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.

20755 lines
551KB

  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. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrusher
  392. Reduce audio bit resolution.
  393. This filter is bit crusher with enhanced functionality. A bit crusher
  394. is used to audibly reduce number of bits an audio signal is sampled
  395. with. This doesn't change the bit depth at all, it just produces the
  396. effect. Material reduced in bit depth sounds more harsh and "digital".
  397. This filter is able to even round to continuous values instead of discrete
  398. bit depths.
  399. Additionally it has a D/C offset which results in different crushing of
  400. the lower and the upper half of the signal.
  401. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  402. Another feature of this filter is the logarithmic mode.
  403. This setting switches from linear distances between bits to logarithmic ones.
  404. The result is a much more "natural" sounding crusher which doesn't gate low
  405. signals for example. The human ear has a logarithmic perception,
  406. so this kind of crushing is much more pleasant.
  407. Logarithmic crushing is also able to get anti-aliased.
  408. The filter accepts the following options:
  409. @table @option
  410. @item level_in
  411. Set level in.
  412. @item level_out
  413. Set level out.
  414. @item bits
  415. Set bit reduction.
  416. @item mix
  417. Set mixing amount.
  418. @item mode
  419. Can be linear: @code{lin} or logarithmic: @code{log}.
  420. @item dc
  421. Set DC.
  422. @item aa
  423. Set anti-aliasing.
  424. @item samples
  425. Set sample reduction.
  426. @item lfo
  427. Enable LFO. By default disabled.
  428. @item lforange
  429. Set LFO range.
  430. @item lforate
  431. Set LFO rate.
  432. @end table
  433. @section adelay
  434. Delay one or more audio channels.
  435. Samples in delayed channel are filled with silence.
  436. The filter accepts the following option:
  437. @table @option
  438. @item delays
  439. Set list of delays in milliseconds for each channel separated by '|'.
  440. Unused delays will be silently ignored. If number of given delays is
  441. smaller than number of channels all remaining channels will not be delayed.
  442. If you want to delay exact number of samples, append 'S' to number.
  443. @end table
  444. @subsection Examples
  445. @itemize
  446. @item
  447. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  448. the second channel (and any other channels that may be present) unchanged.
  449. @example
  450. adelay=1500|0|500
  451. @end example
  452. @item
  453. Delay second channel by 500 samples, the third channel by 700 samples and leave
  454. the first channel (and any other channels that may be present) unchanged.
  455. @example
  456. adelay=0|500S|700S
  457. @end example
  458. @end itemize
  459. @section aderivative, aintegral
  460. Compute derivative/integral of audio stream.
  461. Applying both filters one after another produces original audio.
  462. @section aecho
  463. Apply echoing to the input audio.
  464. Echoes are reflected sound and can occur naturally amongst mountains
  465. (and sometimes large buildings) when talking or shouting; digital echo
  466. effects emulate this behaviour and are often used to help fill out the
  467. sound of a single instrument or vocal. The time difference between the
  468. original signal and the reflection is the @code{delay}, and the
  469. loudness of the reflected signal is the @code{decay}.
  470. Multiple echoes can have different delays and decays.
  471. A description of the accepted parameters follows.
  472. @table @option
  473. @item in_gain
  474. Set input gain of reflected signal. Default is @code{0.6}.
  475. @item out_gain
  476. Set output gain of reflected signal. Default is @code{0.3}.
  477. @item delays
  478. Set list of time intervals in milliseconds between original signal and reflections
  479. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  480. Default is @code{1000}.
  481. @item decays
  482. Set list of loudness of reflected signals separated by '|'.
  483. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  484. Default is @code{0.5}.
  485. @end table
  486. @subsection Examples
  487. @itemize
  488. @item
  489. Make it sound as if there are twice as many instruments as are actually playing:
  490. @example
  491. aecho=0.8:0.88:60:0.4
  492. @end example
  493. @item
  494. If delay is very short, then it sound like a (metallic) robot playing music:
  495. @example
  496. aecho=0.8:0.88:6:0.4
  497. @end example
  498. @item
  499. A longer delay will sound like an open air concert in the mountains:
  500. @example
  501. aecho=0.8:0.9:1000:0.3
  502. @end example
  503. @item
  504. Same as above but with one more mountain:
  505. @example
  506. aecho=0.8:0.9:1000|1800:0.3|0.25
  507. @end example
  508. @end itemize
  509. @section aemphasis
  510. Audio emphasis filter creates or restores material directly taken from LPs or
  511. emphased CDs with different filter curves. E.g. to store music on vinyl the
  512. signal has to be altered by a filter first to even out the disadvantages of
  513. this recording medium.
  514. Once the material is played back the inverse filter has to be applied to
  515. restore the distortion of the frequency response.
  516. The filter accepts the following options:
  517. @table @option
  518. @item level_in
  519. Set input gain.
  520. @item level_out
  521. Set output gain.
  522. @item mode
  523. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  524. use @code{production} mode. Default is @code{reproduction} mode.
  525. @item type
  526. Set filter type. Selects medium. Can be one of the following:
  527. @table @option
  528. @item col
  529. select Columbia.
  530. @item emi
  531. select EMI.
  532. @item bsi
  533. select BSI (78RPM).
  534. @item riaa
  535. select RIAA.
  536. @item cd
  537. select Compact Disc (CD).
  538. @item 50fm
  539. select 50µs (FM).
  540. @item 75fm
  541. select 75µs (FM).
  542. @item 50kf
  543. select 50µs (FM-KF).
  544. @item 75kf
  545. select 75µs (FM-KF).
  546. @end table
  547. @end table
  548. @section aeval
  549. Modify an audio signal according to the specified expressions.
  550. This filter accepts one or more expressions (one for each channel),
  551. which are evaluated and used to modify a corresponding audio signal.
  552. It accepts the following parameters:
  553. @table @option
  554. @item exprs
  555. Set the '|'-separated expressions list for each separate channel. If
  556. the number of input channels is greater than the number of
  557. expressions, the last specified expression is used for the remaining
  558. output channels.
  559. @item channel_layout, c
  560. Set output channel layout. If not specified, the channel layout is
  561. specified by the number of expressions. If set to @samp{same}, it will
  562. use by default the same input channel layout.
  563. @end table
  564. Each expression in @var{exprs} can contain the following constants and functions:
  565. @table @option
  566. @item ch
  567. channel number of the current expression
  568. @item n
  569. number of the evaluated sample, starting from 0
  570. @item s
  571. sample rate
  572. @item t
  573. time of the evaluated sample expressed in seconds
  574. @item nb_in_channels
  575. @item nb_out_channels
  576. input and output number of channels
  577. @item val(CH)
  578. the value of input channel with number @var{CH}
  579. @end table
  580. Note: this filter is slow. For faster processing you should use a
  581. dedicated filter.
  582. @subsection Examples
  583. @itemize
  584. @item
  585. Half volume:
  586. @example
  587. aeval=val(ch)/2:c=same
  588. @end example
  589. @item
  590. Invert phase of the second channel:
  591. @example
  592. aeval=val(0)|-val(1)
  593. @end example
  594. @end itemize
  595. @anchor{afade}
  596. @section afade
  597. Apply fade-in/out effect to input audio.
  598. A description of the accepted parameters follows.
  599. @table @option
  600. @item type, t
  601. Specify the effect type, can be either @code{in} for fade-in, or
  602. @code{out} for a fade-out effect. Default is @code{in}.
  603. @item start_sample, ss
  604. Specify the number of the start sample for starting to apply the fade
  605. effect. Default is 0.
  606. @item nb_samples, ns
  607. Specify the number of samples for which the fade effect has to last. At
  608. the end of the fade-in effect the output audio will have the same
  609. volume as the input audio, at the end of the fade-out transition
  610. the output audio will be silence. Default is 44100.
  611. @item start_time, st
  612. Specify the start time of the fade effect. Default is 0.
  613. The value must be specified as a time duration; see
  614. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  615. for the accepted syntax.
  616. If set this option is used instead of @var{start_sample}.
  617. @item duration, d
  618. Specify the duration of the fade effect. See
  619. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  620. for the accepted syntax.
  621. At the end of the fade-in effect the output audio will have the same
  622. volume as the input audio, at the end of the fade-out transition
  623. the output audio will be silence.
  624. By default the duration is determined by @var{nb_samples}.
  625. If set this option is used instead of @var{nb_samples}.
  626. @item curve
  627. Set curve for fade transition.
  628. It accepts the following values:
  629. @table @option
  630. @item tri
  631. select triangular, linear slope (default)
  632. @item qsin
  633. select quarter of sine wave
  634. @item hsin
  635. select half of sine wave
  636. @item esin
  637. select exponential sine wave
  638. @item log
  639. select logarithmic
  640. @item ipar
  641. select inverted parabola
  642. @item qua
  643. select quadratic
  644. @item cub
  645. select cubic
  646. @item squ
  647. select square root
  648. @item cbr
  649. select cubic root
  650. @item par
  651. select parabola
  652. @item exp
  653. select exponential
  654. @item iqsin
  655. select inverted quarter of sine wave
  656. @item ihsin
  657. select inverted half of sine wave
  658. @item dese
  659. select double-exponential seat
  660. @item desi
  661. select double-exponential sigmoid
  662. @end table
  663. @end table
  664. @subsection Examples
  665. @itemize
  666. @item
  667. Fade in first 15 seconds of audio:
  668. @example
  669. afade=t=in:ss=0:d=15
  670. @end example
  671. @item
  672. Fade out last 25 seconds of a 900 seconds audio:
  673. @example
  674. afade=t=out:st=875:d=25
  675. @end example
  676. @end itemize
  677. @section afftfilt
  678. Apply arbitrary expressions to samples in frequency domain.
  679. @table @option
  680. @item real
  681. Set frequency domain real expression for each separate channel separated
  682. by '|'. Default is "1".
  683. If the number of input channels is greater than the number of
  684. expressions, the last specified expression is used for the remaining
  685. output channels.
  686. @item imag
  687. Set frequency domain imaginary expression for each separate channel
  688. separated by '|'. If not set, @var{real} option is used.
  689. Each expression in @var{real} and @var{imag} can contain the following
  690. constants:
  691. @table @option
  692. @item sr
  693. sample rate
  694. @item b
  695. current frequency bin number
  696. @item nb
  697. number of available bins
  698. @item ch
  699. channel number of the current expression
  700. @item chs
  701. number of channels
  702. @item pts
  703. current frame pts
  704. @end table
  705. @item win_size
  706. Set window size.
  707. It accepts the following values:
  708. @table @samp
  709. @item w16
  710. @item w32
  711. @item w64
  712. @item w128
  713. @item w256
  714. @item w512
  715. @item w1024
  716. @item w2048
  717. @item w4096
  718. @item w8192
  719. @item w16384
  720. @item w32768
  721. @item w65536
  722. @end table
  723. Default is @code{w4096}
  724. @item win_func
  725. Set window function. Default is @code{hann}.
  726. @item overlap
  727. Set window overlap. If set to 1, the recommended overlap for selected
  728. window function will be picked. Default is @code{0.75}.
  729. @end table
  730. @subsection Examples
  731. @itemize
  732. @item
  733. Leave almost only low frequencies in audio:
  734. @example
  735. afftfilt="1-clip((b/nb)*b,0,1)"
  736. @end example
  737. @end itemize
  738. @anchor{afir}
  739. @section afir
  740. Apply an arbitrary Frequency Impulse Response filter.
  741. This filter is designed for applying long FIR filters,
  742. up to 30 seconds long.
  743. It can be used as component for digital crossover filters,
  744. room equalization, cross talk cancellation, wavefield synthesis,
  745. auralization, ambiophonics and ambisonics.
  746. This filter uses second stream as FIR coefficients.
  747. If second stream holds single channel, it will be used
  748. for all input channels in first stream, otherwise
  749. number of channels in second stream must be same as
  750. number of channels in first stream.
  751. It accepts the following parameters:
  752. @table @option
  753. @item dry
  754. Set dry gain. This sets input gain.
  755. @item wet
  756. Set wet gain. This sets final output gain.
  757. @item length
  758. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  759. @item again
  760. Enable applying gain measured from power of IR.
  761. @item maxir
  762. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  763. Allowed range is 0.1 to 60 seconds.
  764. @item response
  765. Show IR frequency reponse, magnitude and phase in additional video stream.
  766. By default it is disabled.
  767. @item channel
  768. Set for which IR channel to display frequency response. By default is first channel
  769. displayed. This option is used only when @var{response} is enabled.
  770. @item size
  771. Set video stream size. This option is used only when @var{response} is enabled.
  772. @end table
  773. @subsection Examples
  774. @itemize
  775. @item
  776. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  777. @example
  778. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  779. @end example
  780. @end itemize
  781. @anchor{aformat}
  782. @section aformat
  783. Set output format constraints for the input audio. The framework will
  784. negotiate the most appropriate format to minimize conversions.
  785. It accepts the following parameters:
  786. @table @option
  787. @item sample_fmts
  788. A '|'-separated list of requested sample formats.
  789. @item sample_rates
  790. A '|'-separated list of requested sample rates.
  791. @item channel_layouts
  792. A '|'-separated list of requested channel layouts.
  793. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  794. for the required syntax.
  795. @end table
  796. If a parameter is omitted, all values are allowed.
  797. Force the output to either unsigned 8-bit or signed 16-bit stereo
  798. @example
  799. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  800. @end example
  801. @section agate
  802. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  803. processing reduces disturbing noise between useful signals.
  804. Gating is done by detecting the volume below a chosen level @var{threshold}
  805. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  806. floor is set via @var{range}. Because an exact manipulation of the signal
  807. would cause distortion of the waveform the reduction can be levelled over
  808. time. This is done by setting @var{attack} and @var{release}.
  809. @var{attack} determines how long the signal has to fall below the threshold
  810. before any reduction will occur and @var{release} sets the time the signal
  811. has to rise above the threshold to reduce the reduction again.
  812. Shorter signals than the chosen attack time will be left untouched.
  813. @table @option
  814. @item level_in
  815. Set input level before filtering.
  816. Default is 1. Allowed range is from 0.015625 to 64.
  817. @item range
  818. Set the level of gain reduction when the signal is below the threshold.
  819. Default is 0.06125. Allowed range is from 0 to 1.
  820. @item threshold
  821. If a signal rises above this level the gain reduction is released.
  822. Default is 0.125. Allowed range is from 0 to 1.
  823. @item ratio
  824. Set a ratio by which the signal is reduced.
  825. Default is 2. Allowed range is from 1 to 9000.
  826. @item attack
  827. Amount of milliseconds the signal has to rise above the threshold before gain
  828. reduction stops.
  829. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  830. @item release
  831. Amount of milliseconds the signal has to fall below the threshold before the
  832. reduction is increased again. Default is 250 milliseconds.
  833. Allowed range is from 0.01 to 9000.
  834. @item makeup
  835. Set amount of amplification of signal after processing.
  836. Default is 1. Allowed range is from 1 to 64.
  837. @item knee
  838. Curve the sharp knee around the threshold to enter gain reduction more softly.
  839. Default is 2.828427125. Allowed range is from 1 to 8.
  840. @item detection
  841. Choose if exact signal should be taken for detection or an RMS like one.
  842. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  843. @item link
  844. Choose if the average level between all channels or the louder channel affects
  845. the reduction.
  846. Default is @code{average}. Can be @code{average} or @code{maximum}.
  847. @end table
  848. @section aiir
  849. Apply an arbitrary Infinite Impulse Response filter.
  850. It accepts the following parameters:
  851. @table @option
  852. @item z
  853. Set numerator/zeros coefficients.
  854. @item p
  855. Set denominator/poles coefficients.
  856. @item k
  857. Set channels gains.
  858. @item dry_gain
  859. Set input gain.
  860. @item wet_gain
  861. Set output gain.
  862. @item f
  863. Set coefficients format.
  864. @table @samp
  865. @item tf
  866. transfer function
  867. @item zp
  868. Z-plane zeros/poles, cartesian (default)
  869. @item pr
  870. Z-plane zeros/poles, polar radians
  871. @item pd
  872. Z-plane zeros/poles, polar degrees
  873. @end table
  874. @item r
  875. Set kind of processing.
  876. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  877. @item e
  878. Set filtering precision.
  879. @table @samp
  880. @item dbl
  881. double-precision floating-point (default)
  882. @item flt
  883. single-precision floating-point
  884. @item i32
  885. 32-bit integers
  886. @item i16
  887. 16-bit integers
  888. @end table
  889. @item response
  890. Show IR frequency reponse, magnitude and phase in additional video stream.
  891. By default it is disabled.
  892. @item channel
  893. Set for which IR channel to display frequency response. By default is first channel
  894. displayed. This option is used only when @var{response} is enabled.
  895. @item size
  896. Set video stream size. This option is used only when @var{response} is enabled.
  897. @end table
  898. Coefficients in @code{tf} format are separated by spaces and are in ascending
  899. order.
  900. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  901. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  902. imaginary unit.
  903. Different coefficients and gains can be provided for every channel, in such case
  904. use '|' to separate coefficients or gains. Last provided coefficients will be
  905. used for all remaining channels.
  906. @subsection Examples
  907. @itemize
  908. @item
  909. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  910. @example
  911. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  912. @end example
  913. @item
  914. Same as above but in @code{zp} format:
  915. @example
  916. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  917. @end example
  918. @end itemize
  919. @section alimiter
  920. The limiter prevents an input signal from rising over a desired threshold.
  921. This limiter uses lookahead technology to prevent your signal from distorting.
  922. It means that there is a small delay after the signal is processed. Keep in mind
  923. that the delay it produces is the attack time you set.
  924. The filter accepts the following options:
  925. @table @option
  926. @item level_in
  927. Set input gain. Default is 1.
  928. @item level_out
  929. Set output gain. Default is 1.
  930. @item limit
  931. Don't let signals above this level pass the limiter. Default is 1.
  932. @item attack
  933. The limiter will reach its attenuation level in this amount of time in
  934. milliseconds. Default is 5 milliseconds.
  935. @item release
  936. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  937. Default is 50 milliseconds.
  938. @item asc
  939. When gain reduction is always needed ASC takes care of releasing to an
  940. average reduction level rather than reaching a reduction of 0 in the release
  941. time.
  942. @item asc_level
  943. Select how much the release time is affected by ASC, 0 means nearly no changes
  944. in release time while 1 produces higher release times.
  945. @item level
  946. Auto level output signal. Default is enabled.
  947. This normalizes audio back to 0dB if enabled.
  948. @end table
  949. Depending on picked setting it is recommended to upsample input 2x or 4x times
  950. with @ref{aresample} before applying this filter.
  951. @section allpass
  952. Apply a two-pole all-pass filter with central frequency (in Hz)
  953. @var{frequency}, and filter-width @var{width}.
  954. An all-pass filter changes the audio's frequency to phase relationship
  955. without changing its frequency to amplitude relationship.
  956. The filter accepts the following options:
  957. @table @option
  958. @item frequency, f
  959. Set frequency in Hz.
  960. @item width_type, t
  961. Set method to specify band-width of filter.
  962. @table @option
  963. @item h
  964. Hz
  965. @item q
  966. Q-Factor
  967. @item o
  968. octave
  969. @item s
  970. slope
  971. @item k
  972. kHz
  973. @end table
  974. @item width, w
  975. Specify the band-width of a filter in width_type units.
  976. @item channels, c
  977. Specify which channels to filter, by default all available are filtered.
  978. @end table
  979. @subsection Commands
  980. This filter supports the following commands:
  981. @table @option
  982. @item frequency, f
  983. Change allpass frequency.
  984. Syntax for the command is : "@var{frequency}"
  985. @item width_type, t
  986. Change allpass width_type.
  987. Syntax for the command is : "@var{width_type}"
  988. @item width, w
  989. Change allpass width.
  990. Syntax for the command is : "@var{width}"
  991. @end table
  992. @section aloop
  993. Loop audio samples.
  994. The filter accepts the following options:
  995. @table @option
  996. @item loop
  997. Set the number of loops. Setting this value to -1 will result in infinite loops.
  998. Default is 0.
  999. @item size
  1000. Set maximal number of samples. Default is 0.
  1001. @item start
  1002. Set first sample of loop. Default is 0.
  1003. @end table
  1004. @anchor{amerge}
  1005. @section amerge
  1006. Merge two or more audio streams into a single multi-channel stream.
  1007. The filter accepts the following options:
  1008. @table @option
  1009. @item inputs
  1010. Set the number of inputs. Default is 2.
  1011. @end table
  1012. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1013. the channel layout of the output will be set accordingly and the channels
  1014. will be reordered as necessary. If the channel layouts of the inputs are not
  1015. disjoint, the output will have all the channels of the first input then all
  1016. the channels of the second input, in that order, and the channel layout of
  1017. the output will be the default value corresponding to the total number of
  1018. channels.
  1019. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1020. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1021. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1022. first input, b1 is the first channel of the second input).
  1023. On the other hand, if both input are in stereo, the output channels will be
  1024. in the default order: a1, a2, b1, b2, and the channel layout will be
  1025. arbitrarily set to 4.0, which may or may not be the expected value.
  1026. All inputs must have the same sample rate, and format.
  1027. If inputs do not have the same duration, the output will stop with the
  1028. shortest.
  1029. @subsection Examples
  1030. @itemize
  1031. @item
  1032. Merge two mono files into a stereo stream:
  1033. @example
  1034. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1035. @end example
  1036. @item
  1037. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1038. @example
  1039. 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
  1040. @end example
  1041. @end itemize
  1042. @section amix
  1043. Mixes multiple audio inputs into a single output.
  1044. Note that this filter only supports float samples (the @var{amerge}
  1045. and @var{pan} audio filters support many formats). If the @var{amix}
  1046. input has integer samples then @ref{aresample} will be automatically
  1047. inserted to perform the conversion to float samples.
  1048. For example
  1049. @example
  1050. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1051. @end example
  1052. will mix 3 input audio streams to a single output with the same duration as the
  1053. first input and a dropout transition time of 3 seconds.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item inputs
  1057. The number of inputs. If unspecified, it defaults to 2.
  1058. @item duration
  1059. How to determine the end-of-stream.
  1060. @table @option
  1061. @item longest
  1062. The duration of the longest input. (default)
  1063. @item shortest
  1064. The duration of the shortest input.
  1065. @item first
  1066. The duration of the first input.
  1067. @end table
  1068. @item dropout_transition
  1069. The transition time, in seconds, for volume renormalization when an input
  1070. stream ends. The default value is 2 seconds.
  1071. @item weights
  1072. Specify weight of each input audio stream as sequence.
  1073. Each weight is separated by space. By default all inputs have same weight.
  1074. @end table
  1075. @section anequalizer
  1076. High-order parametric multiband equalizer for each channel.
  1077. It accepts the following parameters:
  1078. @table @option
  1079. @item params
  1080. This option string is in format:
  1081. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1082. Each equalizer band is separated by '|'.
  1083. @table @option
  1084. @item chn
  1085. Set channel number to which equalization will be applied.
  1086. If input doesn't have that channel the entry is ignored.
  1087. @item f
  1088. Set central frequency for band.
  1089. If input doesn't have that frequency the entry is ignored.
  1090. @item w
  1091. Set band width in hertz.
  1092. @item g
  1093. Set band gain in dB.
  1094. @item t
  1095. Set filter type for band, optional, can be:
  1096. @table @samp
  1097. @item 0
  1098. Butterworth, this is default.
  1099. @item 1
  1100. Chebyshev type 1.
  1101. @item 2
  1102. Chebyshev type 2.
  1103. @end table
  1104. @end table
  1105. @item curves
  1106. With this option activated frequency response of anequalizer is displayed
  1107. in video stream.
  1108. @item size
  1109. Set video stream size. Only useful if curves option is activated.
  1110. @item mgain
  1111. Set max gain that will be displayed. Only useful if curves option is activated.
  1112. Setting this to a reasonable value makes it possible to display gain which is derived from
  1113. neighbour bands which are too close to each other and thus produce higher gain
  1114. when both are activated.
  1115. @item fscale
  1116. Set frequency scale used to draw frequency response in video output.
  1117. Can be linear or logarithmic. Default is logarithmic.
  1118. @item colors
  1119. Set color for each channel curve which is going to be displayed in video stream.
  1120. This is list of color names separated by space or by '|'.
  1121. Unrecognised or missing colors will be replaced by white color.
  1122. @end table
  1123. @subsection Examples
  1124. @itemize
  1125. @item
  1126. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1127. for first 2 channels using Chebyshev type 1 filter:
  1128. @example
  1129. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1130. @end example
  1131. @end itemize
  1132. @subsection Commands
  1133. This filter supports the following commands:
  1134. @table @option
  1135. @item change
  1136. Alter existing filter parameters.
  1137. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1138. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1139. error is returned.
  1140. @var{freq} set new frequency parameter.
  1141. @var{width} set new width parameter in herz.
  1142. @var{gain} set new gain parameter in dB.
  1143. Full filter invocation with asendcmd may look like this:
  1144. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1145. @end table
  1146. @section anull
  1147. Pass the audio source unchanged to the output.
  1148. @section apad
  1149. Pad the end of an audio stream with silence.
  1150. This can be used together with @command{ffmpeg} @option{-shortest} to
  1151. extend audio streams to the same length as the video stream.
  1152. A description of the accepted options follows.
  1153. @table @option
  1154. @item packet_size
  1155. Set silence packet size. Default value is 4096.
  1156. @item pad_len
  1157. Set the number of samples of silence to add to the end. After the
  1158. value is reached, the stream is terminated. This option is mutually
  1159. exclusive with @option{whole_len}.
  1160. @item whole_len
  1161. Set the minimum total number of samples in the output audio stream. If
  1162. the value is longer than the input audio length, silence is added to
  1163. the end, until the value is reached. This option is mutually exclusive
  1164. with @option{pad_len}.
  1165. @end table
  1166. If neither the @option{pad_len} nor the @option{whole_len} option is
  1167. set, the filter will add silence to the end of the input stream
  1168. indefinitely.
  1169. @subsection Examples
  1170. @itemize
  1171. @item
  1172. Add 1024 samples of silence to the end of the input:
  1173. @example
  1174. apad=pad_len=1024
  1175. @end example
  1176. @item
  1177. Make sure the audio output will contain at least 10000 samples, pad
  1178. the input with silence if required:
  1179. @example
  1180. apad=whole_len=10000
  1181. @end example
  1182. @item
  1183. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1184. video stream will always result the shortest and will be converted
  1185. until the end in the output file when using the @option{shortest}
  1186. option:
  1187. @example
  1188. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1189. @end example
  1190. @end itemize
  1191. @section aphaser
  1192. Add a phasing effect to the input audio.
  1193. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1194. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1195. A description of the accepted parameters follows.
  1196. @table @option
  1197. @item in_gain
  1198. Set input gain. Default is 0.4.
  1199. @item out_gain
  1200. Set output gain. Default is 0.74
  1201. @item delay
  1202. Set delay in milliseconds. Default is 3.0.
  1203. @item decay
  1204. Set decay. Default is 0.4.
  1205. @item speed
  1206. Set modulation speed in Hz. Default is 0.5.
  1207. @item type
  1208. Set modulation type. Default is triangular.
  1209. It accepts the following values:
  1210. @table @samp
  1211. @item triangular, t
  1212. @item sinusoidal, s
  1213. @end table
  1214. @end table
  1215. @section apulsator
  1216. Audio pulsator is something between an autopanner and a tremolo.
  1217. But it can produce funny stereo effects as well. Pulsator changes the volume
  1218. of the left and right channel based on a LFO (low frequency oscillator) with
  1219. different waveforms and shifted phases.
  1220. This filter have the ability to define an offset between left and right
  1221. channel. An offset of 0 means that both LFO shapes match each other.
  1222. The left and right channel are altered equally - a conventional tremolo.
  1223. An offset of 50% means that the shape of the right channel is exactly shifted
  1224. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1225. an autopanner. At 1 both curves match again. Every setting in between moves the
  1226. phase shift gapless between all stages and produces some "bypassing" sounds with
  1227. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1228. the 0.5) the faster the signal passes from the left to the right speaker.
  1229. The filter accepts the following options:
  1230. @table @option
  1231. @item level_in
  1232. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1233. @item level_out
  1234. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1235. @item mode
  1236. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1237. sawup or sawdown. Default is sine.
  1238. @item amount
  1239. Set modulation. Define how much of original signal is affected by the LFO.
  1240. @item offset_l
  1241. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1242. @item offset_r
  1243. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1244. @item width
  1245. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1246. @item timing
  1247. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1248. @item bpm
  1249. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1250. is set to bpm.
  1251. @item ms
  1252. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1253. is set to ms.
  1254. @item hz
  1255. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1256. if timing is set to hz.
  1257. @end table
  1258. @anchor{aresample}
  1259. @section aresample
  1260. Resample the input audio to the specified parameters, using the
  1261. libswresample library. If none are specified then the filter will
  1262. automatically convert between its input and output.
  1263. This filter is also able to stretch/squeeze the audio data to make it match
  1264. the timestamps or to inject silence / cut out audio to make it match the
  1265. timestamps, do a combination of both or do neither.
  1266. The filter accepts the syntax
  1267. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1268. expresses a sample rate and @var{resampler_options} is a list of
  1269. @var{key}=@var{value} pairs, separated by ":". See the
  1270. @ref{Resampler Options,,"Resampler Options" section in the
  1271. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1272. for the complete list of supported options.
  1273. @subsection Examples
  1274. @itemize
  1275. @item
  1276. Resample the input audio to 44100Hz:
  1277. @example
  1278. aresample=44100
  1279. @end example
  1280. @item
  1281. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1282. samples per second compensation:
  1283. @example
  1284. aresample=async=1000
  1285. @end example
  1286. @end itemize
  1287. @section areverse
  1288. Reverse an audio clip.
  1289. Warning: This filter requires memory to buffer the entire clip, so trimming
  1290. is suggested.
  1291. @subsection Examples
  1292. @itemize
  1293. @item
  1294. Take the first 5 seconds of a clip, and reverse it.
  1295. @example
  1296. atrim=end=5,areverse
  1297. @end example
  1298. @end itemize
  1299. @section asetnsamples
  1300. Set the number of samples per each output audio frame.
  1301. The last output packet may contain a different number of samples, as
  1302. the filter will flush all the remaining samples when the input audio
  1303. signals its end.
  1304. The filter accepts the following options:
  1305. @table @option
  1306. @item nb_out_samples, n
  1307. Set the number of frames per each output audio frame. The number is
  1308. intended as the number of samples @emph{per each channel}.
  1309. Default value is 1024.
  1310. @item pad, p
  1311. If set to 1, the filter will pad the last audio frame with zeroes, so
  1312. that the last frame will contain the same number of samples as the
  1313. previous ones. Default value is 1.
  1314. @end table
  1315. For example, to set the number of per-frame samples to 1234 and
  1316. disable padding for the last frame, use:
  1317. @example
  1318. asetnsamples=n=1234:p=0
  1319. @end example
  1320. @section asetrate
  1321. Set the sample rate without altering the PCM data.
  1322. This will result in a change of speed and pitch.
  1323. The filter accepts the following options:
  1324. @table @option
  1325. @item sample_rate, r
  1326. Set the output sample rate. Default is 44100 Hz.
  1327. @end table
  1328. @section ashowinfo
  1329. Show a line containing various information for each input audio frame.
  1330. The input audio is not modified.
  1331. The shown line contains a sequence of key/value pairs of the form
  1332. @var{key}:@var{value}.
  1333. The following values are shown in the output:
  1334. @table @option
  1335. @item n
  1336. The (sequential) number of the input frame, starting from 0.
  1337. @item pts
  1338. The presentation timestamp of the input frame, in time base units; the time base
  1339. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1340. @item pts_time
  1341. The presentation timestamp of the input frame in seconds.
  1342. @item pos
  1343. position of the frame in the input stream, -1 if this information in
  1344. unavailable and/or meaningless (for example in case of synthetic audio)
  1345. @item fmt
  1346. The sample format.
  1347. @item chlayout
  1348. The channel layout.
  1349. @item rate
  1350. The sample rate for the audio frame.
  1351. @item nb_samples
  1352. The number of samples (per channel) in the frame.
  1353. @item checksum
  1354. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1355. audio, the data is treated as if all the planes were concatenated.
  1356. @item plane_checksums
  1357. A list of Adler-32 checksums for each data plane.
  1358. @end table
  1359. @anchor{astats}
  1360. @section astats
  1361. Display time domain statistical information about the audio channels.
  1362. Statistics are calculated and displayed for each audio channel and,
  1363. where applicable, an overall figure is also given.
  1364. It accepts the following option:
  1365. @table @option
  1366. @item length
  1367. Short window length in seconds, used for peak and trough RMS measurement.
  1368. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1369. @item metadata
  1370. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1371. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1372. disabled.
  1373. Available keys for each channel are:
  1374. DC_offset
  1375. Min_level
  1376. Max_level
  1377. Min_difference
  1378. Max_difference
  1379. Mean_difference
  1380. RMS_difference
  1381. Peak_level
  1382. RMS_peak
  1383. RMS_trough
  1384. Crest_factor
  1385. Flat_factor
  1386. Peak_count
  1387. Bit_depth
  1388. Dynamic_range
  1389. and for Overall:
  1390. DC_offset
  1391. Min_level
  1392. Max_level
  1393. Min_difference
  1394. Max_difference
  1395. Mean_difference
  1396. RMS_difference
  1397. Peak_level
  1398. RMS_level
  1399. RMS_peak
  1400. RMS_trough
  1401. Flat_factor
  1402. Peak_count
  1403. Bit_depth
  1404. Number_of_samples
  1405. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1406. this @code{lavfi.astats.Overall.Peak_count}.
  1407. For description what each key means read below.
  1408. @item reset
  1409. Set number of frame after which stats are going to be recalculated.
  1410. Default is disabled.
  1411. @end table
  1412. A description of each shown parameter follows:
  1413. @table @option
  1414. @item DC offset
  1415. Mean amplitude displacement from zero.
  1416. @item Min level
  1417. Minimal sample level.
  1418. @item Max level
  1419. Maximal sample level.
  1420. @item Min difference
  1421. Minimal difference between two consecutive samples.
  1422. @item Max difference
  1423. Maximal difference between two consecutive samples.
  1424. @item Mean difference
  1425. Mean difference between two consecutive samples.
  1426. The average of each difference between two consecutive samples.
  1427. @item RMS difference
  1428. Root Mean Square difference between two consecutive samples.
  1429. @item Peak level dB
  1430. @item RMS level dB
  1431. Standard peak and RMS level measured in dBFS.
  1432. @item RMS peak dB
  1433. @item RMS trough dB
  1434. Peak and trough values for RMS level measured over a short window.
  1435. @item Crest factor
  1436. Standard ratio of peak to RMS level (note: not in dB).
  1437. @item Flat factor
  1438. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1439. (i.e. either @var{Min level} or @var{Max level}).
  1440. @item Peak count
  1441. Number of occasions (not the number of samples) that the signal attained either
  1442. @var{Min level} or @var{Max level}.
  1443. @item Bit depth
  1444. Overall bit depth of audio. Number of bits used for each sample.
  1445. @item Dynamic range
  1446. Measured dynamic range of audio in dB.
  1447. @end table
  1448. @section atempo
  1449. Adjust audio tempo.
  1450. The filter accepts exactly one parameter, the audio tempo. If not
  1451. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1452. be in the [0.5, 2.0] range.
  1453. @subsection Examples
  1454. @itemize
  1455. @item
  1456. Slow down audio to 80% tempo:
  1457. @example
  1458. atempo=0.8
  1459. @end example
  1460. @item
  1461. To speed up audio to 125% tempo:
  1462. @example
  1463. atempo=1.25
  1464. @end example
  1465. @end itemize
  1466. @section atrim
  1467. Trim the input so that the output contains one continuous subpart of the input.
  1468. It accepts the following parameters:
  1469. @table @option
  1470. @item start
  1471. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1472. sample with the timestamp @var{start} will be the first sample in the output.
  1473. @item end
  1474. Specify time of the first audio sample that will be dropped, i.e. the
  1475. audio sample immediately preceding the one with the timestamp @var{end} will be
  1476. the last sample in the output.
  1477. @item start_pts
  1478. Same as @var{start}, except this option sets the start timestamp in samples
  1479. instead of seconds.
  1480. @item end_pts
  1481. Same as @var{end}, except this option sets the end timestamp in samples instead
  1482. of seconds.
  1483. @item duration
  1484. The maximum duration of the output in seconds.
  1485. @item start_sample
  1486. The number of the first sample that should be output.
  1487. @item end_sample
  1488. The number of the first sample that should be dropped.
  1489. @end table
  1490. @option{start}, @option{end}, and @option{duration} are expressed as time
  1491. duration specifications; see
  1492. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1493. Note that the first two sets of the start/end options and the @option{duration}
  1494. option look at the frame timestamp, while the _sample options simply count the
  1495. samples that pass through the filter. So start/end_pts and start/end_sample will
  1496. give different results when the timestamps are wrong, inexact or do not start at
  1497. zero. Also note that this filter does not modify the timestamps. If you wish
  1498. to have the output timestamps start at zero, insert the asetpts filter after the
  1499. atrim filter.
  1500. If multiple start or end options are set, this filter tries to be greedy and
  1501. keep all samples that match at least one of the specified constraints. To keep
  1502. only the part that matches all the constraints at once, chain multiple atrim
  1503. filters.
  1504. The defaults are such that all the input is kept. So it is possible to set e.g.
  1505. just the end values to keep everything before the specified time.
  1506. Examples:
  1507. @itemize
  1508. @item
  1509. Drop everything except the second minute of input:
  1510. @example
  1511. ffmpeg -i INPUT -af atrim=60:120
  1512. @end example
  1513. @item
  1514. Keep only the first 1000 samples:
  1515. @example
  1516. ffmpeg -i INPUT -af atrim=end_sample=1000
  1517. @end example
  1518. @end itemize
  1519. @section bandpass
  1520. Apply a two-pole Butterworth band-pass filter with central
  1521. frequency @var{frequency}, and (3dB-point) band-width width.
  1522. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1523. instead of the default: constant 0dB peak gain.
  1524. The filter roll off at 6dB per octave (20dB per decade).
  1525. The filter accepts the following options:
  1526. @table @option
  1527. @item frequency, f
  1528. Set the filter's central frequency. Default is @code{3000}.
  1529. @item csg
  1530. Constant skirt gain if set to 1. Defaults to 0.
  1531. @item width_type, t
  1532. Set method to specify band-width of filter.
  1533. @table @option
  1534. @item h
  1535. Hz
  1536. @item q
  1537. Q-Factor
  1538. @item o
  1539. octave
  1540. @item s
  1541. slope
  1542. @item k
  1543. kHz
  1544. @end table
  1545. @item width, w
  1546. Specify the band-width of a filter in width_type units.
  1547. @item channels, c
  1548. Specify which channels to filter, by default all available are filtered.
  1549. @end table
  1550. @subsection Commands
  1551. This filter supports the following commands:
  1552. @table @option
  1553. @item frequency, f
  1554. Change bandpass frequency.
  1555. Syntax for the command is : "@var{frequency}"
  1556. @item width_type, t
  1557. Change bandpass width_type.
  1558. Syntax for the command is : "@var{width_type}"
  1559. @item width, w
  1560. Change bandpass width.
  1561. Syntax for the command is : "@var{width}"
  1562. @end table
  1563. @section bandreject
  1564. Apply a two-pole Butterworth band-reject filter with central
  1565. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1566. The filter roll off at 6dB per octave (20dB per decade).
  1567. The filter accepts the following options:
  1568. @table @option
  1569. @item frequency, f
  1570. Set the filter's central frequency. Default is @code{3000}.
  1571. @item width_type, t
  1572. Set method to specify band-width of filter.
  1573. @table @option
  1574. @item h
  1575. Hz
  1576. @item q
  1577. Q-Factor
  1578. @item o
  1579. octave
  1580. @item s
  1581. slope
  1582. @item k
  1583. kHz
  1584. @end table
  1585. @item width, w
  1586. Specify the band-width of a filter in width_type units.
  1587. @item channels, c
  1588. Specify which channels to filter, by default all available are filtered.
  1589. @end table
  1590. @subsection Commands
  1591. This filter supports the following commands:
  1592. @table @option
  1593. @item frequency, f
  1594. Change bandreject frequency.
  1595. Syntax for the command is : "@var{frequency}"
  1596. @item width_type, t
  1597. Change bandreject width_type.
  1598. Syntax for the command is : "@var{width_type}"
  1599. @item width, w
  1600. Change bandreject width.
  1601. Syntax for the command is : "@var{width}"
  1602. @end table
  1603. @section bass, lowshelf
  1604. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1605. shelving filter with a response similar to that of a standard
  1606. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1607. The filter accepts the following options:
  1608. @table @option
  1609. @item gain, g
  1610. Give the gain at 0 Hz. Its useful range is about -20
  1611. (for a large cut) to +20 (for a large boost).
  1612. Beware of clipping when using a positive gain.
  1613. @item frequency, f
  1614. Set the filter's central frequency and so can be used
  1615. to extend or reduce the frequency range to be boosted or cut.
  1616. The default value is @code{100} Hz.
  1617. @item width_type, t
  1618. Set method to specify band-width of filter.
  1619. @table @option
  1620. @item h
  1621. Hz
  1622. @item q
  1623. Q-Factor
  1624. @item o
  1625. octave
  1626. @item s
  1627. slope
  1628. @item k
  1629. kHz
  1630. @end table
  1631. @item width, w
  1632. Determine how steep is the filter's shelf transition.
  1633. @item channels, c
  1634. Specify which channels to filter, by default all available are filtered.
  1635. @end table
  1636. @subsection Commands
  1637. This filter supports the following commands:
  1638. @table @option
  1639. @item frequency, f
  1640. Change bass frequency.
  1641. Syntax for the command is : "@var{frequency}"
  1642. @item width_type, t
  1643. Change bass width_type.
  1644. Syntax for the command is : "@var{width_type}"
  1645. @item width, w
  1646. Change bass width.
  1647. Syntax for the command is : "@var{width}"
  1648. @item gain, g
  1649. Change bass gain.
  1650. Syntax for the command is : "@var{gain}"
  1651. @end table
  1652. @section biquad
  1653. Apply a biquad IIR filter with the given coefficients.
  1654. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1655. are the numerator and denominator coefficients respectively.
  1656. and @var{channels}, @var{c} specify which channels to filter, by default all
  1657. available are filtered.
  1658. @subsection Commands
  1659. This filter supports the following commands:
  1660. @table @option
  1661. @item a0
  1662. @item a1
  1663. @item a2
  1664. @item b0
  1665. @item b1
  1666. @item b2
  1667. Change biquad parameter.
  1668. Syntax for the command is : "@var{value}"
  1669. @end table
  1670. @section bs2b
  1671. Bauer stereo to binaural transformation, which improves headphone listening of
  1672. stereo audio records.
  1673. To enable compilation of this filter you need to configure FFmpeg with
  1674. @code{--enable-libbs2b}.
  1675. It accepts the following parameters:
  1676. @table @option
  1677. @item profile
  1678. Pre-defined crossfeed level.
  1679. @table @option
  1680. @item default
  1681. Default level (fcut=700, feed=50).
  1682. @item cmoy
  1683. Chu Moy circuit (fcut=700, feed=60).
  1684. @item jmeier
  1685. Jan Meier circuit (fcut=650, feed=95).
  1686. @end table
  1687. @item fcut
  1688. Cut frequency (in Hz).
  1689. @item feed
  1690. Feed level (in Hz).
  1691. @end table
  1692. @section channelmap
  1693. Remap input channels to new locations.
  1694. It accepts the following parameters:
  1695. @table @option
  1696. @item map
  1697. Map channels from input to output. The argument is a '|'-separated list of
  1698. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1699. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1700. channel (e.g. FL for front left) or its index in the input channel layout.
  1701. @var{out_channel} is the name of the output channel or its index in the output
  1702. channel layout. If @var{out_channel} is not given then it is implicitly an
  1703. index, starting with zero and increasing by one for each mapping.
  1704. @item channel_layout
  1705. The channel layout of the output stream.
  1706. @end table
  1707. If no mapping is present, the filter will implicitly map input channels to
  1708. output channels, preserving indices.
  1709. @subsection Examples
  1710. @itemize
  1711. @item
  1712. For example, assuming a 5.1+downmix input MOV file,
  1713. @example
  1714. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1715. @end example
  1716. will create an output WAV file tagged as stereo from the downmix channels of
  1717. the input.
  1718. @item
  1719. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1720. @example
  1721. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1722. @end example
  1723. @end itemize
  1724. @section channelsplit
  1725. Split each channel from an input audio stream into a separate output stream.
  1726. It accepts the following parameters:
  1727. @table @option
  1728. @item channel_layout
  1729. The channel layout of the input stream. The default is "stereo".
  1730. @item channels
  1731. A channel layout describing the channels to be extracted as separate output streams
  1732. or "all" to extract each input channel as a separate stream. The default is "all".
  1733. Choosing channels not present in channel layout in the input will result in an error.
  1734. @end table
  1735. @subsection Examples
  1736. @itemize
  1737. @item
  1738. For example, assuming a stereo input MP3 file,
  1739. @example
  1740. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1741. @end example
  1742. will create an output Matroska file with two audio streams, one containing only
  1743. the left channel and the other the right channel.
  1744. @item
  1745. Split a 5.1 WAV file into per-channel files:
  1746. @example
  1747. ffmpeg -i in.wav -filter_complex
  1748. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1749. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1750. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1751. side_right.wav
  1752. @end example
  1753. @item
  1754. Extract only LFE from a 5.1 WAV file:
  1755. @example
  1756. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1757. -map '[LFE]' lfe.wav
  1758. @end example
  1759. @end itemize
  1760. @section chorus
  1761. Add a chorus effect to the audio.
  1762. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1763. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1764. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1765. The modulation depth defines the range the modulated delay is played before or after
  1766. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1767. sound tuned around the original one, like in a chorus where some vocals are slightly
  1768. off key.
  1769. It accepts the following parameters:
  1770. @table @option
  1771. @item in_gain
  1772. Set input gain. Default is 0.4.
  1773. @item out_gain
  1774. Set output gain. Default is 0.4.
  1775. @item delays
  1776. Set delays. A typical delay is around 40ms to 60ms.
  1777. @item decays
  1778. Set decays.
  1779. @item speeds
  1780. Set speeds.
  1781. @item depths
  1782. Set depths.
  1783. @end table
  1784. @subsection Examples
  1785. @itemize
  1786. @item
  1787. A single delay:
  1788. @example
  1789. chorus=0.7:0.9:55:0.4:0.25:2
  1790. @end example
  1791. @item
  1792. Two delays:
  1793. @example
  1794. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1795. @end example
  1796. @item
  1797. Fuller sounding chorus with three delays:
  1798. @example
  1799. 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
  1800. @end example
  1801. @end itemize
  1802. @section compand
  1803. Compress or expand the audio's dynamic range.
  1804. It accepts the following parameters:
  1805. @table @option
  1806. @item attacks
  1807. @item decays
  1808. A list of times in seconds for each channel over which the instantaneous level
  1809. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1810. increase of volume and @var{decays} refers to decrease of volume. For most
  1811. situations, the attack time (response to the audio getting louder) should be
  1812. shorter than the decay time, because the human ear is more sensitive to sudden
  1813. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1814. a typical value for decay is 0.8 seconds.
  1815. If specified number of attacks & decays is lower than number of channels, the last
  1816. set attack/decay will be used for all remaining channels.
  1817. @item points
  1818. A list of points for the transfer function, specified in dB relative to the
  1819. maximum possible signal amplitude. Each key points list must be defined using
  1820. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1821. @code{x0/y0 x1/y1 x2/y2 ....}
  1822. The input values must be in strictly increasing order but the transfer function
  1823. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1824. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1825. function are @code{-70/-70|-60/-20|1/0}.
  1826. @item soft-knee
  1827. Set the curve radius in dB for all joints. It defaults to 0.01.
  1828. @item gain
  1829. Set the additional gain in dB to be applied at all points on the transfer
  1830. function. This allows for easy adjustment of the overall gain.
  1831. It defaults to 0.
  1832. @item volume
  1833. Set an initial volume, in dB, to be assumed for each channel when filtering
  1834. starts. This permits the user to supply a nominal level initially, so that, for
  1835. example, a very large gain is not applied to initial signal levels before the
  1836. companding has begun to operate. A typical value for audio which is initially
  1837. quiet is -90 dB. It defaults to 0.
  1838. @item delay
  1839. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1840. delayed before being fed to the volume adjuster. Specifying a delay
  1841. approximately equal to the attack/decay times allows the filter to effectively
  1842. operate in predictive rather than reactive mode. It defaults to 0.
  1843. @end table
  1844. @subsection Examples
  1845. @itemize
  1846. @item
  1847. Make music with both quiet and loud passages suitable for listening to in a
  1848. noisy environment:
  1849. @example
  1850. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1851. @end example
  1852. Another example for audio with whisper and explosion parts:
  1853. @example
  1854. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1855. @end example
  1856. @item
  1857. A noise gate for when the noise is at a lower level than the signal:
  1858. @example
  1859. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1860. @end example
  1861. @item
  1862. Here is another noise gate, this time for when the noise is at a higher level
  1863. than the signal (making it, in some ways, similar to squelch):
  1864. @example
  1865. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1866. @end example
  1867. @item
  1868. 2:1 compression starting at -6dB:
  1869. @example
  1870. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1871. @end example
  1872. @item
  1873. 2:1 compression starting at -9dB:
  1874. @example
  1875. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1876. @end example
  1877. @item
  1878. 2:1 compression starting at -12dB:
  1879. @example
  1880. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1881. @end example
  1882. @item
  1883. 2:1 compression starting at -18dB:
  1884. @example
  1885. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1886. @end example
  1887. @item
  1888. 3:1 compression starting at -15dB:
  1889. @example
  1890. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1891. @end example
  1892. @item
  1893. Compressor/Gate:
  1894. @example
  1895. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1896. @end example
  1897. @item
  1898. Expander:
  1899. @example
  1900. 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
  1901. @end example
  1902. @item
  1903. Hard limiter at -6dB:
  1904. @example
  1905. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1906. @end example
  1907. @item
  1908. Hard limiter at -12dB:
  1909. @example
  1910. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1911. @end example
  1912. @item
  1913. Hard noise gate at -35 dB:
  1914. @example
  1915. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1916. @end example
  1917. @item
  1918. Soft limiter:
  1919. @example
  1920. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1921. @end example
  1922. @end itemize
  1923. @section compensationdelay
  1924. Compensation Delay Line is a metric based delay to compensate differing
  1925. positions of microphones or speakers.
  1926. For example, you have recorded guitar with two microphones placed in
  1927. different location. Because the front of sound wave has fixed speed in
  1928. normal conditions, the phasing of microphones can vary and depends on
  1929. their location and interposition. The best sound mix can be achieved when
  1930. these microphones are in phase (synchronized). Note that distance of
  1931. ~30 cm between microphones makes one microphone to capture signal in
  1932. antiphase to another microphone. That makes the final mix sounding moody.
  1933. This filter helps to solve phasing problems by adding different delays
  1934. to each microphone track and make them synchronized.
  1935. The best result can be reached when you take one track as base and
  1936. synchronize other tracks one by one with it.
  1937. Remember that synchronization/delay tolerance depends on sample rate, too.
  1938. Higher sample rates will give more tolerance.
  1939. It accepts the following parameters:
  1940. @table @option
  1941. @item mm
  1942. Set millimeters distance. This is compensation distance for fine tuning.
  1943. Default is 0.
  1944. @item cm
  1945. Set cm distance. This is compensation distance for tightening distance setup.
  1946. Default is 0.
  1947. @item m
  1948. Set meters distance. This is compensation distance for hard distance setup.
  1949. Default is 0.
  1950. @item dry
  1951. Set dry amount. Amount of unprocessed (dry) signal.
  1952. Default is 0.
  1953. @item wet
  1954. Set wet amount. Amount of processed (wet) signal.
  1955. Default is 1.
  1956. @item temp
  1957. Set temperature degree in Celsius. This is the temperature of the environment.
  1958. Default is 20.
  1959. @end table
  1960. @section crossfeed
  1961. Apply headphone crossfeed filter.
  1962. Crossfeed is the process of blending the left and right channels of stereo
  1963. audio recording.
  1964. It is mainly used to reduce extreme stereo separation of low frequencies.
  1965. The intent is to produce more speaker like sound to the listener.
  1966. The filter accepts the following options:
  1967. @table @option
  1968. @item strength
  1969. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1970. This sets gain of low shelf filter for side part of stereo image.
  1971. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1972. @item range
  1973. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1974. This sets cut off frequency of low shelf filter. Default is cut off near
  1975. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1976. @item level_in
  1977. Set input gain. Default is 0.9.
  1978. @item level_out
  1979. Set output gain. Default is 1.
  1980. @end table
  1981. @section crystalizer
  1982. Simple algorithm to expand audio dynamic range.
  1983. The filter accepts the following options:
  1984. @table @option
  1985. @item i
  1986. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1987. (unchanged sound) to 10.0 (maximum effect).
  1988. @item c
  1989. Enable clipping. By default is enabled.
  1990. @end table
  1991. @section dcshift
  1992. Apply a DC shift to the audio.
  1993. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1994. in the recording chain) from the audio. The effect of a DC offset is reduced
  1995. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1996. a signal has a DC offset.
  1997. @table @option
  1998. @item shift
  1999. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2000. the audio.
  2001. @item limitergain
  2002. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2003. used to prevent clipping.
  2004. @end table
  2005. @section drmeter
  2006. Measure audio dynamic range.
  2007. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2008. is found in transition material. And anything less that 8 have very poor dynamics
  2009. and is very compressed.
  2010. The filter accepts the following options:
  2011. @table @option
  2012. @item length
  2013. Set window length in seconds used to split audio into segments of equal length.
  2014. Default is 3 seconds.
  2015. @end table
  2016. @section dynaudnorm
  2017. Dynamic Audio Normalizer.
  2018. This filter applies a certain amount of gain to the input audio in order
  2019. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2020. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2021. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2022. This allows for applying extra gain to the "quiet" sections of the audio
  2023. while avoiding distortions or clipping the "loud" sections. In other words:
  2024. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2025. sections, in the sense that the volume of each section is brought to the
  2026. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2027. this goal *without* applying "dynamic range compressing". It will retain 100%
  2028. of the dynamic range *within* each section of the audio file.
  2029. @table @option
  2030. @item f
  2031. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2032. Default is 500 milliseconds.
  2033. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2034. referred to as frames. This is required, because a peak magnitude has no
  2035. meaning for just a single sample value. Instead, we need to determine the
  2036. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2037. normalizer would simply use the peak magnitude of the complete file, the
  2038. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2039. frame. The length of a frame is specified in milliseconds. By default, the
  2040. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2041. been found to give good results with most files.
  2042. Note that the exact frame length, in number of samples, will be determined
  2043. automatically, based on the sampling rate of the individual input audio file.
  2044. @item g
  2045. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2046. number. Default is 31.
  2047. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2048. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2049. is specified in frames, centered around the current frame. For the sake of
  2050. simplicity, this must be an odd number. Consequently, the default value of 31
  2051. takes into account the current frame, as well as the 15 preceding frames and
  2052. the 15 subsequent frames. Using a larger window results in a stronger
  2053. smoothing effect and thus in less gain variation, i.e. slower gain
  2054. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2055. effect and thus in more gain variation, i.e. faster gain adaptation.
  2056. In other words, the more you increase this value, the more the Dynamic Audio
  2057. Normalizer will behave like a "traditional" normalization filter. On the
  2058. contrary, the more you decrease this value, the more the Dynamic Audio
  2059. Normalizer will behave like a dynamic range compressor.
  2060. @item p
  2061. Set the target peak value. This specifies the highest permissible magnitude
  2062. level for the normalized audio input. This filter will try to approach the
  2063. target peak magnitude as closely as possible, but at the same time it also
  2064. makes sure that the normalized signal will never exceed the peak magnitude.
  2065. A frame's maximum local gain factor is imposed directly by the target peak
  2066. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2067. It is not recommended to go above this value.
  2068. @item m
  2069. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2070. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2071. factor for each input frame, i.e. the maximum gain factor that does not
  2072. result in clipping or distortion. The maximum gain factor is determined by
  2073. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2074. additionally bounds the frame's maximum gain factor by a predetermined
  2075. (global) maximum gain factor. This is done in order to avoid excessive gain
  2076. factors in "silent" or almost silent frames. By default, the maximum gain
  2077. factor is 10.0, For most inputs the default value should be sufficient and
  2078. it usually is not recommended to increase this value. Though, for input
  2079. with an extremely low overall volume level, it may be necessary to allow even
  2080. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2081. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2082. Instead, a "sigmoid" threshold function will be applied. This way, the
  2083. gain factors will smoothly approach the threshold value, but never exceed that
  2084. value.
  2085. @item r
  2086. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2087. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2088. This means that the maximum local gain factor for each frame is defined
  2089. (only) by the frame's highest magnitude sample. This way, the samples can
  2090. be amplified as much as possible without exceeding the maximum signal
  2091. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2092. Normalizer can also take into account the frame's root mean square,
  2093. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2094. determine the power of a time-varying signal. It is therefore considered
  2095. that the RMS is a better approximation of the "perceived loudness" than
  2096. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2097. frames to a constant RMS value, a uniform "perceived loudness" can be
  2098. established. If a target RMS value has been specified, a frame's local gain
  2099. factor is defined as the factor that would result in exactly that RMS value.
  2100. Note, however, that the maximum local gain factor is still restricted by the
  2101. frame's highest magnitude sample, in order to prevent clipping.
  2102. @item n
  2103. Enable channels coupling. By default is enabled.
  2104. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2105. amount. This means the same gain factor will be applied to all channels, i.e.
  2106. the maximum possible gain factor is determined by the "loudest" channel.
  2107. However, in some recordings, it may happen that the volume of the different
  2108. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2109. In this case, this option can be used to disable the channel coupling. This way,
  2110. the gain factor will be determined independently for each channel, depending
  2111. only on the individual channel's highest magnitude sample. This allows for
  2112. harmonizing the volume of the different channels.
  2113. @item c
  2114. Enable DC bias correction. By default is disabled.
  2115. An audio signal (in the time domain) is a sequence of sample values.
  2116. In the Dynamic Audio Normalizer these sample values are represented in the
  2117. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2118. audio signal, or "waveform", should be centered around the zero point.
  2119. That means if we calculate the mean value of all samples in a file, or in a
  2120. single frame, then the result should be 0.0 or at least very close to that
  2121. value. If, however, there is a significant deviation of the mean value from
  2122. 0.0, in either positive or negative direction, this is referred to as a
  2123. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2124. Audio Normalizer provides optional DC bias correction.
  2125. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2126. the mean value, or "DC correction" offset, of each input frame and subtract
  2127. that value from all of the frame's sample values which ensures those samples
  2128. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2129. boundaries, the DC correction offset values will be interpolated smoothly
  2130. between neighbouring frames.
  2131. @item b
  2132. Enable alternative boundary mode. By default is disabled.
  2133. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2134. around each frame. This includes the preceding frames as well as the
  2135. subsequent frames. However, for the "boundary" frames, located at the very
  2136. beginning and at the very end of the audio file, not all neighbouring
  2137. frames are available. In particular, for the first few frames in the audio
  2138. file, the preceding frames are not known. And, similarly, for the last few
  2139. frames in the audio file, the subsequent frames are not known. Thus, the
  2140. question arises which gain factors should be assumed for the missing frames
  2141. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2142. to deal with this situation. The default boundary mode assumes a gain factor
  2143. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2144. "fade out" at the beginning and at the end of the input, respectively.
  2145. @item s
  2146. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2147. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2148. compression. This means that signal peaks will not be pruned and thus the
  2149. full dynamic range will be retained within each local neighbourhood. However,
  2150. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2151. normalization algorithm with a more "traditional" compression.
  2152. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2153. (thresholding) function. If (and only if) the compression feature is enabled,
  2154. all input frames will be processed by a soft knee thresholding function prior
  2155. to the actual normalization process. Put simply, the thresholding function is
  2156. going to prune all samples whose magnitude exceeds a certain threshold value.
  2157. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2158. value. Instead, the threshold value will be adjusted for each individual
  2159. frame.
  2160. In general, smaller parameters result in stronger compression, and vice versa.
  2161. Values below 3.0 are not recommended, because audible distortion may appear.
  2162. @end table
  2163. @section earwax
  2164. Make audio easier to listen to on headphones.
  2165. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2166. so that when listened to on headphones the stereo image is moved from
  2167. inside your head (standard for headphones) to outside and in front of
  2168. the listener (standard for speakers).
  2169. Ported from SoX.
  2170. @section equalizer
  2171. Apply a two-pole peaking equalisation (EQ) filter. With this
  2172. filter, the signal-level at and around a selected frequency can
  2173. be increased or decreased, whilst (unlike bandpass and bandreject
  2174. filters) that at all other frequencies is unchanged.
  2175. In order to produce complex equalisation curves, this filter can
  2176. be given several times, each with a different central frequency.
  2177. The filter accepts the following options:
  2178. @table @option
  2179. @item frequency, f
  2180. Set the filter's central frequency in Hz.
  2181. @item width_type, t
  2182. Set method to specify band-width of filter.
  2183. @table @option
  2184. @item h
  2185. Hz
  2186. @item q
  2187. Q-Factor
  2188. @item o
  2189. octave
  2190. @item s
  2191. slope
  2192. @item k
  2193. kHz
  2194. @end table
  2195. @item width, w
  2196. Specify the band-width of a filter in width_type units.
  2197. @item gain, g
  2198. Set the required gain or attenuation in dB.
  2199. Beware of clipping when using a positive gain.
  2200. @item channels, c
  2201. Specify which channels to filter, by default all available are filtered.
  2202. @end table
  2203. @subsection Examples
  2204. @itemize
  2205. @item
  2206. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2207. @example
  2208. equalizer=f=1000:t=h:width=200:g=-10
  2209. @end example
  2210. @item
  2211. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2212. @example
  2213. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2214. @end example
  2215. @end itemize
  2216. @subsection Commands
  2217. This filter supports the following commands:
  2218. @table @option
  2219. @item frequency, f
  2220. Change equalizer frequency.
  2221. Syntax for the command is : "@var{frequency}"
  2222. @item width_type, t
  2223. Change equalizer width_type.
  2224. Syntax for the command is : "@var{width_type}"
  2225. @item width, w
  2226. Change equalizer width.
  2227. Syntax for the command is : "@var{width}"
  2228. @item gain, g
  2229. Change equalizer gain.
  2230. Syntax for the command is : "@var{gain}"
  2231. @end table
  2232. @section extrastereo
  2233. Linearly increases the difference between left and right channels which
  2234. adds some sort of "live" effect to playback.
  2235. The filter accepts the following options:
  2236. @table @option
  2237. @item m
  2238. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2239. (average of both channels), with 1.0 sound will be unchanged, with
  2240. -1.0 left and right channels will be swapped.
  2241. @item c
  2242. Enable clipping. By default is enabled.
  2243. @end table
  2244. @section firequalizer
  2245. Apply FIR Equalization using arbitrary frequency response.
  2246. The filter accepts the following option:
  2247. @table @option
  2248. @item gain
  2249. Set gain curve equation (in dB). The expression can contain variables:
  2250. @table @option
  2251. @item f
  2252. the evaluated frequency
  2253. @item sr
  2254. sample rate
  2255. @item ch
  2256. channel number, set to 0 when multichannels evaluation is disabled
  2257. @item chid
  2258. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2259. multichannels evaluation is disabled
  2260. @item chs
  2261. number of channels
  2262. @item chlayout
  2263. channel_layout, see libavutil/channel_layout.h
  2264. @end table
  2265. and functions:
  2266. @table @option
  2267. @item gain_interpolate(f)
  2268. interpolate gain on frequency f based on gain_entry
  2269. @item cubic_interpolate(f)
  2270. same as gain_interpolate, but smoother
  2271. @end table
  2272. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2273. @item gain_entry
  2274. Set gain entry for gain_interpolate function. The expression can
  2275. contain functions:
  2276. @table @option
  2277. @item entry(f, g)
  2278. store gain entry at frequency f with value g
  2279. @end table
  2280. This option is also available as command.
  2281. @item delay
  2282. Set filter delay in seconds. Higher value means more accurate.
  2283. Default is @code{0.01}.
  2284. @item accuracy
  2285. Set filter accuracy in Hz. Lower value means more accurate.
  2286. Default is @code{5}.
  2287. @item wfunc
  2288. Set window function. Acceptable values are:
  2289. @table @option
  2290. @item rectangular
  2291. rectangular window, useful when gain curve is already smooth
  2292. @item hann
  2293. hann window (default)
  2294. @item hamming
  2295. hamming window
  2296. @item blackman
  2297. blackman window
  2298. @item nuttall3
  2299. 3-terms continuous 1st derivative nuttall window
  2300. @item mnuttall3
  2301. minimum 3-terms discontinuous nuttall window
  2302. @item nuttall
  2303. 4-terms continuous 1st derivative nuttall window
  2304. @item bnuttall
  2305. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2306. @item bharris
  2307. blackman-harris window
  2308. @item tukey
  2309. tukey window
  2310. @end table
  2311. @item fixed
  2312. If enabled, use fixed number of audio samples. This improves speed when
  2313. filtering with large delay. Default is disabled.
  2314. @item multi
  2315. Enable multichannels evaluation on gain. Default is disabled.
  2316. @item zero_phase
  2317. Enable zero phase mode by subtracting timestamp to compensate delay.
  2318. Default is disabled.
  2319. @item scale
  2320. Set scale used by gain. Acceptable values are:
  2321. @table @option
  2322. @item linlin
  2323. linear frequency, linear gain
  2324. @item linlog
  2325. linear frequency, logarithmic (in dB) gain (default)
  2326. @item loglin
  2327. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2328. @item loglog
  2329. logarithmic frequency, logarithmic gain
  2330. @end table
  2331. @item dumpfile
  2332. Set file for dumping, suitable for gnuplot.
  2333. @item dumpscale
  2334. Set scale for dumpfile. Acceptable values are same with scale option.
  2335. Default is linlog.
  2336. @item fft2
  2337. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2338. Default is disabled.
  2339. @item min_phase
  2340. Enable minimum phase impulse response. Default is disabled.
  2341. @end table
  2342. @subsection Examples
  2343. @itemize
  2344. @item
  2345. lowpass at 1000 Hz:
  2346. @example
  2347. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2348. @end example
  2349. @item
  2350. lowpass at 1000 Hz with gain_entry:
  2351. @example
  2352. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2353. @end example
  2354. @item
  2355. custom equalization:
  2356. @example
  2357. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2358. @end example
  2359. @item
  2360. higher delay with zero phase to compensate delay:
  2361. @example
  2362. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2363. @end example
  2364. @item
  2365. lowpass on left channel, highpass on right channel:
  2366. @example
  2367. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2368. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2369. @end example
  2370. @end itemize
  2371. @section flanger
  2372. Apply a flanging effect to the audio.
  2373. The filter accepts the following options:
  2374. @table @option
  2375. @item delay
  2376. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2377. @item depth
  2378. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2379. @item regen
  2380. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2381. Default value is 0.
  2382. @item width
  2383. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2384. Default value is 71.
  2385. @item speed
  2386. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2387. @item shape
  2388. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2389. Default value is @var{sinusoidal}.
  2390. @item phase
  2391. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2392. Default value is 25.
  2393. @item interp
  2394. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2395. Default is @var{linear}.
  2396. @end table
  2397. @section haas
  2398. Apply Haas effect to audio.
  2399. Note that this makes most sense to apply on mono signals.
  2400. With this filter applied to mono signals it give some directionality and
  2401. stretches its stereo image.
  2402. The filter accepts the following options:
  2403. @table @option
  2404. @item level_in
  2405. Set input level. By default is @var{1}, or 0dB
  2406. @item level_out
  2407. Set output level. By default is @var{1}, or 0dB.
  2408. @item side_gain
  2409. Set gain applied to side part of signal. By default is @var{1}.
  2410. @item middle_source
  2411. Set kind of middle source. Can be one of the following:
  2412. @table @samp
  2413. @item left
  2414. Pick left channel.
  2415. @item right
  2416. Pick right channel.
  2417. @item mid
  2418. Pick middle part signal of stereo image.
  2419. @item side
  2420. Pick side part signal of stereo image.
  2421. @end table
  2422. @item middle_phase
  2423. Change middle phase. By default is disabled.
  2424. @item left_delay
  2425. Set left channel delay. By default is @var{2.05} milliseconds.
  2426. @item left_balance
  2427. Set left channel balance. By default is @var{-1}.
  2428. @item left_gain
  2429. Set left channel gain. By default is @var{1}.
  2430. @item left_phase
  2431. Change left phase. By default is disabled.
  2432. @item right_delay
  2433. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2434. @item right_balance
  2435. Set right channel balance. By default is @var{1}.
  2436. @item right_gain
  2437. Set right channel gain. By default is @var{1}.
  2438. @item right_phase
  2439. Change right phase. By default is enabled.
  2440. @end table
  2441. @section hdcd
  2442. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2443. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2444. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2445. of HDCD, and detects the Transient Filter flag.
  2446. @example
  2447. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2448. @end example
  2449. When using the filter with wav, note the default encoding for wav is 16-bit,
  2450. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2451. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2452. @example
  2453. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2454. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2455. @end example
  2456. The filter accepts the following options:
  2457. @table @option
  2458. @item disable_autoconvert
  2459. Disable any automatic format conversion or resampling in the filter graph.
  2460. @item process_stereo
  2461. Process the stereo channels together. If target_gain does not match between
  2462. channels, consider it invalid and use the last valid target_gain.
  2463. @item cdt_ms
  2464. Set the code detect timer period in ms.
  2465. @item force_pe
  2466. Always extend peaks above -3dBFS even if PE isn't signaled.
  2467. @item analyze_mode
  2468. Replace audio with a solid tone and adjust the amplitude to signal some
  2469. specific aspect of the decoding process. The output file can be loaded in
  2470. an audio editor alongside the original to aid analysis.
  2471. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2472. Modes are:
  2473. @table @samp
  2474. @item 0, off
  2475. Disabled
  2476. @item 1, lle
  2477. Gain adjustment level at each sample
  2478. @item 2, pe
  2479. Samples where peak extend occurs
  2480. @item 3, cdt
  2481. Samples where the code detect timer is active
  2482. @item 4, tgm
  2483. Samples where the target gain does not match between channels
  2484. @end table
  2485. @end table
  2486. @section headphone
  2487. Apply head-related transfer functions (HRTFs) to create virtual
  2488. loudspeakers around the user for binaural listening via headphones.
  2489. The HRIRs are provided via additional streams, for each channel
  2490. one stereo input stream is needed.
  2491. The filter accepts the following options:
  2492. @table @option
  2493. @item map
  2494. Set mapping of input streams for convolution.
  2495. The argument is a '|'-separated list of channel names in order as they
  2496. are given as additional stream inputs for filter.
  2497. This also specify number of input streams. Number of input streams
  2498. must be not less than number of channels in first stream plus one.
  2499. @item gain
  2500. Set gain applied to audio. Value is in dB. Default is 0.
  2501. @item type
  2502. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2503. processing audio in time domain which is slow.
  2504. @var{freq} is processing audio in frequency domain which is fast.
  2505. Default is @var{freq}.
  2506. @item lfe
  2507. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2508. @item size
  2509. Set size of frame in number of samples which will be processed at once.
  2510. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2511. @item hrir
  2512. Set format of hrir stream.
  2513. Default value is @var{stereo}. Alternative value is @var{multich}.
  2514. If value is set to @var{stereo}, number of additional streams should
  2515. be greater or equal to number of input channels in first input stream.
  2516. Also each additional stream should have stereo number of channels.
  2517. If value is set to @var{multich}, number of additional streams should
  2518. be exactly one. Also number of input channels of additional stream
  2519. should be equal or greater than twice number of channels of first input
  2520. stream.
  2521. @end table
  2522. @subsection Examples
  2523. @itemize
  2524. @item
  2525. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2526. each amovie filter use stereo file with IR coefficients as input.
  2527. The files give coefficients for each position of virtual loudspeaker:
  2528. @example
  2529. 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"
  2530. output.wav
  2531. @end example
  2532. @item
  2533. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2534. but now in @var{multich} @var{hrir} format.
  2535. @example
  2536. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2537. output.wav
  2538. @end example
  2539. @end itemize
  2540. @section highpass
  2541. Apply a high-pass filter with 3dB point frequency.
  2542. The filter can be either single-pole, or double-pole (the default).
  2543. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2544. The filter accepts the following options:
  2545. @table @option
  2546. @item frequency, f
  2547. Set frequency in Hz. Default is 3000.
  2548. @item poles, p
  2549. Set number of poles. Default is 2.
  2550. @item width_type, t
  2551. Set method to specify band-width of filter.
  2552. @table @option
  2553. @item h
  2554. Hz
  2555. @item q
  2556. Q-Factor
  2557. @item o
  2558. octave
  2559. @item s
  2560. slope
  2561. @item k
  2562. kHz
  2563. @end table
  2564. @item width, w
  2565. Specify the band-width of a filter in width_type units.
  2566. Applies only to double-pole filter.
  2567. The default is 0.707q and gives a Butterworth response.
  2568. @item channels, c
  2569. Specify which channels to filter, by default all available are filtered.
  2570. @end table
  2571. @subsection Commands
  2572. This filter supports the following commands:
  2573. @table @option
  2574. @item frequency, f
  2575. Change highpass frequency.
  2576. Syntax for the command is : "@var{frequency}"
  2577. @item width_type, t
  2578. Change highpass width_type.
  2579. Syntax for the command is : "@var{width_type}"
  2580. @item width, w
  2581. Change highpass width.
  2582. Syntax for the command is : "@var{width}"
  2583. @end table
  2584. @section join
  2585. Join multiple input streams into one multi-channel stream.
  2586. It accepts the following parameters:
  2587. @table @option
  2588. @item inputs
  2589. The number of input streams. It defaults to 2.
  2590. @item channel_layout
  2591. The desired output channel layout. It defaults to stereo.
  2592. @item map
  2593. Map channels from inputs to output. The argument is a '|'-separated list of
  2594. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2595. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2596. can be either the name of the input channel (e.g. FL for front left) or its
  2597. index in the specified input stream. @var{out_channel} is the name of the output
  2598. channel.
  2599. @end table
  2600. The filter will attempt to guess the mappings when they are not specified
  2601. explicitly. It does so by first trying to find an unused matching input channel
  2602. and if that fails it picks the first unused input channel.
  2603. Join 3 inputs (with properly set channel layouts):
  2604. @example
  2605. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2606. @end example
  2607. Build a 5.1 output from 6 single-channel streams:
  2608. @example
  2609. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2610. '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'
  2611. out
  2612. @end example
  2613. @section ladspa
  2614. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2615. To enable compilation of this filter you need to configure FFmpeg with
  2616. @code{--enable-ladspa}.
  2617. @table @option
  2618. @item file, f
  2619. Specifies the name of LADSPA plugin library to load. If the environment
  2620. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2621. each one of the directories specified by the colon separated list in
  2622. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2623. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2624. @file{/usr/lib/ladspa/}.
  2625. @item plugin, p
  2626. Specifies the plugin within the library. Some libraries contain only
  2627. one plugin, but others contain many of them. If this is not set filter
  2628. will list all available plugins within the specified library.
  2629. @item controls, c
  2630. Set the '|' separated list of controls which are zero or more floating point
  2631. values that determine the behavior of the loaded plugin (for example delay,
  2632. threshold or gain).
  2633. Controls need to be defined using the following syntax:
  2634. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2635. @var{valuei} is the value set on the @var{i}-th control.
  2636. Alternatively they can be also defined using the following syntax:
  2637. @var{value0}|@var{value1}|@var{value2}|..., where
  2638. @var{valuei} is the value set on the @var{i}-th control.
  2639. If @option{controls} is set to @code{help}, all available controls and
  2640. their valid ranges are printed.
  2641. @item sample_rate, s
  2642. Specify the sample rate, default to 44100. Only used if plugin have
  2643. zero inputs.
  2644. @item nb_samples, n
  2645. Set the number of samples per channel per each output frame, default
  2646. is 1024. Only used if plugin have zero inputs.
  2647. @item duration, d
  2648. Set the minimum duration of the sourced audio. See
  2649. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2650. for the accepted syntax.
  2651. Note that the resulting duration may be greater than the specified duration,
  2652. as the generated audio is always cut at the end of a complete frame.
  2653. If not specified, or the expressed duration is negative, the audio is
  2654. supposed to be generated forever.
  2655. Only used if plugin have zero inputs.
  2656. @end table
  2657. @subsection Examples
  2658. @itemize
  2659. @item
  2660. List all available plugins within amp (LADSPA example plugin) library:
  2661. @example
  2662. ladspa=file=amp
  2663. @end example
  2664. @item
  2665. List all available controls and their valid ranges for @code{vcf_notch}
  2666. plugin from @code{VCF} library:
  2667. @example
  2668. ladspa=f=vcf:p=vcf_notch:c=help
  2669. @end example
  2670. @item
  2671. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2672. plugin library:
  2673. @example
  2674. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2675. @end example
  2676. @item
  2677. Add reverberation to the audio using TAP-plugins
  2678. (Tom's Audio Processing plugins):
  2679. @example
  2680. ladspa=file=tap_reverb:tap_reverb
  2681. @end example
  2682. @item
  2683. Generate white noise, with 0.2 amplitude:
  2684. @example
  2685. ladspa=file=cmt:noise_source_white:c=c0=.2
  2686. @end example
  2687. @item
  2688. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2689. @code{C* Audio Plugin Suite} (CAPS) library:
  2690. @example
  2691. ladspa=file=caps:Click:c=c1=20'
  2692. @end example
  2693. @item
  2694. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2695. @example
  2696. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2697. @end example
  2698. @item
  2699. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2700. @code{SWH Plugins} collection:
  2701. @example
  2702. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2703. @end example
  2704. @item
  2705. Attenuate low frequencies using Multiband EQ from Steve Harris
  2706. @code{SWH Plugins} collection:
  2707. @example
  2708. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2709. @end example
  2710. @item
  2711. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2712. (CAPS) library:
  2713. @example
  2714. ladspa=caps:Narrower
  2715. @end example
  2716. @item
  2717. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2718. @example
  2719. ladspa=caps:White:.2
  2720. @end example
  2721. @item
  2722. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2723. @example
  2724. ladspa=caps:Fractal:c=c1=1
  2725. @end example
  2726. @item
  2727. Dynamic volume normalization using @code{VLevel} plugin:
  2728. @example
  2729. ladspa=vlevel-ladspa:vlevel_mono
  2730. @end example
  2731. @end itemize
  2732. @subsection Commands
  2733. This filter supports the following commands:
  2734. @table @option
  2735. @item cN
  2736. Modify the @var{N}-th control value.
  2737. If the specified value is not valid, it is ignored and prior one is kept.
  2738. @end table
  2739. @section loudnorm
  2740. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2741. Support for both single pass (livestreams, files) and double pass (files) modes.
  2742. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2743. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2744. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2745. The filter accepts the following options:
  2746. @table @option
  2747. @item I, i
  2748. Set integrated loudness target.
  2749. Range is -70.0 - -5.0. Default value is -24.0.
  2750. @item LRA, lra
  2751. Set loudness range target.
  2752. Range is 1.0 - 20.0. Default value is 7.0.
  2753. @item TP, tp
  2754. Set maximum true peak.
  2755. Range is -9.0 - +0.0. Default value is -2.0.
  2756. @item measured_I, measured_i
  2757. Measured IL of input file.
  2758. Range is -99.0 - +0.0.
  2759. @item measured_LRA, measured_lra
  2760. Measured LRA of input file.
  2761. Range is 0.0 - 99.0.
  2762. @item measured_TP, measured_tp
  2763. Measured true peak of input file.
  2764. Range is -99.0 - +99.0.
  2765. @item measured_thresh
  2766. Measured threshold of input file.
  2767. Range is -99.0 - +0.0.
  2768. @item offset
  2769. Set offset gain. Gain is applied before the true-peak limiter.
  2770. Range is -99.0 - +99.0. Default is +0.0.
  2771. @item linear
  2772. Normalize linearly if possible.
  2773. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2774. to be specified in order to use this mode.
  2775. Options are true or false. Default is true.
  2776. @item dual_mono
  2777. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2778. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2779. If set to @code{true}, this option will compensate for this effect.
  2780. Multi-channel input files are not affected by this option.
  2781. Options are true or false. Default is false.
  2782. @item print_format
  2783. Set print format for stats. Options are summary, json, or none.
  2784. Default value is none.
  2785. @end table
  2786. @section lowpass
  2787. Apply a low-pass filter with 3dB point frequency.
  2788. The filter can be either single-pole or double-pole (the default).
  2789. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2790. The filter accepts the following options:
  2791. @table @option
  2792. @item frequency, f
  2793. Set frequency in Hz. Default is 500.
  2794. @item poles, p
  2795. Set number of poles. Default is 2.
  2796. @item width_type, t
  2797. Set method to specify band-width of filter.
  2798. @table @option
  2799. @item h
  2800. Hz
  2801. @item q
  2802. Q-Factor
  2803. @item o
  2804. octave
  2805. @item s
  2806. slope
  2807. @item k
  2808. kHz
  2809. @end table
  2810. @item width, w
  2811. Specify the band-width of a filter in width_type units.
  2812. Applies only to double-pole filter.
  2813. The default is 0.707q and gives a Butterworth response.
  2814. @item channels, c
  2815. Specify which channels to filter, by default all available are filtered.
  2816. @end table
  2817. @subsection Examples
  2818. @itemize
  2819. @item
  2820. Lowpass only LFE channel, it LFE is not present it does nothing:
  2821. @example
  2822. lowpass=c=LFE
  2823. @end example
  2824. @end itemize
  2825. @subsection Commands
  2826. This filter supports the following commands:
  2827. @table @option
  2828. @item frequency, f
  2829. Change lowpass frequency.
  2830. Syntax for the command is : "@var{frequency}"
  2831. @item width_type, t
  2832. Change lowpass width_type.
  2833. Syntax for the command is : "@var{width_type}"
  2834. @item width, w
  2835. Change lowpass width.
  2836. Syntax for the command is : "@var{width}"
  2837. @end table
  2838. @section lv2
  2839. Load a LV2 (LADSPA Version 2) plugin.
  2840. To enable compilation of this filter you need to configure FFmpeg with
  2841. @code{--enable-lv2}.
  2842. @table @option
  2843. @item plugin, p
  2844. Specifies the plugin URI. You may need to escape ':'.
  2845. @item controls, c
  2846. Set the '|' separated list of controls which are zero or more floating point
  2847. values that determine the behavior of the loaded plugin (for example delay,
  2848. threshold or gain).
  2849. If @option{controls} is set to @code{help}, all available controls and
  2850. their valid ranges are printed.
  2851. @item sample_rate, s
  2852. Specify the sample rate, default to 44100. Only used if plugin have
  2853. zero inputs.
  2854. @item nb_samples, n
  2855. Set the number of samples per channel per each output frame, default
  2856. is 1024. Only used if plugin have zero inputs.
  2857. @item duration, d
  2858. Set the minimum duration of the sourced audio. See
  2859. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2860. for the accepted syntax.
  2861. Note that the resulting duration may be greater than the specified duration,
  2862. as the generated audio is always cut at the end of a complete frame.
  2863. If not specified, or the expressed duration is negative, the audio is
  2864. supposed to be generated forever.
  2865. Only used if plugin have zero inputs.
  2866. @end table
  2867. @subsection Examples
  2868. @itemize
  2869. @item
  2870. Apply bass enhancer plugin from Calf:
  2871. @example
  2872. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2873. @end example
  2874. @item
  2875. Apply vinyl plugin from Calf:
  2876. @example
  2877. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2878. @end example
  2879. @item
  2880. Apply bit crusher plugin from ArtyFX:
  2881. @example
  2882. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2883. @end example
  2884. @end itemize
  2885. @section mcompand
  2886. Multiband Compress or expand the audio's dynamic range.
  2887. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2888. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2889. response when absent compander action.
  2890. It accepts the following parameters:
  2891. @table @option
  2892. @item args
  2893. This option syntax is:
  2894. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2895. For explanation of each item refer to compand filter documentation.
  2896. @end table
  2897. @anchor{pan}
  2898. @section pan
  2899. Mix channels with specific gain levels. The filter accepts the output
  2900. channel layout followed by a set of channels definitions.
  2901. This filter is also designed to efficiently remap the channels of an audio
  2902. stream.
  2903. The filter accepts parameters of the form:
  2904. "@var{l}|@var{outdef}|@var{outdef}|..."
  2905. @table @option
  2906. @item l
  2907. output channel layout or number of channels
  2908. @item outdef
  2909. output channel specification, of the form:
  2910. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2911. @item out_name
  2912. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2913. number (c0, c1, etc.)
  2914. @item gain
  2915. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2916. @item in_name
  2917. input channel to use, see out_name for details; it is not possible to mix
  2918. named and numbered input channels
  2919. @end table
  2920. If the `=' in a channel specification is replaced by `<', then the gains for
  2921. that specification will be renormalized so that the total is 1, thus
  2922. avoiding clipping noise.
  2923. @subsection Mixing examples
  2924. For example, if you want to down-mix from stereo to mono, but with a bigger
  2925. factor for the left channel:
  2926. @example
  2927. pan=1c|c0=0.9*c0+0.1*c1
  2928. @end example
  2929. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2930. 7-channels surround:
  2931. @example
  2932. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2933. @end example
  2934. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2935. that should be preferred (see "-ac" option) unless you have very specific
  2936. needs.
  2937. @subsection Remapping examples
  2938. The channel remapping will be effective if, and only if:
  2939. @itemize
  2940. @item gain coefficients are zeroes or ones,
  2941. @item only one input per channel output,
  2942. @end itemize
  2943. If all these conditions are satisfied, the filter will notify the user ("Pure
  2944. channel mapping detected"), and use an optimized and lossless method to do the
  2945. remapping.
  2946. For example, if you have a 5.1 source and want a stereo audio stream by
  2947. dropping the extra channels:
  2948. @example
  2949. pan="stereo| c0=FL | c1=FR"
  2950. @end example
  2951. Given the same source, you can also switch front left and front right channels
  2952. and keep the input channel layout:
  2953. @example
  2954. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2955. @end example
  2956. If the input is a stereo audio stream, you can mute the front left channel (and
  2957. still keep the stereo channel layout) with:
  2958. @example
  2959. pan="stereo|c1=c1"
  2960. @end example
  2961. Still with a stereo audio stream input, you can copy the right channel in both
  2962. front left and right:
  2963. @example
  2964. pan="stereo| c0=FR | c1=FR"
  2965. @end example
  2966. @section replaygain
  2967. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2968. outputs it unchanged.
  2969. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2970. @section resample
  2971. Convert the audio sample format, sample rate and channel layout. It is
  2972. not meant to be used directly.
  2973. @section rubberband
  2974. Apply time-stretching and pitch-shifting with librubberband.
  2975. The filter accepts the following options:
  2976. @table @option
  2977. @item tempo
  2978. Set tempo scale factor.
  2979. @item pitch
  2980. Set pitch scale factor.
  2981. @item transients
  2982. Set transients detector.
  2983. Possible values are:
  2984. @table @var
  2985. @item crisp
  2986. @item mixed
  2987. @item smooth
  2988. @end table
  2989. @item detector
  2990. Set detector.
  2991. Possible values are:
  2992. @table @var
  2993. @item compound
  2994. @item percussive
  2995. @item soft
  2996. @end table
  2997. @item phase
  2998. Set phase.
  2999. Possible values are:
  3000. @table @var
  3001. @item laminar
  3002. @item independent
  3003. @end table
  3004. @item window
  3005. Set processing window size.
  3006. Possible values are:
  3007. @table @var
  3008. @item standard
  3009. @item short
  3010. @item long
  3011. @end table
  3012. @item smoothing
  3013. Set smoothing.
  3014. Possible values are:
  3015. @table @var
  3016. @item off
  3017. @item on
  3018. @end table
  3019. @item formant
  3020. Enable formant preservation when shift pitching.
  3021. Possible values are:
  3022. @table @var
  3023. @item shifted
  3024. @item preserved
  3025. @end table
  3026. @item pitchq
  3027. Set pitch quality.
  3028. Possible values are:
  3029. @table @var
  3030. @item quality
  3031. @item speed
  3032. @item consistency
  3033. @end table
  3034. @item channels
  3035. Set channels.
  3036. Possible values are:
  3037. @table @var
  3038. @item apart
  3039. @item together
  3040. @end table
  3041. @end table
  3042. @section sidechaincompress
  3043. This filter acts like normal compressor but has the ability to compress
  3044. detected signal using second input signal.
  3045. It needs two input streams and returns one output stream.
  3046. First input stream will be processed depending on second stream signal.
  3047. The filtered signal then can be filtered with other filters in later stages of
  3048. processing. See @ref{pan} and @ref{amerge} filter.
  3049. The filter accepts the following options:
  3050. @table @option
  3051. @item level_in
  3052. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3053. @item threshold
  3054. If a signal of second stream raises above this level it will affect the gain
  3055. reduction of first stream.
  3056. By default is 0.125. Range is between 0.00097563 and 1.
  3057. @item ratio
  3058. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3059. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3060. Default is 2. Range is between 1 and 20.
  3061. @item attack
  3062. Amount of milliseconds the signal has to rise above the threshold before gain
  3063. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3064. @item release
  3065. Amount of milliseconds the signal has to fall below the threshold before
  3066. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3067. @item makeup
  3068. Set the amount by how much signal will be amplified after processing.
  3069. Default is 1. Range is from 1 to 64.
  3070. @item knee
  3071. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3072. Default is 2.82843. Range is between 1 and 8.
  3073. @item link
  3074. Choose if the @code{average} level between all channels of side-chain stream
  3075. or the louder(@code{maximum}) channel of side-chain stream affects the
  3076. reduction. Default is @code{average}.
  3077. @item detection
  3078. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3079. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3080. @item level_sc
  3081. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3082. @item mix
  3083. How much to use compressed signal in output. Default is 1.
  3084. Range is between 0 and 1.
  3085. @end table
  3086. @subsection Examples
  3087. @itemize
  3088. @item
  3089. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3090. depending on the signal of 2nd input and later compressed signal to be
  3091. merged with 2nd input:
  3092. @example
  3093. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3094. @end example
  3095. @end itemize
  3096. @section sidechaingate
  3097. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3098. filter the detected signal before sending it to the gain reduction stage.
  3099. Normally a gate uses the full range signal to detect a level above the
  3100. threshold.
  3101. For example: If you cut all lower frequencies from your sidechain signal
  3102. the gate will decrease the volume of your track only if not enough highs
  3103. appear. With this technique you are able to reduce the resonation of a
  3104. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3105. guitar.
  3106. It needs two input streams and returns one output stream.
  3107. First input stream will be processed depending on second stream signal.
  3108. The filter accepts the following options:
  3109. @table @option
  3110. @item level_in
  3111. Set input level before filtering.
  3112. Default is 1. Allowed range is from 0.015625 to 64.
  3113. @item range
  3114. Set the level of gain reduction when the signal is below the threshold.
  3115. Default is 0.06125. Allowed range is from 0 to 1.
  3116. @item threshold
  3117. If a signal rises above this level the gain reduction is released.
  3118. Default is 0.125. Allowed range is from 0 to 1.
  3119. @item ratio
  3120. Set a ratio about which the signal is reduced.
  3121. Default is 2. Allowed range is from 1 to 9000.
  3122. @item attack
  3123. Amount of milliseconds the signal has to rise above the threshold before gain
  3124. reduction stops.
  3125. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3126. @item release
  3127. Amount of milliseconds the signal has to fall below the threshold before the
  3128. reduction is increased again. Default is 250 milliseconds.
  3129. Allowed range is from 0.01 to 9000.
  3130. @item makeup
  3131. Set amount of amplification of signal after processing.
  3132. Default is 1. Allowed range is from 1 to 64.
  3133. @item knee
  3134. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3135. Default is 2.828427125. Allowed range is from 1 to 8.
  3136. @item detection
  3137. Choose if exact signal should be taken for detection or an RMS like one.
  3138. Default is rms. Can be peak or rms.
  3139. @item link
  3140. Choose if the average level between all channels or the louder channel affects
  3141. the reduction.
  3142. Default is average. Can be average or maximum.
  3143. @item level_sc
  3144. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3145. @end table
  3146. @section silencedetect
  3147. Detect silence in an audio stream.
  3148. This filter logs a message when it detects that the input audio volume is less
  3149. or equal to a noise tolerance value for a duration greater or equal to the
  3150. minimum detected noise duration.
  3151. The printed times and duration are expressed in seconds.
  3152. The filter accepts the following options:
  3153. @table @option
  3154. @item duration, d
  3155. Set silence duration until notification (default is 2 seconds).
  3156. @item noise, n
  3157. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3158. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3159. @end table
  3160. @subsection Examples
  3161. @itemize
  3162. @item
  3163. Detect 5 seconds of silence with -50dB noise tolerance:
  3164. @example
  3165. silencedetect=n=-50dB:d=5
  3166. @end example
  3167. @item
  3168. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3169. tolerance in @file{silence.mp3}:
  3170. @example
  3171. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3172. @end example
  3173. @end itemize
  3174. @section silenceremove
  3175. Remove silence from the beginning, middle or end of the audio.
  3176. The filter accepts the following options:
  3177. @table @option
  3178. @item start_periods
  3179. This value is used to indicate if audio should be trimmed at beginning of
  3180. the audio. A value of zero indicates no silence should be trimmed from the
  3181. beginning. When specifying a non-zero value, it trims audio up until it
  3182. finds non-silence. Normally, when trimming silence from beginning of audio
  3183. the @var{start_periods} will be @code{1} but it can be increased to higher
  3184. values to trim all audio up to specific count of non-silence periods.
  3185. Default value is @code{0}.
  3186. @item start_duration
  3187. Specify the amount of time that non-silence must be detected before it stops
  3188. trimming audio. By increasing the duration, bursts of noises can be treated
  3189. as silence and trimmed off. Default value is @code{0}.
  3190. @item start_threshold
  3191. This indicates what sample value should be treated as silence. For digital
  3192. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3193. you may wish to increase the value to account for background noise.
  3194. Can be specified in dB (in case "dB" is appended to the specified value)
  3195. or amplitude ratio. Default value is @code{0}.
  3196. @item stop_periods
  3197. Set the count for trimming silence from the end of audio.
  3198. To remove silence from the middle of a file, specify a @var{stop_periods}
  3199. that is negative. This value is then treated as a positive value and is
  3200. used to indicate the effect should restart processing as specified by
  3201. @var{start_periods}, making it suitable for removing periods of silence
  3202. in the middle of the audio.
  3203. Default value is @code{0}.
  3204. @item stop_duration
  3205. Specify a duration of silence that must exist before audio is not copied any
  3206. more. By specifying a higher duration, silence that is wanted can be left in
  3207. the audio.
  3208. Default value is @code{0}.
  3209. @item stop_threshold
  3210. This is the same as @option{start_threshold} but for trimming silence from
  3211. the end of audio.
  3212. Can be specified in dB (in case "dB" is appended to the specified value)
  3213. or amplitude ratio. Default value is @code{0}.
  3214. @item leave_silence
  3215. This indicates that @var{stop_duration} length of audio should be left intact
  3216. at the beginning of each period of silence.
  3217. For example, if you want to remove long pauses between words but do not want
  3218. to remove the pauses completely. Default value is @code{0}.
  3219. @item detection
  3220. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3221. and works better with digital silence which is exactly 0.
  3222. Default value is @code{rms}.
  3223. @item window
  3224. Set ratio used to calculate size of window for detecting silence.
  3225. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3226. @end table
  3227. @subsection Examples
  3228. @itemize
  3229. @item
  3230. The following example shows how this filter can be used to start a recording
  3231. that does not contain the delay at the start which usually occurs between
  3232. pressing the record button and the start of the performance:
  3233. @example
  3234. silenceremove=1:5:0.02
  3235. @end example
  3236. @item
  3237. Trim all silence encountered from beginning to end where there is more than 1
  3238. second of silence in audio:
  3239. @example
  3240. silenceremove=0:0:0:-1:1:-90dB
  3241. @end example
  3242. @end itemize
  3243. @section sofalizer
  3244. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3245. loudspeakers around the user for binaural listening via headphones (audio
  3246. formats up to 9 channels supported).
  3247. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3248. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3249. Austrian Academy of Sciences.
  3250. To enable compilation of this filter you need to configure FFmpeg with
  3251. @code{--enable-libmysofa}.
  3252. The filter accepts the following options:
  3253. @table @option
  3254. @item sofa
  3255. Set the SOFA file used for rendering.
  3256. @item gain
  3257. Set gain applied to audio. Value is in dB. Default is 0.
  3258. @item rotation
  3259. Set rotation of virtual loudspeakers in deg. Default is 0.
  3260. @item elevation
  3261. Set elevation of virtual speakers in deg. Default is 0.
  3262. @item radius
  3263. Set distance in meters between loudspeakers and the listener with near-field
  3264. HRTFs. Default is 1.
  3265. @item type
  3266. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3267. processing audio in time domain which is slow.
  3268. @var{freq} is processing audio in frequency domain which is fast.
  3269. Default is @var{freq}.
  3270. @item speakers
  3271. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3272. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3273. Each virtual loudspeaker is described with short channel name following with
  3274. azimuth and elevation in degrees.
  3275. Each virtual loudspeaker description is separated by '|'.
  3276. For example to override front left and front right channel positions use:
  3277. 'speakers=FL 45 15|FR 345 15'.
  3278. Descriptions with unrecognised channel names are ignored.
  3279. @item lfegain
  3280. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3281. @end table
  3282. @subsection Examples
  3283. @itemize
  3284. @item
  3285. Using ClubFritz6 sofa file:
  3286. @example
  3287. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3288. @end example
  3289. @item
  3290. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3291. @example
  3292. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3293. @end example
  3294. @item
  3295. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3296. and also with custom gain:
  3297. @example
  3298. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3299. @end example
  3300. @end itemize
  3301. @section stereotools
  3302. This filter has some handy utilities to manage stereo signals, for converting
  3303. M/S stereo recordings to L/R signal while having control over the parameters
  3304. or spreading the stereo image of master track.
  3305. The filter accepts the following options:
  3306. @table @option
  3307. @item level_in
  3308. Set input level before filtering for both channels. Defaults is 1.
  3309. Allowed range is from 0.015625 to 64.
  3310. @item level_out
  3311. Set output level after filtering for both channels. Defaults is 1.
  3312. Allowed range is from 0.015625 to 64.
  3313. @item balance_in
  3314. Set input balance between both channels. Default is 0.
  3315. Allowed range is from -1 to 1.
  3316. @item balance_out
  3317. Set output balance between both channels. Default is 0.
  3318. Allowed range is from -1 to 1.
  3319. @item softclip
  3320. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3321. clipping. Disabled by default.
  3322. @item mutel
  3323. Mute the left channel. Disabled by default.
  3324. @item muter
  3325. Mute the right channel. Disabled by default.
  3326. @item phasel
  3327. Change the phase of the left channel. Disabled by default.
  3328. @item phaser
  3329. Change the phase of the right channel. Disabled by default.
  3330. @item mode
  3331. Set stereo mode. Available values are:
  3332. @table @samp
  3333. @item lr>lr
  3334. Left/Right to Left/Right, this is default.
  3335. @item lr>ms
  3336. Left/Right to Mid/Side.
  3337. @item ms>lr
  3338. Mid/Side to Left/Right.
  3339. @item lr>ll
  3340. Left/Right to Left/Left.
  3341. @item lr>rr
  3342. Left/Right to Right/Right.
  3343. @item lr>l+r
  3344. Left/Right to Left + Right.
  3345. @item lr>rl
  3346. Left/Right to Right/Left.
  3347. @item ms>ll
  3348. Mid/Side to Left/Left.
  3349. @item ms>rr
  3350. Mid/Side to Right/Right.
  3351. @end table
  3352. @item slev
  3353. Set level of side signal. Default is 1.
  3354. Allowed range is from 0.015625 to 64.
  3355. @item sbal
  3356. Set balance of side signal. Default is 0.
  3357. Allowed range is from -1 to 1.
  3358. @item mlev
  3359. Set level of the middle signal. Default is 1.
  3360. Allowed range is from 0.015625 to 64.
  3361. @item mpan
  3362. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3363. @item base
  3364. Set stereo base between mono and inversed channels. Default is 0.
  3365. Allowed range is from -1 to 1.
  3366. @item delay
  3367. Set delay in milliseconds how much to delay left from right channel and
  3368. vice versa. Default is 0. Allowed range is from -20 to 20.
  3369. @item sclevel
  3370. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3371. @item phase
  3372. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3373. @item bmode_in, bmode_out
  3374. Set balance mode for balance_in/balance_out option.
  3375. Can be one of the following:
  3376. @table @samp
  3377. @item balance
  3378. Classic balance mode. Attenuate one channel at time.
  3379. Gain is raised up to 1.
  3380. @item amplitude
  3381. Similar as classic mode above but gain is raised up to 2.
  3382. @item power
  3383. Equal power distribution, from -6dB to +6dB range.
  3384. @end table
  3385. @end table
  3386. @subsection Examples
  3387. @itemize
  3388. @item
  3389. Apply karaoke like effect:
  3390. @example
  3391. stereotools=mlev=0.015625
  3392. @end example
  3393. @item
  3394. Convert M/S signal to L/R:
  3395. @example
  3396. "stereotools=mode=ms>lr"
  3397. @end example
  3398. @end itemize
  3399. @section stereowiden
  3400. This filter enhance the stereo effect by suppressing signal common to both
  3401. channels and by delaying the signal of left into right and vice versa,
  3402. thereby widening the stereo effect.
  3403. The filter accepts the following options:
  3404. @table @option
  3405. @item delay
  3406. Time in milliseconds of the delay of left signal into right and vice versa.
  3407. Default is 20 milliseconds.
  3408. @item feedback
  3409. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3410. effect of left signal in right output and vice versa which gives widening
  3411. effect. Default is 0.3.
  3412. @item crossfeed
  3413. Cross feed of left into right with inverted phase. This helps in suppressing
  3414. the mono. If the value is 1 it will cancel all the signal common to both
  3415. channels. Default is 0.3.
  3416. @item drymix
  3417. Set level of input signal of original channel. Default is 0.8.
  3418. @end table
  3419. @section superequalizer
  3420. Apply 18 band equalizer.
  3421. The filter accepts the following options:
  3422. @table @option
  3423. @item 1b
  3424. Set 65Hz band gain.
  3425. @item 2b
  3426. Set 92Hz band gain.
  3427. @item 3b
  3428. Set 131Hz band gain.
  3429. @item 4b
  3430. Set 185Hz band gain.
  3431. @item 5b
  3432. Set 262Hz band gain.
  3433. @item 6b
  3434. Set 370Hz band gain.
  3435. @item 7b
  3436. Set 523Hz band gain.
  3437. @item 8b
  3438. Set 740Hz band gain.
  3439. @item 9b
  3440. Set 1047Hz band gain.
  3441. @item 10b
  3442. Set 1480Hz band gain.
  3443. @item 11b
  3444. Set 2093Hz band gain.
  3445. @item 12b
  3446. Set 2960Hz band gain.
  3447. @item 13b
  3448. Set 4186Hz band gain.
  3449. @item 14b
  3450. Set 5920Hz band gain.
  3451. @item 15b
  3452. Set 8372Hz band gain.
  3453. @item 16b
  3454. Set 11840Hz band gain.
  3455. @item 17b
  3456. Set 16744Hz band gain.
  3457. @item 18b
  3458. Set 20000Hz band gain.
  3459. @end table
  3460. @section surround
  3461. Apply audio surround upmix filter.
  3462. This filter allows to produce multichannel output from audio stream.
  3463. The filter accepts the following options:
  3464. @table @option
  3465. @item chl_out
  3466. Set output channel layout. By default, this is @var{5.1}.
  3467. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3468. for the required syntax.
  3469. @item chl_in
  3470. Set input channel layout. By default, this is @var{stereo}.
  3471. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3472. for the required syntax.
  3473. @item level_in
  3474. Set input volume level. By default, this is @var{1}.
  3475. @item level_out
  3476. Set output volume level. By default, this is @var{1}.
  3477. @item lfe
  3478. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3479. @item lfe_low
  3480. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3481. @item lfe_high
  3482. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3483. @item fc_in
  3484. Set front center input volume. By default, this is @var{1}.
  3485. @item fc_out
  3486. Set front center output volume. By default, this is @var{1}.
  3487. @item lfe_in
  3488. Set LFE input volume. By default, this is @var{1}.
  3489. @item lfe_out
  3490. Set LFE output volume. By default, this is @var{1}.
  3491. @end table
  3492. @section treble, highshelf
  3493. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3494. shelving filter with a response similar to that of a standard
  3495. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3496. The filter accepts the following options:
  3497. @table @option
  3498. @item gain, g
  3499. Give the gain at whichever is the lower of ~22 kHz and the
  3500. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3501. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3502. @item frequency, f
  3503. Set the filter's central frequency and so can be used
  3504. to extend or reduce the frequency range to be boosted or cut.
  3505. The default value is @code{3000} Hz.
  3506. @item width_type, t
  3507. Set method to specify band-width of filter.
  3508. @table @option
  3509. @item h
  3510. Hz
  3511. @item q
  3512. Q-Factor
  3513. @item o
  3514. octave
  3515. @item s
  3516. slope
  3517. @item k
  3518. kHz
  3519. @end table
  3520. @item width, w
  3521. Determine how steep is the filter's shelf transition.
  3522. @item channels, c
  3523. Specify which channels to filter, by default all available are filtered.
  3524. @end table
  3525. @subsection Commands
  3526. This filter supports the following commands:
  3527. @table @option
  3528. @item frequency, f
  3529. Change treble frequency.
  3530. Syntax for the command is : "@var{frequency}"
  3531. @item width_type, t
  3532. Change treble width_type.
  3533. Syntax for the command is : "@var{width_type}"
  3534. @item width, w
  3535. Change treble width.
  3536. Syntax for the command is : "@var{width}"
  3537. @item gain, g
  3538. Change treble gain.
  3539. Syntax for the command is : "@var{gain}"
  3540. @end table
  3541. @section tremolo
  3542. Sinusoidal amplitude modulation.
  3543. The filter accepts the following options:
  3544. @table @option
  3545. @item f
  3546. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3547. (20 Hz or lower) will result in a tremolo effect.
  3548. This filter may also be used as a ring modulator by specifying
  3549. a modulation frequency higher than 20 Hz.
  3550. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3551. @item d
  3552. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3553. Default value is 0.5.
  3554. @end table
  3555. @section vibrato
  3556. Sinusoidal phase modulation.
  3557. The filter accepts the following options:
  3558. @table @option
  3559. @item f
  3560. Modulation frequency in Hertz.
  3561. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3562. @item d
  3563. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3564. Default value is 0.5.
  3565. @end table
  3566. @section volume
  3567. Adjust the input audio volume.
  3568. It accepts the following parameters:
  3569. @table @option
  3570. @item volume
  3571. Set audio volume expression.
  3572. Output values are clipped to the maximum value.
  3573. The output audio volume is given by the relation:
  3574. @example
  3575. @var{output_volume} = @var{volume} * @var{input_volume}
  3576. @end example
  3577. The default value for @var{volume} is "1.0".
  3578. @item precision
  3579. This parameter represents the mathematical precision.
  3580. It determines which input sample formats will be allowed, which affects the
  3581. precision of the volume scaling.
  3582. @table @option
  3583. @item fixed
  3584. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3585. @item float
  3586. 32-bit floating-point; this limits input sample format to FLT. (default)
  3587. @item double
  3588. 64-bit floating-point; this limits input sample format to DBL.
  3589. @end table
  3590. @item replaygain
  3591. Choose the behaviour on encountering ReplayGain side data in input frames.
  3592. @table @option
  3593. @item drop
  3594. Remove ReplayGain side data, ignoring its contents (the default).
  3595. @item ignore
  3596. Ignore ReplayGain side data, but leave it in the frame.
  3597. @item track
  3598. Prefer the track gain, if present.
  3599. @item album
  3600. Prefer the album gain, if present.
  3601. @end table
  3602. @item replaygain_preamp
  3603. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3604. Default value for @var{replaygain_preamp} is 0.0.
  3605. @item eval
  3606. Set when the volume expression is evaluated.
  3607. It accepts the following values:
  3608. @table @samp
  3609. @item once
  3610. only evaluate expression once during the filter initialization, or
  3611. when the @samp{volume} command is sent
  3612. @item frame
  3613. evaluate expression for each incoming frame
  3614. @end table
  3615. Default value is @samp{once}.
  3616. @end table
  3617. The volume expression can contain the following parameters.
  3618. @table @option
  3619. @item n
  3620. frame number (starting at zero)
  3621. @item nb_channels
  3622. number of channels
  3623. @item nb_consumed_samples
  3624. number of samples consumed by the filter
  3625. @item nb_samples
  3626. number of samples in the current frame
  3627. @item pos
  3628. original frame position in the file
  3629. @item pts
  3630. frame PTS
  3631. @item sample_rate
  3632. sample rate
  3633. @item startpts
  3634. PTS at start of stream
  3635. @item startt
  3636. time at start of stream
  3637. @item t
  3638. frame time
  3639. @item tb
  3640. timestamp timebase
  3641. @item volume
  3642. last set volume value
  3643. @end table
  3644. Note that when @option{eval} is set to @samp{once} only the
  3645. @var{sample_rate} and @var{tb} variables are available, all other
  3646. variables will evaluate to NAN.
  3647. @subsection Commands
  3648. This filter supports the following commands:
  3649. @table @option
  3650. @item volume
  3651. Modify the volume expression.
  3652. The command accepts the same syntax of the corresponding option.
  3653. If the specified expression is not valid, it is kept at its current
  3654. value.
  3655. @item replaygain_noclip
  3656. Prevent clipping by limiting the gain applied.
  3657. Default value for @var{replaygain_noclip} is 1.
  3658. @end table
  3659. @subsection Examples
  3660. @itemize
  3661. @item
  3662. Halve the input audio volume:
  3663. @example
  3664. volume=volume=0.5
  3665. volume=volume=1/2
  3666. volume=volume=-6.0206dB
  3667. @end example
  3668. In all the above example the named key for @option{volume} can be
  3669. omitted, for example like in:
  3670. @example
  3671. volume=0.5
  3672. @end example
  3673. @item
  3674. Increase input audio power by 6 decibels using fixed-point precision:
  3675. @example
  3676. volume=volume=6dB:precision=fixed
  3677. @end example
  3678. @item
  3679. Fade volume after time 10 with an annihilation period of 5 seconds:
  3680. @example
  3681. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3682. @end example
  3683. @end itemize
  3684. @section volumedetect
  3685. Detect the volume of the input video.
  3686. The filter has no parameters. The input is not modified. Statistics about
  3687. the volume will be printed in the log when the input stream end is reached.
  3688. In particular it will show the mean volume (root mean square), maximum
  3689. volume (on a per-sample basis), and the beginning of a histogram of the
  3690. registered volume values (from the maximum value to a cumulated 1/1000 of
  3691. the samples).
  3692. All volumes are in decibels relative to the maximum PCM value.
  3693. @subsection Examples
  3694. Here is an excerpt of the output:
  3695. @example
  3696. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3697. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3698. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3699. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3700. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3701. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3702. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3703. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3704. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3705. @end example
  3706. It means that:
  3707. @itemize
  3708. @item
  3709. The mean square energy is approximately -27 dB, or 10^-2.7.
  3710. @item
  3711. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3712. @item
  3713. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3714. @end itemize
  3715. In other words, raising the volume by +4 dB does not cause any clipping,
  3716. raising it by +5 dB causes clipping for 6 samples, etc.
  3717. @c man end AUDIO FILTERS
  3718. @chapter Audio Sources
  3719. @c man begin AUDIO SOURCES
  3720. Below is a description of the currently available audio sources.
  3721. @section abuffer
  3722. Buffer audio frames, and make them available to the filter chain.
  3723. This source is mainly intended for a programmatic use, in particular
  3724. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3725. It accepts the following parameters:
  3726. @table @option
  3727. @item time_base
  3728. The timebase which will be used for timestamps of submitted frames. It must be
  3729. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3730. @item sample_rate
  3731. The sample rate of the incoming audio buffers.
  3732. @item sample_fmt
  3733. The sample format of the incoming audio buffers.
  3734. Either a sample format name or its corresponding integer representation from
  3735. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3736. @item channel_layout
  3737. The channel layout of the incoming audio buffers.
  3738. Either a channel layout name from channel_layout_map in
  3739. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3740. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3741. @item channels
  3742. The number of channels of the incoming audio buffers.
  3743. If both @var{channels} and @var{channel_layout} are specified, then they
  3744. must be consistent.
  3745. @end table
  3746. @subsection Examples
  3747. @example
  3748. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3749. @end example
  3750. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3751. Since the sample format with name "s16p" corresponds to the number
  3752. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3753. equivalent to:
  3754. @example
  3755. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3756. @end example
  3757. @section aevalsrc
  3758. Generate an audio signal specified by an expression.
  3759. This source accepts in input one or more expressions (one for each
  3760. channel), which are evaluated and used to generate a corresponding
  3761. audio signal.
  3762. This source accepts the following options:
  3763. @table @option
  3764. @item exprs
  3765. Set the '|'-separated expressions list for each separate channel. In case the
  3766. @option{channel_layout} option is not specified, the selected channel layout
  3767. depends on the number of provided expressions. Otherwise the last
  3768. specified expression is applied to the remaining output channels.
  3769. @item channel_layout, c
  3770. Set the channel layout. The number of channels in the specified layout
  3771. must be equal to the number of specified expressions.
  3772. @item duration, d
  3773. Set the minimum duration of the sourced audio. See
  3774. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3775. for the accepted syntax.
  3776. Note that the resulting duration may be greater than the specified
  3777. duration, as the generated audio is always cut at the end of a
  3778. complete frame.
  3779. If not specified, or the expressed duration is negative, the audio is
  3780. supposed to be generated forever.
  3781. @item nb_samples, n
  3782. Set the number of samples per channel per each output frame,
  3783. default to 1024.
  3784. @item sample_rate, s
  3785. Specify the sample rate, default to 44100.
  3786. @end table
  3787. Each expression in @var{exprs} can contain the following constants:
  3788. @table @option
  3789. @item n
  3790. number of the evaluated sample, starting from 0
  3791. @item t
  3792. time of the evaluated sample expressed in seconds, starting from 0
  3793. @item s
  3794. sample rate
  3795. @end table
  3796. @subsection Examples
  3797. @itemize
  3798. @item
  3799. Generate silence:
  3800. @example
  3801. aevalsrc=0
  3802. @end example
  3803. @item
  3804. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3805. 8000 Hz:
  3806. @example
  3807. aevalsrc="sin(440*2*PI*t):s=8000"
  3808. @end example
  3809. @item
  3810. Generate a two channels signal, specify the channel layout (Front
  3811. Center + Back Center) explicitly:
  3812. @example
  3813. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3814. @end example
  3815. @item
  3816. Generate white noise:
  3817. @example
  3818. aevalsrc="-2+random(0)"
  3819. @end example
  3820. @item
  3821. Generate an amplitude modulated signal:
  3822. @example
  3823. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3824. @end example
  3825. @item
  3826. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3827. @example
  3828. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3829. @end example
  3830. @end itemize
  3831. @section anullsrc
  3832. The null audio source, return unprocessed audio frames. It is mainly useful
  3833. as a template and to be employed in analysis / debugging tools, or as
  3834. the source for filters which ignore the input data (for example the sox
  3835. synth filter).
  3836. This source accepts the following options:
  3837. @table @option
  3838. @item channel_layout, cl
  3839. Specifies the channel layout, and can be either an integer or a string
  3840. representing a channel layout. The default value of @var{channel_layout}
  3841. is "stereo".
  3842. Check the channel_layout_map definition in
  3843. @file{libavutil/channel_layout.c} for the mapping between strings and
  3844. channel layout values.
  3845. @item sample_rate, r
  3846. Specifies the sample rate, and defaults to 44100.
  3847. @item nb_samples, n
  3848. Set the number of samples per requested frames.
  3849. @end table
  3850. @subsection Examples
  3851. @itemize
  3852. @item
  3853. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3854. @example
  3855. anullsrc=r=48000:cl=4
  3856. @end example
  3857. @item
  3858. Do the same operation with a more obvious syntax:
  3859. @example
  3860. anullsrc=r=48000:cl=mono
  3861. @end example
  3862. @end itemize
  3863. All the parameters need to be explicitly defined.
  3864. @section flite
  3865. Synthesize a voice utterance using the libflite library.
  3866. To enable compilation of this filter you need to configure FFmpeg with
  3867. @code{--enable-libflite}.
  3868. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3869. The filter accepts the following options:
  3870. @table @option
  3871. @item list_voices
  3872. If set to 1, list the names of the available voices and exit
  3873. immediately. Default value is 0.
  3874. @item nb_samples, n
  3875. Set the maximum number of samples per frame. Default value is 512.
  3876. @item textfile
  3877. Set the filename containing the text to speak.
  3878. @item text
  3879. Set the text to speak.
  3880. @item voice, v
  3881. Set the voice to use for the speech synthesis. Default value is
  3882. @code{kal}. See also the @var{list_voices} option.
  3883. @end table
  3884. @subsection Examples
  3885. @itemize
  3886. @item
  3887. Read from file @file{speech.txt}, and synthesize the text using the
  3888. standard flite voice:
  3889. @example
  3890. flite=textfile=speech.txt
  3891. @end example
  3892. @item
  3893. Read the specified text selecting the @code{slt} voice:
  3894. @example
  3895. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3896. @end example
  3897. @item
  3898. Input text to ffmpeg:
  3899. @example
  3900. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3901. @end example
  3902. @item
  3903. Make @file{ffplay} speak the specified text, using @code{flite} and
  3904. the @code{lavfi} device:
  3905. @example
  3906. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3907. @end example
  3908. @end itemize
  3909. For more information about libflite, check:
  3910. @url{http://www.festvox.org/flite/}
  3911. @section anoisesrc
  3912. Generate a noise audio signal.
  3913. The filter accepts the following options:
  3914. @table @option
  3915. @item sample_rate, r
  3916. Specify the sample rate. Default value is 48000 Hz.
  3917. @item amplitude, a
  3918. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3919. is 1.0.
  3920. @item duration, d
  3921. Specify the duration of the generated audio stream. Not specifying this option
  3922. results in noise with an infinite length.
  3923. @item color, colour, c
  3924. Specify the color of noise. Available noise colors are white, pink, brown,
  3925. blue and violet. Default color is white.
  3926. @item seed, s
  3927. Specify a value used to seed the PRNG.
  3928. @item nb_samples, n
  3929. Set the number of samples per each output frame, default is 1024.
  3930. @end table
  3931. @subsection Examples
  3932. @itemize
  3933. @item
  3934. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3935. @example
  3936. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3937. @end example
  3938. @end itemize
  3939. @section hilbert
  3940. Generate odd-tap Hilbert transform FIR coefficients.
  3941. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3942. the signal by 90 degrees.
  3943. This is used in many matrix coding schemes and for analytic signal generation.
  3944. The process is often written as a multiplication by i (or j), the imaginary unit.
  3945. The filter accepts the following options:
  3946. @table @option
  3947. @item sample_rate, s
  3948. Set sample rate, default is 44100.
  3949. @item taps, t
  3950. Set length of FIR filter, default is 22051.
  3951. @item nb_samples, n
  3952. Set number of samples per each frame.
  3953. @item win_func, w
  3954. Set window function to be used when generating FIR coefficients.
  3955. @end table
  3956. @section sine
  3957. Generate an audio signal made of a sine wave with amplitude 1/8.
  3958. The audio signal is bit-exact.
  3959. The filter accepts the following options:
  3960. @table @option
  3961. @item frequency, f
  3962. Set the carrier frequency. Default is 440 Hz.
  3963. @item beep_factor, b
  3964. Enable a periodic beep every second with frequency @var{beep_factor} times
  3965. the carrier frequency. Default is 0, meaning the beep is disabled.
  3966. @item sample_rate, r
  3967. Specify the sample rate, default is 44100.
  3968. @item duration, d
  3969. Specify the duration of the generated audio stream.
  3970. @item samples_per_frame
  3971. Set the number of samples per output frame.
  3972. The expression can contain the following constants:
  3973. @table @option
  3974. @item n
  3975. The (sequential) number of the output audio frame, starting from 0.
  3976. @item pts
  3977. The PTS (Presentation TimeStamp) of the output audio frame,
  3978. expressed in @var{TB} units.
  3979. @item t
  3980. The PTS of the output audio frame, expressed in seconds.
  3981. @item TB
  3982. The timebase of the output audio frames.
  3983. @end table
  3984. Default is @code{1024}.
  3985. @end table
  3986. @subsection Examples
  3987. @itemize
  3988. @item
  3989. Generate a simple 440 Hz sine wave:
  3990. @example
  3991. sine
  3992. @end example
  3993. @item
  3994. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3995. @example
  3996. sine=220:4:d=5
  3997. sine=f=220:b=4:d=5
  3998. sine=frequency=220:beep_factor=4:duration=5
  3999. @end example
  4000. @item
  4001. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4002. pattern:
  4003. @example
  4004. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4005. @end example
  4006. @end itemize
  4007. @c man end AUDIO SOURCES
  4008. @chapter Audio Sinks
  4009. @c man begin AUDIO SINKS
  4010. Below is a description of the currently available audio sinks.
  4011. @section abuffersink
  4012. Buffer audio frames, and make them available to the end of filter chain.
  4013. This sink is mainly intended for programmatic use, in particular
  4014. through the interface defined in @file{libavfilter/buffersink.h}
  4015. or the options system.
  4016. It accepts a pointer to an AVABufferSinkContext structure, which
  4017. defines the incoming buffers' formats, to be passed as the opaque
  4018. parameter to @code{avfilter_init_filter} for initialization.
  4019. @section anullsink
  4020. Null audio sink; do absolutely nothing with the input audio. It is
  4021. mainly useful as a template and for use in analysis / debugging
  4022. tools.
  4023. @c man end AUDIO SINKS
  4024. @chapter Video Filters
  4025. @c man begin VIDEO FILTERS
  4026. When you configure your FFmpeg build, you can disable any of the
  4027. existing filters using @code{--disable-filters}.
  4028. The configure output will show the video filters included in your
  4029. build.
  4030. Below is a description of the currently available video filters.
  4031. @section alphaextract
  4032. Extract the alpha component from the input as a grayscale video. This
  4033. is especially useful with the @var{alphamerge} filter.
  4034. @section alphamerge
  4035. Add or replace the alpha component of the primary input with the
  4036. grayscale value of a second input. This is intended for use with
  4037. @var{alphaextract} to allow the transmission or storage of frame
  4038. sequences that have alpha in a format that doesn't support an alpha
  4039. channel.
  4040. For example, to reconstruct full frames from a normal YUV-encoded video
  4041. and a separate video created with @var{alphaextract}, you might use:
  4042. @example
  4043. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4044. @end example
  4045. Since this filter is designed for reconstruction, it operates on frame
  4046. sequences without considering timestamps, and terminates when either
  4047. input reaches end of stream. This will cause problems if your encoding
  4048. pipeline drops frames. If you're trying to apply an image as an
  4049. overlay to a video stream, consider the @var{overlay} filter instead.
  4050. @section amplify
  4051. Amplify differences between current pixel and pixels of adjacent frames in
  4052. same pixel location.
  4053. This filter accepts the following options:
  4054. @table @option
  4055. @item radius
  4056. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4057. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4058. @item factor
  4059. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4060. @item threshold
  4061. Set threshold for difference amplification. Any differrence greater or equal to
  4062. this value will not alter source pixel. Default is 10.
  4063. Allowed range is from 0 to 65535.
  4064. @item low
  4065. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4066. This option controls maximum possible value that will decrease source pixel value.
  4067. @item high
  4068. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4069. This option controls maximum possible value that will increase source pixel value.
  4070. @item planes
  4071. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4072. @end table
  4073. @section ass
  4074. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4075. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4076. Substation Alpha) subtitles files.
  4077. This filter accepts the following option in addition to the common options from
  4078. the @ref{subtitles} filter:
  4079. @table @option
  4080. @item shaping
  4081. Set the shaping engine
  4082. Available values are:
  4083. @table @samp
  4084. @item auto
  4085. The default libass shaping engine, which is the best available.
  4086. @item simple
  4087. Fast, font-agnostic shaper that can do only substitutions
  4088. @item complex
  4089. Slower shaper using OpenType for substitutions and positioning
  4090. @end table
  4091. The default is @code{auto}.
  4092. @end table
  4093. @section atadenoise
  4094. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4095. The filter accepts the following options:
  4096. @table @option
  4097. @item 0a
  4098. Set threshold A for 1st plane. Default is 0.02.
  4099. Valid range is 0 to 0.3.
  4100. @item 0b
  4101. Set threshold B for 1st plane. Default is 0.04.
  4102. Valid range is 0 to 5.
  4103. @item 1a
  4104. Set threshold A for 2nd plane. Default is 0.02.
  4105. Valid range is 0 to 0.3.
  4106. @item 1b
  4107. Set threshold B for 2nd plane. Default is 0.04.
  4108. Valid range is 0 to 5.
  4109. @item 2a
  4110. Set threshold A for 3rd plane. Default is 0.02.
  4111. Valid range is 0 to 0.3.
  4112. @item 2b
  4113. Set threshold B for 3rd plane. Default is 0.04.
  4114. Valid range is 0 to 5.
  4115. Threshold A is designed to react on abrupt changes in the input signal and
  4116. threshold B is designed to react on continuous changes in the input signal.
  4117. @item s
  4118. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4119. number in range [5, 129].
  4120. @item p
  4121. Set what planes of frame filter will use for averaging. Default is all.
  4122. @end table
  4123. @section avgblur
  4124. Apply average blur filter.
  4125. The filter accepts the following options:
  4126. @table @option
  4127. @item sizeX
  4128. Set horizontal kernel size.
  4129. @item planes
  4130. Set which planes to filter. By default all planes are filtered.
  4131. @item sizeY
  4132. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4133. Default is @code{0}.
  4134. @end table
  4135. @section bbox
  4136. Compute the bounding box for the non-black pixels in the input frame
  4137. luminance plane.
  4138. This filter computes the bounding box containing all the pixels with a
  4139. luminance value greater than the minimum allowed value.
  4140. The parameters describing the bounding box are printed on the filter
  4141. log.
  4142. The filter accepts the following option:
  4143. @table @option
  4144. @item min_val
  4145. Set the minimal luminance value. Default is @code{16}.
  4146. @end table
  4147. @section bitplanenoise
  4148. Show and measure bit plane noise.
  4149. The filter accepts the following options:
  4150. @table @option
  4151. @item bitplane
  4152. Set which plane to analyze. Default is @code{1}.
  4153. @item filter
  4154. Filter out noisy pixels from @code{bitplane} set above.
  4155. Default is disabled.
  4156. @end table
  4157. @section blackdetect
  4158. Detect video intervals that are (almost) completely black. Can be
  4159. useful to detect chapter transitions, commercials, or invalid
  4160. recordings. Output lines contains the time for the start, end and
  4161. duration of the detected black interval expressed in seconds.
  4162. In order to display the output lines, you need to set the loglevel at
  4163. least to the AV_LOG_INFO value.
  4164. The filter accepts the following options:
  4165. @table @option
  4166. @item black_min_duration, d
  4167. Set the minimum detected black duration expressed in seconds. It must
  4168. be a non-negative floating point number.
  4169. Default value is 2.0.
  4170. @item picture_black_ratio_th, pic_th
  4171. Set the threshold for considering a picture "black".
  4172. Express the minimum value for the ratio:
  4173. @example
  4174. @var{nb_black_pixels} / @var{nb_pixels}
  4175. @end example
  4176. for which a picture is considered black.
  4177. Default value is 0.98.
  4178. @item pixel_black_th, pix_th
  4179. Set the threshold for considering a pixel "black".
  4180. The threshold expresses the maximum pixel luminance value for which a
  4181. pixel is considered "black". The provided value is scaled according to
  4182. the following equation:
  4183. @example
  4184. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4185. @end example
  4186. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4187. the input video format, the range is [0-255] for YUV full-range
  4188. formats and [16-235] for YUV non full-range formats.
  4189. Default value is 0.10.
  4190. @end table
  4191. The following example sets the maximum pixel threshold to the minimum
  4192. value, and detects only black intervals of 2 or more seconds:
  4193. @example
  4194. blackdetect=d=2:pix_th=0.00
  4195. @end example
  4196. @section blackframe
  4197. Detect frames that are (almost) completely black. Can be useful to
  4198. detect chapter transitions or commercials. Output lines consist of
  4199. the frame number of the detected frame, the percentage of blackness,
  4200. the position in the file if known or -1 and the timestamp in seconds.
  4201. In order to display the output lines, you need to set the loglevel at
  4202. least to the AV_LOG_INFO value.
  4203. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4204. The value represents the percentage of pixels in the picture that
  4205. are below the threshold value.
  4206. It accepts the following parameters:
  4207. @table @option
  4208. @item amount
  4209. The percentage of the pixels that have to be below the threshold; it defaults to
  4210. @code{98}.
  4211. @item threshold, thresh
  4212. The threshold below which a pixel value is considered black; it defaults to
  4213. @code{32}.
  4214. @end table
  4215. @section blend, tblend
  4216. Blend two video frames into each other.
  4217. The @code{blend} filter takes two input streams and outputs one
  4218. stream, the first input is the "top" layer and second input is
  4219. "bottom" layer. By default, the output terminates when the longest input terminates.
  4220. The @code{tblend} (time blend) filter takes two consecutive frames
  4221. from one single stream, and outputs the result obtained by blending
  4222. the new frame on top of the old frame.
  4223. A description of the accepted options follows.
  4224. @table @option
  4225. @item c0_mode
  4226. @item c1_mode
  4227. @item c2_mode
  4228. @item c3_mode
  4229. @item all_mode
  4230. Set blend mode for specific pixel component or all pixel components in case
  4231. of @var{all_mode}. Default value is @code{normal}.
  4232. Available values for component modes are:
  4233. @table @samp
  4234. @item addition
  4235. @item grainmerge
  4236. @item and
  4237. @item average
  4238. @item burn
  4239. @item darken
  4240. @item difference
  4241. @item grainextract
  4242. @item divide
  4243. @item dodge
  4244. @item freeze
  4245. @item exclusion
  4246. @item extremity
  4247. @item glow
  4248. @item hardlight
  4249. @item hardmix
  4250. @item heat
  4251. @item lighten
  4252. @item linearlight
  4253. @item multiply
  4254. @item multiply128
  4255. @item negation
  4256. @item normal
  4257. @item or
  4258. @item overlay
  4259. @item phoenix
  4260. @item pinlight
  4261. @item reflect
  4262. @item screen
  4263. @item softlight
  4264. @item subtract
  4265. @item vividlight
  4266. @item xor
  4267. @end table
  4268. @item c0_opacity
  4269. @item c1_opacity
  4270. @item c2_opacity
  4271. @item c3_opacity
  4272. @item all_opacity
  4273. Set blend opacity for specific pixel component or all pixel components in case
  4274. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4275. @item c0_expr
  4276. @item c1_expr
  4277. @item c2_expr
  4278. @item c3_expr
  4279. @item all_expr
  4280. Set blend expression for specific pixel component or all pixel components in case
  4281. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4282. The expressions can use the following variables:
  4283. @table @option
  4284. @item N
  4285. The sequential number of the filtered frame, starting from @code{0}.
  4286. @item X
  4287. @item Y
  4288. the coordinates of the current sample
  4289. @item W
  4290. @item H
  4291. the width and height of currently filtered plane
  4292. @item SW
  4293. @item SH
  4294. Width and height scale depending on the currently filtered plane. It is the
  4295. ratio between the corresponding luma plane number of pixels and the current
  4296. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4297. @code{0.5,0.5} for chroma planes.
  4298. @item T
  4299. Time of the current frame, expressed in seconds.
  4300. @item TOP, A
  4301. Value of pixel component at current location for first video frame (top layer).
  4302. @item BOTTOM, B
  4303. Value of pixel component at current location for second video frame (bottom layer).
  4304. @end table
  4305. @end table
  4306. The @code{blend} filter also supports the @ref{framesync} options.
  4307. @subsection Examples
  4308. @itemize
  4309. @item
  4310. Apply transition from bottom layer to top layer in first 10 seconds:
  4311. @example
  4312. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4313. @end example
  4314. @item
  4315. Apply linear horizontal transition from top layer to bottom layer:
  4316. @example
  4317. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4318. @end example
  4319. @item
  4320. Apply 1x1 checkerboard effect:
  4321. @example
  4322. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4323. @end example
  4324. @item
  4325. Apply uncover left effect:
  4326. @example
  4327. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4328. @end example
  4329. @item
  4330. Apply uncover down effect:
  4331. @example
  4332. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4333. @end example
  4334. @item
  4335. Apply uncover up-left effect:
  4336. @example
  4337. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4338. @end example
  4339. @item
  4340. Split diagonally video and shows top and bottom layer on each side:
  4341. @example
  4342. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4343. @end example
  4344. @item
  4345. Display differences between the current and the previous frame:
  4346. @example
  4347. tblend=all_mode=grainextract
  4348. @end example
  4349. @end itemize
  4350. @section boxblur
  4351. Apply a boxblur algorithm to the input video.
  4352. It accepts the following parameters:
  4353. @table @option
  4354. @item luma_radius, lr
  4355. @item luma_power, lp
  4356. @item chroma_radius, cr
  4357. @item chroma_power, cp
  4358. @item alpha_radius, ar
  4359. @item alpha_power, ap
  4360. @end table
  4361. A description of the accepted options follows.
  4362. @table @option
  4363. @item luma_radius, lr
  4364. @item chroma_radius, cr
  4365. @item alpha_radius, ar
  4366. Set an expression for the box radius in pixels used for blurring the
  4367. corresponding input plane.
  4368. The radius value must be a non-negative number, and must not be
  4369. greater than the value of the expression @code{min(w,h)/2} for the
  4370. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4371. planes.
  4372. Default value for @option{luma_radius} is "2". If not specified,
  4373. @option{chroma_radius} and @option{alpha_radius} default to the
  4374. corresponding value set for @option{luma_radius}.
  4375. The expressions can contain the following constants:
  4376. @table @option
  4377. @item w
  4378. @item h
  4379. The input width and height in pixels.
  4380. @item cw
  4381. @item ch
  4382. The input chroma image width and height in pixels.
  4383. @item hsub
  4384. @item vsub
  4385. The horizontal and vertical chroma subsample values. For example, for the
  4386. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4387. @end table
  4388. @item luma_power, lp
  4389. @item chroma_power, cp
  4390. @item alpha_power, ap
  4391. Specify how many times the boxblur filter is applied to the
  4392. corresponding plane.
  4393. Default value for @option{luma_power} is 2. If not specified,
  4394. @option{chroma_power} and @option{alpha_power} default to the
  4395. corresponding value set for @option{luma_power}.
  4396. A value of 0 will disable the effect.
  4397. @end table
  4398. @subsection Examples
  4399. @itemize
  4400. @item
  4401. Apply a boxblur filter with the luma, chroma, and alpha radii
  4402. set to 2:
  4403. @example
  4404. boxblur=luma_radius=2:luma_power=1
  4405. boxblur=2:1
  4406. @end example
  4407. @item
  4408. Set the luma radius to 2, and alpha and chroma radius to 0:
  4409. @example
  4410. boxblur=2:1:cr=0:ar=0
  4411. @end example
  4412. @item
  4413. Set the luma and chroma radii to a fraction of the video dimension:
  4414. @example
  4415. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4416. @end example
  4417. @end itemize
  4418. @section bwdif
  4419. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4420. Deinterlacing Filter").
  4421. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4422. interpolation algorithms.
  4423. It accepts the following parameters:
  4424. @table @option
  4425. @item mode
  4426. The interlacing mode to adopt. It accepts one of the following values:
  4427. @table @option
  4428. @item 0, send_frame
  4429. Output one frame for each frame.
  4430. @item 1, send_field
  4431. Output one frame for each field.
  4432. @end table
  4433. The default value is @code{send_field}.
  4434. @item parity
  4435. The picture field parity assumed for the input interlaced video. It accepts one
  4436. of the following values:
  4437. @table @option
  4438. @item 0, tff
  4439. Assume the top field is first.
  4440. @item 1, bff
  4441. Assume the bottom field is first.
  4442. @item -1, auto
  4443. Enable automatic detection of field parity.
  4444. @end table
  4445. The default value is @code{auto}.
  4446. If the interlacing is unknown or the decoder does not export this information,
  4447. top field first will be assumed.
  4448. @item deint
  4449. Specify which frames to deinterlace. Accept one of the following
  4450. values:
  4451. @table @option
  4452. @item 0, all
  4453. Deinterlace all frames.
  4454. @item 1, interlaced
  4455. Only deinterlace frames marked as interlaced.
  4456. @end table
  4457. The default value is @code{all}.
  4458. @end table
  4459. @section chromakey
  4460. YUV colorspace color/chroma keying.
  4461. The filter accepts the following options:
  4462. @table @option
  4463. @item color
  4464. The color which will be replaced with transparency.
  4465. @item similarity
  4466. Similarity percentage with the key color.
  4467. 0.01 matches only the exact key color, while 1.0 matches everything.
  4468. @item blend
  4469. Blend percentage.
  4470. 0.0 makes pixels either fully transparent, or not transparent at all.
  4471. Higher values result in semi-transparent pixels, with a higher transparency
  4472. the more similar the pixels color is to the key color.
  4473. @item yuv
  4474. Signals that the color passed is already in YUV instead of RGB.
  4475. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4476. This can be used to pass exact YUV values as hexadecimal numbers.
  4477. @end table
  4478. @subsection Examples
  4479. @itemize
  4480. @item
  4481. Make every green pixel in the input image transparent:
  4482. @example
  4483. ffmpeg -i input.png -vf chromakey=green out.png
  4484. @end example
  4485. @item
  4486. Overlay a greenscreen-video on top of a static black background.
  4487. @example
  4488. 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
  4489. @end example
  4490. @end itemize
  4491. @section ciescope
  4492. Display CIE color diagram with pixels overlaid onto it.
  4493. The filter accepts the following options:
  4494. @table @option
  4495. @item system
  4496. Set color system.
  4497. @table @samp
  4498. @item ntsc, 470m
  4499. @item ebu, 470bg
  4500. @item smpte
  4501. @item 240m
  4502. @item apple
  4503. @item widergb
  4504. @item cie1931
  4505. @item rec709, hdtv
  4506. @item uhdtv, rec2020
  4507. @end table
  4508. @item cie
  4509. Set CIE system.
  4510. @table @samp
  4511. @item xyy
  4512. @item ucs
  4513. @item luv
  4514. @end table
  4515. @item gamuts
  4516. Set what gamuts to draw.
  4517. See @code{system} option for available values.
  4518. @item size, s
  4519. Set ciescope size, by default set to 512.
  4520. @item intensity, i
  4521. Set intensity used to map input pixel values to CIE diagram.
  4522. @item contrast
  4523. Set contrast used to draw tongue colors that are out of active color system gamut.
  4524. @item corrgamma
  4525. Correct gamma displayed on scope, by default enabled.
  4526. @item showwhite
  4527. Show white point on CIE diagram, by default disabled.
  4528. @item gamma
  4529. Set input gamma. Used only with XYZ input color space.
  4530. @end table
  4531. @section codecview
  4532. Visualize information exported by some codecs.
  4533. Some codecs can export information through frames using side-data or other
  4534. means. For example, some MPEG based codecs export motion vectors through the
  4535. @var{export_mvs} flag in the codec @option{flags2} option.
  4536. The filter accepts the following option:
  4537. @table @option
  4538. @item mv
  4539. Set motion vectors to visualize.
  4540. Available flags for @var{mv} are:
  4541. @table @samp
  4542. @item pf
  4543. forward predicted MVs of P-frames
  4544. @item bf
  4545. forward predicted MVs of B-frames
  4546. @item bb
  4547. backward predicted MVs of B-frames
  4548. @end table
  4549. @item qp
  4550. Display quantization parameters using the chroma planes.
  4551. @item mv_type, mvt
  4552. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4553. Available flags for @var{mv_type} are:
  4554. @table @samp
  4555. @item fp
  4556. forward predicted MVs
  4557. @item bp
  4558. backward predicted MVs
  4559. @end table
  4560. @item frame_type, ft
  4561. Set frame type to visualize motion vectors of.
  4562. Available flags for @var{frame_type} are:
  4563. @table @samp
  4564. @item if
  4565. intra-coded frames (I-frames)
  4566. @item pf
  4567. predicted frames (P-frames)
  4568. @item bf
  4569. bi-directionally predicted frames (B-frames)
  4570. @end table
  4571. @end table
  4572. @subsection Examples
  4573. @itemize
  4574. @item
  4575. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4576. @example
  4577. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4578. @end example
  4579. @item
  4580. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4581. @example
  4582. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4583. @end example
  4584. @end itemize
  4585. @section colorbalance
  4586. Modify intensity of primary colors (red, green and blue) of input frames.
  4587. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4588. regions for the red-cyan, green-magenta or blue-yellow balance.
  4589. A positive adjustment value shifts the balance towards the primary color, a negative
  4590. value towards the complementary color.
  4591. The filter accepts the following options:
  4592. @table @option
  4593. @item rs
  4594. @item gs
  4595. @item bs
  4596. Adjust red, green and blue shadows (darkest pixels).
  4597. @item rm
  4598. @item gm
  4599. @item bm
  4600. Adjust red, green and blue midtones (medium pixels).
  4601. @item rh
  4602. @item gh
  4603. @item bh
  4604. Adjust red, green and blue highlights (brightest pixels).
  4605. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4606. @end table
  4607. @subsection Examples
  4608. @itemize
  4609. @item
  4610. Add red color cast to shadows:
  4611. @example
  4612. colorbalance=rs=.3
  4613. @end example
  4614. @end itemize
  4615. @section colorkey
  4616. RGB colorspace color keying.
  4617. The filter accepts the following options:
  4618. @table @option
  4619. @item color
  4620. The color which will be replaced with transparency.
  4621. @item similarity
  4622. Similarity percentage with the key color.
  4623. 0.01 matches only the exact key color, while 1.0 matches everything.
  4624. @item blend
  4625. Blend percentage.
  4626. 0.0 makes pixels either fully transparent, or not transparent at all.
  4627. Higher values result in semi-transparent pixels, with a higher transparency
  4628. the more similar the pixels color is to the key color.
  4629. @end table
  4630. @subsection Examples
  4631. @itemize
  4632. @item
  4633. Make every green pixel in the input image transparent:
  4634. @example
  4635. ffmpeg -i input.png -vf colorkey=green out.png
  4636. @end example
  4637. @item
  4638. Overlay a greenscreen-video on top of a static background image.
  4639. @example
  4640. 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
  4641. @end example
  4642. @end itemize
  4643. @section colorlevels
  4644. Adjust video input frames using levels.
  4645. The filter accepts the following options:
  4646. @table @option
  4647. @item rimin
  4648. @item gimin
  4649. @item bimin
  4650. @item aimin
  4651. Adjust red, green, blue and alpha input black point.
  4652. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4653. @item rimax
  4654. @item gimax
  4655. @item bimax
  4656. @item aimax
  4657. Adjust red, green, blue and alpha input white point.
  4658. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4659. Input levels are used to lighten highlights (bright tones), darken shadows
  4660. (dark tones), change the balance of bright and dark tones.
  4661. @item romin
  4662. @item gomin
  4663. @item bomin
  4664. @item aomin
  4665. Adjust red, green, blue and alpha output black point.
  4666. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4667. @item romax
  4668. @item gomax
  4669. @item bomax
  4670. @item aomax
  4671. Adjust red, green, blue and alpha output white point.
  4672. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4673. Output levels allows manual selection of a constrained output level range.
  4674. @end table
  4675. @subsection Examples
  4676. @itemize
  4677. @item
  4678. Make video output darker:
  4679. @example
  4680. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4681. @end example
  4682. @item
  4683. Increase contrast:
  4684. @example
  4685. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4686. @end example
  4687. @item
  4688. Make video output lighter:
  4689. @example
  4690. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4691. @end example
  4692. @item
  4693. Increase brightness:
  4694. @example
  4695. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4696. @end example
  4697. @end itemize
  4698. @section colorchannelmixer
  4699. Adjust video input frames by re-mixing color channels.
  4700. This filter modifies a color channel by adding the values associated to
  4701. the other channels of the same pixels. For example if the value to
  4702. modify is red, the output value will be:
  4703. @example
  4704. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4705. @end example
  4706. The filter accepts the following options:
  4707. @table @option
  4708. @item rr
  4709. @item rg
  4710. @item rb
  4711. @item ra
  4712. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4713. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4714. @item gr
  4715. @item gg
  4716. @item gb
  4717. @item ga
  4718. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4719. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4720. @item br
  4721. @item bg
  4722. @item bb
  4723. @item ba
  4724. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4725. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4726. @item ar
  4727. @item ag
  4728. @item ab
  4729. @item aa
  4730. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4731. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4732. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4733. @end table
  4734. @subsection Examples
  4735. @itemize
  4736. @item
  4737. Convert source to grayscale:
  4738. @example
  4739. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4740. @end example
  4741. @item
  4742. Simulate sepia tones:
  4743. @example
  4744. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4745. @end example
  4746. @end itemize
  4747. @section colormatrix
  4748. Convert color matrix.
  4749. The filter accepts the following options:
  4750. @table @option
  4751. @item src
  4752. @item dst
  4753. Specify the source and destination color matrix. Both values must be
  4754. specified.
  4755. The accepted values are:
  4756. @table @samp
  4757. @item bt709
  4758. BT.709
  4759. @item fcc
  4760. FCC
  4761. @item bt601
  4762. BT.601
  4763. @item bt470
  4764. BT.470
  4765. @item bt470bg
  4766. BT.470BG
  4767. @item smpte170m
  4768. SMPTE-170M
  4769. @item smpte240m
  4770. SMPTE-240M
  4771. @item bt2020
  4772. BT.2020
  4773. @end table
  4774. @end table
  4775. For example to convert from BT.601 to SMPTE-240M, use the command:
  4776. @example
  4777. colormatrix=bt601:smpte240m
  4778. @end example
  4779. @section colorspace
  4780. Convert colorspace, transfer characteristics or color primaries.
  4781. Input video needs to have an even size.
  4782. The filter accepts the following options:
  4783. @table @option
  4784. @anchor{all}
  4785. @item all
  4786. Specify all color properties at once.
  4787. The accepted values are:
  4788. @table @samp
  4789. @item bt470m
  4790. BT.470M
  4791. @item bt470bg
  4792. BT.470BG
  4793. @item bt601-6-525
  4794. BT.601-6 525
  4795. @item bt601-6-625
  4796. BT.601-6 625
  4797. @item bt709
  4798. BT.709
  4799. @item smpte170m
  4800. SMPTE-170M
  4801. @item smpte240m
  4802. SMPTE-240M
  4803. @item bt2020
  4804. BT.2020
  4805. @end table
  4806. @anchor{space}
  4807. @item space
  4808. Specify output colorspace.
  4809. The accepted values are:
  4810. @table @samp
  4811. @item bt709
  4812. BT.709
  4813. @item fcc
  4814. FCC
  4815. @item bt470bg
  4816. BT.470BG or BT.601-6 625
  4817. @item smpte170m
  4818. SMPTE-170M or BT.601-6 525
  4819. @item smpte240m
  4820. SMPTE-240M
  4821. @item ycgco
  4822. YCgCo
  4823. @item bt2020ncl
  4824. BT.2020 with non-constant luminance
  4825. @end table
  4826. @anchor{trc}
  4827. @item trc
  4828. Specify output transfer characteristics.
  4829. The accepted values are:
  4830. @table @samp
  4831. @item bt709
  4832. BT.709
  4833. @item bt470m
  4834. BT.470M
  4835. @item bt470bg
  4836. BT.470BG
  4837. @item gamma22
  4838. Constant gamma of 2.2
  4839. @item gamma28
  4840. Constant gamma of 2.8
  4841. @item smpte170m
  4842. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4843. @item smpte240m
  4844. SMPTE-240M
  4845. @item srgb
  4846. SRGB
  4847. @item iec61966-2-1
  4848. iec61966-2-1
  4849. @item iec61966-2-4
  4850. iec61966-2-4
  4851. @item xvycc
  4852. xvycc
  4853. @item bt2020-10
  4854. BT.2020 for 10-bits content
  4855. @item bt2020-12
  4856. BT.2020 for 12-bits content
  4857. @end table
  4858. @anchor{primaries}
  4859. @item primaries
  4860. Specify output color primaries.
  4861. The accepted values are:
  4862. @table @samp
  4863. @item bt709
  4864. BT.709
  4865. @item bt470m
  4866. BT.470M
  4867. @item bt470bg
  4868. BT.470BG or BT.601-6 625
  4869. @item smpte170m
  4870. SMPTE-170M or BT.601-6 525
  4871. @item smpte240m
  4872. SMPTE-240M
  4873. @item film
  4874. film
  4875. @item smpte431
  4876. SMPTE-431
  4877. @item smpte432
  4878. SMPTE-432
  4879. @item bt2020
  4880. BT.2020
  4881. @item jedec-p22
  4882. JEDEC P22 phosphors
  4883. @end table
  4884. @anchor{range}
  4885. @item range
  4886. Specify output color range.
  4887. The accepted values are:
  4888. @table @samp
  4889. @item tv
  4890. TV (restricted) range
  4891. @item mpeg
  4892. MPEG (restricted) range
  4893. @item pc
  4894. PC (full) range
  4895. @item jpeg
  4896. JPEG (full) range
  4897. @end table
  4898. @item format
  4899. Specify output color format.
  4900. The accepted values are:
  4901. @table @samp
  4902. @item yuv420p
  4903. YUV 4:2:0 planar 8-bits
  4904. @item yuv420p10
  4905. YUV 4:2:0 planar 10-bits
  4906. @item yuv420p12
  4907. YUV 4:2:0 planar 12-bits
  4908. @item yuv422p
  4909. YUV 4:2:2 planar 8-bits
  4910. @item yuv422p10
  4911. YUV 4:2:2 planar 10-bits
  4912. @item yuv422p12
  4913. YUV 4:2:2 planar 12-bits
  4914. @item yuv444p
  4915. YUV 4:4:4 planar 8-bits
  4916. @item yuv444p10
  4917. YUV 4:4:4 planar 10-bits
  4918. @item yuv444p12
  4919. YUV 4:4:4 planar 12-bits
  4920. @end table
  4921. @item fast
  4922. Do a fast conversion, which skips gamma/primary correction. This will take
  4923. significantly less CPU, but will be mathematically incorrect. To get output
  4924. compatible with that produced by the colormatrix filter, use fast=1.
  4925. @item dither
  4926. Specify dithering mode.
  4927. The accepted values are:
  4928. @table @samp
  4929. @item none
  4930. No dithering
  4931. @item fsb
  4932. Floyd-Steinberg dithering
  4933. @end table
  4934. @item wpadapt
  4935. Whitepoint adaptation mode.
  4936. The accepted values are:
  4937. @table @samp
  4938. @item bradford
  4939. Bradford whitepoint adaptation
  4940. @item vonkries
  4941. von Kries whitepoint adaptation
  4942. @item identity
  4943. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4944. @end table
  4945. @item iall
  4946. Override all input properties at once. Same accepted values as @ref{all}.
  4947. @item ispace
  4948. Override input colorspace. Same accepted values as @ref{space}.
  4949. @item iprimaries
  4950. Override input color primaries. Same accepted values as @ref{primaries}.
  4951. @item itrc
  4952. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4953. @item irange
  4954. Override input color range. Same accepted values as @ref{range}.
  4955. @end table
  4956. The filter converts the transfer characteristics, color space and color
  4957. primaries to the specified user values. The output value, if not specified,
  4958. is set to a default value based on the "all" property. If that property is
  4959. also not specified, the filter will log an error. The output color range and
  4960. format default to the same value as the input color range and format. The
  4961. input transfer characteristics, color space, color primaries and color range
  4962. should be set on the input data. If any of these are missing, the filter will
  4963. log an error and no conversion will take place.
  4964. For example to convert the input to SMPTE-240M, use the command:
  4965. @example
  4966. colorspace=smpte240m
  4967. @end example
  4968. @section convolution
  4969. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  4970. The filter accepts the following options:
  4971. @table @option
  4972. @item 0m
  4973. @item 1m
  4974. @item 2m
  4975. @item 3m
  4976. Set matrix for each plane.
  4977. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  4978. and from 1 to 49 odd number of signed integers in @var{row} mode.
  4979. @item 0rdiv
  4980. @item 1rdiv
  4981. @item 2rdiv
  4982. @item 3rdiv
  4983. Set multiplier for calculated value for each plane.
  4984. If unset or 0, it will be sum of all matrix elements.
  4985. @item 0bias
  4986. @item 1bias
  4987. @item 2bias
  4988. @item 3bias
  4989. Set bias for each plane. This value is added to the result of the multiplication.
  4990. Useful for making the overall image brighter or darker. Default is 0.0.
  4991. @item 0mode
  4992. @item 1mode
  4993. @item 2mode
  4994. @item 3mode
  4995. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  4996. Default is @var{square}.
  4997. @end table
  4998. @subsection Examples
  4999. @itemize
  5000. @item
  5001. Apply sharpen:
  5002. @example
  5003. 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"
  5004. @end example
  5005. @item
  5006. Apply blur:
  5007. @example
  5008. 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"
  5009. @end example
  5010. @item
  5011. Apply edge enhance:
  5012. @example
  5013. 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"
  5014. @end example
  5015. @item
  5016. Apply edge detect:
  5017. @example
  5018. 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"
  5019. @end example
  5020. @item
  5021. Apply laplacian edge detector which includes diagonals:
  5022. @example
  5023. 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"
  5024. @end example
  5025. @item
  5026. Apply emboss:
  5027. @example
  5028. 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"
  5029. @end example
  5030. @end itemize
  5031. @section convolve
  5032. Apply 2D convolution of video stream in frequency domain using second stream
  5033. as impulse.
  5034. The filter accepts the following options:
  5035. @table @option
  5036. @item planes
  5037. Set which planes to process.
  5038. @item impulse
  5039. Set which impulse video frames will be processed, can be @var{first}
  5040. or @var{all}. Default is @var{all}.
  5041. @end table
  5042. The @code{convolve} filter also supports the @ref{framesync} options.
  5043. @section copy
  5044. Copy the input video source unchanged to the output. This is mainly useful for
  5045. testing purposes.
  5046. @anchor{coreimage}
  5047. @section coreimage
  5048. Video filtering on GPU using Apple's CoreImage API on OSX.
  5049. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5050. processed by video hardware. However, software-based OpenGL implementations
  5051. exist which means there is no guarantee for hardware processing. It depends on
  5052. the respective OSX.
  5053. There are many filters and image generators provided by Apple that come with a
  5054. large variety of options. The filter has to be referenced by its name along
  5055. with its options.
  5056. The coreimage filter accepts the following options:
  5057. @table @option
  5058. @item list_filters
  5059. List all available filters and generators along with all their respective
  5060. options as well as possible minimum and maximum values along with the default
  5061. values.
  5062. @example
  5063. list_filters=true
  5064. @end example
  5065. @item filter
  5066. Specify all filters by their respective name and options.
  5067. Use @var{list_filters} to determine all valid filter names and options.
  5068. Numerical options are specified by a float value and are automatically clamped
  5069. to their respective value range. Vector and color options have to be specified
  5070. by a list of space separated float values. Character escaping has to be done.
  5071. A special option name @code{default} is available to use default options for a
  5072. filter.
  5073. It is required to specify either @code{default} or at least one of the filter options.
  5074. All omitted options are used with their default values.
  5075. The syntax of the filter string is as follows:
  5076. @example
  5077. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5078. @end example
  5079. @item output_rect
  5080. Specify a rectangle where the output of the filter chain is copied into the
  5081. input image. It is given by a list of space separated float values:
  5082. @example
  5083. output_rect=x\ y\ width\ height
  5084. @end example
  5085. If not given, the output rectangle equals the dimensions of the input image.
  5086. The output rectangle is automatically cropped at the borders of the input
  5087. image. Negative values are valid for each component.
  5088. @example
  5089. output_rect=25\ 25\ 100\ 100
  5090. @end example
  5091. @end table
  5092. Several filters can be chained for successive processing without GPU-HOST
  5093. transfers allowing for fast processing of complex filter chains.
  5094. Currently, only filters with zero (generators) or exactly one (filters) input
  5095. image and one output image are supported. Also, transition filters are not yet
  5096. usable as intended.
  5097. Some filters generate output images with additional padding depending on the
  5098. respective filter kernel. The padding is automatically removed to ensure the
  5099. filter output has the same size as the input image.
  5100. For image generators, the size of the output image is determined by the
  5101. previous output image of the filter chain or the input image of the whole
  5102. filterchain, respectively. The generators do not use the pixel information of
  5103. this image to generate their output. However, the generated output is
  5104. blended onto this image, resulting in partial or complete coverage of the
  5105. output image.
  5106. The @ref{coreimagesrc} video source can be used for generating input images
  5107. which are directly fed into the filter chain. By using it, providing input
  5108. images by another video source or an input video is not required.
  5109. @subsection Examples
  5110. @itemize
  5111. @item
  5112. List all filters available:
  5113. @example
  5114. coreimage=list_filters=true
  5115. @end example
  5116. @item
  5117. Use the CIBoxBlur filter with default options to blur an image:
  5118. @example
  5119. coreimage=filter=CIBoxBlur@@default
  5120. @end example
  5121. @item
  5122. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5123. its center at 100x100 and a radius of 50 pixels:
  5124. @example
  5125. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5126. @end example
  5127. @item
  5128. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5129. given as complete and escaped command-line for Apple's standard bash shell:
  5130. @example
  5131. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5132. @end example
  5133. @end itemize
  5134. @section crop
  5135. Crop the input video to given dimensions.
  5136. It accepts the following parameters:
  5137. @table @option
  5138. @item w, out_w
  5139. The width of the output video. It defaults to @code{iw}.
  5140. This expression is evaluated only once during the filter
  5141. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5142. @item h, out_h
  5143. The height of the output video. It defaults to @code{ih}.
  5144. This expression is evaluated only once during the filter
  5145. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5146. @item x
  5147. The horizontal position, in the input video, of the left edge of the output
  5148. video. It defaults to @code{(in_w-out_w)/2}.
  5149. This expression is evaluated per-frame.
  5150. @item y
  5151. The vertical position, in the input video, of the top edge of the output video.
  5152. It defaults to @code{(in_h-out_h)/2}.
  5153. This expression is evaluated per-frame.
  5154. @item keep_aspect
  5155. If set to 1 will force the output display aspect ratio
  5156. to be the same of the input, by changing the output sample aspect
  5157. ratio. It defaults to 0.
  5158. @item exact
  5159. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5160. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5161. It defaults to 0.
  5162. @end table
  5163. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5164. expressions containing the following constants:
  5165. @table @option
  5166. @item x
  5167. @item y
  5168. The computed values for @var{x} and @var{y}. They are evaluated for
  5169. each new frame.
  5170. @item in_w
  5171. @item in_h
  5172. The input width and height.
  5173. @item iw
  5174. @item ih
  5175. These are the same as @var{in_w} and @var{in_h}.
  5176. @item out_w
  5177. @item out_h
  5178. The output (cropped) width and height.
  5179. @item ow
  5180. @item oh
  5181. These are the same as @var{out_w} and @var{out_h}.
  5182. @item a
  5183. same as @var{iw} / @var{ih}
  5184. @item sar
  5185. input sample aspect ratio
  5186. @item dar
  5187. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5188. @item hsub
  5189. @item vsub
  5190. horizontal and vertical chroma subsample values. For example for the
  5191. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5192. @item n
  5193. The number of the input frame, starting from 0.
  5194. @item pos
  5195. the position in the file of the input frame, NAN if unknown
  5196. @item t
  5197. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5198. @end table
  5199. The expression for @var{out_w} may depend on the value of @var{out_h},
  5200. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5201. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5202. evaluated after @var{out_w} and @var{out_h}.
  5203. The @var{x} and @var{y} parameters specify the expressions for the
  5204. position of the top-left corner of the output (non-cropped) area. They
  5205. are evaluated for each frame. If the evaluated value is not valid, it
  5206. is approximated to the nearest valid value.
  5207. The expression for @var{x} may depend on @var{y}, and the expression
  5208. for @var{y} may depend on @var{x}.
  5209. @subsection Examples
  5210. @itemize
  5211. @item
  5212. Crop area with size 100x100 at position (12,34).
  5213. @example
  5214. crop=100:100:12:34
  5215. @end example
  5216. Using named options, the example above becomes:
  5217. @example
  5218. crop=w=100:h=100:x=12:y=34
  5219. @end example
  5220. @item
  5221. Crop the central input area with size 100x100:
  5222. @example
  5223. crop=100:100
  5224. @end example
  5225. @item
  5226. Crop the central input area with size 2/3 of the input video:
  5227. @example
  5228. crop=2/3*in_w:2/3*in_h
  5229. @end example
  5230. @item
  5231. Crop the input video central square:
  5232. @example
  5233. crop=out_w=in_h
  5234. crop=in_h
  5235. @end example
  5236. @item
  5237. Delimit the rectangle with the top-left corner placed at position
  5238. 100:100 and the right-bottom corner corresponding to the right-bottom
  5239. corner of the input image.
  5240. @example
  5241. crop=in_w-100:in_h-100:100:100
  5242. @end example
  5243. @item
  5244. Crop 10 pixels from the left and right borders, and 20 pixels from
  5245. the top and bottom borders
  5246. @example
  5247. crop=in_w-2*10:in_h-2*20
  5248. @end example
  5249. @item
  5250. Keep only the bottom right quarter of the input image:
  5251. @example
  5252. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5253. @end example
  5254. @item
  5255. Crop height for getting Greek harmony:
  5256. @example
  5257. crop=in_w:1/PHI*in_w
  5258. @end example
  5259. @item
  5260. Apply trembling effect:
  5261. @example
  5262. 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)
  5263. @end example
  5264. @item
  5265. Apply erratic camera effect depending on timestamp:
  5266. @example
  5267. 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)"
  5268. @end example
  5269. @item
  5270. Set x depending on the value of y:
  5271. @example
  5272. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5273. @end example
  5274. @end itemize
  5275. @subsection Commands
  5276. This filter supports the following commands:
  5277. @table @option
  5278. @item w, out_w
  5279. @item h, out_h
  5280. @item x
  5281. @item y
  5282. Set width/height of the output video and the horizontal/vertical position
  5283. in the input video.
  5284. The command accepts the same syntax of the corresponding option.
  5285. If the specified expression is not valid, it is kept at its current
  5286. value.
  5287. @end table
  5288. @section cropdetect
  5289. Auto-detect the crop size.
  5290. It calculates the necessary cropping parameters and prints the
  5291. recommended parameters via the logging system. The detected dimensions
  5292. correspond to the non-black area of the input video.
  5293. It accepts the following parameters:
  5294. @table @option
  5295. @item limit
  5296. Set higher black value threshold, which can be optionally specified
  5297. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5298. value greater to the set value is considered non-black. It defaults to 24.
  5299. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5300. on the bitdepth of the pixel format.
  5301. @item round
  5302. The value which the width/height should be divisible by. It defaults to
  5303. 16. The offset is automatically adjusted to center the video. Use 2 to
  5304. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5305. encoding to most video codecs.
  5306. @item reset_count, reset
  5307. Set the counter that determines after how many frames cropdetect will
  5308. reset the previously detected largest video area and start over to
  5309. detect the current optimal crop area. Default value is 0.
  5310. This can be useful when channel logos distort the video area. 0
  5311. indicates 'never reset', and returns the largest area encountered during
  5312. playback.
  5313. @end table
  5314. @anchor{curves}
  5315. @section curves
  5316. Apply color adjustments using curves.
  5317. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5318. component (red, green and blue) has its values defined by @var{N} key points
  5319. tied from each other using a smooth curve. The x-axis represents the pixel
  5320. values from the input frame, and the y-axis the new pixel values to be set for
  5321. the output frame.
  5322. By default, a component curve is defined by the two points @var{(0;0)} and
  5323. @var{(1;1)}. This creates a straight line where each original pixel value is
  5324. "adjusted" to its own value, which means no change to the image.
  5325. The filter allows you to redefine these two points and add some more. A new
  5326. curve (using a natural cubic spline interpolation) will be define to pass
  5327. smoothly through all these new coordinates. The new defined points needs to be
  5328. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5329. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5330. the vector spaces, the values will be clipped accordingly.
  5331. The filter accepts the following options:
  5332. @table @option
  5333. @item preset
  5334. Select one of the available color presets. This option can be used in addition
  5335. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5336. options takes priority on the preset values.
  5337. Available presets are:
  5338. @table @samp
  5339. @item none
  5340. @item color_negative
  5341. @item cross_process
  5342. @item darker
  5343. @item increase_contrast
  5344. @item lighter
  5345. @item linear_contrast
  5346. @item medium_contrast
  5347. @item negative
  5348. @item strong_contrast
  5349. @item vintage
  5350. @end table
  5351. Default is @code{none}.
  5352. @item master, m
  5353. Set the master key points. These points will define a second pass mapping. It
  5354. is sometimes called a "luminance" or "value" mapping. It can be used with
  5355. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5356. post-processing LUT.
  5357. @item red, r
  5358. Set the key points for the red component.
  5359. @item green, g
  5360. Set the key points for the green component.
  5361. @item blue, b
  5362. Set the key points for the blue component.
  5363. @item all
  5364. Set the key points for all components (not including master).
  5365. Can be used in addition to the other key points component
  5366. options. In this case, the unset component(s) will fallback on this
  5367. @option{all} setting.
  5368. @item psfile
  5369. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5370. @item plot
  5371. Save Gnuplot script of the curves in specified file.
  5372. @end table
  5373. To avoid some filtergraph syntax conflicts, each key points list need to be
  5374. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5375. @subsection Examples
  5376. @itemize
  5377. @item
  5378. Increase slightly the middle level of blue:
  5379. @example
  5380. curves=blue='0/0 0.5/0.58 1/1'
  5381. @end example
  5382. @item
  5383. Vintage effect:
  5384. @example
  5385. 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'
  5386. @end example
  5387. Here we obtain the following coordinates for each components:
  5388. @table @var
  5389. @item red
  5390. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5391. @item green
  5392. @code{(0;0) (0.50;0.48) (1;1)}
  5393. @item blue
  5394. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5395. @end table
  5396. @item
  5397. The previous example can also be achieved with the associated built-in preset:
  5398. @example
  5399. curves=preset=vintage
  5400. @end example
  5401. @item
  5402. Or simply:
  5403. @example
  5404. curves=vintage
  5405. @end example
  5406. @item
  5407. Use a Photoshop preset and redefine the points of the green component:
  5408. @example
  5409. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5410. @end example
  5411. @item
  5412. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5413. and @command{gnuplot}:
  5414. @example
  5415. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5416. gnuplot -p /tmp/curves.plt
  5417. @end example
  5418. @end itemize
  5419. @section datascope
  5420. Video data analysis filter.
  5421. This filter shows hexadecimal pixel values of part of video.
  5422. The filter accepts the following options:
  5423. @table @option
  5424. @item size, s
  5425. Set output video size.
  5426. @item x
  5427. Set x offset from where to pick pixels.
  5428. @item y
  5429. Set y offset from where to pick pixels.
  5430. @item mode
  5431. Set scope mode, can be one of the following:
  5432. @table @samp
  5433. @item mono
  5434. Draw hexadecimal pixel values with white color on black background.
  5435. @item color
  5436. Draw hexadecimal pixel values with input video pixel color on black
  5437. background.
  5438. @item color2
  5439. Draw hexadecimal pixel values on color background picked from input video,
  5440. the text color is picked in such way so its always visible.
  5441. @end table
  5442. @item axis
  5443. Draw rows and columns numbers on left and top of video.
  5444. @item opacity
  5445. Set background opacity.
  5446. @end table
  5447. @section dctdnoiz
  5448. Denoise frames using 2D DCT (frequency domain filtering).
  5449. This filter is not designed for real time.
  5450. The filter accepts the following options:
  5451. @table @option
  5452. @item sigma, s
  5453. Set the noise sigma constant.
  5454. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5455. coefficient (absolute value) below this threshold with be dropped.
  5456. If you need a more advanced filtering, see @option{expr}.
  5457. Default is @code{0}.
  5458. @item overlap
  5459. Set number overlapping pixels for each block. Since the filter can be slow, you
  5460. may want to reduce this value, at the cost of a less effective filter and the
  5461. risk of various artefacts.
  5462. If the overlapping value doesn't permit processing the whole input width or
  5463. height, a warning will be displayed and according borders won't be denoised.
  5464. Default value is @var{blocksize}-1, which is the best possible setting.
  5465. @item expr, e
  5466. Set the coefficient factor expression.
  5467. For each coefficient of a DCT block, this expression will be evaluated as a
  5468. multiplier value for the coefficient.
  5469. If this is option is set, the @option{sigma} option will be ignored.
  5470. The absolute value of the coefficient can be accessed through the @var{c}
  5471. variable.
  5472. @item n
  5473. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5474. @var{blocksize}, which is the width and height of the processed blocks.
  5475. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5476. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5477. on the speed processing. Also, a larger block size does not necessarily means a
  5478. better de-noising.
  5479. @end table
  5480. @subsection Examples
  5481. Apply a denoise with a @option{sigma} of @code{4.5}:
  5482. @example
  5483. dctdnoiz=4.5
  5484. @end example
  5485. The same operation can be achieved using the expression system:
  5486. @example
  5487. dctdnoiz=e='gte(c, 4.5*3)'
  5488. @end example
  5489. Violent denoise using a block size of @code{16x16}:
  5490. @example
  5491. dctdnoiz=15:n=4
  5492. @end example
  5493. @section deband
  5494. Remove banding artifacts from input video.
  5495. It works by replacing banded pixels with average value of referenced pixels.
  5496. The filter accepts the following options:
  5497. @table @option
  5498. @item 1thr
  5499. @item 2thr
  5500. @item 3thr
  5501. @item 4thr
  5502. Set banding detection threshold for each plane. Default is 0.02.
  5503. Valid range is 0.00003 to 0.5.
  5504. If difference between current pixel and reference pixel is less than threshold,
  5505. it will be considered as banded.
  5506. @item range, r
  5507. Banding detection range in pixels. Default is 16. If positive, random number
  5508. in range 0 to set value will be used. If negative, exact absolute value
  5509. will be used.
  5510. The range defines square of four pixels around current pixel.
  5511. @item direction, d
  5512. Set direction in radians from which four pixel will be compared. If positive,
  5513. random direction from 0 to set direction will be picked. If negative, exact of
  5514. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5515. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5516. column.
  5517. @item blur, b
  5518. If enabled, current pixel is compared with average value of all four
  5519. surrounding pixels. The default is enabled. If disabled current pixel is
  5520. compared with all four surrounding pixels. The pixel is considered banded
  5521. if only all four differences with surrounding pixels are less than threshold.
  5522. @item coupling, c
  5523. If enabled, current pixel is changed if and only if all pixel components are banded,
  5524. e.g. banding detection threshold is triggered for all color components.
  5525. The default is disabled.
  5526. @end table
  5527. @section deblock
  5528. Remove blocking artifacts from input video.
  5529. The filter accepts the following options:
  5530. @table @option
  5531. @item filter
  5532. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5533. This controls what kind of deblocking is applied.
  5534. @item block
  5535. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5536. @item alpha
  5537. @item beta
  5538. @item gamma
  5539. @item delta
  5540. Set blocking detection thresholds. Allowed range is 0 to 1.
  5541. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5542. Using higher threshold gives more deblocking strength.
  5543. Setting @var{alpha} controls threshold detection at exact edge of block.
  5544. Remaining options controls threshold detection near the edge. Each one for
  5545. below/above or left/right. Setting any of those to @var{0} disables
  5546. deblocking.
  5547. @item planes
  5548. Set planes to filter. Default is to filter all available planes.
  5549. @end table
  5550. @subsection Examples
  5551. @itemize
  5552. @item
  5553. Deblock using weak filter and block size of 4 pixels.
  5554. @example
  5555. deblock=filter=weak:block=4
  5556. @end example
  5557. @item
  5558. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5559. deblocking more edges.
  5560. @example
  5561. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5562. @end example
  5563. @item
  5564. Similar as above, but filter only first plane.
  5565. @example
  5566. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5567. @end example
  5568. @item
  5569. Similar as above, but filter only second and third plane.
  5570. @example
  5571. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5572. @end example
  5573. @end itemize
  5574. @anchor{decimate}
  5575. @section decimate
  5576. Drop duplicated frames at regular intervals.
  5577. The filter accepts the following options:
  5578. @table @option
  5579. @item cycle
  5580. Set the number of frames from which one will be dropped. Setting this to
  5581. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5582. Default is @code{5}.
  5583. @item dupthresh
  5584. Set the threshold for duplicate detection. If the difference metric for a frame
  5585. is less than or equal to this value, then it is declared as duplicate. Default
  5586. is @code{1.1}
  5587. @item scthresh
  5588. Set scene change threshold. Default is @code{15}.
  5589. @item blockx
  5590. @item blocky
  5591. Set the size of the x and y-axis blocks used during metric calculations.
  5592. Larger blocks give better noise suppression, but also give worse detection of
  5593. small movements. Must be a power of two. Default is @code{32}.
  5594. @item ppsrc
  5595. Mark main input as a pre-processed input and activate clean source input
  5596. stream. This allows the input to be pre-processed with various filters to help
  5597. the metrics calculation while keeping the frame selection lossless. When set to
  5598. @code{1}, the first stream is for the pre-processed input, and the second
  5599. stream is the clean source from where the kept frames are chosen. Default is
  5600. @code{0}.
  5601. @item chroma
  5602. Set whether or not chroma is considered in the metric calculations. Default is
  5603. @code{1}.
  5604. @end table
  5605. @section deconvolve
  5606. Apply 2D deconvolution of video stream in frequency domain using second stream
  5607. as impulse.
  5608. The filter accepts the following options:
  5609. @table @option
  5610. @item planes
  5611. Set which planes to process.
  5612. @item impulse
  5613. Set which impulse video frames will be processed, can be @var{first}
  5614. or @var{all}. Default is @var{all}.
  5615. @item noise
  5616. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5617. and height are not same and not power of 2 or if stream prior to convolving
  5618. had noise.
  5619. @end table
  5620. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5621. @section deflate
  5622. Apply deflate effect to the video.
  5623. This filter replaces the pixel by the local(3x3) average by taking into account
  5624. only values lower than the pixel.
  5625. It accepts the following options:
  5626. @table @option
  5627. @item threshold0
  5628. @item threshold1
  5629. @item threshold2
  5630. @item threshold3
  5631. Limit the maximum change for each plane, default is 65535.
  5632. If 0, plane will remain unchanged.
  5633. @end table
  5634. @section deflicker
  5635. Remove temporal frame luminance variations.
  5636. It accepts the following options:
  5637. @table @option
  5638. @item size, s
  5639. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5640. @item mode, m
  5641. Set averaging mode to smooth temporal luminance variations.
  5642. Available values are:
  5643. @table @samp
  5644. @item am
  5645. Arithmetic mean
  5646. @item gm
  5647. Geometric mean
  5648. @item hm
  5649. Harmonic mean
  5650. @item qm
  5651. Quadratic mean
  5652. @item cm
  5653. Cubic mean
  5654. @item pm
  5655. Power mean
  5656. @item median
  5657. Median
  5658. @end table
  5659. @item bypass
  5660. Do not actually modify frame. Useful when one only wants metadata.
  5661. @end table
  5662. @section dejudder
  5663. Remove judder produced by partially interlaced telecined content.
  5664. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5665. source was partially telecined content then the output of @code{pullup,dejudder}
  5666. will have a variable frame rate. May change the recorded frame rate of the
  5667. container. Aside from that change, this filter will not affect constant frame
  5668. rate video.
  5669. The option available in this filter is:
  5670. @table @option
  5671. @item cycle
  5672. Specify the length of the window over which the judder repeats.
  5673. Accepts any integer greater than 1. Useful values are:
  5674. @table @samp
  5675. @item 4
  5676. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5677. @item 5
  5678. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5679. @item 20
  5680. If a mixture of the two.
  5681. @end table
  5682. The default is @samp{4}.
  5683. @end table
  5684. @section delogo
  5685. Suppress a TV station logo by a simple interpolation of the surrounding
  5686. pixels. Just set a rectangle covering the logo and watch it disappear
  5687. (and sometimes something even uglier appear - your mileage may vary).
  5688. It accepts the following parameters:
  5689. @table @option
  5690. @item x
  5691. @item y
  5692. Specify the top left corner coordinates of the logo. They must be
  5693. specified.
  5694. @item w
  5695. @item h
  5696. Specify the width and height of the logo to clear. They must be
  5697. specified.
  5698. @item band, t
  5699. Specify the thickness of the fuzzy edge of the rectangle (added to
  5700. @var{w} and @var{h}). The default value is 1. This option is
  5701. deprecated, setting higher values should no longer be necessary and
  5702. is not recommended.
  5703. @item show
  5704. When set to 1, a green rectangle is drawn on the screen to simplify
  5705. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5706. The default value is 0.
  5707. The rectangle is drawn on the outermost pixels which will be (partly)
  5708. replaced with interpolated values. The values of the next pixels
  5709. immediately outside this rectangle in each direction will be used to
  5710. compute the interpolated pixel values inside the rectangle.
  5711. @end table
  5712. @subsection Examples
  5713. @itemize
  5714. @item
  5715. Set a rectangle covering the area with top left corner coordinates 0,0
  5716. and size 100x77, and a band of size 10:
  5717. @example
  5718. delogo=x=0:y=0:w=100:h=77:band=10
  5719. @end example
  5720. @end itemize
  5721. @section deshake
  5722. Attempt to fix small changes in horizontal and/or vertical shift. This
  5723. filter helps remove camera shake from hand-holding a camera, bumping a
  5724. tripod, moving on a vehicle, etc.
  5725. The filter accepts the following options:
  5726. @table @option
  5727. @item x
  5728. @item y
  5729. @item w
  5730. @item h
  5731. Specify a rectangular area where to limit the search for motion
  5732. vectors.
  5733. If desired the search for motion vectors can be limited to a
  5734. rectangular area of the frame defined by its top left corner, width
  5735. and height. These parameters have the same meaning as the drawbox
  5736. filter which can be used to visualise the position of the bounding
  5737. box.
  5738. This is useful when simultaneous movement of subjects within the frame
  5739. might be confused for camera motion by the motion vector search.
  5740. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5741. then the full frame is used. This allows later options to be set
  5742. without specifying the bounding box for the motion vector search.
  5743. Default - search the whole frame.
  5744. @item rx
  5745. @item ry
  5746. Specify the maximum extent of movement in x and y directions in the
  5747. range 0-64 pixels. Default 16.
  5748. @item edge
  5749. Specify how to generate pixels to fill blanks at the edge of the
  5750. frame. Available values are:
  5751. @table @samp
  5752. @item blank, 0
  5753. Fill zeroes at blank locations
  5754. @item original, 1
  5755. Original image at blank locations
  5756. @item clamp, 2
  5757. Extruded edge value at blank locations
  5758. @item mirror, 3
  5759. Mirrored edge at blank locations
  5760. @end table
  5761. Default value is @samp{mirror}.
  5762. @item blocksize
  5763. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5764. default 8.
  5765. @item contrast
  5766. Specify the contrast threshold for blocks. Only blocks with more than
  5767. the specified contrast (difference between darkest and lightest
  5768. pixels) will be considered. Range 1-255, default 125.
  5769. @item search
  5770. Specify the search strategy. Available values are:
  5771. @table @samp
  5772. @item exhaustive, 0
  5773. Set exhaustive search
  5774. @item less, 1
  5775. Set less exhaustive search.
  5776. @end table
  5777. Default value is @samp{exhaustive}.
  5778. @item filename
  5779. If set then a detailed log of the motion search is written to the
  5780. specified file.
  5781. @end table
  5782. @section despill
  5783. Remove unwanted contamination of foreground colors, caused by reflected color of
  5784. greenscreen or bluescreen.
  5785. This filter accepts the following options:
  5786. @table @option
  5787. @item type
  5788. Set what type of despill to use.
  5789. @item mix
  5790. Set how spillmap will be generated.
  5791. @item expand
  5792. Set how much to get rid of still remaining spill.
  5793. @item red
  5794. Controls amount of red in spill area.
  5795. @item green
  5796. Controls amount of green in spill area.
  5797. Should be -1 for greenscreen.
  5798. @item blue
  5799. Controls amount of blue in spill area.
  5800. Should be -1 for bluescreen.
  5801. @item brightness
  5802. Controls brightness of spill area, preserving colors.
  5803. @item alpha
  5804. Modify alpha from generated spillmap.
  5805. @end table
  5806. @section detelecine
  5807. Apply an exact inverse of the telecine operation. It requires a predefined
  5808. pattern specified using the pattern option which must be the same as that passed
  5809. to the telecine filter.
  5810. This filter accepts the following options:
  5811. @table @option
  5812. @item first_field
  5813. @table @samp
  5814. @item top, t
  5815. top field first
  5816. @item bottom, b
  5817. bottom field first
  5818. The default value is @code{top}.
  5819. @end table
  5820. @item pattern
  5821. A string of numbers representing the pulldown pattern you wish to apply.
  5822. The default value is @code{23}.
  5823. @item start_frame
  5824. A number representing position of the first frame with respect to the telecine
  5825. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5826. @end table
  5827. @section dilation
  5828. Apply dilation effect to the video.
  5829. This filter replaces the pixel by the local(3x3) maximum.
  5830. It accepts the following options:
  5831. @table @option
  5832. @item threshold0
  5833. @item threshold1
  5834. @item threshold2
  5835. @item threshold3
  5836. Limit the maximum change for each plane, default is 65535.
  5837. If 0, plane will remain unchanged.
  5838. @item coordinates
  5839. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5840. pixels are used.
  5841. Flags to local 3x3 coordinates maps like this:
  5842. 1 2 3
  5843. 4 5
  5844. 6 7 8
  5845. @end table
  5846. @section displace
  5847. Displace pixels as indicated by second and third input stream.
  5848. It takes three input streams and outputs one stream, the first input is the
  5849. source, and second and third input are displacement maps.
  5850. The second input specifies how much to displace pixels along the
  5851. x-axis, while the third input specifies how much to displace pixels
  5852. along the y-axis.
  5853. If one of displacement map streams terminates, last frame from that
  5854. displacement map will be used.
  5855. Note that once generated, displacements maps can be reused over and over again.
  5856. A description of the accepted options follows.
  5857. @table @option
  5858. @item edge
  5859. Set displace behavior for pixels that are out of range.
  5860. Available values are:
  5861. @table @samp
  5862. @item blank
  5863. Missing pixels are replaced by black pixels.
  5864. @item smear
  5865. Adjacent pixels will spread out to replace missing pixels.
  5866. @item wrap
  5867. Out of range pixels are wrapped so they point to pixels of other side.
  5868. @item mirror
  5869. Out of range pixels will be replaced with mirrored pixels.
  5870. @end table
  5871. Default is @samp{smear}.
  5872. @end table
  5873. @subsection Examples
  5874. @itemize
  5875. @item
  5876. Add ripple effect to rgb input of video size hd720:
  5877. @example
  5878. 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
  5879. @end example
  5880. @item
  5881. Add wave effect to rgb input of video size hd720:
  5882. @example
  5883. 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
  5884. @end example
  5885. @end itemize
  5886. @section drawbox
  5887. Draw a colored box on the input image.
  5888. It accepts the following parameters:
  5889. @table @option
  5890. @item x
  5891. @item y
  5892. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5893. @item width, w
  5894. @item height, h
  5895. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5896. the input width and height. It defaults to 0.
  5897. @item color, c
  5898. Specify the color of the box to write. For the general syntax of this option,
  5899. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5900. value @code{invert} is used, the box edge color is the same as the
  5901. video with inverted luma.
  5902. @item thickness, t
  5903. The expression which sets the thickness of the box edge.
  5904. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5905. See below for the list of accepted constants.
  5906. @item replace
  5907. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5908. will overwrite the video's color and alpha pixels.
  5909. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5910. @end table
  5911. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5912. following constants:
  5913. @table @option
  5914. @item dar
  5915. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5916. @item hsub
  5917. @item vsub
  5918. horizontal and vertical chroma subsample values. For example for the
  5919. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5920. @item in_h, ih
  5921. @item in_w, iw
  5922. The input width and height.
  5923. @item sar
  5924. The input sample aspect ratio.
  5925. @item x
  5926. @item y
  5927. The x and y offset coordinates where the box is drawn.
  5928. @item w
  5929. @item h
  5930. The width and height of the drawn box.
  5931. @item t
  5932. The thickness of the drawn box.
  5933. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5934. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5935. @end table
  5936. @subsection Examples
  5937. @itemize
  5938. @item
  5939. Draw a black box around the edge of the input image:
  5940. @example
  5941. drawbox
  5942. @end example
  5943. @item
  5944. Draw a box with color red and an opacity of 50%:
  5945. @example
  5946. drawbox=10:20:200:60:red@@0.5
  5947. @end example
  5948. The previous example can be specified as:
  5949. @example
  5950. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5951. @end example
  5952. @item
  5953. Fill the box with pink color:
  5954. @example
  5955. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5956. @end example
  5957. @item
  5958. Draw a 2-pixel red 2.40:1 mask:
  5959. @example
  5960. 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
  5961. @end example
  5962. @end itemize
  5963. @section drawgrid
  5964. Draw a grid on the input image.
  5965. It accepts the following parameters:
  5966. @table @option
  5967. @item x
  5968. @item y
  5969. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5970. @item width, w
  5971. @item height, h
  5972. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5973. input width and height, respectively, minus @code{thickness}, so image gets
  5974. framed. Default to 0.
  5975. @item color, c
  5976. Specify the color of the grid. For the general syntax of this option,
  5977. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5978. value @code{invert} is used, the grid color is the same as the
  5979. video with inverted luma.
  5980. @item thickness, t
  5981. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5982. See below for the list of accepted constants.
  5983. @item replace
  5984. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5985. will overwrite the video's color and alpha pixels.
  5986. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5987. @end table
  5988. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5989. following constants:
  5990. @table @option
  5991. @item dar
  5992. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5993. @item hsub
  5994. @item vsub
  5995. horizontal and vertical chroma subsample values. For example for the
  5996. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5997. @item in_h, ih
  5998. @item in_w, iw
  5999. The input grid cell width and height.
  6000. @item sar
  6001. The input sample aspect ratio.
  6002. @item x
  6003. @item y
  6004. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6005. @item w
  6006. @item h
  6007. The width and height of the drawn cell.
  6008. @item t
  6009. The thickness of the drawn cell.
  6010. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6011. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6012. @end table
  6013. @subsection Examples
  6014. @itemize
  6015. @item
  6016. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6017. @example
  6018. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6019. @end example
  6020. @item
  6021. Draw a white 3x3 grid with an opacity of 50%:
  6022. @example
  6023. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6024. @end example
  6025. @end itemize
  6026. @anchor{drawtext}
  6027. @section drawtext
  6028. Draw a text string or text from a specified file on top of a video, using the
  6029. libfreetype library.
  6030. To enable compilation of this filter, you need to configure FFmpeg with
  6031. @code{--enable-libfreetype}.
  6032. To enable default font fallback and the @var{font} option you need to
  6033. configure FFmpeg with @code{--enable-libfontconfig}.
  6034. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6035. @code{--enable-libfribidi}.
  6036. @subsection Syntax
  6037. It accepts the following parameters:
  6038. @table @option
  6039. @item box
  6040. Used to draw a box around text using the background color.
  6041. The value must be either 1 (enable) or 0 (disable).
  6042. The default value of @var{box} is 0.
  6043. @item boxborderw
  6044. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6045. The default value of @var{boxborderw} is 0.
  6046. @item boxcolor
  6047. The color to be used for drawing box around text. For the syntax of this
  6048. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6049. The default value of @var{boxcolor} is "white".
  6050. @item line_spacing
  6051. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6052. The default value of @var{line_spacing} is 0.
  6053. @item borderw
  6054. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6055. The default value of @var{borderw} is 0.
  6056. @item bordercolor
  6057. Set the color to be used for drawing border around text. For the syntax of this
  6058. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6059. The default value of @var{bordercolor} is "black".
  6060. @item expansion
  6061. Select how the @var{text} is expanded. Can be either @code{none},
  6062. @code{strftime} (deprecated) or
  6063. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6064. below for details.
  6065. @item basetime
  6066. Set a start time for the count. Value is in microseconds. Only applied
  6067. in the deprecated strftime expansion mode. To emulate in normal expansion
  6068. mode use the @code{pts} function, supplying the start time (in seconds)
  6069. as the second argument.
  6070. @item fix_bounds
  6071. If true, check and fix text coords to avoid clipping.
  6072. @item fontcolor
  6073. The color to be used for drawing fonts. For the syntax of this option, check
  6074. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6075. The default value of @var{fontcolor} is "black".
  6076. @item fontcolor_expr
  6077. String which is expanded the same way as @var{text} to obtain dynamic
  6078. @var{fontcolor} value. By default this option has empty value and is not
  6079. processed. When this option is set, it overrides @var{fontcolor} option.
  6080. @item font
  6081. The font family to be used for drawing text. By default Sans.
  6082. @item fontfile
  6083. The font file to be used for drawing text. The path must be included.
  6084. This parameter is mandatory if the fontconfig support is disabled.
  6085. @item alpha
  6086. Draw the text applying alpha blending. The value can
  6087. be a number between 0.0 and 1.0.
  6088. The expression accepts the same variables @var{x, y} as well.
  6089. The default value is 1.
  6090. Please see @var{fontcolor_expr}.
  6091. @item fontsize
  6092. The font size to be used for drawing text.
  6093. The default value of @var{fontsize} is 16.
  6094. @item text_shaping
  6095. If set to 1, attempt to shape the text (for example, reverse the order of
  6096. right-to-left text and join Arabic characters) before drawing it.
  6097. Otherwise, just draw the text exactly as given.
  6098. By default 1 (if supported).
  6099. @item ft_load_flags
  6100. The flags to be used for loading the fonts.
  6101. The flags map the corresponding flags supported by libfreetype, and are
  6102. a combination of the following values:
  6103. @table @var
  6104. @item default
  6105. @item no_scale
  6106. @item no_hinting
  6107. @item render
  6108. @item no_bitmap
  6109. @item vertical_layout
  6110. @item force_autohint
  6111. @item crop_bitmap
  6112. @item pedantic
  6113. @item ignore_global_advance_width
  6114. @item no_recurse
  6115. @item ignore_transform
  6116. @item monochrome
  6117. @item linear_design
  6118. @item no_autohint
  6119. @end table
  6120. Default value is "default".
  6121. For more information consult the documentation for the FT_LOAD_*
  6122. libfreetype flags.
  6123. @item shadowcolor
  6124. The color to be used for drawing a shadow behind the drawn text. For the
  6125. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6126. ffmpeg-utils manual,ffmpeg-utils}.
  6127. The default value of @var{shadowcolor} is "black".
  6128. @item shadowx
  6129. @item shadowy
  6130. The x and y offsets for the text shadow position with respect to the
  6131. position of the text. They can be either positive or negative
  6132. values. The default value for both is "0".
  6133. @item start_number
  6134. The starting frame number for the n/frame_num variable. The default value
  6135. is "0".
  6136. @item tabsize
  6137. The size in number of spaces to use for rendering the tab.
  6138. Default value is 4.
  6139. @item timecode
  6140. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6141. format. It can be used with or without text parameter. @var{timecode_rate}
  6142. option must be specified.
  6143. @item timecode_rate, rate, r
  6144. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6145. integer. Minimum value is "1".
  6146. Drop-frame timecode is supported for frame rates 30 & 60.
  6147. @item tc24hmax
  6148. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6149. Default is 0 (disabled).
  6150. @item text
  6151. The text string to be drawn. The text must be a sequence of UTF-8
  6152. encoded characters.
  6153. This parameter is mandatory if no file is specified with the parameter
  6154. @var{textfile}.
  6155. @item textfile
  6156. A text file containing text to be drawn. The text must be a sequence
  6157. of UTF-8 encoded characters.
  6158. This parameter is mandatory if no text string is specified with the
  6159. parameter @var{text}.
  6160. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6161. @item reload
  6162. If set to 1, the @var{textfile} will be reloaded before each frame.
  6163. Be sure to update it atomically, or it may be read partially, or even fail.
  6164. @item x
  6165. @item y
  6166. The expressions which specify the offsets where text will be drawn
  6167. within the video frame. They are relative to the top/left border of the
  6168. output image.
  6169. The default value of @var{x} and @var{y} is "0".
  6170. See below for the list of accepted constants and functions.
  6171. @end table
  6172. The parameters for @var{x} and @var{y} are expressions containing the
  6173. following constants and functions:
  6174. @table @option
  6175. @item dar
  6176. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6177. @item hsub
  6178. @item vsub
  6179. horizontal and vertical chroma subsample values. For example for the
  6180. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6181. @item line_h, lh
  6182. the height of each text line
  6183. @item main_h, h, H
  6184. the input height
  6185. @item main_w, w, W
  6186. the input width
  6187. @item max_glyph_a, ascent
  6188. the maximum distance from the baseline to the highest/upper grid
  6189. coordinate used to place a glyph outline point, for all the rendered
  6190. glyphs.
  6191. It is a positive value, due to the grid's orientation with the Y axis
  6192. upwards.
  6193. @item max_glyph_d, descent
  6194. the maximum distance from the baseline to the lowest grid coordinate
  6195. used to place a glyph outline point, for all the rendered glyphs.
  6196. This is a negative value, due to the grid's orientation, with the Y axis
  6197. upwards.
  6198. @item max_glyph_h
  6199. maximum glyph height, that is the maximum height for all the glyphs
  6200. contained in the rendered text, it is equivalent to @var{ascent} -
  6201. @var{descent}.
  6202. @item max_glyph_w
  6203. maximum glyph width, that is the maximum width for all the glyphs
  6204. contained in the rendered text
  6205. @item n
  6206. the number of input frame, starting from 0
  6207. @item rand(min, max)
  6208. return a random number included between @var{min} and @var{max}
  6209. @item sar
  6210. The input sample aspect ratio.
  6211. @item t
  6212. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6213. @item text_h, th
  6214. the height of the rendered text
  6215. @item text_w, tw
  6216. the width of the rendered text
  6217. @item x
  6218. @item y
  6219. the x and y offset coordinates where the text is drawn.
  6220. These parameters allow the @var{x} and @var{y} expressions to refer
  6221. each other, so you can for example specify @code{y=x/dar}.
  6222. @end table
  6223. @anchor{drawtext_expansion}
  6224. @subsection Text expansion
  6225. If @option{expansion} is set to @code{strftime},
  6226. the filter recognizes strftime() sequences in the provided text and
  6227. expands them accordingly. Check the documentation of strftime(). This
  6228. feature is deprecated.
  6229. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6230. If @option{expansion} is set to @code{normal} (which is the default),
  6231. the following expansion mechanism is used.
  6232. The backslash character @samp{\}, followed by any character, always expands to
  6233. the second character.
  6234. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6235. braces is a function name, possibly followed by arguments separated by ':'.
  6236. If the arguments contain special characters or delimiters (':' or '@}'),
  6237. they should be escaped.
  6238. Note that they probably must also be escaped as the value for the
  6239. @option{text} option in the filter argument string and as the filter
  6240. argument in the filtergraph description, and possibly also for the shell,
  6241. that makes up to four levels of escaping; using a text file avoids these
  6242. problems.
  6243. The following functions are available:
  6244. @table @command
  6245. @item expr, e
  6246. The expression evaluation result.
  6247. It must take one argument specifying the expression to be evaluated,
  6248. which accepts the same constants and functions as the @var{x} and
  6249. @var{y} values. Note that not all constants should be used, for
  6250. example the text size is not known when evaluating the expression, so
  6251. the constants @var{text_w} and @var{text_h} will have an undefined
  6252. value.
  6253. @item expr_int_format, eif
  6254. Evaluate the expression's value and output as formatted integer.
  6255. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6256. The second argument specifies the output format. Allowed values are @samp{x},
  6257. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6258. @code{printf} function.
  6259. The third parameter is optional and sets the number of positions taken by the output.
  6260. It can be used to add padding with zeros from the left.
  6261. @item gmtime
  6262. The time at which the filter is running, expressed in UTC.
  6263. It can accept an argument: a strftime() format string.
  6264. @item localtime
  6265. The time at which the filter is running, expressed in the local time zone.
  6266. It can accept an argument: a strftime() format string.
  6267. @item metadata
  6268. Frame metadata. Takes one or two arguments.
  6269. The first argument is mandatory and specifies the metadata key.
  6270. The second argument is optional and specifies a default value, used when the
  6271. metadata key is not found or empty.
  6272. @item n, frame_num
  6273. The frame number, starting from 0.
  6274. @item pict_type
  6275. A 1 character description of the current picture type.
  6276. @item pts
  6277. The timestamp of the current frame.
  6278. It can take up to three arguments.
  6279. The first argument is the format of the timestamp; it defaults to @code{flt}
  6280. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6281. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6282. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6283. @code{localtime} stands for the timestamp of the frame formatted as
  6284. local time zone time.
  6285. The second argument is an offset added to the timestamp.
  6286. If the format is set to @code{localtime} or @code{gmtime},
  6287. a third argument may be supplied: a strftime() format string.
  6288. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6289. @end table
  6290. @subsection Examples
  6291. @itemize
  6292. @item
  6293. Draw "Test Text" with font FreeSerif, using the default values for the
  6294. optional parameters.
  6295. @example
  6296. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6297. @end example
  6298. @item
  6299. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6300. and y=50 (counting from the top-left corner of the screen), text is
  6301. yellow with a red box around it. Both the text and the box have an
  6302. opacity of 20%.
  6303. @example
  6304. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6305. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6306. @end example
  6307. Note that the double quotes are not necessary if spaces are not used
  6308. within the parameter list.
  6309. @item
  6310. Show the text at the center of the video frame:
  6311. @example
  6312. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6313. @end example
  6314. @item
  6315. Show the text at a random position, switching to a new position every 30 seconds:
  6316. @example
  6317. 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)"
  6318. @end example
  6319. @item
  6320. Show a text line sliding from right to left in the last row of the video
  6321. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6322. with no newlines.
  6323. @example
  6324. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6325. @end example
  6326. @item
  6327. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6328. @example
  6329. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6330. @end example
  6331. @item
  6332. Draw a single green letter "g", at the center of the input video.
  6333. The glyph baseline is placed at half screen height.
  6334. @example
  6335. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6336. @end example
  6337. @item
  6338. Show text for 1 second every 3 seconds:
  6339. @example
  6340. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6341. @end example
  6342. @item
  6343. Use fontconfig to set the font. Note that the colons need to be escaped.
  6344. @example
  6345. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6346. @end example
  6347. @item
  6348. Print the date of a real-time encoding (see strftime(3)):
  6349. @example
  6350. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6351. @end example
  6352. @item
  6353. Show text fading in and out (appearing/disappearing):
  6354. @example
  6355. #!/bin/sh
  6356. DS=1.0 # display start
  6357. DE=10.0 # display end
  6358. FID=1.5 # fade in duration
  6359. FOD=5 # fade out duration
  6360. 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 @}"
  6361. @end example
  6362. @item
  6363. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6364. and the @option{fontsize} value are included in the @option{y} offset.
  6365. @example
  6366. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6367. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6368. @end example
  6369. @end itemize
  6370. For more information about libfreetype, check:
  6371. @url{http://www.freetype.org/}.
  6372. For more information about fontconfig, check:
  6373. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6374. For more information about libfribidi, check:
  6375. @url{http://fribidi.org/}.
  6376. @section edgedetect
  6377. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6378. The filter accepts the following options:
  6379. @table @option
  6380. @item low
  6381. @item high
  6382. Set low and high threshold values used by the Canny thresholding
  6383. algorithm.
  6384. The high threshold selects the "strong" edge pixels, which are then
  6385. connected through 8-connectivity with the "weak" edge pixels selected
  6386. by the low threshold.
  6387. @var{low} and @var{high} threshold values must be chosen in the range
  6388. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6389. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6390. is @code{50/255}.
  6391. @item mode
  6392. Define the drawing mode.
  6393. @table @samp
  6394. @item wires
  6395. Draw white/gray wires on black background.
  6396. @item colormix
  6397. Mix the colors to create a paint/cartoon effect.
  6398. @item canny
  6399. Apply Canny edge detector on all selected planes.
  6400. @end table
  6401. Default value is @var{wires}.
  6402. @item planes
  6403. Select planes for filtering. By default all available planes are filtered.
  6404. @end table
  6405. @subsection Examples
  6406. @itemize
  6407. @item
  6408. Standard edge detection with custom values for the hysteresis thresholding:
  6409. @example
  6410. edgedetect=low=0.1:high=0.4
  6411. @end example
  6412. @item
  6413. Painting effect without thresholding:
  6414. @example
  6415. edgedetect=mode=colormix:high=0
  6416. @end example
  6417. @end itemize
  6418. @section eq
  6419. Set brightness, contrast, saturation and approximate gamma adjustment.
  6420. The filter accepts the following options:
  6421. @table @option
  6422. @item contrast
  6423. Set the contrast expression. The value must be a float value in range
  6424. @code{-2.0} to @code{2.0}. The default value is "1".
  6425. @item brightness
  6426. Set the brightness expression. The value must be a float value in
  6427. range @code{-1.0} to @code{1.0}. The default value is "0".
  6428. @item saturation
  6429. Set the saturation expression. The value must be a float in
  6430. range @code{0.0} to @code{3.0}. The default value is "1".
  6431. @item gamma
  6432. Set the gamma expression. The value must be a float in range
  6433. @code{0.1} to @code{10.0}. The default value is "1".
  6434. @item gamma_r
  6435. Set the gamma expression for red. The value must be a float in
  6436. range @code{0.1} to @code{10.0}. The default value is "1".
  6437. @item gamma_g
  6438. Set the gamma expression for green. The value must be a float in range
  6439. @code{0.1} to @code{10.0}. The default value is "1".
  6440. @item gamma_b
  6441. Set the gamma expression for blue. The value must be a float in range
  6442. @code{0.1} to @code{10.0}. The default value is "1".
  6443. @item gamma_weight
  6444. Set the gamma weight expression. It can be used to reduce the effect
  6445. of a high gamma value on bright image areas, e.g. keep them from
  6446. getting overamplified and just plain white. The value must be a float
  6447. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6448. gamma correction all the way down while @code{1.0} leaves it at its
  6449. full strength. Default is "1".
  6450. @item eval
  6451. Set when the expressions for brightness, contrast, saturation and
  6452. gamma expressions are evaluated.
  6453. It accepts the following values:
  6454. @table @samp
  6455. @item init
  6456. only evaluate expressions once during the filter initialization or
  6457. when a command is processed
  6458. @item frame
  6459. evaluate expressions for each incoming frame
  6460. @end table
  6461. Default value is @samp{init}.
  6462. @end table
  6463. The expressions accept the following parameters:
  6464. @table @option
  6465. @item n
  6466. frame count of the input frame starting from 0
  6467. @item pos
  6468. byte position of the corresponding packet in the input file, NAN if
  6469. unspecified
  6470. @item r
  6471. frame rate of the input video, NAN if the input frame rate is unknown
  6472. @item t
  6473. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6474. @end table
  6475. @subsection Commands
  6476. The filter supports the following commands:
  6477. @table @option
  6478. @item contrast
  6479. Set the contrast expression.
  6480. @item brightness
  6481. Set the brightness expression.
  6482. @item saturation
  6483. Set the saturation expression.
  6484. @item gamma
  6485. Set the gamma expression.
  6486. @item gamma_r
  6487. Set the gamma_r expression.
  6488. @item gamma_g
  6489. Set gamma_g expression.
  6490. @item gamma_b
  6491. Set gamma_b expression.
  6492. @item gamma_weight
  6493. Set gamma_weight expression.
  6494. The command accepts the same syntax of the corresponding option.
  6495. If the specified expression is not valid, it is kept at its current
  6496. value.
  6497. @end table
  6498. @section erosion
  6499. Apply erosion effect to the video.
  6500. This filter replaces the pixel by the local(3x3) minimum.
  6501. It accepts the following options:
  6502. @table @option
  6503. @item threshold0
  6504. @item threshold1
  6505. @item threshold2
  6506. @item threshold3
  6507. Limit the maximum change for each plane, default is 65535.
  6508. If 0, plane will remain unchanged.
  6509. @item coordinates
  6510. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6511. pixels are used.
  6512. Flags to local 3x3 coordinates maps like this:
  6513. 1 2 3
  6514. 4 5
  6515. 6 7 8
  6516. @end table
  6517. @section extractplanes
  6518. Extract color channel components from input video stream into
  6519. separate grayscale video streams.
  6520. The filter accepts the following option:
  6521. @table @option
  6522. @item planes
  6523. Set plane(s) to extract.
  6524. Available values for planes are:
  6525. @table @samp
  6526. @item y
  6527. @item u
  6528. @item v
  6529. @item a
  6530. @item r
  6531. @item g
  6532. @item b
  6533. @end table
  6534. Choosing planes not available in the input will result in an error.
  6535. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6536. with @code{y}, @code{u}, @code{v} planes at same time.
  6537. @end table
  6538. @subsection Examples
  6539. @itemize
  6540. @item
  6541. Extract luma, u and v color channel component from input video frame
  6542. into 3 grayscale outputs:
  6543. @example
  6544. 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
  6545. @end example
  6546. @end itemize
  6547. @section elbg
  6548. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6549. For each input image, the filter will compute the optimal mapping from
  6550. the input to the output given the codebook length, that is the number
  6551. of distinct output colors.
  6552. This filter accepts the following options.
  6553. @table @option
  6554. @item codebook_length, l
  6555. Set codebook length. The value must be a positive integer, and
  6556. represents the number of distinct output colors. Default value is 256.
  6557. @item nb_steps, n
  6558. Set the maximum number of iterations to apply for computing the optimal
  6559. mapping. The higher the value the better the result and the higher the
  6560. computation time. Default value is 1.
  6561. @item seed, s
  6562. Set a random seed, must be an integer included between 0 and
  6563. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6564. will try to use a good random seed on a best effort basis.
  6565. @item pal8
  6566. Set pal8 output pixel format. This option does not work with codebook
  6567. length greater than 256.
  6568. @end table
  6569. @section entropy
  6570. Measure graylevel entropy in histogram of color channels of video frames.
  6571. It accepts the following parameters:
  6572. @table @option
  6573. @item mode
  6574. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6575. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6576. between neighbour histogram values.
  6577. @end table
  6578. @section fade
  6579. Apply a fade-in/out effect to the input video.
  6580. It accepts the following parameters:
  6581. @table @option
  6582. @item type, t
  6583. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6584. effect.
  6585. Default is @code{in}.
  6586. @item start_frame, s
  6587. Specify the number of the frame to start applying the fade
  6588. effect at. Default is 0.
  6589. @item nb_frames, n
  6590. The number of frames that the fade effect lasts. At the end of the
  6591. fade-in effect, the output video will have the same intensity as the input video.
  6592. At the end of the fade-out transition, the output video will be filled with the
  6593. selected @option{color}.
  6594. Default is 25.
  6595. @item alpha
  6596. If set to 1, fade only alpha channel, if one exists on the input.
  6597. Default value is 0.
  6598. @item start_time, st
  6599. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6600. effect. If both start_frame and start_time are specified, the fade will start at
  6601. whichever comes last. Default is 0.
  6602. @item duration, d
  6603. The number of seconds for which the fade effect has to last. At the end of the
  6604. fade-in effect the output video will have the same intensity as the input video,
  6605. at the end of the fade-out transition the output video will be filled with the
  6606. selected @option{color}.
  6607. If both duration and nb_frames are specified, duration is used. Default is 0
  6608. (nb_frames is used by default).
  6609. @item color, c
  6610. Specify the color of the fade. Default is "black".
  6611. @end table
  6612. @subsection Examples
  6613. @itemize
  6614. @item
  6615. Fade in the first 30 frames of video:
  6616. @example
  6617. fade=in:0:30
  6618. @end example
  6619. The command above is equivalent to:
  6620. @example
  6621. fade=t=in:s=0:n=30
  6622. @end example
  6623. @item
  6624. Fade out the last 45 frames of a 200-frame video:
  6625. @example
  6626. fade=out:155:45
  6627. fade=type=out:start_frame=155:nb_frames=45
  6628. @end example
  6629. @item
  6630. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6631. @example
  6632. fade=in:0:25, fade=out:975:25
  6633. @end example
  6634. @item
  6635. Make the first 5 frames yellow, then fade in from frame 5-24:
  6636. @example
  6637. fade=in:5:20:color=yellow
  6638. @end example
  6639. @item
  6640. Fade in alpha over first 25 frames of video:
  6641. @example
  6642. fade=in:0:25:alpha=1
  6643. @end example
  6644. @item
  6645. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6646. @example
  6647. fade=t=in:st=5.5:d=0.5
  6648. @end example
  6649. @end itemize
  6650. @section fftfilt
  6651. Apply arbitrary expressions to samples in frequency domain
  6652. @table @option
  6653. @item dc_Y
  6654. Adjust the dc value (gain) of the luma plane of the image. The filter
  6655. accepts an integer value in range @code{0} to @code{1000}. The default
  6656. value is set to @code{0}.
  6657. @item dc_U
  6658. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6659. filter accepts an integer value in range @code{0} to @code{1000}. The
  6660. default value is set to @code{0}.
  6661. @item dc_V
  6662. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6663. filter accepts an integer value in range @code{0} to @code{1000}. The
  6664. default value is set to @code{0}.
  6665. @item weight_Y
  6666. Set the frequency domain weight expression for the luma plane.
  6667. @item weight_U
  6668. Set the frequency domain weight expression for the 1st chroma plane.
  6669. @item weight_V
  6670. Set the frequency domain weight expression for the 2nd chroma plane.
  6671. @item eval
  6672. Set when the expressions are evaluated.
  6673. It accepts the following values:
  6674. @table @samp
  6675. @item init
  6676. Only evaluate expressions once during the filter initialization.
  6677. @item frame
  6678. Evaluate expressions for each incoming frame.
  6679. @end table
  6680. Default value is @samp{init}.
  6681. The filter accepts the following variables:
  6682. @item X
  6683. @item Y
  6684. The coordinates of the current sample.
  6685. @item W
  6686. @item H
  6687. The width and height of the image.
  6688. @item N
  6689. The number of input frame, starting from 0.
  6690. @end table
  6691. @subsection Examples
  6692. @itemize
  6693. @item
  6694. High-pass:
  6695. @example
  6696. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6697. @end example
  6698. @item
  6699. Low-pass:
  6700. @example
  6701. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6702. @end example
  6703. @item
  6704. Sharpen:
  6705. @example
  6706. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6707. @end example
  6708. @item
  6709. Blur:
  6710. @example
  6711. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6712. @end example
  6713. @end itemize
  6714. @section fftdnoiz
  6715. Denoise frames using 3D FFT (frequency domain filtering).
  6716. The filter accepts the following options:
  6717. @table @option
  6718. @item sigma
  6719. Set the noise sigma constant. This sets denoising strength.
  6720. Default value is 1. Allowed range is from 0 to 30.
  6721. Using very high sigma with low overlap may give blocking artifacts.
  6722. @item amount
  6723. Set amount of denoising. By default all detected noise is reduced.
  6724. Default value is 1. Allowed range is from 0 to 1.
  6725. @item block
  6726. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  6727. Actual size of block in pixels is 2 to power of @var{block}, so by default
  6728. block size in pixels is 2^4 which is 16.
  6729. @item overlap
  6730. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  6731. @item prev
  6732. Set number of previous frames to use for denoising. By default is set to 0.
  6733. @item next
  6734. Set number of next frames to to use for denoising. By default is set to 0.
  6735. @item planes
  6736. Set planes which will be filtered, by default are all available filtered
  6737. except alpha.
  6738. @end table
  6739. @section field
  6740. Extract a single field from an interlaced image using stride
  6741. arithmetic to avoid wasting CPU time. The output frames are marked as
  6742. non-interlaced.
  6743. The filter accepts the following options:
  6744. @table @option
  6745. @item type
  6746. Specify whether to extract the top (if the value is @code{0} or
  6747. @code{top}) or the bottom field (if the value is @code{1} or
  6748. @code{bottom}).
  6749. @end table
  6750. @section fieldhint
  6751. Create new frames by copying the top and bottom fields from surrounding frames
  6752. supplied as numbers by the hint file.
  6753. @table @option
  6754. @item hint
  6755. Set file containing hints: absolute/relative frame numbers.
  6756. There must be one line for each frame in a clip. Each line must contain two
  6757. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6758. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6759. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6760. for @code{relative} mode. First number tells from which frame to pick up top
  6761. field and second number tells from which frame to pick up bottom field.
  6762. If optionally followed by @code{+} output frame will be marked as interlaced,
  6763. else if followed by @code{-} output frame will be marked as progressive, else
  6764. it will be marked same as input frame.
  6765. If line starts with @code{#} or @code{;} that line is skipped.
  6766. @item mode
  6767. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6768. @end table
  6769. Example of first several lines of @code{hint} file for @code{relative} mode:
  6770. @example
  6771. 0,0 - # first frame
  6772. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6773. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6774. 1,0 -
  6775. 0,0 -
  6776. 0,0 -
  6777. 1,0 -
  6778. 1,0 -
  6779. 1,0 -
  6780. 0,0 -
  6781. 0,0 -
  6782. 1,0 -
  6783. 1,0 -
  6784. 1,0 -
  6785. 0,0 -
  6786. @end example
  6787. @section fieldmatch
  6788. Field matching filter for inverse telecine. It is meant to reconstruct the
  6789. progressive frames from a telecined stream. The filter does not drop duplicated
  6790. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6791. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6792. The separation of the field matching and the decimation is notably motivated by
  6793. the possibility of inserting a de-interlacing filter fallback between the two.
  6794. If the source has mixed telecined and real interlaced content,
  6795. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6796. But these remaining combed frames will be marked as interlaced, and thus can be
  6797. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6798. In addition to the various configuration options, @code{fieldmatch} can take an
  6799. optional second stream, activated through the @option{ppsrc} option. If
  6800. enabled, the frames reconstruction will be based on the fields and frames from
  6801. this second stream. This allows the first input to be pre-processed in order to
  6802. help the various algorithms of the filter, while keeping the output lossless
  6803. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6804. or brightness/contrast adjustments can help.
  6805. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6806. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6807. which @code{fieldmatch} is based on. While the semantic and usage are very
  6808. close, some behaviour and options names can differ.
  6809. The @ref{decimate} filter currently only works for constant frame rate input.
  6810. If your input has mixed telecined (30fps) and progressive content with a lower
  6811. framerate like 24fps use the following filterchain to produce the necessary cfr
  6812. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6813. The filter accepts the following options:
  6814. @table @option
  6815. @item order
  6816. Specify the assumed field order of the input stream. Available values are:
  6817. @table @samp
  6818. @item auto
  6819. Auto detect parity (use FFmpeg's internal parity value).
  6820. @item bff
  6821. Assume bottom field first.
  6822. @item tff
  6823. Assume top field first.
  6824. @end table
  6825. Note that it is sometimes recommended not to trust the parity announced by the
  6826. stream.
  6827. Default value is @var{auto}.
  6828. @item mode
  6829. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6830. sense that it won't risk creating jerkiness due to duplicate frames when
  6831. possible, but if there are bad edits or blended fields it will end up
  6832. outputting combed frames when a good match might actually exist. On the other
  6833. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6834. but will almost always find a good frame if there is one. The other values are
  6835. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6836. jerkiness and creating duplicate frames versus finding good matches in sections
  6837. with bad edits, orphaned fields, blended fields, etc.
  6838. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6839. Available values are:
  6840. @table @samp
  6841. @item pc
  6842. 2-way matching (p/c)
  6843. @item pc_n
  6844. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6845. @item pc_u
  6846. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6847. @item pc_n_ub
  6848. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6849. still combed (p/c + n + u/b)
  6850. @item pcn
  6851. 3-way matching (p/c/n)
  6852. @item pcn_ub
  6853. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6854. detected as combed (p/c/n + u/b)
  6855. @end table
  6856. The parenthesis at the end indicate the matches that would be used for that
  6857. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6858. @var{top}).
  6859. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6860. the slowest.
  6861. Default value is @var{pc_n}.
  6862. @item ppsrc
  6863. Mark the main input stream as a pre-processed input, and enable the secondary
  6864. input stream as the clean source to pick the fields from. See the filter
  6865. introduction for more details. It is similar to the @option{clip2} feature from
  6866. VFM/TFM.
  6867. Default value is @code{0} (disabled).
  6868. @item field
  6869. Set the field to match from. It is recommended to set this to the same value as
  6870. @option{order} unless you experience matching failures with that setting. In
  6871. certain circumstances changing the field that is used to match from can have a
  6872. large impact on matching performance. Available values are:
  6873. @table @samp
  6874. @item auto
  6875. Automatic (same value as @option{order}).
  6876. @item bottom
  6877. Match from the bottom field.
  6878. @item top
  6879. Match from the top field.
  6880. @end table
  6881. Default value is @var{auto}.
  6882. @item mchroma
  6883. Set whether or not chroma is included during the match comparisons. In most
  6884. cases it is recommended to leave this enabled. You should set this to @code{0}
  6885. only if your clip has bad chroma problems such as heavy rainbowing or other
  6886. artifacts. Setting this to @code{0} could also be used to speed things up at
  6887. the cost of some accuracy.
  6888. Default value is @code{1}.
  6889. @item y0
  6890. @item y1
  6891. These define an exclusion band which excludes the lines between @option{y0} and
  6892. @option{y1} from being included in the field matching decision. An exclusion
  6893. band can be used to ignore subtitles, a logo, or other things that may
  6894. interfere with the matching. @option{y0} sets the starting scan line and
  6895. @option{y1} sets the ending line; all lines in between @option{y0} and
  6896. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6897. @option{y0} and @option{y1} to the same value will disable the feature.
  6898. @option{y0} and @option{y1} defaults to @code{0}.
  6899. @item scthresh
  6900. Set the scene change detection threshold as a percentage of maximum change on
  6901. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6902. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6903. @option{scthresh} is @code{[0.0, 100.0]}.
  6904. Default value is @code{12.0}.
  6905. @item combmatch
  6906. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6907. account the combed scores of matches when deciding what match to use as the
  6908. final match. Available values are:
  6909. @table @samp
  6910. @item none
  6911. No final matching based on combed scores.
  6912. @item sc
  6913. Combed scores are only used when a scene change is detected.
  6914. @item full
  6915. Use combed scores all the time.
  6916. @end table
  6917. Default is @var{sc}.
  6918. @item combdbg
  6919. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6920. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6921. Available values are:
  6922. @table @samp
  6923. @item none
  6924. No forced calculation.
  6925. @item pcn
  6926. Force p/c/n calculations.
  6927. @item pcnub
  6928. Force p/c/n/u/b calculations.
  6929. @end table
  6930. Default value is @var{none}.
  6931. @item cthresh
  6932. This is the area combing threshold used for combed frame detection. This
  6933. essentially controls how "strong" or "visible" combing must be to be detected.
  6934. Larger values mean combing must be more visible and smaller values mean combing
  6935. can be less visible or strong and still be detected. Valid settings are from
  6936. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6937. be detected as combed). This is basically a pixel difference value. A good
  6938. range is @code{[8, 12]}.
  6939. Default value is @code{9}.
  6940. @item chroma
  6941. Sets whether or not chroma is considered in the combed frame decision. Only
  6942. disable this if your source has chroma problems (rainbowing, etc.) that are
  6943. causing problems for the combed frame detection with chroma enabled. Actually,
  6944. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6945. where there is chroma only combing in the source.
  6946. Default value is @code{0}.
  6947. @item blockx
  6948. @item blocky
  6949. Respectively set the x-axis and y-axis size of the window used during combed
  6950. frame detection. This has to do with the size of the area in which
  6951. @option{combpel} pixels are required to be detected as combed for a frame to be
  6952. declared combed. See the @option{combpel} parameter description for more info.
  6953. Possible values are any number that is a power of 2 starting at 4 and going up
  6954. to 512.
  6955. Default value is @code{16}.
  6956. @item combpel
  6957. The number of combed pixels inside any of the @option{blocky} by
  6958. @option{blockx} size blocks on the frame for the frame to be detected as
  6959. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6960. setting controls "how much" combing there must be in any localized area (a
  6961. window defined by the @option{blockx} and @option{blocky} settings) on the
  6962. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6963. which point no frames will ever be detected as combed). This setting is known
  6964. as @option{MI} in TFM/VFM vocabulary.
  6965. Default value is @code{80}.
  6966. @end table
  6967. @anchor{p/c/n/u/b meaning}
  6968. @subsection p/c/n/u/b meaning
  6969. @subsubsection p/c/n
  6970. We assume the following telecined stream:
  6971. @example
  6972. Top fields: 1 2 2 3 4
  6973. Bottom fields: 1 2 3 4 4
  6974. @end example
  6975. The numbers correspond to the progressive frame the fields relate to. Here, the
  6976. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6977. When @code{fieldmatch} is configured to run a matching from bottom
  6978. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6979. @example
  6980. Input stream:
  6981. T 1 2 2 3 4
  6982. B 1 2 3 4 4 <-- matching reference
  6983. Matches: c c n n c
  6984. Output stream:
  6985. T 1 2 3 4 4
  6986. B 1 2 3 4 4
  6987. @end example
  6988. As a result of the field matching, we can see that some frames get duplicated.
  6989. To perform a complete inverse telecine, you need to rely on a decimation filter
  6990. after this operation. See for instance the @ref{decimate} filter.
  6991. The same operation now matching from top fields (@option{field}=@var{top})
  6992. looks like this:
  6993. @example
  6994. Input stream:
  6995. T 1 2 2 3 4 <-- matching reference
  6996. B 1 2 3 4 4
  6997. Matches: c c p p c
  6998. Output stream:
  6999. T 1 2 2 3 4
  7000. B 1 2 2 3 4
  7001. @end example
  7002. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7003. basically, they refer to the frame and field of the opposite parity:
  7004. @itemize
  7005. @item @var{p} matches the field of the opposite parity in the previous frame
  7006. @item @var{c} matches the field of the opposite parity in the current frame
  7007. @item @var{n} matches the field of the opposite parity in the next frame
  7008. @end itemize
  7009. @subsubsection u/b
  7010. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7011. from the opposite parity flag. In the following examples, we assume that we are
  7012. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7013. 'x' is placed above and below each matched fields.
  7014. With bottom matching (@option{field}=@var{bottom}):
  7015. @example
  7016. Match: c p n b u
  7017. x x x x x
  7018. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7019. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7020. x x x x x
  7021. Output frames:
  7022. 2 1 2 2 2
  7023. 2 2 2 1 3
  7024. @end example
  7025. With top matching (@option{field}=@var{top}):
  7026. @example
  7027. Match: c p n b u
  7028. x x x x x
  7029. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7030. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7031. x x x x x
  7032. Output frames:
  7033. 2 2 2 1 2
  7034. 2 1 3 2 2
  7035. @end example
  7036. @subsection Examples
  7037. Simple IVTC of a top field first telecined stream:
  7038. @example
  7039. fieldmatch=order=tff:combmatch=none, decimate
  7040. @end example
  7041. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7042. @example
  7043. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7044. @end example
  7045. @section fieldorder
  7046. Transform the field order of the input video.
  7047. It accepts the following parameters:
  7048. @table @option
  7049. @item order
  7050. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7051. for bottom field first.
  7052. @end table
  7053. The default value is @samp{tff}.
  7054. The transformation is done by shifting the picture content up or down
  7055. by one line, and filling the remaining line with appropriate picture content.
  7056. This method is consistent with most broadcast field order converters.
  7057. If the input video is not flagged as being interlaced, or it is already
  7058. flagged as being of the required output field order, then this filter does
  7059. not alter the incoming video.
  7060. It is very useful when converting to or from PAL DV material,
  7061. which is bottom field first.
  7062. For example:
  7063. @example
  7064. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7065. @end example
  7066. @section fifo, afifo
  7067. Buffer input images and send them when they are requested.
  7068. It is mainly useful when auto-inserted by the libavfilter
  7069. framework.
  7070. It does not take parameters.
  7071. @section fillborders
  7072. Fill borders of the input video, without changing video stream dimensions.
  7073. Sometimes video can have garbage at the four edges and you may not want to
  7074. crop video input to keep size multiple of some number.
  7075. This filter accepts the following options:
  7076. @table @option
  7077. @item left
  7078. Number of pixels to fill from left border.
  7079. @item right
  7080. Number of pixels to fill from right border.
  7081. @item top
  7082. Number of pixels to fill from top border.
  7083. @item bottom
  7084. Number of pixels to fill from bottom border.
  7085. @item mode
  7086. Set fill mode.
  7087. It accepts the following values:
  7088. @table @samp
  7089. @item smear
  7090. fill pixels using outermost pixels
  7091. @item mirror
  7092. fill pixels using mirroring
  7093. @item fixed
  7094. fill pixels with constant value
  7095. @end table
  7096. Default is @var{smear}.
  7097. @item color
  7098. Set color for pixels in fixed mode. Default is @var{black}.
  7099. @end table
  7100. @section find_rect
  7101. Find a rectangular object
  7102. It accepts the following options:
  7103. @table @option
  7104. @item object
  7105. Filepath of the object image, needs to be in gray8.
  7106. @item threshold
  7107. Detection threshold, default is 0.5.
  7108. @item mipmaps
  7109. Number of mipmaps, default is 3.
  7110. @item xmin, ymin, xmax, ymax
  7111. Specifies the rectangle in which to search.
  7112. @end table
  7113. @subsection Examples
  7114. @itemize
  7115. @item
  7116. Generate a representative palette of a given video using @command{ffmpeg}:
  7117. @example
  7118. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7119. @end example
  7120. @end itemize
  7121. @section cover_rect
  7122. Cover a rectangular object
  7123. It accepts the following options:
  7124. @table @option
  7125. @item cover
  7126. Filepath of the optional cover image, needs to be in yuv420.
  7127. @item mode
  7128. Set covering mode.
  7129. It accepts the following values:
  7130. @table @samp
  7131. @item cover
  7132. cover it by the supplied image
  7133. @item blur
  7134. cover it by interpolating the surrounding pixels
  7135. @end table
  7136. Default value is @var{blur}.
  7137. @end table
  7138. @subsection Examples
  7139. @itemize
  7140. @item
  7141. Generate a representative palette of a given video using @command{ffmpeg}:
  7142. @example
  7143. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7144. @end example
  7145. @end itemize
  7146. @section floodfill
  7147. Flood area with values of same pixel components with another values.
  7148. It accepts the following options:
  7149. @table @option
  7150. @item x
  7151. Set pixel x coordinate.
  7152. @item y
  7153. Set pixel y coordinate.
  7154. @item s0
  7155. Set source #0 component value.
  7156. @item s1
  7157. Set source #1 component value.
  7158. @item s2
  7159. Set source #2 component value.
  7160. @item s3
  7161. Set source #3 component value.
  7162. @item d0
  7163. Set destination #0 component value.
  7164. @item d1
  7165. Set destination #1 component value.
  7166. @item d2
  7167. Set destination #2 component value.
  7168. @item d3
  7169. Set destination #3 component value.
  7170. @end table
  7171. @anchor{format}
  7172. @section format
  7173. Convert the input video to one of the specified pixel formats.
  7174. Libavfilter will try to pick one that is suitable as input to
  7175. the next filter.
  7176. It accepts the following parameters:
  7177. @table @option
  7178. @item pix_fmts
  7179. A '|'-separated list of pixel format names, such as
  7180. "pix_fmts=yuv420p|monow|rgb24".
  7181. @end table
  7182. @subsection Examples
  7183. @itemize
  7184. @item
  7185. Convert the input video to the @var{yuv420p} format
  7186. @example
  7187. format=pix_fmts=yuv420p
  7188. @end example
  7189. Convert the input video to any of the formats in the list
  7190. @example
  7191. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7192. @end example
  7193. @end itemize
  7194. @anchor{fps}
  7195. @section fps
  7196. Convert the video to specified constant frame rate by duplicating or dropping
  7197. frames as necessary.
  7198. It accepts the following parameters:
  7199. @table @option
  7200. @item fps
  7201. The desired output frame rate. The default is @code{25}.
  7202. @item start_time
  7203. Assume the first PTS should be the given value, in seconds. This allows for
  7204. padding/trimming at the start of stream. By default, no assumption is made
  7205. about the first frame's expected PTS, so no padding or trimming is done.
  7206. For example, this could be set to 0 to pad the beginning with duplicates of
  7207. the first frame if a video stream starts after the audio stream or to trim any
  7208. frames with a negative PTS.
  7209. @item round
  7210. Timestamp (PTS) rounding method.
  7211. Possible values are:
  7212. @table @option
  7213. @item zero
  7214. round towards 0
  7215. @item inf
  7216. round away from 0
  7217. @item down
  7218. round towards -infinity
  7219. @item up
  7220. round towards +infinity
  7221. @item near
  7222. round to nearest
  7223. @end table
  7224. The default is @code{near}.
  7225. @item eof_action
  7226. Action performed when reading the last frame.
  7227. Possible values are:
  7228. @table @option
  7229. @item round
  7230. Use same timestamp rounding method as used for other frames.
  7231. @item pass
  7232. Pass through last frame if input duration has not been reached yet.
  7233. @end table
  7234. The default is @code{round}.
  7235. @end table
  7236. Alternatively, the options can be specified as a flat string:
  7237. @var{fps}[:@var{start_time}[:@var{round}]].
  7238. See also the @ref{setpts} filter.
  7239. @subsection Examples
  7240. @itemize
  7241. @item
  7242. A typical usage in order to set the fps to 25:
  7243. @example
  7244. fps=fps=25
  7245. @end example
  7246. @item
  7247. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7248. @example
  7249. fps=fps=film:round=near
  7250. @end example
  7251. @end itemize
  7252. @section framepack
  7253. Pack two different video streams into a stereoscopic video, setting proper
  7254. metadata on supported codecs. The two views should have the same size and
  7255. framerate and processing will stop when the shorter video ends. Please note
  7256. that you may conveniently adjust view properties with the @ref{scale} and
  7257. @ref{fps} filters.
  7258. It accepts the following parameters:
  7259. @table @option
  7260. @item format
  7261. The desired packing format. Supported values are:
  7262. @table @option
  7263. @item sbs
  7264. The views are next to each other (default).
  7265. @item tab
  7266. The views are on top of each other.
  7267. @item lines
  7268. The views are packed by line.
  7269. @item columns
  7270. The views are packed by column.
  7271. @item frameseq
  7272. The views are temporally interleaved.
  7273. @end table
  7274. @end table
  7275. Some examples:
  7276. @example
  7277. # Convert left and right views into a frame-sequential video
  7278. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7279. # Convert views into a side-by-side video with the same output resolution as the input
  7280. 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
  7281. @end example
  7282. @section framerate
  7283. Change the frame rate by interpolating new video output frames from the source
  7284. frames.
  7285. This filter is not designed to function correctly with interlaced media. If
  7286. you wish to change the frame rate of interlaced media then you are required
  7287. to deinterlace before this filter and re-interlace after this filter.
  7288. A description of the accepted options follows.
  7289. @table @option
  7290. @item fps
  7291. Specify the output frames per second. This option can also be specified
  7292. as a value alone. The default is @code{50}.
  7293. @item interp_start
  7294. Specify the start of a range where the output frame will be created as a
  7295. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7296. the default is @code{15}.
  7297. @item interp_end
  7298. Specify the end of a range where the output frame will be created as a
  7299. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7300. the default is @code{240}.
  7301. @item scene
  7302. Specify the level at which a scene change is detected as a value between
  7303. 0 and 100 to indicate a new scene; a low value reflects a low
  7304. probability for the current frame to introduce a new scene, while a higher
  7305. value means the current frame is more likely to be one.
  7306. The default is @code{8.2}.
  7307. @item flags
  7308. Specify flags influencing the filter process.
  7309. Available value for @var{flags} is:
  7310. @table @option
  7311. @item scene_change_detect, scd
  7312. Enable scene change detection using the value of the option @var{scene}.
  7313. This flag is enabled by default.
  7314. @end table
  7315. @end table
  7316. @section framestep
  7317. Select one frame every N-th frame.
  7318. This filter accepts the following option:
  7319. @table @option
  7320. @item step
  7321. Select frame after every @code{step} frames.
  7322. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7323. @end table
  7324. @anchor{frei0r}
  7325. @section frei0r
  7326. Apply a frei0r effect to the input video.
  7327. To enable the compilation of this filter, you need to install the frei0r
  7328. header and configure FFmpeg with @code{--enable-frei0r}.
  7329. It accepts the following parameters:
  7330. @table @option
  7331. @item filter_name
  7332. The name of the frei0r effect to load. If the environment variable
  7333. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7334. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7335. Otherwise, the standard frei0r paths are searched, in this order:
  7336. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7337. @file{/usr/lib/frei0r-1/}.
  7338. @item filter_params
  7339. A '|'-separated list of parameters to pass to the frei0r effect.
  7340. @end table
  7341. A frei0r effect parameter can be a boolean (its value is either
  7342. "y" or "n"), a double, a color (specified as
  7343. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7344. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7345. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7346. a position (specified as @var{X}/@var{Y}, where
  7347. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7348. The number and types of parameters depend on the loaded effect. If an
  7349. effect parameter is not specified, the default value is set.
  7350. @subsection Examples
  7351. @itemize
  7352. @item
  7353. Apply the distort0r effect, setting the first two double parameters:
  7354. @example
  7355. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7356. @end example
  7357. @item
  7358. Apply the colordistance effect, taking a color as the first parameter:
  7359. @example
  7360. frei0r=colordistance:0.2/0.3/0.4
  7361. frei0r=colordistance:violet
  7362. frei0r=colordistance:0x112233
  7363. @end example
  7364. @item
  7365. Apply the perspective effect, specifying the top left and top right image
  7366. positions:
  7367. @example
  7368. frei0r=perspective:0.2/0.2|0.8/0.2
  7369. @end example
  7370. @end itemize
  7371. For more information, see
  7372. @url{http://frei0r.dyne.org}
  7373. @section fspp
  7374. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7375. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7376. processing filter, one of them is performed once per block, not per pixel.
  7377. This allows for much higher speed.
  7378. The filter accepts the following options:
  7379. @table @option
  7380. @item quality
  7381. Set quality. This option defines the number of levels for averaging. It accepts
  7382. an integer in the range 4-5. Default value is @code{4}.
  7383. @item qp
  7384. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7385. If not set, the filter will use the QP from the video stream (if available).
  7386. @item strength
  7387. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7388. more details but also more artifacts, while higher values make the image smoother
  7389. but also blurrier. Default value is @code{0} − PSNR optimal.
  7390. @item use_bframe_qp
  7391. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7392. option may cause flicker since the B-Frames have often larger QP. Default is
  7393. @code{0} (not enabled).
  7394. @end table
  7395. @section gblur
  7396. Apply Gaussian blur filter.
  7397. The filter accepts the following options:
  7398. @table @option
  7399. @item sigma
  7400. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7401. @item steps
  7402. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7403. @item planes
  7404. Set which planes to filter. By default all planes are filtered.
  7405. @item sigmaV
  7406. Set vertical sigma, if negative it will be same as @code{sigma}.
  7407. Default is @code{-1}.
  7408. @end table
  7409. @section geq
  7410. The filter accepts the following options:
  7411. @table @option
  7412. @item lum_expr, lum
  7413. Set the luminance expression.
  7414. @item cb_expr, cb
  7415. Set the chrominance blue expression.
  7416. @item cr_expr, cr
  7417. Set the chrominance red expression.
  7418. @item alpha_expr, a
  7419. Set the alpha expression.
  7420. @item red_expr, r
  7421. Set the red expression.
  7422. @item green_expr, g
  7423. Set the green expression.
  7424. @item blue_expr, b
  7425. Set the blue expression.
  7426. @end table
  7427. The colorspace is selected according to the specified options. If one
  7428. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7429. options is specified, the filter will automatically select a YCbCr
  7430. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7431. @option{blue_expr} options is specified, it will select an RGB
  7432. colorspace.
  7433. If one of the chrominance expression is not defined, it falls back on the other
  7434. one. If no alpha expression is specified it will evaluate to opaque value.
  7435. If none of chrominance expressions are specified, they will evaluate
  7436. to the luminance expression.
  7437. The expressions can use the following variables and functions:
  7438. @table @option
  7439. @item N
  7440. The sequential number of the filtered frame, starting from @code{0}.
  7441. @item X
  7442. @item Y
  7443. The coordinates of the current sample.
  7444. @item W
  7445. @item H
  7446. The width and height of the image.
  7447. @item SW
  7448. @item SH
  7449. Width and height scale depending on the currently filtered plane. It is the
  7450. ratio between the corresponding luma plane number of pixels and the current
  7451. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7452. @code{0.5,0.5} for chroma planes.
  7453. @item T
  7454. Time of the current frame, expressed in seconds.
  7455. @item p(x, y)
  7456. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7457. plane.
  7458. @item lum(x, y)
  7459. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7460. plane.
  7461. @item cb(x, y)
  7462. Return the value of the pixel at location (@var{x},@var{y}) of the
  7463. blue-difference chroma plane. Return 0 if there is no such plane.
  7464. @item cr(x, y)
  7465. Return the value of the pixel at location (@var{x},@var{y}) of the
  7466. red-difference chroma plane. Return 0 if there is no such plane.
  7467. @item r(x, y)
  7468. @item g(x, y)
  7469. @item b(x, y)
  7470. Return the value of the pixel at location (@var{x},@var{y}) of the
  7471. red/green/blue component. Return 0 if there is no such component.
  7472. @item alpha(x, y)
  7473. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7474. plane. Return 0 if there is no such plane.
  7475. @end table
  7476. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7477. automatically clipped to the closer edge.
  7478. @subsection Examples
  7479. @itemize
  7480. @item
  7481. Flip the image horizontally:
  7482. @example
  7483. geq=p(W-X\,Y)
  7484. @end example
  7485. @item
  7486. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7487. wavelength of 100 pixels:
  7488. @example
  7489. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7490. @end example
  7491. @item
  7492. Generate a fancy enigmatic moving light:
  7493. @example
  7494. 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
  7495. @end example
  7496. @item
  7497. Generate a quick emboss effect:
  7498. @example
  7499. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7500. @end example
  7501. @item
  7502. Modify RGB components depending on pixel position:
  7503. @example
  7504. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7505. @end example
  7506. @item
  7507. Create a radial gradient that is the same size as the input (also see
  7508. the @ref{vignette} filter):
  7509. @example
  7510. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7511. @end example
  7512. @end itemize
  7513. @section gradfun
  7514. Fix the banding artifacts that are sometimes introduced into nearly flat
  7515. regions by truncation to 8-bit color depth.
  7516. Interpolate the gradients that should go where the bands are, and
  7517. dither them.
  7518. It is designed for playback only. Do not use it prior to
  7519. lossy compression, because compression tends to lose the dither and
  7520. bring back the bands.
  7521. It accepts the following parameters:
  7522. @table @option
  7523. @item strength
  7524. The maximum amount by which the filter will change any one pixel. This is also
  7525. the threshold for detecting nearly flat regions. Acceptable values range from
  7526. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7527. valid range.
  7528. @item radius
  7529. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7530. gradients, but also prevents the filter from modifying the pixels near detailed
  7531. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7532. values will be clipped to the valid range.
  7533. @end table
  7534. Alternatively, the options can be specified as a flat string:
  7535. @var{strength}[:@var{radius}]
  7536. @subsection Examples
  7537. @itemize
  7538. @item
  7539. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7540. @example
  7541. gradfun=3.5:8
  7542. @end example
  7543. @item
  7544. Specify radius, omitting the strength (which will fall-back to the default
  7545. value):
  7546. @example
  7547. gradfun=radius=8
  7548. @end example
  7549. @end itemize
  7550. @anchor{haldclut}
  7551. @section haldclut
  7552. Apply a Hald CLUT to a video stream.
  7553. First input is the video stream to process, and second one is the Hald CLUT.
  7554. The Hald CLUT input can be a simple picture or a complete video stream.
  7555. The filter accepts the following options:
  7556. @table @option
  7557. @item shortest
  7558. Force termination when the shortest input terminates. Default is @code{0}.
  7559. @item repeatlast
  7560. Continue applying the last CLUT after the end of the stream. A value of
  7561. @code{0} disable the filter after the last frame of the CLUT is reached.
  7562. Default is @code{1}.
  7563. @end table
  7564. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7565. filters share the same internals).
  7566. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7567. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7568. @subsection Workflow examples
  7569. @subsubsection Hald CLUT video stream
  7570. Generate an identity Hald CLUT stream altered with various effects:
  7571. @example
  7572. 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
  7573. @end example
  7574. Note: make sure you use a lossless codec.
  7575. Then use it with @code{haldclut} to apply it on some random stream:
  7576. @example
  7577. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7578. @end example
  7579. The Hald CLUT will be applied to the 10 first seconds (duration of
  7580. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7581. to the remaining frames of the @code{mandelbrot} stream.
  7582. @subsubsection Hald CLUT with preview
  7583. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7584. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7585. biggest possible square starting at the top left of the picture. The remaining
  7586. padding pixels (bottom or right) will be ignored. This area can be used to add
  7587. a preview of the Hald CLUT.
  7588. Typically, the following generated Hald CLUT will be supported by the
  7589. @code{haldclut} filter:
  7590. @example
  7591. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7592. pad=iw+320 [padded_clut];
  7593. smptebars=s=320x256, split [a][b];
  7594. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7595. [main][b] overlay=W-320" -frames:v 1 clut.png
  7596. @end example
  7597. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7598. bars are displayed on the right-top, and below the same color bars processed by
  7599. the color changes.
  7600. Then, the effect of this Hald CLUT can be visualized with:
  7601. @example
  7602. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7603. @end example
  7604. @section hflip
  7605. Flip the input video horizontally.
  7606. For example, to horizontally flip the input video with @command{ffmpeg}:
  7607. @example
  7608. ffmpeg -i in.avi -vf "hflip" out.avi
  7609. @end example
  7610. @section histeq
  7611. This filter applies a global color histogram equalization on a
  7612. per-frame basis.
  7613. It can be used to correct video that has a compressed range of pixel
  7614. intensities. The filter redistributes the pixel intensities to
  7615. equalize their distribution across the intensity range. It may be
  7616. viewed as an "automatically adjusting contrast filter". This filter is
  7617. useful only for correcting degraded or poorly captured source
  7618. video.
  7619. The filter accepts the following options:
  7620. @table @option
  7621. @item strength
  7622. Determine the amount of equalization to be applied. As the strength
  7623. is reduced, the distribution of pixel intensities more-and-more
  7624. approaches that of the input frame. The value must be a float number
  7625. in the range [0,1] and defaults to 0.200.
  7626. @item intensity
  7627. Set the maximum intensity that can generated and scale the output
  7628. values appropriately. The strength should be set as desired and then
  7629. the intensity can be limited if needed to avoid washing-out. The value
  7630. must be a float number in the range [0,1] and defaults to 0.210.
  7631. @item antibanding
  7632. Set the antibanding level. If enabled the filter will randomly vary
  7633. the luminance of output pixels by a small amount to avoid banding of
  7634. the histogram. Possible values are @code{none}, @code{weak} or
  7635. @code{strong}. It defaults to @code{none}.
  7636. @end table
  7637. @section histogram
  7638. Compute and draw a color distribution histogram for the input video.
  7639. The computed histogram is a representation of the color component
  7640. distribution in an image.
  7641. Standard histogram displays the color components distribution in an image.
  7642. Displays color graph for each color component. Shows distribution of
  7643. the Y, U, V, A or R, G, B components, depending on input format, in the
  7644. current frame. Below each graph a color component scale meter is shown.
  7645. The filter accepts the following options:
  7646. @table @option
  7647. @item level_height
  7648. Set height of level. Default value is @code{200}.
  7649. Allowed range is [50, 2048].
  7650. @item scale_height
  7651. Set height of color scale. Default value is @code{12}.
  7652. Allowed range is [0, 40].
  7653. @item display_mode
  7654. Set display mode.
  7655. It accepts the following values:
  7656. @table @samp
  7657. @item stack
  7658. Per color component graphs are placed below each other.
  7659. @item parade
  7660. Per color component graphs are placed side by side.
  7661. @item overlay
  7662. Presents information identical to that in the @code{parade}, except
  7663. that the graphs representing color components are superimposed directly
  7664. over one another.
  7665. @end table
  7666. Default is @code{stack}.
  7667. @item levels_mode
  7668. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7669. Default is @code{linear}.
  7670. @item components
  7671. Set what color components to display.
  7672. Default is @code{7}.
  7673. @item fgopacity
  7674. Set foreground opacity. Default is @code{0.7}.
  7675. @item bgopacity
  7676. Set background opacity. Default is @code{0.5}.
  7677. @end table
  7678. @subsection Examples
  7679. @itemize
  7680. @item
  7681. Calculate and draw histogram:
  7682. @example
  7683. ffplay -i input -vf histogram
  7684. @end example
  7685. @end itemize
  7686. @anchor{hqdn3d}
  7687. @section hqdn3d
  7688. This is a high precision/quality 3d denoise filter. It aims to reduce
  7689. image noise, producing smooth images and making still images really
  7690. still. It should enhance compressibility.
  7691. It accepts the following optional parameters:
  7692. @table @option
  7693. @item luma_spatial
  7694. A non-negative floating point number which specifies spatial luma strength.
  7695. It defaults to 4.0.
  7696. @item chroma_spatial
  7697. A non-negative floating point number which specifies spatial chroma strength.
  7698. It defaults to 3.0*@var{luma_spatial}/4.0.
  7699. @item luma_tmp
  7700. A floating point number which specifies luma temporal strength. It defaults to
  7701. 6.0*@var{luma_spatial}/4.0.
  7702. @item chroma_tmp
  7703. A floating point number which specifies chroma temporal strength. It defaults to
  7704. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7705. @end table
  7706. @section hwdownload
  7707. Download hardware frames to system memory.
  7708. The input must be in hardware frames, and the output a non-hardware format.
  7709. Not all formats will be supported on the output - it may be necessary to insert
  7710. an additional @option{format} filter immediately following in the graph to get
  7711. the output in a supported format.
  7712. @section hwmap
  7713. Map hardware frames to system memory or to another device.
  7714. This filter has several different modes of operation; which one is used depends
  7715. on the input and output formats:
  7716. @itemize
  7717. @item
  7718. Hardware frame input, normal frame output
  7719. Map the input frames to system memory and pass them to the output. If the
  7720. original hardware frame is later required (for example, after overlaying
  7721. something else on part of it), the @option{hwmap} filter can be used again
  7722. in the next mode to retrieve it.
  7723. @item
  7724. Normal frame input, hardware frame output
  7725. If the input is actually a software-mapped hardware frame, then unmap it -
  7726. that is, return the original hardware frame.
  7727. Otherwise, a device must be provided. Create new hardware surfaces on that
  7728. device for the output, then map them back to the software format at the input
  7729. and give those frames to the preceding filter. This will then act like the
  7730. @option{hwupload} filter, but may be able to avoid an additional copy when
  7731. the input is already in a compatible format.
  7732. @item
  7733. Hardware frame input and output
  7734. A device must be supplied for the output, either directly or with the
  7735. @option{derive_device} option. The input and output devices must be of
  7736. different types and compatible - the exact meaning of this is
  7737. system-dependent, but typically it means that they must refer to the same
  7738. underlying hardware context (for example, refer to the same graphics card).
  7739. If the input frames were originally created on the output device, then unmap
  7740. to retrieve the original frames.
  7741. Otherwise, map the frames to the output device - create new hardware frames
  7742. on the output corresponding to the frames on the input.
  7743. @end itemize
  7744. The following additional parameters are accepted:
  7745. @table @option
  7746. @item mode
  7747. Set the frame mapping mode. Some combination of:
  7748. @table @var
  7749. @item read
  7750. The mapped frame should be readable.
  7751. @item write
  7752. The mapped frame should be writeable.
  7753. @item overwrite
  7754. The mapping will always overwrite the entire frame.
  7755. This may improve performance in some cases, as the original contents of the
  7756. frame need not be loaded.
  7757. @item direct
  7758. The mapping must not involve any copying.
  7759. Indirect mappings to copies of frames are created in some cases where either
  7760. direct mapping is not possible or it would have unexpected properties.
  7761. Setting this flag ensures that the mapping is direct and will fail if that is
  7762. not possible.
  7763. @end table
  7764. Defaults to @var{read+write} if not specified.
  7765. @item derive_device @var{type}
  7766. Rather than using the device supplied at initialisation, instead derive a new
  7767. device of type @var{type} from the device the input frames exist on.
  7768. @item reverse
  7769. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7770. and map them back to the source. This may be necessary in some cases where
  7771. a mapping in one direction is required but only the opposite direction is
  7772. supported by the devices being used.
  7773. This option is dangerous - it may break the preceding filter in undefined
  7774. ways if there are any additional constraints on that filter's output.
  7775. Do not use it without fully understanding the implications of its use.
  7776. @end table
  7777. @section hwupload
  7778. Upload system memory frames to hardware surfaces.
  7779. The device to upload to must be supplied when the filter is initialised. If
  7780. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7781. option.
  7782. @anchor{hwupload_cuda}
  7783. @section hwupload_cuda
  7784. Upload system memory frames to a CUDA device.
  7785. It accepts the following optional parameters:
  7786. @table @option
  7787. @item device
  7788. The number of the CUDA device to use
  7789. @end table
  7790. @section hqx
  7791. Apply a high-quality magnification filter designed for pixel art. This filter
  7792. was originally created by Maxim Stepin.
  7793. It accepts the following option:
  7794. @table @option
  7795. @item n
  7796. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7797. @code{hq3x} and @code{4} for @code{hq4x}.
  7798. Default is @code{3}.
  7799. @end table
  7800. @section hstack
  7801. Stack input videos horizontally.
  7802. All streams must be of same pixel format and of same height.
  7803. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7804. to create same output.
  7805. The filter accept the following option:
  7806. @table @option
  7807. @item inputs
  7808. Set number of input streams. Default is 2.
  7809. @item shortest
  7810. If set to 1, force the output to terminate when the shortest input
  7811. terminates. Default value is 0.
  7812. @end table
  7813. @section hue
  7814. Modify the hue and/or the saturation of the input.
  7815. It accepts the following parameters:
  7816. @table @option
  7817. @item h
  7818. Specify the hue angle as a number of degrees. It accepts an expression,
  7819. and defaults to "0".
  7820. @item s
  7821. Specify the saturation in the [-10,10] range. It accepts an expression and
  7822. defaults to "1".
  7823. @item H
  7824. Specify the hue angle as a number of radians. It accepts an
  7825. expression, and defaults to "0".
  7826. @item b
  7827. Specify the brightness in the [-10,10] range. It accepts an expression and
  7828. defaults to "0".
  7829. @end table
  7830. @option{h} and @option{H} are mutually exclusive, and can't be
  7831. specified at the same time.
  7832. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7833. expressions containing the following constants:
  7834. @table @option
  7835. @item n
  7836. frame count of the input frame starting from 0
  7837. @item pts
  7838. presentation timestamp of the input frame expressed in time base units
  7839. @item r
  7840. frame rate of the input video, NAN if the input frame rate is unknown
  7841. @item t
  7842. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7843. @item tb
  7844. time base of the input video
  7845. @end table
  7846. @subsection Examples
  7847. @itemize
  7848. @item
  7849. Set the hue to 90 degrees and the saturation to 1.0:
  7850. @example
  7851. hue=h=90:s=1
  7852. @end example
  7853. @item
  7854. Same command but expressing the hue in radians:
  7855. @example
  7856. hue=H=PI/2:s=1
  7857. @end example
  7858. @item
  7859. Rotate hue and make the saturation swing between 0
  7860. and 2 over a period of 1 second:
  7861. @example
  7862. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7863. @end example
  7864. @item
  7865. Apply a 3 seconds saturation fade-in effect starting at 0:
  7866. @example
  7867. hue="s=min(t/3\,1)"
  7868. @end example
  7869. The general fade-in expression can be written as:
  7870. @example
  7871. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7872. @end example
  7873. @item
  7874. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7875. @example
  7876. hue="s=max(0\, min(1\, (8-t)/3))"
  7877. @end example
  7878. The general fade-out expression can be written as:
  7879. @example
  7880. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7881. @end example
  7882. @end itemize
  7883. @subsection Commands
  7884. This filter supports the following commands:
  7885. @table @option
  7886. @item b
  7887. @item s
  7888. @item h
  7889. @item H
  7890. Modify the hue and/or the saturation and/or brightness of the input video.
  7891. The command accepts the same syntax of the corresponding option.
  7892. If the specified expression is not valid, it is kept at its current
  7893. value.
  7894. @end table
  7895. @section hysteresis
  7896. Grow first stream into second stream by connecting components.
  7897. This makes it possible to build more robust edge masks.
  7898. This filter accepts the following options:
  7899. @table @option
  7900. @item planes
  7901. Set which planes will be processed as bitmap, unprocessed planes will be
  7902. copied from first stream.
  7903. By default value 0xf, all planes will be processed.
  7904. @item threshold
  7905. Set threshold which is used in filtering. If pixel component value is higher than
  7906. this value filter algorithm for connecting components is activated.
  7907. By default value is 0.
  7908. @end table
  7909. @section idet
  7910. Detect video interlacing type.
  7911. This filter tries to detect if the input frames are interlaced, progressive,
  7912. top or bottom field first. It will also try to detect fields that are
  7913. repeated between adjacent frames (a sign of telecine).
  7914. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7915. Multiple frame detection incorporates the classification history of previous frames.
  7916. The filter will log these metadata values:
  7917. @table @option
  7918. @item single.current_frame
  7919. Detected type of current frame using single-frame detection. One of:
  7920. ``tff'' (top field first), ``bff'' (bottom field first),
  7921. ``progressive'', or ``undetermined''
  7922. @item single.tff
  7923. Cumulative number of frames detected as top field first using single-frame detection.
  7924. @item multiple.tff
  7925. Cumulative number of frames detected as top field first using multiple-frame detection.
  7926. @item single.bff
  7927. Cumulative number of frames detected as bottom field first using single-frame detection.
  7928. @item multiple.current_frame
  7929. Detected type of current frame using multiple-frame detection. One of:
  7930. ``tff'' (top field first), ``bff'' (bottom field first),
  7931. ``progressive'', or ``undetermined''
  7932. @item multiple.bff
  7933. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7934. @item single.progressive
  7935. Cumulative number of frames detected as progressive using single-frame detection.
  7936. @item multiple.progressive
  7937. Cumulative number of frames detected as progressive using multiple-frame detection.
  7938. @item single.undetermined
  7939. Cumulative number of frames that could not be classified using single-frame detection.
  7940. @item multiple.undetermined
  7941. Cumulative number of frames that could not be classified using multiple-frame detection.
  7942. @item repeated.current_frame
  7943. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7944. @item repeated.neither
  7945. Cumulative number of frames with no repeated field.
  7946. @item repeated.top
  7947. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7948. @item repeated.bottom
  7949. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7950. @end table
  7951. The filter accepts the following options:
  7952. @table @option
  7953. @item intl_thres
  7954. Set interlacing threshold.
  7955. @item prog_thres
  7956. Set progressive threshold.
  7957. @item rep_thres
  7958. Threshold for repeated field detection.
  7959. @item half_life
  7960. Number of frames after which a given frame's contribution to the
  7961. statistics is halved (i.e., it contributes only 0.5 to its
  7962. classification). The default of 0 means that all frames seen are given
  7963. full weight of 1.0 forever.
  7964. @item analyze_interlaced_flag
  7965. When this is not 0 then idet will use the specified number of frames to determine
  7966. if the interlaced flag is accurate, it will not count undetermined frames.
  7967. If the flag is found to be accurate it will be used without any further
  7968. computations, if it is found to be inaccurate it will be cleared without any
  7969. further computations. This allows inserting the idet filter as a low computational
  7970. method to clean up the interlaced flag
  7971. @end table
  7972. @section il
  7973. Deinterleave or interleave fields.
  7974. This filter allows one to process interlaced images fields without
  7975. deinterlacing them. Deinterleaving splits the input frame into 2
  7976. fields (so called half pictures). Odd lines are moved to the top
  7977. half of the output image, even lines to the bottom half.
  7978. You can process (filter) them independently and then re-interleave them.
  7979. The filter accepts the following options:
  7980. @table @option
  7981. @item luma_mode, l
  7982. @item chroma_mode, c
  7983. @item alpha_mode, a
  7984. Available values for @var{luma_mode}, @var{chroma_mode} and
  7985. @var{alpha_mode} are:
  7986. @table @samp
  7987. @item none
  7988. Do nothing.
  7989. @item deinterleave, d
  7990. Deinterleave fields, placing one above the other.
  7991. @item interleave, i
  7992. Interleave fields. Reverse the effect of deinterleaving.
  7993. @end table
  7994. Default value is @code{none}.
  7995. @item luma_swap, ls
  7996. @item chroma_swap, cs
  7997. @item alpha_swap, as
  7998. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7999. @end table
  8000. @section inflate
  8001. Apply inflate effect to the video.
  8002. This filter replaces the pixel by the local(3x3) average by taking into account
  8003. only values higher than the pixel.
  8004. It accepts the following options:
  8005. @table @option
  8006. @item threshold0
  8007. @item threshold1
  8008. @item threshold2
  8009. @item threshold3
  8010. Limit the maximum change for each plane, default is 65535.
  8011. If 0, plane will remain unchanged.
  8012. @end table
  8013. @section interlace
  8014. Simple interlacing filter from progressive contents. This interleaves upper (or
  8015. lower) lines from odd frames with lower (or upper) lines from even frames,
  8016. halving the frame rate and preserving image height.
  8017. @example
  8018. Original Original New Frame
  8019. Frame 'j' Frame 'j+1' (tff)
  8020. ========== =========== ==================
  8021. Line 0 --------------------> Frame 'j' Line 0
  8022. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8023. Line 2 ---------------------> Frame 'j' Line 2
  8024. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8025. ... ... ...
  8026. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8027. @end example
  8028. It accepts the following optional parameters:
  8029. @table @option
  8030. @item scan
  8031. This determines whether the interlaced frame is taken from the even
  8032. (tff - default) or odd (bff) lines of the progressive frame.
  8033. @item lowpass
  8034. Vertical lowpass filter to avoid twitter interlacing and
  8035. reduce moire patterns.
  8036. @table @samp
  8037. @item 0, off
  8038. Disable vertical lowpass filter
  8039. @item 1, linear
  8040. Enable linear filter (default)
  8041. @item 2, complex
  8042. Enable complex filter. This will slightly less reduce twitter and moire
  8043. but better retain detail and subjective sharpness impression.
  8044. @end table
  8045. @end table
  8046. @section kerndeint
  8047. Deinterlace input video by applying Donald Graft's adaptive kernel
  8048. deinterling. Work on interlaced parts of a video to produce
  8049. progressive frames.
  8050. The description of the accepted parameters follows.
  8051. @table @option
  8052. @item thresh
  8053. Set the threshold which affects the filter's tolerance when
  8054. determining if a pixel line must be processed. It must be an integer
  8055. in the range [0,255] and defaults to 10. A value of 0 will result in
  8056. applying the process on every pixels.
  8057. @item map
  8058. Paint pixels exceeding the threshold value to white if set to 1.
  8059. Default is 0.
  8060. @item order
  8061. Set the fields order. Swap fields if set to 1, leave fields alone if
  8062. 0. Default is 0.
  8063. @item sharp
  8064. Enable additional sharpening if set to 1. Default is 0.
  8065. @item twoway
  8066. Enable twoway sharpening if set to 1. Default is 0.
  8067. @end table
  8068. @subsection Examples
  8069. @itemize
  8070. @item
  8071. Apply default values:
  8072. @example
  8073. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8074. @end example
  8075. @item
  8076. Enable additional sharpening:
  8077. @example
  8078. kerndeint=sharp=1
  8079. @end example
  8080. @item
  8081. Paint processed pixels in white:
  8082. @example
  8083. kerndeint=map=1
  8084. @end example
  8085. @end itemize
  8086. @section lenscorrection
  8087. Correct radial lens distortion
  8088. This filter can be used to correct for radial distortion as can result from the use
  8089. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8090. one can use tools available for example as part of opencv or simply trial-and-error.
  8091. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8092. and extract the k1 and k2 coefficients from the resulting matrix.
  8093. Note that effectively the same filter is available in the open-source tools Krita and
  8094. Digikam from the KDE project.
  8095. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8096. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8097. brightness distribution, so you may want to use both filters together in certain
  8098. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8099. be applied before or after lens correction.
  8100. @subsection Options
  8101. The filter accepts the following options:
  8102. @table @option
  8103. @item cx
  8104. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8105. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8106. width. Default is 0.5.
  8107. @item cy
  8108. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8109. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8110. height. Default is 0.5.
  8111. @item k1
  8112. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8113. no correction. Default is 0.
  8114. @item k2
  8115. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8116. 0 means no correction. Default is 0.
  8117. @end table
  8118. The formula that generates the correction is:
  8119. @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)
  8120. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8121. distances from the focal point in the source and target images, respectively.
  8122. @section libvmaf
  8123. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8124. score between two input videos.
  8125. The obtained VMAF score is printed through the logging system.
  8126. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8127. After installing the library it can be enabled using:
  8128. @code{./configure --enable-libvmaf}.
  8129. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8130. The filter has following options:
  8131. @table @option
  8132. @item model_path
  8133. Set the model path which is to be used for SVM.
  8134. Default value: @code{"vmaf_v0.6.1.pkl"}
  8135. @item log_path
  8136. Set the file path to be used to store logs.
  8137. @item log_fmt
  8138. Set the format of the log file (xml or json).
  8139. @item enable_transform
  8140. Enables transform for computing vmaf.
  8141. @item phone_model
  8142. Invokes the phone model which will generate VMAF scores higher than in the
  8143. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8144. @item psnr
  8145. Enables computing psnr along with vmaf.
  8146. @item ssim
  8147. Enables computing ssim along with vmaf.
  8148. @item ms_ssim
  8149. Enables computing ms_ssim along with vmaf.
  8150. @item pool
  8151. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8152. @end table
  8153. This filter also supports the @ref{framesync} options.
  8154. On the below examples the input file @file{main.mpg} being processed is
  8155. compared with the reference file @file{ref.mpg}.
  8156. @example
  8157. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8158. @end example
  8159. Example with options:
  8160. @example
  8161. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8162. @end example
  8163. @section limiter
  8164. Limits the pixel components values to the specified range [min, max].
  8165. The filter accepts the following options:
  8166. @table @option
  8167. @item min
  8168. Lower bound. Defaults to the lowest allowed value for the input.
  8169. @item max
  8170. Upper bound. Defaults to the highest allowed value for the input.
  8171. @item planes
  8172. Specify which planes will be processed. Defaults to all available.
  8173. @end table
  8174. @section loop
  8175. Loop video frames.
  8176. The filter accepts the following options:
  8177. @table @option
  8178. @item loop
  8179. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8180. Default is 0.
  8181. @item size
  8182. Set maximal size in number of frames. Default is 0.
  8183. @item start
  8184. Set first frame of loop. Default is 0.
  8185. @end table
  8186. @anchor{lut3d}
  8187. @section lut3d
  8188. Apply a 3D LUT to an input video.
  8189. The filter accepts the following options:
  8190. @table @option
  8191. @item file
  8192. Set the 3D LUT file name.
  8193. Currently supported formats:
  8194. @table @samp
  8195. @item 3dl
  8196. AfterEffects
  8197. @item cube
  8198. Iridas
  8199. @item dat
  8200. DaVinci
  8201. @item m3d
  8202. Pandora
  8203. @end table
  8204. @item interp
  8205. Select interpolation mode.
  8206. Available values are:
  8207. @table @samp
  8208. @item nearest
  8209. Use values from the nearest defined point.
  8210. @item trilinear
  8211. Interpolate values using the 8 points defining a cube.
  8212. @item tetrahedral
  8213. Interpolate values using a tetrahedron.
  8214. @end table
  8215. @end table
  8216. This filter also supports the @ref{framesync} options.
  8217. @section lumakey
  8218. Turn certain luma values into transparency.
  8219. The filter accepts the following options:
  8220. @table @option
  8221. @item threshold
  8222. Set the luma which will be used as base for transparency.
  8223. Default value is @code{0}.
  8224. @item tolerance
  8225. Set the range of luma values to be keyed out.
  8226. Default value is @code{0}.
  8227. @item softness
  8228. Set the range of softness. Default value is @code{0}.
  8229. Use this to control gradual transition from zero to full transparency.
  8230. @end table
  8231. @section lut, lutrgb, lutyuv
  8232. Compute a look-up table for binding each pixel component input value
  8233. to an output value, and apply it to the input video.
  8234. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8235. to an RGB input video.
  8236. These filters accept the following parameters:
  8237. @table @option
  8238. @item c0
  8239. set first pixel component expression
  8240. @item c1
  8241. set second pixel component expression
  8242. @item c2
  8243. set third pixel component expression
  8244. @item c3
  8245. set fourth pixel component expression, corresponds to the alpha component
  8246. @item r
  8247. set red component expression
  8248. @item g
  8249. set green component expression
  8250. @item b
  8251. set blue component expression
  8252. @item a
  8253. alpha component expression
  8254. @item y
  8255. set Y/luminance component expression
  8256. @item u
  8257. set U/Cb component expression
  8258. @item v
  8259. set V/Cr component expression
  8260. @end table
  8261. Each of them specifies the expression to use for computing the lookup table for
  8262. the corresponding pixel component values.
  8263. The exact component associated to each of the @var{c*} options depends on the
  8264. format in input.
  8265. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8266. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8267. The expressions can contain the following constants and functions:
  8268. @table @option
  8269. @item w
  8270. @item h
  8271. The input width and height.
  8272. @item val
  8273. The input value for the pixel component.
  8274. @item clipval
  8275. The input value, clipped to the @var{minval}-@var{maxval} range.
  8276. @item maxval
  8277. The maximum value for the pixel component.
  8278. @item minval
  8279. The minimum value for the pixel component.
  8280. @item negval
  8281. The negated value for the pixel component value, clipped to the
  8282. @var{minval}-@var{maxval} range; it corresponds to the expression
  8283. "maxval-clipval+minval".
  8284. @item clip(val)
  8285. The computed value in @var{val}, clipped to the
  8286. @var{minval}-@var{maxval} range.
  8287. @item gammaval(gamma)
  8288. The computed gamma correction value of the pixel component value,
  8289. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8290. expression
  8291. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8292. @end table
  8293. All expressions default to "val".
  8294. @subsection Examples
  8295. @itemize
  8296. @item
  8297. Negate input video:
  8298. @example
  8299. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8300. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8301. @end example
  8302. The above is the same as:
  8303. @example
  8304. lutrgb="r=negval:g=negval:b=negval"
  8305. lutyuv="y=negval:u=negval:v=negval"
  8306. @end example
  8307. @item
  8308. Negate luminance:
  8309. @example
  8310. lutyuv=y=negval
  8311. @end example
  8312. @item
  8313. Remove chroma components, turning the video into a graytone image:
  8314. @example
  8315. lutyuv="u=128:v=128"
  8316. @end example
  8317. @item
  8318. Apply a luma burning effect:
  8319. @example
  8320. lutyuv="y=2*val"
  8321. @end example
  8322. @item
  8323. Remove green and blue components:
  8324. @example
  8325. lutrgb="g=0:b=0"
  8326. @end example
  8327. @item
  8328. Set a constant alpha channel value on input:
  8329. @example
  8330. format=rgba,lutrgb=a="maxval-minval/2"
  8331. @end example
  8332. @item
  8333. Correct luminance gamma by a factor of 0.5:
  8334. @example
  8335. lutyuv=y=gammaval(0.5)
  8336. @end example
  8337. @item
  8338. Discard least significant bits of luma:
  8339. @example
  8340. lutyuv=y='bitand(val, 128+64+32)'
  8341. @end example
  8342. @item
  8343. Technicolor like effect:
  8344. @example
  8345. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8346. @end example
  8347. @end itemize
  8348. @section lut2, tlut2
  8349. The @code{lut2} filter takes two input streams and outputs one
  8350. stream.
  8351. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8352. from one single stream.
  8353. This filter accepts the following parameters:
  8354. @table @option
  8355. @item c0
  8356. set first pixel component expression
  8357. @item c1
  8358. set second pixel component expression
  8359. @item c2
  8360. set third pixel component expression
  8361. @item c3
  8362. set fourth pixel component expression, corresponds to the alpha component
  8363. @end table
  8364. Each of them specifies the expression to use for computing the lookup table for
  8365. the corresponding pixel component values.
  8366. The exact component associated to each of the @var{c*} options depends on the
  8367. format in inputs.
  8368. The expressions can contain the following constants:
  8369. @table @option
  8370. @item w
  8371. @item h
  8372. The input width and height.
  8373. @item x
  8374. The first input value for the pixel component.
  8375. @item y
  8376. The second input value for the pixel component.
  8377. @item bdx
  8378. The first input video bit depth.
  8379. @item bdy
  8380. The second input video bit depth.
  8381. @end table
  8382. All expressions default to "x".
  8383. @subsection Examples
  8384. @itemize
  8385. @item
  8386. Highlight differences between two RGB video streams:
  8387. @example
  8388. 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)'
  8389. @end example
  8390. @item
  8391. Highlight differences between two YUV video streams:
  8392. @example
  8393. 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)'
  8394. @end example
  8395. @item
  8396. Show max difference between two video streams:
  8397. @example
  8398. 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)))'
  8399. @end example
  8400. @end itemize
  8401. @section maskedclamp
  8402. Clamp the first input stream with the second input and third input stream.
  8403. Returns the value of first stream to be between second input
  8404. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8405. This filter accepts the following options:
  8406. @table @option
  8407. @item undershoot
  8408. Default value is @code{0}.
  8409. @item overshoot
  8410. Default value is @code{0}.
  8411. @item planes
  8412. Set which planes will be processed as bitmap, unprocessed planes will be
  8413. copied from first stream.
  8414. By default value 0xf, all planes will be processed.
  8415. @end table
  8416. @section maskedmerge
  8417. Merge the first input stream with the second input stream using per pixel
  8418. weights in the third input stream.
  8419. A value of 0 in the third stream pixel component means that pixel component
  8420. from first stream is returned unchanged, while maximum value (eg. 255 for
  8421. 8-bit videos) means that pixel component from second stream is returned
  8422. unchanged. Intermediate values define the amount of merging between both
  8423. input stream's pixel components.
  8424. This filter accepts the following options:
  8425. @table @option
  8426. @item planes
  8427. Set which planes will be processed as bitmap, unprocessed planes will be
  8428. copied from first stream.
  8429. By default value 0xf, all planes will be processed.
  8430. @end table
  8431. @section mcdeint
  8432. Apply motion-compensation deinterlacing.
  8433. It needs one field per frame as input and must thus be used together
  8434. with yadif=1/3 or equivalent.
  8435. This filter accepts the following options:
  8436. @table @option
  8437. @item mode
  8438. Set the deinterlacing mode.
  8439. It accepts one of the following values:
  8440. @table @samp
  8441. @item fast
  8442. @item medium
  8443. @item slow
  8444. use iterative motion estimation
  8445. @item extra_slow
  8446. like @samp{slow}, but use multiple reference frames.
  8447. @end table
  8448. Default value is @samp{fast}.
  8449. @item parity
  8450. Set the picture field parity assumed for the input video. It must be
  8451. one of the following values:
  8452. @table @samp
  8453. @item 0, tff
  8454. assume top field first
  8455. @item 1, bff
  8456. assume bottom field first
  8457. @end table
  8458. Default value is @samp{bff}.
  8459. @item qp
  8460. Set per-block quantization parameter (QP) used by the internal
  8461. encoder.
  8462. Higher values should result in a smoother motion vector field but less
  8463. optimal individual vectors. Default value is 1.
  8464. @end table
  8465. @section mergeplanes
  8466. Merge color channel components from several video streams.
  8467. The filter accepts up to 4 input streams, and merge selected input
  8468. planes to the output video.
  8469. This filter accepts the following options:
  8470. @table @option
  8471. @item mapping
  8472. Set input to output plane mapping. Default is @code{0}.
  8473. The mappings is specified as a bitmap. It should be specified as a
  8474. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8475. mapping for the first plane of the output stream. 'A' sets the number of
  8476. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8477. corresponding input to use (from 0 to 3). The rest of the mappings is
  8478. similar, 'Bb' describes the mapping for the output stream second
  8479. plane, 'Cc' describes the mapping for the output stream third plane and
  8480. 'Dd' describes the mapping for the output stream fourth plane.
  8481. @item format
  8482. Set output pixel format. Default is @code{yuva444p}.
  8483. @end table
  8484. @subsection Examples
  8485. @itemize
  8486. @item
  8487. Merge three gray video streams of same width and height into single video stream:
  8488. @example
  8489. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8490. @end example
  8491. @item
  8492. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8493. @example
  8494. [a0][a1]mergeplanes=0x00010210:yuva444p
  8495. @end example
  8496. @item
  8497. Swap Y and A plane in yuva444p stream:
  8498. @example
  8499. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8500. @end example
  8501. @item
  8502. Swap U and V plane in yuv420p stream:
  8503. @example
  8504. format=yuv420p,mergeplanes=0x000201:yuv420p
  8505. @end example
  8506. @item
  8507. Cast a rgb24 clip to yuv444p:
  8508. @example
  8509. format=rgb24,mergeplanes=0x000102:yuv444p
  8510. @end example
  8511. @end itemize
  8512. @section mestimate
  8513. Estimate and export motion vectors using block matching algorithms.
  8514. Motion vectors are stored in frame side data to be used by other filters.
  8515. This filter accepts the following options:
  8516. @table @option
  8517. @item method
  8518. Specify the motion estimation method. Accepts one of the following values:
  8519. @table @samp
  8520. @item esa
  8521. Exhaustive search algorithm.
  8522. @item tss
  8523. Three step search algorithm.
  8524. @item tdls
  8525. Two dimensional logarithmic search algorithm.
  8526. @item ntss
  8527. New three step search algorithm.
  8528. @item fss
  8529. Four step search algorithm.
  8530. @item ds
  8531. Diamond search algorithm.
  8532. @item hexbs
  8533. Hexagon-based search algorithm.
  8534. @item epzs
  8535. Enhanced predictive zonal search algorithm.
  8536. @item umh
  8537. Uneven multi-hexagon search algorithm.
  8538. @end table
  8539. Default value is @samp{esa}.
  8540. @item mb_size
  8541. Macroblock size. Default @code{16}.
  8542. @item search_param
  8543. Search parameter. Default @code{7}.
  8544. @end table
  8545. @section midequalizer
  8546. Apply Midway Image Equalization effect using two video streams.
  8547. Midway Image Equalization adjusts a pair of images to have the same
  8548. histogram, while maintaining their dynamics as much as possible. It's
  8549. useful for e.g. matching exposures from a pair of stereo cameras.
  8550. This filter has two inputs and one output, which must be of same pixel format, but
  8551. may be of different sizes. The output of filter is first input adjusted with
  8552. midway histogram of both inputs.
  8553. This filter accepts the following option:
  8554. @table @option
  8555. @item planes
  8556. Set which planes to process. Default is @code{15}, which is all available planes.
  8557. @end table
  8558. @section minterpolate
  8559. Convert the video to specified frame rate using motion interpolation.
  8560. This filter accepts the following options:
  8561. @table @option
  8562. @item fps
  8563. 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}.
  8564. @item mi_mode
  8565. Motion interpolation mode. Following values are accepted:
  8566. @table @samp
  8567. @item dup
  8568. Duplicate previous or next frame for interpolating new ones.
  8569. @item blend
  8570. Blend source frames. Interpolated frame is mean of previous and next frames.
  8571. @item mci
  8572. Motion compensated interpolation. Following options are effective when this mode is selected:
  8573. @table @samp
  8574. @item mc_mode
  8575. Motion compensation mode. Following values are accepted:
  8576. @table @samp
  8577. @item obmc
  8578. Overlapped block motion compensation.
  8579. @item aobmc
  8580. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8581. @end table
  8582. Default mode is @samp{obmc}.
  8583. @item me_mode
  8584. Motion estimation mode. Following values are accepted:
  8585. @table @samp
  8586. @item bidir
  8587. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8588. @item bilat
  8589. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8590. @end table
  8591. Default mode is @samp{bilat}.
  8592. @item me
  8593. The algorithm to be used for motion estimation. Following values are accepted:
  8594. @table @samp
  8595. @item esa
  8596. Exhaustive search algorithm.
  8597. @item tss
  8598. Three step search algorithm.
  8599. @item tdls
  8600. Two dimensional logarithmic search algorithm.
  8601. @item ntss
  8602. New three step search algorithm.
  8603. @item fss
  8604. Four step search algorithm.
  8605. @item ds
  8606. Diamond search algorithm.
  8607. @item hexbs
  8608. Hexagon-based search algorithm.
  8609. @item epzs
  8610. Enhanced predictive zonal search algorithm.
  8611. @item umh
  8612. Uneven multi-hexagon search algorithm.
  8613. @end table
  8614. Default algorithm is @samp{epzs}.
  8615. @item mb_size
  8616. Macroblock size. Default @code{16}.
  8617. @item search_param
  8618. Motion estimation search parameter. Default @code{32}.
  8619. @item vsbmc
  8620. 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).
  8621. @end table
  8622. @end table
  8623. @item scd
  8624. 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:
  8625. @table @samp
  8626. @item none
  8627. Disable scene change detection.
  8628. @item fdiff
  8629. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8630. @end table
  8631. Default method is @samp{fdiff}.
  8632. @item scd_threshold
  8633. Scene change detection threshold. Default is @code{5.0}.
  8634. @end table
  8635. @section mix
  8636. Mix several video input streams into one video stream.
  8637. A description of the accepted options follows.
  8638. @table @option
  8639. @item nb_inputs
  8640. The number of inputs. If unspecified, it defaults to 2.
  8641. @item weights
  8642. Specify weight of each input video stream as sequence.
  8643. Each weight is separated by space. If number of weights
  8644. is smaller than number of @var{frames} last specified
  8645. weight will be used for all remaining unset weights.
  8646. @item scale
  8647. Specify scale, if it is set it will be multiplied with sum
  8648. of each weight multiplied with pixel values to give final destination
  8649. pixel value. By default @var{scale} is auto scaled to sum of weights.
  8650. @item duration
  8651. Specify how end of stream is determined.
  8652. @table @samp
  8653. @item longest
  8654. The duration of the longest input. (default)
  8655. @item shortest
  8656. The duration of the shortest input.
  8657. @item first
  8658. The duration of the first input.
  8659. @end table
  8660. @end table
  8661. @section mpdecimate
  8662. Drop frames that do not differ greatly from the previous frame in
  8663. order to reduce frame rate.
  8664. The main use of this filter is for very-low-bitrate encoding
  8665. (e.g. streaming over dialup modem), but it could in theory be used for
  8666. fixing movies that were inverse-telecined incorrectly.
  8667. A description of the accepted options follows.
  8668. @table @option
  8669. @item max
  8670. Set the maximum number of consecutive frames which can be dropped (if
  8671. positive), or the minimum interval between dropped frames (if
  8672. negative). If the value is 0, the frame is dropped disregarding the
  8673. number of previous sequentially dropped frames.
  8674. Default value is 0.
  8675. @item hi
  8676. @item lo
  8677. @item frac
  8678. Set the dropping threshold values.
  8679. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8680. represent actual pixel value differences, so a threshold of 64
  8681. corresponds to 1 unit of difference for each pixel, or the same spread
  8682. out differently over the block.
  8683. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8684. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8685. meaning the whole image) differ by more than a threshold of @option{lo}.
  8686. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8687. 64*5, and default value for @option{frac} is 0.33.
  8688. @end table
  8689. @section negate
  8690. Negate input video.
  8691. It accepts an integer in input; if non-zero it negates the
  8692. alpha component (if available). The default value in input is 0.
  8693. @section nlmeans
  8694. Denoise frames using Non-Local Means algorithm.
  8695. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8696. context similarity is defined by comparing their surrounding patches of size
  8697. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8698. around the pixel.
  8699. Note that the research area defines centers for patches, which means some
  8700. patches will be made of pixels outside that research area.
  8701. The filter accepts the following options.
  8702. @table @option
  8703. @item s
  8704. Set denoising strength.
  8705. @item p
  8706. Set patch size.
  8707. @item pc
  8708. Same as @option{p} but for chroma planes.
  8709. The default value is @var{0} and means automatic.
  8710. @item r
  8711. Set research size.
  8712. @item rc
  8713. Same as @option{r} but for chroma planes.
  8714. The default value is @var{0} and means automatic.
  8715. @end table
  8716. @section nnedi
  8717. Deinterlace video using neural network edge directed interpolation.
  8718. This filter accepts the following options:
  8719. @table @option
  8720. @item weights
  8721. Mandatory option, without binary file filter can not work.
  8722. Currently file can be found here:
  8723. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8724. @item deint
  8725. Set which frames to deinterlace, by default it is @code{all}.
  8726. Can be @code{all} or @code{interlaced}.
  8727. @item field
  8728. Set mode of operation.
  8729. Can be one of the following:
  8730. @table @samp
  8731. @item af
  8732. Use frame flags, both fields.
  8733. @item a
  8734. Use frame flags, single field.
  8735. @item t
  8736. Use top field only.
  8737. @item b
  8738. Use bottom field only.
  8739. @item tf
  8740. Use both fields, top first.
  8741. @item bf
  8742. Use both fields, bottom first.
  8743. @end table
  8744. @item planes
  8745. Set which planes to process, by default filter process all frames.
  8746. @item nsize
  8747. Set size of local neighborhood around each pixel, used by the predictor neural
  8748. network.
  8749. Can be one of the following:
  8750. @table @samp
  8751. @item s8x6
  8752. @item s16x6
  8753. @item s32x6
  8754. @item s48x6
  8755. @item s8x4
  8756. @item s16x4
  8757. @item s32x4
  8758. @end table
  8759. @item nns
  8760. Set the number of neurons in predictor neural network.
  8761. Can be one of the following:
  8762. @table @samp
  8763. @item n16
  8764. @item n32
  8765. @item n64
  8766. @item n128
  8767. @item n256
  8768. @end table
  8769. @item qual
  8770. Controls the number of different neural network predictions that are blended
  8771. together to compute the final output value. Can be @code{fast}, default or
  8772. @code{slow}.
  8773. @item etype
  8774. Set which set of weights to use in the predictor.
  8775. Can be one of the following:
  8776. @table @samp
  8777. @item a
  8778. weights trained to minimize absolute error
  8779. @item s
  8780. weights trained to minimize squared error
  8781. @end table
  8782. @item pscrn
  8783. Controls whether or not the prescreener neural network is used to decide
  8784. which pixels should be processed by the predictor neural network and which
  8785. can be handled by simple cubic interpolation.
  8786. The prescreener is trained to know whether cubic interpolation will be
  8787. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8788. The computational complexity of the prescreener nn is much less than that of
  8789. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8790. using the prescreener generally results in much faster processing.
  8791. The prescreener is pretty accurate, so the difference between using it and not
  8792. using it is almost always unnoticeable.
  8793. Can be one of the following:
  8794. @table @samp
  8795. @item none
  8796. @item original
  8797. @item new
  8798. @end table
  8799. Default is @code{new}.
  8800. @item fapprox
  8801. Set various debugging flags.
  8802. @end table
  8803. @section noformat
  8804. Force libavfilter not to use any of the specified pixel formats for the
  8805. input to the next filter.
  8806. It accepts the following parameters:
  8807. @table @option
  8808. @item pix_fmts
  8809. A '|'-separated list of pixel format names, such as
  8810. pix_fmts=yuv420p|monow|rgb24".
  8811. @end table
  8812. @subsection Examples
  8813. @itemize
  8814. @item
  8815. Force libavfilter to use a format different from @var{yuv420p} for the
  8816. input to the vflip filter:
  8817. @example
  8818. noformat=pix_fmts=yuv420p,vflip
  8819. @end example
  8820. @item
  8821. Convert the input video to any of the formats not contained in the list:
  8822. @example
  8823. noformat=yuv420p|yuv444p|yuv410p
  8824. @end example
  8825. @end itemize
  8826. @section noise
  8827. Add noise on video input frame.
  8828. The filter accepts the following options:
  8829. @table @option
  8830. @item all_seed
  8831. @item c0_seed
  8832. @item c1_seed
  8833. @item c2_seed
  8834. @item c3_seed
  8835. Set noise seed for specific pixel component or all pixel components in case
  8836. of @var{all_seed}. Default value is @code{123457}.
  8837. @item all_strength, alls
  8838. @item c0_strength, c0s
  8839. @item c1_strength, c1s
  8840. @item c2_strength, c2s
  8841. @item c3_strength, c3s
  8842. Set noise strength for specific pixel component or all pixel components in case
  8843. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8844. @item all_flags, allf
  8845. @item c0_flags, c0f
  8846. @item c1_flags, c1f
  8847. @item c2_flags, c2f
  8848. @item c3_flags, c3f
  8849. Set pixel component flags or set flags for all components if @var{all_flags}.
  8850. Available values for component flags are:
  8851. @table @samp
  8852. @item a
  8853. averaged temporal noise (smoother)
  8854. @item p
  8855. mix random noise with a (semi)regular pattern
  8856. @item t
  8857. temporal noise (noise pattern changes between frames)
  8858. @item u
  8859. uniform noise (gaussian otherwise)
  8860. @end table
  8861. @end table
  8862. @subsection Examples
  8863. Add temporal and uniform noise to input video:
  8864. @example
  8865. noise=alls=20:allf=t+u
  8866. @end example
  8867. @section normalize
  8868. Normalize RGB video (aka histogram stretching, contrast stretching).
  8869. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8870. For each channel of each frame, the filter computes the input range and maps
  8871. it linearly to the user-specified output range. The output range defaults
  8872. to the full dynamic range from pure black to pure white.
  8873. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8874. changes in brightness) caused when small dark or bright objects enter or leave
  8875. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8876. video camera, and, like a video camera, it may cause a period of over- or
  8877. under-exposure of the video.
  8878. The R,G,B channels can be normalized independently, which may cause some
  8879. color shifting, or linked together as a single channel, which prevents
  8880. color shifting. Linked normalization preserves hue. Independent normalization
  8881. does not, so it can be used to remove some color casts. Independent and linked
  8882. normalization can be combined in any ratio.
  8883. The normalize filter accepts the following options:
  8884. @table @option
  8885. @item blackpt
  8886. @item whitept
  8887. Colors which define the output range. The minimum input value is mapped to
  8888. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8889. The defaults are black and white respectively. Specifying white for
  8890. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8891. normalized video. Shades of grey can be used to reduce the dynamic range
  8892. (contrast). Specifying saturated colors here can create some interesting
  8893. effects.
  8894. @item smoothing
  8895. The number of previous frames to use for temporal smoothing. The input range
  8896. of each channel is smoothed using a rolling average over the current frame
  8897. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8898. smoothing).
  8899. @item independence
  8900. Controls the ratio of independent (color shifting) channel normalization to
  8901. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8902. independent. Defaults to 1.0 (fully independent).
  8903. @item strength
  8904. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8905. expensive no-op. Defaults to 1.0 (full strength).
  8906. @end table
  8907. @subsection Examples
  8908. Stretch video contrast to use the full dynamic range, with no temporal
  8909. smoothing; may flicker depending on the source content:
  8910. @example
  8911. normalize=blackpt=black:whitept=white:smoothing=0
  8912. @end example
  8913. As above, but with 50 frames of temporal smoothing; flicker should be
  8914. reduced, depending on the source content:
  8915. @example
  8916. normalize=blackpt=black:whitept=white:smoothing=50
  8917. @end example
  8918. As above, but with hue-preserving linked channel normalization:
  8919. @example
  8920. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8921. @end example
  8922. As above, but with half strength:
  8923. @example
  8924. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8925. @end example
  8926. Map the darkest input color to red, the brightest input color to cyan:
  8927. @example
  8928. normalize=blackpt=red:whitept=cyan
  8929. @end example
  8930. @section null
  8931. Pass the video source unchanged to the output.
  8932. @section ocr
  8933. Optical Character Recognition
  8934. This filter uses Tesseract for optical character recognition.
  8935. It accepts the following options:
  8936. @table @option
  8937. @item datapath
  8938. Set datapath to tesseract data. Default is to use whatever was
  8939. set at installation.
  8940. @item language
  8941. Set language, default is "eng".
  8942. @item whitelist
  8943. Set character whitelist.
  8944. @item blacklist
  8945. Set character blacklist.
  8946. @end table
  8947. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8948. @section ocv
  8949. Apply a video transform using libopencv.
  8950. To enable this filter, install the libopencv library and headers and
  8951. configure FFmpeg with @code{--enable-libopencv}.
  8952. It accepts the following parameters:
  8953. @table @option
  8954. @item filter_name
  8955. The name of the libopencv filter to apply.
  8956. @item filter_params
  8957. The parameters to pass to the libopencv filter. If not specified, the default
  8958. values are assumed.
  8959. @end table
  8960. Refer to the official libopencv documentation for more precise
  8961. information:
  8962. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8963. Several libopencv filters are supported; see the following subsections.
  8964. @anchor{dilate}
  8965. @subsection dilate
  8966. Dilate an image by using a specific structuring element.
  8967. It corresponds to the libopencv function @code{cvDilate}.
  8968. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8969. @var{struct_el} represents a structuring element, and has the syntax:
  8970. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8971. @var{cols} and @var{rows} represent the number of columns and rows of
  8972. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8973. point, and @var{shape} the shape for the structuring element. @var{shape}
  8974. must be "rect", "cross", "ellipse", or "custom".
  8975. If the value for @var{shape} is "custom", it must be followed by a
  8976. string of the form "=@var{filename}". The file with name
  8977. @var{filename} is assumed to represent a binary image, with each
  8978. printable character corresponding to a bright pixel. When a custom
  8979. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8980. or columns and rows of the read file are assumed instead.
  8981. The default value for @var{struct_el} is "3x3+0x0/rect".
  8982. @var{nb_iterations} specifies the number of times the transform is
  8983. applied to the image, and defaults to 1.
  8984. Some examples:
  8985. @example
  8986. # Use the default values
  8987. ocv=dilate
  8988. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8989. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8990. # Read the shape from the file diamond.shape, iterating two times.
  8991. # The file diamond.shape may contain a pattern of characters like this
  8992. # *
  8993. # ***
  8994. # *****
  8995. # ***
  8996. # *
  8997. # The specified columns and rows are ignored
  8998. # but the anchor point coordinates are not
  8999. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9000. @end example
  9001. @subsection erode
  9002. Erode an image by using a specific structuring element.
  9003. It corresponds to the libopencv function @code{cvErode}.
  9004. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9005. with the same syntax and semantics as the @ref{dilate} filter.
  9006. @subsection smooth
  9007. Smooth the input video.
  9008. The filter takes the following parameters:
  9009. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9010. @var{type} is the type of smooth filter to apply, and must be one of
  9011. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9012. or "bilateral". The default value is "gaussian".
  9013. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9014. depend on the smooth type. @var{param1} and
  9015. @var{param2} accept integer positive values or 0. @var{param3} and
  9016. @var{param4} accept floating point values.
  9017. The default value for @var{param1} is 3. The default value for the
  9018. other parameters is 0.
  9019. These parameters correspond to the parameters assigned to the
  9020. libopencv function @code{cvSmooth}.
  9021. @section oscilloscope
  9022. 2D Video Oscilloscope.
  9023. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9024. It accepts the following parameters:
  9025. @table @option
  9026. @item x
  9027. Set scope center x position.
  9028. @item y
  9029. Set scope center y position.
  9030. @item s
  9031. Set scope size, relative to frame diagonal.
  9032. @item t
  9033. Set scope tilt/rotation.
  9034. @item o
  9035. Set trace opacity.
  9036. @item tx
  9037. Set trace center x position.
  9038. @item ty
  9039. Set trace center y position.
  9040. @item tw
  9041. Set trace width, relative to width of frame.
  9042. @item th
  9043. Set trace height, relative to height of frame.
  9044. @item c
  9045. Set which components to trace. By default it traces first three components.
  9046. @item g
  9047. Draw trace grid. By default is enabled.
  9048. @item st
  9049. Draw some statistics. By default is enabled.
  9050. @item sc
  9051. Draw scope. By default is enabled.
  9052. @end table
  9053. @subsection Examples
  9054. @itemize
  9055. @item
  9056. Inspect full first row of video frame.
  9057. @example
  9058. oscilloscope=x=0.5:y=0:s=1
  9059. @end example
  9060. @item
  9061. Inspect full last row of video frame.
  9062. @example
  9063. oscilloscope=x=0.5:y=1:s=1
  9064. @end example
  9065. @item
  9066. Inspect full 5th line of video frame of height 1080.
  9067. @example
  9068. oscilloscope=x=0.5:y=5/1080:s=1
  9069. @end example
  9070. @item
  9071. Inspect full last column of video frame.
  9072. @example
  9073. oscilloscope=x=1:y=0.5:s=1:t=1
  9074. @end example
  9075. @end itemize
  9076. @anchor{overlay}
  9077. @section overlay
  9078. Overlay one video on top of another.
  9079. It takes two inputs and has one output. The first input is the "main"
  9080. video on which the second input is overlaid.
  9081. It accepts the following parameters:
  9082. A description of the accepted options follows.
  9083. @table @option
  9084. @item x
  9085. @item y
  9086. Set the expression for the x and y coordinates of the overlaid video
  9087. on the main video. Default value is "0" for both expressions. In case
  9088. the expression is invalid, it is set to a huge value (meaning that the
  9089. overlay will not be displayed within the output visible area).
  9090. @item eof_action
  9091. See @ref{framesync}.
  9092. @item eval
  9093. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9094. It accepts the following values:
  9095. @table @samp
  9096. @item init
  9097. only evaluate expressions once during the filter initialization or
  9098. when a command is processed
  9099. @item frame
  9100. evaluate expressions for each incoming frame
  9101. @end table
  9102. Default value is @samp{frame}.
  9103. @item shortest
  9104. See @ref{framesync}.
  9105. @item format
  9106. Set the format for the output video.
  9107. It accepts the following values:
  9108. @table @samp
  9109. @item yuv420
  9110. force YUV420 output
  9111. @item yuv422
  9112. force YUV422 output
  9113. @item yuv444
  9114. force YUV444 output
  9115. @item rgb
  9116. force packed RGB output
  9117. @item gbrp
  9118. force planar RGB output
  9119. @item auto
  9120. automatically pick format
  9121. @end table
  9122. Default value is @samp{yuv420}.
  9123. @item repeatlast
  9124. See @ref{framesync}.
  9125. @item alpha
  9126. Set format of alpha of the overlaid video, it can be @var{straight} or
  9127. @var{premultiplied}. Default is @var{straight}.
  9128. @end table
  9129. The @option{x}, and @option{y} expressions can contain the following
  9130. parameters.
  9131. @table @option
  9132. @item main_w, W
  9133. @item main_h, H
  9134. The main input width and height.
  9135. @item overlay_w, w
  9136. @item overlay_h, h
  9137. The overlay input width and height.
  9138. @item x
  9139. @item y
  9140. The computed values for @var{x} and @var{y}. They are evaluated for
  9141. each new frame.
  9142. @item hsub
  9143. @item vsub
  9144. horizontal and vertical chroma subsample values of the output
  9145. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9146. @var{vsub} is 1.
  9147. @item n
  9148. the number of input frame, starting from 0
  9149. @item pos
  9150. the position in the file of the input frame, NAN if unknown
  9151. @item t
  9152. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9153. @end table
  9154. This filter also supports the @ref{framesync} options.
  9155. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9156. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9157. when @option{eval} is set to @samp{init}.
  9158. Be aware that frames are taken from each input video in timestamp
  9159. order, hence, if their initial timestamps differ, it is a good idea
  9160. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9161. have them begin in the same zero timestamp, as the example for
  9162. the @var{movie} filter does.
  9163. You can chain together more overlays but you should test the
  9164. efficiency of such approach.
  9165. @subsection Commands
  9166. This filter supports the following commands:
  9167. @table @option
  9168. @item x
  9169. @item y
  9170. Modify the x and y of the overlay input.
  9171. The command accepts the same syntax of the corresponding option.
  9172. If the specified expression is not valid, it is kept at its current
  9173. value.
  9174. @end table
  9175. @subsection Examples
  9176. @itemize
  9177. @item
  9178. Draw the overlay at 10 pixels from the bottom right corner of the main
  9179. video:
  9180. @example
  9181. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9182. @end example
  9183. Using named options the example above becomes:
  9184. @example
  9185. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9186. @end example
  9187. @item
  9188. Insert a transparent PNG logo in the bottom left corner of the input,
  9189. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9190. @example
  9191. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9192. @end example
  9193. @item
  9194. Insert 2 different transparent PNG logos (second logo on bottom
  9195. right corner) using the @command{ffmpeg} tool:
  9196. @example
  9197. 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
  9198. @end example
  9199. @item
  9200. Add a transparent color layer on top of the main video; @code{WxH}
  9201. must specify the size of the main input to the overlay filter:
  9202. @example
  9203. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9204. @end example
  9205. @item
  9206. Play an original video and a filtered version (here with the deshake
  9207. filter) side by side using the @command{ffplay} tool:
  9208. @example
  9209. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9210. @end example
  9211. The above command is the same as:
  9212. @example
  9213. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9214. @end example
  9215. @item
  9216. Make a sliding overlay appearing from the left to the right top part of the
  9217. screen starting since time 2:
  9218. @example
  9219. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9220. @end example
  9221. @item
  9222. Compose output by putting two input videos side to side:
  9223. @example
  9224. ffmpeg -i left.avi -i right.avi -filter_complex "
  9225. nullsrc=size=200x100 [background];
  9226. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9227. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9228. [background][left] overlay=shortest=1 [background+left];
  9229. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9230. "
  9231. @end example
  9232. @item
  9233. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9234. @example
  9235. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9236. -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]'
  9237. masked.avi
  9238. @end example
  9239. @item
  9240. Chain several overlays in cascade:
  9241. @example
  9242. nullsrc=s=200x200 [bg];
  9243. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9244. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9245. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9246. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9247. [in3] null, [mid2] overlay=100:100 [out0]
  9248. @end example
  9249. @end itemize
  9250. @section owdenoise
  9251. Apply Overcomplete Wavelet denoiser.
  9252. The filter accepts the following options:
  9253. @table @option
  9254. @item depth
  9255. Set depth.
  9256. Larger depth values will denoise lower frequency components more, but
  9257. slow down filtering.
  9258. Must be an int in the range 8-16, default is @code{8}.
  9259. @item luma_strength, ls
  9260. Set luma strength.
  9261. Must be a double value in the range 0-1000, default is @code{1.0}.
  9262. @item chroma_strength, cs
  9263. Set chroma strength.
  9264. Must be a double value in the range 0-1000, default is @code{1.0}.
  9265. @end table
  9266. @anchor{pad}
  9267. @section pad
  9268. Add paddings to the input image, and place the original input at the
  9269. provided @var{x}, @var{y} coordinates.
  9270. It accepts the following parameters:
  9271. @table @option
  9272. @item width, w
  9273. @item height, h
  9274. Specify an expression for the size of the output image with the
  9275. paddings added. If the value for @var{width} or @var{height} is 0, the
  9276. corresponding input size is used for the output.
  9277. The @var{width} expression can reference the value set by the
  9278. @var{height} expression, and vice versa.
  9279. The default value of @var{width} and @var{height} is 0.
  9280. @item x
  9281. @item y
  9282. Specify the offsets to place the input image at within the padded area,
  9283. with respect to the top/left border of the output image.
  9284. The @var{x} expression can reference the value set by the @var{y}
  9285. expression, and vice versa.
  9286. The default value of @var{x} and @var{y} is 0.
  9287. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9288. so the input image is centered on the padded area.
  9289. @item color
  9290. Specify the color of the padded area. For the syntax of this option,
  9291. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9292. manual,ffmpeg-utils}.
  9293. The default value of @var{color} is "black".
  9294. @item eval
  9295. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9296. It accepts the following values:
  9297. @table @samp
  9298. @item init
  9299. Only evaluate expressions once during the filter initialization or when
  9300. a command is processed.
  9301. @item frame
  9302. Evaluate expressions for each incoming frame.
  9303. @end table
  9304. Default value is @samp{init}.
  9305. @item aspect
  9306. Pad to aspect instead to a resolution.
  9307. @end table
  9308. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9309. options are expressions containing the following constants:
  9310. @table @option
  9311. @item in_w
  9312. @item in_h
  9313. The input video width and height.
  9314. @item iw
  9315. @item ih
  9316. These are the same as @var{in_w} and @var{in_h}.
  9317. @item out_w
  9318. @item out_h
  9319. The output width and height (the size of the padded area), as
  9320. specified by the @var{width} and @var{height} expressions.
  9321. @item ow
  9322. @item oh
  9323. These are the same as @var{out_w} and @var{out_h}.
  9324. @item x
  9325. @item y
  9326. The x and y offsets as specified by the @var{x} and @var{y}
  9327. expressions, or NAN if not yet specified.
  9328. @item a
  9329. same as @var{iw} / @var{ih}
  9330. @item sar
  9331. input sample aspect ratio
  9332. @item dar
  9333. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9334. @item hsub
  9335. @item vsub
  9336. The horizontal and vertical chroma subsample values. For example for the
  9337. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9338. @end table
  9339. @subsection Examples
  9340. @itemize
  9341. @item
  9342. Add paddings with the color "violet" to the input video. The output video
  9343. size is 640x480, and the top-left corner of the input video is placed at
  9344. column 0, row 40
  9345. @example
  9346. pad=640:480:0:40:violet
  9347. @end example
  9348. The example above is equivalent to the following command:
  9349. @example
  9350. pad=width=640:height=480:x=0:y=40:color=violet
  9351. @end example
  9352. @item
  9353. Pad the input to get an output with dimensions increased by 3/2,
  9354. and put the input video at the center of the padded area:
  9355. @example
  9356. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9357. @end example
  9358. @item
  9359. Pad the input to get a squared output with size equal to the maximum
  9360. value between the input width and height, and put the input video at
  9361. the center of the padded area:
  9362. @example
  9363. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9364. @end example
  9365. @item
  9366. Pad the input to get a final w/h ratio of 16:9:
  9367. @example
  9368. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9369. @end example
  9370. @item
  9371. In case of anamorphic video, in order to set the output display aspect
  9372. correctly, it is necessary to use @var{sar} in the expression,
  9373. according to the relation:
  9374. @example
  9375. (ih * X / ih) * sar = output_dar
  9376. X = output_dar / sar
  9377. @end example
  9378. Thus the previous example needs to be modified to:
  9379. @example
  9380. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9381. @end example
  9382. @item
  9383. Double the output size and put the input video in the bottom-right
  9384. corner of the output padded area:
  9385. @example
  9386. pad="2*iw:2*ih:ow-iw:oh-ih"
  9387. @end example
  9388. @end itemize
  9389. @anchor{palettegen}
  9390. @section palettegen
  9391. Generate one palette for a whole video stream.
  9392. It accepts the following options:
  9393. @table @option
  9394. @item max_colors
  9395. Set the maximum number of colors to quantize in the palette.
  9396. Note: the palette will still contain 256 colors; the unused palette entries
  9397. will be black.
  9398. @item reserve_transparent
  9399. Create a palette of 255 colors maximum and reserve the last one for
  9400. transparency. Reserving the transparency color is useful for GIF optimization.
  9401. If not set, the maximum of colors in the palette will be 256. You probably want
  9402. to disable this option for a standalone image.
  9403. Set by default.
  9404. @item transparency_color
  9405. Set the color that will be used as background for transparency.
  9406. @item stats_mode
  9407. Set statistics mode.
  9408. It accepts the following values:
  9409. @table @samp
  9410. @item full
  9411. Compute full frame histograms.
  9412. @item diff
  9413. Compute histograms only for the part that differs from previous frame. This
  9414. might be relevant to give more importance to the moving part of your input if
  9415. the background is static.
  9416. @item single
  9417. Compute new histogram for each frame.
  9418. @end table
  9419. Default value is @var{full}.
  9420. @end table
  9421. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9422. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9423. color quantization of the palette. This information is also visible at
  9424. @var{info} logging level.
  9425. @subsection Examples
  9426. @itemize
  9427. @item
  9428. Generate a representative palette of a given video using @command{ffmpeg}:
  9429. @example
  9430. ffmpeg -i input.mkv -vf palettegen palette.png
  9431. @end example
  9432. @end itemize
  9433. @section paletteuse
  9434. Use a palette to downsample an input video stream.
  9435. The filter takes two inputs: one video stream and a palette. The palette must
  9436. be a 256 pixels image.
  9437. It accepts the following options:
  9438. @table @option
  9439. @item dither
  9440. Select dithering mode. Available algorithms are:
  9441. @table @samp
  9442. @item bayer
  9443. Ordered 8x8 bayer dithering (deterministic)
  9444. @item heckbert
  9445. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9446. Note: this dithering is sometimes considered "wrong" and is included as a
  9447. reference.
  9448. @item floyd_steinberg
  9449. Floyd and Steingberg dithering (error diffusion)
  9450. @item sierra2
  9451. Frankie Sierra dithering v2 (error diffusion)
  9452. @item sierra2_4a
  9453. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9454. @end table
  9455. Default is @var{sierra2_4a}.
  9456. @item bayer_scale
  9457. When @var{bayer} dithering is selected, this option defines the scale of the
  9458. pattern (how much the crosshatch pattern is visible). A low value means more
  9459. visible pattern for less banding, and higher value means less visible pattern
  9460. at the cost of more banding.
  9461. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9462. @item diff_mode
  9463. If set, define the zone to process
  9464. @table @samp
  9465. @item rectangle
  9466. Only the changing rectangle will be reprocessed. This is similar to GIF
  9467. cropping/offsetting compression mechanism. This option can be useful for speed
  9468. if only a part of the image is changing, and has use cases such as limiting the
  9469. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9470. moving scene (it leads to more deterministic output if the scene doesn't change
  9471. much, and as a result less moving noise and better GIF compression).
  9472. @end table
  9473. Default is @var{none}.
  9474. @item new
  9475. Take new palette for each output frame.
  9476. @item alpha_threshold
  9477. Sets the alpha threshold for transparency. Alpha values above this threshold
  9478. will be treated as completely opaque, and values below this threshold will be
  9479. treated as completely transparent.
  9480. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9481. @end table
  9482. @subsection Examples
  9483. @itemize
  9484. @item
  9485. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9486. using @command{ffmpeg}:
  9487. @example
  9488. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9489. @end example
  9490. @end itemize
  9491. @section perspective
  9492. Correct perspective of video not recorded perpendicular to the screen.
  9493. A description of the accepted parameters follows.
  9494. @table @option
  9495. @item x0
  9496. @item y0
  9497. @item x1
  9498. @item y1
  9499. @item x2
  9500. @item y2
  9501. @item x3
  9502. @item y3
  9503. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9504. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9505. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9506. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9507. then the corners of the source will be sent to the specified coordinates.
  9508. The expressions can use the following variables:
  9509. @table @option
  9510. @item W
  9511. @item H
  9512. the width and height of video frame.
  9513. @item in
  9514. Input frame count.
  9515. @item on
  9516. Output frame count.
  9517. @end table
  9518. @item interpolation
  9519. Set interpolation for perspective correction.
  9520. It accepts the following values:
  9521. @table @samp
  9522. @item linear
  9523. @item cubic
  9524. @end table
  9525. Default value is @samp{linear}.
  9526. @item sense
  9527. Set interpretation of coordinate options.
  9528. It accepts the following values:
  9529. @table @samp
  9530. @item 0, source
  9531. Send point in the source specified by the given coordinates to
  9532. the corners of the destination.
  9533. @item 1, destination
  9534. Send the corners of the source to the point in the destination specified
  9535. by the given coordinates.
  9536. Default value is @samp{source}.
  9537. @end table
  9538. @item eval
  9539. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9540. It accepts the following values:
  9541. @table @samp
  9542. @item init
  9543. only evaluate expressions once during the filter initialization or
  9544. when a command is processed
  9545. @item frame
  9546. evaluate expressions for each incoming frame
  9547. @end table
  9548. Default value is @samp{init}.
  9549. @end table
  9550. @section phase
  9551. Delay interlaced video by one field time so that the field order changes.
  9552. The intended use is to fix PAL movies that have been captured with the
  9553. opposite field order to the film-to-video transfer.
  9554. A description of the accepted parameters follows.
  9555. @table @option
  9556. @item mode
  9557. Set phase mode.
  9558. It accepts the following values:
  9559. @table @samp
  9560. @item t
  9561. Capture field order top-first, transfer bottom-first.
  9562. Filter will delay the bottom field.
  9563. @item b
  9564. Capture field order bottom-first, transfer top-first.
  9565. Filter will delay the top field.
  9566. @item p
  9567. Capture and transfer with the same field order. This mode only exists
  9568. for the documentation of the other options to refer to, but if you
  9569. actually select it, the filter will faithfully do nothing.
  9570. @item a
  9571. Capture field order determined automatically by field flags, transfer
  9572. opposite.
  9573. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9574. basis using field flags. If no field information is available,
  9575. then this works just like @samp{u}.
  9576. @item u
  9577. Capture unknown or varying, transfer opposite.
  9578. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9579. analyzing the images and selecting the alternative that produces best
  9580. match between the fields.
  9581. @item T
  9582. Capture top-first, transfer unknown or varying.
  9583. Filter selects among @samp{t} and @samp{p} using image analysis.
  9584. @item B
  9585. Capture bottom-first, transfer unknown or varying.
  9586. Filter selects among @samp{b} and @samp{p} using image analysis.
  9587. @item A
  9588. Capture determined by field flags, transfer unknown or varying.
  9589. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9590. image analysis. If no field information is available, then this works just
  9591. like @samp{U}. This is the default mode.
  9592. @item U
  9593. Both capture and transfer unknown or varying.
  9594. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9595. @end table
  9596. @end table
  9597. @section pixdesctest
  9598. Pixel format descriptor test filter, mainly useful for internal
  9599. testing. The output video should be equal to the input video.
  9600. For example:
  9601. @example
  9602. format=monow, pixdesctest
  9603. @end example
  9604. can be used to test the monowhite pixel format descriptor definition.
  9605. @section pixscope
  9606. Display sample values of color channels. Mainly useful for checking color
  9607. and levels. Minimum supported resolution is 640x480.
  9608. The filters accept the following options:
  9609. @table @option
  9610. @item x
  9611. Set scope X position, relative offset on X axis.
  9612. @item y
  9613. Set scope Y position, relative offset on Y axis.
  9614. @item w
  9615. Set scope width.
  9616. @item h
  9617. Set scope height.
  9618. @item o
  9619. Set window opacity. This window also holds statistics about pixel area.
  9620. @item wx
  9621. Set window X position, relative offset on X axis.
  9622. @item wy
  9623. Set window Y position, relative offset on Y axis.
  9624. @end table
  9625. @section pp
  9626. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9627. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9628. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9629. Each subfilter and some options have a short and a long name that can be used
  9630. interchangeably, i.e. dr/dering are the same.
  9631. The filters accept the following options:
  9632. @table @option
  9633. @item subfilters
  9634. Set postprocessing subfilters string.
  9635. @end table
  9636. All subfilters share common options to determine their scope:
  9637. @table @option
  9638. @item a/autoq
  9639. Honor the quality commands for this subfilter.
  9640. @item c/chrom
  9641. Do chrominance filtering, too (default).
  9642. @item y/nochrom
  9643. Do luminance filtering only (no chrominance).
  9644. @item n/noluma
  9645. Do chrominance filtering only (no luminance).
  9646. @end table
  9647. These options can be appended after the subfilter name, separated by a '|'.
  9648. Available subfilters are:
  9649. @table @option
  9650. @item hb/hdeblock[|difference[|flatness]]
  9651. Horizontal deblocking filter
  9652. @table @option
  9653. @item difference
  9654. Difference factor where higher values mean more deblocking (default: @code{32}).
  9655. @item flatness
  9656. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9657. @end table
  9658. @item vb/vdeblock[|difference[|flatness]]
  9659. Vertical deblocking filter
  9660. @table @option
  9661. @item difference
  9662. Difference factor where higher values mean more deblocking (default: @code{32}).
  9663. @item flatness
  9664. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9665. @end table
  9666. @item ha/hadeblock[|difference[|flatness]]
  9667. Accurate horizontal deblocking filter
  9668. @table @option
  9669. @item difference
  9670. Difference factor where higher values mean more deblocking (default: @code{32}).
  9671. @item flatness
  9672. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9673. @end table
  9674. @item va/vadeblock[|difference[|flatness]]
  9675. Accurate vertical deblocking filter
  9676. @table @option
  9677. @item difference
  9678. Difference factor where higher values mean more deblocking (default: @code{32}).
  9679. @item flatness
  9680. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9681. @end table
  9682. @end table
  9683. The horizontal and vertical deblocking filters share the difference and
  9684. flatness values so you cannot set different horizontal and vertical
  9685. thresholds.
  9686. @table @option
  9687. @item h1/x1hdeblock
  9688. Experimental horizontal deblocking filter
  9689. @item v1/x1vdeblock
  9690. Experimental vertical deblocking filter
  9691. @item dr/dering
  9692. Deringing filter
  9693. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9694. @table @option
  9695. @item threshold1
  9696. larger -> stronger filtering
  9697. @item threshold2
  9698. larger -> stronger filtering
  9699. @item threshold3
  9700. larger -> stronger filtering
  9701. @end table
  9702. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9703. @table @option
  9704. @item f/fullyrange
  9705. Stretch luminance to @code{0-255}.
  9706. @end table
  9707. @item lb/linblenddeint
  9708. Linear blend deinterlacing filter that deinterlaces the given block by
  9709. filtering all lines with a @code{(1 2 1)} filter.
  9710. @item li/linipoldeint
  9711. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9712. linearly interpolating every second line.
  9713. @item ci/cubicipoldeint
  9714. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9715. cubically interpolating every second line.
  9716. @item md/mediandeint
  9717. Median deinterlacing filter that deinterlaces the given block by applying a
  9718. median filter to every second line.
  9719. @item fd/ffmpegdeint
  9720. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9721. second line with a @code{(-1 4 2 4 -1)} filter.
  9722. @item l5/lowpass5
  9723. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9724. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9725. @item fq/forceQuant[|quantizer]
  9726. Overrides the quantizer table from the input with the constant quantizer you
  9727. specify.
  9728. @table @option
  9729. @item quantizer
  9730. Quantizer to use
  9731. @end table
  9732. @item de/default
  9733. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9734. @item fa/fast
  9735. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9736. @item ac
  9737. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9738. @end table
  9739. @subsection Examples
  9740. @itemize
  9741. @item
  9742. Apply horizontal and vertical deblocking, deringing and automatic
  9743. brightness/contrast:
  9744. @example
  9745. pp=hb/vb/dr/al
  9746. @end example
  9747. @item
  9748. Apply default filters without brightness/contrast correction:
  9749. @example
  9750. pp=de/-al
  9751. @end example
  9752. @item
  9753. Apply default filters and temporal denoiser:
  9754. @example
  9755. pp=default/tmpnoise|1|2|3
  9756. @end example
  9757. @item
  9758. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9759. automatically depending on available CPU time:
  9760. @example
  9761. pp=hb|y/vb|a
  9762. @end example
  9763. @end itemize
  9764. @section pp7
  9765. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9766. similar to spp = 6 with 7 point DCT, where only the center sample is
  9767. used after IDCT.
  9768. The filter accepts the following options:
  9769. @table @option
  9770. @item qp
  9771. Force a constant quantization parameter. It accepts an integer in range
  9772. 0 to 63. If not set, the filter will use the QP from the video stream
  9773. (if available).
  9774. @item mode
  9775. Set thresholding mode. Available modes are:
  9776. @table @samp
  9777. @item hard
  9778. Set hard thresholding.
  9779. @item soft
  9780. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9781. @item medium
  9782. Set medium thresholding (good results, default).
  9783. @end table
  9784. @end table
  9785. @section premultiply
  9786. Apply alpha premultiply effect to input video stream using first plane
  9787. of second stream as alpha.
  9788. Both streams must have same dimensions and same pixel format.
  9789. The filter accepts the following option:
  9790. @table @option
  9791. @item planes
  9792. Set which planes will be processed, unprocessed planes will be copied.
  9793. By default value 0xf, all planes will be processed.
  9794. @item inplace
  9795. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9796. @end table
  9797. @section prewitt
  9798. Apply prewitt operator to input video stream.
  9799. The filter accepts the following option:
  9800. @table @option
  9801. @item planes
  9802. Set which planes will be processed, unprocessed planes will be copied.
  9803. By default value 0xf, all planes will be processed.
  9804. @item scale
  9805. Set value which will be multiplied with filtered result.
  9806. @item delta
  9807. Set value which will be added to filtered result.
  9808. @end table
  9809. @anchor{program_opencl}
  9810. @section program_opencl
  9811. Filter video using an OpenCL program.
  9812. @table @option
  9813. @item source
  9814. OpenCL program source file.
  9815. @item kernel
  9816. Kernel name in program.
  9817. @item inputs
  9818. Number of inputs to the filter. Defaults to 1.
  9819. @item size, s
  9820. Size of output frames. Defaults to the same as the first input.
  9821. @end table
  9822. The program source file must contain a kernel function with the given name,
  9823. which will be run once for each plane of the output. Each run on a plane
  9824. gets enqueued as a separate 2D global NDRange with one work-item for each
  9825. pixel to be generated. The global ID offset for each work-item is therefore
  9826. the coordinates of a pixel in the destination image.
  9827. The kernel function needs to take the following arguments:
  9828. @itemize
  9829. @item
  9830. Destination image, @var{__write_only image2d_t}.
  9831. This image will become the output; the kernel should write all of it.
  9832. @item
  9833. Frame index, @var{unsigned int}.
  9834. This is a counter starting from zero and increasing by one for each frame.
  9835. @item
  9836. Source images, @var{__read_only image2d_t}.
  9837. These are the most recent images on each input. The kernel may read from
  9838. them to generate the output, but they can't be written to.
  9839. @end itemize
  9840. Example programs:
  9841. @itemize
  9842. @item
  9843. Copy the input to the output (output must be the same size as the input).
  9844. @verbatim
  9845. __kernel void copy(__write_only image2d_t destination,
  9846. unsigned int index,
  9847. __read_only image2d_t source)
  9848. {
  9849. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9850. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9851. float4 value = read_imagef(source, sampler, location);
  9852. write_imagef(destination, location, value);
  9853. }
  9854. @end verbatim
  9855. @item
  9856. Apply a simple transformation, rotating the input by an amount increasing
  9857. with the index counter. Pixel values are linearly interpolated by the
  9858. sampler, and the output need not have the same dimensions as the input.
  9859. @verbatim
  9860. __kernel void rotate_image(__write_only image2d_t dst,
  9861. unsigned int index,
  9862. __read_only image2d_t src)
  9863. {
  9864. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9865. CLK_FILTER_LINEAR);
  9866. float angle = (float)index / 100.0f;
  9867. float2 dst_dim = convert_float2(get_image_dim(dst));
  9868. float2 src_dim = convert_float2(get_image_dim(src));
  9869. float2 dst_cen = dst_dim / 2.0f;
  9870. float2 src_cen = src_dim / 2.0f;
  9871. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9872. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9873. float2 src_pos = {
  9874. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9875. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9876. };
  9877. src_pos = src_pos * src_dim / dst_dim;
  9878. float2 src_loc = src_pos + src_cen;
  9879. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9880. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9881. write_imagef(dst, dst_loc, 0.5f);
  9882. else
  9883. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9884. }
  9885. @end verbatim
  9886. @item
  9887. Blend two inputs together, with the amount of each input used varying
  9888. with the index counter.
  9889. @verbatim
  9890. __kernel void blend_images(__write_only image2d_t dst,
  9891. unsigned int index,
  9892. __read_only image2d_t src1,
  9893. __read_only image2d_t src2)
  9894. {
  9895. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9896. CLK_FILTER_LINEAR);
  9897. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9898. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9899. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9900. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9901. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9902. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9903. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9904. }
  9905. @end verbatim
  9906. @end itemize
  9907. @section pseudocolor
  9908. Alter frame colors in video with pseudocolors.
  9909. This filter accept the following options:
  9910. @table @option
  9911. @item c0
  9912. set pixel first component expression
  9913. @item c1
  9914. set pixel second component expression
  9915. @item c2
  9916. set pixel third component expression
  9917. @item c3
  9918. set pixel fourth component expression, corresponds to the alpha component
  9919. @item i
  9920. set component to use as base for altering colors
  9921. @end table
  9922. Each of them specifies the expression to use for computing the lookup table for
  9923. the corresponding pixel component values.
  9924. The expressions can contain the following constants and functions:
  9925. @table @option
  9926. @item w
  9927. @item h
  9928. The input width and height.
  9929. @item val
  9930. The input value for the pixel component.
  9931. @item ymin, umin, vmin, amin
  9932. The minimum allowed component value.
  9933. @item ymax, umax, vmax, amax
  9934. The maximum allowed component value.
  9935. @end table
  9936. All expressions default to "val".
  9937. @subsection Examples
  9938. @itemize
  9939. @item
  9940. Change too high luma values to gradient:
  9941. @example
  9942. 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'"
  9943. @end example
  9944. @end itemize
  9945. @section psnr
  9946. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9947. Ratio) between two input videos.
  9948. This filter takes in input two input videos, the first input is
  9949. considered the "main" source and is passed unchanged to the
  9950. output. The second input is used as a "reference" video for computing
  9951. the PSNR.
  9952. Both video inputs must have the same resolution and pixel format for
  9953. this filter to work correctly. Also it assumes that both inputs
  9954. have the same number of frames, which are compared one by one.
  9955. The obtained average PSNR is printed through the logging system.
  9956. The filter stores the accumulated MSE (mean squared error) of each
  9957. frame, and at the end of the processing it is averaged across all frames
  9958. equally, and the following formula is applied to obtain the PSNR:
  9959. @example
  9960. PSNR = 10*log10(MAX^2/MSE)
  9961. @end example
  9962. Where MAX is the average of the maximum values of each component of the
  9963. image.
  9964. The description of the accepted parameters follows.
  9965. @table @option
  9966. @item stats_file, f
  9967. If specified the filter will use the named file to save the PSNR of
  9968. each individual frame. When filename equals "-" the data is sent to
  9969. standard output.
  9970. @item stats_version
  9971. Specifies which version of the stats file format to use. Details of
  9972. each format are written below.
  9973. Default value is 1.
  9974. @item stats_add_max
  9975. Determines whether the max value is output to the stats log.
  9976. Default value is 0.
  9977. Requires stats_version >= 2. If this is set and stats_version < 2,
  9978. the filter will return an error.
  9979. @end table
  9980. This filter also supports the @ref{framesync} options.
  9981. The file printed if @var{stats_file} is selected, contains a sequence of
  9982. key/value pairs of the form @var{key}:@var{value} for each compared
  9983. couple of frames.
  9984. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9985. the list of per-frame-pair stats, with key value pairs following the frame
  9986. format with the following parameters:
  9987. @table @option
  9988. @item psnr_log_version
  9989. The version of the log file format. Will match @var{stats_version}.
  9990. @item fields
  9991. A comma separated list of the per-frame-pair parameters included in
  9992. the log.
  9993. @end table
  9994. A description of each shown per-frame-pair parameter follows:
  9995. @table @option
  9996. @item n
  9997. sequential number of the input frame, starting from 1
  9998. @item mse_avg
  9999. Mean Square Error pixel-by-pixel average difference of the compared
  10000. frames, averaged over all the image components.
  10001. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10002. Mean Square Error pixel-by-pixel average difference of the compared
  10003. frames for the component specified by the suffix.
  10004. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10005. Peak Signal to Noise ratio of the compared frames for the component
  10006. specified by the suffix.
  10007. @item max_avg, max_y, max_u, max_v
  10008. Maximum allowed value for each channel, and average over all
  10009. channels.
  10010. @end table
  10011. For example:
  10012. @example
  10013. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10014. [main][ref] psnr="stats_file=stats.log" [out]
  10015. @end example
  10016. On this example the input file being processed is compared with the
  10017. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10018. is stored in @file{stats.log}.
  10019. @anchor{pullup}
  10020. @section pullup
  10021. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10022. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10023. content.
  10024. The pullup filter is designed to take advantage of future context in making
  10025. its decisions. This filter is stateless in the sense that it does not lock
  10026. onto a pattern to follow, but it instead looks forward to the following
  10027. fields in order to identify matches and rebuild progressive frames.
  10028. To produce content with an even framerate, insert the fps filter after
  10029. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10030. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10031. The filter accepts the following options:
  10032. @table @option
  10033. @item jl
  10034. @item jr
  10035. @item jt
  10036. @item jb
  10037. These options set the amount of "junk" to ignore at the left, right, top, and
  10038. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10039. while top and bottom are in units of 2 lines.
  10040. The default is 8 pixels on each side.
  10041. @item sb
  10042. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10043. filter generating an occasional mismatched frame, but it may also cause an
  10044. excessive number of frames to be dropped during high motion sequences.
  10045. Conversely, setting it to -1 will make filter match fields more easily.
  10046. This may help processing of video where there is slight blurring between
  10047. the fields, but may also cause there to be interlaced frames in the output.
  10048. Default value is @code{0}.
  10049. @item mp
  10050. Set the metric plane to use. It accepts the following values:
  10051. @table @samp
  10052. @item l
  10053. Use luma plane.
  10054. @item u
  10055. Use chroma blue plane.
  10056. @item v
  10057. Use chroma red plane.
  10058. @end table
  10059. This option may be set to use chroma plane instead of the default luma plane
  10060. for doing filter's computations. This may improve accuracy on very clean
  10061. source material, but more likely will decrease accuracy, especially if there
  10062. is chroma noise (rainbow effect) or any grayscale video.
  10063. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10064. load and make pullup usable in realtime on slow machines.
  10065. @end table
  10066. For best results (without duplicated frames in the output file) it is
  10067. necessary to change the output frame rate. For example, to inverse
  10068. telecine NTSC input:
  10069. @example
  10070. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10071. @end example
  10072. @section qp
  10073. Change video quantization parameters (QP).
  10074. The filter accepts the following option:
  10075. @table @option
  10076. @item qp
  10077. Set expression for quantization parameter.
  10078. @end table
  10079. The expression is evaluated through the eval API and can contain, among others,
  10080. the following constants:
  10081. @table @var
  10082. @item known
  10083. 1 if index is not 129, 0 otherwise.
  10084. @item qp
  10085. Sequential index starting from -129 to 128.
  10086. @end table
  10087. @subsection Examples
  10088. @itemize
  10089. @item
  10090. Some equation like:
  10091. @example
  10092. qp=2+2*sin(PI*qp)
  10093. @end example
  10094. @end itemize
  10095. @section random
  10096. Flush video frames from internal cache of frames into a random order.
  10097. No frame is discarded.
  10098. Inspired by @ref{frei0r} nervous filter.
  10099. @table @option
  10100. @item frames
  10101. Set size in number of frames of internal cache, in range from @code{2} to
  10102. @code{512}. Default is @code{30}.
  10103. @item seed
  10104. Set seed for random number generator, must be an integer included between
  10105. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10106. less than @code{0}, the filter will try to use a good random seed on a
  10107. best effort basis.
  10108. @end table
  10109. @section readeia608
  10110. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10111. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10112. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10113. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10114. @table @option
  10115. @item lavfi.readeia608.X.cc
  10116. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10117. @item lavfi.readeia608.X.line
  10118. The number of the line on which the EIA-608 data was identified and read.
  10119. @end table
  10120. This filter accepts the following options:
  10121. @table @option
  10122. @item scan_min
  10123. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10124. @item scan_max
  10125. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10126. @item mac
  10127. Set minimal acceptable amplitude change for sync codes detection.
  10128. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10129. @item spw
  10130. Set the ratio of width reserved for sync code detection.
  10131. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10132. @item mhd
  10133. Set the max peaks height difference for sync code detection.
  10134. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10135. @item mpd
  10136. Set max peaks period difference for sync code detection.
  10137. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10138. @item msd
  10139. Set the first two max start code bits differences.
  10140. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10141. @item bhd
  10142. Set the minimum ratio of bits height compared to 3rd start code bit.
  10143. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10144. @item th_w
  10145. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10146. @item th_b
  10147. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10148. @item chp
  10149. Enable checking the parity bit. In the event of a parity error, the filter will output
  10150. @code{0x00} for that character. Default is false.
  10151. @end table
  10152. @subsection Examples
  10153. @itemize
  10154. @item
  10155. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10156. @example
  10157. 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
  10158. @end example
  10159. @end itemize
  10160. @section readvitc
  10161. Read vertical interval timecode (VITC) information from the top lines of a
  10162. video frame.
  10163. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10164. timecode value, if a valid timecode has been detected. Further metadata key
  10165. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10166. timecode data has been found or not.
  10167. This filter accepts the following options:
  10168. @table @option
  10169. @item scan_max
  10170. Set the maximum number of lines to scan for VITC data. If the value is set to
  10171. @code{-1} the full video frame is scanned. Default is @code{45}.
  10172. @item thr_b
  10173. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10174. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10175. @item thr_w
  10176. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10177. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10178. @end table
  10179. @subsection Examples
  10180. @itemize
  10181. @item
  10182. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10183. draw @code{--:--:--:--} as a placeholder:
  10184. @example
  10185. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10186. @end example
  10187. @end itemize
  10188. @section remap
  10189. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10190. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10191. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10192. value for pixel will be used for destination pixel.
  10193. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10194. will have Xmap/Ymap video stream dimensions.
  10195. Xmap and Ymap input video streams are 16bit depth, single channel.
  10196. @section removegrain
  10197. The removegrain filter is a spatial denoiser for progressive video.
  10198. @table @option
  10199. @item m0
  10200. Set mode for the first plane.
  10201. @item m1
  10202. Set mode for the second plane.
  10203. @item m2
  10204. Set mode for the third plane.
  10205. @item m3
  10206. Set mode for the fourth plane.
  10207. @end table
  10208. Range of mode is from 0 to 24. Description of each mode follows:
  10209. @table @var
  10210. @item 0
  10211. Leave input plane unchanged. Default.
  10212. @item 1
  10213. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10214. @item 2
  10215. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10216. @item 3
  10217. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10218. @item 4
  10219. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10220. This is equivalent to a median filter.
  10221. @item 5
  10222. Line-sensitive clipping giving the minimal change.
  10223. @item 6
  10224. Line-sensitive clipping, intermediate.
  10225. @item 7
  10226. Line-sensitive clipping, intermediate.
  10227. @item 8
  10228. Line-sensitive clipping, intermediate.
  10229. @item 9
  10230. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10231. @item 10
  10232. Replaces the target pixel with the closest neighbour.
  10233. @item 11
  10234. [1 2 1] horizontal and vertical kernel blur.
  10235. @item 12
  10236. Same as mode 11.
  10237. @item 13
  10238. Bob mode, interpolates top field from the line where the neighbours
  10239. pixels are the closest.
  10240. @item 14
  10241. Bob mode, interpolates bottom field from the line where the neighbours
  10242. pixels are the closest.
  10243. @item 15
  10244. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10245. interpolation formula.
  10246. @item 16
  10247. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10248. interpolation formula.
  10249. @item 17
  10250. Clips the pixel with the minimum and maximum of respectively the maximum and
  10251. minimum of each pair of opposite neighbour pixels.
  10252. @item 18
  10253. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10254. the current pixel is minimal.
  10255. @item 19
  10256. Replaces the pixel with the average of its 8 neighbours.
  10257. @item 20
  10258. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10259. @item 21
  10260. Clips pixels using the averages of opposite neighbour.
  10261. @item 22
  10262. Same as mode 21 but simpler and faster.
  10263. @item 23
  10264. Small edge and halo removal, but reputed useless.
  10265. @item 24
  10266. Similar as 23.
  10267. @end table
  10268. @section removelogo
  10269. Suppress a TV station logo, using an image file to determine which
  10270. pixels comprise the logo. It works by filling in the pixels that
  10271. comprise the logo with neighboring pixels.
  10272. The filter accepts the following options:
  10273. @table @option
  10274. @item filename, f
  10275. Set the filter bitmap file, which can be any image format supported by
  10276. libavformat. The width and height of the image file must match those of the
  10277. video stream being processed.
  10278. @end table
  10279. Pixels in the provided bitmap image with a value of zero are not
  10280. considered part of the logo, non-zero pixels are considered part of
  10281. the logo. If you use white (255) for the logo and black (0) for the
  10282. rest, you will be safe. For making the filter bitmap, it is
  10283. recommended to take a screen capture of a black frame with the logo
  10284. visible, and then using a threshold filter followed by the erode
  10285. filter once or twice.
  10286. If needed, little splotches can be fixed manually. Remember that if
  10287. logo pixels are not covered, the filter quality will be much
  10288. reduced. Marking too many pixels as part of the logo does not hurt as
  10289. much, but it will increase the amount of blurring needed to cover over
  10290. the image and will destroy more information than necessary, and extra
  10291. pixels will slow things down on a large logo.
  10292. @section repeatfields
  10293. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10294. fields based on its value.
  10295. @section reverse
  10296. Reverse a video clip.
  10297. Warning: This filter requires memory to buffer the entire clip, so trimming
  10298. is suggested.
  10299. @subsection Examples
  10300. @itemize
  10301. @item
  10302. Take the first 5 seconds of a clip, and reverse it.
  10303. @example
  10304. trim=end=5,reverse
  10305. @end example
  10306. @end itemize
  10307. @section roberts
  10308. Apply roberts cross operator to input video stream.
  10309. The filter accepts the following option:
  10310. @table @option
  10311. @item planes
  10312. Set which planes will be processed, unprocessed planes will be copied.
  10313. By default value 0xf, all planes will be processed.
  10314. @item scale
  10315. Set value which will be multiplied with filtered result.
  10316. @item delta
  10317. Set value which will be added to filtered result.
  10318. @end table
  10319. @section rotate
  10320. Rotate video by an arbitrary angle expressed in radians.
  10321. The filter accepts the following options:
  10322. A description of the optional parameters follows.
  10323. @table @option
  10324. @item angle, a
  10325. Set an expression for the angle by which to rotate the input video
  10326. clockwise, expressed as a number of radians. A negative value will
  10327. result in a counter-clockwise rotation. By default it is set to "0".
  10328. This expression is evaluated for each frame.
  10329. @item out_w, ow
  10330. Set the output width expression, default value is "iw".
  10331. This expression is evaluated just once during configuration.
  10332. @item out_h, oh
  10333. Set the output height expression, default value is "ih".
  10334. This expression is evaluated just once during configuration.
  10335. @item bilinear
  10336. Enable bilinear interpolation if set to 1, a value of 0 disables
  10337. it. Default value is 1.
  10338. @item fillcolor, c
  10339. Set the color used to fill the output area not covered by the rotated
  10340. image. For the general syntax of this option, check the
  10341. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10342. If the special value "none" is selected then no
  10343. background is printed (useful for example if the background is never shown).
  10344. Default value is "black".
  10345. @end table
  10346. The expressions for the angle and the output size can contain the
  10347. following constants and functions:
  10348. @table @option
  10349. @item n
  10350. sequential number of the input frame, starting from 0. It is always NAN
  10351. before the first frame is filtered.
  10352. @item t
  10353. time in seconds of the input frame, it is set to 0 when the filter is
  10354. configured. It is always NAN before the first frame is filtered.
  10355. @item hsub
  10356. @item vsub
  10357. horizontal and vertical chroma subsample values. For example for the
  10358. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10359. @item in_w, iw
  10360. @item in_h, ih
  10361. the input video width and height
  10362. @item out_w, ow
  10363. @item out_h, oh
  10364. the output width and height, that is the size of the padded area as
  10365. specified by the @var{width} and @var{height} expressions
  10366. @item rotw(a)
  10367. @item roth(a)
  10368. the minimal width/height required for completely containing the input
  10369. video rotated by @var{a} radians.
  10370. These are only available when computing the @option{out_w} and
  10371. @option{out_h} expressions.
  10372. @end table
  10373. @subsection Examples
  10374. @itemize
  10375. @item
  10376. Rotate the input by PI/6 radians clockwise:
  10377. @example
  10378. rotate=PI/6
  10379. @end example
  10380. @item
  10381. Rotate the input by PI/6 radians counter-clockwise:
  10382. @example
  10383. rotate=-PI/6
  10384. @end example
  10385. @item
  10386. Rotate the input by 45 degrees clockwise:
  10387. @example
  10388. rotate=45*PI/180
  10389. @end example
  10390. @item
  10391. Apply a constant rotation with period T, starting from an angle of PI/3:
  10392. @example
  10393. rotate=PI/3+2*PI*t/T
  10394. @end example
  10395. @item
  10396. Make the input video rotation oscillating with a period of T
  10397. seconds and an amplitude of A radians:
  10398. @example
  10399. rotate=A*sin(2*PI/T*t)
  10400. @end example
  10401. @item
  10402. Rotate the video, output size is chosen so that the whole rotating
  10403. input video is always completely contained in the output:
  10404. @example
  10405. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10406. @end example
  10407. @item
  10408. Rotate the video, reduce the output size so that no background is ever
  10409. shown:
  10410. @example
  10411. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10412. @end example
  10413. @end itemize
  10414. @subsection Commands
  10415. The filter supports the following commands:
  10416. @table @option
  10417. @item a, angle
  10418. Set the angle expression.
  10419. The command accepts the same syntax of the corresponding option.
  10420. If the specified expression is not valid, it is kept at its current
  10421. value.
  10422. @end table
  10423. @section sab
  10424. Apply Shape Adaptive Blur.
  10425. The filter accepts the following options:
  10426. @table @option
  10427. @item luma_radius, lr
  10428. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10429. value is 1.0. A greater value will result in a more blurred image, and
  10430. in slower processing.
  10431. @item luma_pre_filter_radius, lpfr
  10432. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10433. value is 1.0.
  10434. @item luma_strength, ls
  10435. Set luma maximum difference between pixels to still be considered, must
  10436. be a value in the 0.1-100.0 range, default value is 1.0.
  10437. @item chroma_radius, cr
  10438. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10439. greater value will result in a more blurred image, and in slower
  10440. processing.
  10441. @item chroma_pre_filter_radius, cpfr
  10442. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10443. @item chroma_strength, cs
  10444. Set chroma maximum difference between pixels to still be considered,
  10445. must be a value in the -0.9-100.0 range.
  10446. @end table
  10447. Each chroma option value, if not explicitly specified, is set to the
  10448. corresponding luma option value.
  10449. @anchor{scale}
  10450. @section scale
  10451. Scale (resize) the input video, using the libswscale library.
  10452. The scale filter forces the output display aspect ratio to be the same
  10453. of the input, by changing the output sample aspect ratio.
  10454. If the input image format is different from the format requested by
  10455. the next filter, the scale filter will convert the input to the
  10456. requested format.
  10457. @subsection Options
  10458. The filter accepts the following options, or any of the options
  10459. supported by the libswscale scaler.
  10460. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10461. the complete list of scaler options.
  10462. @table @option
  10463. @item width, w
  10464. @item height, h
  10465. Set the output video dimension expression. Default value is the input
  10466. dimension.
  10467. If the @var{width} or @var{w} value is 0, the input width is used for
  10468. the output. If the @var{height} or @var{h} value is 0, the input height
  10469. is used for the output.
  10470. If one and only one of the values is -n with n >= 1, the scale filter
  10471. will use a value that maintains the aspect ratio of the input image,
  10472. calculated from the other specified dimension. After that it will,
  10473. however, make sure that the calculated dimension is divisible by n and
  10474. adjust the value if necessary.
  10475. If both values are -n with n >= 1, the behavior will be identical to
  10476. both values being set to 0 as previously detailed.
  10477. See below for the list of accepted constants for use in the dimension
  10478. expression.
  10479. @item eval
  10480. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10481. @table @samp
  10482. @item init
  10483. Only evaluate expressions once during the filter initialization or when a command is processed.
  10484. @item frame
  10485. Evaluate expressions for each incoming frame.
  10486. @end table
  10487. Default value is @samp{init}.
  10488. @item interl
  10489. Set the interlacing mode. It accepts the following values:
  10490. @table @samp
  10491. @item 1
  10492. Force interlaced aware scaling.
  10493. @item 0
  10494. Do not apply interlaced scaling.
  10495. @item -1
  10496. Select interlaced aware scaling depending on whether the source frames
  10497. are flagged as interlaced or not.
  10498. @end table
  10499. Default value is @samp{0}.
  10500. @item flags
  10501. Set libswscale scaling flags. See
  10502. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10503. complete list of values. If not explicitly specified the filter applies
  10504. the default flags.
  10505. @item param0, param1
  10506. Set libswscale input parameters for scaling algorithms that need them. See
  10507. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10508. complete documentation. If not explicitly specified the filter applies
  10509. empty parameters.
  10510. @item size, s
  10511. Set the video size. For the syntax of this option, check the
  10512. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10513. @item in_color_matrix
  10514. @item out_color_matrix
  10515. Set in/output YCbCr color space type.
  10516. This allows the autodetected value to be overridden as well as allows forcing
  10517. a specific value used for the output and encoder.
  10518. If not specified, the color space type depends on the pixel format.
  10519. Possible values:
  10520. @table @samp
  10521. @item auto
  10522. Choose automatically.
  10523. @item bt709
  10524. Format conforming to International Telecommunication Union (ITU)
  10525. Recommendation BT.709.
  10526. @item fcc
  10527. Set color space conforming to the United States Federal Communications
  10528. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10529. @item bt601
  10530. Set color space conforming to:
  10531. @itemize
  10532. @item
  10533. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10534. @item
  10535. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10536. @item
  10537. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10538. @end itemize
  10539. @item smpte240m
  10540. Set color space conforming to SMPTE ST 240:1999.
  10541. @end table
  10542. @item in_range
  10543. @item out_range
  10544. Set in/output YCbCr sample range.
  10545. This allows the autodetected value to be overridden as well as allows forcing
  10546. a specific value used for the output and encoder. If not specified, the
  10547. range depends on the pixel format. Possible values:
  10548. @table @samp
  10549. @item auto/unknown
  10550. Choose automatically.
  10551. @item jpeg/full/pc
  10552. Set full range (0-255 in case of 8-bit luma).
  10553. @item mpeg/limited/tv
  10554. Set "MPEG" range (16-235 in case of 8-bit luma).
  10555. @end table
  10556. @item force_original_aspect_ratio
  10557. Enable decreasing or increasing output video width or height if necessary to
  10558. keep the original aspect ratio. Possible values:
  10559. @table @samp
  10560. @item disable
  10561. Scale the video as specified and disable this feature.
  10562. @item decrease
  10563. The output video dimensions will automatically be decreased if needed.
  10564. @item increase
  10565. The output video dimensions will automatically be increased if needed.
  10566. @end table
  10567. One useful instance of this option is that when you know a specific device's
  10568. maximum allowed resolution, you can use this to limit the output video to
  10569. that, while retaining the aspect ratio. For example, device A allows
  10570. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10571. decrease) and specifying 1280x720 to the command line makes the output
  10572. 1280x533.
  10573. Please note that this is a different thing than specifying -1 for @option{w}
  10574. or @option{h}, you still need to specify the output resolution for this option
  10575. to work.
  10576. @end table
  10577. The values of the @option{w} and @option{h} options are expressions
  10578. containing the following constants:
  10579. @table @var
  10580. @item in_w
  10581. @item in_h
  10582. The input width and height
  10583. @item iw
  10584. @item ih
  10585. These are the same as @var{in_w} and @var{in_h}.
  10586. @item out_w
  10587. @item out_h
  10588. The output (scaled) width and height
  10589. @item ow
  10590. @item oh
  10591. These are the same as @var{out_w} and @var{out_h}
  10592. @item a
  10593. The same as @var{iw} / @var{ih}
  10594. @item sar
  10595. input sample aspect ratio
  10596. @item dar
  10597. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10598. @item hsub
  10599. @item vsub
  10600. horizontal and vertical input chroma subsample values. For example for the
  10601. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10602. @item ohsub
  10603. @item ovsub
  10604. horizontal and vertical output chroma subsample values. For example for the
  10605. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10606. @end table
  10607. @subsection Examples
  10608. @itemize
  10609. @item
  10610. Scale the input video to a size of 200x100
  10611. @example
  10612. scale=w=200:h=100
  10613. @end example
  10614. This is equivalent to:
  10615. @example
  10616. scale=200:100
  10617. @end example
  10618. or:
  10619. @example
  10620. scale=200x100
  10621. @end example
  10622. @item
  10623. Specify a size abbreviation for the output size:
  10624. @example
  10625. scale=qcif
  10626. @end example
  10627. which can also be written as:
  10628. @example
  10629. scale=size=qcif
  10630. @end example
  10631. @item
  10632. Scale the input to 2x:
  10633. @example
  10634. scale=w=2*iw:h=2*ih
  10635. @end example
  10636. @item
  10637. The above is the same as:
  10638. @example
  10639. scale=2*in_w:2*in_h
  10640. @end example
  10641. @item
  10642. Scale the input to 2x with forced interlaced scaling:
  10643. @example
  10644. scale=2*iw:2*ih:interl=1
  10645. @end example
  10646. @item
  10647. Scale the input to half size:
  10648. @example
  10649. scale=w=iw/2:h=ih/2
  10650. @end example
  10651. @item
  10652. Increase the width, and set the height to the same size:
  10653. @example
  10654. scale=3/2*iw:ow
  10655. @end example
  10656. @item
  10657. Seek Greek harmony:
  10658. @example
  10659. scale=iw:1/PHI*iw
  10660. scale=ih*PHI:ih
  10661. @end example
  10662. @item
  10663. Increase the height, and set the width to 3/2 of the height:
  10664. @example
  10665. scale=w=3/2*oh:h=3/5*ih
  10666. @end example
  10667. @item
  10668. Increase the size, making the size a multiple of the chroma
  10669. subsample values:
  10670. @example
  10671. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10672. @end example
  10673. @item
  10674. Increase the width to a maximum of 500 pixels,
  10675. keeping the same aspect ratio as the input:
  10676. @example
  10677. scale=w='min(500\, iw*3/2):h=-1'
  10678. @end example
  10679. @item
  10680. Make pixels square by combining scale and setsar:
  10681. @example
  10682. scale='trunc(ih*dar):ih',setsar=1/1
  10683. @end example
  10684. @item
  10685. Make pixels square by combining scale and setsar,
  10686. making sure the resulting resolution is even (required by some codecs):
  10687. @example
  10688. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10689. @end example
  10690. @end itemize
  10691. @subsection Commands
  10692. This filter supports the following commands:
  10693. @table @option
  10694. @item width, w
  10695. @item height, h
  10696. Set the output video dimension expression.
  10697. The command accepts the same syntax of the corresponding option.
  10698. If the specified expression is not valid, it is kept at its current
  10699. value.
  10700. @end table
  10701. @section scale_npp
  10702. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10703. format conversion on CUDA video frames. Setting the output width and height
  10704. works in the same way as for the @var{scale} filter.
  10705. The following additional options are accepted:
  10706. @table @option
  10707. @item format
  10708. The pixel format of the output CUDA frames. If set to the string "same" (the
  10709. default), the input format will be kept. Note that automatic format negotiation
  10710. and conversion is not yet supported for hardware frames
  10711. @item interp_algo
  10712. The interpolation algorithm used for resizing. One of the following:
  10713. @table @option
  10714. @item nn
  10715. Nearest neighbour.
  10716. @item linear
  10717. @item cubic
  10718. @item cubic2p_bspline
  10719. 2-parameter cubic (B=1, C=0)
  10720. @item cubic2p_catmullrom
  10721. 2-parameter cubic (B=0, C=1/2)
  10722. @item cubic2p_b05c03
  10723. 2-parameter cubic (B=1/2, C=3/10)
  10724. @item super
  10725. Supersampling
  10726. @item lanczos
  10727. @end table
  10728. @end table
  10729. @section scale2ref
  10730. Scale (resize) the input video, based on a reference video.
  10731. See the scale filter for available options, scale2ref supports the same but
  10732. uses the reference video instead of the main input as basis. scale2ref also
  10733. supports the following additional constants for the @option{w} and
  10734. @option{h} options:
  10735. @table @var
  10736. @item main_w
  10737. @item main_h
  10738. The main input video's width and height
  10739. @item main_a
  10740. The same as @var{main_w} / @var{main_h}
  10741. @item main_sar
  10742. The main input video's sample aspect ratio
  10743. @item main_dar, mdar
  10744. The main input video's display aspect ratio. Calculated from
  10745. @code{(main_w / main_h) * main_sar}.
  10746. @item main_hsub
  10747. @item main_vsub
  10748. The main input video's horizontal and vertical chroma subsample values.
  10749. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10750. is 1.
  10751. @end table
  10752. @subsection Examples
  10753. @itemize
  10754. @item
  10755. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10756. @example
  10757. 'scale2ref[b][a];[a][b]overlay'
  10758. @end example
  10759. @end itemize
  10760. @anchor{selectivecolor}
  10761. @section selectivecolor
  10762. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10763. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10764. by the "purity" of the color (that is, how saturated it already is).
  10765. This filter is similar to the Adobe Photoshop Selective Color tool.
  10766. The filter accepts the following options:
  10767. @table @option
  10768. @item correction_method
  10769. Select color correction method.
  10770. Available values are:
  10771. @table @samp
  10772. @item absolute
  10773. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10774. component value).
  10775. @item relative
  10776. Specified adjustments are relative to the original component value.
  10777. @end table
  10778. Default is @code{absolute}.
  10779. @item reds
  10780. Adjustments for red pixels (pixels where the red component is the maximum)
  10781. @item yellows
  10782. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10783. @item greens
  10784. Adjustments for green pixels (pixels where the green component is the maximum)
  10785. @item cyans
  10786. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10787. @item blues
  10788. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10789. @item magentas
  10790. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10791. @item whites
  10792. Adjustments for white pixels (pixels where all components are greater than 128)
  10793. @item neutrals
  10794. Adjustments for all pixels except pure black and pure white
  10795. @item blacks
  10796. Adjustments for black pixels (pixels where all components are lesser than 128)
  10797. @item psfile
  10798. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10799. @end table
  10800. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10801. 4 space separated floating point adjustment values in the [-1,1] range,
  10802. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10803. pixels of its range.
  10804. @subsection Examples
  10805. @itemize
  10806. @item
  10807. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10808. increase magenta by 27% in blue areas:
  10809. @example
  10810. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10811. @end example
  10812. @item
  10813. Use a Photoshop selective color preset:
  10814. @example
  10815. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10816. @end example
  10817. @end itemize
  10818. @anchor{separatefields}
  10819. @section separatefields
  10820. The @code{separatefields} takes a frame-based video input and splits
  10821. each frame into its components fields, producing a new half height clip
  10822. with twice the frame rate and twice the frame count.
  10823. This filter use field-dominance information in frame to decide which
  10824. of each pair of fields to place first in the output.
  10825. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10826. @section setdar, setsar
  10827. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10828. output video.
  10829. This is done by changing the specified Sample (aka Pixel) Aspect
  10830. Ratio, according to the following equation:
  10831. @example
  10832. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10833. @end example
  10834. Keep in mind that the @code{setdar} filter does not modify the pixel
  10835. dimensions of the video frame. Also, the display aspect ratio set by
  10836. this filter may be changed by later filters in the filterchain,
  10837. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10838. applied.
  10839. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10840. the filter output video.
  10841. Note that as a consequence of the application of this filter, the
  10842. output display aspect ratio will change according to the equation
  10843. above.
  10844. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10845. filter may be changed by later filters in the filterchain, e.g. if
  10846. another "setsar" or a "setdar" filter is applied.
  10847. It accepts the following parameters:
  10848. @table @option
  10849. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10850. Set the aspect ratio used by the filter.
  10851. The parameter can be a floating point number string, an expression, or
  10852. a string of the form @var{num}:@var{den}, where @var{num} and
  10853. @var{den} are the numerator and denominator of the aspect ratio. If
  10854. the parameter is not specified, it is assumed the value "0".
  10855. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10856. should be escaped.
  10857. @item max
  10858. Set the maximum integer value to use for expressing numerator and
  10859. denominator when reducing the expressed aspect ratio to a rational.
  10860. Default value is @code{100}.
  10861. @end table
  10862. The parameter @var{sar} is an expression containing
  10863. the following constants:
  10864. @table @option
  10865. @item E, PI, PHI
  10866. These are approximated values for the mathematical constants e
  10867. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10868. @item w, h
  10869. The input width and height.
  10870. @item a
  10871. These are the same as @var{w} / @var{h}.
  10872. @item sar
  10873. The input sample aspect ratio.
  10874. @item dar
  10875. The input display aspect ratio. It is the same as
  10876. (@var{w} / @var{h}) * @var{sar}.
  10877. @item hsub, vsub
  10878. Horizontal and vertical chroma subsample values. For example, for the
  10879. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10880. @end table
  10881. @subsection Examples
  10882. @itemize
  10883. @item
  10884. To change the display aspect ratio to 16:9, specify one of the following:
  10885. @example
  10886. setdar=dar=1.77777
  10887. setdar=dar=16/9
  10888. @end example
  10889. @item
  10890. To change the sample aspect ratio to 10:11, specify:
  10891. @example
  10892. setsar=sar=10/11
  10893. @end example
  10894. @item
  10895. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10896. 1000 in the aspect ratio reduction, use the command:
  10897. @example
  10898. setdar=ratio=16/9:max=1000
  10899. @end example
  10900. @end itemize
  10901. @anchor{setfield}
  10902. @section setfield
  10903. Force field for the output video frame.
  10904. The @code{setfield} filter marks the interlace type field for the
  10905. output frames. It does not change the input frame, but only sets the
  10906. corresponding property, which affects how the frame is treated by
  10907. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10908. The filter accepts the following options:
  10909. @table @option
  10910. @item mode
  10911. Available values are:
  10912. @table @samp
  10913. @item auto
  10914. Keep the same field property.
  10915. @item bff
  10916. Mark the frame as bottom-field-first.
  10917. @item tff
  10918. Mark the frame as top-field-first.
  10919. @item prog
  10920. Mark the frame as progressive.
  10921. @end table
  10922. @end table
  10923. @section showinfo
  10924. Show a line containing various information for each input video frame.
  10925. The input video is not modified.
  10926. The shown line contains a sequence of key/value pairs of the form
  10927. @var{key}:@var{value}.
  10928. The following values are shown in the output:
  10929. @table @option
  10930. @item n
  10931. The (sequential) number of the input frame, starting from 0.
  10932. @item pts
  10933. The Presentation TimeStamp of the input frame, expressed as a number of
  10934. time base units. The time base unit depends on the filter input pad.
  10935. @item pts_time
  10936. The Presentation TimeStamp of the input frame, expressed as a number of
  10937. seconds.
  10938. @item pos
  10939. The position of the frame in the input stream, or -1 if this information is
  10940. unavailable and/or meaningless (for example in case of synthetic video).
  10941. @item fmt
  10942. The pixel format name.
  10943. @item sar
  10944. The sample aspect ratio of the input frame, expressed in the form
  10945. @var{num}/@var{den}.
  10946. @item s
  10947. The size of the input frame. For the syntax of this option, check the
  10948. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10949. @item i
  10950. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10951. for bottom field first).
  10952. @item iskey
  10953. This is 1 if the frame is a key frame, 0 otherwise.
  10954. @item type
  10955. The picture type of the input frame ("I" for an I-frame, "P" for a
  10956. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10957. Also refer to the documentation of the @code{AVPictureType} enum and of
  10958. the @code{av_get_picture_type_char} function defined in
  10959. @file{libavutil/avutil.h}.
  10960. @item checksum
  10961. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10962. @item plane_checksum
  10963. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10964. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10965. @end table
  10966. @section showpalette
  10967. Displays the 256 colors palette of each frame. This filter is only relevant for
  10968. @var{pal8} pixel format frames.
  10969. It accepts the following option:
  10970. @table @option
  10971. @item s
  10972. Set the size of the box used to represent one palette color entry. Default is
  10973. @code{30} (for a @code{30x30} pixel box).
  10974. @end table
  10975. @section shuffleframes
  10976. Reorder and/or duplicate and/or drop video frames.
  10977. It accepts the following parameters:
  10978. @table @option
  10979. @item mapping
  10980. Set the destination indexes of input frames.
  10981. This is space or '|' separated list of indexes that maps input frames to output
  10982. frames. Number of indexes also sets maximal value that each index may have.
  10983. '-1' index have special meaning and that is to drop frame.
  10984. @end table
  10985. The first frame has the index 0. The default is to keep the input unchanged.
  10986. @subsection Examples
  10987. @itemize
  10988. @item
  10989. Swap second and third frame of every three frames of the input:
  10990. @example
  10991. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10992. @end example
  10993. @item
  10994. Swap 10th and 1st frame of every ten frames of the input:
  10995. @example
  10996. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10997. @end example
  10998. @end itemize
  10999. @section shuffleplanes
  11000. Reorder and/or duplicate video planes.
  11001. It accepts the following parameters:
  11002. @table @option
  11003. @item map0
  11004. The index of the input plane to be used as the first output plane.
  11005. @item map1
  11006. The index of the input plane to be used as the second output plane.
  11007. @item map2
  11008. The index of the input plane to be used as the third output plane.
  11009. @item map3
  11010. The index of the input plane to be used as the fourth output plane.
  11011. @end table
  11012. The first plane has the index 0. The default is to keep the input unchanged.
  11013. @subsection Examples
  11014. @itemize
  11015. @item
  11016. Swap the second and third planes of the input:
  11017. @example
  11018. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11019. @end example
  11020. @end itemize
  11021. @anchor{signalstats}
  11022. @section signalstats
  11023. Evaluate various visual metrics that assist in determining issues associated
  11024. with the digitization of analog video media.
  11025. By default the filter will log these metadata values:
  11026. @table @option
  11027. @item YMIN
  11028. Display the minimal Y value contained within the input frame. Expressed in
  11029. range of [0-255].
  11030. @item YLOW
  11031. Display the Y value at the 10% percentile within the input frame. Expressed in
  11032. range of [0-255].
  11033. @item YAVG
  11034. Display the average Y value within the input frame. Expressed in range of
  11035. [0-255].
  11036. @item YHIGH
  11037. Display the Y value at the 90% percentile within the input frame. Expressed in
  11038. range of [0-255].
  11039. @item YMAX
  11040. Display the maximum Y value contained within the input frame. Expressed in
  11041. range of [0-255].
  11042. @item UMIN
  11043. Display the minimal U value contained within the input frame. Expressed in
  11044. range of [0-255].
  11045. @item ULOW
  11046. Display the U value at the 10% percentile within the input frame. Expressed in
  11047. range of [0-255].
  11048. @item UAVG
  11049. Display the average U value within the input frame. Expressed in range of
  11050. [0-255].
  11051. @item UHIGH
  11052. Display the U value at the 90% percentile within the input frame. Expressed in
  11053. range of [0-255].
  11054. @item UMAX
  11055. Display the maximum U value contained within the input frame. Expressed in
  11056. range of [0-255].
  11057. @item VMIN
  11058. Display the minimal V value contained within the input frame. Expressed in
  11059. range of [0-255].
  11060. @item VLOW
  11061. Display the V value at the 10% percentile within the input frame. Expressed in
  11062. range of [0-255].
  11063. @item VAVG
  11064. Display the average V value within the input frame. Expressed in range of
  11065. [0-255].
  11066. @item VHIGH
  11067. Display the V value at the 90% percentile within the input frame. Expressed in
  11068. range of [0-255].
  11069. @item VMAX
  11070. Display the maximum V value contained within the input frame. Expressed in
  11071. range of [0-255].
  11072. @item SATMIN
  11073. Display the minimal saturation value contained within the input frame.
  11074. Expressed in range of [0-~181.02].
  11075. @item SATLOW
  11076. Display the saturation value at the 10% percentile within the input frame.
  11077. Expressed in range of [0-~181.02].
  11078. @item SATAVG
  11079. Display the average saturation value within the input frame. Expressed in range
  11080. of [0-~181.02].
  11081. @item SATHIGH
  11082. Display the saturation value at the 90% percentile within the input frame.
  11083. Expressed in range of [0-~181.02].
  11084. @item SATMAX
  11085. Display the maximum saturation value contained within the input frame.
  11086. Expressed in range of [0-~181.02].
  11087. @item HUEMED
  11088. Display the median value for hue within the input frame. Expressed in range of
  11089. [0-360].
  11090. @item HUEAVG
  11091. Display the average value for hue within the input frame. Expressed in range of
  11092. [0-360].
  11093. @item YDIF
  11094. Display the average of sample value difference between all values of the Y
  11095. plane in the current frame and corresponding values of the previous input frame.
  11096. Expressed in range of [0-255].
  11097. @item UDIF
  11098. Display the average of sample value difference between all values of the U
  11099. plane in the current frame and corresponding values of the previous input frame.
  11100. Expressed in range of [0-255].
  11101. @item VDIF
  11102. Display the average of sample value difference between all values of the V
  11103. plane in the current frame and corresponding values of the previous input frame.
  11104. Expressed in range of [0-255].
  11105. @item YBITDEPTH
  11106. Display bit depth of Y plane in current frame.
  11107. Expressed in range of [0-16].
  11108. @item UBITDEPTH
  11109. Display bit depth of U plane in current frame.
  11110. Expressed in range of [0-16].
  11111. @item VBITDEPTH
  11112. Display bit depth of V plane in current frame.
  11113. Expressed in range of [0-16].
  11114. @end table
  11115. The filter accepts the following options:
  11116. @table @option
  11117. @item stat
  11118. @item out
  11119. @option{stat} specify an additional form of image analysis.
  11120. @option{out} output video with the specified type of pixel highlighted.
  11121. Both options accept the following values:
  11122. @table @samp
  11123. @item tout
  11124. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11125. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11126. include the results of video dropouts, head clogs, or tape tracking issues.
  11127. @item vrep
  11128. Identify @var{vertical line repetition}. Vertical line repetition includes
  11129. similar rows of pixels within a frame. In born-digital video vertical line
  11130. repetition is common, but this pattern is uncommon in video digitized from an
  11131. analog source. When it occurs in video that results from the digitization of an
  11132. analog source it can indicate concealment from a dropout compensator.
  11133. @item brng
  11134. Identify pixels that fall outside of legal broadcast range.
  11135. @end table
  11136. @item color, c
  11137. Set the highlight color for the @option{out} option. The default color is
  11138. yellow.
  11139. @end table
  11140. @subsection Examples
  11141. @itemize
  11142. @item
  11143. Output data of various video metrics:
  11144. @example
  11145. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11146. @end example
  11147. @item
  11148. Output specific data about the minimum and maximum values of the Y plane per frame:
  11149. @example
  11150. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11151. @end example
  11152. @item
  11153. Playback video while highlighting pixels that are outside of broadcast range in red.
  11154. @example
  11155. ffplay example.mov -vf signalstats="out=brng:color=red"
  11156. @end example
  11157. @item
  11158. Playback video with signalstats metadata drawn over the frame.
  11159. @example
  11160. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11161. @end example
  11162. The contents of signalstat_drawtext.txt used in the command are:
  11163. @example
  11164. time %@{pts:hms@}
  11165. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11166. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11167. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11168. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11169. @end example
  11170. @end itemize
  11171. @anchor{signature}
  11172. @section signature
  11173. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11174. input. In this case the matching between the inputs can be calculated additionally.
  11175. The filter always passes through the first input. The signature of each stream can
  11176. be written into a file.
  11177. It accepts the following options:
  11178. @table @option
  11179. @item detectmode
  11180. Enable or disable the matching process.
  11181. Available values are:
  11182. @table @samp
  11183. @item off
  11184. Disable the calculation of a matching (default).
  11185. @item full
  11186. Calculate the matching for the whole video and output whether the whole video
  11187. matches or only parts.
  11188. @item fast
  11189. Calculate only until a matching is found or the video ends. Should be faster in
  11190. some cases.
  11191. @end table
  11192. @item nb_inputs
  11193. Set the number of inputs. The option value must be a non negative integer.
  11194. Default value is 1.
  11195. @item filename
  11196. Set the path to which the output is written. If there is more than one input,
  11197. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11198. integer), that will be replaced with the input number. If no filename is
  11199. specified, no output will be written. This is the default.
  11200. @item format
  11201. Choose the output format.
  11202. Available values are:
  11203. @table @samp
  11204. @item binary
  11205. Use the specified binary representation (default).
  11206. @item xml
  11207. Use the specified xml representation.
  11208. @end table
  11209. @item th_d
  11210. Set threshold to detect one word as similar. The option value must be an integer
  11211. greater than zero. The default value is 9000.
  11212. @item th_dc
  11213. Set threshold to detect all words as similar. The option value must be an integer
  11214. greater than zero. The default value is 60000.
  11215. @item th_xh
  11216. Set threshold to detect frames as similar. The option value must be an integer
  11217. greater than zero. The default value is 116.
  11218. @item th_di
  11219. Set the minimum length of a sequence in frames to recognize it as matching
  11220. sequence. The option value must be a non negative integer value.
  11221. The default value is 0.
  11222. @item th_it
  11223. Set the minimum relation, that matching frames to all frames must have.
  11224. The option value must be a double value between 0 and 1. The default value is 0.5.
  11225. @end table
  11226. @subsection Examples
  11227. @itemize
  11228. @item
  11229. To calculate the signature of an input video and store it in signature.bin:
  11230. @example
  11231. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11232. @end example
  11233. @item
  11234. To detect whether two videos match and store the signatures in XML format in
  11235. signature0.xml and signature1.xml:
  11236. @example
  11237. 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 -
  11238. @end example
  11239. @end itemize
  11240. @anchor{smartblur}
  11241. @section smartblur
  11242. Blur the input video without impacting the outlines.
  11243. It accepts the following options:
  11244. @table @option
  11245. @item luma_radius, lr
  11246. Set the luma radius. The option value must be a float number in
  11247. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11248. used to blur the image (slower if larger). Default value is 1.0.
  11249. @item luma_strength, ls
  11250. Set the luma strength. The option value must be a float number
  11251. in the range [-1.0,1.0] that configures the blurring. A value included
  11252. in [0.0,1.0] will blur the image whereas a value included in
  11253. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11254. @item luma_threshold, lt
  11255. Set the luma threshold used as a coefficient to determine
  11256. whether a pixel should be blurred or not. The option value must be an
  11257. integer in the range [-30,30]. A value of 0 will filter all the image,
  11258. a value included in [0,30] will filter flat areas and a value included
  11259. in [-30,0] will filter edges. Default value is 0.
  11260. @item chroma_radius, cr
  11261. Set the chroma radius. The option value must be a float number in
  11262. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11263. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11264. @item chroma_strength, cs
  11265. Set the chroma strength. The option value must be a float number
  11266. in the range [-1.0,1.0] that configures the blurring. A value included
  11267. in [0.0,1.0] will blur the image whereas a value included in
  11268. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11269. @item chroma_threshold, ct
  11270. Set the chroma threshold used as a coefficient to determine
  11271. whether a pixel should be blurred or not. The option value must be an
  11272. integer in the range [-30,30]. A value of 0 will filter all the image,
  11273. a value included in [0,30] will filter flat areas and a value included
  11274. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11275. @end table
  11276. If a chroma option is not explicitly set, the corresponding luma value
  11277. is set.
  11278. @section ssim
  11279. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11280. This filter takes in input two input videos, the first input is
  11281. considered the "main" source and is passed unchanged to the
  11282. output. The second input is used as a "reference" video for computing
  11283. the SSIM.
  11284. Both video inputs must have the same resolution and pixel format for
  11285. this filter to work correctly. Also it assumes that both inputs
  11286. have the same number of frames, which are compared one by one.
  11287. The filter stores the calculated SSIM of each frame.
  11288. The description of the accepted parameters follows.
  11289. @table @option
  11290. @item stats_file, f
  11291. If specified the filter will use the named file to save the SSIM of
  11292. each individual frame. When filename equals "-" the data is sent to
  11293. standard output.
  11294. @end table
  11295. The file printed if @var{stats_file} is selected, contains a sequence of
  11296. key/value pairs of the form @var{key}:@var{value} for each compared
  11297. couple of frames.
  11298. A description of each shown parameter follows:
  11299. @table @option
  11300. @item n
  11301. sequential number of the input frame, starting from 1
  11302. @item Y, U, V, R, G, B
  11303. SSIM of the compared frames for the component specified by the suffix.
  11304. @item All
  11305. SSIM of the compared frames for the whole frame.
  11306. @item dB
  11307. Same as above but in dB representation.
  11308. @end table
  11309. This filter also supports the @ref{framesync} options.
  11310. For example:
  11311. @example
  11312. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11313. [main][ref] ssim="stats_file=stats.log" [out]
  11314. @end example
  11315. On this example the input file being processed is compared with the
  11316. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11317. is stored in @file{stats.log}.
  11318. Another example with both psnr and ssim at same time:
  11319. @example
  11320. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11321. @end example
  11322. @section stereo3d
  11323. Convert between different stereoscopic image formats.
  11324. The filters accept the following options:
  11325. @table @option
  11326. @item in
  11327. Set stereoscopic image format of input.
  11328. Available values for input image formats are:
  11329. @table @samp
  11330. @item sbsl
  11331. side by side parallel (left eye left, right eye right)
  11332. @item sbsr
  11333. side by side crosseye (right eye left, left eye right)
  11334. @item sbs2l
  11335. side by side parallel with half width resolution
  11336. (left eye left, right eye right)
  11337. @item sbs2r
  11338. side by side crosseye with half width resolution
  11339. (right eye left, left eye right)
  11340. @item abl
  11341. above-below (left eye above, right eye below)
  11342. @item abr
  11343. above-below (right eye above, left eye below)
  11344. @item ab2l
  11345. above-below with half height resolution
  11346. (left eye above, right eye below)
  11347. @item ab2r
  11348. above-below with half height resolution
  11349. (right eye above, left eye below)
  11350. @item al
  11351. alternating frames (left eye first, right eye second)
  11352. @item ar
  11353. alternating frames (right eye first, left eye second)
  11354. @item irl
  11355. interleaved rows (left eye has top row, right eye starts on next row)
  11356. @item irr
  11357. interleaved rows (right eye has top row, left eye starts on next row)
  11358. @item icl
  11359. interleaved columns, left eye first
  11360. @item icr
  11361. interleaved columns, right eye first
  11362. Default value is @samp{sbsl}.
  11363. @end table
  11364. @item out
  11365. Set stereoscopic image format of output.
  11366. @table @samp
  11367. @item sbsl
  11368. side by side parallel (left eye left, right eye right)
  11369. @item sbsr
  11370. side by side crosseye (right eye left, left eye right)
  11371. @item sbs2l
  11372. side by side parallel with half width resolution
  11373. (left eye left, right eye right)
  11374. @item sbs2r
  11375. side by side crosseye with half width resolution
  11376. (right eye left, left eye right)
  11377. @item abl
  11378. above-below (left eye above, right eye below)
  11379. @item abr
  11380. above-below (right eye above, left eye below)
  11381. @item ab2l
  11382. above-below with half height resolution
  11383. (left eye above, right eye below)
  11384. @item ab2r
  11385. above-below with half height resolution
  11386. (right eye above, left eye below)
  11387. @item al
  11388. alternating frames (left eye first, right eye second)
  11389. @item ar
  11390. alternating frames (right eye first, left eye second)
  11391. @item irl
  11392. interleaved rows (left eye has top row, right eye starts on next row)
  11393. @item irr
  11394. interleaved rows (right eye has top row, left eye starts on next row)
  11395. @item arbg
  11396. anaglyph red/blue gray
  11397. (red filter on left eye, blue filter on right eye)
  11398. @item argg
  11399. anaglyph red/green gray
  11400. (red filter on left eye, green filter on right eye)
  11401. @item arcg
  11402. anaglyph red/cyan gray
  11403. (red filter on left eye, cyan filter on right eye)
  11404. @item arch
  11405. anaglyph red/cyan half colored
  11406. (red filter on left eye, cyan filter on right eye)
  11407. @item arcc
  11408. anaglyph red/cyan color
  11409. (red filter on left eye, cyan filter on right eye)
  11410. @item arcd
  11411. anaglyph red/cyan color optimized with the least squares projection of dubois
  11412. (red filter on left eye, cyan filter on right eye)
  11413. @item agmg
  11414. anaglyph green/magenta gray
  11415. (green filter on left eye, magenta filter on right eye)
  11416. @item agmh
  11417. anaglyph green/magenta half colored
  11418. (green filter on left eye, magenta filter on right eye)
  11419. @item agmc
  11420. anaglyph green/magenta colored
  11421. (green filter on left eye, magenta filter on right eye)
  11422. @item agmd
  11423. anaglyph green/magenta color optimized with the least squares projection of dubois
  11424. (green filter on left eye, magenta filter on right eye)
  11425. @item aybg
  11426. anaglyph yellow/blue gray
  11427. (yellow filter on left eye, blue filter on right eye)
  11428. @item aybh
  11429. anaglyph yellow/blue half colored
  11430. (yellow filter on left eye, blue filter on right eye)
  11431. @item aybc
  11432. anaglyph yellow/blue colored
  11433. (yellow filter on left eye, blue filter on right eye)
  11434. @item aybd
  11435. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11436. (yellow filter on left eye, blue filter on right eye)
  11437. @item ml
  11438. mono output (left eye only)
  11439. @item mr
  11440. mono output (right eye only)
  11441. @item chl
  11442. checkerboard, left eye first
  11443. @item chr
  11444. checkerboard, right eye first
  11445. @item icl
  11446. interleaved columns, left eye first
  11447. @item icr
  11448. interleaved columns, right eye first
  11449. @item hdmi
  11450. HDMI frame pack
  11451. @end table
  11452. Default value is @samp{arcd}.
  11453. @end table
  11454. @subsection Examples
  11455. @itemize
  11456. @item
  11457. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11458. @example
  11459. stereo3d=sbsl:aybd
  11460. @end example
  11461. @item
  11462. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11463. @example
  11464. stereo3d=abl:sbsr
  11465. @end example
  11466. @end itemize
  11467. @section streamselect, astreamselect
  11468. Select video or audio streams.
  11469. The filter accepts the following options:
  11470. @table @option
  11471. @item inputs
  11472. Set number of inputs. Default is 2.
  11473. @item map
  11474. Set input indexes to remap to outputs.
  11475. @end table
  11476. @subsection Commands
  11477. The @code{streamselect} and @code{astreamselect} filter supports the following
  11478. commands:
  11479. @table @option
  11480. @item map
  11481. Set input indexes to remap to outputs.
  11482. @end table
  11483. @subsection Examples
  11484. @itemize
  11485. @item
  11486. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11487. @example
  11488. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11489. @end example
  11490. @item
  11491. Same as above, but for audio:
  11492. @example
  11493. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11494. @end example
  11495. @end itemize
  11496. @section sobel
  11497. Apply sobel operator to input video stream.
  11498. The filter accepts the following option:
  11499. @table @option
  11500. @item planes
  11501. Set which planes will be processed, unprocessed planes will be copied.
  11502. By default value 0xf, all planes will be processed.
  11503. @item scale
  11504. Set value which will be multiplied with filtered result.
  11505. @item delta
  11506. Set value which will be added to filtered result.
  11507. @end table
  11508. @anchor{spp}
  11509. @section spp
  11510. Apply a simple postprocessing filter that compresses and decompresses the image
  11511. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11512. and average the results.
  11513. The filter accepts the following options:
  11514. @table @option
  11515. @item quality
  11516. Set quality. This option defines the number of levels for averaging. It accepts
  11517. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11518. effect. A value of @code{6} means the higher quality. For each increment of
  11519. that value the speed drops by a factor of approximately 2. Default value is
  11520. @code{3}.
  11521. @item qp
  11522. Force a constant quantization parameter. If not set, the filter will use the QP
  11523. from the video stream (if available).
  11524. @item mode
  11525. Set thresholding mode. Available modes are:
  11526. @table @samp
  11527. @item hard
  11528. Set hard thresholding (default).
  11529. @item soft
  11530. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11531. @end table
  11532. @item use_bframe_qp
  11533. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11534. option may cause flicker since the B-Frames have often larger QP. Default is
  11535. @code{0} (not enabled).
  11536. @end table
  11537. @anchor{subtitles}
  11538. @section subtitles
  11539. Draw subtitles on top of input video using the libass library.
  11540. To enable compilation of this filter you need to configure FFmpeg with
  11541. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11542. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11543. Alpha) subtitles format.
  11544. The filter accepts the following options:
  11545. @table @option
  11546. @item filename, f
  11547. Set the filename of the subtitle file to read. It must be specified.
  11548. @item original_size
  11549. Specify the size of the original video, the video for which the ASS file
  11550. was composed. For the syntax of this option, check the
  11551. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11552. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11553. correctly scale the fonts if the aspect ratio has been changed.
  11554. @item fontsdir
  11555. Set a directory path containing fonts that can be used by the filter.
  11556. These fonts will be used in addition to whatever the font provider uses.
  11557. @item alpha
  11558. Process alpha channel, by default alpha channel is untouched.
  11559. @item charenc
  11560. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11561. useful if not UTF-8.
  11562. @item stream_index, si
  11563. Set subtitles stream index. @code{subtitles} filter only.
  11564. @item force_style
  11565. Override default style or script info parameters of the subtitles. It accepts a
  11566. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11567. @end table
  11568. If the first key is not specified, it is assumed that the first value
  11569. specifies the @option{filename}.
  11570. For example, to render the file @file{sub.srt} on top of the input
  11571. video, use the command:
  11572. @example
  11573. subtitles=sub.srt
  11574. @end example
  11575. which is equivalent to:
  11576. @example
  11577. subtitles=filename=sub.srt
  11578. @end example
  11579. To render the default subtitles stream from file @file{video.mkv}, use:
  11580. @example
  11581. subtitles=video.mkv
  11582. @end example
  11583. To render the second subtitles stream from that file, use:
  11584. @example
  11585. subtitles=video.mkv:si=1
  11586. @end example
  11587. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11588. @code{DejaVu Serif}, use:
  11589. @example
  11590. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11591. @end example
  11592. @section super2xsai
  11593. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11594. Interpolate) pixel art scaling algorithm.
  11595. Useful for enlarging pixel art images without reducing sharpness.
  11596. @section swaprect
  11597. Swap two rectangular objects in video.
  11598. This filter accepts the following options:
  11599. @table @option
  11600. @item w
  11601. Set object width.
  11602. @item h
  11603. Set object height.
  11604. @item x1
  11605. Set 1st rect x coordinate.
  11606. @item y1
  11607. Set 1st rect y coordinate.
  11608. @item x2
  11609. Set 2nd rect x coordinate.
  11610. @item y2
  11611. Set 2nd rect y coordinate.
  11612. All expressions are evaluated once for each frame.
  11613. @end table
  11614. The all options are expressions containing the following constants:
  11615. @table @option
  11616. @item w
  11617. @item h
  11618. The input width and height.
  11619. @item a
  11620. same as @var{w} / @var{h}
  11621. @item sar
  11622. input sample aspect ratio
  11623. @item dar
  11624. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11625. @item n
  11626. The number of the input frame, starting from 0.
  11627. @item t
  11628. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11629. @item pos
  11630. the position in the file of the input frame, NAN if unknown
  11631. @end table
  11632. @section swapuv
  11633. Swap U & V plane.
  11634. @section telecine
  11635. Apply telecine process to the video.
  11636. This filter accepts the following options:
  11637. @table @option
  11638. @item first_field
  11639. @table @samp
  11640. @item top, t
  11641. top field first
  11642. @item bottom, b
  11643. bottom field first
  11644. The default value is @code{top}.
  11645. @end table
  11646. @item pattern
  11647. A string of numbers representing the pulldown pattern you wish to apply.
  11648. The default value is @code{23}.
  11649. @end table
  11650. @example
  11651. Some typical patterns:
  11652. NTSC output (30i):
  11653. 27.5p: 32222
  11654. 24p: 23 (classic)
  11655. 24p: 2332 (preferred)
  11656. 20p: 33
  11657. 18p: 334
  11658. 16p: 3444
  11659. PAL output (25i):
  11660. 27.5p: 12222
  11661. 24p: 222222222223 ("Euro pulldown")
  11662. 16.67p: 33
  11663. 16p: 33333334
  11664. @end example
  11665. @section threshold
  11666. Apply threshold effect to video stream.
  11667. This filter needs four video streams to perform thresholding.
  11668. First stream is stream we are filtering.
  11669. Second stream is holding threshold values, third stream is holding min values,
  11670. and last, fourth stream is holding max values.
  11671. The filter accepts the following option:
  11672. @table @option
  11673. @item planes
  11674. Set which planes will be processed, unprocessed planes will be copied.
  11675. By default value 0xf, all planes will be processed.
  11676. @end table
  11677. For example if first stream pixel's component value is less then threshold value
  11678. of pixel component from 2nd threshold stream, third stream value will picked,
  11679. otherwise fourth stream pixel component value will be picked.
  11680. Using color source filter one can perform various types of thresholding:
  11681. @subsection Examples
  11682. @itemize
  11683. @item
  11684. Binary threshold, using gray color as threshold:
  11685. @example
  11686. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11687. @end example
  11688. @item
  11689. Inverted binary threshold, using gray color as threshold:
  11690. @example
  11691. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11692. @end example
  11693. @item
  11694. Truncate binary threshold, using gray color as threshold:
  11695. @example
  11696. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11697. @end example
  11698. @item
  11699. Threshold to zero, using gray color as threshold:
  11700. @example
  11701. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11702. @end example
  11703. @item
  11704. Inverted threshold to zero, using gray color as threshold:
  11705. @example
  11706. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11707. @end example
  11708. @end itemize
  11709. @section thumbnail
  11710. Select the most representative frame in a given sequence of consecutive frames.
  11711. The filter accepts the following options:
  11712. @table @option
  11713. @item n
  11714. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11715. will pick one of them, and then handle the next batch of @var{n} frames until
  11716. the end. Default is @code{100}.
  11717. @end table
  11718. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11719. value will result in a higher memory usage, so a high value is not recommended.
  11720. @subsection Examples
  11721. @itemize
  11722. @item
  11723. Extract one picture each 50 frames:
  11724. @example
  11725. thumbnail=50
  11726. @end example
  11727. @item
  11728. Complete example of a thumbnail creation with @command{ffmpeg}:
  11729. @example
  11730. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11731. @end example
  11732. @end itemize
  11733. @section tile
  11734. Tile several successive frames together.
  11735. The filter accepts the following options:
  11736. @table @option
  11737. @item layout
  11738. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11739. this option, check the
  11740. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11741. @item nb_frames
  11742. Set the maximum number of frames to render in the given area. It must be less
  11743. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11744. the area will be used.
  11745. @item margin
  11746. Set the outer border margin in pixels.
  11747. @item padding
  11748. Set the inner border thickness (i.e. the number of pixels between frames). For
  11749. more advanced padding options (such as having different values for the edges),
  11750. refer to the pad video filter.
  11751. @item color
  11752. Specify the color of the unused area. For the syntax of this option, check the
  11753. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11754. The default value of @var{color} is "black".
  11755. @item overlap
  11756. Set the number of frames to overlap when tiling several successive frames together.
  11757. The value must be between @code{0} and @var{nb_frames - 1}.
  11758. @item init_padding
  11759. Set the number of frames to initially be empty before displaying first output frame.
  11760. This controls how soon will one get first output frame.
  11761. The value must be between @code{0} and @var{nb_frames - 1}.
  11762. @end table
  11763. @subsection Examples
  11764. @itemize
  11765. @item
  11766. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11767. @example
  11768. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11769. @end example
  11770. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11771. duplicating each output frame to accommodate the originally detected frame
  11772. rate.
  11773. @item
  11774. Display @code{5} pictures in an area of @code{3x2} frames,
  11775. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11776. mixed flat and named options:
  11777. @example
  11778. tile=3x2:nb_frames=5:padding=7:margin=2
  11779. @end example
  11780. @end itemize
  11781. @section tinterlace
  11782. Perform various types of temporal field interlacing.
  11783. Frames are counted starting from 1, so the first input frame is
  11784. considered odd.
  11785. The filter accepts the following options:
  11786. @table @option
  11787. @item mode
  11788. Specify the mode of the interlacing. This option can also be specified
  11789. as a value alone. See below for a list of values for this option.
  11790. Available values are:
  11791. @table @samp
  11792. @item merge, 0
  11793. Move odd frames into the upper field, even into the lower field,
  11794. generating a double height frame at half frame rate.
  11795. @example
  11796. ------> time
  11797. Input:
  11798. Frame 1 Frame 2 Frame 3 Frame 4
  11799. 11111 22222 33333 44444
  11800. 11111 22222 33333 44444
  11801. 11111 22222 33333 44444
  11802. 11111 22222 33333 44444
  11803. Output:
  11804. 11111 33333
  11805. 22222 44444
  11806. 11111 33333
  11807. 22222 44444
  11808. 11111 33333
  11809. 22222 44444
  11810. 11111 33333
  11811. 22222 44444
  11812. @end example
  11813. @item drop_even, 1
  11814. Only output odd frames, even frames are dropped, generating a frame with
  11815. unchanged height at half frame rate.
  11816. @example
  11817. ------> time
  11818. Input:
  11819. Frame 1 Frame 2 Frame 3 Frame 4
  11820. 11111 22222 33333 44444
  11821. 11111 22222 33333 44444
  11822. 11111 22222 33333 44444
  11823. 11111 22222 33333 44444
  11824. Output:
  11825. 11111 33333
  11826. 11111 33333
  11827. 11111 33333
  11828. 11111 33333
  11829. @end example
  11830. @item drop_odd, 2
  11831. Only output even frames, odd frames are dropped, generating a frame with
  11832. unchanged height at half frame rate.
  11833. @example
  11834. ------> time
  11835. Input:
  11836. Frame 1 Frame 2 Frame 3 Frame 4
  11837. 11111 22222 33333 44444
  11838. 11111 22222 33333 44444
  11839. 11111 22222 33333 44444
  11840. 11111 22222 33333 44444
  11841. Output:
  11842. 22222 44444
  11843. 22222 44444
  11844. 22222 44444
  11845. 22222 44444
  11846. @end example
  11847. @item pad, 3
  11848. Expand each frame to full height, but pad alternate lines with black,
  11849. generating a frame with double height at the same input frame rate.
  11850. @example
  11851. ------> time
  11852. Input:
  11853. Frame 1 Frame 2 Frame 3 Frame 4
  11854. 11111 22222 33333 44444
  11855. 11111 22222 33333 44444
  11856. 11111 22222 33333 44444
  11857. 11111 22222 33333 44444
  11858. Output:
  11859. 11111 ..... 33333 .....
  11860. ..... 22222 ..... 44444
  11861. 11111 ..... 33333 .....
  11862. ..... 22222 ..... 44444
  11863. 11111 ..... 33333 .....
  11864. ..... 22222 ..... 44444
  11865. 11111 ..... 33333 .....
  11866. ..... 22222 ..... 44444
  11867. @end example
  11868. @item interleave_top, 4
  11869. Interleave the upper field from odd frames with the lower field from
  11870. even frames, generating a frame with unchanged height at half frame rate.
  11871. @example
  11872. ------> time
  11873. Input:
  11874. Frame 1 Frame 2 Frame 3 Frame 4
  11875. 11111<- 22222 33333<- 44444
  11876. 11111 22222<- 33333 44444<-
  11877. 11111<- 22222 33333<- 44444
  11878. 11111 22222<- 33333 44444<-
  11879. Output:
  11880. 11111 33333
  11881. 22222 44444
  11882. 11111 33333
  11883. 22222 44444
  11884. @end example
  11885. @item interleave_bottom, 5
  11886. Interleave the lower field from odd frames with the upper field from
  11887. even frames, generating a frame with unchanged height at half frame rate.
  11888. @example
  11889. ------> time
  11890. Input:
  11891. Frame 1 Frame 2 Frame 3 Frame 4
  11892. 11111 22222<- 33333 44444<-
  11893. 11111<- 22222 33333<- 44444
  11894. 11111 22222<- 33333 44444<-
  11895. 11111<- 22222 33333<- 44444
  11896. Output:
  11897. 22222 44444
  11898. 11111 33333
  11899. 22222 44444
  11900. 11111 33333
  11901. @end example
  11902. @item interlacex2, 6
  11903. Double frame rate with unchanged height. Frames are inserted each
  11904. containing the second temporal field from the previous input frame and
  11905. the first temporal field from the next input frame. This mode relies on
  11906. the top_field_first flag. Useful for interlaced video displays with no
  11907. field synchronisation.
  11908. @example
  11909. ------> time
  11910. Input:
  11911. Frame 1 Frame 2 Frame 3 Frame 4
  11912. 11111 22222 33333 44444
  11913. 11111 22222 33333 44444
  11914. 11111 22222 33333 44444
  11915. 11111 22222 33333 44444
  11916. Output:
  11917. 11111 22222 22222 33333 33333 44444 44444
  11918. 11111 11111 22222 22222 33333 33333 44444
  11919. 11111 22222 22222 33333 33333 44444 44444
  11920. 11111 11111 22222 22222 33333 33333 44444
  11921. @end example
  11922. @item mergex2, 7
  11923. Move odd frames into the upper field, even into the lower field,
  11924. generating a double height frame at same frame rate.
  11925. @example
  11926. ------> time
  11927. Input:
  11928. Frame 1 Frame 2 Frame 3 Frame 4
  11929. 11111 22222 33333 44444
  11930. 11111 22222 33333 44444
  11931. 11111 22222 33333 44444
  11932. 11111 22222 33333 44444
  11933. Output:
  11934. 11111 33333 33333 55555
  11935. 22222 22222 44444 44444
  11936. 11111 33333 33333 55555
  11937. 22222 22222 44444 44444
  11938. 11111 33333 33333 55555
  11939. 22222 22222 44444 44444
  11940. 11111 33333 33333 55555
  11941. 22222 22222 44444 44444
  11942. @end example
  11943. @end table
  11944. Numeric values are deprecated but are accepted for backward
  11945. compatibility reasons.
  11946. Default mode is @code{merge}.
  11947. @item flags
  11948. Specify flags influencing the filter process.
  11949. Available value for @var{flags} is:
  11950. @table @option
  11951. @item low_pass_filter, vlfp
  11952. Enable linear vertical low-pass filtering in the filter.
  11953. Vertical low-pass filtering is required when creating an interlaced
  11954. destination from a progressive source which contains high-frequency
  11955. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11956. patterning.
  11957. @item complex_filter, cvlfp
  11958. Enable complex vertical low-pass filtering.
  11959. This will slightly less reduce interlace 'twitter' and Moire
  11960. patterning but better retain detail and subjective sharpness impression.
  11961. @end table
  11962. Vertical low-pass filtering can only be enabled for @option{mode}
  11963. @var{interleave_top} and @var{interleave_bottom}.
  11964. @end table
  11965. @section tmix
  11966. Mix successive video frames.
  11967. A description of the accepted options follows.
  11968. @table @option
  11969. @item frames
  11970. The number of successive frames to mix. If unspecified, it defaults to 3.
  11971. @item weights
  11972. Specify weight of each input video frame.
  11973. Each weight is separated by space. If number of weights is smaller than
  11974. number of @var{frames} last specified weight will be used for all remaining
  11975. unset weights.
  11976. @item scale
  11977. Specify scale, if it is set it will be multiplied with sum
  11978. of each weight multiplied with pixel values to give final destination
  11979. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11980. @end table
  11981. @subsection Examples
  11982. @itemize
  11983. @item
  11984. Average 7 successive frames:
  11985. @example
  11986. tmix=frames=7:weights="1 1 1 1 1 1 1"
  11987. @end example
  11988. @item
  11989. Apply simple temporal convolution:
  11990. @example
  11991. tmix=frames=3:weights="-1 3 -1"
  11992. @end example
  11993. @item
  11994. Similar as above but only showing temporal differences:
  11995. @example
  11996. tmix=frames=3:weights="-1 2 -1":scale=1
  11997. @end example
  11998. @end itemize
  11999. @section tonemap
  12000. Tone map colors from different dynamic ranges.
  12001. This filter expects data in single precision floating point, as it needs to
  12002. operate on (and can output) out-of-range values. Another filter, such as
  12003. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12004. The tonemapping algorithms implemented only work on linear light, so input
  12005. data should be linearized beforehand (and possibly correctly tagged).
  12006. @example
  12007. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12008. @end example
  12009. @subsection Options
  12010. The filter accepts the following options.
  12011. @table @option
  12012. @item tonemap
  12013. Set the tone map algorithm to use.
  12014. Possible values are:
  12015. @table @var
  12016. @item none
  12017. Do not apply any tone map, only desaturate overbright pixels.
  12018. @item clip
  12019. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12020. in-range values, while distorting out-of-range values.
  12021. @item linear
  12022. Stretch the entire reference gamut to a linear multiple of the display.
  12023. @item gamma
  12024. Fit a logarithmic transfer between the tone curves.
  12025. @item reinhard
  12026. Preserve overall image brightness with a simple curve, using nonlinear
  12027. contrast, which results in flattening details and degrading color accuracy.
  12028. @item hable
  12029. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12030. of slightly darkening everything. Use it when detail preservation is more
  12031. important than color and brightness accuracy.
  12032. @item mobius
  12033. Smoothly map out-of-range values, while retaining contrast and colors for
  12034. in-range material as much as possible. Use it when color accuracy is more
  12035. important than detail preservation.
  12036. @end table
  12037. Default is none.
  12038. @item param
  12039. Tune the tone mapping algorithm.
  12040. This affects the following algorithms:
  12041. @table @var
  12042. @item none
  12043. Ignored.
  12044. @item linear
  12045. Specifies the scale factor to use while stretching.
  12046. Default to 1.0.
  12047. @item gamma
  12048. Specifies the exponent of the function.
  12049. Default to 1.8.
  12050. @item clip
  12051. Specify an extra linear coefficient to multiply into the signal before clipping.
  12052. Default to 1.0.
  12053. @item reinhard
  12054. Specify the local contrast coefficient at the display peak.
  12055. Default to 0.5, which means that in-gamut values will be about half as bright
  12056. as when clipping.
  12057. @item hable
  12058. Ignored.
  12059. @item mobius
  12060. Specify the transition point from linear to mobius transform. Every value
  12061. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12062. more accurate the result will be, at the cost of losing bright details.
  12063. Default to 0.3, which due to the steep initial slope still preserves in-range
  12064. colors fairly accurately.
  12065. @end table
  12066. @item desat
  12067. Apply desaturation for highlights that exceed this level of brightness. The
  12068. higher the parameter, the more color information will be preserved. This
  12069. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12070. (smoothly) turning into white instead. This makes images feel more natural,
  12071. at the cost of reducing information about out-of-range colors.
  12072. The default of 2.0 is somewhat conservative and will mostly just apply to
  12073. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12074. This option works only if the input frame has a supported color tag.
  12075. @item peak
  12076. Override signal/nominal/reference peak with this value. Useful when the
  12077. embedded peak information in display metadata is not reliable or when tone
  12078. mapping from a lower range to a higher range.
  12079. @end table
  12080. @section transpose
  12081. Transpose rows with columns in the input video and optionally flip it.
  12082. It accepts the following parameters:
  12083. @table @option
  12084. @item dir
  12085. Specify the transposition direction.
  12086. Can assume the following values:
  12087. @table @samp
  12088. @item 0, 4, cclock_flip
  12089. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12090. @example
  12091. L.R L.l
  12092. . . -> . .
  12093. l.r R.r
  12094. @end example
  12095. @item 1, 5, clock
  12096. Rotate by 90 degrees clockwise, that is:
  12097. @example
  12098. L.R l.L
  12099. . . -> . .
  12100. l.r r.R
  12101. @end example
  12102. @item 2, 6, cclock
  12103. Rotate by 90 degrees counterclockwise, that is:
  12104. @example
  12105. L.R R.r
  12106. . . -> . .
  12107. l.r L.l
  12108. @end example
  12109. @item 3, 7, clock_flip
  12110. Rotate by 90 degrees clockwise and vertically flip, that is:
  12111. @example
  12112. L.R r.R
  12113. . . -> . .
  12114. l.r l.L
  12115. @end example
  12116. @end table
  12117. For values between 4-7, the transposition is only done if the input
  12118. video geometry is portrait and not landscape. These values are
  12119. deprecated, the @code{passthrough} option should be used instead.
  12120. Numerical values are deprecated, and should be dropped in favor of
  12121. symbolic constants.
  12122. @item passthrough
  12123. Do not apply the transposition if the input geometry matches the one
  12124. specified by the specified value. It accepts the following values:
  12125. @table @samp
  12126. @item none
  12127. Always apply transposition.
  12128. @item portrait
  12129. Preserve portrait geometry (when @var{height} >= @var{width}).
  12130. @item landscape
  12131. Preserve landscape geometry (when @var{width} >= @var{height}).
  12132. @end table
  12133. Default value is @code{none}.
  12134. @end table
  12135. For example to rotate by 90 degrees clockwise and preserve portrait
  12136. layout:
  12137. @example
  12138. transpose=dir=1:passthrough=portrait
  12139. @end example
  12140. The command above can also be specified as:
  12141. @example
  12142. transpose=1:portrait
  12143. @end example
  12144. @section trim
  12145. Trim the input so that the output contains one continuous subpart of the input.
  12146. It accepts the following parameters:
  12147. @table @option
  12148. @item start
  12149. Specify the time of the start of the kept section, i.e. the frame with the
  12150. timestamp @var{start} will be the first frame in the output.
  12151. @item end
  12152. Specify the time of the first frame that will be dropped, i.e. the frame
  12153. immediately preceding the one with the timestamp @var{end} will be the last
  12154. frame in the output.
  12155. @item start_pts
  12156. This is the same as @var{start}, except this option sets the start timestamp
  12157. in timebase units instead of seconds.
  12158. @item end_pts
  12159. This is the same as @var{end}, except this option sets the end timestamp
  12160. in timebase units instead of seconds.
  12161. @item duration
  12162. The maximum duration of the output in seconds.
  12163. @item start_frame
  12164. The number of the first frame that should be passed to the output.
  12165. @item end_frame
  12166. The number of the first frame that should be dropped.
  12167. @end table
  12168. @option{start}, @option{end}, and @option{duration} are expressed as time
  12169. duration specifications; see
  12170. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12171. for the accepted syntax.
  12172. Note that the first two sets of the start/end options and the @option{duration}
  12173. option look at the frame timestamp, while the _frame variants simply count the
  12174. frames that pass through the filter. Also note that this filter does not modify
  12175. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12176. setpts filter after the trim filter.
  12177. If multiple start or end options are set, this filter tries to be greedy and
  12178. keep all the frames that match at least one of the specified constraints. To keep
  12179. only the part that matches all the constraints at once, chain multiple trim
  12180. filters.
  12181. The defaults are such that all the input is kept. So it is possible to set e.g.
  12182. just the end values to keep everything before the specified time.
  12183. Examples:
  12184. @itemize
  12185. @item
  12186. Drop everything except the second minute of input:
  12187. @example
  12188. ffmpeg -i INPUT -vf trim=60:120
  12189. @end example
  12190. @item
  12191. Keep only the first second:
  12192. @example
  12193. ffmpeg -i INPUT -vf trim=duration=1
  12194. @end example
  12195. @end itemize
  12196. @section unpremultiply
  12197. Apply alpha unpremultiply effect to input video stream using first plane
  12198. of second stream as alpha.
  12199. Both streams must have same dimensions and same pixel format.
  12200. The filter accepts the following option:
  12201. @table @option
  12202. @item planes
  12203. Set which planes will be processed, unprocessed planes will be copied.
  12204. By default value 0xf, all planes will be processed.
  12205. If the format has 1 or 2 components, then luma is bit 0.
  12206. If the format has 3 or 4 components:
  12207. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12208. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12209. If present, the alpha channel is always the last bit.
  12210. @item inplace
  12211. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12212. @end table
  12213. @anchor{unsharp}
  12214. @section unsharp
  12215. Sharpen or blur the input video.
  12216. It accepts the following parameters:
  12217. @table @option
  12218. @item luma_msize_x, lx
  12219. Set the luma matrix horizontal size. It must be an odd integer between
  12220. 3 and 23. The default value is 5.
  12221. @item luma_msize_y, ly
  12222. Set the luma matrix vertical size. It must be an odd integer between 3
  12223. and 23. The default value is 5.
  12224. @item luma_amount, la
  12225. Set the luma effect strength. It must be a floating point number, reasonable
  12226. values lay between -1.5 and 1.5.
  12227. Negative values will blur the input video, while positive values will
  12228. sharpen it, a value of zero will disable the effect.
  12229. Default value is 1.0.
  12230. @item chroma_msize_x, cx
  12231. Set the chroma matrix horizontal size. It must be an odd integer
  12232. between 3 and 23. The default value is 5.
  12233. @item chroma_msize_y, cy
  12234. Set the chroma matrix vertical size. It must be an odd integer
  12235. between 3 and 23. The default value is 5.
  12236. @item chroma_amount, ca
  12237. Set the chroma effect strength. It must be a floating point number, reasonable
  12238. values lay between -1.5 and 1.5.
  12239. Negative values will blur the input video, while positive values will
  12240. sharpen it, a value of zero will disable the effect.
  12241. Default value is 0.0.
  12242. @end table
  12243. All parameters are optional and default to the equivalent of the
  12244. string '5:5:1.0:5:5:0.0'.
  12245. @subsection Examples
  12246. @itemize
  12247. @item
  12248. Apply strong luma sharpen effect:
  12249. @example
  12250. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12251. @end example
  12252. @item
  12253. Apply a strong blur of both luma and chroma parameters:
  12254. @example
  12255. unsharp=7:7:-2:7:7:-2
  12256. @end example
  12257. @end itemize
  12258. @section uspp
  12259. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12260. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12261. shifts and average the results.
  12262. The way this differs from the behavior of spp is that uspp actually encodes &
  12263. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12264. DCT similar to MJPEG.
  12265. The filter accepts the following options:
  12266. @table @option
  12267. @item quality
  12268. Set quality. This option defines the number of levels for averaging. It accepts
  12269. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12270. effect. A value of @code{8} means the higher quality. For each increment of
  12271. that value the speed drops by a factor of approximately 2. Default value is
  12272. @code{3}.
  12273. @item qp
  12274. Force a constant quantization parameter. If not set, the filter will use the QP
  12275. from the video stream (if available).
  12276. @end table
  12277. @section vaguedenoiser
  12278. Apply a wavelet based denoiser.
  12279. It transforms each frame from the video input into the wavelet domain,
  12280. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12281. the obtained coefficients. It does an inverse wavelet transform after.
  12282. Due to wavelet properties, it should give a nice smoothed result, and
  12283. reduced noise, without blurring picture features.
  12284. This filter accepts the following options:
  12285. @table @option
  12286. @item threshold
  12287. The filtering strength. The higher, the more filtered the video will be.
  12288. Hard thresholding can use a higher threshold than soft thresholding
  12289. before the video looks overfiltered. Default value is 2.
  12290. @item method
  12291. The filtering method the filter will use.
  12292. It accepts the following values:
  12293. @table @samp
  12294. @item hard
  12295. All values under the threshold will be zeroed.
  12296. @item soft
  12297. All values under the threshold will be zeroed. All values above will be
  12298. reduced by the threshold.
  12299. @item garrote
  12300. Scales or nullifies coefficients - intermediary between (more) soft and
  12301. (less) hard thresholding.
  12302. @end table
  12303. Default is garrote.
  12304. @item nsteps
  12305. Number of times, the wavelet will decompose the picture. Picture can't
  12306. be decomposed beyond a particular point (typically, 8 for a 640x480
  12307. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12308. @item percent
  12309. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12310. @item planes
  12311. A list of the planes to process. By default all planes are processed.
  12312. @end table
  12313. @section vectorscope
  12314. Display 2 color component values in the two dimensional graph (which is called
  12315. a vectorscope).
  12316. This filter accepts the following options:
  12317. @table @option
  12318. @item mode, m
  12319. Set vectorscope mode.
  12320. It accepts the following values:
  12321. @table @samp
  12322. @item gray
  12323. Gray values are displayed on graph, higher brightness means more pixels have
  12324. same component color value on location in graph. This is the default mode.
  12325. @item color
  12326. Gray values are displayed on graph. Surrounding pixels values which are not
  12327. present in video frame are drawn in gradient of 2 color components which are
  12328. set by option @code{x} and @code{y}. The 3rd color component is static.
  12329. @item color2
  12330. Actual color components values present in video frame are displayed on graph.
  12331. @item color3
  12332. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12333. on graph increases value of another color component, which is luminance by
  12334. default values of @code{x} and @code{y}.
  12335. @item color4
  12336. Actual colors present in video frame are displayed on graph. If two different
  12337. colors map to same position on graph then color with higher value of component
  12338. not present in graph is picked.
  12339. @item color5
  12340. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12341. component picked from radial gradient.
  12342. @end table
  12343. @item x
  12344. Set which color component will be represented on X-axis. Default is @code{1}.
  12345. @item y
  12346. Set which color component will be represented on Y-axis. Default is @code{2}.
  12347. @item intensity, i
  12348. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12349. of color component which represents frequency of (X, Y) location in graph.
  12350. @item envelope, e
  12351. @table @samp
  12352. @item none
  12353. No envelope, this is default.
  12354. @item instant
  12355. Instant envelope, even darkest single pixel will be clearly highlighted.
  12356. @item peak
  12357. Hold maximum and minimum values presented in graph over time. This way you
  12358. can still spot out of range values without constantly looking at vectorscope.
  12359. @item peak+instant
  12360. Peak and instant envelope combined together.
  12361. @end table
  12362. @item graticule, g
  12363. Set what kind of graticule to draw.
  12364. @table @samp
  12365. @item none
  12366. @item green
  12367. @item color
  12368. @end table
  12369. @item opacity, o
  12370. Set graticule opacity.
  12371. @item flags, f
  12372. Set graticule flags.
  12373. @table @samp
  12374. @item white
  12375. Draw graticule for white point.
  12376. @item black
  12377. Draw graticule for black point.
  12378. @item name
  12379. Draw color points short names.
  12380. @end table
  12381. @item bgopacity, b
  12382. Set background opacity.
  12383. @item lthreshold, l
  12384. Set low threshold for color component not represented on X or Y axis.
  12385. Values lower than this value will be ignored. Default is 0.
  12386. Note this value is multiplied with actual max possible value one pixel component
  12387. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12388. is 0.1 * 255 = 25.
  12389. @item hthreshold, h
  12390. Set high threshold for color component not represented on X or Y axis.
  12391. Values higher than this value will be ignored. Default is 1.
  12392. Note this value is multiplied with actual max possible value one pixel component
  12393. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12394. is 0.9 * 255 = 230.
  12395. @item colorspace, c
  12396. Set what kind of colorspace to use when drawing graticule.
  12397. @table @samp
  12398. @item auto
  12399. @item 601
  12400. @item 709
  12401. @end table
  12402. Default is auto.
  12403. @end table
  12404. @anchor{vidstabdetect}
  12405. @section vidstabdetect
  12406. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12407. @ref{vidstabtransform} for pass 2.
  12408. This filter generates a file with relative translation and rotation
  12409. transform information about subsequent frames, which is then used by
  12410. the @ref{vidstabtransform} filter.
  12411. To enable compilation of this filter you need to configure FFmpeg with
  12412. @code{--enable-libvidstab}.
  12413. This filter accepts the following options:
  12414. @table @option
  12415. @item result
  12416. Set the path to the file used to write the transforms information.
  12417. Default value is @file{transforms.trf}.
  12418. @item shakiness
  12419. Set how shaky the video is and how quick the camera is. It accepts an
  12420. integer in the range 1-10, a value of 1 means little shakiness, a
  12421. value of 10 means strong shakiness. Default value is 5.
  12422. @item accuracy
  12423. Set the accuracy of the detection process. It must be a value in the
  12424. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12425. accuracy. Default value is 15.
  12426. @item stepsize
  12427. Set stepsize of the search process. The region around minimum is
  12428. scanned with 1 pixel resolution. Default value is 6.
  12429. @item mincontrast
  12430. Set minimum contrast. Below this value a local measurement field is
  12431. discarded. Must be a floating point value in the range 0-1. Default
  12432. value is 0.3.
  12433. @item tripod
  12434. Set reference frame number for tripod mode.
  12435. If enabled, the motion of the frames is compared to a reference frame
  12436. in the filtered stream, identified by the specified number. The idea
  12437. is to compensate all movements in a more-or-less static scene and keep
  12438. the camera view absolutely still.
  12439. If set to 0, it is disabled. The frames are counted starting from 1.
  12440. @item show
  12441. Show fields and transforms in the resulting frames. It accepts an
  12442. integer in the range 0-2. Default value is 0, which disables any
  12443. visualization.
  12444. @end table
  12445. @subsection Examples
  12446. @itemize
  12447. @item
  12448. Use default values:
  12449. @example
  12450. vidstabdetect
  12451. @end example
  12452. @item
  12453. Analyze strongly shaky movie and put the results in file
  12454. @file{mytransforms.trf}:
  12455. @example
  12456. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12457. @end example
  12458. @item
  12459. Visualize the result of internal transformations in the resulting
  12460. video:
  12461. @example
  12462. vidstabdetect=show=1
  12463. @end example
  12464. @item
  12465. Analyze a video with medium shakiness using @command{ffmpeg}:
  12466. @example
  12467. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12468. @end example
  12469. @end itemize
  12470. @anchor{vidstabtransform}
  12471. @section vidstabtransform
  12472. Video stabilization/deshaking: pass 2 of 2,
  12473. see @ref{vidstabdetect} for pass 1.
  12474. Read a file with transform information for each frame and
  12475. apply/compensate them. Together with the @ref{vidstabdetect}
  12476. filter this can be used to deshake videos. See also
  12477. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12478. the @ref{unsharp} filter, see below.
  12479. To enable compilation of this filter you need to configure FFmpeg with
  12480. @code{--enable-libvidstab}.
  12481. @subsection Options
  12482. @table @option
  12483. @item input
  12484. Set path to the file used to read the transforms. Default value is
  12485. @file{transforms.trf}.
  12486. @item smoothing
  12487. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12488. camera movements. Default value is 10.
  12489. For example a number of 10 means that 21 frames are used (10 in the
  12490. past and 10 in the future) to smoothen the motion in the video. A
  12491. larger value leads to a smoother video, but limits the acceleration of
  12492. the camera (pan/tilt movements). 0 is a special case where a static
  12493. camera is simulated.
  12494. @item optalgo
  12495. Set the camera path optimization algorithm.
  12496. Accepted values are:
  12497. @table @samp
  12498. @item gauss
  12499. gaussian kernel low-pass filter on camera motion (default)
  12500. @item avg
  12501. averaging on transformations
  12502. @end table
  12503. @item maxshift
  12504. Set maximal number of pixels to translate frames. Default value is -1,
  12505. meaning no limit.
  12506. @item maxangle
  12507. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12508. value is -1, meaning no limit.
  12509. @item crop
  12510. Specify how to deal with borders that may be visible due to movement
  12511. compensation.
  12512. Available values are:
  12513. @table @samp
  12514. @item keep
  12515. keep image information from previous frame (default)
  12516. @item black
  12517. fill the border black
  12518. @end table
  12519. @item invert
  12520. Invert transforms if set to 1. Default value is 0.
  12521. @item relative
  12522. Consider transforms as relative to previous frame if set to 1,
  12523. absolute if set to 0. Default value is 0.
  12524. @item zoom
  12525. Set percentage to zoom. A positive value will result in a zoom-in
  12526. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12527. zoom).
  12528. @item optzoom
  12529. Set optimal zooming to avoid borders.
  12530. Accepted values are:
  12531. @table @samp
  12532. @item 0
  12533. disabled
  12534. @item 1
  12535. optimal static zoom value is determined (only very strong movements
  12536. will lead to visible borders) (default)
  12537. @item 2
  12538. optimal adaptive zoom value is determined (no borders will be
  12539. visible), see @option{zoomspeed}
  12540. @end table
  12541. Note that the value given at zoom is added to the one calculated here.
  12542. @item zoomspeed
  12543. Set percent to zoom maximally each frame (enabled when
  12544. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12545. 0.25.
  12546. @item interpol
  12547. Specify type of interpolation.
  12548. Available values are:
  12549. @table @samp
  12550. @item no
  12551. no interpolation
  12552. @item linear
  12553. linear only horizontal
  12554. @item bilinear
  12555. linear in both directions (default)
  12556. @item bicubic
  12557. cubic in both directions (slow)
  12558. @end table
  12559. @item tripod
  12560. Enable virtual tripod mode if set to 1, which is equivalent to
  12561. @code{relative=0:smoothing=0}. Default value is 0.
  12562. Use also @code{tripod} option of @ref{vidstabdetect}.
  12563. @item debug
  12564. Increase log verbosity if set to 1. Also the detected global motions
  12565. are written to the temporary file @file{global_motions.trf}. Default
  12566. value is 0.
  12567. @end table
  12568. @subsection Examples
  12569. @itemize
  12570. @item
  12571. Use @command{ffmpeg} for a typical stabilization with default values:
  12572. @example
  12573. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12574. @end example
  12575. Note the use of the @ref{unsharp} filter which is always recommended.
  12576. @item
  12577. Zoom in a bit more and load transform data from a given file:
  12578. @example
  12579. vidstabtransform=zoom=5:input="mytransforms.trf"
  12580. @end example
  12581. @item
  12582. Smoothen the video even more:
  12583. @example
  12584. vidstabtransform=smoothing=30
  12585. @end example
  12586. @end itemize
  12587. @section vflip
  12588. Flip the input video vertically.
  12589. For example, to vertically flip a video with @command{ffmpeg}:
  12590. @example
  12591. ffmpeg -i in.avi -vf "vflip" out.avi
  12592. @end example
  12593. @section vfrdet
  12594. Detect variable frame rate video.
  12595. This filter tries to detect if the input is variable or constant frame rate.
  12596. At end it will output number of frames detected as having variable delta pts,
  12597. and ones with constant delta pts.
  12598. If there was frames with variable delta, than it will also show min and max delta
  12599. encountered.
  12600. @anchor{vignette}
  12601. @section vignette
  12602. Make or reverse a natural vignetting effect.
  12603. The filter accepts the following options:
  12604. @table @option
  12605. @item angle, a
  12606. Set lens angle expression as a number of radians.
  12607. The value is clipped in the @code{[0,PI/2]} range.
  12608. Default value: @code{"PI/5"}
  12609. @item x0
  12610. @item y0
  12611. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12612. by default.
  12613. @item mode
  12614. Set forward/backward mode.
  12615. Available modes are:
  12616. @table @samp
  12617. @item forward
  12618. The larger the distance from the central point, the darker the image becomes.
  12619. @item backward
  12620. The larger the distance from the central point, the brighter the image becomes.
  12621. This can be used to reverse a vignette effect, though there is no automatic
  12622. detection to extract the lens @option{angle} and other settings (yet). It can
  12623. also be used to create a burning effect.
  12624. @end table
  12625. Default value is @samp{forward}.
  12626. @item eval
  12627. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12628. It accepts the following values:
  12629. @table @samp
  12630. @item init
  12631. Evaluate expressions only once during the filter initialization.
  12632. @item frame
  12633. Evaluate expressions for each incoming frame. This is way slower than the
  12634. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12635. allows advanced dynamic expressions.
  12636. @end table
  12637. Default value is @samp{init}.
  12638. @item dither
  12639. Set dithering to reduce the circular banding effects. Default is @code{1}
  12640. (enabled).
  12641. @item aspect
  12642. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12643. Setting this value to the SAR of the input will make a rectangular vignetting
  12644. following the dimensions of the video.
  12645. Default is @code{1/1}.
  12646. @end table
  12647. @subsection Expressions
  12648. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12649. following parameters.
  12650. @table @option
  12651. @item w
  12652. @item h
  12653. input width and height
  12654. @item n
  12655. the number of input frame, starting from 0
  12656. @item pts
  12657. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12658. @var{TB} units, NAN if undefined
  12659. @item r
  12660. frame rate of the input video, NAN if the input frame rate is unknown
  12661. @item t
  12662. the PTS (Presentation TimeStamp) of the filtered video frame,
  12663. expressed in seconds, NAN if undefined
  12664. @item tb
  12665. time base of the input video
  12666. @end table
  12667. @subsection Examples
  12668. @itemize
  12669. @item
  12670. Apply simple strong vignetting effect:
  12671. @example
  12672. vignette=PI/4
  12673. @end example
  12674. @item
  12675. Make a flickering vignetting:
  12676. @example
  12677. vignette='PI/4+random(1)*PI/50':eval=frame
  12678. @end example
  12679. @end itemize
  12680. @section vmafmotion
  12681. Obtain the average vmaf motion score of a video.
  12682. It is one of the component filters of VMAF.
  12683. The obtained average motion score is printed through the logging system.
  12684. In the below example the input file @file{ref.mpg} is being processed and score
  12685. is computed.
  12686. @example
  12687. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12688. @end example
  12689. @section vstack
  12690. Stack input videos vertically.
  12691. All streams must be of same pixel format and of same width.
  12692. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12693. to create same output.
  12694. The filter accept the following option:
  12695. @table @option
  12696. @item inputs
  12697. Set number of input streams. Default is 2.
  12698. @item shortest
  12699. If set to 1, force the output to terminate when the shortest input
  12700. terminates. Default value is 0.
  12701. @end table
  12702. @section w3fdif
  12703. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12704. Deinterlacing Filter").
  12705. Based on the process described by Martin Weston for BBC R&D, and
  12706. implemented based on the de-interlace algorithm written by Jim
  12707. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12708. uses filter coefficients calculated by BBC R&D.
  12709. There are two sets of filter coefficients, so called "simple":
  12710. and "complex". Which set of filter coefficients is used can
  12711. be set by passing an optional parameter:
  12712. @table @option
  12713. @item filter
  12714. Set the interlacing filter coefficients. Accepts one of the following values:
  12715. @table @samp
  12716. @item simple
  12717. Simple filter coefficient set.
  12718. @item complex
  12719. More-complex filter coefficient set.
  12720. @end table
  12721. Default value is @samp{complex}.
  12722. @item deint
  12723. Specify which frames to deinterlace. Accept one of the following values:
  12724. @table @samp
  12725. @item all
  12726. Deinterlace all frames,
  12727. @item interlaced
  12728. Only deinterlace frames marked as interlaced.
  12729. @end table
  12730. Default value is @samp{all}.
  12731. @end table
  12732. @section waveform
  12733. Video waveform monitor.
  12734. The waveform monitor plots color component intensity. By default luminance
  12735. only. Each column of the waveform corresponds to a column of pixels in the
  12736. source video.
  12737. It accepts the following options:
  12738. @table @option
  12739. @item mode, m
  12740. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12741. In row mode, the graph on the left side represents color component value 0 and
  12742. the right side represents value = 255. In column mode, the top side represents
  12743. color component value = 0 and bottom side represents value = 255.
  12744. @item intensity, i
  12745. Set intensity. Smaller values are useful to find out how many values of the same
  12746. luminance are distributed across input rows/columns.
  12747. Default value is @code{0.04}. Allowed range is [0, 1].
  12748. @item mirror, r
  12749. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12750. In mirrored mode, higher values will be represented on the left
  12751. side for @code{row} mode and at the top for @code{column} mode. Default is
  12752. @code{1} (mirrored).
  12753. @item display, d
  12754. Set display mode.
  12755. It accepts the following values:
  12756. @table @samp
  12757. @item overlay
  12758. Presents information identical to that in the @code{parade}, except
  12759. that the graphs representing color components are superimposed directly
  12760. over one another.
  12761. This display mode makes it easier to spot relative differences or similarities
  12762. in overlapping areas of the color components that are supposed to be identical,
  12763. such as neutral whites, grays, or blacks.
  12764. @item stack
  12765. Display separate graph for the color components side by side in
  12766. @code{row} mode or one below the other in @code{column} mode.
  12767. @item parade
  12768. Display separate graph for the color components side by side in
  12769. @code{column} mode or one below the other in @code{row} mode.
  12770. Using this display mode makes it easy to spot color casts in the highlights
  12771. and shadows of an image, by comparing the contours of the top and the bottom
  12772. graphs of each waveform. Since whites, grays, and blacks are characterized
  12773. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12774. should display three waveforms of roughly equal width/height. If not, the
  12775. correction is easy to perform by making level adjustments the three waveforms.
  12776. @end table
  12777. Default is @code{stack}.
  12778. @item components, c
  12779. Set which color components to display. Default is 1, which means only luminance
  12780. or red color component if input is in RGB colorspace. If is set for example to
  12781. 7 it will display all 3 (if) available color components.
  12782. @item envelope, e
  12783. @table @samp
  12784. @item none
  12785. No envelope, this is default.
  12786. @item instant
  12787. Instant envelope, minimum and maximum values presented in graph will be easily
  12788. visible even with small @code{step} value.
  12789. @item peak
  12790. Hold minimum and maximum values presented in graph across time. This way you
  12791. can still spot out of range values without constantly looking at waveforms.
  12792. @item peak+instant
  12793. Peak and instant envelope combined together.
  12794. @end table
  12795. @item filter, f
  12796. @table @samp
  12797. @item lowpass
  12798. No filtering, this is default.
  12799. @item flat
  12800. Luma and chroma combined together.
  12801. @item aflat
  12802. Similar as above, but shows difference between blue and red chroma.
  12803. @item xflat
  12804. Similar as above, but use different colors.
  12805. @item chroma
  12806. Displays only chroma.
  12807. @item color
  12808. Displays actual color value on waveform.
  12809. @item acolor
  12810. Similar as above, but with luma showing frequency of chroma values.
  12811. @end table
  12812. @item graticule, g
  12813. Set which graticule to display.
  12814. @table @samp
  12815. @item none
  12816. Do not display graticule.
  12817. @item green
  12818. Display green graticule showing legal broadcast ranges.
  12819. @item orange
  12820. Display orange graticule showing legal broadcast ranges.
  12821. @end table
  12822. @item opacity, o
  12823. Set graticule opacity.
  12824. @item flags, fl
  12825. Set graticule flags.
  12826. @table @samp
  12827. @item numbers
  12828. Draw numbers above lines. By default enabled.
  12829. @item dots
  12830. Draw dots instead of lines.
  12831. @end table
  12832. @item scale, s
  12833. Set scale used for displaying graticule.
  12834. @table @samp
  12835. @item digital
  12836. @item millivolts
  12837. @item ire
  12838. @end table
  12839. Default is digital.
  12840. @item bgopacity, b
  12841. Set background opacity.
  12842. @end table
  12843. @section weave, doubleweave
  12844. The @code{weave} takes a field-based video input and join
  12845. each two sequential fields into single frame, producing a new double
  12846. height clip with half the frame rate and half the frame count.
  12847. The @code{doubleweave} works same as @code{weave} but without
  12848. halving frame rate and frame count.
  12849. It accepts the following option:
  12850. @table @option
  12851. @item first_field
  12852. Set first field. Available values are:
  12853. @table @samp
  12854. @item top, t
  12855. Set the frame as top-field-first.
  12856. @item bottom, b
  12857. Set the frame as bottom-field-first.
  12858. @end table
  12859. @end table
  12860. @subsection Examples
  12861. @itemize
  12862. @item
  12863. Interlace video using @ref{select} and @ref{separatefields} filter:
  12864. @example
  12865. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12866. @end example
  12867. @end itemize
  12868. @section xbr
  12869. Apply the xBR high-quality magnification filter which is designed for pixel
  12870. art. It follows a set of edge-detection rules, see
  12871. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12872. It accepts the following option:
  12873. @table @option
  12874. @item n
  12875. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12876. @code{3xBR} and @code{4} for @code{4xBR}.
  12877. Default is @code{3}.
  12878. @end table
  12879. @anchor{yadif}
  12880. @section yadif
  12881. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12882. filter").
  12883. It accepts the following parameters:
  12884. @table @option
  12885. @item mode
  12886. The interlacing mode to adopt. It accepts one of the following values:
  12887. @table @option
  12888. @item 0, send_frame
  12889. Output one frame for each frame.
  12890. @item 1, send_field
  12891. Output one frame for each field.
  12892. @item 2, send_frame_nospatial
  12893. Like @code{send_frame}, but it skips the spatial interlacing check.
  12894. @item 3, send_field_nospatial
  12895. Like @code{send_field}, but it skips the spatial interlacing check.
  12896. @end table
  12897. The default value is @code{send_frame}.
  12898. @item parity
  12899. The picture field parity assumed for the input interlaced video. It accepts one
  12900. of the following values:
  12901. @table @option
  12902. @item 0, tff
  12903. Assume the top field is first.
  12904. @item 1, bff
  12905. Assume the bottom field is first.
  12906. @item -1, auto
  12907. Enable automatic detection of field parity.
  12908. @end table
  12909. The default value is @code{auto}.
  12910. If the interlacing is unknown or the decoder does not export this information,
  12911. top field first will be assumed.
  12912. @item deint
  12913. Specify which frames to deinterlace. Accept one of the following
  12914. values:
  12915. @table @option
  12916. @item 0, all
  12917. Deinterlace all frames.
  12918. @item 1, interlaced
  12919. Only deinterlace frames marked as interlaced.
  12920. @end table
  12921. The default value is @code{all}.
  12922. @end table
  12923. @section zoompan
  12924. Apply Zoom & Pan effect.
  12925. This filter accepts the following options:
  12926. @table @option
  12927. @item zoom, z
  12928. Set the zoom expression. Default is 1.
  12929. @item x
  12930. @item y
  12931. Set the x and y expression. Default is 0.
  12932. @item d
  12933. Set the duration expression in number of frames.
  12934. This sets for how many number of frames effect will last for
  12935. single input image.
  12936. @item s
  12937. Set the output image size, default is 'hd720'.
  12938. @item fps
  12939. Set the output frame rate, default is '25'.
  12940. @end table
  12941. Each expression can contain the following constants:
  12942. @table @option
  12943. @item in_w, iw
  12944. Input width.
  12945. @item in_h, ih
  12946. Input height.
  12947. @item out_w, ow
  12948. Output width.
  12949. @item out_h, oh
  12950. Output height.
  12951. @item in
  12952. Input frame count.
  12953. @item on
  12954. Output frame count.
  12955. @item x
  12956. @item y
  12957. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12958. for current input frame.
  12959. @item px
  12960. @item py
  12961. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12962. not yet such frame (first input frame).
  12963. @item zoom
  12964. Last calculated zoom from 'z' expression for current input frame.
  12965. @item pzoom
  12966. Last calculated zoom of last output frame of previous input frame.
  12967. @item duration
  12968. Number of output frames for current input frame. Calculated from 'd' expression
  12969. for each input frame.
  12970. @item pduration
  12971. number of output frames created for previous input frame
  12972. @item a
  12973. Rational number: input width / input height
  12974. @item sar
  12975. sample aspect ratio
  12976. @item dar
  12977. display aspect ratio
  12978. @end table
  12979. @subsection Examples
  12980. @itemize
  12981. @item
  12982. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12983. @example
  12984. 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
  12985. @end example
  12986. @item
  12987. Zoom-in up to 1.5 and pan always at center of picture:
  12988. @example
  12989. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12990. @end example
  12991. @item
  12992. Same as above but without pausing:
  12993. @example
  12994. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12995. @end example
  12996. @end itemize
  12997. @anchor{zscale}
  12998. @section zscale
  12999. Scale (resize) the input video, using the z.lib library:
  13000. https://github.com/sekrit-twc/zimg.
  13001. The zscale filter forces the output display aspect ratio to be the same
  13002. as the input, by changing the output sample aspect ratio.
  13003. If the input image format is different from the format requested by
  13004. the next filter, the zscale filter will convert the input to the
  13005. requested format.
  13006. @subsection Options
  13007. The filter accepts the following options.
  13008. @table @option
  13009. @item width, w
  13010. @item height, h
  13011. Set the output video dimension expression. Default value is the input
  13012. dimension.
  13013. If the @var{width} or @var{w} value is 0, the input width is used for
  13014. the output. If the @var{height} or @var{h} value is 0, the input height
  13015. is used for the output.
  13016. If one and only one of the values is -n with n >= 1, the zscale filter
  13017. will use a value that maintains the aspect ratio of the input image,
  13018. calculated from the other specified dimension. After that it will,
  13019. however, make sure that the calculated dimension is divisible by n and
  13020. adjust the value if necessary.
  13021. If both values are -n with n >= 1, the behavior will be identical to
  13022. both values being set to 0 as previously detailed.
  13023. See below for the list of accepted constants for use in the dimension
  13024. expression.
  13025. @item size, s
  13026. Set the video size. For the syntax of this option, check the
  13027. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13028. @item dither, d
  13029. Set the dither type.
  13030. Possible values are:
  13031. @table @var
  13032. @item none
  13033. @item ordered
  13034. @item random
  13035. @item error_diffusion
  13036. @end table
  13037. Default is none.
  13038. @item filter, f
  13039. Set the resize filter type.
  13040. Possible values are:
  13041. @table @var
  13042. @item point
  13043. @item bilinear
  13044. @item bicubic
  13045. @item spline16
  13046. @item spline36
  13047. @item lanczos
  13048. @end table
  13049. Default is bilinear.
  13050. @item range, r
  13051. Set the color range.
  13052. Possible values are:
  13053. @table @var
  13054. @item input
  13055. @item limited
  13056. @item full
  13057. @end table
  13058. Default is same as input.
  13059. @item primaries, p
  13060. Set the color primaries.
  13061. Possible values are:
  13062. @table @var
  13063. @item input
  13064. @item 709
  13065. @item unspecified
  13066. @item 170m
  13067. @item 240m
  13068. @item 2020
  13069. @end table
  13070. Default is same as input.
  13071. @item transfer, t
  13072. Set the transfer characteristics.
  13073. Possible values are:
  13074. @table @var
  13075. @item input
  13076. @item 709
  13077. @item unspecified
  13078. @item 601
  13079. @item linear
  13080. @item 2020_10
  13081. @item 2020_12
  13082. @item smpte2084
  13083. @item iec61966-2-1
  13084. @item arib-std-b67
  13085. @end table
  13086. Default is same as input.
  13087. @item matrix, m
  13088. Set the colorspace matrix.
  13089. Possible value are:
  13090. @table @var
  13091. @item input
  13092. @item 709
  13093. @item unspecified
  13094. @item 470bg
  13095. @item 170m
  13096. @item 2020_ncl
  13097. @item 2020_cl
  13098. @end table
  13099. Default is same as input.
  13100. @item rangein, rin
  13101. Set the input color range.
  13102. Possible values are:
  13103. @table @var
  13104. @item input
  13105. @item limited
  13106. @item full
  13107. @end table
  13108. Default is same as input.
  13109. @item primariesin, pin
  13110. Set the input color primaries.
  13111. Possible values are:
  13112. @table @var
  13113. @item input
  13114. @item 709
  13115. @item unspecified
  13116. @item 170m
  13117. @item 240m
  13118. @item 2020
  13119. @end table
  13120. Default is same as input.
  13121. @item transferin, tin
  13122. Set the input transfer characteristics.
  13123. Possible values are:
  13124. @table @var
  13125. @item input
  13126. @item 709
  13127. @item unspecified
  13128. @item 601
  13129. @item linear
  13130. @item 2020_10
  13131. @item 2020_12
  13132. @end table
  13133. Default is same as input.
  13134. @item matrixin, min
  13135. Set the input colorspace matrix.
  13136. Possible value are:
  13137. @table @var
  13138. @item input
  13139. @item 709
  13140. @item unspecified
  13141. @item 470bg
  13142. @item 170m
  13143. @item 2020_ncl
  13144. @item 2020_cl
  13145. @end table
  13146. @item chromal, c
  13147. Set the output chroma location.
  13148. Possible values are:
  13149. @table @var
  13150. @item input
  13151. @item left
  13152. @item center
  13153. @item topleft
  13154. @item top
  13155. @item bottomleft
  13156. @item bottom
  13157. @end table
  13158. @item chromalin, cin
  13159. Set the input chroma location.
  13160. Possible values are:
  13161. @table @var
  13162. @item input
  13163. @item left
  13164. @item center
  13165. @item topleft
  13166. @item top
  13167. @item bottomleft
  13168. @item bottom
  13169. @end table
  13170. @item npl
  13171. Set the nominal peak luminance.
  13172. @end table
  13173. The values of the @option{w} and @option{h} options are expressions
  13174. containing the following constants:
  13175. @table @var
  13176. @item in_w
  13177. @item in_h
  13178. The input width and height
  13179. @item iw
  13180. @item ih
  13181. These are the same as @var{in_w} and @var{in_h}.
  13182. @item out_w
  13183. @item out_h
  13184. The output (scaled) width and height
  13185. @item ow
  13186. @item oh
  13187. These are the same as @var{out_w} and @var{out_h}
  13188. @item a
  13189. The same as @var{iw} / @var{ih}
  13190. @item sar
  13191. input sample aspect ratio
  13192. @item dar
  13193. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13194. @item hsub
  13195. @item vsub
  13196. horizontal and vertical input chroma subsample values. For example for the
  13197. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13198. @item ohsub
  13199. @item ovsub
  13200. horizontal and vertical output chroma subsample values. For example for the
  13201. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13202. @end table
  13203. @table @option
  13204. @end table
  13205. @c man end VIDEO FILTERS
  13206. @chapter Video Sources
  13207. @c man begin VIDEO SOURCES
  13208. Below is a description of the currently available video sources.
  13209. @section buffer
  13210. Buffer video frames, and make them available to the filter chain.
  13211. This source is mainly intended for a programmatic use, in particular
  13212. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13213. It accepts the following parameters:
  13214. @table @option
  13215. @item video_size
  13216. Specify the size (width and height) of the buffered video frames. For the
  13217. syntax of this option, check the
  13218. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13219. @item width
  13220. The input video width.
  13221. @item height
  13222. The input video height.
  13223. @item pix_fmt
  13224. A string representing the pixel format of the buffered video frames.
  13225. It may be a number corresponding to a pixel format, or a pixel format
  13226. name.
  13227. @item time_base
  13228. Specify the timebase assumed by the timestamps of the buffered frames.
  13229. @item frame_rate
  13230. Specify the frame rate expected for the video stream.
  13231. @item pixel_aspect, sar
  13232. The sample (pixel) aspect ratio of the input video.
  13233. @item sws_param
  13234. Specify the optional parameters to be used for the scale filter which
  13235. is automatically inserted when an input change is detected in the
  13236. input size or format.
  13237. @item hw_frames_ctx
  13238. When using a hardware pixel format, this should be a reference to an
  13239. AVHWFramesContext describing input frames.
  13240. @end table
  13241. For example:
  13242. @example
  13243. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13244. @end example
  13245. will instruct the source to accept video frames with size 320x240 and
  13246. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13247. square pixels (1:1 sample aspect ratio).
  13248. Since the pixel format with name "yuv410p" corresponds to the number 6
  13249. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13250. this example corresponds to:
  13251. @example
  13252. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13253. @end example
  13254. Alternatively, the options can be specified as a flat string, but this
  13255. syntax is deprecated:
  13256. @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}]
  13257. @section cellauto
  13258. Create a pattern generated by an elementary cellular automaton.
  13259. The initial state of the cellular automaton can be defined through the
  13260. @option{filename} and @option{pattern} options. If such options are
  13261. not specified an initial state is created randomly.
  13262. At each new frame a new row in the video is filled with the result of
  13263. the cellular automaton next generation. The behavior when the whole
  13264. frame is filled is defined by the @option{scroll} option.
  13265. This source accepts the following options:
  13266. @table @option
  13267. @item filename, f
  13268. Read the initial cellular automaton state, i.e. the starting row, from
  13269. the specified file.
  13270. In the file, each non-whitespace character is considered an alive
  13271. cell, a newline will terminate the row, and further characters in the
  13272. file will be ignored.
  13273. @item pattern, p
  13274. Read the initial cellular automaton state, i.e. the starting row, from
  13275. the specified string.
  13276. Each non-whitespace character in the string is considered an alive
  13277. cell, a newline will terminate the row, and further characters in the
  13278. string will be ignored.
  13279. @item rate, r
  13280. Set the video rate, that is the number of frames generated per second.
  13281. Default is 25.
  13282. @item random_fill_ratio, ratio
  13283. Set the random fill ratio for the initial cellular automaton row. It
  13284. is a floating point number value ranging from 0 to 1, defaults to
  13285. 1/PHI.
  13286. This option is ignored when a file or a pattern is specified.
  13287. @item random_seed, seed
  13288. Set the seed for filling randomly the initial row, must be an integer
  13289. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13290. set to -1, the filter will try to use a good random seed on a best
  13291. effort basis.
  13292. @item rule
  13293. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13294. Default value is 110.
  13295. @item size, s
  13296. Set the size of the output video. For the syntax of this option, check the
  13297. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13298. If @option{filename} or @option{pattern} is specified, the size is set
  13299. by default to the width of the specified initial state row, and the
  13300. height is set to @var{width} * PHI.
  13301. If @option{size} is set, it must contain the width of the specified
  13302. pattern string, and the specified pattern will be centered in the
  13303. larger row.
  13304. If a filename or a pattern string is not specified, the size value
  13305. defaults to "320x518" (used for a randomly generated initial state).
  13306. @item scroll
  13307. If set to 1, scroll the output upward when all the rows in the output
  13308. have been already filled. If set to 0, the new generated row will be
  13309. written over the top row just after the bottom row is filled.
  13310. Defaults to 1.
  13311. @item start_full, full
  13312. If set to 1, completely fill the output with generated rows before
  13313. outputting the first frame.
  13314. This is the default behavior, for disabling set the value to 0.
  13315. @item stitch
  13316. If set to 1, stitch the left and right row edges together.
  13317. This is the default behavior, for disabling set the value to 0.
  13318. @end table
  13319. @subsection Examples
  13320. @itemize
  13321. @item
  13322. Read the initial state from @file{pattern}, and specify an output of
  13323. size 200x400.
  13324. @example
  13325. cellauto=f=pattern:s=200x400
  13326. @end example
  13327. @item
  13328. Generate a random initial row with a width of 200 cells, with a fill
  13329. ratio of 2/3:
  13330. @example
  13331. cellauto=ratio=2/3:s=200x200
  13332. @end example
  13333. @item
  13334. Create a pattern generated by rule 18 starting by a single alive cell
  13335. centered on an initial row with width 100:
  13336. @example
  13337. cellauto=p=@@:s=100x400:full=0:rule=18
  13338. @end example
  13339. @item
  13340. Specify a more elaborated initial pattern:
  13341. @example
  13342. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13343. @end example
  13344. @end itemize
  13345. @anchor{coreimagesrc}
  13346. @section coreimagesrc
  13347. Video source generated on GPU using Apple's CoreImage API on OSX.
  13348. This video source is a specialized version of the @ref{coreimage} video filter.
  13349. Use a core image generator at the beginning of the applied filterchain to
  13350. generate the content.
  13351. The coreimagesrc video source accepts the following options:
  13352. @table @option
  13353. @item list_generators
  13354. List all available generators along with all their respective options as well as
  13355. possible minimum and maximum values along with the default values.
  13356. @example
  13357. list_generators=true
  13358. @end example
  13359. @item size, s
  13360. Specify the size of the sourced video. For the syntax of this option, check the
  13361. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13362. The default value is @code{320x240}.
  13363. @item rate, r
  13364. Specify the frame rate of the sourced video, as the number of frames
  13365. generated per second. It has to be a string in the format
  13366. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13367. number or a valid video frame rate abbreviation. The default value is
  13368. "25".
  13369. @item sar
  13370. Set the sample aspect ratio of the sourced video.
  13371. @item duration, d
  13372. Set the duration of the sourced video. See
  13373. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13374. for the accepted syntax.
  13375. If not specified, or the expressed duration is negative, the video is
  13376. supposed to be generated forever.
  13377. @end table
  13378. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13379. A complete filterchain can be used for further processing of the
  13380. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13381. and examples for details.
  13382. @subsection Examples
  13383. @itemize
  13384. @item
  13385. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13386. given as complete and escaped command-line for Apple's standard bash shell:
  13387. @example
  13388. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13389. @end example
  13390. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13391. need for a nullsrc video source.
  13392. @end itemize
  13393. @section mandelbrot
  13394. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13395. point specified with @var{start_x} and @var{start_y}.
  13396. This source accepts the following options:
  13397. @table @option
  13398. @item end_pts
  13399. Set the terminal pts value. Default value is 400.
  13400. @item end_scale
  13401. Set the terminal scale value.
  13402. Must be a floating point value. Default value is 0.3.
  13403. @item inner
  13404. Set the inner coloring mode, that is the algorithm used to draw the
  13405. Mandelbrot fractal internal region.
  13406. It shall assume one of the following values:
  13407. @table @option
  13408. @item black
  13409. Set black mode.
  13410. @item convergence
  13411. Show time until convergence.
  13412. @item mincol
  13413. Set color based on point closest to the origin of the iterations.
  13414. @item period
  13415. Set period mode.
  13416. @end table
  13417. Default value is @var{mincol}.
  13418. @item bailout
  13419. Set the bailout value. Default value is 10.0.
  13420. @item maxiter
  13421. Set the maximum of iterations performed by the rendering
  13422. algorithm. Default value is 7189.
  13423. @item outer
  13424. Set outer coloring mode.
  13425. It shall assume one of following values:
  13426. @table @option
  13427. @item iteration_count
  13428. Set iteration cound mode.
  13429. @item normalized_iteration_count
  13430. set normalized iteration count mode.
  13431. @end table
  13432. Default value is @var{normalized_iteration_count}.
  13433. @item rate, r
  13434. Set frame rate, expressed as number of frames per second. Default
  13435. value is "25".
  13436. @item size, s
  13437. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13438. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13439. @item start_scale
  13440. Set the initial scale value. Default value is 3.0.
  13441. @item start_x
  13442. Set the initial x position. Must be a floating point value between
  13443. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13444. @item start_y
  13445. Set the initial y position. Must be a floating point value between
  13446. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13447. @end table
  13448. @section mptestsrc
  13449. Generate various test patterns, as generated by the MPlayer test filter.
  13450. The size of the generated video is fixed, and is 256x256.
  13451. This source is useful in particular for testing encoding features.
  13452. This source accepts the following options:
  13453. @table @option
  13454. @item rate, r
  13455. Specify the frame rate of the sourced video, as the number of frames
  13456. generated per second. It has to be a string in the format
  13457. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13458. number or a valid video frame rate abbreviation. The default value is
  13459. "25".
  13460. @item duration, d
  13461. Set the duration of the sourced video. See
  13462. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13463. for the accepted syntax.
  13464. If not specified, or the expressed duration is negative, the video is
  13465. supposed to be generated forever.
  13466. @item test, t
  13467. Set the number or the name of the test to perform. Supported tests are:
  13468. @table @option
  13469. @item dc_luma
  13470. @item dc_chroma
  13471. @item freq_luma
  13472. @item freq_chroma
  13473. @item amp_luma
  13474. @item amp_chroma
  13475. @item cbp
  13476. @item mv
  13477. @item ring1
  13478. @item ring2
  13479. @item all
  13480. @end table
  13481. Default value is "all", which will cycle through the list of all tests.
  13482. @end table
  13483. Some examples:
  13484. @example
  13485. mptestsrc=t=dc_luma
  13486. @end example
  13487. will generate a "dc_luma" test pattern.
  13488. @section frei0r_src
  13489. Provide a frei0r source.
  13490. To enable compilation of this filter you need to install the frei0r
  13491. header and configure FFmpeg with @code{--enable-frei0r}.
  13492. This source accepts the following parameters:
  13493. @table @option
  13494. @item size
  13495. The size of the video to generate. For the syntax of this option, check the
  13496. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13497. @item framerate
  13498. The framerate of the generated video. It may be a string of the form
  13499. @var{num}/@var{den} or a frame rate abbreviation.
  13500. @item filter_name
  13501. The name to the frei0r source to load. For more information regarding frei0r and
  13502. how to set the parameters, read the @ref{frei0r} section in the video filters
  13503. documentation.
  13504. @item filter_params
  13505. A '|'-separated list of parameters to pass to the frei0r source.
  13506. @end table
  13507. For example, to generate a frei0r partik0l source with size 200x200
  13508. and frame rate 10 which is overlaid on the overlay filter main input:
  13509. @example
  13510. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13511. @end example
  13512. @section life
  13513. Generate a life pattern.
  13514. This source is based on a generalization of John Conway's life game.
  13515. The sourced input represents a life grid, each pixel represents a cell
  13516. which can be in one of two possible states, alive or dead. Every cell
  13517. interacts with its eight neighbours, which are the cells that are
  13518. horizontally, vertically, or diagonally adjacent.
  13519. At each interaction the grid evolves according to the adopted rule,
  13520. which specifies the number of neighbor alive cells which will make a
  13521. cell stay alive or born. The @option{rule} option allows one to specify
  13522. the rule to adopt.
  13523. This source accepts the following options:
  13524. @table @option
  13525. @item filename, f
  13526. Set the file from which to read the initial grid state. In the file,
  13527. each non-whitespace character is considered an alive cell, and newline
  13528. is used to delimit the end of each row.
  13529. If this option is not specified, the initial grid is generated
  13530. randomly.
  13531. @item rate, r
  13532. Set the video rate, that is the number of frames generated per second.
  13533. Default is 25.
  13534. @item random_fill_ratio, ratio
  13535. Set the random fill ratio for the initial random grid. It is a
  13536. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13537. It is ignored when a file is specified.
  13538. @item random_seed, seed
  13539. Set the seed for filling the initial random grid, must be an integer
  13540. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13541. set to -1, the filter will try to use a good random seed on a best
  13542. effort basis.
  13543. @item rule
  13544. Set the life rule.
  13545. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13546. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13547. @var{NS} specifies the number of alive neighbor cells which make a
  13548. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13549. which make a dead cell to become alive (i.e. to "born").
  13550. "s" and "b" can be used in place of "S" and "B", respectively.
  13551. Alternatively a rule can be specified by an 18-bits integer. The 9
  13552. high order bits are used to encode the next cell state if it is alive
  13553. for each number of neighbor alive cells, the low order bits specify
  13554. the rule for "borning" new cells. Higher order bits encode for an
  13555. higher number of neighbor cells.
  13556. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13557. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13558. Default value is "S23/B3", which is the original Conway's game of life
  13559. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13560. cells, and will born a new cell if there are three alive cells around
  13561. a dead cell.
  13562. @item size, s
  13563. Set the size of the output video. For the syntax of this option, check the
  13564. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13565. If @option{filename} is specified, the size is set by default to the
  13566. same size of the input file. If @option{size} is set, it must contain
  13567. the size specified in the input file, and the initial grid defined in
  13568. that file is centered in the larger resulting area.
  13569. If a filename is not specified, the size value defaults to "320x240"
  13570. (used for a randomly generated initial grid).
  13571. @item stitch
  13572. If set to 1, stitch the left and right grid edges together, and the
  13573. top and bottom edges also. Defaults to 1.
  13574. @item mold
  13575. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13576. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13577. value from 0 to 255.
  13578. @item life_color
  13579. Set the color of living (or new born) cells.
  13580. @item death_color
  13581. Set the color of dead cells. If @option{mold} is set, this is the first color
  13582. used to represent a dead cell.
  13583. @item mold_color
  13584. Set mold color, for definitely dead and moldy cells.
  13585. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13586. ffmpeg-utils manual,ffmpeg-utils}.
  13587. @end table
  13588. @subsection Examples
  13589. @itemize
  13590. @item
  13591. Read a grid from @file{pattern}, and center it on a grid of size
  13592. 300x300 pixels:
  13593. @example
  13594. life=f=pattern:s=300x300
  13595. @end example
  13596. @item
  13597. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13598. @example
  13599. life=ratio=2/3:s=200x200
  13600. @end example
  13601. @item
  13602. Specify a custom rule for evolving a randomly generated grid:
  13603. @example
  13604. life=rule=S14/B34
  13605. @end example
  13606. @item
  13607. Full example with slow death effect (mold) using @command{ffplay}:
  13608. @example
  13609. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13610. @end example
  13611. @end itemize
  13612. @anchor{allrgb}
  13613. @anchor{allyuv}
  13614. @anchor{color}
  13615. @anchor{haldclutsrc}
  13616. @anchor{nullsrc}
  13617. @anchor{pal75bars}
  13618. @anchor{pal100bars}
  13619. @anchor{rgbtestsrc}
  13620. @anchor{smptebars}
  13621. @anchor{smptehdbars}
  13622. @anchor{testsrc}
  13623. @anchor{testsrc2}
  13624. @anchor{yuvtestsrc}
  13625. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13626. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13627. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13628. The @code{color} source provides an uniformly colored input.
  13629. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13630. @ref{haldclut} filter.
  13631. The @code{nullsrc} source returns unprocessed video frames. It is
  13632. mainly useful to be employed in analysis / debugging tools, or as the
  13633. source for filters which ignore the input data.
  13634. The @code{pal75bars} source generates a color bars pattern, based on
  13635. EBU PAL recommendations with 75% color levels.
  13636. The @code{pal100bars} source generates a color bars pattern, based on
  13637. EBU PAL recommendations with 100% color levels.
  13638. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13639. detecting RGB vs BGR issues. You should see a red, green and blue
  13640. stripe from top to bottom.
  13641. The @code{smptebars} source generates a color bars pattern, based on
  13642. the SMPTE Engineering Guideline EG 1-1990.
  13643. The @code{smptehdbars} source generates a color bars pattern, based on
  13644. the SMPTE RP 219-2002.
  13645. The @code{testsrc} source generates a test video pattern, showing a
  13646. color pattern, a scrolling gradient and a timestamp. This is mainly
  13647. intended for testing purposes.
  13648. The @code{testsrc2} source is similar to testsrc, but supports more
  13649. pixel formats instead of just @code{rgb24}. This allows using it as an
  13650. input for other tests without requiring a format conversion.
  13651. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13652. see a y, cb and cr stripe from top to bottom.
  13653. The sources accept the following parameters:
  13654. @table @option
  13655. @item level
  13656. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13657. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13658. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13659. coded on a @code{1/(N*N)} scale.
  13660. @item color, c
  13661. Specify the color of the source, only available in the @code{color}
  13662. source. For the syntax of this option, check the
  13663. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13664. @item size, s
  13665. Specify the size of the sourced video. For the syntax of this option, check the
  13666. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13667. The default value is @code{320x240}.
  13668. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13669. @code{haldclutsrc} filters.
  13670. @item rate, r
  13671. Specify the frame rate of the sourced video, as the number of frames
  13672. generated per second. It has to be a string in the format
  13673. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13674. number or a valid video frame rate abbreviation. The default value is
  13675. "25".
  13676. @item duration, d
  13677. Set the duration of the sourced video. See
  13678. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13679. for the accepted syntax.
  13680. If not specified, or the expressed duration is negative, the video is
  13681. supposed to be generated forever.
  13682. @item sar
  13683. Set the sample aspect ratio of the sourced video.
  13684. @item alpha
  13685. Specify the alpha (opacity) of the background, only available in the
  13686. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13687. 255 (fully opaque, the default).
  13688. @item decimals, n
  13689. Set the number of decimals to show in the timestamp, only available in the
  13690. @code{testsrc} source.
  13691. The displayed timestamp value will correspond to the original
  13692. timestamp value multiplied by the power of 10 of the specified
  13693. value. Default value is 0.
  13694. @end table
  13695. @subsection Examples
  13696. @itemize
  13697. @item
  13698. Generate a video with a duration of 5.3 seconds, with size
  13699. 176x144 and a frame rate of 10 frames per second:
  13700. @example
  13701. testsrc=duration=5.3:size=qcif:rate=10
  13702. @end example
  13703. @item
  13704. The following graph description will generate a red source
  13705. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13706. frames per second:
  13707. @example
  13708. color=c=red@@0.2:s=qcif:r=10
  13709. @end example
  13710. @item
  13711. If the input content is to be ignored, @code{nullsrc} can be used. The
  13712. following command generates noise in the luminance plane by employing
  13713. the @code{geq} filter:
  13714. @example
  13715. nullsrc=s=256x256, geq=random(1)*255:128:128
  13716. @end example
  13717. @end itemize
  13718. @subsection Commands
  13719. The @code{color} source supports the following commands:
  13720. @table @option
  13721. @item c, color
  13722. Set the color of the created image. Accepts the same syntax of the
  13723. corresponding @option{color} option.
  13724. @end table
  13725. @section openclsrc
  13726. Generate video using an OpenCL program.
  13727. @table @option
  13728. @item source
  13729. OpenCL program source file.
  13730. @item kernel
  13731. Kernel name in program.
  13732. @item size, s
  13733. Size of frames to generate. This must be set.
  13734. @item format
  13735. Pixel format to use for the generated frames. This must be set.
  13736. @item rate, r
  13737. Number of frames generated every second. Default value is '25'.
  13738. @end table
  13739. For details of how the program loading works, see the @ref{program_opencl}
  13740. filter.
  13741. Example programs:
  13742. @itemize
  13743. @item
  13744. Generate a colour ramp by setting pixel values from the position of the pixel
  13745. in the output image. (Note that this will work with all pixel formats, but
  13746. the generated output will not be the same.)
  13747. @verbatim
  13748. __kernel void ramp(__write_only image2d_t dst,
  13749. unsigned int index)
  13750. {
  13751. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13752. float4 val;
  13753. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13754. write_imagef(dst, loc, val);
  13755. }
  13756. @end verbatim
  13757. @item
  13758. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13759. @verbatim
  13760. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13761. unsigned int index)
  13762. {
  13763. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13764. float4 value = 0.0f;
  13765. int x = loc.x + index;
  13766. int y = loc.y + index;
  13767. while (x > 0 || y > 0) {
  13768. if (x % 3 == 1 && y % 3 == 1) {
  13769. value = 1.0f;
  13770. break;
  13771. }
  13772. x /= 3;
  13773. y /= 3;
  13774. }
  13775. write_imagef(dst, loc, value);
  13776. }
  13777. @end verbatim
  13778. @end itemize
  13779. @c man end VIDEO SOURCES
  13780. @chapter Video Sinks
  13781. @c man begin VIDEO SINKS
  13782. Below is a description of the currently available video sinks.
  13783. @section buffersink
  13784. Buffer video frames, and make them available to the end of the filter
  13785. graph.
  13786. This sink is mainly intended for programmatic use, in particular
  13787. through the interface defined in @file{libavfilter/buffersink.h}
  13788. or the options system.
  13789. It accepts a pointer to an AVBufferSinkContext structure, which
  13790. defines the incoming buffers' formats, to be passed as the opaque
  13791. parameter to @code{avfilter_init_filter} for initialization.
  13792. @section nullsink
  13793. Null video sink: do absolutely nothing with the input video. It is
  13794. mainly useful as a template and for use in analysis / debugging
  13795. tools.
  13796. @c man end VIDEO SINKS
  13797. @chapter Multimedia Filters
  13798. @c man begin MULTIMEDIA FILTERS
  13799. Below is a description of the currently available multimedia filters.
  13800. @section abitscope
  13801. Convert input audio to a video output, displaying the audio bit scope.
  13802. The filter accepts the following options:
  13803. @table @option
  13804. @item rate, r
  13805. Set frame rate, expressed as number of frames per second. Default
  13806. value is "25".
  13807. @item size, s
  13808. Specify the video size for the output. For the syntax of this option, check the
  13809. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13810. Default value is @code{1024x256}.
  13811. @item colors
  13812. Specify list of colors separated by space or by '|' which will be used to
  13813. draw channels. Unrecognized or missing colors will be replaced
  13814. by white color.
  13815. @end table
  13816. @section ahistogram
  13817. Convert input audio to a video output, displaying the volume histogram.
  13818. The filter accepts the following options:
  13819. @table @option
  13820. @item dmode
  13821. Specify how histogram is calculated.
  13822. It accepts the following values:
  13823. @table @samp
  13824. @item single
  13825. Use single histogram for all channels.
  13826. @item separate
  13827. Use separate histogram for each channel.
  13828. @end table
  13829. Default is @code{single}.
  13830. @item rate, r
  13831. Set frame rate, expressed as number of frames per second. Default
  13832. value is "25".
  13833. @item size, s
  13834. Specify the video size for the output. For the syntax of this option, check the
  13835. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13836. Default value is @code{hd720}.
  13837. @item scale
  13838. Set display scale.
  13839. It accepts the following values:
  13840. @table @samp
  13841. @item log
  13842. logarithmic
  13843. @item sqrt
  13844. square root
  13845. @item cbrt
  13846. cubic root
  13847. @item lin
  13848. linear
  13849. @item rlog
  13850. reverse logarithmic
  13851. @end table
  13852. Default is @code{log}.
  13853. @item ascale
  13854. Set amplitude scale.
  13855. It accepts the following values:
  13856. @table @samp
  13857. @item log
  13858. logarithmic
  13859. @item lin
  13860. linear
  13861. @end table
  13862. Default is @code{log}.
  13863. @item acount
  13864. Set how much frames to accumulate in histogram.
  13865. Defauls is 1. Setting this to -1 accumulates all frames.
  13866. @item rheight
  13867. Set histogram ratio of window height.
  13868. @item slide
  13869. Set sonogram sliding.
  13870. It accepts the following values:
  13871. @table @samp
  13872. @item replace
  13873. replace old rows with new ones.
  13874. @item scroll
  13875. scroll from top to bottom.
  13876. @end table
  13877. Default is @code{replace}.
  13878. @end table
  13879. @section aphasemeter
  13880. Convert input audio to a video output, displaying the audio phase.
  13881. The filter accepts the following options:
  13882. @table @option
  13883. @item rate, r
  13884. Set the output frame rate. Default value is @code{25}.
  13885. @item size, s
  13886. Set the video size for the output. For the syntax of this option, check the
  13887. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13888. Default value is @code{800x400}.
  13889. @item rc
  13890. @item gc
  13891. @item bc
  13892. Specify the red, green, blue contrast. Default values are @code{2},
  13893. @code{7} and @code{1}.
  13894. Allowed range is @code{[0, 255]}.
  13895. @item mpc
  13896. Set color which will be used for drawing median phase. If color is
  13897. @code{none} which is default, no median phase value will be drawn.
  13898. @item video
  13899. Enable video output. Default is enabled.
  13900. @end table
  13901. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13902. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13903. The @code{-1} means left and right channels are completely out of phase and
  13904. @code{1} means channels are in phase.
  13905. @section avectorscope
  13906. Convert input audio to a video output, representing the audio vector
  13907. scope.
  13908. The filter is used to measure the difference between channels of stereo
  13909. audio stream. A monoaural signal, consisting of identical left and right
  13910. signal, results in straight vertical line. Any stereo separation is visible
  13911. as a deviation from this line, creating a Lissajous figure.
  13912. If the straight (or deviation from it) but horizontal line appears this
  13913. indicates that the left and right channels are out of phase.
  13914. The filter accepts the following options:
  13915. @table @option
  13916. @item mode, m
  13917. Set the vectorscope mode.
  13918. Available values are:
  13919. @table @samp
  13920. @item lissajous
  13921. Lissajous rotated by 45 degrees.
  13922. @item lissajous_xy
  13923. Same as above but not rotated.
  13924. @item polar
  13925. Shape resembling half of circle.
  13926. @end table
  13927. Default value is @samp{lissajous}.
  13928. @item size, s
  13929. Set the video size for the output. For the syntax of this option, check the
  13930. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13931. Default value is @code{400x400}.
  13932. @item rate, r
  13933. Set the output frame rate. Default value is @code{25}.
  13934. @item rc
  13935. @item gc
  13936. @item bc
  13937. @item ac
  13938. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13939. @code{160}, @code{80} and @code{255}.
  13940. Allowed range is @code{[0, 255]}.
  13941. @item rf
  13942. @item gf
  13943. @item bf
  13944. @item af
  13945. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13946. @code{10}, @code{5} and @code{5}.
  13947. Allowed range is @code{[0, 255]}.
  13948. @item zoom
  13949. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13950. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13951. @item draw
  13952. Set the vectorscope drawing mode.
  13953. Available values are:
  13954. @table @samp
  13955. @item dot
  13956. Draw dot for each sample.
  13957. @item line
  13958. Draw line between previous and current sample.
  13959. @end table
  13960. Default value is @samp{dot}.
  13961. @item scale
  13962. Specify amplitude scale of audio samples.
  13963. Available values are:
  13964. @table @samp
  13965. @item lin
  13966. Linear.
  13967. @item sqrt
  13968. Square root.
  13969. @item cbrt
  13970. Cubic root.
  13971. @item log
  13972. Logarithmic.
  13973. @end table
  13974. @item swap
  13975. Swap left channel axis with right channel axis.
  13976. @item mirror
  13977. Mirror axis.
  13978. @table @samp
  13979. @item none
  13980. No mirror.
  13981. @item x
  13982. Mirror only x axis.
  13983. @item y
  13984. Mirror only y axis.
  13985. @item xy
  13986. Mirror both axis.
  13987. @end table
  13988. @end table
  13989. @subsection Examples
  13990. @itemize
  13991. @item
  13992. Complete example using @command{ffplay}:
  13993. @example
  13994. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13995. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13996. @end example
  13997. @end itemize
  13998. @section bench, abench
  13999. Benchmark part of a filtergraph.
  14000. The filter accepts the following options:
  14001. @table @option
  14002. @item action
  14003. Start or stop a timer.
  14004. Available values are:
  14005. @table @samp
  14006. @item start
  14007. Get the current time, set it as frame metadata (using the key
  14008. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  14009. @item stop
  14010. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  14011. the input frame metadata to get the time difference. Time difference, average,
  14012. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  14013. @code{min}) are then printed. The timestamps are expressed in seconds.
  14014. @end table
  14015. @end table
  14016. @subsection Examples
  14017. @itemize
  14018. @item
  14019. Benchmark @ref{selectivecolor} filter:
  14020. @example
  14021. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14022. @end example
  14023. @end itemize
  14024. @section concat
  14025. Concatenate audio and video streams, joining them together one after the
  14026. other.
  14027. The filter works on segments of synchronized video and audio streams. All
  14028. segments must have the same number of streams of each type, and that will
  14029. also be the number of streams at output.
  14030. The filter accepts the following options:
  14031. @table @option
  14032. @item n
  14033. Set the number of segments. Default is 2.
  14034. @item v
  14035. Set the number of output video streams, that is also the number of video
  14036. streams in each segment. Default is 1.
  14037. @item a
  14038. Set the number of output audio streams, that is also the number of audio
  14039. streams in each segment. Default is 0.
  14040. @item unsafe
  14041. Activate unsafe mode: do not fail if segments have a different format.
  14042. @end table
  14043. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14044. @var{a} audio outputs.
  14045. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14046. segment, in the same order as the outputs, then the inputs for the second
  14047. segment, etc.
  14048. Related streams do not always have exactly the same duration, for various
  14049. reasons including codec frame size or sloppy authoring. For that reason,
  14050. related synchronized streams (e.g. a video and its audio track) should be
  14051. concatenated at once. The concat filter will use the duration of the longest
  14052. stream in each segment (except the last one), and if necessary pad shorter
  14053. audio streams with silence.
  14054. For this filter to work correctly, all segments must start at timestamp 0.
  14055. All corresponding streams must have the same parameters in all segments; the
  14056. filtering system will automatically select a common pixel format for video
  14057. streams, and a common sample format, sample rate and channel layout for
  14058. audio streams, but other settings, such as resolution, must be converted
  14059. explicitly by the user.
  14060. Different frame rates are acceptable but will result in variable frame rate
  14061. at output; be sure to configure the output file to handle it.
  14062. @subsection Examples
  14063. @itemize
  14064. @item
  14065. Concatenate an opening, an episode and an ending, all in bilingual version
  14066. (video in stream 0, audio in streams 1 and 2):
  14067. @example
  14068. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14069. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14070. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14071. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14072. @end example
  14073. @item
  14074. Concatenate two parts, handling audio and video separately, using the
  14075. (a)movie sources, and adjusting the resolution:
  14076. @example
  14077. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14078. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14079. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14080. @end example
  14081. Note that a desync will happen at the stitch if the audio and video streams
  14082. do not have exactly the same duration in the first file.
  14083. @end itemize
  14084. @subsection Commands
  14085. This filter supports the following commands:
  14086. @table @option
  14087. @item next
  14088. Close the current segment and step to the next one
  14089. @end table
  14090. @section drawgraph, adrawgraph
  14091. Draw a graph using input video or audio metadata.
  14092. It accepts the following parameters:
  14093. @table @option
  14094. @item m1
  14095. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14096. @item fg1
  14097. Set 1st foreground color expression.
  14098. @item m2
  14099. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14100. @item fg2
  14101. Set 2nd foreground color expression.
  14102. @item m3
  14103. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14104. @item fg3
  14105. Set 3rd foreground color expression.
  14106. @item m4
  14107. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14108. @item fg4
  14109. Set 4th foreground color expression.
  14110. @item min
  14111. Set minimal value of metadata value.
  14112. @item max
  14113. Set maximal value of metadata value.
  14114. @item bg
  14115. Set graph background color. Default is white.
  14116. @item mode
  14117. Set graph mode.
  14118. Available values for mode is:
  14119. @table @samp
  14120. @item bar
  14121. @item dot
  14122. @item line
  14123. @end table
  14124. Default is @code{line}.
  14125. @item slide
  14126. Set slide mode.
  14127. Available values for slide is:
  14128. @table @samp
  14129. @item frame
  14130. Draw new frame when right border is reached.
  14131. @item replace
  14132. Replace old columns with new ones.
  14133. @item scroll
  14134. Scroll from right to left.
  14135. @item rscroll
  14136. Scroll from left to right.
  14137. @item picture
  14138. Draw single picture.
  14139. @end table
  14140. Default is @code{frame}.
  14141. @item size
  14142. Set size of graph video. For the syntax of this option, check the
  14143. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14144. The default value is @code{900x256}.
  14145. The foreground color expressions can use the following variables:
  14146. @table @option
  14147. @item MIN
  14148. Minimal value of metadata value.
  14149. @item MAX
  14150. Maximal value of metadata value.
  14151. @item VAL
  14152. Current metadata key value.
  14153. @end table
  14154. The color is defined as 0xAABBGGRR.
  14155. @end table
  14156. Example using metadata from @ref{signalstats} filter:
  14157. @example
  14158. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14159. @end example
  14160. Example using metadata from @ref{ebur128} filter:
  14161. @example
  14162. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14163. @end example
  14164. @anchor{ebur128}
  14165. @section ebur128
  14166. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14167. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14168. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14169. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14170. The filter also has a video output (see the @var{video} option) with a real
  14171. time graph to observe the loudness evolution. The graphic contains the logged
  14172. message mentioned above, so it is not printed anymore when this option is set,
  14173. unless the verbose logging is set. The main graphing area contains the
  14174. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14175. the momentary loudness (400 milliseconds).
  14176. More information about the Loudness Recommendation EBU R128 on
  14177. @url{http://tech.ebu.ch/loudness}.
  14178. The filter accepts the following options:
  14179. @table @option
  14180. @item video
  14181. Activate the video output. The audio stream is passed unchanged whether this
  14182. option is set or no. The video stream will be the first output stream if
  14183. activated. Default is @code{0}.
  14184. @item size
  14185. Set the video size. This option is for video only. For the syntax of this
  14186. option, check the
  14187. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14188. Default and minimum resolution is @code{640x480}.
  14189. @item meter
  14190. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14191. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14192. other integer value between this range is allowed.
  14193. @item metadata
  14194. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14195. into 100ms output frames, each of them containing various loudness information
  14196. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14197. Default is @code{0}.
  14198. @item framelog
  14199. Force the frame logging level.
  14200. Available values are:
  14201. @table @samp
  14202. @item info
  14203. information logging level
  14204. @item verbose
  14205. verbose logging level
  14206. @end table
  14207. By default, the logging level is set to @var{info}. If the @option{video} or
  14208. the @option{metadata} options are set, it switches to @var{verbose}.
  14209. @item peak
  14210. Set peak mode(s).
  14211. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14212. values are:
  14213. @table @samp
  14214. @item none
  14215. Disable any peak mode (default).
  14216. @item sample
  14217. Enable sample-peak mode.
  14218. Simple peak mode looking for the higher sample value. It logs a message
  14219. for sample-peak (identified by @code{SPK}).
  14220. @item true
  14221. Enable true-peak mode.
  14222. If enabled, the peak lookup is done on an over-sampled version of the input
  14223. stream for better peak accuracy. It logs a message for true-peak.
  14224. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14225. This mode requires a build with @code{libswresample}.
  14226. @end table
  14227. @item dualmono
  14228. Treat mono input files as "dual mono". If a mono file is intended for playback
  14229. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14230. If set to @code{true}, this option will compensate for this effect.
  14231. Multi-channel input files are not affected by this option.
  14232. @item panlaw
  14233. Set a specific pan law to be used for the measurement of dual mono files.
  14234. This parameter is optional, and has a default value of -3.01dB.
  14235. @end table
  14236. @subsection Examples
  14237. @itemize
  14238. @item
  14239. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14240. @example
  14241. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14242. @end example
  14243. @item
  14244. Run an analysis with @command{ffmpeg}:
  14245. @example
  14246. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14247. @end example
  14248. @end itemize
  14249. @section interleave, ainterleave
  14250. Temporally interleave frames from several inputs.
  14251. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14252. These filters read frames from several inputs and send the oldest
  14253. queued frame to the output.
  14254. Input streams must have well defined, monotonically increasing frame
  14255. timestamp values.
  14256. In order to submit one frame to output, these filters need to enqueue
  14257. at least one frame for each input, so they cannot work in case one
  14258. input is not yet terminated and will not receive incoming frames.
  14259. For example consider the case when one input is a @code{select} filter
  14260. which always drops input frames. The @code{interleave} filter will keep
  14261. reading from that input, but it will never be able to send new frames
  14262. to output until the input sends an end-of-stream signal.
  14263. Also, depending on inputs synchronization, the filters will drop
  14264. frames in case one input receives more frames than the other ones, and
  14265. the queue is already filled.
  14266. These filters accept the following options:
  14267. @table @option
  14268. @item nb_inputs, n
  14269. Set the number of different inputs, it is 2 by default.
  14270. @end table
  14271. @subsection Examples
  14272. @itemize
  14273. @item
  14274. Interleave frames belonging to different streams using @command{ffmpeg}:
  14275. @example
  14276. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14277. @end example
  14278. @item
  14279. Add flickering blur effect:
  14280. @example
  14281. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14282. @end example
  14283. @end itemize
  14284. @section metadata, ametadata
  14285. Manipulate frame metadata.
  14286. This filter accepts the following options:
  14287. @table @option
  14288. @item mode
  14289. Set mode of operation of the filter.
  14290. Can be one of the following:
  14291. @table @samp
  14292. @item select
  14293. If both @code{value} and @code{key} is set, select frames
  14294. which have such metadata. If only @code{key} is set, select
  14295. every frame that has such key in metadata.
  14296. @item add
  14297. Add new metadata @code{key} and @code{value}. If key is already available
  14298. do nothing.
  14299. @item modify
  14300. Modify value of already present key.
  14301. @item delete
  14302. If @code{value} is set, delete only keys that have such value.
  14303. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14304. the frame.
  14305. @item print
  14306. Print key and its value if metadata was found. If @code{key} is not set print all
  14307. metadata values available in frame.
  14308. @end table
  14309. @item key
  14310. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14311. @item value
  14312. Set metadata value which will be used. This option is mandatory for
  14313. @code{modify} and @code{add} mode.
  14314. @item function
  14315. Which function to use when comparing metadata value and @code{value}.
  14316. Can be one of following:
  14317. @table @samp
  14318. @item same_str
  14319. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14320. @item starts_with
  14321. Values are interpreted as strings, returns true if metadata value starts with
  14322. the @code{value} option string.
  14323. @item less
  14324. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14325. @item equal
  14326. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14327. @item greater
  14328. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14329. @item expr
  14330. Values are interpreted as floats, returns true if expression from option @code{expr}
  14331. evaluates to true.
  14332. @end table
  14333. @item expr
  14334. Set expression which is used when @code{function} is set to @code{expr}.
  14335. The expression is evaluated through the eval API and can contain the following
  14336. constants:
  14337. @table @option
  14338. @item VALUE1
  14339. Float representation of @code{value} from metadata key.
  14340. @item VALUE2
  14341. Float representation of @code{value} as supplied by user in @code{value} option.
  14342. @end table
  14343. @item file
  14344. If specified in @code{print} mode, output is written to the named file. Instead of
  14345. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14346. for standard output. If @code{file} option is not set, output is written to the log
  14347. with AV_LOG_INFO loglevel.
  14348. @end table
  14349. @subsection Examples
  14350. @itemize
  14351. @item
  14352. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14353. between 0 and 1.
  14354. @example
  14355. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14356. @end example
  14357. @item
  14358. Print silencedetect output to file @file{metadata.txt}.
  14359. @example
  14360. silencedetect,ametadata=mode=print:file=metadata.txt
  14361. @end example
  14362. @item
  14363. Direct all metadata to a pipe with file descriptor 4.
  14364. @example
  14365. metadata=mode=print:file='pipe\:4'
  14366. @end example
  14367. @end itemize
  14368. @section perms, aperms
  14369. Set read/write permissions for the output frames.
  14370. These filters are mainly aimed at developers to test direct path in the
  14371. following filter in the filtergraph.
  14372. The filters accept the following options:
  14373. @table @option
  14374. @item mode
  14375. Select the permissions mode.
  14376. It accepts the following values:
  14377. @table @samp
  14378. @item none
  14379. Do nothing. This is the default.
  14380. @item ro
  14381. Set all the output frames read-only.
  14382. @item rw
  14383. Set all the output frames directly writable.
  14384. @item toggle
  14385. Make the frame read-only if writable, and writable if read-only.
  14386. @item random
  14387. Set each output frame read-only or writable randomly.
  14388. @end table
  14389. @item seed
  14390. Set the seed for the @var{random} mode, must be an integer included between
  14391. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14392. @code{-1}, the filter will try to use a good random seed on a best effort
  14393. basis.
  14394. @end table
  14395. Note: in case of auto-inserted filter between the permission filter and the
  14396. following one, the permission might not be received as expected in that
  14397. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14398. perms/aperms filter can avoid this problem.
  14399. @section realtime, arealtime
  14400. Slow down filtering to match real time approximately.
  14401. These filters will pause the filtering for a variable amount of time to
  14402. match the output rate with the input timestamps.
  14403. They are similar to the @option{re} option to @code{ffmpeg}.
  14404. They accept the following options:
  14405. @table @option
  14406. @item limit
  14407. Time limit for the pauses. Any pause longer than that will be considered
  14408. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14409. @end table
  14410. @anchor{select}
  14411. @section select, aselect
  14412. Select frames to pass in output.
  14413. This filter accepts the following options:
  14414. @table @option
  14415. @item expr, e
  14416. Set expression, which is evaluated for each input frame.
  14417. If the expression is evaluated to zero, the frame is discarded.
  14418. If the evaluation result is negative or NaN, the frame is sent to the
  14419. first output; otherwise it is sent to the output with index
  14420. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14421. For example a value of @code{1.2} corresponds to the output with index
  14422. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14423. @item outputs, n
  14424. Set the number of outputs. The output to which to send the selected
  14425. frame is based on the result of the evaluation. Default value is 1.
  14426. @end table
  14427. The expression can contain the following constants:
  14428. @table @option
  14429. @item n
  14430. The (sequential) number of the filtered frame, starting from 0.
  14431. @item selected_n
  14432. The (sequential) number of the selected frame, starting from 0.
  14433. @item prev_selected_n
  14434. The sequential number of the last selected frame. It's NAN if undefined.
  14435. @item TB
  14436. The timebase of the input timestamps.
  14437. @item pts
  14438. The PTS (Presentation TimeStamp) of the filtered video frame,
  14439. expressed in @var{TB} units. It's NAN if undefined.
  14440. @item t
  14441. The PTS of the filtered video frame,
  14442. expressed in seconds. It's NAN if undefined.
  14443. @item prev_pts
  14444. The PTS of the previously filtered video frame. It's NAN if undefined.
  14445. @item prev_selected_pts
  14446. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14447. @item prev_selected_t
  14448. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14449. @item start_pts
  14450. The PTS of the first video frame in the video. It's NAN if undefined.
  14451. @item start_t
  14452. The time of the first video frame in the video. It's NAN if undefined.
  14453. @item pict_type @emph{(video only)}
  14454. The type of the filtered frame. It can assume one of the following
  14455. values:
  14456. @table @option
  14457. @item I
  14458. @item P
  14459. @item B
  14460. @item S
  14461. @item SI
  14462. @item SP
  14463. @item BI
  14464. @end table
  14465. @item interlace_type @emph{(video only)}
  14466. The frame interlace type. It can assume one of the following values:
  14467. @table @option
  14468. @item PROGRESSIVE
  14469. The frame is progressive (not interlaced).
  14470. @item TOPFIRST
  14471. The frame is top-field-first.
  14472. @item BOTTOMFIRST
  14473. The frame is bottom-field-first.
  14474. @end table
  14475. @item consumed_sample_n @emph{(audio only)}
  14476. the number of selected samples before the current frame
  14477. @item samples_n @emph{(audio only)}
  14478. the number of samples in the current frame
  14479. @item sample_rate @emph{(audio only)}
  14480. the input sample rate
  14481. @item key
  14482. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14483. @item pos
  14484. the position in the file of the filtered frame, -1 if the information
  14485. is not available (e.g. for synthetic video)
  14486. @item scene @emph{(video only)}
  14487. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14488. probability for the current frame to introduce a new scene, while a higher
  14489. value means the current frame is more likely to be one (see the example below)
  14490. @item concatdec_select
  14491. The concat demuxer can select only part of a concat input file by setting an
  14492. inpoint and an outpoint, but the output packets may not be entirely contained
  14493. in the selected interval. By using this variable, it is possible to skip frames
  14494. generated by the concat demuxer which are not exactly contained in the selected
  14495. interval.
  14496. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14497. and the @var{lavf.concat.duration} packet metadata values which are also
  14498. present in the decoded frames.
  14499. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14500. start_time and either the duration metadata is missing or the frame pts is less
  14501. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14502. missing.
  14503. That basically means that an input frame is selected if its pts is within the
  14504. interval set by the concat demuxer.
  14505. @end table
  14506. The default value of the select expression is "1".
  14507. @subsection Examples
  14508. @itemize
  14509. @item
  14510. Select all frames in input:
  14511. @example
  14512. select
  14513. @end example
  14514. The example above is the same as:
  14515. @example
  14516. select=1
  14517. @end example
  14518. @item
  14519. Skip all frames:
  14520. @example
  14521. select=0
  14522. @end example
  14523. @item
  14524. Select only I-frames:
  14525. @example
  14526. select='eq(pict_type\,I)'
  14527. @end example
  14528. @item
  14529. Select one frame every 100:
  14530. @example
  14531. select='not(mod(n\,100))'
  14532. @end example
  14533. @item
  14534. Select only frames contained in the 10-20 time interval:
  14535. @example
  14536. select=between(t\,10\,20)
  14537. @end example
  14538. @item
  14539. Select only I-frames contained in the 10-20 time interval:
  14540. @example
  14541. select=between(t\,10\,20)*eq(pict_type\,I)
  14542. @end example
  14543. @item
  14544. Select frames with a minimum distance of 10 seconds:
  14545. @example
  14546. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14547. @end example
  14548. @item
  14549. Use aselect to select only audio frames with samples number > 100:
  14550. @example
  14551. aselect='gt(samples_n\,100)'
  14552. @end example
  14553. @item
  14554. Create a mosaic of the first scenes:
  14555. @example
  14556. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14557. @end example
  14558. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14559. choice.
  14560. @item
  14561. Send even and odd frames to separate outputs, and compose them:
  14562. @example
  14563. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14564. @end example
  14565. @item
  14566. Select useful frames from an ffconcat file which is using inpoints and
  14567. outpoints but where the source files are not intra frame only.
  14568. @example
  14569. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14570. @end example
  14571. @end itemize
  14572. @section sendcmd, asendcmd
  14573. Send commands to filters in the filtergraph.
  14574. These filters read commands to be sent to other filters in the
  14575. filtergraph.
  14576. @code{sendcmd} must be inserted between two video filters,
  14577. @code{asendcmd} must be inserted between two audio filters, but apart
  14578. from that they act the same way.
  14579. The specification of commands can be provided in the filter arguments
  14580. with the @var{commands} option, or in a file specified by the
  14581. @var{filename} option.
  14582. These filters accept the following options:
  14583. @table @option
  14584. @item commands, c
  14585. Set the commands to be read and sent to the other filters.
  14586. @item filename, f
  14587. Set the filename of the commands to be read and sent to the other
  14588. filters.
  14589. @end table
  14590. @subsection Commands syntax
  14591. A commands description consists of a sequence of interval
  14592. specifications, comprising a list of commands to be executed when a
  14593. particular event related to that interval occurs. The occurring event
  14594. is typically the current frame time entering or leaving a given time
  14595. interval.
  14596. An interval is specified by the following syntax:
  14597. @example
  14598. @var{START}[-@var{END}] @var{COMMANDS};
  14599. @end example
  14600. The time interval is specified by the @var{START} and @var{END} times.
  14601. @var{END} is optional and defaults to the maximum time.
  14602. The current frame time is considered within the specified interval if
  14603. it is included in the interval [@var{START}, @var{END}), that is when
  14604. the time is greater or equal to @var{START} and is lesser than
  14605. @var{END}.
  14606. @var{COMMANDS} consists of a sequence of one or more command
  14607. specifications, separated by ",", relating to that interval. The
  14608. syntax of a command specification is given by:
  14609. @example
  14610. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14611. @end example
  14612. @var{FLAGS} is optional and specifies the type of events relating to
  14613. the time interval which enable sending the specified command, and must
  14614. be a non-null sequence of identifier flags separated by "+" or "|" and
  14615. enclosed between "[" and "]".
  14616. The following flags are recognized:
  14617. @table @option
  14618. @item enter
  14619. The command is sent when the current frame timestamp enters the
  14620. specified interval. In other words, the command is sent when the
  14621. previous frame timestamp was not in the given interval, and the
  14622. current is.
  14623. @item leave
  14624. The command is sent when the current frame timestamp leaves the
  14625. specified interval. In other words, the command is sent when the
  14626. previous frame timestamp was in the given interval, and the
  14627. current is not.
  14628. @end table
  14629. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14630. assumed.
  14631. @var{TARGET} specifies the target of the command, usually the name of
  14632. the filter class or a specific filter instance name.
  14633. @var{COMMAND} specifies the name of the command for the target filter.
  14634. @var{ARG} is optional and specifies the optional list of argument for
  14635. the given @var{COMMAND}.
  14636. Between one interval specification and another, whitespaces, or
  14637. sequences of characters starting with @code{#} until the end of line,
  14638. are ignored and can be used to annotate comments.
  14639. A simplified BNF description of the commands specification syntax
  14640. follows:
  14641. @example
  14642. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14643. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14644. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14645. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14646. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14647. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14648. @end example
  14649. @subsection Examples
  14650. @itemize
  14651. @item
  14652. Specify audio tempo change at second 4:
  14653. @example
  14654. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14655. @end example
  14656. @item
  14657. Target a specific filter instance:
  14658. @example
  14659. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14660. @end example
  14661. @item
  14662. Specify a list of drawtext and hue commands in a file.
  14663. @example
  14664. # show text in the interval 5-10
  14665. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14666. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14667. # desaturate the image in the interval 15-20
  14668. 15.0-20.0 [enter] hue s 0,
  14669. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14670. [leave] hue s 1,
  14671. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14672. # apply an exponential saturation fade-out effect, starting from time 25
  14673. 25 [enter] hue s exp(25-t)
  14674. @end example
  14675. A filtergraph allowing to read and process the above command list
  14676. stored in a file @file{test.cmd}, can be specified with:
  14677. @example
  14678. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14679. @end example
  14680. @end itemize
  14681. @anchor{setpts}
  14682. @section setpts, asetpts
  14683. Change the PTS (presentation timestamp) of the input frames.
  14684. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14685. This filter accepts the following options:
  14686. @table @option
  14687. @item expr
  14688. The expression which is evaluated for each frame to construct its timestamp.
  14689. @end table
  14690. The expression is evaluated through the eval API and can contain the following
  14691. constants:
  14692. @table @option
  14693. @item FRAME_RATE
  14694. frame rate, only defined for constant frame-rate video
  14695. @item PTS
  14696. The presentation timestamp in input
  14697. @item N
  14698. The count of the input frame for video or the number of consumed samples,
  14699. not including the current frame for audio, starting from 0.
  14700. @item NB_CONSUMED_SAMPLES
  14701. The number of consumed samples, not including the current frame (only
  14702. audio)
  14703. @item NB_SAMPLES, S
  14704. The number of samples in the current frame (only audio)
  14705. @item SAMPLE_RATE, SR
  14706. The audio sample rate.
  14707. @item STARTPTS
  14708. The PTS of the first frame.
  14709. @item STARTT
  14710. the time in seconds of the first frame
  14711. @item INTERLACED
  14712. State whether the current frame is interlaced.
  14713. @item T
  14714. the time in seconds of the current frame
  14715. @item POS
  14716. original position in the file of the frame, or undefined if undefined
  14717. for the current frame
  14718. @item PREV_INPTS
  14719. The previous input PTS.
  14720. @item PREV_INT
  14721. previous input time in seconds
  14722. @item PREV_OUTPTS
  14723. The previous output PTS.
  14724. @item PREV_OUTT
  14725. previous output time in seconds
  14726. @item RTCTIME
  14727. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14728. instead.
  14729. @item RTCSTART
  14730. The wallclock (RTC) time at the start of the movie in microseconds.
  14731. @item TB
  14732. The timebase of the input timestamps.
  14733. @end table
  14734. @subsection Examples
  14735. @itemize
  14736. @item
  14737. Start counting PTS from zero
  14738. @example
  14739. setpts=PTS-STARTPTS
  14740. @end example
  14741. @item
  14742. Apply fast motion effect:
  14743. @example
  14744. setpts=0.5*PTS
  14745. @end example
  14746. @item
  14747. Apply slow motion effect:
  14748. @example
  14749. setpts=2.0*PTS
  14750. @end example
  14751. @item
  14752. Set fixed rate of 25 frames per second:
  14753. @example
  14754. setpts=N/(25*TB)
  14755. @end example
  14756. @item
  14757. Set fixed rate 25 fps with some jitter:
  14758. @example
  14759. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14760. @end example
  14761. @item
  14762. Apply an offset of 10 seconds to the input PTS:
  14763. @example
  14764. setpts=PTS+10/TB
  14765. @end example
  14766. @item
  14767. Generate timestamps from a "live source" and rebase onto the current timebase:
  14768. @example
  14769. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14770. @end example
  14771. @item
  14772. Generate timestamps by counting samples:
  14773. @example
  14774. asetpts=N/SR/TB
  14775. @end example
  14776. @end itemize
  14777. @section setrange
  14778. Force color range for the output video frame.
  14779. The @code{setrange} filter marks the color range property for the
  14780. output frames. It does not change the input frame, but only sets the
  14781. corresponding property, which affects how the frame is treated by
  14782. following filters.
  14783. The filter accepts the following options:
  14784. @table @option
  14785. @item range
  14786. Available values are:
  14787. @table @samp
  14788. @item auto
  14789. Keep the same color range property.
  14790. @item unspecified, unknown
  14791. Set the color range as unspecified.
  14792. @item limited, tv, mpeg
  14793. Set the color range as limited.
  14794. @item full, pc, jpeg
  14795. Set the color range as full.
  14796. @end table
  14797. @end table
  14798. @section settb, asettb
  14799. Set the timebase to use for the output frames timestamps.
  14800. It is mainly useful for testing timebase configuration.
  14801. It accepts the following parameters:
  14802. @table @option
  14803. @item expr, tb
  14804. The expression which is evaluated into the output timebase.
  14805. @end table
  14806. The value for @option{tb} is an arithmetic expression representing a
  14807. rational. The expression can contain the constants "AVTB" (the default
  14808. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14809. audio only). Default value is "intb".
  14810. @subsection Examples
  14811. @itemize
  14812. @item
  14813. Set the timebase to 1/25:
  14814. @example
  14815. settb=expr=1/25
  14816. @end example
  14817. @item
  14818. Set the timebase to 1/10:
  14819. @example
  14820. settb=expr=0.1
  14821. @end example
  14822. @item
  14823. Set the timebase to 1001/1000:
  14824. @example
  14825. settb=1+0.001
  14826. @end example
  14827. @item
  14828. Set the timebase to 2*intb:
  14829. @example
  14830. settb=2*intb
  14831. @end example
  14832. @item
  14833. Set the default timebase value:
  14834. @example
  14835. settb=AVTB
  14836. @end example
  14837. @end itemize
  14838. @section showcqt
  14839. Convert input audio to a video output representing frequency spectrum
  14840. logarithmically using Brown-Puckette constant Q transform algorithm with
  14841. direct frequency domain coefficient calculation (but the transform itself
  14842. is not really constant Q, instead the Q factor is actually variable/clamped),
  14843. with musical tone scale, from E0 to D#10.
  14844. The filter accepts the following options:
  14845. @table @option
  14846. @item size, s
  14847. Specify the video size for the output. It must be even. For the syntax of this option,
  14848. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14849. Default value is @code{1920x1080}.
  14850. @item fps, rate, r
  14851. Set the output frame rate. Default value is @code{25}.
  14852. @item bar_h
  14853. Set the bargraph height. It must be even. Default value is @code{-1} which
  14854. computes the bargraph height automatically.
  14855. @item axis_h
  14856. Set the axis height. It must be even. Default value is @code{-1} which computes
  14857. the axis height automatically.
  14858. @item sono_h
  14859. Set the sonogram height. It must be even. Default value is @code{-1} which
  14860. computes the sonogram height automatically.
  14861. @item fullhd
  14862. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14863. instead. Default value is @code{1}.
  14864. @item sono_v, volume
  14865. Specify the sonogram volume expression. It can contain variables:
  14866. @table @option
  14867. @item bar_v
  14868. the @var{bar_v} evaluated expression
  14869. @item frequency, freq, f
  14870. the frequency where it is evaluated
  14871. @item timeclamp, tc
  14872. the value of @var{timeclamp} option
  14873. @end table
  14874. and functions:
  14875. @table @option
  14876. @item a_weighting(f)
  14877. A-weighting of equal loudness
  14878. @item b_weighting(f)
  14879. B-weighting of equal loudness
  14880. @item c_weighting(f)
  14881. C-weighting of equal loudness.
  14882. @end table
  14883. Default value is @code{16}.
  14884. @item bar_v, volume2
  14885. Specify the bargraph volume expression. It can contain variables:
  14886. @table @option
  14887. @item sono_v
  14888. the @var{sono_v} evaluated expression
  14889. @item frequency, freq, f
  14890. the frequency where it is evaluated
  14891. @item timeclamp, tc
  14892. the value of @var{timeclamp} option
  14893. @end table
  14894. and functions:
  14895. @table @option
  14896. @item a_weighting(f)
  14897. A-weighting of equal loudness
  14898. @item b_weighting(f)
  14899. B-weighting of equal loudness
  14900. @item c_weighting(f)
  14901. C-weighting of equal loudness.
  14902. @end table
  14903. Default value is @code{sono_v}.
  14904. @item sono_g, gamma
  14905. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14906. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14907. Acceptable range is @code{[1, 7]}.
  14908. @item bar_g, gamma2
  14909. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14910. @code{[1, 7]}.
  14911. @item bar_t
  14912. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14913. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14914. @item timeclamp, tc
  14915. Specify the transform timeclamp. At low frequency, there is trade-off between
  14916. accuracy in time domain and frequency domain. If timeclamp is lower,
  14917. event in time domain is represented more accurately (such as fast bass drum),
  14918. otherwise event in frequency domain is represented more accurately
  14919. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14920. @item attack
  14921. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14922. limits future samples by applying asymmetric windowing in time domain, useful
  14923. when low latency is required. Accepted range is @code{[0, 1]}.
  14924. @item basefreq
  14925. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14926. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14927. @item endfreq
  14928. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14929. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14930. @item coeffclamp
  14931. This option is deprecated and ignored.
  14932. @item tlength
  14933. Specify the transform length in time domain. Use this option to control accuracy
  14934. trade-off between time domain and frequency domain at every frequency sample.
  14935. It can contain variables:
  14936. @table @option
  14937. @item frequency, freq, f
  14938. the frequency where it is evaluated
  14939. @item timeclamp, tc
  14940. the value of @var{timeclamp} option.
  14941. @end table
  14942. Default value is @code{384*tc/(384+tc*f)}.
  14943. @item count
  14944. Specify the transform count for every video frame. Default value is @code{6}.
  14945. Acceptable range is @code{[1, 30]}.
  14946. @item fcount
  14947. Specify the transform count for every single pixel. Default value is @code{0},
  14948. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14949. @item fontfile
  14950. Specify font file for use with freetype to draw the axis. If not specified,
  14951. use embedded font. Note that drawing with font file or embedded font is not
  14952. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14953. option instead.
  14954. @item font
  14955. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14956. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14957. @item fontcolor
  14958. Specify font color expression. This is arithmetic expression that should return
  14959. integer value 0xRRGGBB. It can contain variables:
  14960. @table @option
  14961. @item frequency, freq, f
  14962. the frequency where it is evaluated
  14963. @item timeclamp, tc
  14964. the value of @var{timeclamp} option
  14965. @end table
  14966. and functions:
  14967. @table @option
  14968. @item midi(f)
  14969. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14970. @item r(x), g(x), b(x)
  14971. red, green, and blue value of intensity x.
  14972. @end table
  14973. Default value is @code{st(0, (midi(f)-59.5)/12);
  14974. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14975. r(1-ld(1)) + b(ld(1))}.
  14976. @item axisfile
  14977. Specify image file to draw the axis. This option override @var{fontfile} and
  14978. @var{fontcolor} option.
  14979. @item axis, text
  14980. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14981. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14982. Default value is @code{1}.
  14983. @item csp
  14984. Set colorspace. The accepted values are:
  14985. @table @samp
  14986. @item unspecified
  14987. Unspecified (default)
  14988. @item bt709
  14989. BT.709
  14990. @item fcc
  14991. FCC
  14992. @item bt470bg
  14993. BT.470BG or BT.601-6 625
  14994. @item smpte170m
  14995. SMPTE-170M or BT.601-6 525
  14996. @item smpte240m
  14997. SMPTE-240M
  14998. @item bt2020ncl
  14999. BT.2020 with non-constant luminance
  15000. @end table
  15001. @item cscheme
  15002. Set spectrogram color scheme. This is list of floating point values with format
  15003. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  15004. The default is @code{1|0.5|0|0|0.5|1}.
  15005. @end table
  15006. @subsection Examples
  15007. @itemize
  15008. @item
  15009. Playing audio while showing the spectrum:
  15010. @example
  15011. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  15012. @end example
  15013. @item
  15014. Same as above, but with frame rate 30 fps:
  15015. @example
  15016. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15017. @end example
  15018. @item
  15019. Playing at 1280x720:
  15020. @example
  15021. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15022. @end example
  15023. @item
  15024. Disable sonogram display:
  15025. @example
  15026. sono_h=0
  15027. @end example
  15028. @item
  15029. A1 and its harmonics: A1, A2, (near)E3, A3:
  15030. @example
  15031. 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),
  15032. asplit[a][out1]; [a] showcqt [out0]'
  15033. @end example
  15034. @item
  15035. Same as above, but with more accuracy in frequency domain:
  15036. @example
  15037. 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),
  15038. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15039. @end example
  15040. @item
  15041. Custom volume:
  15042. @example
  15043. bar_v=10:sono_v=bar_v*a_weighting(f)
  15044. @end example
  15045. @item
  15046. Custom gamma, now spectrum is linear to the amplitude.
  15047. @example
  15048. bar_g=2:sono_g=2
  15049. @end example
  15050. @item
  15051. Custom tlength equation:
  15052. @example
  15053. 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)))'
  15054. @end example
  15055. @item
  15056. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15057. @example
  15058. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15059. @end example
  15060. @item
  15061. Custom font using fontconfig:
  15062. @example
  15063. font='Courier New,Monospace,mono|bold'
  15064. @end example
  15065. @item
  15066. Custom frequency range with custom axis using image file:
  15067. @example
  15068. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15069. @end example
  15070. @end itemize
  15071. @section showfreqs
  15072. Convert input audio to video output representing the audio power spectrum.
  15073. Audio amplitude is on Y-axis while frequency is on X-axis.
  15074. The filter accepts the following options:
  15075. @table @option
  15076. @item size, s
  15077. Specify size of video. For the syntax of this option, check the
  15078. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15079. Default is @code{1024x512}.
  15080. @item mode
  15081. Set display mode.
  15082. This set how each frequency bin will be represented.
  15083. It accepts the following values:
  15084. @table @samp
  15085. @item line
  15086. @item bar
  15087. @item dot
  15088. @end table
  15089. Default is @code{bar}.
  15090. @item ascale
  15091. Set amplitude scale.
  15092. It accepts the following values:
  15093. @table @samp
  15094. @item lin
  15095. Linear scale.
  15096. @item sqrt
  15097. Square root scale.
  15098. @item cbrt
  15099. Cubic root scale.
  15100. @item log
  15101. Logarithmic scale.
  15102. @end table
  15103. Default is @code{log}.
  15104. @item fscale
  15105. Set frequency scale.
  15106. It accepts the following values:
  15107. @table @samp
  15108. @item lin
  15109. Linear scale.
  15110. @item log
  15111. Logarithmic scale.
  15112. @item rlog
  15113. Reverse logarithmic scale.
  15114. @end table
  15115. Default is @code{lin}.
  15116. @item win_size
  15117. Set window size.
  15118. It accepts the following values:
  15119. @table @samp
  15120. @item w16
  15121. @item w32
  15122. @item w64
  15123. @item w128
  15124. @item w256
  15125. @item w512
  15126. @item w1024
  15127. @item w2048
  15128. @item w4096
  15129. @item w8192
  15130. @item w16384
  15131. @item w32768
  15132. @item w65536
  15133. @end table
  15134. Default is @code{w2048}
  15135. @item win_func
  15136. Set windowing function.
  15137. It accepts the following values:
  15138. @table @samp
  15139. @item rect
  15140. @item bartlett
  15141. @item hanning
  15142. @item hamming
  15143. @item blackman
  15144. @item welch
  15145. @item flattop
  15146. @item bharris
  15147. @item bnuttall
  15148. @item bhann
  15149. @item sine
  15150. @item nuttall
  15151. @item lanczos
  15152. @item gauss
  15153. @item tukey
  15154. @item dolph
  15155. @item cauchy
  15156. @item parzen
  15157. @item poisson
  15158. @end table
  15159. Default is @code{hanning}.
  15160. @item overlap
  15161. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15162. which means optimal overlap for selected window function will be picked.
  15163. @item averaging
  15164. Set time averaging. Setting this to 0 will display current maximal peaks.
  15165. Default is @code{1}, which means time averaging is disabled.
  15166. @item colors
  15167. Specify list of colors separated by space or by '|' which will be used to
  15168. draw channel frequencies. Unrecognized or missing colors will be replaced
  15169. by white color.
  15170. @item cmode
  15171. Set channel display mode.
  15172. It accepts the following values:
  15173. @table @samp
  15174. @item combined
  15175. @item separate
  15176. @end table
  15177. Default is @code{combined}.
  15178. @item minamp
  15179. Set minimum amplitude used in @code{log} amplitude scaler.
  15180. @end table
  15181. @anchor{showspectrum}
  15182. @section showspectrum
  15183. Convert input audio to a video output, representing the audio frequency
  15184. spectrum.
  15185. The filter accepts the following options:
  15186. @table @option
  15187. @item size, s
  15188. Specify the video size for the output. For the syntax of this option, check the
  15189. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15190. Default value is @code{640x512}.
  15191. @item slide
  15192. Specify how the spectrum should slide along the window.
  15193. It accepts the following values:
  15194. @table @samp
  15195. @item replace
  15196. the samples start again on the left when they reach the right
  15197. @item scroll
  15198. the samples scroll from right to left
  15199. @item fullframe
  15200. frames are only produced when the samples reach the right
  15201. @item rscroll
  15202. the samples scroll from left to right
  15203. @end table
  15204. Default value is @code{replace}.
  15205. @item mode
  15206. Specify display mode.
  15207. It accepts the following values:
  15208. @table @samp
  15209. @item combined
  15210. all channels are displayed in the same row
  15211. @item separate
  15212. all channels are displayed in separate rows
  15213. @end table
  15214. Default value is @samp{combined}.
  15215. @item color
  15216. Specify display color mode.
  15217. It accepts the following values:
  15218. @table @samp
  15219. @item channel
  15220. each channel is displayed in a separate color
  15221. @item intensity
  15222. each channel is displayed using the same color scheme
  15223. @item rainbow
  15224. each channel is displayed using the rainbow color scheme
  15225. @item moreland
  15226. each channel is displayed using the moreland color scheme
  15227. @item nebulae
  15228. each channel is displayed using the nebulae color scheme
  15229. @item fire
  15230. each channel is displayed using the fire color scheme
  15231. @item fiery
  15232. each channel is displayed using the fiery color scheme
  15233. @item fruit
  15234. each channel is displayed using the fruit color scheme
  15235. @item cool
  15236. each channel is displayed using the cool color scheme
  15237. @end table
  15238. Default value is @samp{channel}.
  15239. @item scale
  15240. Specify scale used for calculating intensity color values.
  15241. It accepts the following values:
  15242. @table @samp
  15243. @item lin
  15244. linear
  15245. @item sqrt
  15246. square root, default
  15247. @item cbrt
  15248. cubic root
  15249. @item log
  15250. logarithmic
  15251. @item 4thrt
  15252. 4th root
  15253. @item 5thrt
  15254. 5th root
  15255. @end table
  15256. Default value is @samp{sqrt}.
  15257. @item saturation
  15258. Set saturation modifier for displayed colors. Negative values provide
  15259. alternative color scheme. @code{0} is no saturation at all.
  15260. Saturation must be in [-10.0, 10.0] range.
  15261. Default value is @code{1}.
  15262. @item win_func
  15263. Set window function.
  15264. It accepts the following values:
  15265. @table @samp
  15266. @item rect
  15267. @item bartlett
  15268. @item hann
  15269. @item hanning
  15270. @item hamming
  15271. @item blackman
  15272. @item welch
  15273. @item flattop
  15274. @item bharris
  15275. @item bnuttall
  15276. @item bhann
  15277. @item sine
  15278. @item nuttall
  15279. @item lanczos
  15280. @item gauss
  15281. @item tukey
  15282. @item dolph
  15283. @item cauchy
  15284. @item parzen
  15285. @item poisson
  15286. @end table
  15287. Default value is @code{hann}.
  15288. @item orientation
  15289. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15290. @code{horizontal}. Default is @code{vertical}.
  15291. @item overlap
  15292. Set ratio of overlap window. Default value is @code{0}.
  15293. When value is @code{1} overlap is set to recommended size for specific
  15294. window function currently used.
  15295. @item gain
  15296. Set scale gain for calculating intensity color values.
  15297. Default value is @code{1}.
  15298. @item data
  15299. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15300. @item rotation
  15301. Set color rotation, must be in [-1.0, 1.0] range.
  15302. Default value is @code{0}.
  15303. @end table
  15304. The usage is very similar to the showwaves filter; see the examples in that
  15305. section.
  15306. @subsection Examples
  15307. @itemize
  15308. @item
  15309. Large window with logarithmic color scaling:
  15310. @example
  15311. showspectrum=s=1280x480:scale=log
  15312. @end example
  15313. @item
  15314. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15315. @example
  15316. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15317. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15318. @end example
  15319. @end itemize
  15320. @section showspectrumpic
  15321. Convert input audio to a single video frame, representing the audio frequency
  15322. spectrum.
  15323. The filter accepts the following options:
  15324. @table @option
  15325. @item size, s
  15326. Specify the video size for the output. For the syntax of this option, check the
  15327. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15328. Default value is @code{4096x2048}.
  15329. @item mode
  15330. Specify display mode.
  15331. It accepts the following values:
  15332. @table @samp
  15333. @item combined
  15334. all channels are displayed in the same row
  15335. @item separate
  15336. all channels are displayed in separate rows
  15337. @end table
  15338. Default value is @samp{combined}.
  15339. @item color
  15340. Specify display color mode.
  15341. It accepts the following values:
  15342. @table @samp
  15343. @item channel
  15344. each channel is displayed in a separate color
  15345. @item intensity
  15346. each channel is displayed using the same color scheme
  15347. @item rainbow
  15348. each channel is displayed using the rainbow color scheme
  15349. @item moreland
  15350. each channel is displayed using the moreland color scheme
  15351. @item nebulae
  15352. each channel is displayed using the nebulae color scheme
  15353. @item fire
  15354. each channel is displayed using the fire color scheme
  15355. @item fiery
  15356. each channel is displayed using the fiery color scheme
  15357. @item fruit
  15358. each channel is displayed using the fruit color scheme
  15359. @item cool
  15360. each channel is displayed using the cool color scheme
  15361. @end table
  15362. Default value is @samp{intensity}.
  15363. @item scale
  15364. Specify scale used for calculating intensity color values.
  15365. It accepts the following values:
  15366. @table @samp
  15367. @item lin
  15368. linear
  15369. @item sqrt
  15370. square root, default
  15371. @item cbrt
  15372. cubic root
  15373. @item log
  15374. logarithmic
  15375. @item 4thrt
  15376. 4th root
  15377. @item 5thrt
  15378. 5th root
  15379. @end table
  15380. Default value is @samp{log}.
  15381. @item saturation
  15382. Set saturation modifier for displayed colors. Negative values provide
  15383. alternative color scheme. @code{0} is no saturation at all.
  15384. Saturation must be in [-10.0, 10.0] range.
  15385. Default value is @code{1}.
  15386. @item win_func
  15387. Set window function.
  15388. It accepts the following values:
  15389. @table @samp
  15390. @item rect
  15391. @item bartlett
  15392. @item hann
  15393. @item hanning
  15394. @item hamming
  15395. @item blackman
  15396. @item welch
  15397. @item flattop
  15398. @item bharris
  15399. @item bnuttall
  15400. @item bhann
  15401. @item sine
  15402. @item nuttall
  15403. @item lanczos
  15404. @item gauss
  15405. @item tukey
  15406. @item dolph
  15407. @item cauchy
  15408. @item parzen
  15409. @item poisson
  15410. @end table
  15411. Default value is @code{hann}.
  15412. @item orientation
  15413. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15414. @code{horizontal}. Default is @code{vertical}.
  15415. @item gain
  15416. Set scale gain for calculating intensity color values.
  15417. Default value is @code{1}.
  15418. @item legend
  15419. Draw time and frequency axes and legends. Default is enabled.
  15420. @item rotation
  15421. Set color rotation, must be in [-1.0, 1.0] range.
  15422. Default value is @code{0}.
  15423. @end table
  15424. @subsection Examples
  15425. @itemize
  15426. @item
  15427. Extract an audio spectrogram of a whole audio track
  15428. in a 1024x1024 picture using @command{ffmpeg}:
  15429. @example
  15430. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15431. @end example
  15432. @end itemize
  15433. @section showvolume
  15434. Convert input audio volume to a video output.
  15435. The filter accepts the following options:
  15436. @table @option
  15437. @item rate, r
  15438. Set video rate.
  15439. @item b
  15440. Set border width, allowed range is [0, 5]. Default is 1.
  15441. @item w
  15442. Set channel width, allowed range is [80, 8192]. Default is 400.
  15443. @item h
  15444. Set channel height, allowed range is [1, 900]. Default is 20.
  15445. @item f
  15446. Set fade, allowed range is [0, 1]. Default is 0.95.
  15447. @item c
  15448. Set volume color expression.
  15449. The expression can use the following variables:
  15450. @table @option
  15451. @item VOLUME
  15452. Current max volume of channel in dB.
  15453. @item PEAK
  15454. Current peak.
  15455. @item CHANNEL
  15456. Current channel number, starting from 0.
  15457. @end table
  15458. @item t
  15459. If set, displays channel names. Default is enabled.
  15460. @item v
  15461. If set, displays volume values. Default is enabled.
  15462. @item o
  15463. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15464. default is @code{h}.
  15465. @item s
  15466. Set step size, allowed range is [0, 5]. Default is 0, which means
  15467. step is disabled.
  15468. @item p
  15469. Set background opacity, allowed range is [0, 1]. Default is 0.
  15470. @item m
  15471. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15472. default is @code{p}.
  15473. @item ds
  15474. Set display scale, can be linear: @code{lin} or log: @code{log},
  15475. default is @code{lin}.
  15476. @item dm
  15477. In second.
  15478. If set to > 0., display a line for the max level
  15479. in the previous seconds.
  15480. default is disabled: @code{0.}
  15481. @item dmc
  15482. The color of the max line. Use when @code{dm} option is set to > 0.
  15483. default is: @code{orange}
  15484. @end table
  15485. @section showwaves
  15486. Convert input audio to a video output, representing the samples waves.
  15487. The filter accepts the following options:
  15488. @table @option
  15489. @item size, s
  15490. Specify the video size for the output. For the syntax of this option, check the
  15491. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15492. Default value is @code{600x240}.
  15493. @item mode
  15494. Set display mode.
  15495. Available values are:
  15496. @table @samp
  15497. @item point
  15498. Draw a point for each sample.
  15499. @item line
  15500. Draw a vertical line for each sample.
  15501. @item p2p
  15502. Draw a point for each sample and a line between them.
  15503. @item cline
  15504. Draw a centered vertical line for each sample.
  15505. @end table
  15506. Default value is @code{point}.
  15507. @item n
  15508. Set the number of samples which are printed on the same column. A
  15509. larger value will decrease the frame rate. Must be a positive
  15510. integer. This option can be set only if the value for @var{rate}
  15511. is not explicitly specified.
  15512. @item rate, r
  15513. Set the (approximate) output frame rate. This is done by setting the
  15514. option @var{n}. Default value is "25".
  15515. @item split_channels
  15516. Set if channels should be drawn separately or overlap. Default value is 0.
  15517. @item colors
  15518. Set colors separated by '|' which are going to be used for drawing of each channel.
  15519. @item scale
  15520. Set amplitude scale.
  15521. Available values are:
  15522. @table @samp
  15523. @item lin
  15524. Linear.
  15525. @item log
  15526. Logarithmic.
  15527. @item sqrt
  15528. Square root.
  15529. @item cbrt
  15530. Cubic root.
  15531. @end table
  15532. Default is linear.
  15533. @item draw
  15534. Set the draw mode. This is mostly useful to set for high @var{n}.
  15535. Available values are:
  15536. @table @samp
  15537. @item scale
  15538. Scale pixel values for each drawn sample.
  15539. @item full
  15540. Draw every sample directly.
  15541. @end table
  15542. Default value is @code{scale}.
  15543. @end table
  15544. @subsection Examples
  15545. @itemize
  15546. @item
  15547. Output the input file audio and the corresponding video representation
  15548. at the same time:
  15549. @example
  15550. amovie=a.mp3,asplit[out0],showwaves[out1]
  15551. @end example
  15552. @item
  15553. Create a synthetic signal and show it with showwaves, forcing a
  15554. frame rate of 30 frames per second:
  15555. @example
  15556. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15557. @end example
  15558. @end itemize
  15559. @section showwavespic
  15560. Convert input audio to a single video frame, representing the samples waves.
  15561. The filter accepts the following options:
  15562. @table @option
  15563. @item size, s
  15564. Specify the video size for the output. For the syntax of this option, check the
  15565. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15566. Default value is @code{600x240}.
  15567. @item split_channels
  15568. Set if channels should be drawn separately or overlap. Default value is 0.
  15569. @item colors
  15570. Set colors separated by '|' which are going to be used for drawing of each channel.
  15571. @item scale
  15572. Set amplitude scale.
  15573. Available values are:
  15574. @table @samp
  15575. @item lin
  15576. Linear.
  15577. @item log
  15578. Logarithmic.
  15579. @item sqrt
  15580. Square root.
  15581. @item cbrt
  15582. Cubic root.
  15583. @end table
  15584. Default is linear.
  15585. @end table
  15586. @subsection Examples
  15587. @itemize
  15588. @item
  15589. Extract a channel split representation of the wave form of a whole audio track
  15590. in a 1024x800 picture using @command{ffmpeg}:
  15591. @example
  15592. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15593. @end example
  15594. @end itemize
  15595. @section sidedata, asidedata
  15596. Delete frame side data, or select frames based on it.
  15597. This filter accepts the following options:
  15598. @table @option
  15599. @item mode
  15600. Set mode of operation of the filter.
  15601. Can be one of the following:
  15602. @table @samp
  15603. @item select
  15604. Select every frame with side data of @code{type}.
  15605. @item delete
  15606. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15607. data in the frame.
  15608. @end table
  15609. @item type
  15610. Set side data type used with all modes. Must be set for @code{select} mode. For
  15611. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15612. in @file{libavutil/frame.h}. For example, to choose
  15613. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15614. @end table
  15615. @section spectrumsynth
  15616. Sythesize audio from 2 input video spectrums, first input stream represents
  15617. magnitude across time and second represents phase across time.
  15618. The filter will transform from frequency domain as displayed in videos back
  15619. to time domain as presented in audio output.
  15620. This filter is primarily created for reversing processed @ref{showspectrum}
  15621. filter outputs, but can synthesize sound from other spectrograms too.
  15622. But in such case results are going to be poor if the phase data is not
  15623. available, because in such cases phase data need to be recreated, usually
  15624. its just recreated from random noise.
  15625. For best results use gray only output (@code{channel} color mode in
  15626. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15627. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15628. @code{data} option. Inputs videos should generally use @code{fullframe}
  15629. slide mode as that saves resources needed for decoding video.
  15630. The filter accepts the following options:
  15631. @table @option
  15632. @item sample_rate
  15633. Specify sample rate of output audio, the sample rate of audio from which
  15634. spectrum was generated may differ.
  15635. @item channels
  15636. Set number of channels represented in input video spectrums.
  15637. @item scale
  15638. Set scale which was used when generating magnitude input spectrum.
  15639. Can be @code{lin} or @code{log}. Default is @code{log}.
  15640. @item slide
  15641. Set slide which was used when generating inputs spectrums.
  15642. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15643. Default is @code{fullframe}.
  15644. @item win_func
  15645. Set window function used for resynthesis.
  15646. @item overlap
  15647. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15648. which means optimal overlap for selected window function will be picked.
  15649. @item orientation
  15650. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15651. Default is @code{vertical}.
  15652. @end table
  15653. @subsection Examples
  15654. @itemize
  15655. @item
  15656. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15657. then resynthesize videos back to audio with spectrumsynth:
  15658. @example
  15659. 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
  15660. 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
  15661. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15662. @end example
  15663. @end itemize
  15664. @section split, asplit
  15665. Split input into several identical outputs.
  15666. @code{asplit} works with audio input, @code{split} with video.
  15667. The filter accepts a single parameter which specifies the number of outputs. If
  15668. unspecified, it defaults to 2.
  15669. @subsection Examples
  15670. @itemize
  15671. @item
  15672. Create two separate outputs from the same input:
  15673. @example
  15674. [in] split [out0][out1]
  15675. @end example
  15676. @item
  15677. To create 3 or more outputs, you need to specify the number of
  15678. outputs, like in:
  15679. @example
  15680. [in] asplit=3 [out0][out1][out2]
  15681. @end example
  15682. @item
  15683. Create two separate outputs from the same input, one cropped and
  15684. one padded:
  15685. @example
  15686. [in] split [splitout1][splitout2];
  15687. [splitout1] crop=100:100:0:0 [cropout];
  15688. [splitout2] pad=200:200:100:100 [padout];
  15689. @end example
  15690. @item
  15691. Create 5 copies of the input audio with @command{ffmpeg}:
  15692. @example
  15693. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15694. @end example
  15695. @end itemize
  15696. @section zmq, azmq
  15697. Receive commands sent through a libzmq client, and forward them to
  15698. filters in the filtergraph.
  15699. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15700. must be inserted between two video filters, @code{azmq} between two
  15701. audio filters. Both are capable to send messages to any filter type.
  15702. To enable these filters you need to install the libzmq library and
  15703. headers and configure FFmpeg with @code{--enable-libzmq}.
  15704. For more information about libzmq see:
  15705. @url{http://www.zeromq.org/}
  15706. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15707. receives messages sent through a network interface defined by the
  15708. @option{bind_address} (or the abbreviation "@option{b}") option.
  15709. Default value of this option is @file{tcp://localhost:5555}. You may
  15710. want to alter this value to your needs, but do not forget to escape any
  15711. ':' signs (see @ref{filtergraph escaping}).
  15712. The received message must be in the form:
  15713. @example
  15714. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15715. @end example
  15716. @var{TARGET} specifies the target of the command, usually the name of
  15717. the filter class or a specific filter instance name. The default
  15718. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15719. but you can override this by using the @samp{filter_name@@id} syntax
  15720. (see @ref{Filtergraph syntax}).
  15721. @var{COMMAND} specifies the name of the command for the target filter.
  15722. @var{ARG} is optional and specifies the optional argument list for the
  15723. given @var{COMMAND}.
  15724. Upon reception, the message is processed and the corresponding command
  15725. is injected into the filtergraph. Depending on the result, the filter
  15726. will send a reply to the client, adopting the format:
  15727. @example
  15728. @var{ERROR_CODE} @var{ERROR_REASON}
  15729. @var{MESSAGE}
  15730. @end example
  15731. @var{MESSAGE} is optional.
  15732. @subsection Examples
  15733. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15734. be used to send commands processed by these filters.
  15735. Consider the following filtergraph generated by @command{ffplay}.
  15736. In this example the last overlay filter has an instance name. All other
  15737. filters will have default instance names.
  15738. @example
  15739. ffplay -dumpgraph 1 -f lavfi "
  15740. color=s=100x100:c=red [l];
  15741. color=s=100x100:c=blue [r];
  15742. nullsrc=s=200x100, zmq [bg];
  15743. [bg][l] overlay [bg+l];
  15744. [bg+l][r] overlay@@my=x=100 "
  15745. @end example
  15746. To change the color of the left side of the video, the following
  15747. command can be used:
  15748. @example
  15749. echo Parsed_color_0 c yellow | tools/zmqsend
  15750. @end example
  15751. To change the right side:
  15752. @example
  15753. echo Parsed_color_1 c pink | tools/zmqsend
  15754. @end example
  15755. To change the position of the right side:
  15756. @example
  15757. echo overlay@@my x 150 | tools/zmqsend
  15758. @end example
  15759. @c man end MULTIMEDIA FILTERS
  15760. @chapter Multimedia Sources
  15761. @c man begin MULTIMEDIA SOURCES
  15762. Below is a description of the currently available multimedia sources.
  15763. @section amovie
  15764. This is the same as @ref{movie} source, except it selects an audio
  15765. stream by default.
  15766. @anchor{movie}
  15767. @section movie
  15768. Read audio and/or video stream(s) from a movie container.
  15769. It accepts the following parameters:
  15770. @table @option
  15771. @item filename
  15772. The name of the resource to read (not necessarily a file; it can also be a
  15773. device or a stream accessed through some protocol).
  15774. @item format_name, f
  15775. Specifies the format assumed for the movie to read, and can be either
  15776. the name of a container or an input device. If not specified, the
  15777. format is guessed from @var{movie_name} or by probing.
  15778. @item seek_point, sp
  15779. Specifies the seek point in seconds. The frames will be output
  15780. starting from this seek point. The parameter is evaluated with
  15781. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15782. postfix. The default value is "0".
  15783. @item streams, s
  15784. Specifies the streams to read. Several streams can be specified,
  15785. separated by "+". The source will then have as many outputs, in the
  15786. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15787. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15788. respectively the default (best suited) video and audio stream. Default
  15789. is "dv", or "da" if the filter is called as "amovie".
  15790. @item stream_index, si
  15791. Specifies the index of the video stream to read. If the value is -1,
  15792. the most suitable video stream will be automatically selected. The default
  15793. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15794. audio instead of video.
  15795. @item loop
  15796. Specifies how many times to read the stream in sequence.
  15797. If the value is 0, the stream will be looped infinitely.
  15798. Default value is "1".
  15799. Note that when the movie is looped the source timestamps are not
  15800. changed, so it will generate non monotonically increasing timestamps.
  15801. @item discontinuity
  15802. Specifies the time difference between frames above which the point is
  15803. considered a timestamp discontinuity which is removed by adjusting the later
  15804. timestamps.
  15805. @end table
  15806. It allows overlaying a second video on top of the main input of
  15807. a filtergraph, as shown in this graph:
  15808. @example
  15809. input -----------> deltapts0 --> overlay --> output
  15810. ^
  15811. |
  15812. movie --> scale--> deltapts1 -------+
  15813. @end example
  15814. @subsection Examples
  15815. @itemize
  15816. @item
  15817. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15818. on top of the input labelled "in":
  15819. @example
  15820. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15821. [in] setpts=PTS-STARTPTS [main];
  15822. [main][over] overlay=16:16 [out]
  15823. @end example
  15824. @item
  15825. Read from a video4linux2 device, and overlay it on top of the input
  15826. labelled "in":
  15827. @example
  15828. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15829. [in] setpts=PTS-STARTPTS [main];
  15830. [main][over] overlay=16:16 [out]
  15831. @end example
  15832. @item
  15833. Read the first video stream and the audio stream with id 0x81 from
  15834. dvd.vob; the video is connected to the pad named "video" and the audio is
  15835. connected to the pad named "audio":
  15836. @example
  15837. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15838. @end example
  15839. @end itemize
  15840. @subsection Commands
  15841. Both movie and amovie support the following commands:
  15842. @table @option
  15843. @item seek
  15844. Perform seek using "av_seek_frame".
  15845. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15846. @itemize
  15847. @item
  15848. @var{stream_index}: If stream_index is -1, a default
  15849. stream is selected, and @var{timestamp} is automatically converted
  15850. from AV_TIME_BASE units to the stream specific time_base.
  15851. @item
  15852. @var{timestamp}: Timestamp in AVStream.time_base units
  15853. or, if no stream is specified, in AV_TIME_BASE units.
  15854. @item
  15855. @var{flags}: Flags which select direction and seeking mode.
  15856. @end itemize
  15857. @item get_duration
  15858. Get movie duration in AV_TIME_BASE units.
  15859. @end table
  15860. @c man end MULTIMEDIA SOURCES