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.

20734 lines
550KB

  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. @end table
  765. @subsection Examples
  766. @itemize
  767. @item
  768. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  769. @example
  770. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  771. @end example
  772. @end itemize
  773. @anchor{aformat}
  774. @section aformat
  775. Set output format constraints for the input audio. The framework will
  776. negotiate the most appropriate format to minimize conversions.
  777. It accepts the following parameters:
  778. @table @option
  779. @item sample_fmts
  780. A '|'-separated list of requested sample formats.
  781. @item sample_rates
  782. A '|'-separated list of requested sample rates.
  783. @item channel_layouts
  784. A '|'-separated list of requested channel layouts.
  785. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  786. for the required syntax.
  787. @end table
  788. If a parameter is omitted, all values are allowed.
  789. Force the output to either unsigned 8-bit or signed 16-bit stereo
  790. @example
  791. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  792. @end example
  793. @section agate
  794. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  795. processing reduces disturbing noise between useful signals.
  796. Gating is done by detecting the volume below a chosen level @var{threshold}
  797. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  798. floor is set via @var{range}. Because an exact manipulation of the signal
  799. would cause distortion of the waveform the reduction can be levelled over
  800. time. This is done by setting @var{attack} and @var{release}.
  801. @var{attack} determines how long the signal has to fall below the threshold
  802. before any reduction will occur and @var{release} sets the time the signal
  803. has to rise above the threshold to reduce the reduction again.
  804. Shorter signals than the chosen attack time will be left untouched.
  805. @table @option
  806. @item level_in
  807. Set input level before filtering.
  808. Default is 1. Allowed range is from 0.015625 to 64.
  809. @item range
  810. Set the level of gain reduction when the signal is below the threshold.
  811. Default is 0.06125. Allowed range is from 0 to 1.
  812. @item threshold
  813. If a signal rises above this level the gain reduction is released.
  814. Default is 0.125. Allowed range is from 0 to 1.
  815. @item ratio
  816. Set a ratio by which the signal is reduced.
  817. Default is 2. Allowed range is from 1 to 9000.
  818. @item attack
  819. Amount of milliseconds the signal has to rise above the threshold before gain
  820. reduction stops.
  821. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  822. @item release
  823. Amount of milliseconds the signal has to fall below the threshold before the
  824. reduction is increased again. Default is 250 milliseconds.
  825. Allowed range is from 0.01 to 9000.
  826. @item makeup
  827. Set amount of amplification of signal after processing.
  828. Default is 1. Allowed range is from 1 to 64.
  829. @item knee
  830. Curve the sharp knee around the threshold to enter gain reduction more softly.
  831. Default is 2.828427125. Allowed range is from 1 to 8.
  832. @item detection
  833. Choose if exact signal should be taken for detection or an RMS like one.
  834. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  835. @item link
  836. Choose if the average level between all channels or the louder channel affects
  837. the reduction.
  838. Default is @code{average}. Can be @code{average} or @code{maximum}.
  839. @end table
  840. @section aiir
  841. Apply an arbitrary Infinite Impulse Response filter.
  842. It accepts the following parameters:
  843. @table @option
  844. @item z
  845. Set numerator/zeros coefficients.
  846. @item p
  847. Set denominator/poles coefficients.
  848. @item k
  849. Set channels gains.
  850. @item dry_gain
  851. Set input gain.
  852. @item wet_gain
  853. Set output gain.
  854. @item f
  855. Set coefficients format.
  856. @table @samp
  857. @item tf
  858. transfer function
  859. @item zp
  860. Z-plane zeros/poles, cartesian (default)
  861. @item pr
  862. Z-plane zeros/poles, polar radians
  863. @item pd
  864. Z-plane zeros/poles, polar degrees
  865. @end table
  866. @item r
  867. Set kind of processing.
  868. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  869. @item e
  870. Set filtering precision.
  871. @table @samp
  872. @item dbl
  873. double-precision floating-point (default)
  874. @item flt
  875. single-precision floating-point
  876. @item i32
  877. 32-bit integers
  878. @item i16
  879. 16-bit integers
  880. @end table
  881. @end table
  882. Coefficients in @code{tf} format are separated by spaces and are in ascending
  883. order.
  884. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  885. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  886. imaginary unit.
  887. Different coefficients and gains can be provided for every channel, in such case
  888. use '|' to separate coefficients or gains. Last provided coefficients will be
  889. used for all remaining channels.
  890. @subsection Examples
  891. @itemize
  892. @item
  893. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  894. @example
  895. 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
  896. @end example
  897. @item
  898. Same as above but in @code{zp} format:
  899. @example
  900. 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
  901. @end example
  902. @end itemize
  903. @section alimiter
  904. The limiter prevents an input signal from rising over a desired threshold.
  905. This limiter uses lookahead technology to prevent your signal from distorting.
  906. It means that there is a small delay after the signal is processed. Keep in mind
  907. that the delay it produces is the attack time you set.
  908. The filter accepts the following options:
  909. @table @option
  910. @item level_in
  911. Set input gain. Default is 1.
  912. @item level_out
  913. Set output gain. Default is 1.
  914. @item limit
  915. Don't let signals above this level pass the limiter. Default is 1.
  916. @item attack
  917. The limiter will reach its attenuation level in this amount of time in
  918. milliseconds. Default is 5 milliseconds.
  919. @item release
  920. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  921. Default is 50 milliseconds.
  922. @item asc
  923. When gain reduction is always needed ASC takes care of releasing to an
  924. average reduction level rather than reaching a reduction of 0 in the release
  925. time.
  926. @item asc_level
  927. Select how much the release time is affected by ASC, 0 means nearly no changes
  928. in release time while 1 produces higher release times.
  929. @item level
  930. Auto level output signal. Default is enabled.
  931. This normalizes audio back to 0dB if enabled.
  932. @end table
  933. Depending on picked setting it is recommended to upsample input 2x or 4x times
  934. with @ref{aresample} before applying this filter.
  935. @section allpass
  936. Apply a two-pole all-pass filter with central frequency (in Hz)
  937. @var{frequency}, and filter-width @var{width}.
  938. An all-pass filter changes the audio's frequency to phase relationship
  939. without changing its frequency to amplitude relationship.
  940. The filter accepts the following options:
  941. @table @option
  942. @item frequency, f
  943. Set frequency in Hz.
  944. @item width_type, t
  945. Set method to specify band-width of filter.
  946. @table @option
  947. @item h
  948. Hz
  949. @item q
  950. Q-Factor
  951. @item o
  952. octave
  953. @item s
  954. slope
  955. @item k
  956. kHz
  957. @end table
  958. @item width, w
  959. Specify the band-width of a filter in width_type units.
  960. @item channels, c
  961. Specify which channels to filter, by default all available are filtered.
  962. @end table
  963. @subsection Commands
  964. This filter supports the following commands:
  965. @table @option
  966. @item frequency, f
  967. Change allpass frequency.
  968. Syntax for the command is : "@var{frequency}"
  969. @item width_type, t
  970. Change allpass width_type.
  971. Syntax for the command is : "@var{width_type}"
  972. @item width, w
  973. Change allpass width.
  974. Syntax for the command is : "@var{width}"
  975. @end table
  976. @section aloop
  977. Loop audio samples.
  978. The filter accepts the following options:
  979. @table @option
  980. @item loop
  981. Set the number of loops. Setting this value to -1 will result in infinite loops.
  982. Default is 0.
  983. @item size
  984. Set maximal number of samples. Default is 0.
  985. @item start
  986. Set first sample of loop. Default is 0.
  987. @end table
  988. @anchor{amerge}
  989. @section amerge
  990. Merge two or more audio streams into a single multi-channel stream.
  991. The filter accepts the following options:
  992. @table @option
  993. @item inputs
  994. Set the number of inputs. Default is 2.
  995. @end table
  996. If the channel layouts of the inputs are disjoint, and therefore compatible,
  997. the channel layout of the output will be set accordingly and the channels
  998. will be reordered as necessary. If the channel layouts of the inputs are not
  999. disjoint, the output will have all the channels of the first input then all
  1000. the channels of the second input, in that order, and the channel layout of
  1001. the output will be the default value corresponding to the total number of
  1002. channels.
  1003. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1004. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1005. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1006. first input, b1 is the first channel of the second input).
  1007. On the other hand, if both input are in stereo, the output channels will be
  1008. in the default order: a1, a2, b1, b2, and the channel layout will be
  1009. arbitrarily set to 4.0, which may or may not be the expected value.
  1010. All inputs must have the same sample rate, and format.
  1011. If inputs do not have the same duration, the output will stop with the
  1012. shortest.
  1013. @subsection Examples
  1014. @itemize
  1015. @item
  1016. Merge two mono files into a stereo stream:
  1017. @example
  1018. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1019. @end example
  1020. @item
  1021. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1022. @example
  1023. 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
  1024. @end example
  1025. @end itemize
  1026. @section amix
  1027. Mixes multiple audio inputs into a single output.
  1028. Note that this filter only supports float samples (the @var{amerge}
  1029. and @var{pan} audio filters support many formats). If the @var{amix}
  1030. input has integer samples then @ref{aresample} will be automatically
  1031. inserted to perform the conversion to float samples.
  1032. For example
  1033. @example
  1034. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1035. @end example
  1036. will mix 3 input audio streams to a single output with the same duration as the
  1037. first input and a dropout transition time of 3 seconds.
  1038. It accepts the following parameters:
  1039. @table @option
  1040. @item inputs
  1041. The number of inputs. If unspecified, it defaults to 2.
  1042. @item duration
  1043. How to determine the end-of-stream.
  1044. @table @option
  1045. @item longest
  1046. The duration of the longest input. (default)
  1047. @item shortest
  1048. The duration of the shortest input.
  1049. @item first
  1050. The duration of the first input.
  1051. @end table
  1052. @item dropout_transition
  1053. The transition time, in seconds, for volume renormalization when an input
  1054. stream ends. The default value is 2 seconds.
  1055. @item weights
  1056. Specify weight of each input audio stream as sequence.
  1057. Each weight is separated by space. By default all inputs have same weight.
  1058. @end table
  1059. @section anequalizer
  1060. High-order parametric multiband equalizer for each channel.
  1061. It accepts the following parameters:
  1062. @table @option
  1063. @item params
  1064. This option string is in format:
  1065. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1066. Each equalizer band is separated by '|'.
  1067. @table @option
  1068. @item chn
  1069. Set channel number to which equalization will be applied.
  1070. If input doesn't have that channel the entry is ignored.
  1071. @item f
  1072. Set central frequency for band.
  1073. If input doesn't have that frequency the entry is ignored.
  1074. @item w
  1075. Set band width in hertz.
  1076. @item g
  1077. Set band gain in dB.
  1078. @item t
  1079. Set filter type for band, optional, can be:
  1080. @table @samp
  1081. @item 0
  1082. Butterworth, this is default.
  1083. @item 1
  1084. Chebyshev type 1.
  1085. @item 2
  1086. Chebyshev type 2.
  1087. @end table
  1088. @end table
  1089. @item curves
  1090. With this option activated frequency response of anequalizer is displayed
  1091. in video stream.
  1092. @item size
  1093. Set video stream size. Only useful if curves option is activated.
  1094. @item mgain
  1095. Set max gain that will be displayed. Only useful if curves option is activated.
  1096. Setting this to a reasonable value makes it possible to display gain which is derived from
  1097. neighbour bands which are too close to each other and thus produce higher gain
  1098. when both are activated.
  1099. @item fscale
  1100. Set frequency scale used to draw frequency response in video output.
  1101. Can be linear or logarithmic. Default is logarithmic.
  1102. @item colors
  1103. Set color for each channel curve which is going to be displayed in video stream.
  1104. This is list of color names separated by space or by '|'.
  1105. Unrecognised or missing colors will be replaced by white color.
  1106. @end table
  1107. @subsection Examples
  1108. @itemize
  1109. @item
  1110. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1111. for first 2 channels using Chebyshev type 1 filter:
  1112. @example
  1113. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1114. @end example
  1115. @end itemize
  1116. @subsection Commands
  1117. This filter supports the following commands:
  1118. @table @option
  1119. @item change
  1120. Alter existing filter parameters.
  1121. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1122. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1123. error is returned.
  1124. @var{freq} set new frequency parameter.
  1125. @var{width} set new width parameter in herz.
  1126. @var{gain} set new gain parameter in dB.
  1127. Full filter invocation with asendcmd may look like this:
  1128. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1129. @end table
  1130. @section anull
  1131. Pass the audio source unchanged to the output.
  1132. @section apad
  1133. Pad the end of an audio stream with silence.
  1134. This can be used together with @command{ffmpeg} @option{-shortest} to
  1135. extend audio streams to the same length as the video stream.
  1136. A description of the accepted options follows.
  1137. @table @option
  1138. @item packet_size
  1139. Set silence packet size. Default value is 4096.
  1140. @item pad_len
  1141. Set the number of samples of silence to add to the end. After the
  1142. value is reached, the stream is terminated. This option is mutually
  1143. exclusive with @option{whole_len}.
  1144. @item whole_len
  1145. Set the minimum total number of samples in the output audio stream. If
  1146. the value is longer than the input audio length, silence is added to
  1147. the end, until the value is reached. This option is mutually exclusive
  1148. with @option{pad_len}.
  1149. @end table
  1150. If neither the @option{pad_len} nor the @option{whole_len} option is
  1151. set, the filter will add silence to the end of the input stream
  1152. indefinitely.
  1153. @subsection Examples
  1154. @itemize
  1155. @item
  1156. Add 1024 samples of silence to the end of the input:
  1157. @example
  1158. apad=pad_len=1024
  1159. @end example
  1160. @item
  1161. Make sure the audio output will contain at least 10000 samples, pad
  1162. the input with silence if required:
  1163. @example
  1164. apad=whole_len=10000
  1165. @end example
  1166. @item
  1167. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1168. video stream will always result the shortest and will be converted
  1169. until the end in the output file when using the @option{shortest}
  1170. option:
  1171. @example
  1172. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1173. @end example
  1174. @end itemize
  1175. @section aphaser
  1176. Add a phasing effect to the input audio.
  1177. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1178. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1179. A description of the accepted parameters follows.
  1180. @table @option
  1181. @item in_gain
  1182. Set input gain. Default is 0.4.
  1183. @item out_gain
  1184. Set output gain. Default is 0.74
  1185. @item delay
  1186. Set delay in milliseconds. Default is 3.0.
  1187. @item decay
  1188. Set decay. Default is 0.4.
  1189. @item speed
  1190. Set modulation speed in Hz. Default is 0.5.
  1191. @item type
  1192. Set modulation type. Default is triangular.
  1193. It accepts the following values:
  1194. @table @samp
  1195. @item triangular, t
  1196. @item sinusoidal, s
  1197. @end table
  1198. @end table
  1199. @section apulsator
  1200. Audio pulsator is something between an autopanner and a tremolo.
  1201. But it can produce funny stereo effects as well. Pulsator changes the volume
  1202. of the left and right channel based on a LFO (low frequency oscillator) with
  1203. different waveforms and shifted phases.
  1204. This filter have the ability to define an offset between left and right
  1205. channel. An offset of 0 means that both LFO shapes match each other.
  1206. The left and right channel are altered equally - a conventional tremolo.
  1207. An offset of 50% means that the shape of the right channel is exactly shifted
  1208. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1209. an autopanner. At 1 both curves match again. Every setting in between moves the
  1210. phase shift gapless between all stages and produces some "bypassing" sounds with
  1211. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1212. the 0.5) the faster the signal passes from the left to the right speaker.
  1213. The filter accepts the following options:
  1214. @table @option
  1215. @item level_in
  1216. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1217. @item level_out
  1218. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1219. @item mode
  1220. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1221. sawup or sawdown. Default is sine.
  1222. @item amount
  1223. Set modulation. Define how much of original signal is affected by the LFO.
  1224. @item offset_l
  1225. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1226. @item offset_r
  1227. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1228. @item width
  1229. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1230. @item timing
  1231. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1232. @item bpm
  1233. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1234. is set to bpm.
  1235. @item ms
  1236. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1237. is set to ms.
  1238. @item hz
  1239. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1240. if timing is set to hz.
  1241. @end table
  1242. @anchor{aresample}
  1243. @section aresample
  1244. Resample the input audio to the specified parameters, using the
  1245. libswresample library. If none are specified then the filter will
  1246. automatically convert between its input and output.
  1247. This filter is also able to stretch/squeeze the audio data to make it match
  1248. the timestamps or to inject silence / cut out audio to make it match the
  1249. timestamps, do a combination of both or do neither.
  1250. The filter accepts the syntax
  1251. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1252. expresses a sample rate and @var{resampler_options} is a list of
  1253. @var{key}=@var{value} pairs, separated by ":". See the
  1254. @ref{Resampler Options,,"Resampler Options" section in the
  1255. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1256. for the complete list of supported options.
  1257. @subsection Examples
  1258. @itemize
  1259. @item
  1260. Resample the input audio to 44100Hz:
  1261. @example
  1262. aresample=44100
  1263. @end example
  1264. @item
  1265. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1266. samples per second compensation:
  1267. @example
  1268. aresample=async=1000
  1269. @end example
  1270. @end itemize
  1271. @section areverse
  1272. Reverse an audio clip.
  1273. Warning: This filter requires memory to buffer the entire clip, so trimming
  1274. is suggested.
  1275. @subsection Examples
  1276. @itemize
  1277. @item
  1278. Take the first 5 seconds of a clip, and reverse it.
  1279. @example
  1280. atrim=end=5,areverse
  1281. @end example
  1282. @end itemize
  1283. @section asetnsamples
  1284. Set the number of samples per each output audio frame.
  1285. The last output packet may contain a different number of samples, as
  1286. the filter will flush all the remaining samples when the input audio
  1287. signals its end.
  1288. The filter accepts the following options:
  1289. @table @option
  1290. @item nb_out_samples, n
  1291. Set the number of frames per each output audio frame. The number is
  1292. intended as the number of samples @emph{per each channel}.
  1293. Default value is 1024.
  1294. @item pad, p
  1295. If set to 1, the filter will pad the last audio frame with zeroes, so
  1296. that the last frame will contain the same number of samples as the
  1297. previous ones. Default value is 1.
  1298. @end table
  1299. For example, to set the number of per-frame samples to 1234 and
  1300. disable padding for the last frame, use:
  1301. @example
  1302. asetnsamples=n=1234:p=0
  1303. @end example
  1304. @section asetrate
  1305. Set the sample rate without altering the PCM data.
  1306. This will result in a change of speed and pitch.
  1307. The filter accepts the following options:
  1308. @table @option
  1309. @item sample_rate, r
  1310. Set the output sample rate. Default is 44100 Hz.
  1311. @end table
  1312. @section ashowinfo
  1313. Show a line containing various information for each input audio frame.
  1314. The input audio is not modified.
  1315. The shown line contains a sequence of key/value pairs of the form
  1316. @var{key}:@var{value}.
  1317. The following values are shown in the output:
  1318. @table @option
  1319. @item n
  1320. The (sequential) number of the input frame, starting from 0.
  1321. @item pts
  1322. The presentation timestamp of the input frame, in time base units; the time base
  1323. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1324. @item pts_time
  1325. The presentation timestamp of the input frame in seconds.
  1326. @item pos
  1327. position of the frame in the input stream, -1 if this information in
  1328. unavailable and/or meaningless (for example in case of synthetic audio)
  1329. @item fmt
  1330. The sample format.
  1331. @item chlayout
  1332. The channel layout.
  1333. @item rate
  1334. The sample rate for the audio frame.
  1335. @item nb_samples
  1336. The number of samples (per channel) in the frame.
  1337. @item checksum
  1338. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1339. audio, the data is treated as if all the planes were concatenated.
  1340. @item plane_checksums
  1341. A list of Adler-32 checksums for each data plane.
  1342. @end table
  1343. @anchor{astats}
  1344. @section astats
  1345. Display time domain statistical information about the audio channels.
  1346. Statistics are calculated and displayed for each audio channel and,
  1347. where applicable, an overall figure is also given.
  1348. It accepts the following option:
  1349. @table @option
  1350. @item length
  1351. Short window length in seconds, used for peak and trough RMS measurement.
  1352. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1353. @item metadata
  1354. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1355. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1356. disabled.
  1357. Available keys for each channel are:
  1358. DC_offset
  1359. Min_level
  1360. Max_level
  1361. Min_difference
  1362. Max_difference
  1363. Mean_difference
  1364. RMS_difference
  1365. Peak_level
  1366. RMS_peak
  1367. RMS_trough
  1368. Crest_factor
  1369. Flat_factor
  1370. Peak_count
  1371. Bit_depth
  1372. Dynamic_range
  1373. and for Overall:
  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_level
  1383. RMS_peak
  1384. RMS_trough
  1385. Flat_factor
  1386. Peak_count
  1387. Bit_depth
  1388. Number_of_samples
  1389. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1390. this @code{lavfi.astats.Overall.Peak_count}.
  1391. For description what each key means read below.
  1392. @item reset
  1393. Set number of frame after which stats are going to be recalculated.
  1394. Default is disabled.
  1395. @end table
  1396. A description of each shown parameter follows:
  1397. @table @option
  1398. @item DC offset
  1399. Mean amplitude displacement from zero.
  1400. @item Min level
  1401. Minimal sample level.
  1402. @item Max level
  1403. Maximal sample level.
  1404. @item Min difference
  1405. Minimal difference between two consecutive samples.
  1406. @item Max difference
  1407. Maximal difference between two consecutive samples.
  1408. @item Mean difference
  1409. Mean difference between two consecutive samples.
  1410. The average of each difference between two consecutive samples.
  1411. @item RMS difference
  1412. Root Mean Square difference between two consecutive samples.
  1413. @item Peak level dB
  1414. @item RMS level dB
  1415. Standard peak and RMS level measured in dBFS.
  1416. @item RMS peak dB
  1417. @item RMS trough dB
  1418. Peak and trough values for RMS level measured over a short window.
  1419. @item Crest factor
  1420. Standard ratio of peak to RMS level (note: not in dB).
  1421. @item Flat factor
  1422. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1423. (i.e. either @var{Min level} or @var{Max level}).
  1424. @item Peak count
  1425. Number of occasions (not the number of samples) that the signal attained either
  1426. @var{Min level} or @var{Max level}.
  1427. @item Bit depth
  1428. Overall bit depth of audio. Number of bits used for each sample.
  1429. @item Dynamic range
  1430. Measured dynamic range of audio in dB.
  1431. @end table
  1432. @section atempo
  1433. Adjust audio tempo.
  1434. The filter accepts exactly one parameter, the audio tempo. If not
  1435. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1436. be in the [0.5, 2.0] range.
  1437. @subsection Examples
  1438. @itemize
  1439. @item
  1440. Slow down audio to 80% tempo:
  1441. @example
  1442. atempo=0.8
  1443. @end example
  1444. @item
  1445. To speed up audio to 125% tempo:
  1446. @example
  1447. atempo=1.25
  1448. @end example
  1449. @end itemize
  1450. @section atrim
  1451. Trim the input so that the output contains one continuous subpart of the input.
  1452. It accepts the following parameters:
  1453. @table @option
  1454. @item start
  1455. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1456. sample with the timestamp @var{start} will be the first sample in the output.
  1457. @item end
  1458. Specify time of the first audio sample that will be dropped, i.e. the
  1459. audio sample immediately preceding the one with the timestamp @var{end} will be
  1460. the last sample in the output.
  1461. @item start_pts
  1462. Same as @var{start}, except this option sets the start timestamp in samples
  1463. instead of seconds.
  1464. @item end_pts
  1465. Same as @var{end}, except this option sets the end timestamp in samples instead
  1466. of seconds.
  1467. @item duration
  1468. The maximum duration of the output in seconds.
  1469. @item start_sample
  1470. The number of the first sample that should be output.
  1471. @item end_sample
  1472. The number of the first sample that should be dropped.
  1473. @end table
  1474. @option{start}, @option{end}, and @option{duration} are expressed as time
  1475. duration specifications; see
  1476. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1477. Note that the first two sets of the start/end options and the @option{duration}
  1478. option look at the frame timestamp, while the _sample options simply count the
  1479. samples that pass through the filter. So start/end_pts and start/end_sample will
  1480. give different results when the timestamps are wrong, inexact or do not start at
  1481. zero. Also note that this filter does not modify the timestamps. If you wish
  1482. to have the output timestamps start at zero, insert the asetpts filter after the
  1483. atrim filter.
  1484. If multiple start or end options are set, this filter tries to be greedy and
  1485. keep all samples that match at least one of the specified constraints. To keep
  1486. only the part that matches all the constraints at once, chain multiple atrim
  1487. filters.
  1488. The defaults are such that all the input is kept. So it is possible to set e.g.
  1489. just the end values to keep everything before the specified time.
  1490. Examples:
  1491. @itemize
  1492. @item
  1493. Drop everything except the second minute of input:
  1494. @example
  1495. ffmpeg -i INPUT -af atrim=60:120
  1496. @end example
  1497. @item
  1498. Keep only the first 1000 samples:
  1499. @example
  1500. ffmpeg -i INPUT -af atrim=end_sample=1000
  1501. @end example
  1502. @end itemize
  1503. @section bandpass
  1504. Apply a two-pole Butterworth band-pass filter with central
  1505. frequency @var{frequency}, and (3dB-point) band-width width.
  1506. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1507. instead of the default: constant 0dB peak gain.
  1508. The filter roll off at 6dB per octave (20dB per decade).
  1509. The filter accepts the following options:
  1510. @table @option
  1511. @item frequency, f
  1512. Set the filter's central frequency. Default is @code{3000}.
  1513. @item csg
  1514. Constant skirt gain if set to 1. Defaults to 0.
  1515. @item width_type, t
  1516. Set method to specify band-width of filter.
  1517. @table @option
  1518. @item h
  1519. Hz
  1520. @item q
  1521. Q-Factor
  1522. @item o
  1523. octave
  1524. @item s
  1525. slope
  1526. @item k
  1527. kHz
  1528. @end table
  1529. @item width, w
  1530. Specify the band-width of a filter in width_type units.
  1531. @item channels, c
  1532. Specify which channels to filter, by default all available are filtered.
  1533. @end table
  1534. @subsection Commands
  1535. This filter supports the following commands:
  1536. @table @option
  1537. @item frequency, f
  1538. Change bandpass frequency.
  1539. Syntax for the command is : "@var{frequency}"
  1540. @item width_type, t
  1541. Change bandpass width_type.
  1542. Syntax for the command is : "@var{width_type}"
  1543. @item width, w
  1544. Change bandpass width.
  1545. Syntax for the command is : "@var{width}"
  1546. @end table
  1547. @section bandreject
  1548. Apply a two-pole Butterworth band-reject filter with central
  1549. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1550. The filter roll off at 6dB per octave (20dB per decade).
  1551. The filter accepts the following options:
  1552. @table @option
  1553. @item frequency, f
  1554. Set the filter's central frequency. Default is @code{3000}.
  1555. @item width_type, t
  1556. Set method to specify band-width of filter.
  1557. @table @option
  1558. @item h
  1559. Hz
  1560. @item q
  1561. Q-Factor
  1562. @item o
  1563. octave
  1564. @item s
  1565. slope
  1566. @item k
  1567. kHz
  1568. @end table
  1569. @item width, w
  1570. Specify the band-width of a filter in width_type units.
  1571. @item channels, c
  1572. Specify which channels to filter, by default all available are filtered.
  1573. @end table
  1574. @subsection Commands
  1575. This filter supports the following commands:
  1576. @table @option
  1577. @item frequency, f
  1578. Change bandreject frequency.
  1579. Syntax for the command is : "@var{frequency}"
  1580. @item width_type, t
  1581. Change bandreject width_type.
  1582. Syntax for the command is : "@var{width_type}"
  1583. @item width, w
  1584. Change bandreject width.
  1585. Syntax for the command is : "@var{width}"
  1586. @end table
  1587. @section bass, lowshelf
  1588. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1589. shelving filter with a response similar to that of a standard
  1590. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1591. The filter accepts the following options:
  1592. @table @option
  1593. @item gain, g
  1594. Give the gain at 0 Hz. Its useful range is about -20
  1595. (for a large cut) to +20 (for a large boost).
  1596. Beware of clipping when using a positive gain.
  1597. @item frequency, f
  1598. Set the filter's central frequency and so can be used
  1599. to extend or reduce the frequency range to be boosted or cut.
  1600. The default value is @code{100} Hz.
  1601. @item width_type, t
  1602. Set method to specify band-width of filter.
  1603. @table @option
  1604. @item h
  1605. Hz
  1606. @item q
  1607. Q-Factor
  1608. @item o
  1609. octave
  1610. @item s
  1611. slope
  1612. @item k
  1613. kHz
  1614. @end table
  1615. @item width, w
  1616. Determine how steep is the filter's shelf transition.
  1617. @item channels, c
  1618. Specify which channels to filter, by default all available are filtered.
  1619. @end table
  1620. @subsection Commands
  1621. This filter supports the following commands:
  1622. @table @option
  1623. @item frequency, f
  1624. Change bass frequency.
  1625. Syntax for the command is : "@var{frequency}"
  1626. @item width_type, t
  1627. Change bass width_type.
  1628. Syntax for the command is : "@var{width_type}"
  1629. @item width, w
  1630. Change bass width.
  1631. Syntax for the command is : "@var{width}"
  1632. @item gain, g
  1633. Change bass gain.
  1634. Syntax for the command is : "@var{gain}"
  1635. @end table
  1636. @section biquad
  1637. Apply a biquad IIR filter with the given coefficients.
  1638. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1639. are the numerator and denominator coefficients respectively.
  1640. and @var{channels}, @var{c} specify which channels to filter, by default all
  1641. available are filtered.
  1642. @subsection Commands
  1643. This filter supports the following commands:
  1644. @table @option
  1645. @item a0
  1646. @item a1
  1647. @item a2
  1648. @item b0
  1649. @item b1
  1650. @item b2
  1651. Change biquad parameter.
  1652. Syntax for the command is : "@var{value}"
  1653. @end table
  1654. @section bs2b
  1655. Bauer stereo to binaural transformation, which improves headphone listening of
  1656. stereo audio records.
  1657. To enable compilation of this filter you need to configure FFmpeg with
  1658. @code{--enable-libbs2b}.
  1659. It accepts the following parameters:
  1660. @table @option
  1661. @item profile
  1662. Pre-defined crossfeed level.
  1663. @table @option
  1664. @item default
  1665. Default level (fcut=700, feed=50).
  1666. @item cmoy
  1667. Chu Moy circuit (fcut=700, feed=60).
  1668. @item jmeier
  1669. Jan Meier circuit (fcut=650, feed=95).
  1670. @end table
  1671. @item fcut
  1672. Cut frequency (in Hz).
  1673. @item feed
  1674. Feed level (in Hz).
  1675. @end table
  1676. @section channelmap
  1677. Remap input channels to new locations.
  1678. It accepts the following parameters:
  1679. @table @option
  1680. @item map
  1681. Map channels from input to output. The argument is a '|'-separated list of
  1682. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1683. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1684. channel (e.g. FL for front left) or its index in the input channel layout.
  1685. @var{out_channel} is the name of the output channel or its index in the output
  1686. channel layout. If @var{out_channel} is not given then it is implicitly an
  1687. index, starting with zero and increasing by one for each mapping.
  1688. @item channel_layout
  1689. The channel layout of the output stream.
  1690. @end table
  1691. If no mapping is present, the filter will implicitly map input channels to
  1692. output channels, preserving indices.
  1693. @subsection Examples
  1694. @itemize
  1695. @item
  1696. For example, assuming a 5.1+downmix input MOV file,
  1697. @example
  1698. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1699. @end example
  1700. will create an output WAV file tagged as stereo from the downmix channels of
  1701. the input.
  1702. @item
  1703. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1704. @example
  1705. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1706. @end example
  1707. @end itemize
  1708. @section channelsplit
  1709. Split each channel from an input audio stream into a separate output stream.
  1710. It accepts the following parameters:
  1711. @table @option
  1712. @item channel_layout
  1713. The channel layout of the input stream. The default is "stereo".
  1714. @item channels
  1715. A channel layout describing the channels to be extracted as separate output streams
  1716. or "all" to extract each input channel as a separate stream. The default is "all".
  1717. Choosing channels not present in channel layout in the input will result in an error.
  1718. @end table
  1719. @subsection Examples
  1720. @itemize
  1721. @item
  1722. For example, assuming a stereo input MP3 file,
  1723. @example
  1724. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1725. @end example
  1726. will create an output Matroska file with two audio streams, one containing only
  1727. the left channel and the other the right channel.
  1728. @item
  1729. Split a 5.1 WAV file into per-channel files:
  1730. @example
  1731. ffmpeg -i in.wav -filter_complex
  1732. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1733. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1734. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1735. side_right.wav
  1736. @end example
  1737. @item
  1738. Extract only LFE from a 5.1 WAV file:
  1739. @example
  1740. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1741. -map '[LFE]' lfe.wav
  1742. @end example
  1743. @end itemize
  1744. @section chorus
  1745. Add a chorus effect to the audio.
  1746. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1747. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1748. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1749. The modulation depth defines the range the modulated delay is played before or after
  1750. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1751. sound tuned around the original one, like in a chorus where some vocals are slightly
  1752. off key.
  1753. It accepts the following parameters:
  1754. @table @option
  1755. @item in_gain
  1756. Set input gain. Default is 0.4.
  1757. @item out_gain
  1758. Set output gain. Default is 0.4.
  1759. @item delays
  1760. Set delays. A typical delay is around 40ms to 60ms.
  1761. @item decays
  1762. Set decays.
  1763. @item speeds
  1764. Set speeds.
  1765. @item depths
  1766. Set depths.
  1767. @end table
  1768. @subsection Examples
  1769. @itemize
  1770. @item
  1771. A single delay:
  1772. @example
  1773. chorus=0.7:0.9:55:0.4:0.25:2
  1774. @end example
  1775. @item
  1776. Two delays:
  1777. @example
  1778. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1779. @end example
  1780. @item
  1781. Fuller sounding chorus with three delays:
  1782. @example
  1783. 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
  1784. @end example
  1785. @end itemize
  1786. @section compand
  1787. Compress or expand the audio's dynamic range.
  1788. It accepts the following parameters:
  1789. @table @option
  1790. @item attacks
  1791. @item decays
  1792. A list of times in seconds for each channel over which the instantaneous level
  1793. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1794. increase of volume and @var{decays} refers to decrease of volume. For most
  1795. situations, the attack time (response to the audio getting louder) should be
  1796. shorter than the decay time, because the human ear is more sensitive to sudden
  1797. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1798. a typical value for decay is 0.8 seconds.
  1799. If specified number of attacks & decays is lower than number of channels, the last
  1800. set attack/decay will be used for all remaining channels.
  1801. @item points
  1802. A list of points for the transfer function, specified in dB relative to the
  1803. maximum possible signal amplitude. Each key points list must be defined using
  1804. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1805. @code{x0/y0 x1/y1 x2/y2 ....}
  1806. The input values must be in strictly increasing order but the transfer function
  1807. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1808. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1809. function are @code{-70/-70|-60/-20|1/0}.
  1810. @item soft-knee
  1811. Set the curve radius in dB for all joints. It defaults to 0.01.
  1812. @item gain
  1813. Set the additional gain in dB to be applied at all points on the transfer
  1814. function. This allows for easy adjustment of the overall gain.
  1815. It defaults to 0.
  1816. @item volume
  1817. Set an initial volume, in dB, to be assumed for each channel when filtering
  1818. starts. This permits the user to supply a nominal level initially, so that, for
  1819. example, a very large gain is not applied to initial signal levels before the
  1820. companding has begun to operate. A typical value for audio which is initially
  1821. quiet is -90 dB. It defaults to 0.
  1822. @item delay
  1823. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1824. delayed before being fed to the volume adjuster. Specifying a delay
  1825. approximately equal to the attack/decay times allows the filter to effectively
  1826. operate in predictive rather than reactive mode. It defaults to 0.
  1827. @end table
  1828. @subsection Examples
  1829. @itemize
  1830. @item
  1831. Make music with both quiet and loud passages suitable for listening to in a
  1832. noisy environment:
  1833. @example
  1834. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1835. @end example
  1836. Another example for audio with whisper and explosion parts:
  1837. @example
  1838. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1839. @end example
  1840. @item
  1841. A noise gate for when the noise is at a lower level than the signal:
  1842. @example
  1843. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1844. @end example
  1845. @item
  1846. Here is another noise gate, this time for when the noise is at a higher level
  1847. than the signal (making it, in some ways, similar to squelch):
  1848. @example
  1849. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1850. @end example
  1851. @item
  1852. 2:1 compression starting at -6dB:
  1853. @example
  1854. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1855. @end example
  1856. @item
  1857. 2:1 compression starting at -9dB:
  1858. @example
  1859. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1860. @end example
  1861. @item
  1862. 2:1 compression starting at -12dB:
  1863. @example
  1864. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1865. @end example
  1866. @item
  1867. 2:1 compression starting at -18dB:
  1868. @example
  1869. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1870. @end example
  1871. @item
  1872. 3:1 compression starting at -15dB:
  1873. @example
  1874. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1875. @end example
  1876. @item
  1877. Compressor/Gate:
  1878. @example
  1879. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1880. @end example
  1881. @item
  1882. Expander:
  1883. @example
  1884. 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
  1885. @end example
  1886. @item
  1887. Hard limiter at -6dB:
  1888. @example
  1889. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1890. @end example
  1891. @item
  1892. Hard limiter at -12dB:
  1893. @example
  1894. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1895. @end example
  1896. @item
  1897. Hard noise gate at -35 dB:
  1898. @example
  1899. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1900. @end example
  1901. @item
  1902. Soft limiter:
  1903. @example
  1904. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1905. @end example
  1906. @end itemize
  1907. @section compensationdelay
  1908. Compensation Delay Line is a metric based delay to compensate differing
  1909. positions of microphones or speakers.
  1910. For example, you have recorded guitar with two microphones placed in
  1911. different location. Because the front of sound wave has fixed speed in
  1912. normal conditions, the phasing of microphones can vary and depends on
  1913. their location and interposition. The best sound mix can be achieved when
  1914. these microphones are in phase (synchronized). Note that distance of
  1915. ~30 cm between microphones makes one microphone to capture signal in
  1916. antiphase to another microphone. That makes the final mix sounding moody.
  1917. This filter helps to solve phasing problems by adding different delays
  1918. to each microphone track and make them synchronized.
  1919. The best result can be reached when you take one track as base and
  1920. synchronize other tracks one by one with it.
  1921. Remember that synchronization/delay tolerance depends on sample rate, too.
  1922. Higher sample rates will give more tolerance.
  1923. It accepts the following parameters:
  1924. @table @option
  1925. @item mm
  1926. Set millimeters distance. This is compensation distance for fine tuning.
  1927. Default is 0.
  1928. @item cm
  1929. Set cm distance. This is compensation distance for tightening distance setup.
  1930. Default is 0.
  1931. @item m
  1932. Set meters distance. This is compensation distance for hard distance setup.
  1933. Default is 0.
  1934. @item dry
  1935. Set dry amount. Amount of unprocessed (dry) signal.
  1936. Default is 0.
  1937. @item wet
  1938. Set wet amount. Amount of processed (wet) signal.
  1939. Default is 1.
  1940. @item temp
  1941. Set temperature degree in Celsius. This is the temperature of the environment.
  1942. Default is 20.
  1943. @end table
  1944. @section crossfeed
  1945. Apply headphone crossfeed filter.
  1946. Crossfeed is the process of blending the left and right channels of stereo
  1947. audio recording.
  1948. It is mainly used to reduce extreme stereo separation of low frequencies.
  1949. The intent is to produce more speaker like sound to the listener.
  1950. The filter accepts the following options:
  1951. @table @option
  1952. @item strength
  1953. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1954. This sets gain of low shelf filter for side part of stereo image.
  1955. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1956. @item range
  1957. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1958. This sets cut off frequency of low shelf filter. Default is cut off near
  1959. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1960. @item level_in
  1961. Set input gain. Default is 0.9.
  1962. @item level_out
  1963. Set output gain. Default is 1.
  1964. @end table
  1965. @section crystalizer
  1966. Simple algorithm to expand audio dynamic range.
  1967. The filter accepts the following options:
  1968. @table @option
  1969. @item i
  1970. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1971. (unchanged sound) to 10.0 (maximum effect).
  1972. @item c
  1973. Enable clipping. By default is enabled.
  1974. @end table
  1975. @section dcshift
  1976. Apply a DC shift to the audio.
  1977. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1978. in the recording chain) from the audio. The effect of a DC offset is reduced
  1979. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1980. a signal has a DC offset.
  1981. @table @option
  1982. @item shift
  1983. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1984. the audio.
  1985. @item limitergain
  1986. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1987. used to prevent clipping.
  1988. @end table
  1989. @section drmeter
  1990. Measure audio dynamic range.
  1991. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  1992. is found in transition material. And anything less that 8 have very poor dynamics
  1993. and is very compressed.
  1994. The filter accepts the following options:
  1995. @table @option
  1996. @item length
  1997. Set window length in seconds used to split audio into segments of equal length.
  1998. Default is 3 seconds.
  1999. @end table
  2000. @section dynaudnorm
  2001. Dynamic Audio Normalizer.
  2002. This filter applies a certain amount of gain to the input audio in order
  2003. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2004. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2005. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2006. This allows for applying extra gain to the "quiet" sections of the audio
  2007. while avoiding distortions or clipping the "loud" sections. In other words:
  2008. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2009. sections, in the sense that the volume of each section is brought to the
  2010. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2011. this goal *without* applying "dynamic range compressing". It will retain 100%
  2012. of the dynamic range *within* each section of the audio file.
  2013. @table @option
  2014. @item f
  2015. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2016. Default is 500 milliseconds.
  2017. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2018. referred to as frames. This is required, because a peak magnitude has no
  2019. meaning for just a single sample value. Instead, we need to determine the
  2020. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2021. normalizer would simply use the peak magnitude of the complete file, the
  2022. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2023. frame. The length of a frame is specified in milliseconds. By default, the
  2024. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2025. been found to give good results with most files.
  2026. Note that the exact frame length, in number of samples, will be determined
  2027. automatically, based on the sampling rate of the individual input audio file.
  2028. @item g
  2029. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2030. number. Default is 31.
  2031. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2032. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2033. is specified in frames, centered around the current frame. For the sake of
  2034. simplicity, this must be an odd number. Consequently, the default value of 31
  2035. takes into account the current frame, as well as the 15 preceding frames and
  2036. the 15 subsequent frames. Using a larger window results in a stronger
  2037. smoothing effect and thus in less gain variation, i.e. slower gain
  2038. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2039. effect and thus in more gain variation, i.e. faster gain adaptation.
  2040. In other words, the more you increase this value, the more the Dynamic Audio
  2041. Normalizer will behave like a "traditional" normalization filter. On the
  2042. contrary, the more you decrease this value, the more the Dynamic Audio
  2043. Normalizer will behave like a dynamic range compressor.
  2044. @item p
  2045. Set the target peak value. This specifies the highest permissible magnitude
  2046. level for the normalized audio input. This filter will try to approach the
  2047. target peak magnitude as closely as possible, but at the same time it also
  2048. makes sure that the normalized signal will never exceed the peak magnitude.
  2049. A frame's maximum local gain factor is imposed directly by the target peak
  2050. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2051. It is not recommended to go above this value.
  2052. @item m
  2053. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2054. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2055. factor for each input frame, i.e. the maximum gain factor that does not
  2056. result in clipping or distortion. The maximum gain factor is determined by
  2057. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2058. additionally bounds the frame's maximum gain factor by a predetermined
  2059. (global) maximum gain factor. This is done in order to avoid excessive gain
  2060. factors in "silent" or almost silent frames. By default, the maximum gain
  2061. factor is 10.0, For most inputs the default value should be sufficient and
  2062. it usually is not recommended to increase this value. Though, for input
  2063. with an extremely low overall volume level, it may be necessary to allow even
  2064. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2065. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2066. Instead, a "sigmoid" threshold function will be applied. This way, the
  2067. gain factors will smoothly approach the threshold value, but never exceed that
  2068. value.
  2069. @item r
  2070. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2071. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2072. This means that the maximum local gain factor for each frame is defined
  2073. (only) by the frame's highest magnitude sample. This way, the samples can
  2074. be amplified as much as possible without exceeding the maximum signal
  2075. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2076. Normalizer can also take into account the frame's root mean square,
  2077. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2078. determine the power of a time-varying signal. It is therefore considered
  2079. that the RMS is a better approximation of the "perceived loudness" than
  2080. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2081. frames to a constant RMS value, a uniform "perceived loudness" can be
  2082. established. If a target RMS value has been specified, a frame's local gain
  2083. factor is defined as the factor that would result in exactly that RMS value.
  2084. Note, however, that the maximum local gain factor is still restricted by the
  2085. frame's highest magnitude sample, in order to prevent clipping.
  2086. @item n
  2087. Enable channels coupling. By default is enabled.
  2088. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2089. amount. This means the same gain factor will be applied to all channels, i.e.
  2090. the maximum possible gain factor is determined by the "loudest" channel.
  2091. However, in some recordings, it may happen that the volume of the different
  2092. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2093. In this case, this option can be used to disable the channel coupling. This way,
  2094. the gain factor will be determined independently for each channel, depending
  2095. only on the individual channel's highest magnitude sample. This allows for
  2096. harmonizing the volume of the different channels.
  2097. @item c
  2098. Enable DC bias correction. By default is disabled.
  2099. An audio signal (in the time domain) is a sequence of sample values.
  2100. In the Dynamic Audio Normalizer these sample values are represented in the
  2101. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2102. audio signal, or "waveform", should be centered around the zero point.
  2103. That means if we calculate the mean value of all samples in a file, or in a
  2104. single frame, then the result should be 0.0 or at least very close to that
  2105. value. If, however, there is a significant deviation of the mean value from
  2106. 0.0, in either positive or negative direction, this is referred to as a
  2107. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2108. Audio Normalizer provides optional DC bias correction.
  2109. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2110. the mean value, or "DC correction" offset, of each input frame and subtract
  2111. that value from all of the frame's sample values which ensures those samples
  2112. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2113. boundaries, the DC correction offset values will be interpolated smoothly
  2114. between neighbouring frames.
  2115. @item b
  2116. Enable alternative boundary mode. By default is disabled.
  2117. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2118. around each frame. This includes the preceding frames as well as the
  2119. subsequent frames. However, for the "boundary" frames, located at the very
  2120. beginning and at the very end of the audio file, not all neighbouring
  2121. frames are available. In particular, for the first few frames in the audio
  2122. file, the preceding frames are not known. And, similarly, for the last few
  2123. frames in the audio file, the subsequent frames are not known. Thus, the
  2124. question arises which gain factors should be assumed for the missing frames
  2125. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2126. to deal with this situation. The default boundary mode assumes a gain factor
  2127. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2128. "fade out" at the beginning and at the end of the input, respectively.
  2129. @item s
  2130. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2131. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2132. compression. This means that signal peaks will not be pruned and thus the
  2133. full dynamic range will be retained within each local neighbourhood. However,
  2134. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2135. normalization algorithm with a more "traditional" compression.
  2136. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2137. (thresholding) function. If (and only if) the compression feature is enabled,
  2138. all input frames will be processed by a soft knee thresholding function prior
  2139. to the actual normalization process. Put simply, the thresholding function is
  2140. going to prune all samples whose magnitude exceeds a certain threshold value.
  2141. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2142. value. Instead, the threshold value will be adjusted for each individual
  2143. frame.
  2144. In general, smaller parameters result in stronger compression, and vice versa.
  2145. Values below 3.0 are not recommended, because audible distortion may appear.
  2146. @end table
  2147. @section earwax
  2148. Make audio easier to listen to on headphones.
  2149. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2150. so that when listened to on headphones the stereo image is moved from
  2151. inside your head (standard for headphones) to outside and in front of
  2152. the listener (standard for speakers).
  2153. Ported from SoX.
  2154. @section equalizer
  2155. Apply a two-pole peaking equalisation (EQ) filter. With this
  2156. filter, the signal-level at and around a selected frequency can
  2157. be increased or decreased, whilst (unlike bandpass and bandreject
  2158. filters) that at all other frequencies is unchanged.
  2159. In order to produce complex equalisation curves, this filter can
  2160. be given several times, each with a different central frequency.
  2161. The filter accepts the following options:
  2162. @table @option
  2163. @item frequency, f
  2164. Set the filter's central frequency in Hz.
  2165. @item width_type, t
  2166. Set method to specify band-width of filter.
  2167. @table @option
  2168. @item h
  2169. Hz
  2170. @item q
  2171. Q-Factor
  2172. @item o
  2173. octave
  2174. @item s
  2175. slope
  2176. @item k
  2177. kHz
  2178. @end table
  2179. @item width, w
  2180. Specify the band-width of a filter in width_type units.
  2181. @item gain, g
  2182. Set the required gain or attenuation in dB.
  2183. Beware of clipping when using a positive gain.
  2184. @item channels, c
  2185. Specify which channels to filter, by default all available are filtered.
  2186. @end table
  2187. @subsection Examples
  2188. @itemize
  2189. @item
  2190. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2191. @example
  2192. equalizer=f=1000:t=h:width=200:g=-10
  2193. @end example
  2194. @item
  2195. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2196. @example
  2197. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2198. @end example
  2199. @end itemize
  2200. @subsection Commands
  2201. This filter supports the following commands:
  2202. @table @option
  2203. @item frequency, f
  2204. Change equalizer frequency.
  2205. Syntax for the command is : "@var{frequency}"
  2206. @item width_type, t
  2207. Change equalizer width_type.
  2208. Syntax for the command is : "@var{width_type}"
  2209. @item width, w
  2210. Change equalizer width.
  2211. Syntax for the command is : "@var{width}"
  2212. @item gain, g
  2213. Change equalizer gain.
  2214. Syntax for the command is : "@var{gain}"
  2215. @end table
  2216. @section extrastereo
  2217. Linearly increases the difference between left and right channels which
  2218. adds some sort of "live" effect to playback.
  2219. The filter accepts the following options:
  2220. @table @option
  2221. @item m
  2222. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2223. (average of both channels), with 1.0 sound will be unchanged, with
  2224. -1.0 left and right channels will be swapped.
  2225. @item c
  2226. Enable clipping. By default is enabled.
  2227. @end table
  2228. @section firequalizer
  2229. Apply FIR Equalization using arbitrary frequency response.
  2230. The filter accepts the following option:
  2231. @table @option
  2232. @item gain
  2233. Set gain curve equation (in dB). The expression can contain variables:
  2234. @table @option
  2235. @item f
  2236. the evaluated frequency
  2237. @item sr
  2238. sample rate
  2239. @item ch
  2240. channel number, set to 0 when multichannels evaluation is disabled
  2241. @item chid
  2242. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2243. multichannels evaluation is disabled
  2244. @item chs
  2245. number of channels
  2246. @item chlayout
  2247. channel_layout, see libavutil/channel_layout.h
  2248. @end table
  2249. and functions:
  2250. @table @option
  2251. @item gain_interpolate(f)
  2252. interpolate gain on frequency f based on gain_entry
  2253. @item cubic_interpolate(f)
  2254. same as gain_interpolate, but smoother
  2255. @end table
  2256. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2257. @item gain_entry
  2258. Set gain entry for gain_interpolate function. The expression can
  2259. contain functions:
  2260. @table @option
  2261. @item entry(f, g)
  2262. store gain entry at frequency f with value g
  2263. @end table
  2264. This option is also available as command.
  2265. @item delay
  2266. Set filter delay in seconds. Higher value means more accurate.
  2267. Default is @code{0.01}.
  2268. @item accuracy
  2269. Set filter accuracy in Hz. Lower value means more accurate.
  2270. Default is @code{5}.
  2271. @item wfunc
  2272. Set window function. Acceptable values are:
  2273. @table @option
  2274. @item rectangular
  2275. rectangular window, useful when gain curve is already smooth
  2276. @item hann
  2277. hann window (default)
  2278. @item hamming
  2279. hamming window
  2280. @item blackman
  2281. blackman window
  2282. @item nuttall3
  2283. 3-terms continuous 1st derivative nuttall window
  2284. @item mnuttall3
  2285. minimum 3-terms discontinuous nuttall window
  2286. @item nuttall
  2287. 4-terms continuous 1st derivative nuttall window
  2288. @item bnuttall
  2289. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2290. @item bharris
  2291. blackman-harris window
  2292. @item tukey
  2293. tukey window
  2294. @end table
  2295. @item fixed
  2296. If enabled, use fixed number of audio samples. This improves speed when
  2297. filtering with large delay. Default is disabled.
  2298. @item multi
  2299. Enable multichannels evaluation on gain. Default is disabled.
  2300. @item zero_phase
  2301. Enable zero phase mode by subtracting timestamp to compensate delay.
  2302. Default is disabled.
  2303. @item scale
  2304. Set scale used by gain. Acceptable values are:
  2305. @table @option
  2306. @item linlin
  2307. linear frequency, linear gain
  2308. @item linlog
  2309. linear frequency, logarithmic (in dB) gain (default)
  2310. @item loglin
  2311. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2312. @item loglog
  2313. logarithmic frequency, logarithmic gain
  2314. @end table
  2315. @item dumpfile
  2316. Set file for dumping, suitable for gnuplot.
  2317. @item dumpscale
  2318. Set scale for dumpfile. Acceptable values are same with scale option.
  2319. Default is linlog.
  2320. @item fft2
  2321. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2322. Default is disabled.
  2323. @item min_phase
  2324. Enable minimum phase impulse response. Default is disabled.
  2325. @end table
  2326. @subsection Examples
  2327. @itemize
  2328. @item
  2329. lowpass at 1000 Hz:
  2330. @example
  2331. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2332. @end example
  2333. @item
  2334. lowpass at 1000 Hz with gain_entry:
  2335. @example
  2336. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2337. @end example
  2338. @item
  2339. custom equalization:
  2340. @example
  2341. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2342. @end example
  2343. @item
  2344. higher delay with zero phase to compensate delay:
  2345. @example
  2346. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2347. @end example
  2348. @item
  2349. lowpass on left channel, highpass on right channel:
  2350. @example
  2351. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2352. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2353. @end example
  2354. @end itemize
  2355. @section flanger
  2356. Apply a flanging effect to the audio.
  2357. The filter accepts the following options:
  2358. @table @option
  2359. @item delay
  2360. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2361. @item depth
  2362. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2363. @item regen
  2364. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2365. Default value is 0.
  2366. @item width
  2367. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2368. Default value is 71.
  2369. @item speed
  2370. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2371. @item shape
  2372. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2373. Default value is @var{sinusoidal}.
  2374. @item phase
  2375. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2376. Default value is 25.
  2377. @item interp
  2378. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2379. Default is @var{linear}.
  2380. @end table
  2381. @section haas
  2382. Apply Haas effect to audio.
  2383. Note that this makes most sense to apply on mono signals.
  2384. With this filter applied to mono signals it give some directionality and
  2385. stretches its stereo image.
  2386. The filter accepts the following options:
  2387. @table @option
  2388. @item level_in
  2389. Set input level. By default is @var{1}, or 0dB
  2390. @item level_out
  2391. Set output level. By default is @var{1}, or 0dB.
  2392. @item side_gain
  2393. Set gain applied to side part of signal. By default is @var{1}.
  2394. @item middle_source
  2395. Set kind of middle source. Can be one of the following:
  2396. @table @samp
  2397. @item left
  2398. Pick left channel.
  2399. @item right
  2400. Pick right channel.
  2401. @item mid
  2402. Pick middle part signal of stereo image.
  2403. @item side
  2404. Pick side part signal of stereo image.
  2405. @end table
  2406. @item middle_phase
  2407. Change middle phase. By default is disabled.
  2408. @item left_delay
  2409. Set left channel delay. By default is @var{2.05} milliseconds.
  2410. @item left_balance
  2411. Set left channel balance. By default is @var{-1}.
  2412. @item left_gain
  2413. Set left channel gain. By default is @var{1}.
  2414. @item left_phase
  2415. Change left phase. By default is disabled.
  2416. @item right_delay
  2417. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2418. @item right_balance
  2419. Set right channel balance. By default is @var{1}.
  2420. @item right_gain
  2421. Set right channel gain. By default is @var{1}.
  2422. @item right_phase
  2423. Change right phase. By default is enabled.
  2424. @end table
  2425. @section hdcd
  2426. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2427. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2428. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2429. of HDCD, and detects the Transient Filter flag.
  2430. @example
  2431. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2432. @end example
  2433. When using the filter with wav, note the default encoding for wav is 16-bit,
  2434. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2435. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2436. @example
  2437. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2438. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2439. @end example
  2440. The filter accepts the following options:
  2441. @table @option
  2442. @item disable_autoconvert
  2443. Disable any automatic format conversion or resampling in the filter graph.
  2444. @item process_stereo
  2445. Process the stereo channels together. If target_gain does not match between
  2446. channels, consider it invalid and use the last valid target_gain.
  2447. @item cdt_ms
  2448. Set the code detect timer period in ms.
  2449. @item force_pe
  2450. Always extend peaks above -3dBFS even if PE isn't signaled.
  2451. @item analyze_mode
  2452. Replace audio with a solid tone and adjust the amplitude to signal some
  2453. specific aspect of the decoding process. The output file can be loaded in
  2454. an audio editor alongside the original to aid analysis.
  2455. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2456. Modes are:
  2457. @table @samp
  2458. @item 0, off
  2459. Disabled
  2460. @item 1, lle
  2461. Gain adjustment level at each sample
  2462. @item 2, pe
  2463. Samples where peak extend occurs
  2464. @item 3, cdt
  2465. Samples where the code detect timer is active
  2466. @item 4, tgm
  2467. Samples where the target gain does not match between channels
  2468. @end table
  2469. @end table
  2470. @section headphone
  2471. Apply head-related transfer functions (HRTFs) to create virtual
  2472. loudspeakers around the user for binaural listening via headphones.
  2473. The HRIRs are provided via additional streams, for each channel
  2474. one stereo input stream is needed.
  2475. The filter accepts the following options:
  2476. @table @option
  2477. @item map
  2478. Set mapping of input streams for convolution.
  2479. The argument is a '|'-separated list of channel names in order as they
  2480. are given as additional stream inputs for filter.
  2481. This also specify number of input streams. Number of input streams
  2482. must be not less than number of channels in first stream plus one.
  2483. @item gain
  2484. Set gain applied to audio. Value is in dB. Default is 0.
  2485. @item type
  2486. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2487. processing audio in time domain which is slow.
  2488. @var{freq} is processing audio in frequency domain which is fast.
  2489. Default is @var{freq}.
  2490. @item lfe
  2491. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2492. @item size
  2493. Set size of frame in number of samples which will be processed at once.
  2494. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2495. @item hrir
  2496. Set format of hrir stream.
  2497. Default value is @var{stereo}. Alternative value is @var{multich}.
  2498. If value is set to @var{stereo}, number of additional streams should
  2499. be greater or equal to number of input channels in first input stream.
  2500. Also each additional stream should have stereo number of channels.
  2501. If value is set to @var{multich}, number of additional streams should
  2502. be exactly one. Also number of input channels of additional stream
  2503. should be equal or greater than twice number of channels of first input
  2504. stream.
  2505. @end table
  2506. @subsection Examples
  2507. @itemize
  2508. @item
  2509. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2510. each amovie filter use stereo file with IR coefficients as input.
  2511. The files give coefficients for each position of virtual loudspeaker:
  2512. @example
  2513. 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"
  2514. output.wav
  2515. @end example
  2516. @item
  2517. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2518. but now in @var{multich} @var{hrir} format.
  2519. @example
  2520. 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"
  2521. output.wav
  2522. @end example
  2523. @end itemize
  2524. @section highpass
  2525. Apply a high-pass filter with 3dB point frequency.
  2526. The filter can be either single-pole, or double-pole (the default).
  2527. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2528. The filter accepts the following options:
  2529. @table @option
  2530. @item frequency, f
  2531. Set frequency in Hz. Default is 3000.
  2532. @item poles, p
  2533. Set number of poles. Default is 2.
  2534. @item width_type, t
  2535. Set method to specify band-width of filter.
  2536. @table @option
  2537. @item h
  2538. Hz
  2539. @item q
  2540. Q-Factor
  2541. @item o
  2542. octave
  2543. @item s
  2544. slope
  2545. @item k
  2546. kHz
  2547. @end table
  2548. @item width, w
  2549. Specify the band-width of a filter in width_type units.
  2550. Applies only to double-pole filter.
  2551. The default is 0.707q and gives a Butterworth response.
  2552. @item channels, c
  2553. Specify which channels to filter, by default all available are filtered.
  2554. @end table
  2555. @subsection Commands
  2556. This filter supports the following commands:
  2557. @table @option
  2558. @item frequency, f
  2559. Change highpass frequency.
  2560. Syntax for the command is : "@var{frequency}"
  2561. @item width_type, t
  2562. Change highpass width_type.
  2563. Syntax for the command is : "@var{width_type}"
  2564. @item width, w
  2565. Change highpass width.
  2566. Syntax for the command is : "@var{width}"
  2567. @end table
  2568. @section join
  2569. Join multiple input streams into one multi-channel stream.
  2570. It accepts the following parameters:
  2571. @table @option
  2572. @item inputs
  2573. The number of input streams. It defaults to 2.
  2574. @item channel_layout
  2575. The desired output channel layout. It defaults to stereo.
  2576. @item map
  2577. Map channels from inputs to output. The argument is a '|'-separated list of
  2578. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2579. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2580. can be either the name of the input channel (e.g. FL for front left) or its
  2581. index in the specified input stream. @var{out_channel} is the name of the output
  2582. channel.
  2583. @end table
  2584. The filter will attempt to guess the mappings when they are not specified
  2585. explicitly. It does so by first trying to find an unused matching input channel
  2586. and if that fails it picks the first unused input channel.
  2587. Join 3 inputs (with properly set channel layouts):
  2588. @example
  2589. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2590. @end example
  2591. Build a 5.1 output from 6 single-channel streams:
  2592. @example
  2593. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2594. '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'
  2595. out
  2596. @end example
  2597. @section ladspa
  2598. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2599. To enable compilation of this filter you need to configure FFmpeg with
  2600. @code{--enable-ladspa}.
  2601. @table @option
  2602. @item file, f
  2603. Specifies the name of LADSPA plugin library to load. If the environment
  2604. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2605. each one of the directories specified by the colon separated list in
  2606. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2607. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2608. @file{/usr/lib/ladspa/}.
  2609. @item plugin, p
  2610. Specifies the plugin within the library. Some libraries contain only
  2611. one plugin, but others contain many of them. If this is not set filter
  2612. will list all available plugins within the specified library.
  2613. @item controls, c
  2614. Set the '|' separated list of controls which are zero or more floating point
  2615. values that determine the behavior of the loaded plugin (for example delay,
  2616. threshold or gain).
  2617. Controls need to be defined using the following syntax:
  2618. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2619. @var{valuei} is the value set on the @var{i}-th control.
  2620. Alternatively they can be also defined using the following syntax:
  2621. @var{value0}|@var{value1}|@var{value2}|..., where
  2622. @var{valuei} is the value set on the @var{i}-th control.
  2623. If @option{controls} is set to @code{help}, all available controls and
  2624. their valid ranges are printed.
  2625. @item sample_rate, s
  2626. Specify the sample rate, default to 44100. Only used if plugin have
  2627. zero inputs.
  2628. @item nb_samples, n
  2629. Set the number of samples per channel per each output frame, default
  2630. is 1024. Only used if plugin have zero inputs.
  2631. @item duration, d
  2632. Set the minimum duration of the sourced audio. See
  2633. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2634. for the accepted syntax.
  2635. Note that the resulting duration may be greater than the specified duration,
  2636. as the generated audio is always cut at the end of a complete frame.
  2637. If not specified, or the expressed duration is negative, the audio is
  2638. supposed to be generated forever.
  2639. Only used if plugin have zero inputs.
  2640. @end table
  2641. @subsection Examples
  2642. @itemize
  2643. @item
  2644. List all available plugins within amp (LADSPA example plugin) library:
  2645. @example
  2646. ladspa=file=amp
  2647. @end example
  2648. @item
  2649. List all available controls and their valid ranges for @code{vcf_notch}
  2650. plugin from @code{VCF} library:
  2651. @example
  2652. ladspa=f=vcf:p=vcf_notch:c=help
  2653. @end example
  2654. @item
  2655. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2656. plugin library:
  2657. @example
  2658. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2659. @end example
  2660. @item
  2661. Add reverberation to the audio using TAP-plugins
  2662. (Tom's Audio Processing plugins):
  2663. @example
  2664. ladspa=file=tap_reverb:tap_reverb
  2665. @end example
  2666. @item
  2667. Generate white noise, with 0.2 amplitude:
  2668. @example
  2669. ladspa=file=cmt:noise_source_white:c=c0=.2
  2670. @end example
  2671. @item
  2672. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2673. @code{C* Audio Plugin Suite} (CAPS) library:
  2674. @example
  2675. ladspa=file=caps:Click:c=c1=20'
  2676. @end example
  2677. @item
  2678. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2679. @example
  2680. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2681. @end example
  2682. @item
  2683. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2684. @code{SWH Plugins} collection:
  2685. @example
  2686. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2687. @end example
  2688. @item
  2689. Attenuate low frequencies using Multiband EQ from Steve Harris
  2690. @code{SWH Plugins} collection:
  2691. @example
  2692. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2693. @end example
  2694. @item
  2695. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2696. (CAPS) library:
  2697. @example
  2698. ladspa=caps:Narrower
  2699. @end example
  2700. @item
  2701. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2702. @example
  2703. ladspa=caps:White:.2
  2704. @end example
  2705. @item
  2706. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2707. @example
  2708. ladspa=caps:Fractal:c=c1=1
  2709. @end example
  2710. @item
  2711. Dynamic volume normalization using @code{VLevel} plugin:
  2712. @example
  2713. ladspa=vlevel-ladspa:vlevel_mono
  2714. @end example
  2715. @end itemize
  2716. @subsection Commands
  2717. This filter supports the following commands:
  2718. @table @option
  2719. @item cN
  2720. Modify the @var{N}-th control value.
  2721. If the specified value is not valid, it is ignored and prior one is kept.
  2722. @end table
  2723. @section loudnorm
  2724. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2725. Support for both single pass (livestreams, files) and double pass (files) modes.
  2726. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2727. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2728. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2729. The filter accepts the following options:
  2730. @table @option
  2731. @item I, i
  2732. Set integrated loudness target.
  2733. Range is -70.0 - -5.0. Default value is -24.0.
  2734. @item LRA, lra
  2735. Set loudness range target.
  2736. Range is 1.0 - 20.0. Default value is 7.0.
  2737. @item TP, tp
  2738. Set maximum true peak.
  2739. Range is -9.0 - +0.0. Default value is -2.0.
  2740. @item measured_I, measured_i
  2741. Measured IL of input file.
  2742. Range is -99.0 - +0.0.
  2743. @item measured_LRA, measured_lra
  2744. Measured LRA of input file.
  2745. Range is 0.0 - 99.0.
  2746. @item measured_TP, measured_tp
  2747. Measured true peak of input file.
  2748. Range is -99.0 - +99.0.
  2749. @item measured_thresh
  2750. Measured threshold of input file.
  2751. Range is -99.0 - +0.0.
  2752. @item offset
  2753. Set offset gain. Gain is applied before the true-peak limiter.
  2754. Range is -99.0 - +99.0. Default is +0.0.
  2755. @item linear
  2756. Normalize linearly if possible.
  2757. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2758. to be specified in order to use this mode.
  2759. Options are true or false. Default is true.
  2760. @item dual_mono
  2761. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2762. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2763. If set to @code{true}, this option will compensate for this effect.
  2764. Multi-channel input files are not affected by this option.
  2765. Options are true or false. Default is false.
  2766. @item print_format
  2767. Set print format for stats. Options are summary, json, or none.
  2768. Default value is none.
  2769. @end table
  2770. @section lowpass
  2771. Apply a low-pass filter with 3dB point frequency.
  2772. The filter can be either single-pole or double-pole (the default).
  2773. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2774. The filter accepts the following options:
  2775. @table @option
  2776. @item frequency, f
  2777. Set frequency in Hz. Default is 500.
  2778. @item poles, p
  2779. Set number of poles. Default is 2.
  2780. @item width_type, t
  2781. Set method to specify band-width of filter.
  2782. @table @option
  2783. @item h
  2784. Hz
  2785. @item q
  2786. Q-Factor
  2787. @item o
  2788. octave
  2789. @item s
  2790. slope
  2791. @item k
  2792. kHz
  2793. @end table
  2794. @item width, w
  2795. Specify the band-width of a filter in width_type units.
  2796. Applies only to double-pole filter.
  2797. The default is 0.707q and gives a Butterworth response.
  2798. @item channels, c
  2799. Specify which channels to filter, by default all available are filtered.
  2800. @end table
  2801. @subsection Examples
  2802. @itemize
  2803. @item
  2804. Lowpass only LFE channel, it LFE is not present it does nothing:
  2805. @example
  2806. lowpass=c=LFE
  2807. @end example
  2808. @end itemize
  2809. @subsection Commands
  2810. This filter supports the following commands:
  2811. @table @option
  2812. @item frequency, f
  2813. Change lowpass frequency.
  2814. Syntax for the command is : "@var{frequency}"
  2815. @item width_type, t
  2816. Change lowpass width_type.
  2817. Syntax for the command is : "@var{width_type}"
  2818. @item width, w
  2819. Change lowpass width.
  2820. Syntax for the command is : "@var{width}"
  2821. @end table
  2822. @section lv2
  2823. Load a LV2 (LADSPA Version 2) plugin.
  2824. To enable compilation of this filter you need to configure FFmpeg with
  2825. @code{--enable-lv2}.
  2826. @table @option
  2827. @item plugin, p
  2828. Specifies the plugin URI. You may need to escape ':'.
  2829. @item controls, c
  2830. Set the '|' separated list of controls which are zero or more floating point
  2831. values that determine the behavior of the loaded plugin (for example delay,
  2832. threshold or gain).
  2833. If @option{controls} is set to @code{help}, all available controls and
  2834. their valid ranges are printed.
  2835. @item sample_rate, s
  2836. Specify the sample rate, default to 44100. Only used if plugin have
  2837. zero inputs.
  2838. @item nb_samples, n
  2839. Set the number of samples per channel per each output frame, default
  2840. is 1024. Only used if plugin have zero inputs.
  2841. @item duration, d
  2842. Set the minimum duration of the sourced audio. See
  2843. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2844. for the accepted syntax.
  2845. Note that the resulting duration may be greater than the specified duration,
  2846. as the generated audio is always cut at the end of a complete frame.
  2847. If not specified, or the expressed duration is negative, the audio is
  2848. supposed to be generated forever.
  2849. Only used if plugin have zero inputs.
  2850. @end table
  2851. @subsection Examples
  2852. @itemize
  2853. @item
  2854. Apply bass enhancer plugin from Calf:
  2855. @example
  2856. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2857. @end example
  2858. @item
  2859. Apply vinyl plugin from Calf:
  2860. @example
  2861. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2862. @end example
  2863. @item
  2864. Apply bit crusher plugin from ArtyFX:
  2865. @example
  2866. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2867. @end example
  2868. @end itemize
  2869. @section mcompand
  2870. Multiband Compress or expand the audio's dynamic range.
  2871. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2872. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2873. response when absent compander action.
  2874. It accepts the following parameters:
  2875. @table @option
  2876. @item args
  2877. This option syntax is:
  2878. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2879. For explanation of each item refer to compand filter documentation.
  2880. @end table
  2881. @anchor{pan}
  2882. @section pan
  2883. Mix channels with specific gain levels. The filter accepts the output
  2884. channel layout followed by a set of channels definitions.
  2885. This filter is also designed to efficiently remap the channels of an audio
  2886. stream.
  2887. The filter accepts parameters of the form:
  2888. "@var{l}|@var{outdef}|@var{outdef}|..."
  2889. @table @option
  2890. @item l
  2891. output channel layout or number of channels
  2892. @item outdef
  2893. output channel specification, of the form:
  2894. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2895. @item out_name
  2896. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2897. number (c0, c1, etc.)
  2898. @item gain
  2899. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2900. @item in_name
  2901. input channel to use, see out_name for details; it is not possible to mix
  2902. named and numbered input channels
  2903. @end table
  2904. If the `=' in a channel specification is replaced by `<', then the gains for
  2905. that specification will be renormalized so that the total is 1, thus
  2906. avoiding clipping noise.
  2907. @subsection Mixing examples
  2908. For example, if you want to down-mix from stereo to mono, but with a bigger
  2909. factor for the left channel:
  2910. @example
  2911. pan=1c|c0=0.9*c0+0.1*c1
  2912. @end example
  2913. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2914. 7-channels surround:
  2915. @example
  2916. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2917. @end example
  2918. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2919. that should be preferred (see "-ac" option) unless you have very specific
  2920. needs.
  2921. @subsection Remapping examples
  2922. The channel remapping will be effective if, and only if:
  2923. @itemize
  2924. @item gain coefficients are zeroes or ones,
  2925. @item only one input per channel output,
  2926. @end itemize
  2927. If all these conditions are satisfied, the filter will notify the user ("Pure
  2928. channel mapping detected"), and use an optimized and lossless method to do the
  2929. remapping.
  2930. For example, if you have a 5.1 source and want a stereo audio stream by
  2931. dropping the extra channels:
  2932. @example
  2933. pan="stereo| c0=FL | c1=FR"
  2934. @end example
  2935. Given the same source, you can also switch front left and front right channels
  2936. and keep the input channel layout:
  2937. @example
  2938. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2939. @end example
  2940. If the input is a stereo audio stream, you can mute the front left channel (and
  2941. still keep the stereo channel layout) with:
  2942. @example
  2943. pan="stereo|c1=c1"
  2944. @end example
  2945. Still with a stereo audio stream input, you can copy the right channel in both
  2946. front left and right:
  2947. @example
  2948. pan="stereo| c0=FR | c1=FR"
  2949. @end example
  2950. @section replaygain
  2951. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2952. outputs it unchanged.
  2953. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2954. @section resample
  2955. Convert the audio sample format, sample rate and channel layout. It is
  2956. not meant to be used directly.
  2957. @section rubberband
  2958. Apply time-stretching and pitch-shifting with librubberband.
  2959. The filter accepts the following options:
  2960. @table @option
  2961. @item tempo
  2962. Set tempo scale factor.
  2963. @item pitch
  2964. Set pitch scale factor.
  2965. @item transients
  2966. Set transients detector.
  2967. Possible values are:
  2968. @table @var
  2969. @item crisp
  2970. @item mixed
  2971. @item smooth
  2972. @end table
  2973. @item detector
  2974. Set detector.
  2975. Possible values are:
  2976. @table @var
  2977. @item compound
  2978. @item percussive
  2979. @item soft
  2980. @end table
  2981. @item phase
  2982. Set phase.
  2983. Possible values are:
  2984. @table @var
  2985. @item laminar
  2986. @item independent
  2987. @end table
  2988. @item window
  2989. Set processing window size.
  2990. Possible values are:
  2991. @table @var
  2992. @item standard
  2993. @item short
  2994. @item long
  2995. @end table
  2996. @item smoothing
  2997. Set smoothing.
  2998. Possible values are:
  2999. @table @var
  3000. @item off
  3001. @item on
  3002. @end table
  3003. @item formant
  3004. Enable formant preservation when shift pitching.
  3005. Possible values are:
  3006. @table @var
  3007. @item shifted
  3008. @item preserved
  3009. @end table
  3010. @item pitchq
  3011. Set pitch quality.
  3012. Possible values are:
  3013. @table @var
  3014. @item quality
  3015. @item speed
  3016. @item consistency
  3017. @end table
  3018. @item channels
  3019. Set channels.
  3020. Possible values are:
  3021. @table @var
  3022. @item apart
  3023. @item together
  3024. @end table
  3025. @end table
  3026. @section sidechaincompress
  3027. This filter acts like normal compressor but has the ability to compress
  3028. detected signal using second input signal.
  3029. It needs two input streams and returns one output stream.
  3030. First input stream will be processed depending on second stream signal.
  3031. The filtered signal then can be filtered with other filters in later stages of
  3032. processing. See @ref{pan} and @ref{amerge} filter.
  3033. The filter accepts the following options:
  3034. @table @option
  3035. @item level_in
  3036. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3037. @item threshold
  3038. If a signal of second stream raises above this level it will affect the gain
  3039. reduction of first stream.
  3040. By default is 0.125. Range is between 0.00097563 and 1.
  3041. @item ratio
  3042. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3043. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3044. Default is 2. Range is between 1 and 20.
  3045. @item attack
  3046. Amount of milliseconds the signal has to rise above the threshold before gain
  3047. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3048. @item release
  3049. Amount of milliseconds the signal has to fall below the threshold before
  3050. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3051. @item makeup
  3052. Set the amount by how much signal will be amplified after processing.
  3053. Default is 1. Range is from 1 to 64.
  3054. @item knee
  3055. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3056. Default is 2.82843. Range is between 1 and 8.
  3057. @item link
  3058. Choose if the @code{average} level between all channels of side-chain stream
  3059. or the louder(@code{maximum}) channel of side-chain stream affects the
  3060. reduction. Default is @code{average}.
  3061. @item detection
  3062. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3063. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3064. @item level_sc
  3065. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3066. @item mix
  3067. How much to use compressed signal in output. Default is 1.
  3068. Range is between 0 and 1.
  3069. @end table
  3070. @subsection Examples
  3071. @itemize
  3072. @item
  3073. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3074. depending on the signal of 2nd input and later compressed signal to be
  3075. merged with 2nd input:
  3076. @example
  3077. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3078. @end example
  3079. @end itemize
  3080. @section sidechaingate
  3081. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3082. filter the detected signal before sending it to the gain reduction stage.
  3083. Normally a gate uses the full range signal to detect a level above the
  3084. threshold.
  3085. For example: If you cut all lower frequencies from your sidechain signal
  3086. the gate will decrease the volume of your track only if not enough highs
  3087. appear. With this technique you are able to reduce the resonation of a
  3088. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3089. guitar.
  3090. It needs two input streams and returns one output stream.
  3091. First input stream will be processed depending on second stream signal.
  3092. The filter accepts the following options:
  3093. @table @option
  3094. @item level_in
  3095. Set input level before filtering.
  3096. Default is 1. Allowed range is from 0.015625 to 64.
  3097. @item range
  3098. Set the level of gain reduction when the signal is below the threshold.
  3099. Default is 0.06125. Allowed range is from 0 to 1.
  3100. @item threshold
  3101. If a signal rises above this level the gain reduction is released.
  3102. Default is 0.125. Allowed range is from 0 to 1.
  3103. @item ratio
  3104. Set a ratio about which the signal is reduced.
  3105. Default is 2. Allowed range is from 1 to 9000.
  3106. @item attack
  3107. Amount of milliseconds the signal has to rise above the threshold before gain
  3108. reduction stops.
  3109. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3110. @item release
  3111. Amount of milliseconds the signal has to fall below the threshold before the
  3112. reduction is increased again. Default is 250 milliseconds.
  3113. Allowed range is from 0.01 to 9000.
  3114. @item makeup
  3115. Set amount of amplification of signal after processing.
  3116. Default is 1. Allowed range is from 1 to 64.
  3117. @item knee
  3118. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3119. Default is 2.828427125. Allowed range is from 1 to 8.
  3120. @item detection
  3121. Choose if exact signal should be taken for detection or an RMS like one.
  3122. Default is rms. Can be peak or rms.
  3123. @item link
  3124. Choose if the average level between all channels or the louder channel affects
  3125. the reduction.
  3126. Default is average. Can be average or maximum.
  3127. @item level_sc
  3128. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3129. @end table
  3130. @section silencedetect
  3131. Detect silence in an audio stream.
  3132. This filter logs a message when it detects that the input audio volume is less
  3133. or equal to a noise tolerance value for a duration greater or equal to the
  3134. minimum detected noise duration.
  3135. The printed times and duration are expressed in seconds.
  3136. The filter accepts the following options:
  3137. @table @option
  3138. @item duration, d
  3139. Set silence duration until notification (default is 2 seconds).
  3140. @item noise, n
  3141. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3142. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3143. @end table
  3144. @subsection Examples
  3145. @itemize
  3146. @item
  3147. Detect 5 seconds of silence with -50dB noise tolerance:
  3148. @example
  3149. silencedetect=n=-50dB:d=5
  3150. @end example
  3151. @item
  3152. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3153. tolerance in @file{silence.mp3}:
  3154. @example
  3155. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3156. @end example
  3157. @end itemize
  3158. @section silenceremove
  3159. Remove silence from the beginning, middle or end of the audio.
  3160. The filter accepts the following options:
  3161. @table @option
  3162. @item start_periods
  3163. This value is used to indicate if audio should be trimmed at beginning of
  3164. the audio. A value of zero indicates no silence should be trimmed from the
  3165. beginning. When specifying a non-zero value, it trims audio up until it
  3166. finds non-silence. Normally, when trimming silence from beginning of audio
  3167. the @var{start_periods} will be @code{1} but it can be increased to higher
  3168. values to trim all audio up to specific count of non-silence periods.
  3169. Default value is @code{0}.
  3170. @item start_duration
  3171. Specify the amount of time that non-silence must be detected before it stops
  3172. trimming audio. By increasing the duration, bursts of noises can be treated
  3173. as silence and trimmed off. Default value is @code{0}.
  3174. @item start_threshold
  3175. This indicates what sample value should be treated as silence. For digital
  3176. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3177. you may wish to increase the value to account for background noise.
  3178. Can be specified in dB (in case "dB" is appended to the specified value)
  3179. or amplitude ratio. Default value is @code{0}.
  3180. @item stop_periods
  3181. Set the count for trimming silence from the end of audio.
  3182. To remove silence from the middle of a file, specify a @var{stop_periods}
  3183. that is negative. This value is then treated as a positive value and is
  3184. used to indicate the effect should restart processing as specified by
  3185. @var{start_periods}, making it suitable for removing periods of silence
  3186. in the middle of the audio.
  3187. Default value is @code{0}.
  3188. @item stop_duration
  3189. Specify a duration of silence that must exist before audio is not copied any
  3190. more. By specifying a higher duration, silence that is wanted can be left in
  3191. the audio.
  3192. Default value is @code{0}.
  3193. @item stop_threshold
  3194. This is the same as @option{start_threshold} but for trimming silence from
  3195. the end of audio.
  3196. Can be specified in dB (in case "dB" is appended to the specified value)
  3197. or amplitude ratio. Default value is @code{0}.
  3198. @item leave_silence
  3199. This indicates that @var{stop_duration} length of audio should be left intact
  3200. at the beginning of each period of silence.
  3201. For example, if you want to remove long pauses between words but do not want
  3202. to remove the pauses completely. Default value is @code{0}.
  3203. @item detection
  3204. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3205. and works better with digital silence which is exactly 0.
  3206. Default value is @code{rms}.
  3207. @item window
  3208. Set ratio used to calculate size of window for detecting silence.
  3209. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3210. @end table
  3211. @subsection Examples
  3212. @itemize
  3213. @item
  3214. The following example shows how this filter can be used to start a recording
  3215. that does not contain the delay at the start which usually occurs between
  3216. pressing the record button and the start of the performance:
  3217. @example
  3218. silenceremove=1:5:0.02
  3219. @end example
  3220. @item
  3221. Trim all silence encountered from beginning to end where there is more than 1
  3222. second of silence in audio:
  3223. @example
  3224. silenceremove=0:0:0:-1:1:-90dB
  3225. @end example
  3226. @end itemize
  3227. @section sofalizer
  3228. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3229. loudspeakers around the user for binaural listening via headphones (audio
  3230. formats up to 9 channels supported).
  3231. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3232. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3233. Austrian Academy of Sciences.
  3234. To enable compilation of this filter you need to configure FFmpeg with
  3235. @code{--enable-libmysofa}.
  3236. The filter accepts the following options:
  3237. @table @option
  3238. @item sofa
  3239. Set the SOFA file used for rendering.
  3240. @item gain
  3241. Set gain applied to audio. Value is in dB. Default is 0.
  3242. @item rotation
  3243. Set rotation of virtual loudspeakers in deg. Default is 0.
  3244. @item elevation
  3245. Set elevation of virtual speakers in deg. Default is 0.
  3246. @item radius
  3247. Set distance in meters between loudspeakers and the listener with near-field
  3248. HRTFs. Default is 1.
  3249. @item type
  3250. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3251. processing audio in time domain which is slow.
  3252. @var{freq} is processing audio in frequency domain which is fast.
  3253. Default is @var{freq}.
  3254. @item speakers
  3255. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3256. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3257. Each virtual loudspeaker is described with short channel name following with
  3258. azimuth and elevation in degrees.
  3259. Each virtual loudspeaker description is separated by '|'.
  3260. For example to override front left and front right channel positions use:
  3261. 'speakers=FL 45 15|FR 345 15'.
  3262. Descriptions with unrecognised channel names are ignored.
  3263. @item lfegain
  3264. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3265. @end table
  3266. @subsection Examples
  3267. @itemize
  3268. @item
  3269. Using ClubFritz6 sofa file:
  3270. @example
  3271. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3272. @end example
  3273. @item
  3274. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3275. @example
  3276. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3277. @end example
  3278. @item
  3279. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3280. and also with custom gain:
  3281. @example
  3282. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3283. @end example
  3284. @end itemize
  3285. @section stereotools
  3286. This filter has some handy utilities to manage stereo signals, for converting
  3287. M/S stereo recordings to L/R signal while having control over the parameters
  3288. or spreading the stereo image of master track.
  3289. The filter accepts the following options:
  3290. @table @option
  3291. @item level_in
  3292. Set input level before filtering for both channels. Defaults is 1.
  3293. Allowed range is from 0.015625 to 64.
  3294. @item level_out
  3295. Set output level after filtering for both channels. Defaults is 1.
  3296. Allowed range is from 0.015625 to 64.
  3297. @item balance_in
  3298. Set input balance between both channels. Default is 0.
  3299. Allowed range is from -1 to 1.
  3300. @item balance_out
  3301. Set output balance between both channels. Default is 0.
  3302. Allowed range is from -1 to 1.
  3303. @item softclip
  3304. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3305. clipping. Disabled by default.
  3306. @item mutel
  3307. Mute the left channel. Disabled by default.
  3308. @item muter
  3309. Mute the right channel. Disabled by default.
  3310. @item phasel
  3311. Change the phase of the left channel. Disabled by default.
  3312. @item phaser
  3313. Change the phase of the right channel. Disabled by default.
  3314. @item mode
  3315. Set stereo mode. Available values are:
  3316. @table @samp
  3317. @item lr>lr
  3318. Left/Right to Left/Right, this is default.
  3319. @item lr>ms
  3320. Left/Right to Mid/Side.
  3321. @item ms>lr
  3322. Mid/Side to Left/Right.
  3323. @item lr>ll
  3324. Left/Right to Left/Left.
  3325. @item lr>rr
  3326. Left/Right to Right/Right.
  3327. @item lr>l+r
  3328. Left/Right to Left + Right.
  3329. @item lr>rl
  3330. Left/Right to Right/Left.
  3331. @item ms>ll
  3332. Mid/Side to Left/Left.
  3333. @item ms>rr
  3334. Mid/Side to Right/Right.
  3335. @end table
  3336. @item slev
  3337. Set level of side signal. Default is 1.
  3338. Allowed range is from 0.015625 to 64.
  3339. @item sbal
  3340. Set balance of side signal. Default is 0.
  3341. Allowed range is from -1 to 1.
  3342. @item mlev
  3343. Set level of the middle signal. Default is 1.
  3344. Allowed range is from 0.015625 to 64.
  3345. @item mpan
  3346. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3347. @item base
  3348. Set stereo base between mono and inversed channels. Default is 0.
  3349. Allowed range is from -1 to 1.
  3350. @item delay
  3351. Set delay in milliseconds how much to delay left from right channel and
  3352. vice versa. Default is 0. Allowed range is from -20 to 20.
  3353. @item sclevel
  3354. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3355. @item phase
  3356. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3357. @item bmode_in, bmode_out
  3358. Set balance mode for balance_in/balance_out option.
  3359. Can be one of the following:
  3360. @table @samp
  3361. @item balance
  3362. Classic balance mode. Attenuate one channel at time.
  3363. Gain is raised up to 1.
  3364. @item amplitude
  3365. Similar as classic mode above but gain is raised up to 2.
  3366. @item power
  3367. Equal power distribution, from -6dB to +6dB range.
  3368. @end table
  3369. @end table
  3370. @subsection Examples
  3371. @itemize
  3372. @item
  3373. Apply karaoke like effect:
  3374. @example
  3375. stereotools=mlev=0.015625
  3376. @end example
  3377. @item
  3378. Convert M/S signal to L/R:
  3379. @example
  3380. "stereotools=mode=ms>lr"
  3381. @end example
  3382. @end itemize
  3383. @section stereowiden
  3384. This filter enhance the stereo effect by suppressing signal common to both
  3385. channels and by delaying the signal of left into right and vice versa,
  3386. thereby widening the stereo effect.
  3387. The filter accepts the following options:
  3388. @table @option
  3389. @item delay
  3390. Time in milliseconds of the delay of left signal into right and vice versa.
  3391. Default is 20 milliseconds.
  3392. @item feedback
  3393. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3394. effect of left signal in right output and vice versa which gives widening
  3395. effect. Default is 0.3.
  3396. @item crossfeed
  3397. Cross feed of left into right with inverted phase. This helps in suppressing
  3398. the mono. If the value is 1 it will cancel all the signal common to both
  3399. channels. Default is 0.3.
  3400. @item drymix
  3401. Set level of input signal of original channel. Default is 0.8.
  3402. @end table
  3403. @section superequalizer
  3404. Apply 18 band equalizer.
  3405. The filter accepts the following options:
  3406. @table @option
  3407. @item 1b
  3408. Set 65Hz band gain.
  3409. @item 2b
  3410. Set 92Hz band gain.
  3411. @item 3b
  3412. Set 131Hz band gain.
  3413. @item 4b
  3414. Set 185Hz band gain.
  3415. @item 5b
  3416. Set 262Hz band gain.
  3417. @item 6b
  3418. Set 370Hz band gain.
  3419. @item 7b
  3420. Set 523Hz band gain.
  3421. @item 8b
  3422. Set 740Hz band gain.
  3423. @item 9b
  3424. Set 1047Hz band gain.
  3425. @item 10b
  3426. Set 1480Hz band gain.
  3427. @item 11b
  3428. Set 2093Hz band gain.
  3429. @item 12b
  3430. Set 2960Hz band gain.
  3431. @item 13b
  3432. Set 4186Hz band gain.
  3433. @item 14b
  3434. Set 5920Hz band gain.
  3435. @item 15b
  3436. Set 8372Hz band gain.
  3437. @item 16b
  3438. Set 11840Hz band gain.
  3439. @item 17b
  3440. Set 16744Hz band gain.
  3441. @item 18b
  3442. Set 20000Hz band gain.
  3443. @end table
  3444. @section surround
  3445. Apply audio surround upmix filter.
  3446. This filter allows to produce multichannel output from audio stream.
  3447. The filter accepts the following options:
  3448. @table @option
  3449. @item chl_out
  3450. Set output channel layout. By default, this is @var{5.1}.
  3451. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3452. for the required syntax.
  3453. @item chl_in
  3454. Set input channel layout. By default, this is @var{stereo}.
  3455. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3456. for the required syntax.
  3457. @item level_in
  3458. Set input volume level. By default, this is @var{1}.
  3459. @item level_out
  3460. Set output volume level. By default, this is @var{1}.
  3461. @item lfe
  3462. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3463. @item lfe_low
  3464. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3465. @item lfe_high
  3466. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3467. @item fc_in
  3468. Set front center input volume. By default, this is @var{1}.
  3469. @item fc_out
  3470. Set front center output volume. By default, this is @var{1}.
  3471. @item lfe_in
  3472. Set LFE input volume. By default, this is @var{1}.
  3473. @item lfe_out
  3474. Set LFE output volume. By default, this is @var{1}.
  3475. @end table
  3476. @section treble, highshelf
  3477. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3478. shelving filter with a response similar to that of a standard
  3479. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3480. The filter accepts the following options:
  3481. @table @option
  3482. @item gain, g
  3483. Give the gain at whichever is the lower of ~22 kHz and the
  3484. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3485. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3486. @item frequency, f
  3487. Set the filter's central frequency and so can be used
  3488. to extend or reduce the frequency range to be boosted or cut.
  3489. The default value is @code{3000} Hz.
  3490. @item width_type, t
  3491. Set method to specify band-width of filter.
  3492. @table @option
  3493. @item h
  3494. Hz
  3495. @item q
  3496. Q-Factor
  3497. @item o
  3498. octave
  3499. @item s
  3500. slope
  3501. @item k
  3502. kHz
  3503. @end table
  3504. @item width, w
  3505. Determine how steep is the filter's shelf transition.
  3506. @item channels, c
  3507. Specify which channels to filter, by default all available are filtered.
  3508. @end table
  3509. @subsection Commands
  3510. This filter supports the following commands:
  3511. @table @option
  3512. @item frequency, f
  3513. Change treble frequency.
  3514. Syntax for the command is : "@var{frequency}"
  3515. @item width_type, t
  3516. Change treble width_type.
  3517. Syntax for the command is : "@var{width_type}"
  3518. @item width, w
  3519. Change treble width.
  3520. Syntax for the command is : "@var{width}"
  3521. @item gain, g
  3522. Change treble gain.
  3523. Syntax for the command is : "@var{gain}"
  3524. @end table
  3525. @section tremolo
  3526. Sinusoidal amplitude modulation.
  3527. The filter accepts the following options:
  3528. @table @option
  3529. @item f
  3530. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3531. (20 Hz or lower) will result in a tremolo effect.
  3532. This filter may also be used as a ring modulator by specifying
  3533. a modulation frequency higher than 20 Hz.
  3534. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3535. @item d
  3536. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3537. Default value is 0.5.
  3538. @end table
  3539. @section vibrato
  3540. Sinusoidal phase modulation.
  3541. The filter accepts the following options:
  3542. @table @option
  3543. @item f
  3544. Modulation frequency in Hertz.
  3545. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3546. @item d
  3547. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3548. Default value is 0.5.
  3549. @end table
  3550. @section volume
  3551. Adjust the input audio volume.
  3552. It accepts the following parameters:
  3553. @table @option
  3554. @item volume
  3555. Set audio volume expression.
  3556. Output values are clipped to the maximum value.
  3557. The output audio volume is given by the relation:
  3558. @example
  3559. @var{output_volume} = @var{volume} * @var{input_volume}
  3560. @end example
  3561. The default value for @var{volume} is "1.0".
  3562. @item precision
  3563. This parameter represents the mathematical precision.
  3564. It determines which input sample formats will be allowed, which affects the
  3565. precision of the volume scaling.
  3566. @table @option
  3567. @item fixed
  3568. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3569. @item float
  3570. 32-bit floating-point; this limits input sample format to FLT. (default)
  3571. @item double
  3572. 64-bit floating-point; this limits input sample format to DBL.
  3573. @end table
  3574. @item replaygain
  3575. Choose the behaviour on encountering ReplayGain side data in input frames.
  3576. @table @option
  3577. @item drop
  3578. Remove ReplayGain side data, ignoring its contents (the default).
  3579. @item ignore
  3580. Ignore ReplayGain side data, but leave it in the frame.
  3581. @item track
  3582. Prefer the track gain, if present.
  3583. @item album
  3584. Prefer the album gain, if present.
  3585. @end table
  3586. @item replaygain_preamp
  3587. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3588. Default value for @var{replaygain_preamp} is 0.0.
  3589. @item eval
  3590. Set when the volume expression is evaluated.
  3591. It accepts the following values:
  3592. @table @samp
  3593. @item once
  3594. only evaluate expression once during the filter initialization, or
  3595. when the @samp{volume} command is sent
  3596. @item frame
  3597. evaluate expression for each incoming frame
  3598. @end table
  3599. Default value is @samp{once}.
  3600. @end table
  3601. The volume expression can contain the following parameters.
  3602. @table @option
  3603. @item n
  3604. frame number (starting at zero)
  3605. @item nb_channels
  3606. number of channels
  3607. @item nb_consumed_samples
  3608. number of samples consumed by the filter
  3609. @item nb_samples
  3610. number of samples in the current frame
  3611. @item pos
  3612. original frame position in the file
  3613. @item pts
  3614. frame PTS
  3615. @item sample_rate
  3616. sample rate
  3617. @item startpts
  3618. PTS at start of stream
  3619. @item startt
  3620. time at start of stream
  3621. @item t
  3622. frame time
  3623. @item tb
  3624. timestamp timebase
  3625. @item volume
  3626. last set volume value
  3627. @end table
  3628. Note that when @option{eval} is set to @samp{once} only the
  3629. @var{sample_rate} and @var{tb} variables are available, all other
  3630. variables will evaluate to NAN.
  3631. @subsection Commands
  3632. This filter supports the following commands:
  3633. @table @option
  3634. @item volume
  3635. Modify the volume expression.
  3636. The command accepts the same syntax of the corresponding option.
  3637. If the specified expression is not valid, it is kept at its current
  3638. value.
  3639. @item replaygain_noclip
  3640. Prevent clipping by limiting the gain applied.
  3641. Default value for @var{replaygain_noclip} is 1.
  3642. @end table
  3643. @subsection Examples
  3644. @itemize
  3645. @item
  3646. Halve the input audio volume:
  3647. @example
  3648. volume=volume=0.5
  3649. volume=volume=1/2
  3650. volume=volume=-6.0206dB
  3651. @end example
  3652. In all the above example the named key for @option{volume} can be
  3653. omitted, for example like in:
  3654. @example
  3655. volume=0.5
  3656. @end example
  3657. @item
  3658. Increase input audio power by 6 decibels using fixed-point precision:
  3659. @example
  3660. volume=volume=6dB:precision=fixed
  3661. @end example
  3662. @item
  3663. Fade volume after time 10 with an annihilation period of 5 seconds:
  3664. @example
  3665. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3666. @end example
  3667. @end itemize
  3668. @section volumedetect
  3669. Detect the volume of the input video.
  3670. The filter has no parameters. The input is not modified. Statistics about
  3671. the volume will be printed in the log when the input stream end is reached.
  3672. In particular it will show the mean volume (root mean square), maximum
  3673. volume (on a per-sample basis), and the beginning of a histogram of the
  3674. registered volume values (from the maximum value to a cumulated 1/1000 of
  3675. the samples).
  3676. All volumes are in decibels relative to the maximum PCM value.
  3677. @subsection Examples
  3678. Here is an excerpt of the output:
  3679. @example
  3680. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3681. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3682. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3683. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3684. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3685. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3686. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3687. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3688. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3689. @end example
  3690. It means that:
  3691. @itemize
  3692. @item
  3693. The mean square energy is approximately -27 dB, or 10^-2.7.
  3694. @item
  3695. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3696. @item
  3697. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3698. @end itemize
  3699. In other words, raising the volume by +4 dB does not cause any clipping,
  3700. raising it by +5 dB causes clipping for 6 samples, etc.
  3701. @c man end AUDIO FILTERS
  3702. @chapter Audio Sources
  3703. @c man begin AUDIO SOURCES
  3704. Below is a description of the currently available audio sources.
  3705. @section abuffer
  3706. Buffer audio frames, and make them available to the filter chain.
  3707. This source is mainly intended for a programmatic use, in particular
  3708. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3709. It accepts the following parameters:
  3710. @table @option
  3711. @item time_base
  3712. The timebase which will be used for timestamps of submitted frames. It must be
  3713. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3714. @item sample_rate
  3715. The sample rate of the incoming audio buffers.
  3716. @item sample_fmt
  3717. The sample format of the incoming audio buffers.
  3718. Either a sample format name or its corresponding integer representation from
  3719. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3720. @item channel_layout
  3721. The channel layout of the incoming audio buffers.
  3722. Either a channel layout name from channel_layout_map in
  3723. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3724. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3725. @item channels
  3726. The number of channels of the incoming audio buffers.
  3727. If both @var{channels} and @var{channel_layout} are specified, then they
  3728. must be consistent.
  3729. @end table
  3730. @subsection Examples
  3731. @example
  3732. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3733. @end example
  3734. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3735. Since the sample format with name "s16p" corresponds to the number
  3736. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3737. equivalent to:
  3738. @example
  3739. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3740. @end example
  3741. @section aevalsrc
  3742. Generate an audio signal specified by an expression.
  3743. This source accepts in input one or more expressions (one for each
  3744. channel), which are evaluated and used to generate a corresponding
  3745. audio signal.
  3746. This source accepts the following options:
  3747. @table @option
  3748. @item exprs
  3749. Set the '|'-separated expressions list for each separate channel. In case the
  3750. @option{channel_layout} option is not specified, the selected channel layout
  3751. depends on the number of provided expressions. Otherwise the last
  3752. specified expression is applied to the remaining output channels.
  3753. @item channel_layout, c
  3754. Set the channel layout. The number of channels in the specified layout
  3755. must be equal to the number of specified expressions.
  3756. @item duration, d
  3757. Set the minimum duration of the sourced audio. See
  3758. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3759. for the accepted syntax.
  3760. Note that the resulting duration may be greater than the specified
  3761. duration, as the generated audio is always cut at the end of a
  3762. complete frame.
  3763. If not specified, or the expressed duration is negative, the audio is
  3764. supposed to be generated forever.
  3765. @item nb_samples, n
  3766. Set the number of samples per channel per each output frame,
  3767. default to 1024.
  3768. @item sample_rate, s
  3769. Specify the sample rate, default to 44100.
  3770. @end table
  3771. Each expression in @var{exprs} can contain the following constants:
  3772. @table @option
  3773. @item n
  3774. number of the evaluated sample, starting from 0
  3775. @item t
  3776. time of the evaluated sample expressed in seconds, starting from 0
  3777. @item s
  3778. sample rate
  3779. @end table
  3780. @subsection Examples
  3781. @itemize
  3782. @item
  3783. Generate silence:
  3784. @example
  3785. aevalsrc=0
  3786. @end example
  3787. @item
  3788. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3789. 8000 Hz:
  3790. @example
  3791. aevalsrc="sin(440*2*PI*t):s=8000"
  3792. @end example
  3793. @item
  3794. Generate a two channels signal, specify the channel layout (Front
  3795. Center + Back Center) explicitly:
  3796. @example
  3797. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3798. @end example
  3799. @item
  3800. Generate white noise:
  3801. @example
  3802. aevalsrc="-2+random(0)"
  3803. @end example
  3804. @item
  3805. Generate an amplitude modulated signal:
  3806. @example
  3807. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3808. @end example
  3809. @item
  3810. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3811. @example
  3812. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3813. @end example
  3814. @end itemize
  3815. @section anullsrc
  3816. The null audio source, return unprocessed audio frames. It is mainly useful
  3817. as a template and to be employed in analysis / debugging tools, or as
  3818. the source for filters which ignore the input data (for example the sox
  3819. synth filter).
  3820. This source accepts the following options:
  3821. @table @option
  3822. @item channel_layout, cl
  3823. Specifies the channel layout, and can be either an integer or a string
  3824. representing a channel layout. The default value of @var{channel_layout}
  3825. is "stereo".
  3826. Check the channel_layout_map definition in
  3827. @file{libavutil/channel_layout.c} for the mapping between strings and
  3828. channel layout values.
  3829. @item sample_rate, r
  3830. Specifies the sample rate, and defaults to 44100.
  3831. @item nb_samples, n
  3832. Set the number of samples per requested frames.
  3833. @end table
  3834. @subsection Examples
  3835. @itemize
  3836. @item
  3837. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3838. @example
  3839. anullsrc=r=48000:cl=4
  3840. @end example
  3841. @item
  3842. Do the same operation with a more obvious syntax:
  3843. @example
  3844. anullsrc=r=48000:cl=mono
  3845. @end example
  3846. @end itemize
  3847. All the parameters need to be explicitly defined.
  3848. @section flite
  3849. Synthesize a voice utterance using the libflite library.
  3850. To enable compilation of this filter you need to configure FFmpeg with
  3851. @code{--enable-libflite}.
  3852. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3853. The filter accepts the following options:
  3854. @table @option
  3855. @item list_voices
  3856. If set to 1, list the names of the available voices and exit
  3857. immediately. Default value is 0.
  3858. @item nb_samples, n
  3859. Set the maximum number of samples per frame. Default value is 512.
  3860. @item textfile
  3861. Set the filename containing the text to speak.
  3862. @item text
  3863. Set the text to speak.
  3864. @item voice, v
  3865. Set the voice to use for the speech synthesis. Default value is
  3866. @code{kal}. See also the @var{list_voices} option.
  3867. @end table
  3868. @subsection Examples
  3869. @itemize
  3870. @item
  3871. Read from file @file{speech.txt}, and synthesize the text using the
  3872. standard flite voice:
  3873. @example
  3874. flite=textfile=speech.txt
  3875. @end example
  3876. @item
  3877. Read the specified text selecting the @code{slt} voice:
  3878. @example
  3879. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3880. @end example
  3881. @item
  3882. Input text to ffmpeg:
  3883. @example
  3884. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3885. @end example
  3886. @item
  3887. Make @file{ffplay} speak the specified text, using @code{flite} and
  3888. the @code{lavfi} device:
  3889. @example
  3890. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3891. @end example
  3892. @end itemize
  3893. For more information about libflite, check:
  3894. @url{http://www.festvox.org/flite/}
  3895. @section anoisesrc
  3896. Generate a noise audio signal.
  3897. The filter accepts the following options:
  3898. @table @option
  3899. @item sample_rate, r
  3900. Specify the sample rate. Default value is 48000 Hz.
  3901. @item amplitude, a
  3902. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3903. is 1.0.
  3904. @item duration, d
  3905. Specify the duration of the generated audio stream. Not specifying this option
  3906. results in noise with an infinite length.
  3907. @item color, colour, c
  3908. Specify the color of noise. Available noise colors are white, pink, brown,
  3909. blue and violet. Default color is white.
  3910. @item seed, s
  3911. Specify a value used to seed the PRNG.
  3912. @item nb_samples, n
  3913. Set the number of samples per each output frame, default is 1024.
  3914. @end table
  3915. @subsection Examples
  3916. @itemize
  3917. @item
  3918. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3919. @example
  3920. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3921. @end example
  3922. @end itemize
  3923. @section hilbert
  3924. Generate odd-tap Hilbert transform FIR coefficients.
  3925. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3926. the signal by 90 degrees.
  3927. This is used in many matrix coding schemes and for analytic signal generation.
  3928. The process is often written as a multiplication by i (or j), the imaginary unit.
  3929. The filter accepts the following options:
  3930. @table @option
  3931. @item sample_rate, s
  3932. Set sample rate, default is 44100.
  3933. @item taps, t
  3934. Set length of FIR filter, default is 22051.
  3935. @item nb_samples, n
  3936. Set number of samples per each frame.
  3937. @item win_func, w
  3938. Set window function to be used when generating FIR coefficients.
  3939. @end table
  3940. @section sine
  3941. Generate an audio signal made of a sine wave with amplitude 1/8.
  3942. The audio signal is bit-exact.
  3943. The filter accepts the following options:
  3944. @table @option
  3945. @item frequency, f
  3946. Set the carrier frequency. Default is 440 Hz.
  3947. @item beep_factor, b
  3948. Enable a periodic beep every second with frequency @var{beep_factor} times
  3949. the carrier frequency. Default is 0, meaning the beep is disabled.
  3950. @item sample_rate, r
  3951. Specify the sample rate, default is 44100.
  3952. @item duration, d
  3953. Specify the duration of the generated audio stream.
  3954. @item samples_per_frame
  3955. Set the number of samples per output frame.
  3956. The expression can contain the following constants:
  3957. @table @option
  3958. @item n
  3959. The (sequential) number of the output audio frame, starting from 0.
  3960. @item pts
  3961. The PTS (Presentation TimeStamp) of the output audio frame,
  3962. expressed in @var{TB} units.
  3963. @item t
  3964. The PTS of the output audio frame, expressed in seconds.
  3965. @item TB
  3966. The timebase of the output audio frames.
  3967. @end table
  3968. Default is @code{1024}.
  3969. @end table
  3970. @subsection Examples
  3971. @itemize
  3972. @item
  3973. Generate a simple 440 Hz sine wave:
  3974. @example
  3975. sine
  3976. @end example
  3977. @item
  3978. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3979. @example
  3980. sine=220:4:d=5
  3981. sine=f=220:b=4:d=5
  3982. sine=frequency=220:beep_factor=4:duration=5
  3983. @end example
  3984. @item
  3985. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3986. pattern:
  3987. @example
  3988. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3989. @end example
  3990. @end itemize
  3991. @c man end AUDIO SOURCES
  3992. @chapter Audio Sinks
  3993. @c man begin AUDIO SINKS
  3994. Below is a description of the currently available audio sinks.
  3995. @section abuffersink
  3996. Buffer audio frames, and make them available to the end of filter chain.
  3997. This sink is mainly intended for programmatic use, in particular
  3998. through the interface defined in @file{libavfilter/buffersink.h}
  3999. or the options system.
  4000. It accepts a pointer to an AVABufferSinkContext structure, which
  4001. defines the incoming buffers' formats, to be passed as the opaque
  4002. parameter to @code{avfilter_init_filter} for initialization.
  4003. @section anullsink
  4004. Null audio sink; do absolutely nothing with the input audio. It is
  4005. mainly useful as a template and for use in analysis / debugging
  4006. tools.
  4007. @c man end AUDIO SINKS
  4008. @chapter Video Filters
  4009. @c man begin VIDEO FILTERS
  4010. When you configure your FFmpeg build, you can disable any of the
  4011. existing filters using @code{--disable-filters}.
  4012. The configure output will show the video filters included in your
  4013. build.
  4014. Below is a description of the currently available video filters.
  4015. @section alphaextract
  4016. Extract the alpha component from the input as a grayscale video. This
  4017. is especially useful with the @var{alphamerge} filter.
  4018. @section alphamerge
  4019. Add or replace the alpha component of the primary input with the
  4020. grayscale value of a second input. This is intended for use with
  4021. @var{alphaextract} to allow the transmission or storage of frame
  4022. sequences that have alpha in a format that doesn't support an alpha
  4023. channel.
  4024. For example, to reconstruct full frames from a normal YUV-encoded video
  4025. and a separate video created with @var{alphaextract}, you might use:
  4026. @example
  4027. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4028. @end example
  4029. Since this filter is designed for reconstruction, it operates on frame
  4030. sequences without considering timestamps, and terminates when either
  4031. input reaches end of stream. This will cause problems if your encoding
  4032. pipeline drops frames. If you're trying to apply an image as an
  4033. overlay to a video stream, consider the @var{overlay} filter instead.
  4034. @section amplify
  4035. Amplify differences between current pixel and pixels of adjacent frames in
  4036. same pixel location.
  4037. This filter accepts the following options:
  4038. @table @option
  4039. @item radius
  4040. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4041. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4042. @item factor
  4043. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4044. @item threshold
  4045. Set threshold for difference amplification. Any differrence greater or equal to
  4046. this value will not alter source pixel. Default is 10.
  4047. Allowed range is from 0 to 65535.
  4048. @item low
  4049. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4050. This option controls maximum possible value that will decrease source pixel value.
  4051. @item high
  4052. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4053. This option controls maximum possible value that will increase source pixel value.
  4054. @item planes
  4055. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4056. @end table
  4057. @section ass
  4058. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4059. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4060. Substation Alpha) subtitles files.
  4061. This filter accepts the following option in addition to the common options from
  4062. the @ref{subtitles} filter:
  4063. @table @option
  4064. @item shaping
  4065. Set the shaping engine
  4066. Available values are:
  4067. @table @samp
  4068. @item auto
  4069. The default libass shaping engine, which is the best available.
  4070. @item simple
  4071. Fast, font-agnostic shaper that can do only substitutions
  4072. @item complex
  4073. Slower shaper using OpenType for substitutions and positioning
  4074. @end table
  4075. The default is @code{auto}.
  4076. @end table
  4077. @section atadenoise
  4078. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4079. The filter accepts the following options:
  4080. @table @option
  4081. @item 0a
  4082. Set threshold A for 1st plane. Default is 0.02.
  4083. Valid range is 0 to 0.3.
  4084. @item 0b
  4085. Set threshold B for 1st plane. Default is 0.04.
  4086. Valid range is 0 to 5.
  4087. @item 1a
  4088. Set threshold A for 2nd plane. Default is 0.02.
  4089. Valid range is 0 to 0.3.
  4090. @item 1b
  4091. Set threshold B for 2nd plane. Default is 0.04.
  4092. Valid range is 0 to 5.
  4093. @item 2a
  4094. Set threshold A for 3rd plane. Default is 0.02.
  4095. Valid range is 0 to 0.3.
  4096. @item 2b
  4097. Set threshold B for 3rd plane. Default is 0.04.
  4098. Valid range is 0 to 5.
  4099. Threshold A is designed to react on abrupt changes in the input signal and
  4100. threshold B is designed to react on continuous changes in the input signal.
  4101. @item s
  4102. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4103. number in range [5, 129].
  4104. @item p
  4105. Set what planes of frame filter will use for averaging. Default is all.
  4106. @end table
  4107. @section avgblur
  4108. Apply average blur filter.
  4109. The filter accepts the following options:
  4110. @table @option
  4111. @item sizeX
  4112. Set horizontal kernel size.
  4113. @item planes
  4114. Set which planes to filter. By default all planes are filtered.
  4115. @item sizeY
  4116. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4117. Default is @code{0}.
  4118. @end table
  4119. @section bbox
  4120. Compute the bounding box for the non-black pixels in the input frame
  4121. luminance plane.
  4122. This filter computes the bounding box containing all the pixels with a
  4123. luminance value greater than the minimum allowed value.
  4124. The parameters describing the bounding box are printed on the filter
  4125. log.
  4126. The filter accepts the following option:
  4127. @table @option
  4128. @item min_val
  4129. Set the minimal luminance value. Default is @code{16}.
  4130. @end table
  4131. @section bitplanenoise
  4132. Show and measure bit plane noise.
  4133. The filter accepts the following options:
  4134. @table @option
  4135. @item bitplane
  4136. Set which plane to analyze. Default is @code{1}.
  4137. @item filter
  4138. Filter out noisy pixels from @code{bitplane} set above.
  4139. Default is disabled.
  4140. @end table
  4141. @section blackdetect
  4142. Detect video intervals that are (almost) completely black. Can be
  4143. useful to detect chapter transitions, commercials, or invalid
  4144. recordings. Output lines contains the time for the start, end and
  4145. duration of the detected black interval expressed in seconds.
  4146. In order to display the output lines, you need to set the loglevel at
  4147. least to the AV_LOG_INFO value.
  4148. The filter accepts the following options:
  4149. @table @option
  4150. @item black_min_duration, d
  4151. Set the minimum detected black duration expressed in seconds. It must
  4152. be a non-negative floating point number.
  4153. Default value is 2.0.
  4154. @item picture_black_ratio_th, pic_th
  4155. Set the threshold for considering a picture "black".
  4156. Express the minimum value for the ratio:
  4157. @example
  4158. @var{nb_black_pixels} / @var{nb_pixels}
  4159. @end example
  4160. for which a picture is considered black.
  4161. Default value is 0.98.
  4162. @item pixel_black_th, pix_th
  4163. Set the threshold for considering a pixel "black".
  4164. The threshold expresses the maximum pixel luminance value for which a
  4165. pixel is considered "black". The provided value is scaled according to
  4166. the following equation:
  4167. @example
  4168. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4169. @end example
  4170. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4171. the input video format, the range is [0-255] for YUV full-range
  4172. formats and [16-235] for YUV non full-range formats.
  4173. Default value is 0.10.
  4174. @end table
  4175. The following example sets the maximum pixel threshold to the minimum
  4176. value, and detects only black intervals of 2 or more seconds:
  4177. @example
  4178. blackdetect=d=2:pix_th=0.00
  4179. @end example
  4180. @section blackframe
  4181. Detect frames that are (almost) completely black. Can be useful to
  4182. detect chapter transitions or commercials. Output lines consist of
  4183. the frame number of the detected frame, the percentage of blackness,
  4184. the position in the file if known or -1 and the timestamp in seconds.
  4185. In order to display the output lines, you need to set the loglevel at
  4186. least to the AV_LOG_INFO value.
  4187. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4188. The value represents the percentage of pixels in the picture that
  4189. are below the threshold value.
  4190. It accepts the following parameters:
  4191. @table @option
  4192. @item amount
  4193. The percentage of the pixels that have to be below the threshold; it defaults to
  4194. @code{98}.
  4195. @item threshold, thresh
  4196. The threshold below which a pixel value is considered black; it defaults to
  4197. @code{32}.
  4198. @end table
  4199. @section blend, tblend
  4200. Blend two video frames into each other.
  4201. The @code{blend} filter takes two input streams and outputs one
  4202. stream, the first input is the "top" layer and second input is
  4203. "bottom" layer. By default, the output terminates when the longest input terminates.
  4204. The @code{tblend} (time blend) filter takes two consecutive frames
  4205. from one single stream, and outputs the result obtained by blending
  4206. the new frame on top of the old frame.
  4207. A description of the accepted options follows.
  4208. @table @option
  4209. @item c0_mode
  4210. @item c1_mode
  4211. @item c2_mode
  4212. @item c3_mode
  4213. @item all_mode
  4214. Set blend mode for specific pixel component or all pixel components in case
  4215. of @var{all_mode}. Default value is @code{normal}.
  4216. Available values for component modes are:
  4217. @table @samp
  4218. @item addition
  4219. @item grainmerge
  4220. @item and
  4221. @item average
  4222. @item burn
  4223. @item darken
  4224. @item difference
  4225. @item grainextract
  4226. @item divide
  4227. @item dodge
  4228. @item freeze
  4229. @item exclusion
  4230. @item extremity
  4231. @item glow
  4232. @item hardlight
  4233. @item hardmix
  4234. @item heat
  4235. @item lighten
  4236. @item linearlight
  4237. @item multiply
  4238. @item multiply128
  4239. @item negation
  4240. @item normal
  4241. @item or
  4242. @item overlay
  4243. @item phoenix
  4244. @item pinlight
  4245. @item reflect
  4246. @item screen
  4247. @item softlight
  4248. @item subtract
  4249. @item vividlight
  4250. @item xor
  4251. @end table
  4252. @item c0_opacity
  4253. @item c1_opacity
  4254. @item c2_opacity
  4255. @item c3_opacity
  4256. @item all_opacity
  4257. Set blend opacity for specific pixel component or all pixel components in case
  4258. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4259. @item c0_expr
  4260. @item c1_expr
  4261. @item c2_expr
  4262. @item c3_expr
  4263. @item all_expr
  4264. Set blend expression for specific pixel component or all pixel components in case
  4265. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4266. The expressions can use the following variables:
  4267. @table @option
  4268. @item N
  4269. The sequential number of the filtered frame, starting from @code{0}.
  4270. @item X
  4271. @item Y
  4272. the coordinates of the current sample
  4273. @item W
  4274. @item H
  4275. the width and height of currently filtered plane
  4276. @item SW
  4277. @item SH
  4278. Width and height scale depending on the currently filtered plane. It is the
  4279. ratio between the corresponding luma plane number of pixels and the current
  4280. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4281. @code{0.5,0.5} for chroma planes.
  4282. @item T
  4283. Time of the current frame, expressed in seconds.
  4284. @item TOP, A
  4285. Value of pixel component at current location for first video frame (top layer).
  4286. @item BOTTOM, B
  4287. Value of pixel component at current location for second video frame (bottom layer).
  4288. @end table
  4289. @end table
  4290. The @code{blend} filter also supports the @ref{framesync} options.
  4291. @subsection Examples
  4292. @itemize
  4293. @item
  4294. Apply transition from bottom layer to top layer in first 10 seconds:
  4295. @example
  4296. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4297. @end example
  4298. @item
  4299. Apply linear horizontal transition from top layer to bottom layer:
  4300. @example
  4301. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4302. @end example
  4303. @item
  4304. Apply 1x1 checkerboard effect:
  4305. @example
  4306. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4307. @end example
  4308. @item
  4309. Apply uncover left effect:
  4310. @example
  4311. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4312. @end example
  4313. @item
  4314. Apply uncover down effect:
  4315. @example
  4316. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4317. @end example
  4318. @item
  4319. Apply uncover up-left effect:
  4320. @example
  4321. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4322. @end example
  4323. @item
  4324. Split diagonally video and shows top and bottom layer on each side:
  4325. @example
  4326. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4327. @end example
  4328. @item
  4329. Display differences between the current and the previous frame:
  4330. @example
  4331. tblend=all_mode=grainextract
  4332. @end example
  4333. @end itemize
  4334. @section boxblur
  4335. Apply a boxblur algorithm to the input video.
  4336. It accepts the following parameters:
  4337. @table @option
  4338. @item luma_radius, lr
  4339. @item luma_power, lp
  4340. @item chroma_radius, cr
  4341. @item chroma_power, cp
  4342. @item alpha_radius, ar
  4343. @item alpha_power, ap
  4344. @end table
  4345. A description of the accepted options follows.
  4346. @table @option
  4347. @item luma_radius, lr
  4348. @item chroma_radius, cr
  4349. @item alpha_radius, ar
  4350. Set an expression for the box radius in pixels used for blurring the
  4351. corresponding input plane.
  4352. The radius value must be a non-negative number, and must not be
  4353. greater than the value of the expression @code{min(w,h)/2} for the
  4354. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4355. planes.
  4356. Default value for @option{luma_radius} is "2". If not specified,
  4357. @option{chroma_radius} and @option{alpha_radius} default to the
  4358. corresponding value set for @option{luma_radius}.
  4359. The expressions can contain the following constants:
  4360. @table @option
  4361. @item w
  4362. @item h
  4363. The input width and height in pixels.
  4364. @item cw
  4365. @item ch
  4366. The input chroma image width and height in pixels.
  4367. @item hsub
  4368. @item vsub
  4369. The horizontal and vertical chroma subsample values. For example, for the
  4370. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4371. @end table
  4372. @item luma_power, lp
  4373. @item chroma_power, cp
  4374. @item alpha_power, ap
  4375. Specify how many times the boxblur filter is applied to the
  4376. corresponding plane.
  4377. Default value for @option{luma_power} is 2. If not specified,
  4378. @option{chroma_power} and @option{alpha_power} default to the
  4379. corresponding value set for @option{luma_power}.
  4380. A value of 0 will disable the effect.
  4381. @end table
  4382. @subsection Examples
  4383. @itemize
  4384. @item
  4385. Apply a boxblur filter with the luma, chroma, and alpha radii
  4386. set to 2:
  4387. @example
  4388. boxblur=luma_radius=2:luma_power=1
  4389. boxblur=2:1
  4390. @end example
  4391. @item
  4392. Set the luma radius to 2, and alpha and chroma radius to 0:
  4393. @example
  4394. boxblur=2:1:cr=0:ar=0
  4395. @end example
  4396. @item
  4397. Set the luma and chroma radii to a fraction of the video dimension:
  4398. @example
  4399. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4400. @end example
  4401. @end itemize
  4402. @section bwdif
  4403. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4404. Deinterlacing Filter").
  4405. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4406. interpolation algorithms.
  4407. It accepts the following parameters:
  4408. @table @option
  4409. @item mode
  4410. The interlacing mode to adopt. It accepts one of the following values:
  4411. @table @option
  4412. @item 0, send_frame
  4413. Output one frame for each frame.
  4414. @item 1, send_field
  4415. Output one frame for each field.
  4416. @end table
  4417. The default value is @code{send_field}.
  4418. @item parity
  4419. The picture field parity assumed for the input interlaced video. It accepts one
  4420. of the following values:
  4421. @table @option
  4422. @item 0, tff
  4423. Assume the top field is first.
  4424. @item 1, bff
  4425. Assume the bottom field is first.
  4426. @item -1, auto
  4427. Enable automatic detection of field parity.
  4428. @end table
  4429. The default value is @code{auto}.
  4430. If the interlacing is unknown or the decoder does not export this information,
  4431. top field first will be assumed.
  4432. @item deint
  4433. Specify which frames to deinterlace. Accept one of the following
  4434. values:
  4435. @table @option
  4436. @item 0, all
  4437. Deinterlace all frames.
  4438. @item 1, interlaced
  4439. Only deinterlace frames marked as interlaced.
  4440. @end table
  4441. The default value is @code{all}.
  4442. @end table
  4443. @section chromakey
  4444. YUV colorspace color/chroma keying.
  4445. The filter accepts the following options:
  4446. @table @option
  4447. @item color
  4448. The color which will be replaced with transparency.
  4449. @item similarity
  4450. Similarity percentage with the key color.
  4451. 0.01 matches only the exact key color, while 1.0 matches everything.
  4452. @item blend
  4453. Blend percentage.
  4454. 0.0 makes pixels either fully transparent, or not transparent at all.
  4455. Higher values result in semi-transparent pixels, with a higher transparency
  4456. the more similar the pixels color is to the key color.
  4457. @item yuv
  4458. Signals that the color passed is already in YUV instead of RGB.
  4459. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4460. This can be used to pass exact YUV values as hexadecimal numbers.
  4461. @end table
  4462. @subsection Examples
  4463. @itemize
  4464. @item
  4465. Make every green pixel in the input image transparent:
  4466. @example
  4467. ffmpeg -i input.png -vf chromakey=green out.png
  4468. @end example
  4469. @item
  4470. Overlay a greenscreen-video on top of a static black background.
  4471. @example
  4472. 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
  4473. @end example
  4474. @end itemize
  4475. @section ciescope
  4476. Display CIE color diagram with pixels overlaid onto it.
  4477. The filter accepts the following options:
  4478. @table @option
  4479. @item system
  4480. Set color system.
  4481. @table @samp
  4482. @item ntsc, 470m
  4483. @item ebu, 470bg
  4484. @item smpte
  4485. @item 240m
  4486. @item apple
  4487. @item widergb
  4488. @item cie1931
  4489. @item rec709, hdtv
  4490. @item uhdtv, rec2020
  4491. @end table
  4492. @item cie
  4493. Set CIE system.
  4494. @table @samp
  4495. @item xyy
  4496. @item ucs
  4497. @item luv
  4498. @end table
  4499. @item gamuts
  4500. Set what gamuts to draw.
  4501. See @code{system} option for available values.
  4502. @item size, s
  4503. Set ciescope size, by default set to 512.
  4504. @item intensity, i
  4505. Set intensity used to map input pixel values to CIE diagram.
  4506. @item contrast
  4507. Set contrast used to draw tongue colors that are out of active color system gamut.
  4508. @item corrgamma
  4509. Correct gamma displayed on scope, by default enabled.
  4510. @item showwhite
  4511. Show white point on CIE diagram, by default disabled.
  4512. @item gamma
  4513. Set input gamma. Used only with XYZ input color space.
  4514. @end table
  4515. @section codecview
  4516. Visualize information exported by some codecs.
  4517. Some codecs can export information through frames using side-data or other
  4518. means. For example, some MPEG based codecs export motion vectors through the
  4519. @var{export_mvs} flag in the codec @option{flags2} option.
  4520. The filter accepts the following option:
  4521. @table @option
  4522. @item mv
  4523. Set motion vectors to visualize.
  4524. Available flags for @var{mv} are:
  4525. @table @samp
  4526. @item pf
  4527. forward predicted MVs of P-frames
  4528. @item bf
  4529. forward predicted MVs of B-frames
  4530. @item bb
  4531. backward predicted MVs of B-frames
  4532. @end table
  4533. @item qp
  4534. Display quantization parameters using the chroma planes.
  4535. @item mv_type, mvt
  4536. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4537. Available flags for @var{mv_type} are:
  4538. @table @samp
  4539. @item fp
  4540. forward predicted MVs
  4541. @item bp
  4542. backward predicted MVs
  4543. @end table
  4544. @item frame_type, ft
  4545. Set frame type to visualize motion vectors of.
  4546. Available flags for @var{frame_type} are:
  4547. @table @samp
  4548. @item if
  4549. intra-coded frames (I-frames)
  4550. @item pf
  4551. predicted frames (P-frames)
  4552. @item bf
  4553. bi-directionally predicted frames (B-frames)
  4554. @end table
  4555. @end table
  4556. @subsection Examples
  4557. @itemize
  4558. @item
  4559. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4560. @example
  4561. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4562. @end example
  4563. @item
  4564. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4565. @example
  4566. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4567. @end example
  4568. @end itemize
  4569. @section colorbalance
  4570. Modify intensity of primary colors (red, green and blue) of input frames.
  4571. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4572. regions for the red-cyan, green-magenta or blue-yellow balance.
  4573. A positive adjustment value shifts the balance towards the primary color, a negative
  4574. value towards the complementary color.
  4575. The filter accepts the following options:
  4576. @table @option
  4577. @item rs
  4578. @item gs
  4579. @item bs
  4580. Adjust red, green and blue shadows (darkest pixels).
  4581. @item rm
  4582. @item gm
  4583. @item bm
  4584. Adjust red, green and blue midtones (medium pixels).
  4585. @item rh
  4586. @item gh
  4587. @item bh
  4588. Adjust red, green and blue highlights (brightest pixels).
  4589. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4590. @end table
  4591. @subsection Examples
  4592. @itemize
  4593. @item
  4594. Add red color cast to shadows:
  4595. @example
  4596. colorbalance=rs=.3
  4597. @end example
  4598. @end itemize
  4599. @section colorkey
  4600. RGB colorspace color keying.
  4601. The filter accepts the following options:
  4602. @table @option
  4603. @item color
  4604. The color which will be replaced with transparency.
  4605. @item similarity
  4606. Similarity percentage with the key color.
  4607. 0.01 matches only the exact key color, while 1.0 matches everything.
  4608. @item blend
  4609. Blend percentage.
  4610. 0.0 makes pixels either fully transparent, or not transparent at all.
  4611. Higher values result in semi-transparent pixels, with a higher transparency
  4612. the more similar the pixels color is to the key color.
  4613. @end table
  4614. @subsection Examples
  4615. @itemize
  4616. @item
  4617. Make every green pixel in the input image transparent:
  4618. @example
  4619. ffmpeg -i input.png -vf colorkey=green out.png
  4620. @end example
  4621. @item
  4622. Overlay a greenscreen-video on top of a static background image.
  4623. @example
  4624. 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
  4625. @end example
  4626. @end itemize
  4627. @section colorlevels
  4628. Adjust video input frames using levels.
  4629. The filter accepts the following options:
  4630. @table @option
  4631. @item rimin
  4632. @item gimin
  4633. @item bimin
  4634. @item aimin
  4635. Adjust red, green, blue and alpha input black point.
  4636. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4637. @item rimax
  4638. @item gimax
  4639. @item bimax
  4640. @item aimax
  4641. Adjust red, green, blue and alpha input white point.
  4642. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4643. Input levels are used to lighten highlights (bright tones), darken shadows
  4644. (dark tones), change the balance of bright and dark tones.
  4645. @item romin
  4646. @item gomin
  4647. @item bomin
  4648. @item aomin
  4649. Adjust red, green, blue and alpha output black point.
  4650. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4651. @item romax
  4652. @item gomax
  4653. @item bomax
  4654. @item aomax
  4655. Adjust red, green, blue and alpha output white point.
  4656. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4657. Output levels allows manual selection of a constrained output level range.
  4658. @end table
  4659. @subsection Examples
  4660. @itemize
  4661. @item
  4662. Make video output darker:
  4663. @example
  4664. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4665. @end example
  4666. @item
  4667. Increase contrast:
  4668. @example
  4669. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4670. @end example
  4671. @item
  4672. Make video output lighter:
  4673. @example
  4674. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4675. @end example
  4676. @item
  4677. Increase brightness:
  4678. @example
  4679. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4680. @end example
  4681. @end itemize
  4682. @section colorchannelmixer
  4683. Adjust video input frames by re-mixing color channels.
  4684. This filter modifies a color channel by adding the values associated to
  4685. the other channels of the same pixels. For example if the value to
  4686. modify is red, the output value will be:
  4687. @example
  4688. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4689. @end example
  4690. The filter accepts the following options:
  4691. @table @option
  4692. @item rr
  4693. @item rg
  4694. @item rb
  4695. @item ra
  4696. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4697. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4698. @item gr
  4699. @item gg
  4700. @item gb
  4701. @item ga
  4702. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4703. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4704. @item br
  4705. @item bg
  4706. @item bb
  4707. @item ba
  4708. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4709. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4710. @item ar
  4711. @item ag
  4712. @item ab
  4713. @item aa
  4714. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4715. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4716. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4717. @end table
  4718. @subsection Examples
  4719. @itemize
  4720. @item
  4721. Convert source to grayscale:
  4722. @example
  4723. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4724. @end example
  4725. @item
  4726. Simulate sepia tones:
  4727. @example
  4728. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4729. @end example
  4730. @end itemize
  4731. @section colormatrix
  4732. Convert color matrix.
  4733. The filter accepts the following options:
  4734. @table @option
  4735. @item src
  4736. @item dst
  4737. Specify the source and destination color matrix. Both values must be
  4738. specified.
  4739. The accepted values are:
  4740. @table @samp
  4741. @item bt709
  4742. BT.709
  4743. @item fcc
  4744. FCC
  4745. @item bt601
  4746. BT.601
  4747. @item bt470
  4748. BT.470
  4749. @item bt470bg
  4750. BT.470BG
  4751. @item smpte170m
  4752. SMPTE-170M
  4753. @item smpte240m
  4754. SMPTE-240M
  4755. @item bt2020
  4756. BT.2020
  4757. @end table
  4758. @end table
  4759. For example to convert from BT.601 to SMPTE-240M, use the command:
  4760. @example
  4761. colormatrix=bt601:smpte240m
  4762. @end example
  4763. @section colorspace
  4764. Convert colorspace, transfer characteristics or color primaries.
  4765. Input video needs to have an even size.
  4766. The filter accepts the following options:
  4767. @table @option
  4768. @anchor{all}
  4769. @item all
  4770. Specify all color properties at once.
  4771. The accepted values are:
  4772. @table @samp
  4773. @item bt470m
  4774. BT.470M
  4775. @item bt470bg
  4776. BT.470BG
  4777. @item bt601-6-525
  4778. BT.601-6 525
  4779. @item bt601-6-625
  4780. BT.601-6 625
  4781. @item bt709
  4782. BT.709
  4783. @item smpte170m
  4784. SMPTE-170M
  4785. @item smpte240m
  4786. SMPTE-240M
  4787. @item bt2020
  4788. BT.2020
  4789. @end table
  4790. @anchor{space}
  4791. @item space
  4792. Specify output colorspace.
  4793. The accepted values are:
  4794. @table @samp
  4795. @item bt709
  4796. BT.709
  4797. @item fcc
  4798. FCC
  4799. @item bt470bg
  4800. BT.470BG or BT.601-6 625
  4801. @item smpte170m
  4802. SMPTE-170M or BT.601-6 525
  4803. @item smpte240m
  4804. SMPTE-240M
  4805. @item ycgco
  4806. YCgCo
  4807. @item bt2020ncl
  4808. BT.2020 with non-constant luminance
  4809. @end table
  4810. @anchor{trc}
  4811. @item trc
  4812. Specify output transfer characteristics.
  4813. The accepted values are:
  4814. @table @samp
  4815. @item bt709
  4816. BT.709
  4817. @item bt470m
  4818. BT.470M
  4819. @item bt470bg
  4820. BT.470BG
  4821. @item gamma22
  4822. Constant gamma of 2.2
  4823. @item gamma28
  4824. Constant gamma of 2.8
  4825. @item smpte170m
  4826. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4827. @item smpte240m
  4828. SMPTE-240M
  4829. @item srgb
  4830. SRGB
  4831. @item iec61966-2-1
  4832. iec61966-2-1
  4833. @item iec61966-2-4
  4834. iec61966-2-4
  4835. @item xvycc
  4836. xvycc
  4837. @item bt2020-10
  4838. BT.2020 for 10-bits content
  4839. @item bt2020-12
  4840. BT.2020 for 12-bits content
  4841. @end table
  4842. @anchor{primaries}
  4843. @item primaries
  4844. Specify output color primaries.
  4845. The accepted values are:
  4846. @table @samp
  4847. @item bt709
  4848. BT.709
  4849. @item bt470m
  4850. BT.470M
  4851. @item bt470bg
  4852. BT.470BG or BT.601-6 625
  4853. @item smpte170m
  4854. SMPTE-170M or BT.601-6 525
  4855. @item smpte240m
  4856. SMPTE-240M
  4857. @item film
  4858. film
  4859. @item smpte431
  4860. SMPTE-431
  4861. @item smpte432
  4862. SMPTE-432
  4863. @item bt2020
  4864. BT.2020
  4865. @item jedec-p22
  4866. JEDEC P22 phosphors
  4867. @end table
  4868. @anchor{range}
  4869. @item range
  4870. Specify output color range.
  4871. The accepted values are:
  4872. @table @samp
  4873. @item tv
  4874. TV (restricted) range
  4875. @item mpeg
  4876. MPEG (restricted) range
  4877. @item pc
  4878. PC (full) range
  4879. @item jpeg
  4880. JPEG (full) range
  4881. @end table
  4882. @item format
  4883. Specify output color format.
  4884. The accepted values are:
  4885. @table @samp
  4886. @item yuv420p
  4887. YUV 4:2:0 planar 8-bits
  4888. @item yuv420p10
  4889. YUV 4:2:0 planar 10-bits
  4890. @item yuv420p12
  4891. YUV 4:2:0 planar 12-bits
  4892. @item yuv422p
  4893. YUV 4:2:2 planar 8-bits
  4894. @item yuv422p10
  4895. YUV 4:2:2 planar 10-bits
  4896. @item yuv422p12
  4897. YUV 4:2:2 planar 12-bits
  4898. @item yuv444p
  4899. YUV 4:4:4 planar 8-bits
  4900. @item yuv444p10
  4901. YUV 4:4:4 planar 10-bits
  4902. @item yuv444p12
  4903. YUV 4:4:4 planar 12-bits
  4904. @end table
  4905. @item fast
  4906. Do a fast conversion, which skips gamma/primary correction. This will take
  4907. significantly less CPU, but will be mathematically incorrect. To get output
  4908. compatible with that produced by the colormatrix filter, use fast=1.
  4909. @item dither
  4910. Specify dithering mode.
  4911. The accepted values are:
  4912. @table @samp
  4913. @item none
  4914. No dithering
  4915. @item fsb
  4916. Floyd-Steinberg dithering
  4917. @end table
  4918. @item wpadapt
  4919. Whitepoint adaptation mode.
  4920. The accepted values are:
  4921. @table @samp
  4922. @item bradford
  4923. Bradford whitepoint adaptation
  4924. @item vonkries
  4925. von Kries whitepoint adaptation
  4926. @item identity
  4927. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4928. @end table
  4929. @item iall
  4930. Override all input properties at once. Same accepted values as @ref{all}.
  4931. @item ispace
  4932. Override input colorspace. Same accepted values as @ref{space}.
  4933. @item iprimaries
  4934. Override input color primaries. Same accepted values as @ref{primaries}.
  4935. @item itrc
  4936. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4937. @item irange
  4938. Override input color range. Same accepted values as @ref{range}.
  4939. @end table
  4940. The filter converts the transfer characteristics, color space and color
  4941. primaries to the specified user values. The output value, if not specified,
  4942. is set to a default value based on the "all" property. If that property is
  4943. also not specified, the filter will log an error. The output color range and
  4944. format default to the same value as the input color range and format. The
  4945. input transfer characteristics, color space, color primaries and color range
  4946. should be set on the input data. If any of these are missing, the filter will
  4947. log an error and no conversion will take place.
  4948. For example to convert the input to SMPTE-240M, use the command:
  4949. @example
  4950. colorspace=smpte240m
  4951. @end example
  4952. @section convolution
  4953. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  4954. The filter accepts the following options:
  4955. @table @option
  4956. @item 0m
  4957. @item 1m
  4958. @item 2m
  4959. @item 3m
  4960. Set matrix for each plane.
  4961. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  4962. and from 1 to 49 odd number of signed integers in @var{row} mode.
  4963. @item 0rdiv
  4964. @item 1rdiv
  4965. @item 2rdiv
  4966. @item 3rdiv
  4967. Set multiplier for calculated value for each plane.
  4968. If unset or 0, it will be sum of all matrix elements.
  4969. @item 0bias
  4970. @item 1bias
  4971. @item 2bias
  4972. @item 3bias
  4973. Set bias for each plane. This value is added to the result of the multiplication.
  4974. Useful for making the overall image brighter or darker. Default is 0.0.
  4975. @item 0mode
  4976. @item 1mode
  4977. @item 2mode
  4978. @item 3mode
  4979. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  4980. Default is @var{square}.
  4981. @end table
  4982. @subsection Examples
  4983. @itemize
  4984. @item
  4985. Apply sharpen:
  4986. @example
  4987. 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"
  4988. @end example
  4989. @item
  4990. Apply blur:
  4991. @example
  4992. 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"
  4993. @end example
  4994. @item
  4995. Apply edge enhance:
  4996. @example
  4997. 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"
  4998. @end example
  4999. @item
  5000. Apply edge detect:
  5001. @example
  5002. 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"
  5003. @end example
  5004. @item
  5005. Apply laplacian edge detector which includes diagonals:
  5006. @example
  5007. 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"
  5008. @end example
  5009. @item
  5010. Apply emboss:
  5011. @example
  5012. 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"
  5013. @end example
  5014. @end itemize
  5015. @section convolve
  5016. Apply 2D convolution of video stream in frequency domain using second stream
  5017. as impulse.
  5018. The filter accepts the following options:
  5019. @table @option
  5020. @item planes
  5021. Set which planes to process.
  5022. @item impulse
  5023. Set which impulse video frames will be processed, can be @var{first}
  5024. or @var{all}. Default is @var{all}.
  5025. @end table
  5026. The @code{convolve} filter also supports the @ref{framesync} options.
  5027. @section copy
  5028. Copy the input video source unchanged to the output. This is mainly useful for
  5029. testing purposes.
  5030. @anchor{coreimage}
  5031. @section coreimage
  5032. Video filtering on GPU using Apple's CoreImage API on OSX.
  5033. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5034. processed by video hardware. However, software-based OpenGL implementations
  5035. exist which means there is no guarantee for hardware processing. It depends on
  5036. the respective OSX.
  5037. There are many filters and image generators provided by Apple that come with a
  5038. large variety of options. The filter has to be referenced by its name along
  5039. with its options.
  5040. The coreimage filter accepts the following options:
  5041. @table @option
  5042. @item list_filters
  5043. List all available filters and generators along with all their respective
  5044. options as well as possible minimum and maximum values along with the default
  5045. values.
  5046. @example
  5047. list_filters=true
  5048. @end example
  5049. @item filter
  5050. Specify all filters by their respective name and options.
  5051. Use @var{list_filters} to determine all valid filter names and options.
  5052. Numerical options are specified by a float value and are automatically clamped
  5053. to their respective value range. Vector and color options have to be specified
  5054. by a list of space separated float values. Character escaping has to be done.
  5055. A special option name @code{default} is available to use default options for a
  5056. filter.
  5057. It is required to specify either @code{default} or at least one of the filter options.
  5058. All omitted options are used with their default values.
  5059. The syntax of the filter string is as follows:
  5060. @example
  5061. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5062. @end example
  5063. @item output_rect
  5064. Specify a rectangle where the output of the filter chain is copied into the
  5065. input image. It is given by a list of space separated float values:
  5066. @example
  5067. output_rect=x\ y\ width\ height
  5068. @end example
  5069. If not given, the output rectangle equals the dimensions of the input image.
  5070. The output rectangle is automatically cropped at the borders of the input
  5071. image. Negative values are valid for each component.
  5072. @example
  5073. output_rect=25\ 25\ 100\ 100
  5074. @end example
  5075. @end table
  5076. Several filters can be chained for successive processing without GPU-HOST
  5077. transfers allowing for fast processing of complex filter chains.
  5078. Currently, only filters with zero (generators) or exactly one (filters) input
  5079. image and one output image are supported. Also, transition filters are not yet
  5080. usable as intended.
  5081. Some filters generate output images with additional padding depending on the
  5082. respective filter kernel. The padding is automatically removed to ensure the
  5083. filter output has the same size as the input image.
  5084. For image generators, the size of the output image is determined by the
  5085. previous output image of the filter chain or the input image of the whole
  5086. filterchain, respectively. The generators do not use the pixel information of
  5087. this image to generate their output. However, the generated output is
  5088. blended onto this image, resulting in partial or complete coverage of the
  5089. output image.
  5090. The @ref{coreimagesrc} video source can be used for generating input images
  5091. which are directly fed into the filter chain. By using it, providing input
  5092. images by another video source or an input video is not required.
  5093. @subsection Examples
  5094. @itemize
  5095. @item
  5096. List all filters available:
  5097. @example
  5098. coreimage=list_filters=true
  5099. @end example
  5100. @item
  5101. Use the CIBoxBlur filter with default options to blur an image:
  5102. @example
  5103. coreimage=filter=CIBoxBlur@@default
  5104. @end example
  5105. @item
  5106. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5107. its center at 100x100 and a radius of 50 pixels:
  5108. @example
  5109. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5110. @end example
  5111. @item
  5112. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5113. given as complete and escaped command-line for Apple's standard bash shell:
  5114. @example
  5115. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5116. @end example
  5117. @end itemize
  5118. @section crop
  5119. Crop the input video to given dimensions.
  5120. It accepts the following parameters:
  5121. @table @option
  5122. @item w, out_w
  5123. The width of the output video. It defaults to @code{iw}.
  5124. This expression is evaluated only once during the filter
  5125. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5126. @item h, out_h
  5127. The height of the output video. It defaults to @code{ih}.
  5128. This expression is evaluated only once during the filter
  5129. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5130. @item x
  5131. The horizontal position, in the input video, of the left edge of the output
  5132. video. It defaults to @code{(in_w-out_w)/2}.
  5133. This expression is evaluated per-frame.
  5134. @item y
  5135. The vertical position, in the input video, of the top edge of the output video.
  5136. It defaults to @code{(in_h-out_h)/2}.
  5137. This expression is evaluated per-frame.
  5138. @item keep_aspect
  5139. If set to 1 will force the output display aspect ratio
  5140. to be the same of the input, by changing the output sample aspect
  5141. ratio. It defaults to 0.
  5142. @item exact
  5143. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5144. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5145. It defaults to 0.
  5146. @end table
  5147. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5148. expressions containing the following constants:
  5149. @table @option
  5150. @item x
  5151. @item y
  5152. The computed values for @var{x} and @var{y}. They are evaluated for
  5153. each new frame.
  5154. @item in_w
  5155. @item in_h
  5156. The input width and height.
  5157. @item iw
  5158. @item ih
  5159. These are the same as @var{in_w} and @var{in_h}.
  5160. @item out_w
  5161. @item out_h
  5162. The output (cropped) width and height.
  5163. @item ow
  5164. @item oh
  5165. These are the same as @var{out_w} and @var{out_h}.
  5166. @item a
  5167. same as @var{iw} / @var{ih}
  5168. @item sar
  5169. input sample aspect ratio
  5170. @item dar
  5171. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5172. @item hsub
  5173. @item vsub
  5174. horizontal and vertical chroma subsample values. For example for the
  5175. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5176. @item n
  5177. The number of the input frame, starting from 0.
  5178. @item pos
  5179. the position in the file of the input frame, NAN if unknown
  5180. @item t
  5181. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5182. @end table
  5183. The expression for @var{out_w} may depend on the value of @var{out_h},
  5184. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5185. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5186. evaluated after @var{out_w} and @var{out_h}.
  5187. The @var{x} and @var{y} parameters specify the expressions for the
  5188. position of the top-left corner of the output (non-cropped) area. They
  5189. are evaluated for each frame. If the evaluated value is not valid, it
  5190. is approximated to the nearest valid value.
  5191. The expression for @var{x} may depend on @var{y}, and the expression
  5192. for @var{y} may depend on @var{x}.
  5193. @subsection Examples
  5194. @itemize
  5195. @item
  5196. Crop area with size 100x100 at position (12,34).
  5197. @example
  5198. crop=100:100:12:34
  5199. @end example
  5200. Using named options, the example above becomes:
  5201. @example
  5202. crop=w=100:h=100:x=12:y=34
  5203. @end example
  5204. @item
  5205. Crop the central input area with size 100x100:
  5206. @example
  5207. crop=100:100
  5208. @end example
  5209. @item
  5210. Crop the central input area with size 2/3 of the input video:
  5211. @example
  5212. crop=2/3*in_w:2/3*in_h
  5213. @end example
  5214. @item
  5215. Crop the input video central square:
  5216. @example
  5217. crop=out_w=in_h
  5218. crop=in_h
  5219. @end example
  5220. @item
  5221. Delimit the rectangle with the top-left corner placed at position
  5222. 100:100 and the right-bottom corner corresponding to the right-bottom
  5223. corner of the input image.
  5224. @example
  5225. crop=in_w-100:in_h-100:100:100
  5226. @end example
  5227. @item
  5228. Crop 10 pixels from the left and right borders, and 20 pixels from
  5229. the top and bottom borders
  5230. @example
  5231. crop=in_w-2*10:in_h-2*20
  5232. @end example
  5233. @item
  5234. Keep only the bottom right quarter of the input image:
  5235. @example
  5236. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5237. @end example
  5238. @item
  5239. Crop height for getting Greek harmony:
  5240. @example
  5241. crop=in_w:1/PHI*in_w
  5242. @end example
  5243. @item
  5244. Apply trembling effect:
  5245. @example
  5246. 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)
  5247. @end example
  5248. @item
  5249. Apply erratic camera effect depending on timestamp:
  5250. @example
  5251. 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)"
  5252. @end example
  5253. @item
  5254. Set x depending on the value of y:
  5255. @example
  5256. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5257. @end example
  5258. @end itemize
  5259. @subsection Commands
  5260. This filter supports the following commands:
  5261. @table @option
  5262. @item w, out_w
  5263. @item h, out_h
  5264. @item x
  5265. @item y
  5266. Set width/height of the output video and the horizontal/vertical position
  5267. in the input video.
  5268. The command accepts the same syntax of the corresponding option.
  5269. If the specified expression is not valid, it is kept at its current
  5270. value.
  5271. @end table
  5272. @section cropdetect
  5273. Auto-detect the crop size.
  5274. It calculates the necessary cropping parameters and prints the
  5275. recommended parameters via the logging system. The detected dimensions
  5276. correspond to the non-black area of the input video.
  5277. It accepts the following parameters:
  5278. @table @option
  5279. @item limit
  5280. Set higher black value threshold, which can be optionally specified
  5281. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5282. value greater to the set value is considered non-black. It defaults to 24.
  5283. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5284. on the bitdepth of the pixel format.
  5285. @item round
  5286. The value which the width/height should be divisible by. It defaults to
  5287. 16. The offset is automatically adjusted to center the video. Use 2 to
  5288. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5289. encoding to most video codecs.
  5290. @item reset_count, reset
  5291. Set the counter that determines after how many frames cropdetect will
  5292. reset the previously detected largest video area and start over to
  5293. detect the current optimal crop area. Default value is 0.
  5294. This can be useful when channel logos distort the video area. 0
  5295. indicates 'never reset', and returns the largest area encountered during
  5296. playback.
  5297. @end table
  5298. @anchor{curves}
  5299. @section curves
  5300. Apply color adjustments using curves.
  5301. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5302. component (red, green and blue) has its values defined by @var{N} key points
  5303. tied from each other using a smooth curve. The x-axis represents the pixel
  5304. values from the input frame, and the y-axis the new pixel values to be set for
  5305. the output frame.
  5306. By default, a component curve is defined by the two points @var{(0;0)} and
  5307. @var{(1;1)}. This creates a straight line where each original pixel value is
  5308. "adjusted" to its own value, which means no change to the image.
  5309. The filter allows you to redefine these two points and add some more. A new
  5310. curve (using a natural cubic spline interpolation) will be define to pass
  5311. smoothly through all these new coordinates. The new defined points needs to be
  5312. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5313. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5314. the vector spaces, the values will be clipped accordingly.
  5315. The filter accepts the following options:
  5316. @table @option
  5317. @item preset
  5318. Select one of the available color presets. This option can be used in addition
  5319. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5320. options takes priority on the preset values.
  5321. Available presets are:
  5322. @table @samp
  5323. @item none
  5324. @item color_negative
  5325. @item cross_process
  5326. @item darker
  5327. @item increase_contrast
  5328. @item lighter
  5329. @item linear_contrast
  5330. @item medium_contrast
  5331. @item negative
  5332. @item strong_contrast
  5333. @item vintage
  5334. @end table
  5335. Default is @code{none}.
  5336. @item master, m
  5337. Set the master key points. These points will define a second pass mapping. It
  5338. is sometimes called a "luminance" or "value" mapping. It can be used with
  5339. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5340. post-processing LUT.
  5341. @item red, r
  5342. Set the key points for the red component.
  5343. @item green, g
  5344. Set the key points for the green component.
  5345. @item blue, b
  5346. Set the key points for the blue component.
  5347. @item all
  5348. Set the key points for all components (not including master).
  5349. Can be used in addition to the other key points component
  5350. options. In this case, the unset component(s) will fallback on this
  5351. @option{all} setting.
  5352. @item psfile
  5353. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5354. @item plot
  5355. Save Gnuplot script of the curves in specified file.
  5356. @end table
  5357. To avoid some filtergraph syntax conflicts, each key points list need to be
  5358. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5359. @subsection Examples
  5360. @itemize
  5361. @item
  5362. Increase slightly the middle level of blue:
  5363. @example
  5364. curves=blue='0/0 0.5/0.58 1/1'
  5365. @end example
  5366. @item
  5367. Vintage effect:
  5368. @example
  5369. 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'
  5370. @end example
  5371. Here we obtain the following coordinates for each components:
  5372. @table @var
  5373. @item red
  5374. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5375. @item green
  5376. @code{(0;0) (0.50;0.48) (1;1)}
  5377. @item blue
  5378. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5379. @end table
  5380. @item
  5381. The previous example can also be achieved with the associated built-in preset:
  5382. @example
  5383. curves=preset=vintage
  5384. @end example
  5385. @item
  5386. Or simply:
  5387. @example
  5388. curves=vintage
  5389. @end example
  5390. @item
  5391. Use a Photoshop preset and redefine the points of the green component:
  5392. @example
  5393. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5394. @end example
  5395. @item
  5396. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5397. and @command{gnuplot}:
  5398. @example
  5399. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5400. gnuplot -p /tmp/curves.plt
  5401. @end example
  5402. @end itemize
  5403. @section datascope
  5404. Video data analysis filter.
  5405. This filter shows hexadecimal pixel values of part of video.
  5406. The filter accepts the following options:
  5407. @table @option
  5408. @item size, s
  5409. Set output video size.
  5410. @item x
  5411. Set x offset from where to pick pixels.
  5412. @item y
  5413. Set y offset from where to pick pixels.
  5414. @item mode
  5415. Set scope mode, can be one of the following:
  5416. @table @samp
  5417. @item mono
  5418. Draw hexadecimal pixel values with white color on black background.
  5419. @item color
  5420. Draw hexadecimal pixel values with input video pixel color on black
  5421. background.
  5422. @item color2
  5423. Draw hexadecimal pixel values on color background picked from input video,
  5424. the text color is picked in such way so its always visible.
  5425. @end table
  5426. @item axis
  5427. Draw rows and columns numbers on left and top of video.
  5428. @item opacity
  5429. Set background opacity.
  5430. @end table
  5431. @section dctdnoiz
  5432. Denoise frames using 2D DCT (frequency domain filtering).
  5433. This filter is not designed for real time.
  5434. The filter accepts the following options:
  5435. @table @option
  5436. @item sigma, s
  5437. Set the noise sigma constant.
  5438. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5439. coefficient (absolute value) below this threshold with be dropped.
  5440. If you need a more advanced filtering, see @option{expr}.
  5441. Default is @code{0}.
  5442. @item overlap
  5443. Set number overlapping pixels for each block. Since the filter can be slow, you
  5444. may want to reduce this value, at the cost of a less effective filter and the
  5445. risk of various artefacts.
  5446. If the overlapping value doesn't permit processing the whole input width or
  5447. height, a warning will be displayed and according borders won't be denoised.
  5448. Default value is @var{blocksize}-1, which is the best possible setting.
  5449. @item expr, e
  5450. Set the coefficient factor expression.
  5451. For each coefficient of a DCT block, this expression will be evaluated as a
  5452. multiplier value for the coefficient.
  5453. If this is option is set, the @option{sigma} option will be ignored.
  5454. The absolute value of the coefficient can be accessed through the @var{c}
  5455. variable.
  5456. @item n
  5457. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5458. @var{blocksize}, which is the width and height of the processed blocks.
  5459. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5460. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5461. on the speed processing. Also, a larger block size does not necessarily means a
  5462. better de-noising.
  5463. @end table
  5464. @subsection Examples
  5465. Apply a denoise with a @option{sigma} of @code{4.5}:
  5466. @example
  5467. dctdnoiz=4.5
  5468. @end example
  5469. The same operation can be achieved using the expression system:
  5470. @example
  5471. dctdnoiz=e='gte(c, 4.5*3)'
  5472. @end example
  5473. Violent denoise using a block size of @code{16x16}:
  5474. @example
  5475. dctdnoiz=15:n=4
  5476. @end example
  5477. @section deband
  5478. Remove banding artifacts from input video.
  5479. It works by replacing banded pixels with average value of referenced pixels.
  5480. The filter accepts the following options:
  5481. @table @option
  5482. @item 1thr
  5483. @item 2thr
  5484. @item 3thr
  5485. @item 4thr
  5486. Set banding detection threshold for each plane. Default is 0.02.
  5487. Valid range is 0.00003 to 0.5.
  5488. If difference between current pixel and reference pixel is less than threshold,
  5489. it will be considered as banded.
  5490. @item range, r
  5491. Banding detection range in pixels. Default is 16. If positive, random number
  5492. in range 0 to set value will be used. If negative, exact absolute value
  5493. will be used.
  5494. The range defines square of four pixels around current pixel.
  5495. @item direction, d
  5496. Set direction in radians from which four pixel will be compared. If positive,
  5497. random direction from 0 to set direction will be picked. If negative, exact of
  5498. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5499. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5500. column.
  5501. @item blur, b
  5502. If enabled, current pixel is compared with average value of all four
  5503. surrounding pixels. The default is enabled. If disabled current pixel is
  5504. compared with all four surrounding pixels. The pixel is considered banded
  5505. if only all four differences with surrounding pixels are less than threshold.
  5506. @item coupling, c
  5507. If enabled, current pixel is changed if and only if all pixel components are banded,
  5508. e.g. banding detection threshold is triggered for all color components.
  5509. The default is disabled.
  5510. @end table
  5511. @section deblock
  5512. Remove blocking artifacts from input video.
  5513. The filter accepts the following options:
  5514. @table @option
  5515. @item filter
  5516. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5517. This controls what kind of deblocking is applied.
  5518. @item block
  5519. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5520. @item alpha
  5521. @item beta
  5522. @item gamma
  5523. @item delta
  5524. Set blocking detection thresholds. Allowed range is 0 to 1.
  5525. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5526. Using higher threshold gives more deblocking strength.
  5527. Setting @var{alpha} controls threshold detection at exact edge of block.
  5528. Remaining options controls threshold detection near the edge. Each one for
  5529. below/above or left/right. Setting any of those to @var{0} disables
  5530. deblocking.
  5531. @item planes
  5532. Set planes to filter. Default is to filter all available planes.
  5533. @end table
  5534. @subsection Examples
  5535. @itemize
  5536. @item
  5537. Deblock using weak filter and block size of 4 pixels.
  5538. @example
  5539. deblock=filter=weak:block=4
  5540. @end example
  5541. @item
  5542. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5543. deblocking more edges.
  5544. @example
  5545. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5546. @end example
  5547. @item
  5548. Similar as above, but filter only first plane.
  5549. @example
  5550. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5551. @end example
  5552. @item
  5553. Similar as above, but filter only second and third plane.
  5554. @example
  5555. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5556. @end example
  5557. @end itemize
  5558. @anchor{decimate}
  5559. @section decimate
  5560. Drop duplicated frames at regular intervals.
  5561. The filter accepts the following options:
  5562. @table @option
  5563. @item cycle
  5564. Set the number of frames from which one will be dropped. Setting this to
  5565. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5566. Default is @code{5}.
  5567. @item dupthresh
  5568. Set the threshold for duplicate detection. If the difference metric for a frame
  5569. is less than or equal to this value, then it is declared as duplicate. Default
  5570. is @code{1.1}
  5571. @item scthresh
  5572. Set scene change threshold. Default is @code{15}.
  5573. @item blockx
  5574. @item blocky
  5575. Set the size of the x and y-axis blocks used during metric calculations.
  5576. Larger blocks give better noise suppression, but also give worse detection of
  5577. small movements. Must be a power of two. Default is @code{32}.
  5578. @item ppsrc
  5579. Mark main input as a pre-processed input and activate clean source input
  5580. stream. This allows the input to be pre-processed with various filters to help
  5581. the metrics calculation while keeping the frame selection lossless. When set to
  5582. @code{1}, the first stream is for the pre-processed input, and the second
  5583. stream is the clean source from where the kept frames are chosen. Default is
  5584. @code{0}.
  5585. @item chroma
  5586. Set whether or not chroma is considered in the metric calculations. Default is
  5587. @code{1}.
  5588. @end table
  5589. @section deconvolve
  5590. Apply 2D deconvolution of video stream in frequency domain using second stream
  5591. as impulse.
  5592. The filter accepts the following options:
  5593. @table @option
  5594. @item planes
  5595. Set which planes to process.
  5596. @item impulse
  5597. Set which impulse video frames will be processed, can be @var{first}
  5598. or @var{all}. Default is @var{all}.
  5599. @item noise
  5600. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5601. and height are not same and not power of 2 or if stream prior to convolving
  5602. had noise.
  5603. @end table
  5604. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5605. @section deflate
  5606. Apply deflate effect to the video.
  5607. This filter replaces the pixel by the local(3x3) average by taking into account
  5608. only values lower than the pixel.
  5609. It accepts the following options:
  5610. @table @option
  5611. @item threshold0
  5612. @item threshold1
  5613. @item threshold2
  5614. @item threshold3
  5615. Limit the maximum change for each plane, default is 65535.
  5616. If 0, plane will remain unchanged.
  5617. @end table
  5618. @section deflicker
  5619. Remove temporal frame luminance variations.
  5620. It accepts the following options:
  5621. @table @option
  5622. @item size, s
  5623. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5624. @item mode, m
  5625. Set averaging mode to smooth temporal luminance variations.
  5626. Available values are:
  5627. @table @samp
  5628. @item am
  5629. Arithmetic mean
  5630. @item gm
  5631. Geometric mean
  5632. @item hm
  5633. Harmonic mean
  5634. @item qm
  5635. Quadratic mean
  5636. @item cm
  5637. Cubic mean
  5638. @item pm
  5639. Power mean
  5640. @item median
  5641. Median
  5642. @end table
  5643. @item bypass
  5644. Do not actually modify frame. Useful when one only wants metadata.
  5645. @end table
  5646. @section dejudder
  5647. Remove judder produced by partially interlaced telecined content.
  5648. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5649. source was partially telecined content then the output of @code{pullup,dejudder}
  5650. will have a variable frame rate. May change the recorded frame rate of the
  5651. container. Aside from that change, this filter will not affect constant frame
  5652. rate video.
  5653. The option available in this filter is:
  5654. @table @option
  5655. @item cycle
  5656. Specify the length of the window over which the judder repeats.
  5657. Accepts any integer greater than 1. Useful values are:
  5658. @table @samp
  5659. @item 4
  5660. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5661. @item 5
  5662. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5663. @item 20
  5664. If a mixture of the two.
  5665. @end table
  5666. The default is @samp{4}.
  5667. @end table
  5668. @section delogo
  5669. Suppress a TV station logo by a simple interpolation of the surrounding
  5670. pixels. Just set a rectangle covering the logo and watch it disappear
  5671. (and sometimes something even uglier appear - your mileage may vary).
  5672. It accepts the following parameters:
  5673. @table @option
  5674. @item x
  5675. @item y
  5676. Specify the top left corner coordinates of the logo. They must be
  5677. specified.
  5678. @item w
  5679. @item h
  5680. Specify the width and height of the logo to clear. They must be
  5681. specified.
  5682. @item band, t
  5683. Specify the thickness of the fuzzy edge of the rectangle (added to
  5684. @var{w} and @var{h}). The default value is 1. This option is
  5685. deprecated, setting higher values should no longer be necessary and
  5686. is not recommended.
  5687. @item show
  5688. When set to 1, a green rectangle is drawn on the screen to simplify
  5689. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5690. The default value is 0.
  5691. The rectangle is drawn on the outermost pixels which will be (partly)
  5692. replaced with interpolated values. The values of the next pixels
  5693. immediately outside this rectangle in each direction will be used to
  5694. compute the interpolated pixel values inside the rectangle.
  5695. @end table
  5696. @subsection Examples
  5697. @itemize
  5698. @item
  5699. Set a rectangle covering the area with top left corner coordinates 0,0
  5700. and size 100x77, and a band of size 10:
  5701. @example
  5702. delogo=x=0:y=0:w=100:h=77:band=10
  5703. @end example
  5704. @end itemize
  5705. @section deshake
  5706. Attempt to fix small changes in horizontal and/or vertical shift. This
  5707. filter helps remove camera shake from hand-holding a camera, bumping a
  5708. tripod, moving on a vehicle, etc.
  5709. The filter accepts the following options:
  5710. @table @option
  5711. @item x
  5712. @item y
  5713. @item w
  5714. @item h
  5715. Specify a rectangular area where to limit the search for motion
  5716. vectors.
  5717. If desired the search for motion vectors can be limited to a
  5718. rectangular area of the frame defined by its top left corner, width
  5719. and height. These parameters have the same meaning as the drawbox
  5720. filter which can be used to visualise the position of the bounding
  5721. box.
  5722. This is useful when simultaneous movement of subjects within the frame
  5723. might be confused for camera motion by the motion vector search.
  5724. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5725. then the full frame is used. This allows later options to be set
  5726. without specifying the bounding box for the motion vector search.
  5727. Default - search the whole frame.
  5728. @item rx
  5729. @item ry
  5730. Specify the maximum extent of movement in x and y directions in the
  5731. range 0-64 pixels. Default 16.
  5732. @item edge
  5733. Specify how to generate pixels to fill blanks at the edge of the
  5734. frame. Available values are:
  5735. @table @samp
  5736. @item blank, 0
  5737. Fill zeroes at blank locations
  5738. @item original, 1
  5739. Original image at blank locations
  5740. @item clamp, 2
  5741. Extruded edge value at blank locations
  5742. @item mirror, 3
  5743. Mirrored edge at blank locations
  5744. @end table
  5745. Default value is @samp{mirror}.
  5746. @item blocksize
  5747. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5748. default 8.
  5749. @item contrast
  5750. Specify the contrast threshold for blocks. Only blocks with more than
  5751. the specified contrast (difference between darkest and lightest
  5752. pixels) will be considered. Range 1-255, default 125.
  5753. @item search
  5754. Specify the search strategy. Available values are:
  5755. @table @samp
  5756. @item exhaustive, 0
  5757. Set exhaustive search
  5758. @item less, 1
  5759. Set less exhaustive search.
  5760. @end table
  5761. Default value is @samp{exhaustive}.
  5762. @item filename
  5763. If set then a detailed log of the motion search is written to the
  5764. specified file.
  5765. @end table
  5766. @section despill
  5767. Remove unwanted contamination of foreground colors, caused by reflected color of
  5768. greenscreen or bluescreen.
  5769. This filter accepts the following options:
  5770. @table @option
  5771. @item type
  5772. Set what type of despill to use.
  5773. @item mix
  5774. Set how spillmap will be generated.
  5775. @item expand
  5776. Set how much to get rid of still remaining spill.
  5777. @item red
  5778. Controls amount of red in spill area.
  5779. @item green
  5780. Controls amount of green in spill area.
  5781. Should be -1 for greenscreen.
  5782. @item blue
  5783. Controls amount of blue in spill area.
  5784. Should be -1 for bluescreen.
  5785. @item brightness
  5786. Controls brightness of spill area, preserving colors.
  5787. @item alpha
  5788. Modify alpha from generated spillmap.
  5789. @end table
  5790. @section detelecine
  5791. Apply an exact inverse of the telecine operation. It requires a predefined
  5792. pattern specified using the pattern option which must be the same as that passed
  5793. to the telecine filter.
  5794. This filter accepts the following options:
  5795. @table @option
  5796. @item first_field
  5797. @table @samp
  5798. @item top, t
  5799. top field first
  5800. @item bottom, b
  5801. bottom field first
  5802. The default value is @code{top}.
  5803. @end table
  5804. @item pattern
  5805. A string of numbers representing the pulldown pattern you wish to apply.
  5806. The default value is @code{23}.
  5807. @item start_frame
  5808. A number representing position of the first frame with respect to the telecine
  5809. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5810. @end table
  5811. @section dilation
  5812. Apply dilation effect to the video.
  5813. This filter replaces the pixel by the local(3x3) maximum.
  5814. It accepts the following options:
  5815. @table @option
  5816. @item threshold0
  5817. @item threshold1
  5818. @item threshold2
  5819. @item threshold3
  5820. Limit the maximum change for each plane, default is 65535.
  5821. If 0, plane will remain unchanged.
  5822. @item coordinates
  5823. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5824. pixels are used.
  5825. Flags to local 3x3 coordinates maps like this:
  5826. 1 2 3
  5827. 4 5
  5828. 6 7 8
  5829. @end table
  5830. @section displace
  5831. Displace pixels as indicated by second and third input stream.
  5832. It takes three input streams and outputs one stream, the first input is the
  5833. source, and second and third input are displacement maps.
  5834. The second input specifies how much to displace pixels along the
  5835. x-axis, while the third input specifies how much to displace pixels
  5836. along the y-axis.
  5837. If one of displacement map streams terminates, last frame from that
  5838. displacement map will be used.
  5839. Note that once generated, displacements maps can be reused over and over again.
  5840. A description of the accepted options follows.
  5841. @table @option
  5842. @item edge
  5843. Set displace behavior for pixels that are out of range.
  5844. Available values are:
  5845. @table @samp
  5846. @item blank
  5847. Missing pixels are replaced by black pixels.
  5848. @item smear
  5849. Adjacent pixels will spread out to replace missing pixels.
  5850. @item wrap
  5851. Out of range pixels are wrapped so they point to pixels of other side.
  5852. @item mirror
  5853. Out of range pixels will be replaced with mirrored pixels.
  5854. @end table
  5855. Default is @samp{smear}.
  5856. @end table
  5857. @subsection Examples
  5858. @itemize
  5859. @item
  5860. Add ripple effect to rgb input of video size hd720:
  5861. @example
  5862. 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
  5863. @end example
  5864. @item
  5865. Add wave effect to rgb input of video size hd720:
  5866. @example
  5867. 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
  5868. @end example
  5869. @end itemize
  5870. @section drawbox
  5871. Draw a colored box on the input image.
  5872. It accepts the following parameters:
  5873. @table @option
  5874. @item x
  5875. @item y
  5876. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5877. @item width, w
  5878. @item height, h
  5879. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5880. the input width and height. It defaults to 0.
  5881. @item color, c
  5882. Specify the color of the box to write. For the general syntax of this option,
  5883. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5884. value @code{invert} is used, the box edge color is the same as the
  5885. video with inverted luma.
  5886. @item thickness, t
  5887. The expression which sets the thickness of the box edge.
  5888. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5889. See below for the list of accepted constants.
  5890. @item replace
  5891. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5892. will overwrite the video's color and alpha pixels.
  5893. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5894. @end table
  5895. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5896. following constants:
  5897. @table @option
  5898. @item dar
  5899. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5900. @item hsub
  5901. @item vsub
  5902. horizontal and vertical chroma subsample values. For example for the
  5903. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5904. @item in_h, ih
  5905. @item in_w, iw
  5906. The input width and height.
  5907. @item sar
  5908. The input sample aspect ratio.
  5909. @item x
  5910. @item y
  5911. The x and y offset coordinates where the box is drawn.
  5912. @item w
  5913. @item h
  5914. The width and height of the drawn box.
  5915. @item t
  5916. The thickness of the drawn box.
  5917. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5918. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5919. @end table
  5920. @subsection Examples
  5921. @itemize
  5922. @item
  5923. Draw a black box around the edge of the input image:
  5924. @example
  5925. drawbox
  5926. @end example
  5927. @item
  5928. Draw a box with color red and an opacity of 50%:
  5929. @example
  5930. drawbox=10:20:200:60:red@@0.5
  5931. @end example
  5932. The previous example can be specified as:
  5933. @example
  5934. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5935. @end example
  5936. @item
  5937. Fill the box with pink color:
  5938. @example
  5939. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5940. @end example
  5941. @item
  5942. Draw a 2-pixel red 2.40:1 mask:
  5943. @example
  5944. 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
  5945. @end example
  5946. @end itemize
  5947. @section drawgrid
  5948. Draw a grid on the input image.
  5949. It accepts the following parameters:
  5950. @table @option
  5951. @item x
  5952. @item y
  5953. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5954. @item width, w
  5955. @item height, h
  5956. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5957. input width and height, respectively, minus @code{thickness}, so image gets
  5958. framed. Default to 0.
  5959. @item color, c
  5960. Specify the color of the grid. For the general syntax of this option,
  5961. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5962. value @code{invert} is used, the grid color is the same as the
  5963. video with inverted luma.
  5964. @item thickness, t
  5965. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5966. See below for the list of accepted constants.
  5967. @item replace
  5968. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5969. will overwrite the video's color and alpha pixels.
  5970. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5971. @end table
  5972. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5973. following constants:
  5974. @table @option
  5975. @item dar
  5976. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5977. @item hsub
  5978. @item vsub
  5979. horizontal and vertical chroma subsample values. For example for the
  5980. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5981. @item in_h, ih
  5982. @item in_w, iw
  5983. The input grid cell width and height.
  5984. @item sar
  5985. The input sample aspect ratio.
  5986. @item x
  5987. @item y
  5988. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5989. @item w
  5990. @item h
  5991. The width and height of the drawn cell.
  5992. @item t
  5993. The thickness of the drawn cell.
  5994. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5995. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5996. @end table
  5997. @subsection Examples
  5998. @itemize
  5999. @item
  6000. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6001. @example
  6002. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6003. @end example
  6004. @item
  6005. Draw a white 3x3 grid with an opacity of 50%:
  6006. @example
  6007. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6008. @end example
  6009. @end itemize
  6010. @anchor{drawtext}
  6011. @section drawtext
  6012. Draw a text string or text from a specified file on top of a video, using the
  6013. libfreetype library.
  6014. To enable compilation of this filter, you need to configure FFmpeg with
  6015. @code{--enable-libfreetype}.
  6016. To enable default font fallback and the @var{font} option you need to
  6017. configure FFmpeg with @code{--enable-libfontconfig}.
  6018. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6019. @code{--enable-libfribidi}.
  6020. @subsection Syntax
  6021. It accepts the following parameters:
  6022. @table @option
  6023. @item box
  6024. Used to draw a box around text using the background color.
  6025. The value must be either 1 (enable) or 0 (disable).
  6026. The default value of @var{box} is 0.
  6027. @item boxborderw
  6028. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6029. The default value of @var{boxborderw} is 0.
  6030. @item boxcolor
  6031. The color to be used for drawing box around text. For the syntax of this
  6032. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6033. The default value of @var{boxcolor} is "white".
  6034. @item line_spacing
  6035. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6036. The default value of @var{line_spacing} is 0.
  6037. @item borderw
  6038. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6039. The default value of @var{borderw} is 0.
  6040. @item bordercolor
  6041. Set the color to be used for drawing border around text. For the syntax of this
  6042. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6043. The default value of @var{bordercolor} is "black".
  6044. @item expansion
  6045. Select how the @var{text} is expanded. Can be either @code{none},
  6046. @code{strftime} (deprecated) or
  6047. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6048. below for details.
  6049. @item basetime
  6050. Set a start time for the count. Value is in microseconds. Only applied
  6051. in the deprecated strftime expansion mode. To emulate in normal expansion
  6052. mode use the @code{pts} function, supplying the start time (in seconds)
  6053. as the second argument.
  6054. @item fix_bounds
  6055. If true, check and fix text coords to avoid clipping.
  6056. @item fontcolor
  6057. The color to be used for drawing fonts. For the syntax of this option, check
  6058. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6059. The default value of @var{fontcolor} is "black".
  6060. @item fontcolor_expr
  6061. String which is expanded the same way as @var{text} to obtain dynamic
  6062. @var{fontcolor} value. By default this option has empty value and is not
  6063. processed. When this option is set, it overrides @var{fontcolor} option.
  6064. @item font
  6065. The font family to be used for drawing text. By default Sans.
  6066. @item fontfile
  6067. The font file to be used for drawing text. The path must be included.
  6068. This parameter is mandatory if the fontconfig support is disabled.
  6069. @item alpha
  6070. Draw the text applying alpha blending. The value can
  6071. be a number between 0.0 and 1.0.
  6072. The expression accepts the same variables @var{x, y} as well.
  6073. The default value is 1.
  6074. Please see @var{fontcolor_expr}.
  6075. @item fontsize
  6076. The font size to be used for drawing text.
  6077. The default value of @var{fontsize} is 16.
  6078. @item text_shaping
  6079. If set to 1, attempt to shape the text (for example, reverse the order of
  6080. right-to-left text and join Arabic characters) before drawing it.
  6081. Otherwise, just draw the text exactly as given.
  6082. By default 1 (if supported).
  6083. @item ft_load_flags
  6084. The flags to be used for loading the fonts.
  6085. The flags map the corresponding flags supported by libfreetype, and are
  6086. a combination of the following values:
  6087. @table @var
  6088. @item default
  6089. @item no_scale
  6090. @item no_hinting
  6091. @item render
  6092. @item no_bitmap
  6093. @item vertical_layout
  6094. @item force_autohint
  6095. @item crop_bitmap
  6096. @item pedantic
  6097. @item ignore_global_advance_width
  6098. @item no_recurse
  6099. @item ignore_transform
  6100. @item monochrome
  6101. @item linear_design
  6102. @item no_autohint
  6103. @end table
  6104. Default value is "default".
  6105. For more information consult the documentation for the FT_LOAD_*
  6106. libfreetype flags.
  6107. @item shadowcolor
  6108. The color to be used for drawing a shadow behind the drawn text. For the
  6109. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6110. ffmpeg-utils manual,ffmpeg-utils}.
  6111. The default value of @var{shadowcolor} is "black".
  6112. @item shadowx
  6113. @item shadowy
  6114. The x and y offsets for the text shadow position with respect to the
  6115. position of the text. They can be either positive or negative
  6116. values. The default value for both is "0".
  6117. @item start_number
  6118. The starting frame number for the n/frame_num variable. The default value
  6119. is "0".
  6120. @item tabsize
  6121. The size in number of spaces to use for rendering the tab.
  6122. Default value is 4.
  6123. @item timecode
  6124. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6125. format. It can be used with or without text parameter. @var{timecode_rate}
  6126. option must be specified.
  6127. @item timecode_rate, rate, r
  6128. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6129. integer. Minimum value is "1".
  6130. Drop-frame timecode is supported for frame rates 30 & 60.
  6131. @item tc24hmax
  6132. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6133. Default is 0 (disabled).
  6134. @item text
  6135. The text string to be drawn. The text must be a sequence of UTF-8
  6136. encoded characters.
  6137. This parameter is mandatory if no file is specified with the parameter
  6138. @var{textfile}.
  6139. @item textfile
  6140. A text file containing text to be drawn. The text must be a sequence
  6141. of UTF-8 encoded characters.
  6142. This parameter is mandatory if no text string is specified with the
  6143. parameter @var{text}.
  6144. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6145. @item reload
  6146. If set to 1, the @var{textfile} will be reloaded before each frame.
  6147. Be sure to update it atomically, or it may be read partially, or even fail.
  6148. @item x
  6149. @item y
  6150. The expressions which specify the offsets where text will be drawn
  6151. within the video frame. They are relative to the top/left border of the
  6152. output image.
  6153. The default value of @var{x} and @var{y} is "0".
  6154. See below for the list of accepted constants and functions.
  6155. @end table
  6156. The parameters for @var{x} and @var{y} are expressions containing the
  6157. following constants and functions:
  6158. @table @option
  6159. @item dar
  6160. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6161. @item hsub
  6162. @item vsub
  6163. horizontal and vertical chroma subsample values. For example for the
  6164. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6165. @item line_h, lh
  6166. the height of each text line
  6167. @item main_h, h, H
  6168. the input height
  6169. @item main_w, w, W
  6170. the input width
  6171. @item max_glyph_a, ascent
  6172. the maximum distance from the baseline to the highest/upper grid
  6173. coordinate used to place a glyph outline point, for all the rendered
  6174. glyphs.
  6175. It is a positive value, due to the grid's orientation with the Y axis
  6176. upwards.
  6177. @item max_glyph_d, descent
  6178. the maximum distance from the baseline to the lowest grid coordinate
  6179. used to place a glyph outline point, for all the rendered glyphs.
  6180. This is a negative value, due to the grid's orientation, with the Y axis
  6181. upwards.
  6182. @item max_glyph_h
  6183. maximum glyph height, that is the maximum height for all the glyphs
  6184. contained in the rendered text, it is equivalent to @var{ascent} -
  6185. @var{descent}.
  6186. @item max_glyph_w
  6187. maximum glyph width, that is the maximum width for all the glyphs
  6188. contained in the rendered text
  6189. @item n
  6190. the number of input frame, starting from 0
  6191. @item rand(min, max)
  6192. return a random number included between @var{min} and @var{max}
  6193. @item sar
  6194. The input sample aspect ratio.
  6195. @item t
  6196. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6197. @item text_h, th
  6198. the height of the rendered text
  6199. @item text_w, tw
  6200. the width of the rendered text
  6201. @item x
  6202. @item y
  6203. the x and y offset coordinates where the text is drawn.
  6204. These parameters allow the @var{x} and @var{y} expressions to refer
  6205. each other, so you can for example specify @code{y=x/dar}.
  6206. @end table
  6207. @anchor{drawtext_expansion}
  6208. @subsection Text expansion
  6209. If @option{expansion} is set to @code{strftime},
  6210. the filter recognizes strftime() sequences in the provided text and
  6211. expands them accordingly. Check the documentation of strftime(). This
  6212. feature is deprecated.
  6213. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6214. If @option{expansion} is set to @code{normal} (which is the default),
  6215. the following expansion mechanism is used.
  6216. The backslash character @samp{\}, followed by any character, always expands to
  6217. the second character.
  6218. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6219. braces is a function name, possibly followed by arguments separated by ':'.
  6220. If the arguments contain special characters or delimiters (':' or '@}'),
  6221. they should be escaped.
  6222. Note that they probably must also be escaped as the value for the
  6223. @option{text} option in the filter argument string and as the filter
  6224. argument in the filtergraph description, and possibly also for the shell,
  6225. that makes up to four levels of escaping; using a text file avoids these
  6226. problems.
  6227. The following functions are available:
  6228. @table @command
  6229. @item expr, e
  6230. The expression evaluation result.
  6231. It must take one argument specifying the expression to be evaluated,
  6232. which accepts the same constants and functions as the @var{x} and
  6233. @var{y} values. Note that not all constants should be used, for
  6234. example the text size is not known when evaluating the expression, so
  6235. the constants @var{text_w} and @var{text_h} will have an undefined
  6236. value.
  6237. @item expr_int_format, eif
  6238. Evaluate the expression's value and output as formatted integer.
  6239. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6240. The second argument specifies the output format. Allowed values are @samp{x},
  6241. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6242. @code{printf} function.
  6243. The third parameter is optional and sets the number of positions taken by the output.
  6244. It can be used to add padding with zeros from the left.
  6245. @item gmtime
  6246. The time at which the filter is running, expressed in UTC.
  6247. It can accept an argument: a strftime() format string.
  6248. @item localtime
  6249. The time at which the filter is running, expressed in the local time zone.
  6250. It can accept an argument: a strftime() format string.
  6251. @item metadata
  6252. Frame metadata. Takes one or two arguments.
  6253. The first argument is mandatory and specifies the metadata key.
  6254. The second argument is optional and specifies a default value, used when the
  6255. metadata key is not found or empty.
  6256. @item n, frame_num
  6257. The frame number, starting from 0.
  6258. @item pict_type
  6259. A 1 character description of the current picture type.
  6260. @item pts
  6261. The timestamp of the current frame.
  6262. It can take up to three arguments.
  6263. The first argument is the format of the timestamp; it defaults to @code{flt}
  6264. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6265. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6266. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6267. @code{localtime} stands for the timestamp of the frame formatted as
  6268. local time zone time.
  6269. The second argument is an offset added to the timestamp.
  6270. If the format is set to @code{localtime} or @code{gmtime},
  6271. a third argument may be supplied: a strftime() format string.
  6272. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6273. @end table
  6274. @subsection Examples
  6275. @itemize
  6276. @item
  6277. Draw "Test Text" with font FreeSerif, using the default values for the
  6278. optional parameters.
  6279. @example
  6280. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6281. @end example
  6282. @item
  6283. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6284. and y=50 (counting from the top-left corner of the screen), text is
  6285. yellow with a red box around it. Both the text and the box have an
  6286. opacity of 20%.
  6287. @example
  6288. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6289. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6290. @end example
  6291. Note that the double quotes are not necessary if spaces are not used
  6292. within the parameter list.
  6293. @item
  6294. Show the text at the center of the video frame:
  6295. @example
  6296. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6297. @end example
  6298. @item
  6299. Show the text at a random position, switching to a new position every 30 seconds:
  6300. @example
  6301. 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)"
  6302. @end example
  6303. @item
  6304. Show a text line sliding from right to left in the last row of the video
  6305. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6306. with no newlines.
  6307. @example
  6308. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6309. @end example
  6310. @item
  6311. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6312. @example
  6313. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6314. @end example
  6315. @item
  6316. Draw a single green letter "g", at the center of the input video.
  6317. The glyph baseline is placed at half screen height.
  6318. @example
  6319. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6320. @end example
  6321. @item
  6322. Show text for 1 second every 3 seconds:
  6323. @example
  6324. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6325. @end example
  6326. @item
  6327. Use fontconfig to set the font. Note that the colons need to be escaped.
  6328. @example
  6329. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6330. @end example
  6331. @item
  6332. Print the date of a real-time encoding (see strftime(3)):
  6333. @example
  6334. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6335. @end example
  6336. @item
  6337. Show text fading in and out (appearing/disappearing):
  6338. @example
  6339. #!/bin/sh
  6340. DS=1.0 # display start
  6341. DE=10.0 # display end
  6342. FID=1.5 # fade in duration
  6343. FOD=5 # fade out duration
  6344. 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 @}"
  6345. @end example
  6346. @item
  6347. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6348. and the @option{fontsize} value are included in the @option{y} offset.
  6349. @example
  6350. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6351. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6352. @end example
  6353. @end itemize
  6354. For more information about libfreetype, check:
  6355. @url{http://www.freetype.org/}.
  6356. For more information about fontconfig, check:
  6357. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6358. For more information about libfribidi, check:
  6359. @url{http://fribidi.org/}.
  6360. @section edgedetect
  6361. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6362. The filter accepts the following options:
  6363. @table @option
  6364. @item low
  6365. @item high
  6366. Set low and high threshold values used by the Canny thresholding
  6367. algorithm.
  6368. The high threshold selects the "strong" edge pixels, which are then
  6369. connected through 8-connectivity with the "weak" edge pixels selected
  6370. by the low threshold.
  6371. @var{low} and @var{high} threshold values must be chosen in the range
  6372. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6373. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6374. is @code{50/255}.
  6375. @item mode
  6376. Define the drawing mode.
  6377. @table @samp
  6378. @item wires
  6379. Draw white/gray wires on black background.
  6380. @item colormix
  6381. Mix the colors to create a paint/cartoon effect.
  6382. @item canny
  6383. Apply Canny edge detector on all selected planes.
  6384. @end table
  6385. Default value is @var{wires}.
  6386. @item planes
  6387. Select planes for filtering. By default all available planes are filtered.
  6388. @end table
  6389. @subsection Examples
  6390. @itemize
  6391. @item
  6392. Standard edge detection with custom values for the hysteresis thresholding:
  6393. @example
  6394. edgedetect=low=0.1:high=0.4
  6395. @end example
  6396. @item
  6397. Painting effect without thresholding:
  6398. @example
  6399. edgedetect=mode=colormix:high=0
  6400. @end example
  6401. @end itemize
  6402. @section eq
  6403. Set brightness, contrast, saturation and approximate gamma adjustment.
  6404. The filter accepts the following options:
  6405. @table @option
  6406. @item contrast
  6407. Set the contrast expression. The value must be a float value in range
  6408. @code{-2.0} to @code{2.0}. The default value is "1".
  6409. @item brightness
  6410. Set the brightness expression. The value must be a float value in
  6411. range @code{-1.0} to @code{1.0}. The default value is "0".
  6412. @item saturation
  6413. Set the saturation expression. The value must be a float in
  6414. range @code{0.0} to @code{3.0}. The default value is "1".
  6415. @item gamma
  6416. Set the gamma expression. The value must be a float in range
  6417. @code{0.1} to @code{10.0}. The default value is "1".
  6418. @item gamma_r
  6419. Set the gamma expression for red. The value must be a float in
  6420. range @code{0.1} to @code{10.0}. The default value is "1".
  6421. @item gamma_g
  6422. Set the gamma expression for green. The value must be a float in range
  6423. @code{0.1} to @code{10.0}. The default value is "1".
  6424. @item gamma_b
  6425. Set the gamma expression for blue. The value must be a float in range
  6426. @code{0.1} to @code{10.0}. The default value is "1".
  6427. @item gamma_weight
  6428. Set the gamma weight expression. It can be used to reduce the effect
  6429. of a high gamma value on bright image areas, e.g. keep them from
  6430. getting overamplified and just plain white. The value must be a float
  6431. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6432. gamma correction all the way down while @code{1.0} leaves it at its
  6433. full strength. Default is "1".
  6434. @item eval
  6435. Set when the expressions for brightness, contrast, saturation and
  6436. gamma expressions are evaluated.
  6437. It accepts the following values:
  6438. @table @samp
  6439. @item init
  6440. only evaluate expressions once during the filter initialization or
  6441. when a command is processed
  6442. @item frame
  6443. evaluate expressions for each incoming frame
  6444. @end table
  6445. Default value is @samp{init}.
  6446. @end table
  6447. The expressions accept the following parameters:
  6448. @table @option
  6449. @item n
  6450. frame count of the input frame starting from 0
  6451. @item pos
  6452. byte position of the corresponding packet in the input file, NAN if
  6453. unspecified
  6454. @item r
  6455. frame rate of the input video, NAN if the input frame rate is unknown
  6456. @item t
  6457. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6458. @end table
  6459. @subsection Commands
  6460. The filter supports the following commands:
  6461. @table @option
  6462. @item contrast
  6463. Set the contrast expression.
  6464. @item brightness
  6465. Set the brightness expression.
  6466. @item saturation
  6467. Set the saturation expression.
  6468. @item gamma
  6469. Set the gamma expression.
  6470. @item gamma_r
  6471. Set the gamma_r expression.
  6472. @item gamma_g
  6473. Set gamma_g expression.
  6474. @item gamma_b
  6475. Set gamma_b expression.
  6476. @item gamma_weight
  6477. Set gamma_weight expression.
  6478. The command accepts the same syntax of the corresponding option.
  6479. If the specified expression is not valid, it is kept at its current
  6480. value.
  6481. @end table
  6482. @section erosion
  6483. Apply erosion effect to the video.
  6484. This filter replaces the pixel by the local(3x3) minimum.
  6485. It accepts the following options:
  6486. @table @option
  6487. @item threshold0
  6488. @item threshold1
  6489. @item threshold2
  6490. @item threshold3
  6491. Limit the maximum change for each plane, default is 65535.
  6492. If 0, plane will remain unchanged.
  6493. @item coordinates
  6494. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6495. pixels are used.
  6496. Flags to local 3x3 coordinates maps like this:
  6497. 1 2 3
  6498. 4 5
  6499. 6 7 8
  6500. @end table
  6501. @section extractplanes
  6502. Extract color channel components from input video stream into
  6503. separate grayscale video streams.
  6504. The filter accepts the following option:
  6505. @table @option
  6506. @item planes
  6507. Set plane(s) to extract.
  6508. Available values for planes are:
  6509. @table @samp
  6510. @item y
  6511. @item u
  6512. @item v
  6513. @item a
  6514. @item r
  6515. @item g
  6516. @item b
  6517. @end table
  6518. Choosing planes not available in the input will result in an error.
  6519. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6520. with @code{y}, @code{u}, @code{v} planes at same time.
  6521. @end table
  6522. @subsection Examples
  6523. @itemize
  6524. @item
  6525. Extract luma, u and v color channel component from input video frame
  6526. into 3 grayscale outputs:
  6527. @example
  6528. 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
  6529. @end example
  6530. @end itemize
  6531. @section elbg
  6532. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6533. For each input image, the filter will compute the optimal mapping from
  6534. the input to the output given the codebook length, that is the number
  6535. of distinct output colors.
  6536. This filter accepts the following options.
  6537. @table @option
  6538. @item codebook_length, l
  6539. Set codebook length. The value must be a positive integer, and
  6540. represents the number of distinct output colors. Default value is 256.
  6541. @item nb_steps, n
  6542. Set the maximum number of iterations to apply for computing the optimal
  6543. mapping. The higher the value the better the result and the higher the
  6544. computation time. Default value is 1.
  6545. @item seed, s
  6546. Set a random seed, must be an integer included between 0 and
  6547. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6548. will try to use a good random seed on a best effort basis.
  6549. @item pal8
  6550. Set pal8 output pixel format. This option does not work with codebook
  6551. length greater than 256.
  6552. @end table
  6553. @section entropy
  6554. Measure graylevel entropy in histogram of color channels of video frames.
  6555. It accepts the following parameters:
  6556. @table @option
  6557. @item mode
  6558. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6559. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6560. between neighbour histogram values.
  6561. @end table
  6562. @section fade
  6563. Apply a fade-in/out effect to the input video.
  6564. It accepts the following parameters:
  6565. @table @option
  6566. @item type, t
  6567. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6568. effect.
  6569. Default is @code{in}.
  6570. @item start_frame, s
  6571. Specify the number of the frame to start applying the fade
  6572. effect at. Default is 0.
  6573. @item nb_frames, n
  6574. The number of frames that the fade effect lasts. At the end of the
  6575. fade-in effect, the output video will have the same intensity as the input video.
  6576. At the end of the fade-out transition, the output video will be filled with the
  6577. selected @option{color}.
  6578. Default is 25.
  6579. @item alpha
  6580. If set to 1, fade only alpha channel, if one exists on the input.
  6581. Default value is 0.
  6582. @item start_time, st
  6583. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6584. effect. If both start_frame and start_time are specified, the fade will start at
  6585. whichever comes last. Default is 0.
  6586. @item duration, d
  6587. The number of seconds for which the fade effect has to last. At the end of the
  6588. fade-in effect the output video will have the same intensity as the input video,
  6589. at the end of the fade-out transition the output video will be filled with the
  6590. selected @option{color}.
  6591. If both duration and nb_frames are specified, duration is used. Default is 0
  6592. (nb_frames is used by default).
  6593. @item color, c
  6594. Specify the color of the fade. Default is "black".
  6595. @end table
  6596. @subsection Examples
  6597. @itemize
  6598. @item
  6599. Fade in the first 30 frames of video:
  6600. @example
  6601. fade=in:0:30
  6602. @end example
  6603. The command above is equivalent to:
  6604. @example
  6605. fade=t=in:s=0:n=30
  6606. @end example
  6607. @item
  6608. Fade out the last 45 frames of a 200-frame video:
  6609. @example
  6610. fade=out:155:45
  6611. fade=type=out:start_frame=155:nb_frames=45
  6612. @end example
  6613. @item
  6614. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6615. @example
  6616. fade=in:0:25, fade=out:975:25
  6617. @end example
  6618. @item
  6619. Make the first 5 frames yellow, then fade in from frame 5-24:
  6620. @example
  6621. fade=in:5:20:color=yellow
  6622. @end example
  6623. @item
  6624. Fade in alpha over first 25 frames of video:
  6625. @example
  6626. fade=in:0:25:alpha=1
  6627. @end example
  6628. @item
  6629. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6630. @example
  6631. fade=t=in:st=5.5:d=0.5
  6632. @end example
  6633. @end itemize
  6634. @section fftfilt
  6635. Apply arbitrary expressions to samples in frequency domain
  6636. @table @option
  6637. @item dc_Y
  6638. Adjust the dc value (gain) of the luma plane of the image. The filter
  6639. accepts an integer value in range @code{0} to @code{1000}. The default
  6640. value is set to @code{0}.
  6641. @item dc_U
  6642. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6643. filter accepts an integer value in range @code{0} to @code{1000}. The
  6644. default value is set to @code{0}.
  6645. @item dc_V
  6646. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6647. filter accepts an integer value in range @code{0} to @code{1000}. The
  6648. default value is set to @code{0}.
  6649. @item weight_Y
  6650. Set the frequency domain weight expression for the luma plane.
  6651. @item weight_U
  6652. Set the frequency domain weight expression for the 1st chroma plane.
  6653. @item weight_V
  6654. Set the frequency domain weight expression for the 2nd chroma plane.
  6655. @item eval
  6656. Set when the expressions are evaluated.
  6657. It accepts the following values:
  6658. @table @samp
  6659. @item init
  6660. Only evaluate expressions once during the filter initialization.
  6661. @item frame
  6662. Evaluate expressions for each incoming frame.
  6663. @end table
  6664. Default value is @samp{init}.
  6665. The filter accepts the following variables:
  6666. @item X
  6667. @item Y
  6668. The coordinates of the current sample.
  6669. @item W
  6670. @item H
  6671. The width and height of the image.
  6672. @item N
  6673. The number of input frame, starting from 0.
  6674. @end table
  6675. @subsection Examples
  6676. @itemize
  6677. @item
  6678. High-pass:
  6679. @example
  6680. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6681. @end example
  6682. @item
  6683. Low-pass:
  6684. @example
  6685. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6686. @end example
  6687. @item
  6688. Sharpen:
  6689. @example
  6690. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6691. @end example
  6692. @item
  6693. Blur:
  6694. @example
  6695. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6696. @end example
  6697. @end itemize
  6698. @section fftdnoiz
  6699. Denoise frames using 3D FFT (frequency domain filtering).
  6700. The filter accepts the following options:
  6701. @table @option
  6702. @item sigma
  6703. Set the noise sigma constant. This sets denoising strength.
  6704. Default value is 1. Allowed range is from 0 to 30.
  6705. Using very high sigma with low overlap may give blocking artifacts.
  6706. @item amount
  6707. Set amount of denoising. By default all detected noise is reduced.
  6708. Default value is 1. Allowed range is from 0 to 1.
  6709. @item block
  6710. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  6711. Actual size of block in pixels is 2 to power of @var{block}, so by default
  6712. block size in pixels is 2^4 which is 16.
  6713. @item overlap
  6714. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  6715. @item prev
  6716. Set number of previous frames to use for denoising. By default is set to 0.
  6717. @item next
  6718. Set number of next frames to to use for denoising. By default is set to 0.
  6719. @item planes
  6720. Set planes which will be filtered, by default are all available filtered
  6721. except alpha.
  6722. @end table
  6723. @section field
  6724. Extract a single field from an interlaced image using stride
  6725. arithmetic to avoid wasting CPU time. The output frames are marked as
  6726. non-interlaced.
  6727. The filter accepts the following options:
  6728. @table @option
  6729. @item type
  6730. Specify whether to extract the top (if the value is @code{0} or
  6731. @code{top}) or the bottom field (if the value is @code{1} or
  6732. @code{bottom}).
  6733. @end table
  6734. @section fieldhint
  6735. Create new frames by copying the top and bottom fields from surrounding frames
  6736. supplied as numbers by the hint file.
  6737. @table @option
  6738. @item hint
  6739. Set file containing hints: absolute/relative frame numbers.
  6740. There must be one line for each frame in a clip. Each line must contain two
  6741. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6742. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6743. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6744. for @code{relative} mode. First number tells from which frame to pick up top
  6745. field and second number tells from which frame to pick up bottom field.
  6746. If optionally followed by @code{+} output frame will be marked as interlaced,
  6747. else if followed by @code{-} output frame will be marked as progressive, else
  6748. it will be marked same as input frame.
  6749. If line starts with @code{#} or @code{;} that line is skipped.
  6750. @item mode
  6751. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6752. @end table
  6753. Example of first several lines of @code{hint} file for @code{relative} mode:
  6754. @example
  6755. 0,0 - # first frame
  6756. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6757. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6758. 1,0 -
  6759. 0,0 -
  6760. 0,0 -
  6761. 1,0 -
  6762. 1,0 -
  6763. 1,0 -
  6764. 0,0 -
  6765. 0,0 -
  6766. 1,0 -
  6767. 1,0 -
  6768. 1,0 -
  6769. 0,0 -
  6770. @end example
  6771. @section fieldmatch
  6772. Field matching filter for inverse telecine. It is meant to reconstruct the
  6773. progressive frames from a telecined stream. The filter does not drop duplicated
  6774. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6775. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6776. The separation of the field matching and the decimation is notably motivated by
  6777. the possibility of inserting a de-interlacing filter fallback between the two.
  6778. If the source has mixed telecined and real interlaced content,
  6779. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6780. But these remaining combed frames will be marked as interlaced, and thus can be
  6781. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6782. In addition to the various configuration options, @code{fieldmatch} can take an
  6783. optional second stream, activated through the @option{ppsrc} option. If
  6784. enabled, the frames reconstruction will be based on the fields and frames from
  6785. this second stream. This allows the first input to be pre-processed in order to
  6786. help the various algorithms of the filter, while keeping the output lossless
  6787. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6788. or brightness/contrast adjustments can help.
  6789. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6790. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6791. which @code{fieldmatch} is based on. While the semantic and usage are very
  6792. close, some behaviour and options names can differ.
  6793. The @ref{decimate} filter currently only works for constant frame rate input.
  6794. If your input has mixed telecined (30fps) and progressive content with a lower
  6795. framerate like 24fps use the following filterchain to produce the necessary cfr
  6796. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6797. The filter accepts the following options:
  6798. @table @option
  6799. @item order
  6800. Specify the assumed field order of the input stream. Available values are:
  6801. @table @samp
  6802. @item auto
  6803. Auto detect parity (use FFmpeg's internal parity value).
  6804. @item bff
  6805. Assume bottom field first.
  6806. @item tff
  6807. Assume top field first.
  6808. @end table
  6809. Note that it is sometimes recommended not to trust the parity announced by the
  6810. stream.
  6811. Default value is @var{auto}.
  6812. @item mode
  6813. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6814. sense that it won't risk creating jerkiness due to duplicate frames when
  6815. possible, but if there are bad edits or blended fields it will end up
  6816. outputting combed frames when a good match might actually exist. On the other
  6817. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6818. but will almost always find a good frame if there is one. The other values are
  6819. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6820. jerkiness and creating duplicate frames versus finding good matches in sections
  6821. with bad edits, orphaned fields, blended fields, etc.
  6822. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6823. Available values are:
  6824. @table @samp
  6825. @item pc
  6826. 2-way matching (p/c)
  6827. @item pc_n
  6828. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6829. @item pc_u
  6830. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6831. @item pc_n_ub
  6832. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6833. still combed (p/c + n + u/b)
  6834. @item pcn
  6835. 3-way matching (p/c/n)
  6836. @item pcn_ub
  6837. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6838. detected as combed (p/c/n + u/b)
  6839. @end table
  6840. The parenthesis at the end indicate the matches that would be used for that
  6841. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6842. @var{top}).
  6843. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6844. the slowest.
  6845. Default value is @var{pc_n}.
  6846. @item ppsrc
  6847. Mark the main input stream as a pre-processed input, and enable the secondary
  6848. input stream as the clean source to pick the fields from. See the filter
  6849. introduction for more details. It is similar to the @option{clip2} feature from
  6850. VFM/TFM.
  6851. Default value is @code{0} (disabled).
  6852. @item field
  6853. Set the field to match from. It is recommended to set this to the same value as
  6854. @option{order} unless you experience matching failures with that setting. In
  6855. certain circumstances changing the field that is used to match from can have a
  6856. large impact on matching performance. Available values are:
  6857. @table @samp
  6858. @item auto
  6859. Automatic (same value as @option{order}).
  6860. @item bottom
  6861. Match from the bottom field.
  6862. @item top
  6863. Match from the top field.
  6864. @end table
  6865. Default value is @var{auto}.
  6866. @item mchroma
  6867. Set whether or not chroma is included during the match comparisons. In most
  6868. cases it is recommended to leave this enabled. You should set this to @code{0}
  6869. only if your clip has bad chroma problems such as heavy rainbowing or other
  6870. artifacts. Setting this to @code{0} could also be used to speed things up at
  6871. the cost of some accuracy.
  6872. Default value is @code{1}.
  6873. @item y0
  6874. @item y1
  6875. These define an exclusion band which excludes the lines between @option{y0} and
  6876. @option{y1} from being included in the field matching decision. An exclusion
  6877. band can be used to ignore subtitles, a logo, or other things that may
  6878. interfere with the matching. @option{y0} sets the starting scan line and
  6879. @option{y1} sets the ending line; all lines in between @option{y0} and
  6880. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6881. @option{y0} and @option{y1} to the same value will disable the feature.
  6882. @option{y0} and @option{y1} defaults to @code{0}.
  6883. @item scthresh
  6884. Set the scene change detection threshold as a percentage of maximum change on
  6885. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6886. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6887. @option{scthresh} is @code{[0.0, 100.0]}.
  6888. Default value is @code{12.0}.
  6889. @item combmatch
  6890. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6891. account the combed scores of matches when deciding what match to use as the
  6892. final match. Available values are:
  6893. @table @samp
  6894. @item none
  6895. No final matching based on combed scores.
  6896. @item sc
  6897. Combed scores are only used when a scene change is detected.
  6898. @item full
  6899. Use combed scores all the time.
  6900. @end table
  6901. Default is @var{sc}.
  6902. @item combdbg
  6903. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6904. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6905. Available values are:
  6906. @table @samp
  6907. @item none
  6908. No forced calculation.
  6909. @item pcn
  6910. Force p/c/n calculations.
  6911. @item pcnub
  6912. Force p/c/n/u/b calculations.
  6913. @end table
  6914. Default value is @var{none}.
  6915. @item cthresh
  6916. This is the area combing threshold used for combed frame detection. This
  6917. essentially controls how "strong" or "visible" combing must be to be detected.
  6918. Larger values mean combing must be more visible and smaller values mean combing
  6919. can be less visible or strong and still be detected. Valid settings are from
  6920. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6921. be detected as combed). This is basically a pixel difference value. A good
  6922. range is @code{[8, 12]}.
  6923. Default value is @code{9}.
  6924. @item chroma
  6925. Sets whether or not chroma is considered in the combed frame decision. Only
  6926. disable this if your source has chroma problems (rainbowing, etc.) that are
  6927. causing problems for the combed frame detection with chroma enabled. Actually,
  6928. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6929. where there is chroma only combing in the source.
  6930. Default value is @code{0}.
  6931. @item blockx
  6932. @item blocky
  6933. Respectively set the x-axis and y-axis size of the window used during combed
  6934. frame detection. This has to do with the size of the area in which
  6935. @option{combpel} pixels are required to be detected as combed for a frame to be
  6936. declared combed. See the @option{combpel} parameter description for more info.
  6937. Possible values are any number that is a power of 2 starting at 4 and going up
  6938. to 512.
  6939. Default value is @code{16}.
  6940. @item combpel
  6941. The number of combed pixels inside any of the @option{blocky} by
  6942. @option{blockx} size blocks on the frame for the frame to be detected as
  6943. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6944. setting controls "how much" combing there must be in any localized area (a
  6945. window defined by the @option{blockx} and @option{blocky} settings) on the
  6946. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6947. which point no frames will ever be detected as combed). This setting is known
  6948. as @option{MI} in TFM/VFM vocabulary.
  6949. Default value is @code{80}.
  6950. @end table
  6951. @anchor{p/c/n/u/b meaning}
  6952. @subsection p/c/n/u/b meaning
  6953. @subsubsection p/c/n
  6954. We assume the following telecined stream:
  6955. @example
  6956. Top fields: 1 2 2 3 4
  6957. Bottom fields: 1 2 3 4 4
  6958. @end example
  6959. The numbers correspond to the progressive frame the fields relate to. Here, the
  6960. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6961. When @code{fieldmatch} is configured to run a matching from bottom
  6962. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6963. @example
  6964. Input stream:
  6965. T 1 2 2 3 4
  6966. B 1 2 3 4 4 <-- matching reference
  6967. Matches: c c n n c
  6968. Output stream:
  6969. T 1 2 3 4 4
  6970. B 1 2 3 4 4
  6971. @end example
  6972. As a result of the field matching, we can see that some frames get duplicated.
  6973. To perform a complete inverse telecine, you need to rely on a decimation filter
  6974. after this operation. See for instance the @ref{decimate} filter.
  6975. The same operation now matching from top fields (@option{field}=@var{top})
  6976. looks like this:
  6977. @example
  6978. Input stream:
  6979. T 1 2 2 3 4 <-- matching reference
  6980. B 1 2 3 4 4
  6981. Matches: c c p p c
  6982. Output stream:
  6983. T 1 2 2 3 4
  6984. B 1 2 2 3 4
  6985. @end example
  6986. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6987. basically, they refer to the frame and field of the opposite parity:
  6988. @itemize
  6989. @item @var{p} matches the field of the opposite parity in the previous frame
  6990. @item @var{c} matches the field of the opposite parity in the current frame
  6991. @item @var{n} matches the field of the opposite parity in the next frame
  6992. @end itemize
  6993. @subsubsection u/b
  6994. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6995. from the opposite parity flag. In the following examples, we assume that we are
  6996. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6997. 'x' is placed above and below each matched fields.
  6998. With bottom matching (@option{field}=@var{bottom}):
  6999. @example
  7000. Match: c p n b u
  7001. x x x x x
  7002. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7003. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7004. x x x x x
  7005. Output frames:
  7006. 2 1 2 2 2
  7007. 2 2 2 1 3
  7008. @end example
  7009. With top matching (@option{field}=@var{top}):
  7010. @example
  7011. Match: c p n b u
  7012. x x x x x
  7013. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7014. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7015. x x x x x
  7016. Output frames:
  7017. 2 2 2 1 2
  7018. 2 1 3 2 2
  7019. @end example
  7020. @subsection Examples
  7021. Simple IVTC of a top field first telecined stream:
  7022. @example
  7023. fieldmatch=order=tff:combmatch=none, decimate
  7024. @end example
  7025. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7026. @example
  7027. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7028. @end example
  7029. @section fieldorder
  7030. Transform the field order of the input video.
  7031. It accepts the following parameters:
  7032. @table @option
  7033. @item order
  7034. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7035. for bottom field first.
  7036. @end table
  7037. The default value is @samp{tff}.
  7038. The transformation is done by shifting the picture content up or down
  7039. by one line, and filling the remaining line with appropriate picture content.
  7040. This method is consistent with most broadcast field order converters.
  7041. If the input video is not flagged as being interlaced, or it is already
  7042. flagged as being of the required output field order, then this filter does
  7043. not alter the incoming video.
  7044. It is very useful when converting to or from PAL DV material,
  7045. which is bottom field first.
  7046. For example:
  7047. @example
  7048. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7049. @end example
  7050. @section fifo, afifo
  7051. Buffer input images and send them when they are requested.
  7052. It is mainly useful when auto-inserted by the libavfilter
  7053. framework.
  7054. It does not take parameters.
  7055. @section fillborders
  7056. Fill borders of the input video, without changing video stream dimensions.
  7057. Sometimes video can have garbage at the four edges and you may not want to
  7058. crop video input to keep size multiple of some number.
  7059. This filter accepts the following options:
  7060. @table @option
  7061. @item left
  7062. Number of pixels to fill from left border.
  7063. @item right
  7064. Number of pixels to fill from right border.
  7065. @item top
  7066. Number of pixels to fill from top border.
  7067. @item bottom
  7068. Number of pixels to fill from bottom border.
  7069. @item mode
  7070. Set fill mode.
  7071. It accepts the following values:
  7072. @table @samp
  7073. @item smear
  7074. fill pixels using outermost pixels
  7075. @item mirror
  7076. fill pixels using mirroring
  7077. @item fixed
  7078. fill pixels with constant value
  7079. @end table
  7080. Default is @var{smear}.
  7081. @item color
  7082. Set color for pixels in fixed mode. Default is @var{black}.
  7083. @end table
  7084. @section find_rect
  7085. Find a rectangular object
  7086. It accepts the following options:
  7087. @table @option
  7088. @item object
  7089. Filepath of the object image, needs to be in gray8.
  7090. @item threshold
  7091. Detection threshold, default is 0.5.
  7092. @item mipmaps
  7093. Number of mipmaps, default is 3.
  7094. @item xmin, ymin, xmax, ymax
  7095. Specifies the rectangle in which to search.
  7096. @end table
  7097. @subsection Examples
  7098. @itemize
  7099. @item
  7100. Generate a representative palette of a given video using @command{ffmpeg}:
  7101. @example
  7102. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7103. @end example
  7104. @end itemize
  7105. @section cover_rect
  7106. Cover a rectangular object
  7107. It accepts the following options:
  7108. @table @option
  7109. @item cover
  7110. Filepath of the optional cover image, needs to be in yuv420.
  7111. @item mode
  7112. Set covering mode.
  7113. It accepts the following values:
  7114. @table @samp
  7115. @item cover
  7116. cover it by the supplied image
  7117. @item blur
  7118. cover it by interpolating the surrounding pixels
  7119. @end table
  7120. Default value is @var{blur}.
  7121. @end table
  7122. @subsection Examples
  7123. @itemize
  7124. @item
  7125. Generate a representative palette of a given video using @command{ffmpeg}:
  7126. @example
  7127. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7128. @end example
  7129. @end itemize
  7130. @section floodfill
  7131. Flood area with values of same pixel components with another values.
  7132. It accepts the following options:
  7133. @table @option
  7134. @item x
  7135. Set pixel x coordinate.
  7136. @item y
  7137. Set pixel y coordinate.
  7138. @item s0
  7139. Set source #0 component value.
  7140. @item s1
  7141. Set source #1 component value.
  7142. @item s2
  7143. Set source #2 component value.
  7144. @item s3
  7145. Set source #3 component value.
  7146. @item d0
  7147. Set destination #0 component value.
  7148. @item d1
  7149. Set destination #1 component value.
  7150. @item d2
  7151. Set destination #2 component value.
  7152. @item d3
  7153. Set destination #3 component value.
  7154. @end table
  7155. @anchor{format}
  7156. @section format
  7157. Convert the input video to one of the specified pixel formats.
  7158. Libavfilter will try to pick one that is suitable as input to
  7159. the next filter.
  7160. It accepts the following parameters:
  7161. @table @option
  7162. @item pix_fmts
  7163. A '|'-separated list of pixel format names, such as
  7164. "pix_fmts=yuv420p|monow|rgb24".
  7165. @end table
  7166. @subsection Examples
  7167. @itemize
  7168. @item
  7169. Convert the input video to the @var{yuv420p} format
  7170. @example
  7171. format=pix_fmts=yuv420p
  7172. @end example
  7173. Convert the input video to any of the formats in the list
  7174. @example
  7175. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7176. @end example
  7177. @end itemize
  7178. @anchor{fps}
  7179. @section fps
  7180. Convert the video to specified constant frame rate by duplicating or dropping
  7181. frames as necessary.
  7182. It accepts the following parameters:
  7183. @table @option
  7184. @item fps
  7185. The desired output frame rate. The default is @code{25}.
  7186. @item start_time
  7187. Assume the first PTS should be the given value, in seconds. This allows for
  7188. padding/trimming at the start of stream. By default, no assumption is made
  7189. about the first frame's expected PTS, so no padding or trimming is done.
  7190. For example, this could be set to 0 to pad the beginning with duplicates of
  7191. the first frame if a video stream starts after the audio stream or to trim any
  7192. frames with a negative PTS.
  7193. @item round
  7194. Timestamp (PTS) rounding method.
  7195. Possible values are:
  7196. @table @option
  7197. @item zero
  7198. round towards 0
  7199. @item inf
  7200. round away from 0
  7201. @item down
  7202. round towards -infinity
  7203. @item up
  7204. round towards +infinity
  7205. @item near
  7206. round to nearest
  7207. @end table
  7208. The default is @code{near}.
  7209. @item eof_action
  7210. Action performed when reading the last frame.
  7211. Possible values are:
  7212. @table @option
  7213. @item round
  7214. Use same timestamp rounding method as used for other frames.
  7215. @item pass
  7216. Pass through last frame if input duration has not been reached yet.
  7217. @end table
  7218. The default is @code{round}.
  7219. @end table
  7220. Alternatively, the options can be specified as a flat string:
  7221. @var{fps}[:@var{start_time}[:@var{round}]].
  7222. See also the @ref{setpts} filter.
  7223. @subsection Examples
  7224. @itemize
  7225. @item
  7226. A typical usage in order to set the fps to 25:
  7227. @example
  7228. fps=fps=25
  7229. @end example
  7230. @item
  7231. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7232. @example
  7233. fps=fps=film:round=near
  7234. @end example
  7235. @end itemize
  7236. @section framepack
  7237. Pack two different video streams into a stereoscopic video, setting proper
  7238. metadata on supported codecs. The two views should have the same size and
  7239. framerate and processing will stop when the shorter video ends. Please note
  7240. that you may conveniently adjust view properties with the @ref{scale} and
  7241. @ref{fps} filters.
  7242. It accepts the following parameters:
  7243. @table @option
  7244. @item format
  7245. The desired packing format. Supported values are:
  7246. @table @option
  7247. @item sbs
  7248. The views are next to each other (default).
  7249. @item tab
  7250. The views are on top of each other.
  7251. @item lines
  7252. The views are packed by line.
  7253. @item columns
  7254. The views are packed by column.
  7255. @item frameseq
  7256. The views are temporally interleaved.
  7257. @end table
  7258. @end table
  7259. Some examples:
  7260. @example
  7261. # Convert left and right views into a frame-sequential video
  7262. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7263. # Convert views into a side-by-side video with the same output resolution as the input
  7264. 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
  7265. @end example
  7266. @section framerate
  7267. Change the frame rate by interpolating new video output frames from the source
  7268. frames.
  7269. This filter is not designed to function correctly with interlaced media. If
  7270. you wish to change the frame rate of interlaced media then you are required
  7271. to deinterlace before this filter and re-interlace after this filter.
  7272. A description of the accepted options follows.
  7273. @table @option
  7274. @item fps
  7275. Specify the output frames per second. This option can also be specified
  7276. as a value alone. The default is @code{50}.
  7277. @item interp_start
  7278. Specify the start of a range where the output frame will be created as a
  7279. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7280. the default is @code{15}.
  7281. @item interp_end
  7282. Specify the end of a range where the output frame will be created as a
  7283. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7284. the default is @code{240}.
  7285. @item scene
  7286. Specify the level at which a scene change is detected as a value between
  7287. 0 and 100 to indicate a new scene; a low value reflects a low
  7288. probability for the current frame to introduce a new scene, while a higher
  7289. value means the current frame is more likely to be one.
  7290. The default is @code{8.2}.
  7291. @item flags
  7292. Specify flags influencing the filter process.
  7293. Available value for @var{flags} is:
  7294. @table @option
  7295. @item scene_change_detect, scd
  7296. Enable scene change detection using the value of the option @var{scene}.
  7297. This flag is enabled by default.
  7298. @end table
  7299. @end table
  7300. @section framestep
  7301. Select one frame every N-th frame.
  7302. This filter accepts the following option:
  7303. @table @option
  7304. @item step
  7305. Select frame after every @code{step} frames.
  7306. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7307. @end table
  7308. @anchor{frei0r}
  7309. @section frei0r
  7310. Apply a frei0r effect to the input video.
  7311. To enable the compilation of this filter, you need to install the frei0r
  7312. header and configure FFmpeg with @code{--enable-frei0r}.
  7313. It accepts the following parameters:
  7314. @table @option
  7315. @item filter_name
  7316. The name of the frei0r effect to load. If the environment variable
  7317. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7318. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7319. Otherwise, the standard frei0r paths are searched, in this order:
  7320. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7321. @file{/usr/lib/frei0r-1/}.
  7322. @item filter_params
  7323. A '|'-separated list of parameters to pass to the frei0r effect.
  7324. @end table
  7325. A frei0r effect parameter can be a boolean (its value is either
  7326. "y" or "n"), a double, a color (specified as
  7327. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7328. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7329. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7330. a position (specified as @var{X}/@var{Y}, where
  7331. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7332. The number and types of parameters depend on the loaded effect. If an
  7333. effect parameter is not specified, the default value is set.
  7334. @subsection Examples
  7335. @itemize
  7336. @item
  7337. Apply the distort0r effect, setting the first two double parameters:
  7338. @example
  7339. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7340. @end example
  7341. @item
  7342. Apply the colordistance effect, taking a color as the first parameter:
  7343. @example
  7344. frei0r=colordistance:0.2/0.3/0.4
  7345. frei0r=colordistance:violet
  7346. frei0r=colordistance:0x112233
  7347. @end example
  7348. @item
  7349. Apply the perspective effect, specifying the top left and top right image
  7350. positions:
  7351. @example
  7352. frei0r=perspective:0.2/0.2|0.8/0.2
  7353. @end example
  7354. @end itemize
  7355. For more information, see
  7356. @url{http://frei0r.dyne.org}
  7357. @section fspp
  7358. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7359. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7360. processing filter, one of them is performed once per block, not per pixel.
  7361. This allows for much higher speed.
  7362. The filter accepts the following options:
  7363. @table @option
  7364. @item quality
  7365. Set quality. This option defines the number of levels for averaging. It accepts
  7366. an integer in the range 4-5. Default value is @code{4}.
  7367. @item qp
  7368. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7369. If not set, the filter will use the QP from the video stream (if available).
  7370. @item strength
  7371. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7372. more details but also more artifacts, while higher values make the image smoother
  7373. but also blurrier. Default value is @code{0} − PSNR optimal.
  7374. @item use_bframe_qp
  7375. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7376. option may cause flicker since the B-Frames have often larger QP. Default is
  7377. @code{0} (not enabled).
  7378. @end table
  7379. @section gblur
  7380. Apply Gaussian blur filter.
  7381. The filter accepts the following options:
  7382. @table @option
  7383. @item sigma
  7384. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7385. @item steps
  7386. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7387. @item planes
  7388. Set which planes to filter. By default all planes are filtered.
  7389. @item sigmaV
  7390. Set vertical sigma, if negative it will be same as @code{sigma}.
  7391. Default is @code{-1}.
  7392. @end table
  7393. @section geq
  7394. The filter accepts the following options:
  7395. @table @option
  7396. @item lum_expr, lum
  7397. Set the luminance expression.
  7398. @item cb_expr, cb
  7399. Set the chrominance blue expression.
  7400. @item cr_expr, cr
  7401. Set the chrominance red expression.
  7402. @item alpha_expr, a
  7403. Set the alpha expression.
  7404. @item red_expr, r
  7405. Set the red expression.
  7406. @item green_expr, g
  7407. Set the green expression.
  7408. @item blue_expr, b
  7409. Set the blue expression.
  7410. @end table
  7411. The colorspace is selected according to the specified options. If one
  7412. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7413. options is specified, the filter will automatically select a YCbCr
  7414. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7415. @option{blue_expr} options is specified, it will select an RGB
  7416. colorspace.
  7417. If one of the chrominance expression is not defined, it falls back on the other
  7418. one. If no alpha expression is specified it will evaluate to opaque value.
  7419. If none of chrominance expressions are specified, they will evaluate
  7420. to the luminance expression.
  7421. The expressions can use the following variables and functions:
  7422. @table @option
  7423. @item N
  7424. The sequential number of the filtered frame, starting from @code{0}.
  7425. @item X
  7426. @item Y
  7427. The coordinates of the current sample.
  7428. @item W
  7429. @item H
  7430. The width and height of the image.
  7431. @item SW
  7432. @item SH
  7433. Width and height scale depending on the currently filtered plane. It is the
  7434. ratio between the corresponding luma plane number of pixels and the current
  7435. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7436. @code{0.5,0.5} for chroma planes.
  7437. @item T
  7438. Time of the current frame, expressed in seconds.
  7439. @item p(x, y)
  7440. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7441. plane.
  7442. @item lum(x, y)
  7443. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7444. plane.
  7445. @item cb(x, y)
  7446. Return the value of the pixel at location (@var{x},@var{y}) of the
  7447. blue-difference chroma plane. Return 0 if there is no such plane.
  7448. @item cr(x, y)
  7449. Return the value of the pixel at location (@var{x},@var{y}) of the
  7450. red-difference chroma plane. Return 0 if there is no such plane.
  7451. @item r(x, y)
  7452. @item g(x, y)
  7453. @item b(x, y)
  7454. Return the value of the pixel at location (@var{x},@var{y}) of the
  7455. red/green/blue component. Return 0 if there is no such component.
  7456. @item alpha(x, y)
  7457. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7458. plane. Return 0 if there is no such plane.
  7459. @end table
  7460. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7461. automatically clipped to the closer edge.
  7462. @subsection Examples
  7463. @itemize
  7464. @item
  7465. Flip the image horizontally:
  7466. @example
  7467. geq=p(W-X\,Y)
  7468. @end example
  7469. @item
  7470. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7471. wavelength of 100 pixels:
  7472. @example
  7473. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7474. @end example
  7475. @item
  7476. Generate a fancy enigmatic moving light:
  7477. @example
  7478. 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
  7479. @end example
  7480. @item
  7481. Generate a quick emboss effect:
  7482. @example
  7483. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7484. @end example
  7485. @item
  7486. Modify RGB components depending on pixel position:
  7487. @example
  7488. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7489. @end example
  7490. @item
  7491. Create a radial gradient that is the same size as the input (also see
  7492. the @ref{vignette} filter):
  7493. @example
  7494. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7495. @end example
  7496. @end itemize
  7497. @section gradfun
  7498. Fix the banding artifacts that are sometimes introduced into nearly flat
  7499. regions by truncation to 8-bit color depth.
  7500. Interpolate the gradients that should go where the bands are, and
  7501. dither them.
  7502. It is designed for playback only. Do not use it prior to
  7503. lossy compression, because compression tends to lose the dither and
  7504. bring back the bands.
  7505. It accepts the following parameters:
  7506. @table @option
  7507. @item strength
  7508. The maximum amount by which the filter will change any one pixel. This is also
  7509. the threshold for detecting nearly flat regions. Acceptable values range from
  7510. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7511. valid range.
  7512. @item radius
  7513. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7514. gradients, but also prevents the filter from modifying the pixels near detailed
  7515. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7516. values will be clipped to the valid range.
  7517. @end table
  7518. Alternatively, the options can be specified as a flat string:
  7519. @var{strength}[:@var{radius}]
  7520. @subsection Examples
  7521. @itemize
  7522. @item
  7523. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7524. @example
  7525. gradfun=3.5:8
  7526. @end example
  7527. @item
  7528. Specify radius, omitting the strength (which will fall-back to the default
  7529. value):
  7530. @example
  7531. gradfun=radius=8
  7532. @end example
  7533. @end itemize
  7534. @anchor{haldclut}
  7535. @section haldclut
  7536. Apply a Hald CLUT to a video stream.
  7537. First input is the video stream to process, and second one is the Hald CLUT.
  7538. The Hald CLUT input can be a simple picture or a complete video stream.
  7539. The filter accepts the following options:
  7540. @table @option
  7541. @item shortest
  7542. Force termination when the shortest input terminates. Default is @code{0}.
  7543. @item repeatlast
  7544. Continue applying the last CLUT after the end of the stream. A value of
  7545. @code{0} disable the filter after the last frame of the CLUT is reached.
  7546. Default is @code{1}.
  7547. @end table
  7548. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7549. filters share the same internals).
  7550. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7551. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7552. @subsection Workflow examples
  7553. @subsubsection Hald CLUT video stream
  7554. Generate an identity Hald CLUT stream altered with various effects:
  7555. @example
  7556. 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
  7557. @end example
  7558. Note: make sure you use a lossless codec.
  7559. Then use it with @code{haldclut} to apply it on some random stream:
  7560. @example
  7561. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7562. @end example
  7563. The Hald CLUT will be applied to the 10 first seconds (duration of
  7564. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7565. to the remaining frames of the @code{mandelbrot} stream.
  7566. @subsubsection Hald CLUT with preview
  7567. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7568. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7569. biggest possible square starting at the top left of the picture. The remaining
  7570. padding pixels (bottom or right) will be ignored. This area can be used to add
  7571. a preview of the Hald CLUT.
  7572. Typically, the following generated Hald CLUT will be supported by the
  7573. @code{haldclut} filter:
  7574. @example
  7575. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7576. pad=iw+320 [padded_clut];
  7577. smptebars=s=320x256, split [a][b];
  7578. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7579. [main][b] overlay=W-320" -frames:v 1 clut.png
  7580. @end example
  7581. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7582. bars are displayed on the right-top, and below the same color bars processed by
  7583. the color changes.
  7584. Then, the effect of this Hald CLUT can be visualized with:
  7585. @example
  7586. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7587. @end example
  7588. @section hflip
  7589. Flip the input video horizontally.
  7590. For example, to horizontally flip the input video with @command{ffmpeg}:
  7591. @example
  7592. ffmpeg -i in.avi -vf "hflip" out.avi
  7593. @end example
  7594. @section histeq
  7595. This filter applies a global color histogram equalization on a
  7596. per-frame basis.
  7597. It can be used to correct video that has a compressed range of pixel
  7598. intensities. The filter redistributes the pixel intensities to
  7599. equalize their distribution across the intensity range. It may be
  7600. viewed as an "automatically adjusting contrast filter". This filter is
  7601. useful only for correcting degraded or poorly captured source
  7602. video.
  7603. The filter accepts the following options:
  7604. @table @option
  7605. @item strength
  7606. Determine the amount of equalization to be applied. As the strength
  7607. is reduced, the distribution of pixel intensities more-and-more
  7608. approaches that of the input frame. The value must be a float number
  7609. in the range [0,1] and defaults to 0.200.
  7610. @item intensity
  7611. Set the maximum intensity that can generated and scale the output
  7612. values appropriately. The strength should be set as desired and then
  7613. the intensity can be limited if needed to avoid washing-out. The value
  7614. must be a float number in the range [0,1] and defaults to 0.210.
  7615. @item antibanding
  7616. Set the antibanding level. If enabled the filter will randomly vary
  7617. the luminance of output pixels by a small amount to avoid banding of
  7618. the histogram. Possible values are @code{none}, @code{weak} or
  7619. @code{strong}. It defaults to @code{none}.
  7620. @end table
  7621. @section histogram
  7622. Compute and draw a color distribution histogram for the input video.
  7623. The computed histogram is a representation of the color component
  7624. distribution in an image.
  7625. Standard histogram displays the color components distribution in an image.
  7626. Displays color graph for each color component. Shows distribution of
  7627. the Y, U, V, A or R, G, B components, depending on input format, in the
  7628. current frame. Below each graph a color component scale meter is shown.
  7629. The filter accepts the following options:
  7630. @table @option
  7631. @item level_height
  7632. Set height of level. Default value is @code{200}.
  7633. Allowed range is [50, 2048].
  7634. @item scale_height
  7635. Set height of color scale. Default value is @code{12}.
  7636. Allowed range is [0, 40].
  7637. @item display_mode
  7638. Set display mode.
  7639. It accepts the following values:
  7640. @table @samp
  7641. @item stack
  7642. Per color component graphs are placed below each other.
  7643. @item parade
  7644. Per color component graphs are placed side by side.
  7645. @item overlay
  7646. Presents information identical to that in the @code{parade}, except
  7647. that the graphs representing color components are superimposed directly
  7648. over one another.
  7649. @end table
  7650. Default is @code{stack}.
  7651. @item levels_mode
  7652. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7653. Default is @code{linear}.
  7654. @item components
  7655. Set what color components to display.
  7656. Default is @code{7}.
  7657. @item fgopacity
  7658. Set foreground opacity. Default is @code{0.7}.
  7659. @item bgopacity
  7660. Set background opacity. Default is @code{0.5}.
  7661. @end table
  7662. @subsection Examples
  7663. @itemize
  7664. @item
  7665. Calculate and draw histogram:
  7666. @example
  7667. ffplay -i input -vf histogram
  7668. @end example
  7669. @end itemize
  7670. @anchor{hqdn3d}
  7671. @section hqdn3d
  7672. This is a high precision/quality 3d denoise filter. It aims to reduce
  7673. image noise, producing smooth images and making still images really
  7674. still. It should enhance compressibility.
  7675. It accepts the following optional parameters:
  7676. @table @option
  7677. @item luma_spatial
  7678. A non-negative floating point number which specifies spatial luma strength.
  7679. It defaults to 4.0.
  7680. @item chroma_spatial
  7681. A non-negative floating point number which specifies spatial chroma strength.
  7682. It defaults to 3.0*@var{luma_spatial}/4.0.
  7683. @item luma_tmp
  7684. A floating point number which specifies luma temporal strength. It defaults to
  7685. 6.0*@var{luma_spatial}/4.0.
  7686. @item chroma_tmp
  7687. A floating point number which specifies chroma temporal strength. It defaults to
  7688. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7689. @end table
  7690. @section hwdownload
  7691. Download hardware frames to system memory.
  7692. The input must be in hardware frames, and the output a non-hardware format.
  7693. Not all formats will be supported on the output - it may be necessary to insert
  7694. an additional @option{format} filter immediately following in the graph to get
  7695. the output in a supported format.
  7696. @section hwmap
  7697. Map hardware frames to system memory or to another device.
  7698. This filter has several different modes of operation; which one is used depends
  7699. on the input and output formats:
  7700. @itemize
  7701. @item
  7702. Hardware frame input, normal frame output
  7703. Map the input frames to system memory and pass them to the output. If the
  7704. original hardware frame is later required (for example, after overlaying
  7705. something else on part of it), the @option{hwmap} filter can be used again
  7706. in the next mode to retrieve it.
  7707. @item
  7708. Normal frame input, hardware frame output
  7709. If the input is actually a software-mapped hardware frame, then unmap it -
  7710. that is, return the original hardware frame.
  7711. Otherwise, a device must be provided. Create new hardware surfaces on that
  7712. device for the output, then map them back to the software format at the input
  7713. and give those frames to the preceding filter. This will then act like the
  7714. @option{hwupload} filter, but may be able to avoid an additional copy when
  7715. the input is already in a compatible format.
  7716. @item
  7717. Hardware frame input and output
  7718. A device must be supplied for the output, either directly or with the
  7719. @option{derive_device} option. The input and output devices must be of
  7720. different types and compatible - the exact meaning of this is
  7721. system-dependent, but typically it means that they must refer to the same
  7722. underlying hardware context (for example, refer to the same graphics card).
  7723. If the input frames were originally created on the output device, then unmap
  7724. to retrieve the original frames.
  7725. Otherwise, map the frames to the output device - create new hardware frames
  7726. on the output corresponding to the frames on the input.
  7727. @end itemize
  7728. The following additional parameters are accepted:
  7729. @table @option
  7730. @item mode
  7731. Set the frame mapping mode. Some combination of:
  7732. @table @var
  7733. @item read
  7734. The mapped frame should be readable.
  7735. @item write
  7736. The mapped frame should be writeable.
  7737. @item overwrite
  7738. The mapping will always overwrite the entire frame.
  7739. This may improve performance in some cases, as the original contents of the
  7740. frame need not be loaded.
  7741. @item direct
  7742. The mapping must not involve any copying.
  7743. Indirect mappings to copies of frames are created in some cases where either
  7744. direct mapping is not possible or it would have unexpected properties.
  7745. Setting this flag ensures that the mapping is direct and will fail if that is
  7746. not possible.
  7747. @end table
  7748. Defaults to @var{read+write} if not specified.
  7749. @item derive_device @var{type}
  7750. Rather than using the device supplied at initialisation, instead derive a new
  7751. device of type @var{type} from the device the input frames exist on.
  7752. @item reverse
  7753. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7754. and map them back to the source. This may be necessary in some cases where
  7755. a mapping in one direction is required but only the opposite direction is
  7756. supported by the devices being used.
  7757. This option is dangerous - it may break the preceding filter in undefined
  7758. ways if there are any additional constraints on that filter's output.
  7759. Do not use it without fully understanding the implications of its use.
  7760. @end table
  7761. @section hwupload
  7762. Upload system memory frames to hardware surfaces.
  7763. The device to upload to must be supplied when the filter is initialised. If
  7764. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7765. option.
  7766. @anchor{hwupload_cuda}
  7767. @section hwupload_cuda
  7768. Upload system memory frames to a CUDA device.
  7769. It accepts the following optional parameters:
  7770. @table @option
  7771. @item device
  7772. The number of the CUDA device to use
  7773. @end table
  7774. @section hqx
  7775. Apply a high-quality magnification filter designed for pixel art. This filter
  7776. was originally created by Maxim Stepin.
  7777. It accepts the following option:
  7778. @table @option
  7779. @item n
  7780. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7781. @code{hq3x} and @code{4} for @code{hq4x}.
  7782. Default is @code{3}.
  7783. @end table
  7784. @section hstack
  7785. Stack input videos horizontally.
  7786. All streams must be of same pixel format and of same height.
  7787. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7788. to create same output.
  7789. The filter accept the following option:
  7790. @table @option
  7791. @item inputs
  7792. Set number of input streams. Default is 2.
  7793. @item shortest
  7794. If set to 1, force the output to terminate when the shortest input
  7795. terminates. Default value is 0.
  7796. @end table
  7797. @section hue
  7798. Modify the hue and/or the saturation of the input.
  7799. It accepts the following parameters:
  7800. @table @option
  7801. @item h
  7802. Specify the hue angle as a number of degrees. It accepts an expression,
  7803. and defaults to "0".
  7804. @item s
  7805. Specify the saturation in the [-10,10] range. It accepts an expression and
  7806. defaults to "1".
  7807. @item H
  7808. Specify the hue angle as a number of radians. It accepts an
  7809. expression, and defaults to "0".
  7810. @item b
  7811. Specify the brightness in the [-10,10] range. It accepts an expression and
  7812. defaults to "0".
  7813. @end table
  7814. @option{h} and @option{H} are mutually exclusive, and can't be
  7815. specified at the same time.
  7816. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7817. expressions containing the following constants:
  7818. @table @option
  7819. @item n
  7820. frame count of the input frame starting from 0
  7821. @item pts
  7822. presentation timestamp of the input frame expressed in time base units
  7823. @item r
  7824. frame rate of the input video, NAN if the input frame rate is unknown
  7825. @item t
  7826. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7827. @item tb
  7828. time base of the input video
  7829. @end table
  7830. @subsection Examples
  7831. @itemize
  7832. @item
  7833. Set the hue to 90 degrees and the saturation to 1.0:
  7834. @example
  7835. hue=h=90:s=1
  7836. @end example
  7837. @item
  7838. Same command but expressing the hue in radians:
  7839. @example
  7840. hue=H=PI/2:s=1
  7841. @end example
  7842. @item
  7843. Rotate hue and make the saturation swing between 0
  7844. and 2 over a period of 1 second:
  7845. @example
  7846. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7847. @end example
  7848. @item
  7849. Apply a 3 seconds saturation fade-in effect starting at 0:
  7850. @example
  7851. hue="s=min(t/3\,1)"
  7852. @end example
  7853. The general fade-in expression can be written as:
  7854. @example
  7855. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7856. @end example
  7857. @item
  7858. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7859. @example
  7860. hue="s=max(0\, min(1\, (8-t)/3))"
  7861. @end example
  7862. The general fade-out expression can be written as:
  7863. @example
  7864. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7865. @end example
  7866. @end itemize
  7867. @subsection Commands
  7868. This filter supports the following commands:
  7869. @table @option
  7870. @item b
  7871. @item s
  7872. @item h
  7873. @item H
  7874. Modify the hue and/or the saturation and/or brightness of the input video.
  7875. The command accepts the same syntax of the corresponding option.
  7876. If the specified expression is not valid, it is kept at its current
  7877. value.
  7878. @end table
  7879. @section hysteresis
  7880. Grow first stream into second stream by connecting components.
  7881. This makes it possible to build more robust edge masks.
  7882. This filter accepts the following options:
  7883. @table @option
  7884. @item planes
  7885. Set which planes will be processed as bitmap, unprocessed planes will be
  7886. copied from first stream.
  7887. By default value 0xf, all planes will be processed.
  7888. @item threshold
  7889. Set threshold which is used in filtering. If pixel component value is higher than
  7890. this value filter algorithm for connecting components is activated.
  7891. By default value is 0.
  7892. @end table
  7893. @section idet
  7894. Detect video interlacing type.
  7895. This filter tries to detect if the input frames are interlaced, progressive,
  7896. top or bottom field first. It will also try to detect fields that are
  7897. repeated between adjacent frames (a sign of telecine).
  7898. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7899. Multiple frame detection incorporates the classification history of previous frames.
  7900. The filter will log these metadata values:
  7901. @table @option
  7902. @item single.current_frame
  7903. Detected type of current frame using single-frame detection. One of:
  7904. ``tff'' (top field first), ``bff'' (bottom field first),
  7905. ``progressive'', or ``undetermined''
  7906. @item single.tff
  7907. Cumulative number of frames detected as top field first using single-frame detection.
  7908. @item multiple.tff
  7909. Cumulative number of frames detected as top field first using multiple-frame detection.
  7910. @item single.bff
  7911. Cumulative number of frames detected as bottom field first using single-frame detection.
  7912. @item multiple.current_frame
  7913. Detected type of current frame using multiple-frame detection. One of:
  7914. ``tff'' (top field first), ``bff'' (bottom field first),
  7915. ``progressive'', or ``undetermined''
  7916. @item multiple.bff
  7917. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7918. @item single.progressive
  7919. Cumulative number of frames detected as progressive using single-frame detection.
  7920. @item multiple.progressive
  7921. Cumulative number of frames detected as progressive using multiple-frame detection.
  7922. @item single.undetermined
  7923. Cumulative number of frames that could not be classified using single-frame detection.
  7924. @item multiple.undetermined
  7925. Cumulative number of frames that could not be classified using multiple-frame detection.
  7926. @item repeated.current_frame
  7927. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7928. @item repeated.neither
  7929. Cumulative number of frames with no repeated field.
  7930. @item repeated.top
  7931. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7932. @item repeated.bottom
  7933. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7934. @end table
  7935. The filter accepts the following options:
  7936. @table @option
  7937. @item intl_thres
  7938. Set interlacing threshold.
  7939. @item prog_thres
  7940. Set progressive threshold.
  7941. @item rep_thres
  7942. Threshold for repeated field detection.
  7943. @item half_life
  7944. Number of frames after which a given frame's contribution to the
  7945. statistics is halved (i.e., it contributes only 0.5 to its
  7946. classification). The default of 0 means that all frames seen are given
  7947. full weight of 1.0 forever.
  7948. @item analyze_interlaced_flag
  7949. When this is not 0 then idet will use the specified number of frames to determine
  7950. if the interlaced flag is accurate, it will not count undetermined frames.
  7951. If the flag is found to be accurate it will be used without any further
  7952. computations, if it is found to be inaccurate it will be cleared without any
  7953. further computations. This allows inserting the idet filter as a low computational
  7954. method to clean up the interlaced flag
  7955. @end table
  7956. @section il
  7957. Deinterleave or interleave fields.
  7958. This filter allows one to process interlaced images fields without
  7959. deinterlacing them. Deinterleaving splits the input frame into 2
  7960. fields (so called half pictures). Odd lines are moved to the top
  7961. half of the output image, even lines to the bottom half.
  7962. You can process (filter) them independently and then re-interleave them.
  7963. The filter accepts the following options:
  7964. @table @option
  7965. @item luma_mode, l
  7966. @item chroma_mode, c
  7967. @item alpha_mode, a
  7968. Available values for @var{luma_mode}, @var{chroma_mode} and
  7969. @var{alpha_mode} are:
  7970. @table @samp
  7971. @item none
  7972. Do nothing.
  7973. @item deinterleave, d
  7974. Deinterleave fields, placing one above the other.
  7975. @item interleave, i
  7976. Interleave fields. Reverse the effect of deinterleaving.
  7977. @end table
  7978. Default value is @code{none}.
  7979. @item luma_swap, ls
  7980. @item chroma_swap, cs
  7981. @item alpha_swap, as
  7982. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7983. @end table
  7984. @section inflate
  7985. Apply inflate effect to the video.
  7986. This filter replaces the pixel by the local(3x3) average by taking into account
  7987. only values higher than the pixel.
  7988. It accepts the following options:
  7989. @table @option
  7990. @item threshold0
  7991. @item threshold1
  7992. @item threshold2
  7993. @item threshold3
  7994. Limit the maximum change for each plane, default is 65535.
  7995. If 0, plane will remain unchanged.
  7996. @end table
  7997. @section interlace
  7998. Simple interlacing filter from progressive contents. This interleaves upper (or
  7999. lower) lines from odd frames with lower (or upper) lines from even frames,
  8000. halving the frame rate and preserving image height.
  8001. @example
  8002. Original Original New Frame
  8003. Frame 'j' Frame 'j+1' (tff)
  8004. ========== =========== ==================
  8005. Line 0 --------------------> Frame 'j' Line 0
  8006. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8007. Line 2 ---------------------> Frame 'j' Line 2
  8008. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8009. ... ... ...
  8010. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8011. @end example
  8012. It accepts the following optional parameters:
  8013. @table @option
  8014. @item scan
  8015. This determines whether the interlaced frame is taken from the even
  8016. (tff - default) or odd (bff) lines of the progressive frame.
  8017. @item lowpass
  8018. Vertical lowpass filter to avoid twitter interlacing and
  8019. reduce moire patterns.
  8020. @table @samp
  8021. @item 0, off
  8022. Disable vertical lowpass filter
  8023. @item 1, linear
  8024. Enable linear filter (default)
  8025. @item 2, complex
  8026. Enable complex filter. This will slightly less reduce twitter and moire
  8027. but better retain detail and subjective sharpness impression.
  8028. @end table
  8029. @end table
  8030. @section kerndeint
  8031. Deinterlace input video by applying Donald Graft's adaptive kernel
  8032. deinterling. Work on interlaced parts of a video to produce
  8033. progressive frames.
  8034. The description of the accepted parameters follows.
  8035. @table @option
  8036. @item thresh
  8037. Set the threshold which affects the filter's tolerance when
  8038. determining if a pixel line must be processed. It must be an integer
  8039. in the range [0,255] and defaults to 10. A value of 0 will result in
  8040. applying the process on every pixels.
  8041. @item map
  8042. Paint pixels exceeding the threshold value to white if set to 1.
  8043. Default is 0.
  8044. @item order
  8045. Set the fields order. Swap fields if set to 1, leave fields alone if
  8046. 0. Default is 0.
  8047. @item sharp
  8048. Enable additional sharpening if set to 1. Default is 0.
  8049. @item twoway
  8050. Enable twoway sharpening if set to 1. Default is 0.
  8051. @end table
  8052. @subsection Examples
  8053. @itemize
  8054. @item
  8055. Apply default values:
  8056. @example
  8057. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8058. @end example
  8059. @item
  8060. Enable additional sharpening:
  8061. @example
  8062. kerndeint=sharp=1
  8063. @end example
  8064. @item
  8065. Paint processed pixels in white:
  8066. @example
  8067. kerndeint=map=1
  8068. @end example
  8069. @end itemize
  8070. @section lenscorrection
  8071. Correct radial lens distortion
  8072. This filter can be used to correct for radial distortion as can result from the use
  8073. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8074. one can use tools available for example as part of opencv or simply trial-and-error.
  8075. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8076. and extract the k1 and k2 coefficients from the resulting matrix.
  8077. Note that effectively the same filter is available in the open-source tools Krita and
  8078. Digikam from the KDE project.
  8079. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8080. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8081. brightness distribution, so you may want to use both filters together in certain
  8082. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8083. be applied before or after lens correction.
  8084. @subsection Options
  8085. The filter accepts the following options:
  8086. @table @option
  8087. @item cx
  8088. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8089. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8090. width. Default is 0.5.
  8091. @item cy
  8092. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8093. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8094. height. Default is 0.5.
  8095. @item k1
  8096. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8097. no correction. Default is 0.
  8098. @item k2
  8099. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8100. 0 means no correction. Default is 0.
  8101. @end table
  8102. The formula that generates the correction is:
  8103. @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)
  8104. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8105. distances from the focal point in the source and target images, respectively.
  8106. @section libvmaf
  8107. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8108. score between two input videos.
  8109. The obtained VMAF score is printed through the logging system.
  8110. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8111. After installing the library it can be enabled using:
  8112. @code{./configure --enable-libvmaf}.
  8113. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8114. The filter has following options:
  8115. @table @option
  8116. @item model_path
  8117. Set the model path which is to be used for SVM.
  8118. Default value: @code{"vmaf_v0.6.1.pkl"}
  8119. @item log_path
  8120. Set the file path to be used to store logs.
  8121. @item log_fmt
  8122. Set the format of the log file (xml or json).
  8123. @item enable_transform
  8124. Enables transform for computing vmaf.
  8125. @item phone_model
  8126. Invokes the phone model which will generate VMAF scores higher than in the
  8127. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8128. @item psnr
  8129. Enables computing psnr along with vmaf.
  8130. @item ssim
  8131. Enables computing ssim along with vmaf.
  8132. @item ms_ssim
  8133. Enables computing ms_ssim along with vmaf.
  8134. @item pool
  8135. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8136. @end table
  8137. This filter also supports the @ref{framesync} options.
  8138. On the below examples the input file @file{main.mpg} being processed is
  8139. compared with the reference file @file{ref.mpg}.
  8140. @example
  8141. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8142. @end example
  8143. Example with options:
  8144. @example
  8145. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8146. @end example
  8147. @section limiter
  8148. Limits the pixel components values to the specified range [min, max].
  8149. The filter accepts the following options:
  8150. @table @option
  8151. @item min
  8152. Lower bound. Defaults to the lowest allowed value for the input.
  8153. @item max
  8154. Upper bound. Defaults to the highest allowed value for the input.
  8155. @item planes
  8156. Specify which planes will be processed. Defaults to all available.
  8157. @end table
  8158. @section loop
  8159. Loop video frames.
  8160. The filter accepts the following options:
  8161. @table @option
  8162. @item loop
  8163. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8164. Default is 0.
  8165. @item size
  8166. Set maximal size in number of frames. Default is 0.
  8167. @item start
  8168. Set first frame of loop. Default is 0.
  8169. @end table
  8170. @anchor{lut3d}
  8171. @section lut3d
  8172. Apply a 3D LUT to an input video.
  8173. The filter accepts the following options:
  8174. @table @option
  8175. @item file
  8176. Set the 3D LUT file name.
  8177. Currently supported formats:
  8178. @table @samp
  8179. @item 3dl
  8180. AfterEffects
  8181. @item cube
  8182. Iridas
  8183. @item dat
  8184. DaVinci
  8185. @item m3d
  8186. Pandora
  8187. @end table
  8188. @item interp
  8189. Select interpolation mode.
  8190. Available values are:
  8191. @table @samp
  8192. @item nearest
  8193. Use values from the nearest defined point.
  8194. @item trilinear
  8195. Interpolate values using the 8 points defining a cube.
  8196. @item tetrahedral
  8197. Interpolate values using a tetrahedron.
  8198. @end table
  8199. @end table
  8200. This filter also supports the @ref{framesync} options.
  8201. @section lumakey
  8202. Turn certain luma values into transparency.
  8203. The filter accepts the following options:
  8204. @table @option
  8205. @item threshold
  8206. Set the luma which will be used as base for transparency.
  8207. Default value is @code{0}.
  8208. @item tolerance
  8209. Set the range of luma values to be keyed out.
  8210. Default value is @code{0}.
  8211. @item softness
  8212. Set the range of softness. Default value is @code{0}.
  8213. Use this to control gradual transition from zero to full transparency.
  8214. @end table
  8215. @section lut, lutrgb, lutyuv
  8216. Compute a look-up table for binding each pixel component input value
  8217. to an output value, and apply it to the input video.
  8218. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8219. to an RGB input video.
  8220. These filters accept the following parameters:
  8221. @table @option
  8222. @item c0
  8223. set first pixel component expression
  8224. @item c1
  8225. set second pixel component expression
  8226. @item c2
  8227. set third pixel component expression
  8228. @item c3
  8229. set fourth pixel component expression, corresponds to the alpha component
  8230. @item r
  8231. set red component expression
  8232. @item g
  8233. set green component expression
  8234. @item b
  8235. set blue component expression
  8236. @item a
  8237. alpha component expression
  8238. @item y
  8239. set Y/luminance component expression
  8240. @item u
  8241. set U/Cb component expression
  8242. @item v
  8243. set V/Cr component expression
  8244. @end table
  8245. Each of them specifies the expression to use for computing the lookup table for
  8246. the corresponding pixel component values.
  8247. The exact component associated to each of the @var{c*} options depends on the
  8248. format in input.
  8249. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8250. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8251. The expressions can contain the following constants and functions:
  8252. @table @option
  8253. @item w
  8254. @item h
  8255. The input width and height.
  8256. @item val
  8257. The input value for the pixel component.
  8258. @item clipval
  8259. The input value, clipped to the @var{minval}-@var{maxval} range.
  8260. @item maxval
  8261. The maximum value for the pixel component.
  8262. @item minval
  8263. The minimum value for the pixel component.
  8264. @item negval
  8265. The negated value for the pixel component value, clipped to the
  8266. @var{minval}-@var{maxval} range; it corresponds to the expression
  8267. "maxval-clipval+minval".
  8268. @item clip(val)
  8269. The computed value in @var{val}, clipped to the
  8270. @var{minval}-@var{maxval} range.
  8271. @item gammaval(gamma)
  8272. The computed gamma correction value of the pixel component value,
  8273. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8274. expression
  8275. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8276. @end table
  8277. All expressions default to "val".
  8278. @subsection Examples
  8279. @itemize
  8280. @item
  8281. Negate input video:
  8282. @example
  8283. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8284. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8285. @end example
  8286. The above is the same as:
  8287. @example
  8288. lutrgb="r=negval:g=negval:b=negval"
  8289. lutyuv="y=negval:u=negval:v=negval"
  8290. @end example
  8291. @item
  8292. Negate luminance:
  8293. @example
  8294. lutyuv=y=negval
  8295. @end example
  8296. @item
  8297. Remove chroma components, turning the video into a graytone image:
  8298. @example
  8299. lutyuv="u=128:v=128"
  8300. @end example
  8301. @item
  8302. Apply a luma burning effect:
  8303. @example
  8304. lutyuv="y=2*val"
  8305. @end example
  8306. @item
  8307. Remove green and blue components:
  8308. @example
  8309. lutrgb="g=0:b=0"
  8310. @end example
  8311. @item
  8312. Set a constant alpha channel value on input:
  8313. @example
  8314. format=rgba,lutrgb=a="maxval-minval/2"
  8315. @end example
  8316. @item
  8317. Correct luminance gamma by a factor of 0.5:
  8318. @example
  8319. lutyuv=y=gammaval(0.5)
  8320. @end example
  8321. @item
  8322. Discard least significant bits of luma:
  8323. @example
  8324. lutyuv=y='bitand(val, 128+64+32)'
  8325. @end example
  8326. @item
  8327. Technicolor like effect:
  8328. @example
  8329. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8330. @end example
  8331. @end itemize
  8332. @section lut2, tlut2
  8333. The @code{lut2} filter takes two input streams and outputs one
  8334. stream.
  8335. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8336. from one single stream.
  8337. This filter accepts the following parameters:
  8338. @table @option
  8339. @item c0
  8340. set first pixel component expression
  8341. @item c1
  8342. set second pixel component expression
  8343. @item c2
  8344. set third pixel component expression
  8345. @item c3
  8346. set fourth pixel component expression, corresponds to the alpha component
  8347. @end table
  8348. Each of them specifies the expression to use for computing the lookup table for
  8349. the corresponding pixel component values.
  8350. The exact component associated to each of the @var{c*} options depends on the
  8351. format in inputs.
  8352. The expressions can contain the following constants:
  8353. @table @option
  8354. @item w
  8355. @item h
  8356. The input width and height.
  8357. @item x
  8358. The first input value for the pixel component.
  8359. @item y
  8360. The second input value for the pixel component.
  8361. @item bdx
  8362. The first input video bit depth.
  8363. @item bdy
  8364. The second input video bit depth.
  8365. @end table
  8366. All expressions default to "x".
  8367. @subsection Examples
  8368. @itemize
  8369. @item
  8370. Highlight differences between two RGB video streams:
  8371. @example
  8372. 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)'
  8373. @end example
  8374. @item
  8375. Highlight differences between two YUV video streams:
  8376. @example
  8377. 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)'
  8378. @end example
  8379. @item
  8380. Show max difference between two video streams:
  8381. @example
  8382. 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)))'
  8383. @end example
  8384. @end itemize
  8385. @section maskedclamp
  8386. Clamp the first input stream with the second input and third input stream.
  8387. Returns the value of first stream to be between second input
  8388. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8389. This filter accepts the following options:
  8390. @table @option
  8391. @item undershoot
  8392. Default value is @code{0}.
  8393. @item overshoot
  8394. Default value is @code{0}.
  8395. @item planes
  8396. Set which planes will be processed as bitmap, unprocessed planes will be
  8397. copied from first stream.
  8398. By default value 0xf, all planes will be processed.
  8399. @end table
  8400. @section maskedmerge
  8401. Merge the first input stream with the second input stream using per pixel
  8402. weights in the third input stream.
  8403. A value of 0 in the third stream pixel component means that pixel component
  8404. from first stream is returned unchanged, while maximum value (eg. 255 for
  8405. 8-bit videos) means that pixel component from second stream is returned
  8406. unchanged. Intermediate values define the amount of merging between both
  8407. input stream's pixel components.
  8408. This filter accepts the following options:
  8409. @table @option
  8410. @item planes
  8411. Set which planes will be processed as bitmap, unprocessed planes will be
  8412. copied from first stream.
  8413. By default value 0xf, all planes will be processed.
  8414. @end table
  8415. @section mcdeint
  8416. Apply motion-compensation deinterlacing.
  8417. It needs one field per frame as input and must thus be used together
  8418. with yadif=1/3 or equivalent.
  8419. This filter accepts the following options:
  8420. @table @option
  8421. @item mode
  8422. Set the deinterlacing mode.
  8423. It accepts one of the following values:
  8424. @table @samp
  8425. @item fast
  8426. @item medium
  8427. @item slow
  8428. use iterative motion estimation
  8429. @item extra_slow
  8430. like @samp{slow}, but use multiple reference frames.
  8431. @end table
  8432. Default value is @samp{fast}.
  8433. @item parity
  8434. Set the picture field parity assumed for the input video. It must be
  8435. one of the following values:
  8436. @table @samp
  8437. @item 0, tff
  8438. assume top field first
  8439. @item 1, bff
  8440. assume bottom field first
  8441. @end table
  8442. Default value is @samp{bff}.
  8443. @item qp
  8444. Set per-block quantization parameter (QP) used by the internal
  8445. encoder.
  8446. Higher values should result in a smoother motion vector field but less
  8447. optimal individual vectors. Default value is 1.
  8448. @end table
  8449. @section mergeplanes
  8450. Merge color channel components from several video streams.
  8451. The filter accepts up to 4 input streams, and merge selected input
  8452. planes to the output video.
  8453. This filter accepts the following options:
  8454. @table @option
  8455. @item mapping
  8456. Set input to output plane mapping. Default is @code{0}.
  8457. The mappings is specified as a bitmap. It should be specified as a
  8458. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8459. mapping for the first plane of the output stream. 'A' sets the number of
  8460. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8461. corresponding input to use (from 0 to 3). The rest of the mappings is
  8462. similar, 'Bb' describes the mapping for the output stream second
  8463. plane, 'Cc' describes the mapping for the output stream third plane and
  8464. 'Dd' describes the mapping for the output stream fourth plane.
  8465. @item format
  8466. Set output pixel format. Default is @code{yuva444p}.
  8467. @end table
  8468. @subsection Examples
  8469. @itemize
  8470. @item
  8471. Merge three gray video streams of same width and height into single video stream:
  8472. @example
  8473. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8474. @end example
  8475. @item
  8476. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8477. @example
  8478. [a0][a1]mergeplanes=0x00010210:yuva444p
  8479. @end example
  8480. @item
  8481. Swap Y and A plane in yuva444p stream:
  8482. @example
  8483. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8484. @end example
  8485. @item
  8486. Swap U and V plane in yuv420p stream:
  8487. @example
  8488. format=yuv420p,mergeplanes=0x000201:yuv420p
  8489. @end example
  8490. @item
  8491. Cast a rgb24 clip to yuv444p:
  8492. @example
  8493. format=rgb24,mergeplanes=0x000102:yuv444p
  8494. @end example
  8495. @end itemize
  8496. @section mestimate
  8497. Estimate and export motion vectors using block matching algorithms.
  8498. Motion vectors are stored in frame side data to be used by other filters.
  8499. This filter accepts the following options:
  8500. @table @option
  8501. @item method
  8502. Specify the motion estimation method. Accepts one of the following values:
  8503. @table @samp
  8504. @item esa
  8505. Exhaustive search algorithm.
  8506. @item tss
  8507. Three step search algorithm.
  8508. @item tdls
  8509. Two dimensional logarithmic search algorithm.
  8510. @item ntss
  8511. New three step search algorithm.
  8512. @item fss
  8513. Four step search algorithm.
  8514. @item ds
  8515. Diamond search algorithm.
  8516. @item hexbs
  8517. Hexagon-based search algorithm.
  8518. @item epzs
  8519. Enhanced predictive zonal search algorithm.
  8520. @item umh
  8521. Uneven multi-hexagon search algorithm.
  8522. @end table
  8523. Default value is @samp{esa}.
  8524. @item mb_size
  8525. Macroblock size. Default @code{16}.
  8526. @item search_param
  8527. Search parameter. Default @code{7}.
  8528. @end table
  8529. @section midequalizer
  8530. Apply Midway Image Equalization effect using two video streams.
  8531. Midway Image Equalization adjusts a pair of images to have the same
  8532. histogram, while maintaining their dynamics as much as possible. It's
  8533. useful for e.g. matching exposures from a pair of stereo cameras.
  8534. This filter has two inputs and one output, which must be of same pixel format, but
  8535. may be of different sizes. The output of filter is first input adjusted with
  8536. midway histogram of both inputs.
  8537. This filter accepts the following option:
  8538. @table @option
  8539. @item planes
  8540. Set which planes to process. Default is @code{15}, which is all available planes.
  8541. @end table
  8542. @section minterpolate
  8543. Convert the video to specified frame rate using motion interpolation.
  8544. This filter accepts the following options:
  8545. @table @option
  8546. @item fps
  8547. 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}.
  8548. @item mi_mode
  8549. Motion interpolation mode. Following values are accepted:
  8550. @table @samp
  8551. @item dup
  8552. Duplicate previous or next frame for interpolating new ones.
  8553. @item blend
  8554. Blend source frames. Interpolated frame is mean of previous and next frames.
  8555. @item mci
  8556. Motion compensated interpolation. Following options are effective when this mode is selected:
  8557. @table @samp
  8558. @item mc_mode
  8559. Motion compensation mode. Following values are accepted:
  8560. @table @samp
  8561. @item obmc
  8562. Overlapped block motion compensation.
  8563. @item aobmc
  8564. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8565. @end table
  8566. Default mode is @samp{obmc}.
  8567. @item me_mode
  8568. Motion estimation mode. Following values are accepted:
  8569. @table @samp
  8570. @item bidir
  8571. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8572. @item bilat
  8573. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8574. @end table
  8575. Default mode is @samp{bilat}.
  8576. @item me
  8577. The algorithm to be used for motion estimation. Following values are accepted:
  8578. @table @samp
  8579. @item esa
  8580. Exhaustive search algorithm.
  8581. @item tss
  8582. Three step search algorithm.
  8583. @item tdls
  8584. Two dimensional logarithmic search algorithm.
  8585. @item ntss
  8586. New three step search algorithm.
  8587. @item fss
  8588. Four step search algorithm.
  8589. @item ds
  8590. Diamond search algorithm.
  8591. @item hexbs
  8592. Hexagon-based search algorithm.
  8593. @item epzs
  8594. Enhanced predictive zonal search algorithm.
  8595. @item umh
  8596. Uneven multi-hexagon search algorithm.
  8597. @end table
  8598. Default algorithm is @samp{epzs}.
  8599. @item mb_size
  8600. Macroblock size. Default @code{16}.
  8601. @item search_param
  8602. Motion estimation search parameter. Default @code{32}.
  8603. @item vsbmc
  8604. 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).
  8605. @end table
  8606. @end table
  8607. @item scd
  8608. 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:
  8609. @table @samp
  8610. @item none
  8611. Disable scene change detection.
  8612. @item fdiff
  8613. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8614. @end table
  8615. Default method is @samp{fdiff}.
  8616. @item scd_threshold
  8617. Scene change detection threshold. Default is @code{5.0}.
  8618. @end table
  8619. @section mix
  8620. Mix several video input streams into one video stream.
  8621. A description of the accepted options follows.
  8622. @table @option
  8623. @item nb_inputs
  8624. The number of inputs. If unspecified, it defaults to 2.
  8625. @item weights
  8626. Specify weight of each input video stream as sequence.
  8627. Each weight is separated by space. If number of weights
  8628. is smaller than number of @var{frames} last specified
  8629. weight will be used for all remaining unset weights.
  8630. @item scale
  8631. Specify scale, if it is set it will be multiplied with sum
  8632. of each weight multiplied with pixel values to give final destination
  8633. pixel value. By default @var{scale} is auto scaled to sum of weights.
  8634. @item duration
  8635. Specify how end of stream is determined.
  8636. @table @samp
  8637. @item longest
  8638. The duration of the longest input. (default)
  8639. @item shortest
  8640. The duration of the shortest input.
  8641. @item first
  8642. The duration of the first input.
  8643. @end table
  8644. @end table
  8645. @section mpdecimate
  8646. Drop frames that do not differ greatly from the previous frame in
  8647. order to reduce frame rate.
  8648. The main use of this filter is for very-low-bitrate encoding
  8649. (e.g. streaming over dialup modem), but it could in theory be used for
  8650. fixing movies that were inverse-telecined incorrectly.
  8651. A description of the accepted options follows.
  8652. @table @option
  8653. @item max
  8654. Set the maximum number of consecutive frames which can be dropped (if
  8655. positive), or the minimum interval between dropped frames (if
  8656. negative). If the value is 0, the frame is dropped disregarding the
  8657. number of previous sequentially dropped frames.
  8658. Default value is 0.
  8659. @item hi
  8660. @item lo
  8661. @item frac
  8662. Set the dropping threshold values.
  8663. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8664. represent actual pixel value differences, so a threshold of 64
  8665. corresponds to 1 unit of difference for each pixel, or the same spread
  8666. out differently over the block.
  8667. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8668. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8669. meaning the whole image) differ by more than a threshold of @option{lo}.
  8670. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8671. 64*5, and default value for @option{frac} is 0.33.
  8672. @end table
  8673. @section negate
  8674. Negate input video.
  8675. It accepts an integer in input; if non-zero it negates the
  8676. alpha component (if available). The default value in input is 0.
  8677. @section nlmeans
  8678. Denoise frames using Non-Local Means algorithm.
  8679. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8680. context similarity is defined by comparing their surrounding patches of size
  8681. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8682. around the pixel.
  8683. Note that the research area defines centers for patches, which means some
  8684. patches will be made of pixels outside that research area.
  8685. The filter accepts the following options.
  8686. @table @option
  8687. @item s
  8688. Set denoising strength.
  8689. @item p
  8690. Set patch size.
  8691. @item pc
  8692. Same as @option{p} but for chroma planes.
  8693. The default value is @var{0} and means automatic.
  8694. @item r
  8695. Set research size.
  8696. @item rc
  8697. Same as @option{r} but for chroma planes.
  8698. The default value is @var{0} and means automatic.
  8699. @end table
  8700. @section nnedi
  8701. Deinterlace video using neural network edge directed interpolation.
  8702. This filter accepts the following options:
  8703. @table @option
  8704. @item weights
  8705. Mandatory option, without binary file filter can not work.
  8706. Currently file can be found here:
  8707. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8708. @item deint
  8709. Set which frames to deinterlace, by default it is @code{all}.
  8710. Can be @code{all} or @code{interlaced}.
  8711. @item field
  8712. Set mode of operation.
  8713. Can be one of the following:
  8714. @table @samp
  8715. @item af
  8716. Use frame flags, both fields.
  8717. @item a
  8718. Use frame flags, single field.
  8719. @item t
  8720. Use top field only.
  8721. @item b
  8722. Use bottom field only.
  8723. @item tf
  8724. Use both fields, top first.
  8725. @item bf
  8726. Use both fields, bottom first.
  8727. @end table
  8728. @item planes
  8729. Set which planes to process, by default filter process all frames.
  8730. @item nsize
  8731. Set size of local neighborhood around each pixel, used by the predictor neural
  8732. network.
  8733. Can be one of the following:
  8734. @table @samp
  8735. @item s8x6
  8736. @item s16x6
  8737. @item s32x6
  8738. @item s48x6
  8739. @item s8x4
  8740. @item s16x4
  8741. @item s32x4
  8742. @end table
  8743. @item nns
  8744. Set the number of neurons in predictor neural network.
  8745. Can be one of the following:
  8746. @table @samp
  8747. @item n16
  8748. @item n32
  8749. @item n64
  8750. @item n128
  8751. @item n256
  8752. @end table
  8753. @item qual
  8754. Controls the number of different neural network predictions that are blended
  8755. together to compute the final output value. Can be @code{fast}, default or
  8756. @code{slow}.
  8757. @item etype
  8758. Set which set of weights to use in the predictor.
  8759. Can be one of the following:
  8760. @table @samp
  8761. @item a
  8762. weights trained to minimize absolute error
  8763. @item s
  8764. weights trained to minimize squared error
  8765. @end table
  8766. @item pscrn
  8767. Controls whether or not the prescreener neural network is used to decide
  8768. which pixels should be processed by the predictor neural network and which
  8769. can be handled by simple cubic interpolation.
  8770. The prescreener is trained to know whether cubic interpolation will be
  8771. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8772. The computational complexity of the prescreener nn is much less than that of
  8773. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8774. using the prescreener generally results in much faster processing.
  8775. The prescreener is pretty accurate, so the difference between using it and not
  8776. using it is almost always unnoticeable.
  8777. Can be one of the following:
  8778. @table @samp
  8779. @item none
  8780. @item original
  8781. @item new
  8782. @end table
  8783. Default is @code{new}.
  8784. @item fapprox
  8785. Set various debugging flags.
  8786. @end table
  8787. @section noformat
  8788. Force libavfilter not to use any of the specified pixel formats for the
  8789. input to the next filter.
  8790. It accepts the following parameters:
  8791. @table @option
  8792. @item pix_fmts
  8793. A '|'-separated list of pixel format names, such as
  8794. pix_fmts=yuv420p|monow|rgb24".
  8795. @end table
  8796. @subsection Examples
  8797. @itemize
  8798. @item
  8799. Force libavfilter to use a format different from @var{yuv420p} for the
  8800. input to the vflip filter:
  8801. @example
  8802. noformat=pix_fmts=yuv420p,vflip
  8803. @end example
  8804. @item
  8805. Convert the input video to any of the formats not contained in the list:
  8806. @example
  8807. noformat=yuv420p|yuv444p|yuv410p
  8808. @end example
  8809. @end itemize
  8810. @section noise
  8811. Add noise on video input frame.
  8812. The filter accepts the following options:
  8813. @table @option
  8814. @item all_seed
  8815. @item c0_seed
  8816. @item c1_seed
  8817. @item c2_seed
  8818. @item c3_seed
  8819. Set noise seed for specific pixel component or all pixel components in case
  8820. of @var{all_seed}. Default value is @code{123457}.
  8821. @item all_strength, alls
  8822. @item c0_strength, c0s
  8823. @item c1_strength, c1s
  8824. @item c2_strength, c2s
  8825. @item c3_strength, c3s
  8826. Set noise strength for specific pixel component or all pixel components in case
  8827. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8828. @item all_flags, allf
  8829. @item c0_flags, c0f
  8830. @item c1_flags, c1f
  8831. @item c2_flags, c2f
  8832. @item c3_flags, c3f
  8833. Set pixel component flags or set flags for all components if @var{all_flags}.
  8834. Available values for component flags are:
  8835. @table @samp
  8836. @item a
  8837. averaged temporal noise (smoother)
  8838. @item p
  8839. mix random noise with a (semi)regular pattern
  8840. @item t
  8841. temporal noise (noise pattern changes between frames)
  8842. @item u
  8843. uniform noise (gaussian otherwise)
  8844. @end table
  8845. @end table
  8846. @subsection Examples
  8847. Add temporal and uniform noise to input video:
  8848. @example
  8849. noise=alls=20:allf=t+u
  8850. @end example
  8851. @section normalize
  8852. Normalize RGB video (aka histogram stretching, contrast stretching).
  8853. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8854. For each channel of each frame, the filter computes the input range and maps
  8855. it linearly to the user-specified output range. The output range defaults
  8856. to the full dynamic range from pure black to pure white.
  8857. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8858. changes in brightness) caused when small dark or bright objects enter or leave
  8859. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8860. video camera, and, like a video camera, it may cause a period of over- or
  8861. under-exposure of the video.
  8862. The R,G,B channels can be normalized independently, which may cause some
  8863. color shifting, or linked together as a single channel, which prevents
  8864. color shifting. Linked normalization preserves hue. Independent normalization
  8865. does not, so it can be used to remove some color casts. Independent and linked
  8866. normalization can be combined in any ratio.
  8867. The normalize filter accepts the following options:
  8868. @table @option
  8869. @item blackpt
  8870. @item whitept
  8871. Colors which define the output range. The minimum input value is mapped to
  8872. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8873. The defaults are black and white respectively. Specifying white for
  8874. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8875. normalized video. Shades of grey can be used to reduce the dynamic range
  8876. (contrast). Specifying saturated colors here can create some interesting
  8877. effects.
  8878. @item smoothing
  8879. The number of previous frames to use for temporal smoothing. The input range
  8880. of each channel is smoothed using a rolling average over the current frame
  8881. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8882. smoothing).
  8883. @item independence
  8884. Controls the ratio of independent (color shifting) channel normalization to
  8885. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8886. independent. Defaults to 1.0 (fully independent).
  8887. @item strength
  8888. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8889. expensive no-op. Defaults to 1.0 (full strength).
  8890. @end table
  8891. @subsection Examples
  8892. Stretch video contrast to use the full dynamic range, with no temporal
  8893. smoothing; may flicker depending on the source content:
  8894. @example
  8895. normalize=blackpt=black:whitept=white:smoothing=0
  8896. @end example
  8897. As above, but with 50 frames of temporal smoothing; flicker should be
  8898. reduced, depending on the source content:
  8899. @example
  8900. normalize=blackpt=black:whitept=white:smoothing=50
  8901. @end example
  8902. As above, but with hue-preserving linked channel normalization:
  8903. @example
  8904. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8905. @end example
  8906. As above, but with half strength:
  8907. @example
  8908. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8909. @end example
  8910. Map the darkest input color to red, the brightest input color to cyan:
  8911. @example
  8912. normalize=blackpt=red:whitept=cyan
  8913. @end example
  8914. @section null
  8915. Pass the video source unchanged to the output.
  8916. @section ocr
  8917. Optical Character Recognition
  8918. This filter uses Tesseract for optical character recognition.
  8919. It accepts the following options:
  8920. @table @option
  8921. @item datapath
  8922. Set datapath to tesseract data. Default is to use whatever was
  8923. set at installation.
  8924. @item language
  8925. Set language, default is "eng".
  8926. @item whitelist
  8927. Set character whitelist.
  8928. @item blacklist
  8929. Set character blacklist.
  8930. @end table
  8931. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8932. @section ocv
  8933. Apply a video transform using libopencv.
  8934. To enable this filter, install the libopencv library and headers and
  8935. configure FFmpeg with @code{--enable-libopencv}.
  8936. It accepts the following parameters:
  8937. @table @option
  8938. @item filter_name
  8939. The name of the libopencv filter to apply.
  8940. @item filter_params
  8941. The parameters to pass to the libopencv filter. If not specified, the default
  8942. values are assumed.
  8943. @end table
  8944. Refer to the official libopencv documentation for more precise
  8945. information:
  8946. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8947. Several libopencv filters are supported; see the following subsections.
  8948. @anchor{dilate}
  8949. @subsection dilate
  8950. Dilate an image by using a specific structuring element.
  8951. It corresponds to the libopencv function @code{cvDilate}.
  8952. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8953. @var{struct_el} represents a structuring element, and has the syntax:
  8954. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8955. @var{cols} and @var{rows} represent the number of columns and rows of
  8956. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8957. point, and @var{shape} the shape for the structuring element. @var{shape}
  8958. must be "rect", "cross", "ellipse", or "custom".
  8959. If the value for @var{shape} is "custom", it must be followed by a
  8960. string of the form "=@var{filename}". The file with name
  8961. @var{filename} is assumed to represent a binary image, with each
  8962. printable character corresponding to a bright pixel. When a custom
  8963. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8964. or columns and rows of the read file are assumed instead.
  8965. The default value for @var{struct_el} is "3x3+0x0/rect".
  8966. @var{nb_iterations} specifies the number of times the transform is
  8967. applied to the image, and defaults to 1.
  8968. Some examples:
  8969. @example
  8970. # Use the default values
  8971. ocv=dilate
  8972. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8973. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8974. # Read the shape from the file diamond.shape, iterating two times.
  8975. # The file diamond.shape may contain a pattern of characters like this
  8976. # *
  8977. # ***
  8978. # *****
  8979. # ***
  8980. # *
  8981. # The specified columns and rows are ignored
  8982. # but the anchor point coordinates are not
  8983. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8984. @end example
  8985. @subsection erode
  8986. Erode an image by using a specific structuring element.
  8987. It corresponds to the libopencv function @code{cvErode}.
  8988. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8989. with the same syntax and semantics as the @ref{dilate} filter.
  8990. @subsection smooth
  8991. Smooth the input video.
  8992. The filter takes the following parameters:
  8993. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8994. @var{type} is the type of smooth filter to apply, and must be one of
  8995. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8996. or "bilateral". The default value is "gaussian".
  8997. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8998. depend on the smooth type. @var{param1} and
  8999. @var{param2} accept integer positive values or 0. @var{param3} and
  9000. @var{param4} accept floating point values.
  9001. The default value for @var{param1} is 3. The default value for the
  9002. other parameters is 0.
  9003. These parameters correspond to the parameters assigned to the
  9004. libopencv function @code{cvSmooth}.
  9005. @section oscilloscope
  9006. 2D Video Oscilloscope.
  9007. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9008. It accepts the following parameters:
  9009. @table @option
  9010. @item x
  9011. Set scope center x position.
  9012. @item y
  9013. Set scope center y position.
  9014. @item s
  9015. Set scope size, relative to frame diagonal.
  9016. @item t
  9017. Set scope tilt/rotation.
  9018. @item o
  9019. Set trace opacity.
  9020. @item tx
  9021. Set trace center x position.
  9022. @item ty
  9023. Set trace center y position.
  9024. @item tw
  9025. Set trace width, relative to width of frame.
  9026. @item th
  9027. Set trace height, relative to height of frame.
  9028. @item c
  9029. Set which components to trace. By default it traces first three components.
  9030. @item g
  9031. Draw trace grid. By default is enabled.
  9032. @item st
  9033. Draw some statistics. By default is enabled.
  9034. @item sc
  9035. Draw scope. By default is enabled.
  9036. @end table
  9037. @subsection Examples
  9038. @itemize
  9039. @item
  9040. Inspect full first row of video frame.
  9041. @example
  9042. oscilloscope=x=0.5:y=0:s=1
  9043. @end example
  9044. @item
  9045. Inspect full last row of video frame.
  9046. @example
  9047. oscilloscope=x=0.5:y=1:s=1
  9048. @end example
  9049. @item
  9050. Inspect full 5th line of video frame of height 1080.
  9051. @example
  9052. oscilloscope=x=0.5:y=5/1080:s=1
  9053. @end example
  9054. @item
  9055. Inspect full last column of video frame.
  9056. @example
  9057. oscilloscope=x=1:y=0.5:s=1:t=1
  9058. @end example
  9059. @end itemize
  9060. @anchor{overlay}
  9061. @section overlay
  9062. Overlay one video on top of another.
  9063. It takes two inputs and has one output. The first input is the "main"
  9064. video on which the second input is overlaid.
  9065. It accepts the following parameters:
  9066. A description of the accepted options follows.
  9067. @table @option
  9068. @item x
  9069. @item y
  9070. Set the expression for the x and y coordinates of the overlaid video
  9071. on the main video. Default value is "0" for both expressions. In case
  9072. the expression is invalid, it is set to a huge value (meaning that the
  9073. overlay will not be displayed within the output visible area).
  9074. @item eof_action
  9075. See @ref{framesync}.
  9076. @item eval
  9077. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9078. It accepts the following values:
  9079. @table @samp
  9080. @item init
  9081. only evaluate expressions once during the filter initialization or
  9082. when a command is processed
  9083. @item frame
  9084. evaluate expressions for each incoming frame
  9085. @end table
  9086. Default value is @samp{frame}.
  9087. @item shortest
  9088. See @ref{framesync}.
  9089. @item format
  9090. Set the format for the output video.
  9091. It accepts the following values:
  9092. @table @samp
  9093. @item yuv420
  9094. force YUV420 output
  9095. @item yuv422
  9096. force YUV422 output
  9097. @item yuv444
  9098. force YUV444 output
  9099. @item rgb
  9100. force packed RGB output
  9101. @item gbrp
  9102. force planar RGB output
  9103. @item auto
  9104. automatically pick format
  9105. @end table
  9106. Default value is @samp{yuv420}.
  9107. @item repeatlast
  9108. See @ref{framesync}.
  9109. @item alpha
  9110. Set format of alpha of the overlaid video, it can be @var{straight} or
  9111. @var{premultiplied}. Default is @var{straight}.
  9112. @end table
  9113. The @option{x}, and @option{y} expressions can contain the following
  9114. parameters.
  9115. @table @option
  9116. @item main_w, W
  9117. @item main_h, H
  9118. The main input width and height.
  9119. @item overlay_w, w
  9120. @item overlay_h, h
  9121. The overlay input width and height.
  9122. @item x
  9123. @item y
  9124. The computed values for @var{x} and @var{y}. They are evaluated for
  9125. each new frame.
  9126. @item hsub
  9127. @item vsub
  9128. horizontal and vertical chroma subsample values of the output
  9129. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9130. @var{vsub} is 1.
  9131. @item n
  9132. the number of input frame, starting from 0
  9133. @item pos
  9134. the position in the file of the input frame, NAN if unknown
  9135. @item t
  9136. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9137. @end table
  9138. This filter also supports the @ref{framesync} options.
  9139. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9140. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9141. when @option{eval} is set to @samp{init}.
  9142. Be aware that frames are taken from each input video in timestamp
  9143. order, hence, if their initial timestamps differ, it is a good idea
  9144. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9145. have them begin in the same zero timestamp, as the example for
  9146. the @var{movie} filter does.
  9147. You can chain together more overlays but you should test the
  9148. efficiency of such approach.
  9149. @subsection Commands
  9150. This filter supports the following commands:
  9151. @table @option
  9152. @item x
  9153. @item y
  9154. Modify the x and y of the overlay input.
  9155. The command accepts the same syntax of the corresponding option.
  9156. If the specified expression is not valid, it is kept at its current
  9157. value.
  9158. @end table
  9159. @subsection Examples
  9160. @itemize
  9161. @item
  9162. Draw the overlay at 10 pixels from the bottom right corner of the main
  9163. video:
  9164. @example
  9165. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9166. @end example
  9167. Using named options the example above becomes:
  9168. @example
  9169. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9170. @end example
  9171. @item
  9172. Insert a transparent PNG logo in the bottom left corner of the input,
  9173. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9174. @example
  9175. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9176. @end example
  9177. @item
  9178. Insert 2 different transparent PNG logos (second logo on bottom
  9179. right corner) using the @command{ffmpeg} tool:
  9180. @example
  9181. 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
  9182. @end example
  9183. @item
  9184. Add a transparent color layer on top of the main video; @code{WxH}
  9185. must specify the size of the main input to the overlay filter:
  9186. @example
  9187. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9188. @end example
  9189. @item
  9190. Play an original video and a filtered version (here with the deshake
  9191. filter) side by side using the @command{ffplay} tool:
  9192. @example
  9193. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9194. @end example
  9195. The above command is the same as:
  9196. @example
  9197. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9198. @end example
  9199. @item
  9200. Make a sliding overlay appearing from the left to the right top part of the
  9201. screen starting since time 2:
  9202. @example
  9203. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9204. @end example
  9205. @item
  9206. Compose output by putting two input videos side to side:
  9207. @example
  9208. ffmpeg -i left.avi -i right.avi -filter_complex "
  9209. nullsrc=size=200x100 [background];
  9210. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9211. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9212. [background][left] overlay=shortest=1 [background+left];
  9213. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9214. "
  9215. @end example
  9216. @item
  9217. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9218. @example
  9219. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9220. -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]'
  9221. masked.avi
  9222. @end example
  9223. @item
  9224. Chain several overlays in cascade:
  9225. @example
  9226. nullsrc=s=200x200 [bg];
  9227. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9228. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9229. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9230. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9231. [in3] null, [mid2] overlay=100:100 [out0]
  9232. @end example
  9233. @end itemize
  9234. @section owdenoise
  9235. Apply Overcomplete Wavelet denoiser.
  9236. The filter accepts the following options:
  9237. @table @option
  9238. @item depth
  9239. Set depth.
  9240. Larger depth values will denoise lower frequency components more, but
  9241. slow down filtering.
  9242. Must be an int in the range 8-16, default is @code{8}.
  9243. @item luma_strength, ls
  9244. Set luma strength.
  9245. Must be a double value in the range 0-1000, default is @code{1.0}.
  9246. @item chroma_strength, cs
  9247. Set chroma strength.
  9248. Must be a double value in the range 0-1000, default is @code{1.0}.
  9249. @end table
  9250. @anchor{pad}
  9251. @section pad
  9252. Add paddings to the input image, and place the original input at the
  9253. provided @var{x}, @var{y} coordinates.
  9254. It accepts the following parameters:
  9255. @table @option
  9256. @item width, w
  9257. @item height, h
  9258. Specify an expression for the size of the output image with the
  9259. paddings added. If the value for @var{width} or @var{height} is 0, the
  9260. corresponding input size is used for the output.
  9261. The @var{width} expression can reference the value set by the
  9262. @var{height} expression, and vice versa.
  9263. The default value of @var{width} and @var{height} is 0.
  9264. @item x
  9265. @item y
  9266. Specify the offsets to place the input image at within the padded area,
  9267. with respect to the top/left border of the output image.
  9268. The @var{x} expression can reference the value set by the @var{y}
  9269. expression, and vice versa.
  9270. The default value of @var{x} and @var{y} is 0.
  9271. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9272. so the input image is centered on the padded area.
  9273. @item color
  9274. Specify the color of the padded area. For the syntax of this option,
  9275. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9276. manual,ffmpeg-utils}.
  9277. The default value of @var{color} is "black".
  9278. @item eval
  9279. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9280. It accepts the following values:
  9281. @table @samp
  9282. @item init
  9283. Only evaluate expressions once during the filter initialization or when
  9284. a command is processed.
  9285. @item frame
  9286. Evaluate expressions for each incoming frame.
  9287. @end table
  9288. Default value is @samp{init}.
  9289. @item aspect
  9290. Pad to aspect instead to a resolution.
  9291. @end table
  9292. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9293. options are expressions containing the following constants:
  9294. @table @option
  9295. @item in_w
  9296. @item in_h
  9297. The input video width and height.
  9298. @item iw
  9299. @item ih
  9300. These are the same as @var{in_w} and @var{in_h}.
  9301. @item out_w
  9302. @item out_h
  9303. The output width and height (the size of the padded area), as
  9304. specified by the @var{width} and @var{height} expressions.
  9305. @item ow
  9306. @item oh
  9307. These are the same as @var{out_w} and @var{out_h}.
  9308. @item x
  9309. @item y
  9310. The x and y offsets as specified by the @var{x} and @var{y}
  9311. expressions, or NAN if not yet specified.
  9312. @item a
  9313. same as @var{iw} / @var{ih}
  9314. @item sar
  9315. input sample aspect ratio
  9316. @item dar
  9317. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9318. @item hsub
  9319. @item vsub
  9320. The horizontal and vertical chroma subsample values. For example for the
  9321. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9322. @end table
  9323. @subsection Examples
  9324. @itemize
  9325. @item
  9326. Add paddings with the color "violet" to the input video. The output video
  9327. size is 640x480, and the top-left corner of the input video is placed at
  9328. column 0, row 40
  9329. @example
  9330. pad=640:480:0:40:violet
  9331. @end example
  9332. The example above is equivalent to the following command:
  9333. @example
  9334. pad=width=640:height=480:x=0:y=40:color=violet
  9335. @end example
  9336. @item
  9337. Pad the input to get an output with dimensions increased by 3/2,
  9338. and put the input video at the center of the padded area:
  9339. @example
  9340. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9341. @end example
  9342. @item
  9343. Pad the input to get a squared output with size equal to the maximum
  9344. value between the input width and height, and put the input video at
  9345. the center of the padded area:
  9346. @example
  9347. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9348. @end example
  9349. @item
  9350. Pad the input to get a final w/h ratio of 16:9:
  9351. @example
  9352. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9353. @end example
  9354. @item
  9355. In case of anamorphic video, in order to set the output display aspect
  9356. correctly, it is necessary to use @var{sar} in the expression,
  9357. according to the relation:
  9358. @example
  9359. (ih * X / ih) * sar = output_dar
  9360. X = output_dar / sar
  9361. @end example
  9362. Thus the previous example needs to be modified to:
  9363. @example
  9364. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9365. @end example
  9366. @item
  9367. Double the output size and put the input video in the bottom-right
  9368. corner of the output padded area:
  9369. @example
  9370. pad="2*iw:2*ih:ow-iw:oh-ih"
  9371. @end example
  9372. @end itemize
  9373. @anchor{palettegen}
  9374. @section palettegen
  9375. Generate one palette for a whole video stream.
  9376. It accepts the following options:
  9377. @table @option
  9378. @item max_colors
  9379. Set the maximum number of colors to quantize in the palette.
  9380. Note: the palette will still contain 256 colors; the unused palette entries
  9381. will be black.
  9382. @item reserve_transparent
  9383. Create a palette of 255 colors maximum and reserve the last one for
  9384. transparency. Reserving the transparency color is useful for GIF optimization.
  9385. If not set, the maximum of colors in the palette will be 256. You probably want
  9386. to disable this option for a standalone image.
  9387. Set by default.
  9388. @item transparency_color
  9389. Set the color that will be used as background for transparency.
  9390. @item stats_mode
  9391. Set statistics mode.
  9392. It accepts the following values:
  9393. @table @samp
  9394. @item full
  9395. Compute full frame histograms.
  9396. @item diff
  9397. Compute histograms only for the part that differs from previous frame. This
  9398. might be relevant to give more importance to the moving part of your input if
  9399. the background is static.
  9400. @item single
  9401. Compute new histogram for each frame.
  9402. @end table
  9403. Default value is @var{full}.
  9404. @end table
  9405. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9406. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9407. color quantization of the palette. This information is also visible at
  9408. @var{info} logging level.
  9409. @subsection Examples
  9410. @itemize
  9411. @item
  9412. Generate a representative palette of a given video using @command{ffmpeg}:
  9413. @example
  9414. ffmpeg -i input.mkv -vf palettegen palette.png
  9415. @end example
  9416. @end itemize
  9417. @section paletteuse
  9418. Use a palette to downsample an input video stream.
  9419. The filter takes two inputs: one video stream and a palette. The palette must
  9420. be a 256 pixels image.
  9421. It accepts the following options:
  9422. @table @option
  9423. @item dither
  9424. Select dithering mode. Available algorithms are:
  9425. @table @samp
  9426. @item bayer
  9427. Ordered 8x8 bayer dithering (deterministic)
  9428. @item heckbert
  9429. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9430. Note: this dithering is sometimes considered "wrong" and is included as a
  9431. reference.
  9432. @item floyd_steinberg
  9433. Floyd and Steingberg dithering (error diffusion)
  9434. @item sierra2
  9435. Frankie Sierra dithering v2 (error diffusion)
  9436. @item sierra2_4a
  9437. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9438. @end table
  9439. Default is @var{sierra2_4a}.
  9440. @item bayer_scale
  9441. When @var{bayer} dithering is selected, this option defines the scale of the
  9442. pattern (how much the crosshatch pattern is visible). A low value means more
  9443. visible pattern for less banding, and higher value means less visible pattern
  9444. at the cost of more banding.
  9445. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9446. @item diff_mode
  9447. If set, define the zone to process
  9448. @table @samp
  9449. @item rectangle
  9450. Only the changing rectangle will be reprocessed. This is similar to GIF
  9451. cropping/offsetting compression mechanism. This option can be useful for speed
  9452. if only a part of the image is changing, and has use cases such as limiting the
  9453. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9454. moving scene (it leads to more deterministic output if the scene doesn't change
  9455. much, and as a result less moving noise and better GIF compression).
  9456. @end table
  9457. Default is @var{none}.
  9458. @item new
  9459. Take new palette for each output frame.
  9460. @item alpha_threshold
  9461. Sets the alpha threshold for transparency. Alpha values above this threshold
  9462. will be treated as completely opaque, and values below this threshold will be
  9463. treated as completely transparent.
  9464. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9465. @end table
  9466. @subsection Examples
  9467. @itemize
  9468. @item
  9469. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9470. using @command{ffmpeg}:
  9471. @example
  9472. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9473. @end example
  9474. @end itemize
  9475. @section perspective
  9476. Correct perspective of video not recorded perpendicular to the screen.
  9477. A description of the accepted parameters follows.
  9478. @table @option
  9479. @item x0
  9480. @item y0
  9481. @item x1
  9482. @item y1
  9483. @item x2
  9484. @item y2
  9485. @item x3
  9486. @item y3
  9487. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9488. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9489. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9490. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9491. then the corners of the source will be sent to the specified coordinates.
  9492. The expressions can use the following variables:
  9493. @table @option
  9494. @item W
  9495. @item H
  9496. the width and height of video frame.
  9497. @item in
  9498. Input frame count.
  9499. @item on
  9500. Output frame count.
  9501. @end table
  9502. @item interpolation
  9503. Set interpolation for perspective correction.
  9504. It accepts the following values:
  9505. @table @samp
  9506. @item linear
  9507. @item cubic
  9508. @end table
  9509. Default value is @samp{linear}.
  9510. @item sense
  9511. Set interpretation of coordinate options.
  9512. It accepts the following values:
  9513. @table @samp
  9514. @item 0, source
  9515. Send point in the source specified by the given coordinates to
  9516. the corners of the destination.
  9517. @item 1, destination
  9518. Send the corners of the source to the point in the destination specified
  9519. by the given coordinates.
  9520. Default value is @samp{source}.
  9521. @end table
  9522. @item eval
  9523. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9524. It accepts the following values:
  9525. @table @samp
  9526. @item init
  9527. only evaluate expressions once during the filter initialization or
  9528. when a command is processed
  9529. @item frame
  9530. evaluate expressions for each incoming frame
  9531. @end table
  9532. Default value is @samp{init}.
  9533. @end table
  9534. @section phase
  9535. Delay interlaced video by one field time so that the field order changes.
  9536. The intended use is to fix PAL movies that have been captured with the
  9537. opposite field order to the film-to-video transfer.
  9538. A description of the accepted parameters follows.
  9539. @table @option
  9540. @item mode
  9541. Set phase mode.
  9542. It accepts the following values:
  9543. @table @samp
  9544. @item t
  9545. Capture field order top-first, transfer bottom-first.
  9546. Filter will delay the bottom field.
  9547. @item b
  9548. Capture field order bottom-first, transfer top-first.
  9549. Filter will delay the top field.
  9550. @item p
  9551. Capture and transfer with the same field order. This mode only exists
  9552. for the documentation of the other options to refer to, but if you
  9553. actually select it, the filter will faithfully do nothing.
  9554. @item a
  9555. Capture field order determined automatically by field flags, transfer
  9556. opposite.
  9557. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9558. basis using field flags. If no field information is available,
  9559. then this works just like @samp{u}.
  9560. @item u
  9561. Capture unknown or varying, transfer opposite.
  9562. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9563. analyzing the images and selecting the alternative that produces best
  9564. match between the fields.
  9565. @item T
  9566. Capture top-first, transfer unknown or varying.
  9567. Filter selects among @samp{t} and @samp{p} using image analysis.
  9568. @item B
  9569. Capture bottom-first, transfer unknown or varying.
  9570. Filter selects among @samp{b} and @samp{p} using image analysis.
  9571. @item A
  9572. Capture determined by field flags, transfer unknown or varying.
  9573. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9574. image analysis. If no field information is available, then this works just
  9575. like @samp{U}. This is the default mode.
  9576. @item U
  9577. Both capture and transfer unknown or varying.
  9578. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9579. @end table
  9580. @end table
  9581. @section pixdesctest
  9582. Pixel format descriptor test filter, mainly useful for internal
  9583. testing. The output video should be equal to the input video.
  9584. For example:
  9585. @example
  9586. format=monow, pixdesctest
  9587. @end example
  9588. can be used to test the monowhite pixel format descriptor definition.
  9589. @section pixscope
  9590. Display sample values of color channels. Mainly useful for checking color
  9591. and levels. Minimum supported resolution is 640x480.
  9592. The filters accept the following options:
  9593. @table @option
  9594. @item x
  9595. Set scope X position, relative offset on X axis.
  9596. @item y
  9597. Set scope Y position, relative offset on Y axis.
  9598. @item w
  9599. Set scope width.
  9600. @item h
  9601. Set scope height.
  9602. @item o
  9603. Set window opacity. This window also holds statistics about pixel area.
  9604. @item wx
  9605. Set window X position, relative offset on X axis.
  9606. @item wy
  9607. Set window Y position, relative offset on Y axis.
  9608. @end table
  9609. @section pp
  9610. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9611. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9612. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9613. Each subfilter and some options have a short and a long name that can be used
  9614. interchangeably, i.e. dr/dering are the same.
  9615. The filters accept the following options:
  9616. @table @option
  9617. @item subfilters
  9618. Set postprocessing subfilters string.
  9619. @end table
  9620. All subfilters share common options to determine their scope:
  9621. @table @option
  9622. @item a/autoq
  9623. Honor the quality commands for this subfilter.
  9624. @item c/chrom
  9625. Do chrominance filtering, too (default).
  9626. @item y/nochrom
  9627. Do luminance filtering only (no chrominance).
  9628. @item n/noluma
  9629. Do chrominance filtering only (no luminance).
  9630. @end table
  9631. These options can be appended after the subfilter name, separated by a '|'.
  9632. Available subfilters are:
  9633. @table @option
  9634. @item hb/hdeblock[|difference[|flatness]]
  9635. Horizontal deblocking filter
  9636. @table @option
  9637. @item difference
  9638. Difference factor where higher values mean more deblocking (default: @code{32}).
  9639. @item flatness
  9640. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9641. @end table
  9642. @item vb/vdeblock[|difference[|flatness]]
  9643. Vertical deblocking filter
  9644. @table @option
  9645. @item difference
  9646. Difference factor where higher values mean more deblocking (default: @code{32}).
  9647. @item flatness
  9648. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9649. @end table
  9650. @item ha/hadeblock[|difference[|flatness]]
  9651. Accurate 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 va/vadeblock[|difference[|flatness]]
  9659. Accurate 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. @end table
  9667. The horizontal and vertical deblocking filters share the difference and
  9668. flatness values so you cannot set different horizontal and vertical
  9669. thresholds.
  9670. @table @option
  9671. @item h1/x1hdeblock
  9672. Experimental horizontal deblocking filter
  9673. @item v1/x1vdeblock
  9674. Experimental vertical deblocking filter
  9675. @item dr/dering
  9676. Deringing filter
  9677. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9678. @table @option
  9679. @item threshold1
  9680. larger -> stronger filtering
  9681. @item threshold2
  9682. larger -> stronger filtering
  9683. @item threshold3
  9684. larger -> stronger filtering
  9685. @end table
  9686. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9687. @table @option
  9688. @item f/fullyrange
  9689. Stretch luminance to @code{0-255}.
  9690. @end table
  9691. @item lb/linblenddeint
  9692. Linear blend deinterlacing filter that deinterlaces the given block by
  9693. filtering all lines with a @code{(1 2 1)} filter.
  9694. @item li/linipoldeint
  9695. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9696. linearly interpolating every second line.
  9697. @item ci/cubicipoldeint
  9698. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9699. cubically interpolating every second line.
  9700. @item md/mediandeint
  9701. Median deinterlacing filter that deinterlaces the given block by applying a
  9702. median filter to every second line.
  9703. @item fd/ffmpegdeint
  9704. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9705. second line with a @code{(-1 4 2 4 -1)} filter.
  9706. @item l5/lowpass5
  9707. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9708. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9709. @item fq/forceQuant[|quantizer]
  9710. Overrides the quantizer table from the input with the constant quantizer you
  9711. specify.
  9712. @table @option
  9713. @item quantizer
  9714. Quantizer to use
  9715. @end table
  9716. @item de/default
  9717. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9718. @item fa/fast
  9719. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9720. @item ac
  9721. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9722. @end table
  9723. @subsection Examples
  9724. @itemize
  9725. @item
  9726. Apply horizontal and vertical deblocking, deringing and automatic
  9727. brightness/contrast:
  9728. @example
  9729. pp=hb/vb/dr/al
  9730. @end example
  9731. @item
  9732. Apply default filters without brightness/contrast correction:
  9733. @example
  9734. pp=de/-al
  9735. @end example
  9736. @item
  9737. Apply default filters and temporal denoiser:
  9738. @example
  9739. pp=default/tmpnoise|1|2|3
  9740. @end example
  9741. @item
  9742. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9743. automatically depending on available CPU time:
  9744. @example
  9745. pp=hb|y/vb|a
  9746. @end example
  9747. @end itemize
  9748. @section pp7
  9749. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9750. similar to spp = 6 with 7 point DCT, where only the center sample is
  9751. used after IDCT.
  9752. The filter accepts the following options:
  9753. @table @option
  9754. @item qp
  9755. Force a constant quantization parameter. It accepts an integer in range
  9756. 0 to 63. If not set, the filter will use the QP from the video stream
  9757. (if available).
  9758. @item mode
  9759. Set thresholding mode. Available modes are:
  9760. @table @samp
  9761. @item hard
  9762. Set hard thresholding.
  9763. @item soft
  9764. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9765. @item medium
  9766. Set medium thresholding (good results, default).
  9767. @end table
  9768. @end table
  9769. @section premultiply
  9770. Apply alpha premultiply effect to input video stream using first plane
  9771. of second stream as alpha.
  9772. Both streams must have same dimensions and same pixel format.
  9773. The filter accepts the following option:
  9774. @table @option
  9775. @item planes
  9776. Set which planes will be processed, unprocessed planes will be copied.
  9777. By default value 0xf, all planes will be processed.
  9778. @item inplace
  9779. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9780. @end table
  9781. @section prewitt
  9782. Apply prewitt operator to input video stream.
  9783. The filter accepts the following option:
  9784. @table @option
  9785. @item planes
  9786. Set which planes will be processed, unprocessed planes will be copied.
  9787. By default value 0xf, all planes will be processed.
  9788. @item scale
  9789. Set value which will be multiplied with filtered result.
  9790. @item delta
  9791. Set value which will be added to filtered result.
  9792. @end table
  9793. @anchor{program_opencl}
  9794. @section program_opencl
  9795. Filter video using an OpenCL program.
  9796. @table @option
  9797. @item source
  9798. OpenCL program source file.
  9799. @item kernel
  9800. Kernel name in program.
  9801. @item inputs
  9802. Number of inputs to the filter. Defaults to 1.
  9803. @item size, s
  9804. Size of output frames. Defaults to the same as the first input.
  9805. @end table
  9806. The program source file must contain a kernel function with the given name,
  9807. which will be run once for each plane of the output. Each run on a plane
  9808. gets enqueued as a separate 2D global NDRange with one work-item for each
  9809. pixel to be generated. The global ID offset for each work-item is therefore
  9810. the coordinates of a pixel in the destination image.
  9811. The kernel function needs to take the following arguments:
  9812. @itemize
  9813. @item
  9814. Destination image, @var{__write_only image2d_t}.
  9815. This image will become the output; the kernel should write all of it.
  9816. @item
  9817. Frame index, @var{unsigned int}.
  9818. This is a counter starting from zero and increasing by one for each frame.
  9819. @item
  9820. Source images, @var{__read_only image2d_t}.
  9821. These are the most recent images on each input. The kernel may read from
  9822. them to generate the output, but they can't be written to.
  9823. @end itemize
  9824. Example programs:
  9825. @itemize
  9826. @item
  9827. Copy the input to the output (output must be the same size as the input).
  9828. @verbatim
  9829. __kernel void copy(__write_only image2d_t destination,
  9830. unsigned int index,
  9831. __read_only image2d_t source)
  9832. {
  9833. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9834. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9835. float4 value = read_imagef(source, sampler, location);
  9836. write_imagef(destination, location, value);
  9837. }
  9838. @end verbatim
  9839. @item
  9840. Apply a simple transformation, rotating the input by an amount increasing
  9841. with the index counter. Pixel values are linearly interpolated by the
  9842. sampler, and the output need not have the same dimensions as the input.
  9843. @verbatim
  9844. __kernel void rotate_image(__write_only image2d_t dst,
  9845. unsigned int index,
  9846. __read_only image2d_t src)
  9847. {
  9848. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9849. CLK_FILTER_LINEAR);
  9850. float angle = (float)index / 100.0f;
  9851. float2 dst_dim = convert_float2(get_image_dim(dst));
  9852. float2 src_dim = convert_float2(get_image_dim(src));
  9853. float2 dst_cen = dst_dim / 2.0f;
  9854. float2 src_cen = src_dim / 2.0f;
  9855. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9856. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9857. float2 src_pos = {
  9858. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9859. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9860. };
  9861. src_pos = src_pos * src_dim / dst_dim;
  9862. float2 src_loc = src_pos + src_cen;
  9863. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9864. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9865. write_imagef(dst, dst_loc, 0.5f);
  9866. else
  9867. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9868. }
  9869. @end verbatim
  9870. @item
  9871. Blend two inputs together, with the amount of each input used varying
  9872. with the index counter.
  9873. @verbatim
  9874. __kernel void blend_images(__write_only image2d_t dst,
  9875. unsigned int index,
  9876. __read_only image2d_t src1,
  9877. __read_only image2d_t src2)
  9878. {
  9879. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9880. CLK_FILTER_LINEAR);
  9881. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9882. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9883. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9884. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9885. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9886. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9887. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9888. }
  9889. @end verbatim
  9890. @end itemize
  9891. @section pseudocolor
  9892. Alter frame colors in video with pseudocolors.
  9893. This filter accept the following options:
  9894. @table @option
  9895. @item c0
  9896. set pixel first component expression
  9897. @item c1
  9898. set pixel second component expression
  9899. @item c2
  9900. set pixel third component expression
  9901. @item c3
  9902. set pixel fourth component expression, corresponds to the alpha component
  9903. @item i
  9904. set component to use as base for altering colors
  9905. @end table
  9906. Each of them specifies the expression to use for computing the lookup table for
  9907. the corresponding pixel component values.
  9908. The expressions can contain the following constants and functions:
  9909. @table @option
  9910. @item w
  9911. @item h
  9912. The input width and height.
  9913. @item val
  9914. The input value for the pixel component.
  9915. @item ymin, umin, vmin, amin
  9916. The minimum allowed component value.
  9917. @item ymax, umax, vmax, amax
  9918. The maximum allowed component value.
  9919. @end table
  9920. All expressions default to "val".
  9921. @subsection Examples
  9922. @itemize
  9923. @item
  9924. Change too high luma values to gradient:
  9925. @example
  9926. 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'"
  9927. @end example
  9928. @end itemize
  9929. @section psnr
  9930. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9931. Ratio) between two input videos.
  9932. This filter takes in input two input videos, the first input is
  9933. considered the "main" source and is passed unchanged to the
  9934. output. The second input is used as a "reference" video for computing
  9935. the PSNR.
  9936. Both video inputs must have the same resolution and pixel format for
  9937. this filter to work correctly. Also it assumes that both inputs
  9938. have the same number of frames, which are compared one by one.
  9939. The obtained average PSNR is printed through the logging system.
  9940. The filter stores the accumulated MSE (mean squared error) of each
  9941. frame, and at the end of the processing it is averaged across all frames
  9942. equally, and the following formula is applied to obtain the PSNR:
  9943. @example
  9944. PSNR = 10*log10(MAX^2/MSE)
  9945. @end example
  9946. Where MAX is the average of the maximum values of each component of the
  9947. image.
  9948. The description of the accepted parameters follows.
  9949. @table @option
  9950. @item stats_file, f
  9951. If specified the filter will use the named file to save the PSNR of
  9952. each individual frame. When filename equals "-" the data is sent to
  9953. standard output.
  9954. @item stats_version
  9955. Specifies which version of the stats file format to use. Details of
  9956. each format are written below.
  9957. Default value is 1.
  9958. @item stats_add_max
  9959. Determines whether the max value is output to the stats log.
  9960. Default value is 0.
  9961. Requires stats_version >= 2. If this is set and stats_version < 2,
  9962. the filter will return an error.
  9963. @end table
  9964. This filter also supports the @ref{framesync} options.
  9965. The file printed if @var{stats_file} is selected, contains a sequence of
  9966. key/value pairs of the form @var{key}:@var{value} for each compared
  9967. couple of frames.
  9968. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9969. the list of per-frame-pair stats, with key value pairs following the frame
  9970. format with the following parameters:
  9971. @table @option
  9972. @item psnr_log_version
  9973. The version of the log file format. Will match @var{stats_version}.
  9974. @item fields
  9975. A comma separated list of the per-frame-pair parameters included in
  9976. the log.
  9977. @end table
  9978. A description of each shown per-frame-pair parameter follows:
  9979. @table @option
  9980. @item n
  9981. sequential number of the input frame, starting from 1
  9982. @item mse_avg
  9983. Mean Square Error pixel-by-pixel average difference of the compared
  9984. frames, averaged over all the image components.
  9985. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9986. Mean Square Error pixel-by-pixel average difference of the compared
  9987. frames for the component specified by the suffix.
  9988. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9989. Peak Signal to Noise ratio of the compared frames for the component
  9990. specified by the suffix.
  9991. @item max_avg, max_y, max_u, max_v
  9992. Maximum allowed value for each channel, and average over all
  9993. channels.
  9994. @end table
  9995. For example:
  9996. @example
  9997. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9998. [main][ref] psnr="stats_file=stats.log" [out]
  9999. @end example
  10000. On this example the input file being processed is compared with the
  10001. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10002. is stored in @file{stats.log}.
  10003. @anchor{pullup}
  10004. @section pullup
  10005. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10006. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10007. content.
  10008. The pullup filter is designed to take advantage of future context in making
  10009. its decisions. This filter is stateless in the sense that it does not lock
  10010. onto a pattern to follow, but it instead looks forward to the following
  10011. fields in order to identify matches and rebuild progressive frames.
  10012. To produce content with an even framerate, insert the fps filter after
  10013. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10014. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10015. The filter accepts the following options:
  10016. @table @option
  10017. @item jl
  10018. @item jr
  10019. @item jt
  10020. @item jb
  10021. These options set the amount of "junk" to ignore at the left, right, top, and
  10022. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10023. while top and bottom are in units of 2 lines.
  10024. The default is 8 pixels on each side.
  10025. @item sb
  10026. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10027. filter generating an occasional mismatched frame, but it may also cause an
  10028. excessive number of frames to be dropped during high motion sequences.
  10029. Conversely, setting it to -1 will make filter match fields more easily.
  10030. This may help processing of video where there is slight blurring between
  10031. the fields, but may also cause there to be interlaced frames in the output.
  10032. Default value is @code{0}.
  10033. @item mp
  10034. Set the metric plane to use. It accepts the following values:
  10035. @table @samp
  10036. @item l
  10037. Use luma plane.
  10038. @item u
  10039. Use chroma blue plane.
  10040. @item v
  10041. Use chroma red plane.
  10042. @end table
  10043. This option may be set to use chroma plane instead of the default luma plane
  10044. for doing filter's computations. This may improve accuracy on very clean
  10045. source material, but more likely will decrease accuracy, especially if there
  10046. is chroma noise (rainbow effect) or any grayscale video.
  10047. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10048. load and make pullup usable in realtime on slow machines.
  10049. @end table
  10050. For best results (without duplicated frames in the output file) it is
  10051. necessary to change the output frame rate. For example, to inverse
  10052. telecine NTSC input:
  10053. @example
  10054. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10055. @end example
  10056. @section qp
  10057. Change video quantization parameters (QP).
  10058. The filter accepts the following option:
  10059. @table @option
  10060. @item qp
  10061. Set expression for quantization parameter.
  10062. @end table
  10063. The expression is evaluated through the eval API and can contain, among others,
  10064. the following constants:
  10065. @table @var
  10066. @item known
  10067. 1 if index is not 129, 0 otherwise.
  10068. @item qp
  10069. Sequential index starting from -129 to 128.
  10070. @end table
  10071. @subsection Examples
  10072. @itemize
  10073. @item
  10074. Some equation like:
  10075. @example
  10076. qp=2+2*sin(PI*qp)
  10077. @end example
  10078. @end itemize
  10079. @section random
  10080. Flush video frames from internal cache of frames into a random order.
  10081. No frame is discarded.
  10082. Inspired by @ref{frei0r} nervous filter.
  10083. @table @option
  10084. @item frames
  10085. Set size in number of frames of internal cache, in range from @code{2} to
  10086. @code{512}. Default is @code{30}.
  10087. @item seed
  10088. Set seed for random number generator, must be an integer included between
  10089. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10090. less than @code{0}, the filter will try to use a good random seed on a
  10091. best effort basis.
  10092. @end table
  10093. @section readeia608
  10094. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10095. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10096. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10097. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10098. @table @option
  10099. @item lavfi.readeia608.X.cc
  10100. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10101. @item lavfi.readeia608.X.line
  10102. The number of the line on which the EIA-608 data was identified and read.
  10103. @end table
  10104. This filter accepts the following options:
  10105. @table @option
  10106. @item scan_min
  10107. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10108. @item scan_max
  10109. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10110. @item mac
  10111. Set minimal acceptable amplitude change for sync codes detection.
  10112. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10113. @item spw
  10114. Set the ratio of width reserved for sync code detection.
  10115. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10116. @item mhd
  10117. Set the max peaks height difference for sync code detection.
  10118. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10119. @item mpd
  10120. Set max peaks period difference for sync code detection.
  10121. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10122. @item msd
  10123. Set the first two max start code bits differences.
  10124. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10125. @item bhd
  10126. Set the minimum ratio of bits height compared to 3rd start code bit.
  10127. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10128. @item th_w
  10129. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10130. @item th_b
  10131. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10132. @item chp
  10133. Enable checking the parity bit. In the event of a parity error, the filter will output
  10134. @code{0x00} for that character. Default is false.
  10135. @end table
  10136. @subsection Examples
  10137. @itemize
  10138. @item
  10139. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10140. @example
  10141. 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
  10142. @end example
  10143. @end itemize
  10144. @section readvitc
  10145. Read vertical interval timecode (VITC) information from the top lines of a
  10146. video frame.
  10147. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10148. timecode value, if a valid timecode has been detected. Further metadata key
  10149. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10150. timecode data has been found or not.
  10151. This filter accepts the following options:
  10152. @table @option
  10153. @item scan_max
  10154. Set the maximum number of lines to scan for VITC data. If the value is set to
  10155. @code{-1} the full video frame is scanned. Default is @code{45}.
  10156. @item thr_b
  10157. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10158. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10159. @item thr_w
  10160. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10161. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10162. @end table
  10163. @subsection Examples
  10164. @itemize
  10165. @item
  10166. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10167. draw @code{--:--:--:--} as a placeholder:
  10168. @example
  10169. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10170. @end example
  10171. @end itemize
  10172. @section remap
  10173. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10174. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10175. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10176. value for pixel will be used for destination pixel.
  10177. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10178. will have Xmap/Ymap video stream dimensions.
  10179. Xmap and Ymap input video streams are 16bit depth, single channel.
  10180. @section removegrain
  10181. The removegrain filter is a spatial denoiser for progressive video.
  10182. @table @option
  10183. @item m0
  10184. Set mode for the first plane.
  10185. @item m1
  10186. Set mode for the second plane.
  10187. @item m2
  10188. Set mode for the third plane.
  10189. @item m3
  10190. Set mode for the fourth plane.
  10191. @end table
  10192. Range of mode is from 0 to 24. Description of each mode follows:
  10193. @table @var
  10194. @item 0
  10195. Leave input plane unchanged. Default.
  10196. @item 1
  10197. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10198. @item 2
  10199. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10200. @item 3
  10201. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10202. @item 4
  10203. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10204. This is equivalent to a median filter.
  10205. @item 5
  10206. Line-sensitive clipping giving the minimal change.
  10207. @item 6
  10208. Line-sensitive clipping, intermediate.
  10209. @item 7
  10210. Line-sensitive clipping, intermediate.
  10211. @item 8
  10212. Line-sensitive clipping, intermediate.
  10213. @item 9
  10214. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10215. @item 10
  10216. Replaces the target pixel with the closest neighbour.
  10217. @item 11
  10218. [1 2 1] horizontal and vertical kernel blur.
  10219. @item 12
  10220. Same as mode 11.
  10221. @item 13
  10222. Bob mode, interpolates top field from the line where the neighbours
  10223. pixels are the closest.
  10224. @item 14
  10225. Bob mode, interpolates bottom field from the line where the neighbours
  10226. pixels are the closest.
  10227. @item 15
  10228. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10229. interpolation formula.
  10230. @item 16
  10231. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10232. interpolation formula.
  10233. @item 17
  10234. Clips the pixel with the minimum and maximum of respectively the maximum and
  10235. minimum of each pair of opposite neighbour pixels.
  10236. @item 18
  10237. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10238. the current pixel is minimal.
  10239. @item 19
  10240. Replaces the pixel with the average of its 8 neighbours.
  10241. @item 20
  10242. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10243. @item 21
  10244. Clips pixels using the averages of opposite neighbour.
  10245. @item 22
  10246. Same as mode 21 but simpler and faster.
  10247. @item 23
  10248. Small edge and halo removal, but reputed useless.
  10249. @item 24
  10250. Similar as 23.
  10251. @end table
  10252. @section removelogo
  10253. Suppress a TV station logo, using an image file to determine which
  10254. pixels comprise the logo. It works by filling in the pixels that
  10255. comprise the logo with neighboring pixels.
  10256. The filter accepts the following options:
  10257. @table @option
  10258. @item filename, f
  10259. Set the filter bitmap file, which can be any image format supported by
  10260. libavformat. The width and height of the image file must match those of the
  10261. video stream being processed.
  10262. @end table
  10263. Pixels in the provided bitmap image with a value of zero are not
  10264. considered part of the logo, non-zero pixels are considered part of
  10265. the logo. If you use white (255) for the logo and black (0) for the
  10266. rest, you will be safe. For making the filter bitmap, it is
  10267. recommended to take a screen capture of a black frame with the logo
  10268. visible, and then using a threshold filter followed by the erode
  10269. filter once or twice.
  10270. If needed, little splotches can be fixed manually. Remember that if
  10271. logo pixels are not covered, the filter quality will be much
  10272. reduced. Marking too many pixels as part of the logo does not hurt as
  10273. much, but it will increase the amount of blurring needed to cover over
  10274. the image and will destroy more information than necessary, and extra
  10275. pixels will slow things down on a large logo.
  10276. @section repeatfields
  10277. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10278. fields based on its value.
  10279. @section reverse
  10280. Reverse a video clip.
  10281. Warning: This filter requires memory to buffer the entire clip, so trimming
  10282. is suggested.
  10283. @subsection Examples
  10284. @itemize
  10285. @item
  10286. Take the first 5 seconds of a clip, and reverse it.
  10287. @example
  10288. trim=end=5,reverse
  10289. @end example
  10290. @end itemize
  10291. @section roberts
  10292. Apply roberts cross operator to input video stream.
  10293. The filter accepts the following option:
  10294. @table @option
  10295. @item planes
  10296. Set which planes will be processed, unprocessed planes will be copied.
  10297. By default value 0xf, all planes will be processed.
  10298. @item scale
  10299. Set value which will be multiplied with filtered result.
  10300. @item delta
  10301. Set value which will be added to filtered result.
  10302. @end table
  10303. @section rotate
  10304. Rotate video by an arbitrary angle expressed in radians.
  10305. The filter accepts the following options:
  10306. A description of the optional parameters follows.
  10307. @table @option
  10308. @item angle, a
  10309. Set an expression for the angle by which to rotate the input video
  10310. clockwise, expressed as a number of radians. A negative value will
  10311. result in a counter-clockwise rotation. By default it is set to "0".
  10312. This expression is evaluated for each frame.
  10313. @item out_w, ow
  10314. Set the output width expression, default value is "iw".
  10315. This expression is evaluated just once during configuration.
  10316. @item out_h, oh
  10317. Set the output height expression, default value is "ih".
  10318. This expression is evaluated just once during configuration.
  10319. @item bilinear
  10320. Enable bilinear interpolation if set to 1, a value of 0 disables
  10321. it. Default value is 1.
  10322. @item fillcolor, c
  10323. Set the color used to fill the output area not covered by the rotated
  10324. image. For the general syntax of this option, check the
  10325. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10326. If the special value "none" is selected then no
  10327. background is printed (useful for example if the background is never shown).
  10328. Default value is "black".
  10329. @end table
  10330. The expressions for the angle and the output size can contain the
  10331. following constants and functions:
  10332. @table @option
  10333. @item n
  10334. sequential number of the input frame, starting from 0. It is always NAN
  10335. before the first frame is filtered.
  10336. @item t
  10337. time in seconds of the input frame, it is set to 0 when the filter is
  10338. configured. It is always NAN before the first frame is filtered.
  10339. @item hsub
  10340. @item vsub
  10341. horizontal and vertical chroma subsample values. For example for the
  10342. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10343. @item in_w, iw
  10344. @item in_h, ih
  10345. the input video width and height
  10346. @item out_w, ow
  10347. @item out_h, oh
  10348. the output width and height, that is the size of the padded area as
  10349. specified by the @var{width} and @var{height} expressions
  10350. @item rotw(a)
  10351. @item roth(a)
  10352. the minimal width/height required for completely containing the input
  10353. video rotated by @var{a} radians.
  10354. These are only available when computing the @option{out_w} and
  10355. @option{out_h} expressions.
  10356. @end table
  10357. @subsection Examples
  10358. @itemize
  10359. @item
  10360. Rotate the input by PI/6 radians clockwise:
  10361. @example
  10362. rotate=PI/6
  10363. @end example
  10364. @item
  10365. Rotate the input by PI/6 radians counter-clockwise:
  10366. @example
  10367. rotate=-PI/6
  10368. @end example
  10369. @item
  10370. Rotate the input by 45 degrees clockwise:
  10371. @example
  10372. rotate=45*PI/180
  10373. @end example
  10374. @item
  10375. Apply a constant rotation with period T, starting from an angle of PI/3:
  10376. @example
  10377. rotate=PI/3+2*PI*t/T
  10378. @end example
  10379. @item
  10380. Make the input video rotation oscillating with a period of T
  10381. seconds and an amplitude of A radians:
  10382. @example
  10383. rotate=A*sin(2*PI/T*t)
  10384. @end example
  10385. @item
  10386. Rotate the video, output size is chosen so that the whole rotating
  10387. input video is always completely contained in the output:
  10388. @example
  10389. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10390. @end example
  10391. @item
  10392. Rotate the video, reduce the output size so that no background is ever
  10393. shown:
  10394. @example
  10395. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10396. @end example
  10397. @end itemize
  10398. @subsection Commands
  10399. The filter supports the following commands:
  10400. @table @option
  10401. @item a, angle
  10402. Set the angle expression.
  10403. The command accepts the same syntax of the corresponding option.
  10404. If the specified expression is not valid, it is kept at its current
  10405. value.
  10406. @end table
  10407. @section sab
  10408. Apply Shape Adaptive Blur.
  10409. The filter accepts the following options:
  10410. @table @option
  10411. @item luma_radius, lr
  10412. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10413. value is 1.0. A greater value will result in a more blurred image, and
  10414. in slower processing.
  10415. @item luma_pre_filter_radius, lpfr
  10416. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10417. value is 1.0.
  10418. @item luma_strength, ls
  10419. Set luma maximum difference between pixels to still be considered, must
  10420. be a value in the 0.1-100.0 range, default value is 1.0.
  10421. @item chroma_radius, cr
  10422. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10423. greater value will result in a more blurred image, and in slower
  10424. processing.
  10425. @item chroma_pre_filter_radius, cpfr
  10426. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10427. @item chroma_strength, cs
  10428. Set chroma maximum difference between pixels to still be considered,
  10429. must be a value in the -0.9-100.0 range.
  10430. @end table
  10431. Each chroma option value, if not explicitly specified, is set to the
  10432. corresponding luma option value.
  10433. @anchor{scale}
  10434. @section scale
  10435. Scale (resize) the input video, using the libswscale library.
  10436. The scale filter forces the output display aspect ratio to be the same
  10437. of the input, by changing the output sample aspect ratio.
  10438. If the input image format is different from the format requested by
  10439. the next filter, the scale filter will convert the input to the
  10440. requested format.
  10441. @subsection Options
  10442. The filter accepts the following options, or any of the options
  10443. supported by the libswscale scaler.
  10444. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10445. the complete list of scaler options.
  10446. @table @option
  10447. @item width, w
  10448. @item height, h
  10449. Set the output video dimension expression. Default value is the input
  10450. dimension.
  10451. If the @var{width} or @var{w} value is 0, the input width is used for
  10452. the output. If the @var{height} or @var{h} value is 0, the input height
  10453. is used for the output.
  10454. If one and only one of the values is -n with n >= 1, the scale filter
  10455. will use a value that maintains the aspect ratio of the input image,
  10456. calculated from the other specified dimension. After that it will,
  10457. however, make sure that the calculated dimension is divisible by n and
  10458. adjust the value if necessary.
  10459. If both values are -n with n >= 1, the behavior will be identical to
  10460. both values being set to 0 as previously detailed.
  10461. See below for the list of accepted constants for use in the dimension
  10462. expression.
  10463. @item eval
  10464. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10465. @table @samp
  10466. @item init
  10467. Only evaluate expressions once during the filter initialization or when a command is processed.
  10468. @item frame
  10469. Evaluate expressions for each incoming frame.
  10470. @end table
  10471. Default value is @samp{init}.
  10472. @item interl
  10473. Set the interlacing mode. It accepts the following values:
  10474. @table @samp
  10475. @item 1
  10476. Force interlaced aware scaling.
  10477. @item 0
  10478. Do not apply interlaced scaling.
  10479. @item -1
  10480. Select interlaced aware scaling depending on whether the source frames
  10481. are flagged as interlaced or not.
  10482. @end table
  10483. Default value is @samp{0}.
  10484. @item flags
  10485. Set libswscale scaling flags. See
  10486. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10487. complete list of values. If not explicitly specified the filter applies
  10488. the default flags.
  10489. @item param0, param1
  10490. Set libswscale input parameters for scaling algorithms that need them. See
  10491. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10492. complete documentation. If not explicitly specified the filter applies
  10493. empty parameters.
  10494. @item size, s
  10495. Set the video size. For the syntax of this option, check the
  10496. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10497. @item in_color_matrix
  10498. @item out_color_matrix
  10499. Set in/output YCbCr color space type.
  10500. This allows the autodetected value to be overridden as well as allows forcing
  10501. a specific value used for the output and encoder.
  10502. If not specified, the color space type depends on the pixel format.
  10503. Possible values:
  10504. @table @samp
  10505. @item auto
  10506. Choose automatically.
  10507. @item bt709
  10508. Format conforming to International Telecommunication Union (ITU)
  10509. Recommendation BT.709.
  10510. @item fcc
  10511. Set color space conforming to the United States Federal Communications
  10512. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10513. @item bt601
  10514. Set color space conforming to:
  10515. @itemize
  10516. @item
  10517. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10518. @item
  10519. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10520. @item
  10521. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10522. @end itemize
  10523. @item smpte240m
  10524. Set color space conforming to SMPTE ST 240:1999.
  10525. @end table
  10526. @item in_range
  10527. @item out_range
  10528. Set in/output YCbCr sample range.
  10529. This allows the autodetected value to be overridden as well as allows forcing
  10530. a specific value used for the output and encoder. If not specified, the
  10531. range depends on the pixel format. Possible values:
  10532. @table @samp
  10533. @item auto/unknown
  10534. Choose automatically.
  10535. @item jpeg/full/pc
  10536. Set full range (0-255 in case of 8-bit luma).
  10537. @item mpeg/limited/tv
  10538. Set "MPEG" range (16-235 in case of 8-bit luma).
  10539. @end table
  10540. @item force_original_aspect_ratio
  10541. Enable decreasing or increasing output video width or height if necessary to
  10542. keep the original aspect ratio. Possible values:
  10543. @table @samp
  10544. @item disable
  10545. Scale the video as specified and disable this feature.
  10546. @item decrease
  10547. The output video dimensions will automatically be decreased if needed.
  10548. @item increase
  10549. The output video dimensions will automatically be increased if needed.
  10550. @end table
  10551. One useful instance of this option is that when you know a specific device's
  10552. maximum allowed resolution, you can use this to limit the output video to
  10553. that, while retaining the aspect ratio. For example, device A allows
  10554. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10555. decrease) and specifying 1280x720 to the command line makes the output
  10556. 1280x533.
  10557. Please note that this is a different thing than specifying -1 for @option{w}
  10558. or @option{h}, you still need to specify the output resolution for this option
  10559. to work.
  10560. @end table
  10561. The values of the @option{w} and @option{h} options are expressions
  10562. containing the following constants:
  10563. @table @var
  10564. @item in_w
  10565. @item in_h
  10566. The input width and height
  10567. @item iw
  10568. @item ih
  10569. These are the same as @var{in_w} and @var{in_h}.
  10570. @item out_w
  10571. @item out_h
  10572. The output (scaled) width and height
  10573. @item ow
  10574. @item oh
  10575. These are the same as @var{out_w} and @var{out_h}
  10576. @item a
  10577. The same as @var{iw} / @var{ih}
  10578. @item sar
  10579. input sample aspect ratio
  10580. @item dar
  10581. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10582. @item hsub
  10583. @item vsub
  10584. horizontal and vertical input chroma subsample values. For example for the
  10585. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10586. @item ohsub
  10587. @item ovsub
  10588. horizontal and vertical output chroma subsample values. For example for the
  10589. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10590. @end table
  10591. @subsection Examples
  10592. @itemize
  10593. @item
  10594. Scale the input video to a size of 200x100
  10595. @example
  10596. scale=w=200:h=100
  10597. @end example
  10598. This is equivalent to:
  10599. @example
  10600. scale=200:100
  10601. @end example
  10602. or:
  10603. @example
  10604. scale=200x100
  10605. @end example
  10606. @item
  10607. Specify a size abbreviation for the output size:
  10608. @example
  10609. scale=qcif
  10610. @end example
  10611. which can also be written as:
  10612. @example
  10613. scale=size=qcif
  10614. @end example
  10615. @item
  10616. Scale the input to 2x:
  10617. @example
  10618. scale=w=2*iw:h=2*ih
  10619. @end example
  10620. @item
  10621. The above is the same as:
  10622. @example
  10623. scale=2*in_w:2*in_h
  10624. @end example
  10625. @item
  10626. Scale the input to 2x with forced interlaced scaling:
  10627. @example
  10628. scale=2*iw:2*ih:interl=1
  10629. @end example
  10630. @item
  10631. Scale the input to half size:
  10632. @example
  10633. scale=w=iw/2:h=ih/2
  10634. @end example
  10635. @item
  10636. Increase the width, and set the height to the same size:
  10637. @example
  10638. scale=3/2*iw:ow
  10639. @end example
  10640. @item
  10641. Seek Greek harmony:
  10642. @example
  10643. scale=iw:1/PHI*iw
  10644. scale=ih*PHI:ih
  10645. @end example
  10646. @item
  10647. Increase the height, and set the width to 3/2 of the height:
  10648. @example
  10649. scale=w=3/2*oh:h=3/5*ih
  10650. @end example
  10651. @item
  10652. Increase the size, making the size a multiple of the chroma
  10653. subsample values:
  10654. @example
  10655. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10656. @end example
  10657. @item
  10658. Increase the width to a maximum of 500 pixels,
  10659. keeping the same aspect ratio as the input:
  10660. @example
  10661. scale=w='min(500\, iw*3/2):h=-1'
  10662. @end example
  10663. @item
  10664. Make pixels square by combining scale and setsar:
  10665. @example
  10666. scale='trunc(ih*dar):ih',setsar=1/1
  10667. @end example
  10668. @item
  10669. Make pixels square by combining scale and setsar,
  10670. making sure the resulting resolution is even (required by some codecs):
  10671. @example
  10672. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10673. @end example
  10674. @end itemize
  10675. @subsection Commands
  10676. This filter supports the following commands:
  10677. @table @option
  10678. @item width, w
  10679. @item height, h
  10680. Set the output video dimension expression.
  10681. The command accepts the same syntax of the corresponding option.
  10682. If the specified expression is not valid, it is kept at its current
  10683. value.
  10684. @end table
  10685. @section scale_npp
  10686. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10687. format conversion on CUDA video frames. Setting the output width and height
  10688. works in the same way as for the @var{scale} filter.
  10689. The following additional options are accepted:
  10690. @table @option
  10691. @item format
  10692. The pixel format of the output CUDA frames. If set to the string "same" (the
  10693. default), the input format will be kept. Note that automatic format negotiation
  10694. and conversion is not yet supported for hardware frames
  10695. @item interp_algo
  10696. The interpolation algorithm used for resizing. One of the following:
  10697. @table @option
  10698. @item nn
  10699. Nearest neighbour.
  10700. @item linear
  10701. @item cubic
  10702. @item cubic2p_bspline
  10703. 2-parameter cubic (B=1, C=0)
  10704. @item cubic2p_catmullrom
  10705. 2-parameter cubic (B=0, C=1/2)
  10706. @item cubic2p_b05c03
  10707. 2-parameter cubic (B=1/2, C=3/10)
  10708. @item super
  10709. Supersampling
  10710. @item lanczos
  10711. @end table
  10712. @end table
  10713. @section scale2ref
  10714. Scale (resize) the input video, based on a reference video.
  10715. See the scale filter for available options, scale2ref supports the same but
  10716. uses the reference video instead of the main input as basis. scale2ref also
  10717. supports the following additional constants for the @option{w} and
  10718. @option{h} options:
  10719. @table @var
  10720. @item main_w
  10721. @item main_h
  10722. The main input video's width and height
  10723. @item main_a
  10724. The same as @var{main_w} / @var{main_h}
  10725. @item main_sar
  10726. The main input video's sample aspect ratio
  10727. @item main_dar, mdar
  10728. The main input video's display aspect ratio. Calculated from
  10729. @code{(main_w / main_h) * main_sar}.
  10730. @item main_hsub
  10731. @item main_vsub
  10732. The main input video's horizontal and vertical chroma subsample values.
  10733. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10734. is 1.
  10735. @end table
  10736. @subsection Examples
  10737. @itemize
  10738. @item
  10739. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10740. @example
  10741. 'scale2ref[b][a];[a][b]overlay'
  10742. @end example
  10743. @end itemize
  10744. @anchor{selectivecolor}
  10745. @section selectivecolor
  10746. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10747. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10748. by the "purity" of the color (that is, how saturated it already is).
  10749. This filter is similar to the Adobe Photoshop Selective Color tool.
  10750. The filter accepts the following options:
  10751. @table @option
  10752. @item correction_method
  10753. Select color correction method.
  10754. Available values are:
  10755. @table @samp
  10756. @item absolute
  10757. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10758. component value).
  10759. @item relative
  10760. Specified adjustments are relative to the original component value.
  10761. @end table
  10762. Default is @code{absolute}.
  10763. @item reds
  10764. Adjustments for red pixels (pixels where the red component is the maximum)
  10765. @item yellows
  10766. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10767. @item greens
  10768. Adjustments for green pixels (pixels where the green component is the maximum)
  10769. @item cyans
  10770. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10771. @item blues
  10772. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10773. @item magentas
  10774. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10775. @item whites
  10776. Adjustments for white pixels (pixels where all components are greater than 128)
  10777. @item neutrals
  10778. Adjustments for all pixels except pure black and pure white
  10779. @item blacks
  10780. Adjustments for black pixels (pixels where all components are lesser than 128)
  10781. @item psfile
  10782. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10783. @end table
  10784. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10785. 4 space separated floating point adjustment values in the [-1,1] range,
  10786. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10787. pixels of its range.
  10788. @subsection Examples
  10789. @itemize
  10790. @item
  10791. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10792. increase magenta by 27% in blue areas:
  10793. @example
  10794. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10795. @end example
  10796. @item
  10797. Use a Photoshop selective color preset:
  10798. @example
  10799. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10800. @end example
  10801. @end itemize
  10802. @anchor{separatefields}
  10803. @section separatefields
  10804. The @code{separatefields} takes a frame-based video input and splits
  10805. each frame into its components fields, producing a new half height clip
  10806. with twice the frame rate and twice the frame count.
  10807. This filter use field-dominance information in frame to decide which
  10808. of each pair of fields to place first in the output.
  10809. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10810. @section setdar, setsar
  10811. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10812. output video.
  10813. This is done by changing the specified Sample (aka Pixel) Aspect
  10814. Ratio, according to the following equation:
  10815. @example
  10816. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10817. @end example
  10818. Keep in mind that the @code{setdar} filter does not modify the pixel
  10819. dimensions of the video frame. Also, the display aspect ratio set by
  10820. this filter may be changed by later filters in the filterchain,
  10821. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10822. applied.
  10823. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10824. the filter output video.
  10825. Note that as a consequence of the application of this filter, the
  10826. output display aspect ratio will change according to the equation
  10827. above.
  10828. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10829. filter may be changed by later filters in the filterchain, e.g. if
  10830. another "setsar" or a "setdar" filter is applied.
  10831. It accepts the following parameters:
  10832. @table @option
  10833. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10834. Set the aspect ratio used by the filter.
  10835. The parameter can be a floating point number string, an expression, or
  10836. a string of the form @var{num}:@var{den}, where @var{num} and
  10837. @var{den} are the numerator and denominator of the aspect ratio. If
  10838. the parameter is not specified, it is assumed the value "0".
  10839. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10840. should be escaped.
  10841. @item max
  10842. Set the maximum integer value to use for expressing numerator and
  10843. denominator when reducing the expressed aspect ratio to a rational.
  10844. Default value is @code{100}.
  10845. @end table
  10846. The parameter @var{sar} is an expression containing
  10847. the following constants:
  10848. @table @option
  10849. @item E, PI, PHI
  10850. These are approximated values for the mathematical constants e
  10851. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10852. @item w, h
  10853. The input width and height.
  10854. @item a
  10855. These are the same as @var{w} / @var{h}.
  10856. @item sar
  10857. The input sample aspect ratio.
  10858. @item dar
  10859. The input display aspect ratio. It is the same as
  10860. (@var{w} / @var{h}) * @var{sar}.
  10861. @item hsub, vsub
  10862. Horizontal and vertical chroma subsample values. For example, for the
  10863. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10864. @end table
  10865. @subsection Examples
  10866. @itemize
  10867. @item
  10868. To change the display aspect ratio to 16:9, specify one of the following:
  10869. @example
  10870. setdar=dar=1.77777
  10871. setdar=dar=16/9
  10872. @end example
  10873. @item
  10874. To change the sample aspect ratio to 10:11, specify:
  10875. @example
  10876. setsar=sar=10/11
  10877. @end example
  10878. @item
  10879. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10880. 1000 in the aspect ratio reduction, use the command:
  10881. @example
  10882. setdar=ratio=16/9:max=1000
  10883. @end example
  10884. @end itemize
  10885. @anchor{setfield}
  10886. @section setfield
  10887. Force field for the output video frame.
  10888. The @code{setfield} filter marks the interlace type field for the
  10889. output frames. It does not change the input frame, but only sets the
  10890. corresponding property, which affects how the frame is treated by
  10891. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10892. The filter accepts the following options:
  10893. @table @option
  10894. @item mode
  10895. Available values are:
  10896. @table @samp
  10897. @item auto
  10898. Keep the same field property.
  10899. @item bff
  10900. Mark the frame as bottom-field-first.
  10901. @item tff
  10902. Mark the frame as top-field-first.
  10903. @item prog
  10904. Mark the frame as progressive.
  10905. @end table
  10906. @end table
  10907. @section showinfo
  10908. Show a line containing various information for each input video frame.
  10909. The input video is not modified.
  10910. The shown line contains a sequence of key/value pairs of the form
  10911. @var{key}:@var{value}.
  10912. The following values are shown in the output:
  10913. @table @option
  10914. @item n
  10915. The (sequential) number of the input frame, starting from 0.
  10916. @item pts
  10917. The Presentation TimeStamp of the input frame, expressed as a number of
  10918. time base units. The time base unit depends on the filter input pad.
  10919. @item pts_time
  10920. The Presentation TimeStamp of the input frame, expressed as a number of
  10921. seconds.
  10922. @item pos
  10923. The position of the frame in the input stream, or -1 if this information is
  10924. unavailable and/or meaningless (for example in case of synthetic video).
  10925. @item fmt
  10926. The pixel format name.
  10927. @item sar
  10928. The sample aspect ratio of the input frame, expressed in the form
  10929. @var{num}/@var{den}.
  10930. @item s
  10931. The size of the input frame. For the syntax of this option, check the
  10932. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10933. @item i
  10934. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10935. for bottom field first).
  10936. @item iskey
  10937. This is 1 if the frame is a key frame, 0 otherwise.
  10938. @item type
  10939. The picture type of the input frame ("I" for an I-frame, "P" for a
  10940. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10941. Also refer to the documentation of the @code{AVPictureType} enum and of
  10942. the @code{av_get_picture_type_char} function defined in
  10943. @file{libavutil/avutil.h}.
  10944. @item checksum
  10945. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10946. @item plane_checksum
  10947. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10948. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10949. @end table
  10950. @section showpalette
  10951. Displays the 256 colors palette of each frame. This filter is only relevant for
  10952. @var{pal8} pixel format frames.
  10953. It accepts the following option:
  10954. @table @option
  10955. @item s
  10956. Set the size of the box used to represent one palette color entry. Default is
  10957. @code{30} (for a @code{30x30} pixel box).
  10958. @end table
  10959. @section shuffleframes
  10960. Reorder and/or duplicate and/or drop video frames.
  10961. It accepts the following parameters:
  10962. @table @option
  10963. @item mapping
  10964. Set the destination indexes of input frames.
  10965. This is space or '|' separated list of indexes that maps input frames to output
  10966. frames. Number of indexes also sets maximal value that each index may have.
  10967. '-1' index have special meaning and that is to drop frame.
  10968. @end table
  10969. The first frame has the index 0. The default is to keep the input unchanged.
  10970. @subsection Examples
  10971. @itemize
  10972. @item
  10973. Swap second and third frame of every three frames of the input:
  10974. @example
  10975. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10976. @end example
  10977. @item
  10978. Swap 10th and 1st frame of every ten frames of the input:
  10979. @example
  10980. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10981. @end example
  10982. @end itemize
  10983. @section shuffleplanes
  10984. Reorder and/or duplicate video planes.
  10985. It accepts the following parameters:
  10986. @table @option
  10987. @item map0
  10988. The index of the input plane to be used as the first output plane.
  10989. @item map1
  10990. The index of the input plane to be used as the second output plane.
  10991. @item map2
  10992. The index of the input plane to be used as the third output plane.
  10993. @item map3
  10994. The index of the input plane to be used as the fourth output plane.
  10995. @end table
  10996. The first plane has the index 0. The default is to keep the input unchanged.
  10997. @subsection Examples
  10998. @itemize
  10999. @item
  11000. Swap the second and third planes of the input:
  11001. @example
  11002. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11003. @end example
  11004. @end itemize
  11005. @anchor{signalstats}
  11006. @section signalstats
  11007. Evaluate various visual metrics that assist in determining issues associated
  11008. with the digitization of analog video media.
  11009. By default the filter will log these metadata values:
  11010. @table @option
  11011. @item YMIN
  11012. Display the minimal Y value contained within the input frame. Expressed in
  11013. range of [0-255].
  11014. @item YLOW
  11015. Display the Y value at the 10% percentile within the input frame. Expressed in
  11016. range of [0-255].
  11017. @item YAVG
  11018. Display the average Y value within the input frame. Expressed in range of
  11019. [0-255].
  11020. @item YHIGH
  11021. Display the Y value at the 90% percentile within the input frame. Expressed in
  11022. range of [0-255].
  11023. @item YMAX
  11024. Display the maximum Y value contained within the input frame. Expressed in
  11025. range of [0-255].
  11026. @item UMIN
  11027. Display the minimal U value contained within the input frame. Expressed in
  11028. range of [0-255].
  11029. @item ULOW
  11030. Display the U value at the 10% percentile within the input frame. Expressed in
  11031. range of [0-255].
  11032. @item UAVG
  11033. Display the average U value within the input frame. Expressed in range of
  11034. [0-255].
  11035. @item UHIGH
  11036. Display the U value at the 90% percentile within the input frame. Expressed in
  11037. range of [0-255].
  11038. @item UMAX
  11039. Display the maximum U value contained within the input frame. Expressed in
  11040. range of [0-255].
  11041. @item VMIN
  11042. Display the minimal V value contained within the input frame. Expressed in
  11043. range of [0-255].
  11044. @item VLOW
  11045. Display the V value at the 10% percentile within the input frame. Expressed in
  11046. range of [0-255].
  11047. @item VAVG
  11048. Display the average V value within the input frame. Expressed in range of
  11049. [0-255].
  11050. @item VHIGH
  11051. Display the V value at the 90% percentile within the input frame. Expressed in
  11052. range of [0-255].
  11053. @item VMAX
  11054. Display the maximum V value contained within the input frame. Expressed in
  11055. range of [0-255].
  11056. @item SATMIN
  11057. Display the minimal saturation value contained within the input frame.
  11058. Expressed in range of [0-~181.02].
  11059. @item SATLOW
  11060. Display the saturation value at the 10% percentile within the input frame.
  11061. Expressed in range of [0-~181.02].
  11062. @item SATAVG
  11063. Display the average saturation value within the input frame. Expressed in range
  11064. of [0-~181.02].
  11065. @item SATHIGH
  11066. Display the saturation value at the 90% percentile within the input frame.
  11067. Expressed in range of [0-~181.02].
  11068. @item SATMAX
  11069. Display the maximum saturation value contained within the input frame.
  11070. Expressed in range of [0-~181.02].
  11071. @item HUEMED
  11072. Display the median value for hue within the input frame. Expressed in range of
  11073. [0-360].
  11074. @item HUEAVG
  11075. Display the average value for hue within the input frame. Expressed in range of
  11076. [0-360].
  11077. @item YDIF
  11078. Display the average of sample value difference between all values of the Y
  11079. plane in the current frame and corresponding values of the previous input frame.
  11080. Expressed in range of [0-255].
  11081. @item UDIF
  11082. Display the average of sample value difference between all values of the U
  11083. plane in the current frame and corresponding values of the previous input frame.
  11084. Expressed in range of [0-255].
  11085. @item VDIF
  11086. Display the average of sample value difference between all values of the V
  11087. plane in the current frame and corresponding values of the previous input frame.
  11088. Expressed in range of [0-255].
  11089. @item YBITDEPTH
  11090. Display bit depth of Y plane in current frame.
  11091. Expressed in range of [0-16].
  11092. @item UBITDEPTH
  11093. Display bit depth of U plane in current frame.
  11094. Expressed in range of [0-16].
  11095. @item VBITDEPTH
  11096. Display bit depth of V plane in current frame.
  11097. Expressed in range of [0-16].
  11098. @end table
  11099. The filter accepts the following options:
  11100. @table @option
  11101. @item stat
  11102. @item out
  11103. @option{stat} specify an additional form of image analysis.
  11104. @option{out} output video with the specified type of pixel highlighted.
  11105. Both options accept the following values:
  11106. @table @samp
  11107. @item tout
  11108. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11109. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11110. include the results of video dropouts, head clogs, or tape tracking issues.
  11111. @item vrep
  11112. Identify @var{vertical line repetition}. Vertical line repetition includes
  11113. similar rows of pixels within a frame. In born-digital video vertical line
  11114. repetition is common, but this pattern is uncommon in video digitized from an
  11115. analog source. When it occurs in video that results from the digitization of an
  11116. analog source it can indicate concealment from a dropout compensator.
  11117. @item brng
  11118. Identify pixels that fall outside of legal broadcast range.
  11119. @end table
  11120. @item color, c
  11121. Set the highlight color for the @option{out} option. The default color is
  11122. yellow.
  11123. @end table
  11124. @subsection Examples
  11125. @itemize
  11126. @item
  11127. Output data of various video metrics:
  11128. @example
  11129. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11130. @end example
  11131. @item
  11132. Output specific data about the minimum and maximum values of the Y plane per frame:
  11133. @example
  11134. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11135. @end example
  11136. @item
  11137. Playback video while highlighting pixels that are outside of broadcast range in red.
  11138. @example
  11139. ffplay example.mov -vf signalstats="out=brng:color=red"
  11140. @end example
  11141. @item
  11142. Playback video with signalstats metadata drawn over the frame.
  11143. @example
  11144. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11145. @end example
  11146. The contents of signalstat_drawtext.txt used in the command are:
  11147. @example
  11148. time %@{pts:hms@}
  11149. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11150. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11151. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11152. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11153. @end example
  11154. @end itemize
  11155. @anchor{signature}
  11156. @section signature
  11157. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11158. input. In this case the matching between the inputs can be calculated additionally.
  11159. The filter always passes through the first input. The signature of each stream can
  11160. be written into a file.
  11161. It accepts the following options:
  11162. @table @option
  11163. @item detectmode
  11164. Enable or disable the matching process.
  11165. Available values are:
  11166. @table @samp
  11167. @item off
  11168. Disable the calculation of a matching (default).
  11169. @item full
  11170. Calculate the matching for the whole video and output whether the whole video
  11171. matches or only parts.
  11172. @item fast
  11173. Calculate only until a matching is found or the video ends. Should be faster in
  11174. some cases.
  11175. @end table
  11176. @item nb_inputs
  11177. Set the number of inputs. The option value must be a non negative integer.
  11178. Default value is 1.
  11179. @item filename
  11180. Set the path to which the output is written. If there is more than one input,
  11181. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11182. integer), that will be replaced with the input number. If no filename is
  11183. specified, no output will be written. This is the default.
  11184. @item format
  11185. Choose the output format.
  11186. Available values are:
  11187. @table @samp
  11188. @item binary
  11189. Use the specified binary representation (default).
  11190. @item xml
  11191. Use the specified xml representation.
  11192. @end table
  11193. @item th_d
  11194. Set threshold to detect one word as similar. The option value must be an integer
  11195. greater than zero. The default value is 9000.
  11196. @item th_dc
  11197. Set threshold to detect all words as similar. The option value must be an integer
  11198. greater than zero. The default value is 60000.
  11199. @item th_xh
  11200. Set threshold to detect frames as similar. The option value must be an integer
  11201. greater than zero. The default value is 116.
  11202. @item th_di
  11203. Set the minimum length of a sequence in frames to recognize it as matching
  11204. sequence. The option value must be a non negative integer value.
  11205. The default value is 0.
  11206. @item th_it
  11207. Set the minimum relation, that matching frames to all frames must have.
  11208. The option value must be a double value between 0 and 1. The default value is 0.5.
  11209. @end table
  11210. @subsection Examples
  11211. @itemize
  11212. @item
  11213. To calculate the signature of an input video and store it in signature.bin:
  11214. @example
  11215. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11216. @end example
  11217. @item
  11218. To detect whether two videos match and store the signatures in XML format in
  11219. signature0.xml and signature1.xml:
  11220. @example
  11221. 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 -
  11222. @end example
  11223. @end itemize
  11224. @anchor{smartblur}
  11225. @section smartblur
  11226. Blur the input video without impacting the outlines.
  11227. It accepts the following options:
  11228. @table @option
  11229. @item luma_radius, lr
  11230. Set the luma radius. The option value must be a float number in
  11231. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11232. used to blur the image (slower if larger). Default value is 1.0.
  11233. @item luma_strength, ls
  11234. Set the luma strength. The option value must be a float number
  11235. in the range [-1.0,1.0] that configures the blurring. A value included
  11236. in [0.0,1.0] will blur the image whereas a value included in
  11237. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11238. @item luma_threshold, lt
  11239. Set the luma threshold used as a coefficient to determine
  11240. whether a pixel should be blurred or not. The option value must be an
  11241. integer in the range [-30,30]. A value of 0 will filter all the image,
  11242. a value included in [0,30] will filter flat areas and a value included
  11243. in [-30,0] will filter edges. Default value is 0.
  11244. @item chroma_radius, cr
  11245. Set the chroma radius. The option value must be a float number in
  11246. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11247. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11248. @item chroma_strength, cs
  11249. Set the chroma strength. The option value must be a float number
  11250. in the range [-1.0,1.0] that configures the blurring. A value included
  11251. in [0.0,1.0] will blur the image whereas a value included in
  11252. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11253. @item chroma_threshold, ct
  11254. Set the chroma threshold used as a coefficient to determine
  11255. whether a pixel should be blurred or not. The option value must be an
  11256. integer in the range [-30,30]. A value of 0 will filter all the image,
  11257. a value included in [0,30] will filter flat areas and a value included
  11258. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11259. @end table
  11260. If a chroma option is not explicitly set, the corresponding luma value
  11261. is set.
  11262. @section ssim
  11263. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11264. This filter takes in input two input videos, the first input is
  11265. considered the "main" source and is passed unchanged to the
  11266. output. The second input is used as a "reference" video for computing
  11267. the SSIM.
  11268. Both video inputs must have the same resolution and pixel format for
  11269. this filter to work correctly. Also it assumes that both inputs
  11270. have the same number of frames, which are compared one by one.
  11271. The filter stores the calculated SSIM of each frame.
  11272. The description of the accepted parameters follows.
  11273. @table @option
  11274. @item stats_file, f
  11275. If specified the filter will use the named file to save the SSIM of
  11276. each individual frame. When filename equals "-" the data is sent to
  11277. standard output.
  11278. @end table
  11279. The file printed if @var{stats_file} is selected, contains a sequence of
  11280. key/value pairs of the form @var{key}:@var{value} for each compared
  11281. couple of frames.
  11282. A description of each shown parameter follows:
  11283. @table @option
  11284. @item n
  11285. sequential number of the input frame, starting from 1
  11286. @item Y, U, V, R, G, B
  11287. SSIM of the compared frames for the component specified by the suffix.
  11288. @item All
  11289. SSIM of the compared frames for the whole frame.
  11290. @item dB
  11291. Same as above but in dB representation.
  11292. @end table
  11293. This filter also supports the @ref{framesync} options.
  11294. For example:
  11295. @example
  11296. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11297. [main][ref] ssim="stats_file=stats.log" [out]
  11298. @end example
  11299. On this example the input file being processed is compared with the
  11300. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11301. is stored in @file{stats.log}.
  11302. Another example with both psnr and ssim at same time:
  11303. @example
  11304. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11305. @end example
  11306. @section stereo3d
  11307. Convert between different stereoscopic image formats.
  11308. The filters accept the following options:
  11309. @table @option
  11310. @item in
  11311. Set stereoscopic image format of input.
  11312. Available values for input image formats are:
  11313. @table @samp
  11314. @item sbsl
  11315. side by side parallel (left eye left, right eye right)
  11316. @item sbsr
  11317. side by side crosseye (right eye left, left eye right)
  11318. @item sbs2l
  11319. side by side parallel with half width resolution
  11320. (left eye left, right eye right)
  11321. @item sbs2r
  11322. side by side crosseye with half width resolution
  11323. (right eye left, left eye right)
  11324. @item abl
  11325. above-below (left eye above, right eye below)
  11326. @item abr
  11327. above-below (right eye above, left eye below)
  11328. @item ab2l
  11329. above-below with half height resolution
  11330. (left eye above, right eye below)
  11331. @item ab2r
  11332. above-below with half height resolution
  11333. (right eye above, left eye below)
  11334. @item al
  11335. alternating frames (left eye first, right eye second)
  11336. @item ar
  11337. alternating frames (right eye first, left eye second)
  11338. @item irl
  11339. interleaved rows (left eye has top row, right eye starts on next row)
  11340. @item irr
  11341. interleaved rows (right eye has top row, left eye starts on next row)
  11342. @item icl
  11343. interleaved columns, left eye first
  11344. @item icr
  11345. interleaved columns, right eye first
  11346. Default value is @samp{sbsl}.
  11347. @end table
  11348. @item out
  11349. Set stereoscopic image format of output.
  11350. @table @samp
  11351. @item sbsl
  11352. side by side parallel (left eye left, right eye right)
  11353. @item sbsr
  11354. side by side crosseye (right eye left, left eye right)
  11355. @item sbs2l
  11356. side by side parallel with half width resolution
  11357. (left eye left, right eye right)
  11358. @item sbs2r
  11359. side by side crosseye with half width resolution
  11360. (right eye left, left eye right)
  11361. @item abl
  11362. above-below (left eye above, right eye below)
  11363. @item abr
  11364. above-below (right eye above, left eye below)
  11365. @item ab2l
  11366. above-below with half height resolution
  11367. (left eye above, right eye below)
  11368. @item ab2r
  11369. above-below with half height resolution
  11370. (right eye above, left eye below)
  11371. @item al
  11372. alternating frames (left eye first, right eye second)
  11373. @item ar
  11374. alternating frames (right eye first, left eye second)
  11375. @item irl
  11376. interleaved rows (left eye has top row, right eye starts on next row)
  11377. @item irr
  11378. interleaved rows (right eye has top row, left eye starts on next row)
  11379. @item arbg
  11380. anaglyph red/blue gray
  11381. (red filter on left eye, blue filter on right eye)
  11382. @item argg
  11383. anaglyph red/green gray
  11384. (red filter on left eye, green filter on right eye)
  11385. @item arcg
  11386. anaglyph red/cyan gray
  11387. (red filter on left eye, cyan filter on right eye)
  11388. @item arch
  11389. anaglyph red/cyan half colored
  11390. (red filter on left eye, cyan filter on right eye)
  11391. @item arcc
  11392. anaglyph red/cyan color
  11393. (red filter on left eye, cyan filter on right eye)
  11394. @item arcd
  11395. anaglyph red/cyan color optimized with the least squares projection of dubois
  11396. (red filter on left eye, cyan filter on right eye)
  11397. @item agmg
  11398. anaglyph green/magenta gray
  11399. (green filter on left eye, magenta filter on right eye)
  11400. @item agmh
  11401. anaglyph green/magenta half colored
  11402. (green filter on left eye, magenta filter on right eye)
  11403. @item agmc
  11404. anaglyph green/magenta colored
  11405. (green filter on left eye, magenta filter on right eye)
  11406. @item agmd
  11407. anaglyph green/magenta color optimized with the least squares projection of dubois
  11408. (green filter on left eye, magenta filter on right eye)
  11409. @item aybg
  11410. anaglyph yellow/blue gray
  11411. (yellow filter on left eye, blue filter on right eye)
  11412. @item aybh
  11413. anaglyph yellow/blue half colored
  11414. (yellow filter on left eye, blue filter on right eye)
  11415. @item aybc
  11416. anaglyph yellow/blue colored
  11417. (yellow filter on left eye, blue filter on right eye)
  11418. @item aybd
  11419. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11420. (yellow filter on left eye, blue filter on right eye)
  11421. @item ml
  11422. mono output (left eye only)
  11423. @item mr
  11424. mono output (right eye only)
  11425. @item chl
  11426. checkerboard, left eye first
  11427. @item chr
  11428. checkerboard, right eye first
  11429. @item icl
  11430. interleaved columns, left eye first
  11431. @item icr
  11432. interleaved columns, right eye first
  11433. @item hdmi
  11434. HDMI frame pack
  11435. @end table
  11436. Default value is @samp{arcd}.
  11437. @end table
  11438. @subsection Examples
  11439. @itemize
  11440. @item
  11441. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11442. @example
  11443. stereo3d=sbsl:aybd
  11444. @end example
  11445. @item
  11446. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11447. @example
  11448. stereo3d=abl:sbsr
  11449. @end example
  11450. @end itemize
  11451. @section streamselect, astreamselect
  11452. Select video or audio streams.
  11453. The filter accepts the following options:
  11454. @table @option
  11455. @item inputs
  11456. Set number of inputs. Default is 2.
  11457. @item map
  11458. Set input indexes to remap to outputs.
  11459. @end table
  11460. @subsection Commands
  11461. The @code{streamselect} and @code{astreamselect} filter supports the following
  11462. commands:
  11463. @table @option
  11464. @item map
  11465. Set input indexes to remap to outputs.
  11466. @end table
  11467. @subsection Examples
  11468. @itemize
  11469. @item
  11470. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11471. @example
  11472. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11473. @end example
  11474. @item
  11475. Same as above, but for audio:
  11476. @example
  11477. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11478. @end example
  11479. @end itemize
  11480. @section sobel
  11481. Apply sobel operator to input video stream.
  11482. The filter accepts the following option:
  11483. @table @option
  11484. @item planes
  11485. Set which planes will be processed, unprocessed planes will be copied.
  11486. By default value 0xf, all planes will be processed.
  11487. @item scale
  11488. Set value which will be multiplied with filtered result.
  11489. @item delta
  11490. Set value which will be added to filtered result.
  11491. @end table
  11492. @anchor{spp}
  11493. @section spp
  11494. Apply a simple postprocessing filter that compresses and decompresses the image
  11495. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11496. and average the results.
  11497. The filter accepts the following options:
  11498. @table @option
  11499. @item quality
  11500. Set quality. This option defines the number of levels for averaging. It accepts
  11501. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11502. effect. A value of @code{6} means the higher quality. For each increment of
  11503. that value the speed drops by a factor of approximately 2. Default value is
  11504. @code{3}.
  11505. @item qp
  11506. Force a constant quantization parameter. If not set, the filter will use the QP
  11507. from the video stream (if available).
  11508. @item mode
  11509. Set thresholding mode. Available modes are:
  11510. @table @samp
  11511. @item hard
  11512. Set hard thresholding (default).
  11513. @item soft
  11514. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11515. @end table
  11516. @item use_bframe_qp
  11517. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11518. option may cause flicker since the B-Frames have often larger QP. Default is
  11519. @code{0} (not enabled).
  11520. @end table
  11521. @anchor{subtitles}
  11522. @section subtitles
  11523. Draw subtitles on top of input video using the libass library.
  11524. To enable compilation of this filter you need to configure FFmpeg with
  11525. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11526. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11527. Alpha) subtitles format.
  11528. The filter accepts the following options:
  11529. @table @option
  11530. @item filename, f
  11531. Set the filename of the subtitle file to read. It must be specified.
  11532. @item original_size
  11533. Specify the size of the original video, the video for which the ASS file
  11534. was composed. For the syntax of this option, check the
  11535. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11536. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11537. correctly scale the fonts if the aspect ratio has been changed.
  11538. @item fontsdir
  11539. Set a directory path containing fonts that can be used by the filter.
  11540. These fonts will be used in addition to whatever the font provider uses.
  11541. @item alpha
  11542. Process alpha channel, by default alpha channel is untouched.
  11543. @item charenc
  11544. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11545. useful if not UTF-8.
  11546. @item stream_index, si
  11547. Set subtitles stream index. @code{subtitles} filter only.
  11548. @item force_style
  11549. Override default style or script info parameters of the subtitles. It accepts a
  11550. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11551. @end table
  11552. If the first key is not specified, it is assumed that the first value
  11553. specifies the @option{filename}.
  11554. For example, to render the file @file{sub.srt} on top of the input
  11555. video, use the command:
  11556. @example
  11557. subtitles=sub.srt
  11558. @end example
  11559. which is equivalent to:
  11560. @example
  11561. subtitles=filename=sub.srt
  11562. @end example
  11563. To render the default subtitles stream from file @file{video.mkv}, use:
  11564. @example
  11565. subtitles=video.mkv
  11566. @end example
  11567. To render the second subtitles stream from that file, use:
  11568. @example
  11569. subtitles=video.mkv:si=1
  11570. @end example
  11571. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11572. @code{DejaVu Serif}, use:
  11573. @example
  11574. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11575. @end example
  11576. @section super2xsai
  11577. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11578. Interpolate) pixel art scaling algorithm.
  11579. Useful for enlarging pixel art images without reducing sharpness.
  11580. @section swaprect
  11581. Swap two rectangular objects in video.
  11582. This filter accepts the following options:
  11583. @table @option
  11584. @item w
  11585. Set object width.
  11586. @item h
  11587. Set object height.
  11588. @item x1
  11589. Set 1st rect x coordinate.
  11590. @item y1
  11591. Set 1st rect y coordinate.
  11592. @item x2
  11593. Set 2nd rect x coordinate.
  11594. @item y2
  11595. Set 2nd rect y coordinate.
  11596. All expressions are evaluated once for each frame.
  11597. @end table
  11598. The all options are expressions containing the following constants:
  11599. @table @option
  11600. @item w
  11601. @item h
  11602. The input width and height.
  11603. @item a
  11604. same as @var{w} / @var{h}
  11605. @item sar
  11606. input sample aspect ratio
  11607. @item dar
  11608. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11609. @item n
  11610. The number of the input frame, starting from 0.
  11611. @item t
  11612. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11613. @item pos
  11614. the position in the file of the input frame, NAN if unknown
  11615. @end table
  11616. @section swapuv
  11617. Swap U & V plane.
  11618. @section telecine
  11619. Apply telecine process to the video.
  11620. This filter accepts the following options:
  11621. @table @option
  11622. @item first_field
  11623. @table @samp
  11624. @item top, t
  11625. top field first
  11626. @item bottom, b
  11627. bottom field first
  11628. The default value is @code{top}.
  11629. @end table
  11630. @item pattern
  11631. A string of numbers representing the pulldown pattern you wish to apply.
  11632. The default value is @code{23}.
  11633. @end table
  11634. @example
  11635. Some typical patterns:
  11636. NTSC output (30i):
  11637. 27.5p: 32222
  11638. 24p: 23 (classic)
  11639. 24p: 2332 (preferred)
  11640. 20p: 33
  11641. 18p: 334
  11642. 16p: 3444
  11643. PAL output (25i):
  11644. 27.5p: 12222
  11645. 24p: 222222222223 ("Euro pulldown")
  11646. 16.67p: 33
  11647. 16p: 33333334
  11648. @end example
  11649. @section threshold
  11650. Apply threshold effect to video stream.
  11651. This filter needs four video streams to perform thresholding.
  11652. First stream is stream we are filtering.
  11653. Second stream is holding threshold values, third stream is holding min values,
  11654. and last, fourth stream is holding max values.
  11655. The filter accepts the following option:
  11656. @table @option
  11657. @item planes
  11658. Set which planes will be processed, unprocessed planes will be copied.
  11659. By default value 0xf, all planes will be processed.
  11660. @end table
  11661. For example if first stream pixel's component value is less then threshold value
  11662. of pixel component from 2nd threshold stream, third stream value will picked,
  11663. otherwise fourth stream pixel component value will be picked.
  11664. Using color source filter one can perform various types of thresholding:
  11665. @subsection Examples
  11666. @itemize
  11667. @item
  11668. Binary threshold, using gray color as threshold:
  11669. @example
  11670. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11671. @end example
  11672. @item
  11673. Inverted binary threshold, using gray color as threshold:
  11674. @example
  11675. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11676. @end example
  11677. @item
  11678. Truncate binary threshold, using gray color as threshold:
  11679. @example
  11680. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11681. @end example
  11682. @item
  11683. Threshold to zero, using gray color as threshold:
  11684. @example
  11685. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11686. @end example
  11687. @item
  11688. Inverted threshold to zero, using gray color as threshold:
  11689. @example
  11690. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11691. @end example
  11692. @end itemize
  11693. @section thumbnail
  11694. Select the most representative frame in a given sequence of consecutive frames.
  11695. The filter accepts the following options:
  11696. @table @option
  11697. @item n
  11698. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11699. will pick one of them, and then handle the next batch of @var{n} frames until
  11700. the end. Default is @code{100}.
  11701. @end table
  11702. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11703. value will result in a higher memory usage, so a high value is not recommended.
  11704. @subsection Examples
  11705. @itemize
  11706. @item
  11707. Extract one picture each 50 frames:
  11708. @example
  11709. thumbnail=50
  11710. @end example
  11711. @item
  11712. Complete example of a thumbnail creation with @command{ffmpeg}:
  11713. @example
  11714. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11715. @end example
  11716. @end itemize
  11717. @section tile
  11718. Tile several successive frames together.
  11719. The filter accepts the following options:
  11720. @table @option
  11721. @item layout
  11722. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11723. this option, check the
  11724. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11725. @item nb_frames
  11726. Set the maximum number of frames to render in the given area. It must be less
  11727. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11728. the area will be used.
  11729. @item margin
  11730. Set the outer border margin in pixels.
  11731. @item padding
  11732. Set the inner border thickness (i.e. the number of pixels between frames). For
  11733. more advanced padding options (such as having different values for the edges),
  11734. refer to the pad video filter.
  11735. @item color
  11736. Specify the color of the unused area. For the syntax of this option, check the
  11737. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11738. The default value of @var{color} is "black".
  11739. @item overlap
  11740. Set the number of frames to overlap when tiling several successive frames together.
  11741. The value must be between @code{0} and @var{nb_frames - 1}.
  11742. @item init_padding
  11743. Set the number of frames to initially be empty before displaying first output frame.
  11744. This controls how soon will one get first output frame.
  11745. The value must be between @code{0} and @var{nb_frames - 1}.
  11746. @end table
  11747. @subsection Examples
  11748. @itemize
  11749. @item
  11750. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11751. @example
  11752. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11753. @end example
  11754. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11755. duplicating each output frame to accommodate the originally detected frame
  11756. rate.
  11757. @item
  11758. Display @code{5} pictures in an area of @code{3x2} frames,
  11759. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11760. mixed flat and named options:
  11761. @example
  11762. tile=3x2:nb_frames=5:padding=7:margin=2
  11763. @end example
  11764. @end itemize
  11765. @section tinterlace
  11766. Perform various types of temporal field interlacing.
  11767. Frames are counted starting from 1, so the first input frame is
  11768. considered odd.
  11769. The filter accepts the following options:
  11770. @table @option
  11771. @item mode
  11772. Specify the mode of the interlacing. This option can also be specified
  11773. as a value alone. See below for a list of values for this option.
  11774. Available values are:
  11775. @table @samp
  11776. @item merge, 0
  11777. Move odd frames into the upper field, even into the lower field,
  11778. generating a double height frame at half frame rate.
  11779. @example
  11780. ------> time
  11781. Input:
  11782. Frame 1 Frame 2 Frame 3 Frame 4
  11783. 11111 22222 33333 44444
  11784. 11111 22222 33333 44444
  11785. 11111 22222 33333 44444
  11786. 11111 22222 33333 44444
  11787. Output:
  11788. 11111 33333
  11789. 22222 44444
  11790. 11111 33333
  11791. 22222 44444
  11792. 11111 33333
  11793. 22222 44444
  11794. 11111 33333
  11795. 22222 44444
  11796. @end example
  11797. @item drop_even, 1
  11798. Only output odd frames, even frames are dropped, generating a frame with
  11799. unchanged height at half frame rate.
  11800. @example
  11801. ------> time
  11802. Input:
  11803. Frame 1 Frame 2 Frame 3 Frame 4
  11804. 11111 22222 33333 44444
  11805. 11111 22222 33333 44444
  11806. 11111 22222 33333 44444
  11807. 11111 22222 33333 44444
  11808. Output:
  11809. 11111 33333
  11810. 11111 33333
  11811. 11111 33333
  11812. 11111 33333
  11813. @end example
  11814. @item drop_odd, 2
  11815. Only output even frames, odd frames are dropped, generating a frame with
  11816. unchanged height at half frame rate.
  11817. @example
  11818. ------> time
  11819. Input:
  11820. Frame 1 Frame 2 Frame 3 Frame 4
  11821. 11111 22222 33333 44444
  11822. 11111 22222 33333 44444
  11823. 11111 22222 33333 44444
  11824. 11111 22222 33333 44444
  11825. Output:
  11826. 22222 44444
  11827. 22222 44444
  11828. 22222 44444
  11829. 22222 44444
  11830. @end example
  11831. @item pad, 3
  11832. Expand each frame to full height, but pad alternate lines with black,
  11833. generating a frame with double height at the same input frame rate.
  11834. @example
  11835. ------> time
  11836. Input:
  11837. Frame 1 Frame 2 Frame 3 Frame 4
  11838. 11111 22222 33333 44444
  11839. 11111 22222 33333 44444
  11840. 11111 22222 33333 44444
  11841. 11111 22222 33333 44444
  11842. Output:
  11843. 11111 ..... 33333 .....
  11844. ..... 22222 ..... 44444
  11845. 11111 ..... 33333 .....
  11846. ..... 22222 ..... 44444
  11847. 11111 ..... 33333 .....
  11848. ..... 22222 ..... 44444
  11849. 11111 ..... 33333 .....
  11850. ..... 22222 ..... 44444
  11851. @end example
  11852. @item interleave_top, 4
  11853. Interleave the upper field from odd frames with the lower field from
  11854. even frames, generating a frame with unchanged height at half frame rate.
  11855. @example
  11856. ------> time
  11857. Input:
  11858. Frame 1 Frame 2 Frame 3 Frame 4
  11859. 11111<- 22222 33333<- 44444
  11860. 11111 22222<- 33333 44444<-
  11861. 11111<- 22222 33333<- 44444
  11862. 11111 22222<- 33333 44444<-
  11863. Output:
  11864. 11111 33333
  11865. 22222 44444
  11866. 11111 33333
  11867. 22222 44444
  11868. @end example
  11869. @item interleave_bottom, 5
  11870. Interleave the lower field from odd frames with the upper field from
  11871. even frames, generating a frame with unchanged height at half frame rate.
  11872. @example
  11873. ------> time
  11874. Input:
  11875. Frame 1 Frame 2 Frame 3 Frame 4
  11876. 11111 22222<- 33333 44444<-
  11877. 11111<- 22222 33333<- 44444
  11878. 11111 22222<- 33333 44444<-
  11879. 11111<- 22222 33333<- 44444
  11880. Output:
  11881. 22222 44444
  11882. 11111 33333
  11883. 22222 44444
  11884. 11111 33333
  11885. @end example
  11886. @item interlacex2, 6
  11887. Double frame rate with unchanged height. Frames are inserted each
  11888. containing the second temporal field from the previous input frame and
  11889. the first temporal field from the next input frame. This mode relies on
  11890. the top_field_first flag. Useful for interlaced video displays with no
  11891. field synchronisation.
  11892. @example
  11893. ------> time
  11894. Input:
  11895. Frame 1 Frame 2 Frame 3 Frame 4
  11896. 11111 22222 33333 44444
  11897. 11111 22222 33333 44444
  11898. 11111 22222 33333 44444
  11899. 11111 22222 33333 44444
  11900. Output:
  11901. 11111 22222 22222 33333 33333 44444 44444
  11902. 11111 11111 22222 22222 33333 33333 44444
  11903. 11111 22222 22222 33333 33333 44444 44444
  11904. 11111 11111 22222 22222 33333 33333 44444
  11905. @end example
  11906. @item mergex2, 7
  11907. Move odd frames into the upper field, even into the lower field,
  11908. generating a double height frame at same frame rate.
  11909. @example
  11910. ------> time
  11911. Input:
  11912. Frame 1 Frame 2 Frame 3 Frame 4
  11913. 11111 22222 33333 44444
  11914. 11111 22222 33333 44444
  11915. 11111 22222 33333 44444
  11916. 11111 22222 33333 44444
  11917. Output:
  11918. 11111 33333 33333 55555
  11919. 22222 22222 44444 44444
  11920. 11111 33333 33333 55555
  11921. 22222 22222 44444 44444
  11922. 11111 33333 33333 55555
  11923. 22222 22222 44444 44444
  11924. 11111 33333 33333 55555
  11925. 22222 22222 44444 44444
  11926. @end example
  11927. @end table
  11928. Numeric values are deprecated but are accepted for backward
  11929. compatibility reasons.
  11930. Default mode is @code{merge}.
  11931. @item flags
  11932. Specify flags influencing the filter process.
  11933. Available value for @var{flags} is:
  11934. @table @option
  11935. @item low_pass_filter, vlfp
  11936. Enable linear vertical low-pass filtering in the filter.
  11937. Vertical low-pass filtering is required when creating an interlaced
  11938. destination from a progressive source which contains high-frequency
  11939. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11940. patterning.
  11941. @item complex_filter, cvlfp
  11942. Enable complex vertical low-pass filtering.
  11943. This will slightly less reduce interlace 'twitter' and Moire
  11944. patterning but better retain detail and subjective sharpness impression.
  11945. @end table
  11946. Vertical low-pass filtering can only be enabled for @option{mode}
  11947. @var{interleave_top} and @var{interleave_bottom}.
  11948. @end table
  11949. @section tmix
  11950. Mix successive video frames.
  11951. A description of the accepted options follows.
  11952. @table @option
  11953. @item frames
  11954. The number of successive frames to mix. If unspecified, it defaults to 3.
  11955. @item weights
  11956. Specify weight of each input video frame.
  11957. Each weight is separated by space. If number of weights is smaller than
  11958. number of @var{frames} last specified weight will be used for all remaining
  11959. unset weights.
  11960. @item scale
  11961. Specify scale, if it is set it will be multiplied with sum
  11962. of each weight multiplied with pixel values to give final destination
  11963. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11964. @end table
  11965. @subsection Examples
  11966. @itemize
  11967. @item
  11968. Average 7 successive frames:
  11969. @example
  11970. tmix=frames=7:weights="1 1 1 1 1 1 1"
  11971. @end example
  11972. @item
  11973. Apply simple temporal convolution:
  11974. @example
  11975. tmix=frames=3:weights="-1 3 -1"
  11976. @end example
  11977. @item
  11978. Similar as above but only showing temporal differences:
  11979. @example
  11980. tmix=frames=3:weights="-1 2 -1":scale=1
  11981. @end example
  11982. @end itemize
  11983. @section tonemap
  11984. Tone map colors from different dynamic ranges.
  11985. This filter expects data in single precision floating point, as it needs to
  11986. operate on (and can output) out-of-range values. Another filter, such as
  11987. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11988. The tonemapping algorithms implemented only work on linear light, so input
  11989. data should be linearized beforehand (and possibly correctly tagged).
  11990. @example
  11991. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11992. @end example
  11993. @subsection Options
  11994. The filter accepts the following options.
  11995. @table @option
  11996. @item tonemap
  11997. Set the tone map algorithm to use.
  11998. Possible values are:
  11999. @table @var
  12000. @item none
  12001. Do not apply any tone map, only desaturate overbright pixels.
  12002. @item clip
  12003. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12004. in-range values, while distorting out-of-range values.
  12005. @item linear
  12006. Stretch the entire reference gamut to a linear multiple of the display.
  12007. @item gamma
  12008. Fit a logarithmic transfer between the tone curves.
  12009. @item reinhard
  12010. Preserve overall image brightness with a simple curve, using nonlinear
  12011. contrast, which results in flattening details and degrading color accuracy.
  12012. @item hable
  12013. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12014. of slightly darkening everything. Use it when detail preservation is more
  12015. important than color and brightness accuracy.
  12016. @item mobius
  12017. Smoothly map out-of-range values, while retaining contrast and colors for
  12018. in-range material as much as possible. Use it when color accuracy is more
  12019. important than detail preservation.
  12020. @end table
  12021. Default is none.
  12022. @item param
  12023. Tune the tone mapping algorithm.
  12024. This affects the following algorithms:
  12025. @table @var
  12026. @item none
  12027. Ignored.
  12028. @item linear
  12029. Specifies the scale factor to use while stretching.
  12030. Default to 1.0.
  12031. @item gamma
  12032. Specifies the exponent of the function.
  12033. Default to 1.8.
  12034. @item clip
  12035. Specify an extra linear coefficient to multiply into the signal before clipping.
  12036. Default to 1.0.
  12037. @item reinhard
  12038. Specify the local contrast coefficient at the display peak.
  12039. Default to 0.5, which means that in-gamut values will be about half as bright
  12040. as when clipping.
  12041. @item hable
  12042. Ignored.
  12043. @item mobius
  12044. Specify the transition point from linear to mobius transform. Every value
  12045. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12046. more accurate the result will be, at the cost of losing bright details.
  12047. Default to 0.3, which due to the steep initial slope still preserves in-range
  12048. colors fairly accurately.
  12049. @end table
  12050. @item desat
  12051. Apply desaturation for highlights that exceed this level of brightness. The
  12052. higher the parameter, the more color information will be preserved. This
  12053. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12054. (smoothly) turning into white instead. This makes images feel more natural,
  12055. at the cost of reducing information about out-of-range colors.
  12056. The default of 2.0 is somewhat conservative and will mostly just apply to
  12057. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12058. This option works only if the input frame has a supported color tag.
  12059. @item peak
  12060. Override signal/nominal/reference peak with this value. Useful when the
  12061. embedded peak information in display metadata is not reliable or when tone
  12062. mapping from a lower range to a higher range.
  12063. @end table
  12064. @section transpose
  12065. Transpose rows with columns in the input video and optionally flip it.
  12066. It accepts the following parameters:
  12067. @table @option
  12068. @item dir
  12069. Specify the transposition direction.
  12070. Can assume the following values:
  12071. @table @samp
  12072. @item 0, 4, cclock_flip
  12073. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12074. @example
  12075. L.R L.l
  12076. . . -> . .
  12077. l.r R.r
  12078. @end example
  12079. @item 1, 5, clock
  12080. Rotate by 90 degrees clockwise, that is:
  12081. @example
  12082. L.R l.L
  12083. . . -> . .
  12084. l.r r.R
  12085. @end example
  12086. @item 2, 6, cclock
  12087. Rotate by 90 degrees counterclockwise, that is:
  12088. @example
  12089. L.R R.r
  12090. . . -> . .
  12091. l.r L.l
  12092. @end example
  12093. @item 3, 7, clock_flip
  12094. Rotate by 90 degrees clockwise and vertically flip, that is:
  12095. @example
  12096. L.R r.R
  12097. . . -> . .
  12098. l.r l.L
  12099. @end example
  12100. @end table
  12101. For values between 4-7, the transposition is only done if the input
  12102. video geometry is portrait and not landscape. These values are
  12103. deprecated, the @code{passthrough} option should be used instead.
  12104. Numerical values are deprecated, and should be dropped in favor of
  12105. symbolic constants.
  12106. @item passthrough
  12107. Do not apply the transposition if the input geometry matches the one
  12108. specified by the specified value. It accepts the following values:
  12109. @table @samp
  12110. @item none
  12111. Always apply transposition.
  12112. @item portrait
  12113. Preserve portrait geometry (when @var{height} >= @var{width}).
  12114. @item landscape
  12115. Preserve landscape geometry (when @var{width} >= @var{height}).
  12116. @end table
  12117. Default value is @code{none}.
  12118. @end table
  12119. For example to rotate by 90 degrees clockwise and preserve portrait
  12120. layout:
  12121. @example
  12122. transpose=dir=1:passthrough=portrait
  12123. @end example
  12124. The command above can also be specified as:
  12125. @example
  12126. transpose=1:portrait
  12127. @end example
  12128. @section trim
  12129. Trim the input so that the output contains one continuous subpart of the input.
  12130. It accepts the following parameters:
  12131. @table @option
  12132. @item start
  12133. Specify the time of the start of the kept section, i.e. the frame with the
  12134. timestamp @var{start} will be the first frame in the output.
  12135. @item end
  12136. Specify the time of the first frame that will be dropped, i.e. the frame
  12137. immediately preceding the one with the timestamp @var{end} will be the last
  12138. frame in the output.
  12139. @item start_pts
  12140. This is the same as @var{start}, except this option sets the start timestamp
  12141. in timebase units instead of seconds.
  12142. @item end_pts
  12143. This is the same as @var{end}, except this option sets the end timestamp
  12144. in timebase units instead of seconds.
  12145. @item duration
  12146. The maximum duration of the output in seconds.
  12147. @item start_frame
  12148. The number of the first frame that should be passed to the output.
  12149. @item end_frame
  12150. The number of the first frame that should be dropped.
  12151. @end table
  12152. @option{start}, @option{end}, and @option{duration} are expressed as time
  12153. duration specifications; see
  12154. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12155. for the accepted syntax.
  12156. Note that the first two sets of the start/end options and the @option{duration}
  12157. option look at the frame timestamp, while the _frame variants simply count the
  12158. frames that pass through the filter. Also note that this filter does not modify
  12159. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12160. setpts filter after the trim filter.
  12161. If multiple start or end options are set, this filter tries to be greedy and
  12162. keep all the frames that match at least one of the specified constraints. To keep
  12163. only the part that matches all the constraints at once, chain multiple trim
  12164. filters.
  12165. The defaults are such that all the input is kept. So it is possible to set e.g.
  12166. just the end values to keep everything before the specified time.
  12167. Examples:
  12168. @itemize
  12169. @item
  12170. Drop everything except the second minute of input:
  12171. @example
  12172. ffmpeg -i INPUT -vf trim=60:120
  12173. @end example
  12174. @item
  12175. Keep only the first second:
  12176. @example
  12177. ffmpeg -i INPUT -vf trim=duration=1
  12178. @end example
  12179. @end itemize
  12180. @section unpremultiply
  12181. Apply alpha unpremultiply effect to input video stream using first plane
  12182. of second stream as alpha.
  12183. Both streams must have same dimensions and same pixel format.
  12184. The filter accepts the following option:
  12185. @table @option
  12186. @item planes
  12187. Set which planes will be processed, unprocessed planes will be copied.
  12188. By default value 0xf, all planes will be processed.
  12189. If the format has 1 or 2 components, then luma is bit 0.
  12190. If the format has 3 or 4 components:
  12191. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12192. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12193. If present, the alpha channel is always the last bit.
  12194. @item inplace
  12195. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12196. @end table
  12197. @anchor{unsharp}
  12198. @section unsharp
  12199. Sharpen or blur the input video.
  12200. It accepts the following parameters:
  12201. @table @option
  12202. @item luma_msize_x, lx
  12203. Set the luma matrix horizontal size. It must be an odd integer between
  12204. 3 and 23. The default value is 5.
  12205. @item luma_msize_y, ly
  12206. Set the luma matrix vertical size. It must be an odd integer between 3
  12207. and 23. The default value is 5.
  12208. @item luma_amount, la
  12209. Set the luma effect strength. It must be a floating point number, reasonable
  12210. values lay between -1.5 and 1.5.
  12211. Negative values will blur the input video, while positive values will
  12212. sharpen it, a value of zero will disable the effect.
  12213. Default value is 1.0.
  12214. @item chroma_msize_x, cx
  12215. Set the chroma matrix horizontal size. It must be an odd integer
  12216. between 3 and 23. The default value is 5.
  12217. @item chroma_msize_y, cy
  12218. Set the chroma matrix vertical size. It must be an odd integer
  12219. between 3 and 23. The default value is 5.
  12220. @item chroma_amount, ca
  12221. Set the chroma effect strength. It must be a floating point number, reasonable
  12222. values lay between -1.5 and 1.5.
  12223. Negative values will blur the input video, while positive values will
  12224. sharpen it, a value of zero will disable the effect.
  12225. Default value is 0.0.
  12226. @end table
  12227. All parameters are optional and default to the equivalent of the
  12228. string '5:5:1.0:5:5:0.0'.
  12229. @subsection Examples
  12230. @itemize
  12231. @item
  12232. Apply strong luma sharpen effect:
  12233. @example
  12234. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12235. @end example
  12236. @item
  12237. Apply a strong blur of both luma and chroma parameters:
  12238. @example
  12239. unsharp=7:7:-2:7:7:-2
  12240. @end example
  12241. @end itemize
  12242. @section uspp
  12243. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12244. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12245. shifts and average the results.
  12246. The way this differs from the behavior of spp is that uspp actually encodes &
  12247. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12248. DCT similar to MJPEG.
  12249. The filter accepts the following options:
  12250. @table @option
  12251. @item quality
  12252. Set quality. This option defines the number of levels for averaging. It accepts
  12253. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12254. effect. A value of @code{8} means the higher quality. For each increment of
  12255. that value the speed drops by a factor of approximately 2. Default value is
  12256. @code{3}.
  12257. @item qp
  12258. Force a constant quantization parameter. If not set, the filter will use the QP
  12259. from the video stream (if available).
  12260. @end table
  12261. @section vaguedenoiser
  12262. Apply a wavelet based denoiser.
  12263. It transforms each frame from the video input into the wavelet domain,
  12264. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12265. the obtained coefficients. It does an inverse wavelet transform after.
  12266. Due to wavelet properties, it should give a nice smoothed result, and
  12267. reduced noise, without blurring picture features.
  12268. This filter accepts the following options:
  12269. @table @option
  12270. @item threshold
  12271. The filtering strength. The higher, the more filtered the video will be.
  12272. Hard thresholding can use a higher threshold than soft thresholding
  12273. before the video looks overfiltered. Default value is 2.
  12274. @item method
  12275. The filtering method the filter will use.
  12276. It accepts the following values:
  12277. @table @samp
  12278. @item hard
  12279. All values under the threshold will be zeroed.
  12280. @item soft
  12281. All values under the threshold will be zeroed. All values above will be
  12282. reduced by the threshold.
  12283. @item garrote
  12284. Scales or nullifies coefficients - intermediary between (more) soft and
  12285. (less) hard thresholding.
  12286. @end table
  12287. Default is garrote.
  12288. @item nsteps
  12289. Number of times, the wavelet will decompose the picture. Picture can't
  12290. be decomposed beyond a particular point (typically, 8 for a 640x480
  12291. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12292. @item percent
  12293. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12294. @item planes
  12295. A list of the planes to process. By default all planes are processed.
  12296. @end table
  12297. @section vectorscope
  12298. Display 2 color component values in the two dimensional graph (which is called
  12299. a vectorscope).
  12300. This filter accepts the following options:
  12301. @table @option
  12302. @item mode, m
  12303. Set vectorscope mode.
  12304. It accepts the following values:
  12305. @table @samp
  12306. @item gray
  12307. Gray values are displayed on graph, higher brightness means more pixels have
  12308. same component color value on location in graph. This is the default mode.
  12309. @item color
  12310. Gray values are displayed on graph. Surrounding pixels values which are not
  12311. present in video frame are drawn in gradient of 2 color components which are
  12312. set by option @code{x} and @code{y}. The 3rd color component is static.
  12313. @item color2
  12314. Actual color components values present in video frame are displayed on graph.
  12315. @item color3
  12316. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12317. on graph increases value of another color component, which is luminance by
  12318. default values of @code{x} and @code{y}.
  12319. @item color4
  12320. Actual colors present in video frame are displayed on graph. If two different
  12321. colors map to same position on graph then color with higher value of component
  12322. not present in graph is picked.
  12323. @item color5
  12324. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12325. component picked from radial gradient.
  12326. @end table
  12327. @item x
  12328. Set which color component will be represented on X-axis. Default is @code{1}.
  12329. @item y
  12330. Set which color component will be represented on Y-axis. Default is @code{2}.
  12331. @item intensity, i
  12332. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12333. of color component which represents frequency of (X, Y) location in graph.
  12334. @item envelope, e
  12335. @table @samp
  12336. @item none
  12337. No envelope, this is default.
  12338. @item instant
  12339. Instant envelope, even darkest single pixel will be clearly highlighted.
  12340. @item peak
  12341. Hold maximum and minimum values presented in graph over time. This way you
  12342. can still spot out of range values without constantly looking at vectorscope.
  12343. @item peak+instant
  12344. Peak and instant envelope combined together.
  12345. @end table
  12346. @item graticule, g
  12347. Set what kind of graticule to draw.
  12348. @table @samp
  12349. @item none
  12350. @item green
  12351. @item color
  12352. @end table
  12353. @item opacity, o
  12354. Set graticule opacity.
  12355. @item flags, f
  12356. Set graticule flags.
  12357. @table @samp
  12358. @item white
  12359. Draw graticule for white point.
  12360. @item black
  12361. Draw graticule for black point.
  12362. @item name
  12363. Draw color points short names.
  12364. @end table
  12365. @item bgopacity, b
  12366. Set background opacity.
  12367. @item lthreshold, l
  12368. Set low threshold for color component not represented on X or Y axis.
  12369. Values lower than this value will be ignored. Default is 0.
  12370. Note this value is multiplied with actual max possible value one pixel component
  12371. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12372. is 0.1 * 255 = 25.
  12373. @item hthreshold, h
  12374. Set high threshold for color component not represented on X or Y axis.
  12375. Values higher than this value will be ignored. Default is 1.
  12376. Note this value is multiplied with actual max possible value one pixel component
  12377. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12378. is 0.9 * 255 = 230.
  12379. @item colorspace, c
  12380. Set what kind of colorspace to use when drawing graticule.
  12381. @table @samp
  12382. @item auto
  12383. @item 601
  12384. @item 709
  12385. @end table
  12386. Default is auto.
  12387. @end table
  12388. @anchor{vidstabdetect}
  12389. @section vidstabdetect
  12390. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12391. @ref{vidstabtransform} for pass 2.
  12392. This filter generates a file with relative translation and rotation
  12393. transform information about subsequent frames, which is then used by
  12394. the @ref{vidstabtransform} filter.
  12395. To enable compilation of this filter you need to configure FFmpeg with
  12396. @code{--enable-libvidstab}.
  12397. This filter accepts the following options:
  12398. @table @option
  12399. @item result
  12400. Set the path to the file used to write the transforms information.
  12401. Default value is @file{transforms.trf}.
  12402. @item shakiness
  12403. Set how shaky the video is and how quick the camera is. It accepts an
  12404. integer in the range 1-10, a value of 1 means little shakiness, a
  12405. value of 10 means strong shakiness. Default value is 5.
  12406. @item accuracy
  12407. Set the accuracy of the detection process. It must be a value in the
  12408. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12409. accuracy. Default value is 15.
  12410. @item stepsize
  12411. Set stepsize of the search process. The region around minimum is
  12412. scanned with 1 pixel resolution. Default value is 6.
  12413. @item mincontrast
  12414. Set minimum contrast. Below this value a local measurement field is
  12415. discarded. Must be a floating point value in the range 0-1. Default
  12416. value is 0.3.
  12417. @item tripod
  12418. Set reference frame number for tripod mode.
  12419. If enabled, the motion of the frames is compared to a reference frame
  12420. in the filtered stream, identified by the specified number. The idea
  12421. is to compensate all movements in a more-or-less static scene and keep
  12422. the camera view absolutely still.
  12423. If set to 0, it is disabled. The frames are counted starting from 1.
  12424. @item show
  12425. Show fields and transforms in the resulting frames. It accepts an
  12426. integer in the range 0-2. Default value is 0, which disables any
  12427. visualization.
  12428. @end table
  12429. @subsection Examples
  12430. @itemize
  12431. @item
  12432. Use default values:
  12433. @example
  12434. vidstabdetect
  12435. @end example
  12436. @item
  12437. Analyze strongly shaky movie and put the results in file
  12438. @file{mytransforms.trf}:
  12439. @example
  12440. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12441. @end example
  12442. @item
  12443. Visualize the result of internal transformations in the resulting
  12444. video:
  12445. @example
  12446. vidstabdetect=show=1
  12447. @end example
  12448. @item
  12449. Analyze a video with medium shakiness using @command{ffmpeg}:
  12450. @example
  12451. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12452. @end example
  12453. @end itemize
  12454. @anchor{vidstabtransform}
  12455. @section vidstabtransform
  12456. Video stabilization/deshaking: pass 2 of 2,
  12457. see @ref{vidstabdetect} for pass 1.
  12458. Read a file with transform information for each frame and
  12459. apply/compensate them. Together with the @ref{vidstabdetect}
  12460. filter this can be used to deshake videos. See also
  12461. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12462. the @ref{unsharp} filter, see below.
  12463. To enable compilation of this filter you need to configure FFmpeg with
  12464. @code{--enable-libvidstab}.
  12465. @subsection Options
  12466. @table @option
  12467. @item input
  12468. Set path to the file used to read the transforms. Default value is
  12469. @file{transforms.trf}.
  12470. @item smoothing
  12471. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12472. camera movements. Default value is 10.
  12473. For example a number of 10 means that 21 frames are used (10 in the
  12474. past and 10 in the future) to smoothen the motion in the video. A
  12475. larger value leads to a smoother video, but limits the acceleration of
  12476. the camera (pan/tilt movements). 0 is a special case where a static
  12477. camera is simulated.
  12478. @item optalgo
  12479. Set the camera path optimization algorithm.
  12480. Accepted values are:
  12481. @table @samp
  12482. @item gauss
  12483. gaussian kernel low-pass filter on camera motion (default)
  12484. @item avg
  12485. averaging on transformations
  12486. @end table
  12487. @item maxshift
  12488. Set maximal number of pixels to translate frames. Default value is -1,
  12489. meaning no limit.
  12490. @item maxangle
  12491. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12492. value is -1, meaning no limit.
  12493. @item crop
  12494. Specify how to deal with borders that may be visible due to movement
  12495. compensation.
  12496. Available values are:
  12497. @table @samp
  12498. @item keep
  12499. keep image information from previous frame (default)
  12500. @item black
  12501. fill the border black
  12502. @end table
  12503. @item invert
  12504. Invert transforms if set to 1. Default value is 0.
  12505. @item relative
  12506. Consider transforms as relative to previous frame if set to 1,
  12507. absolute if set to 0. Default value is 0.
  12508. @item zoom
  12509. Set percentage to zoom. A positive value will result in a zoom-in
  12510. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12511. zoom).
  12512. @item optzoom
  12513. Set optimal zooming to avoid borders.
  12514. Accepted values are:
  12515. @table @samp
  12516. @item 0
  12517. disabled
  12518. @item 1
  12519. optimal static zoom value is determined (only very strong movements
  12520. will lead to visible borders) (default)
  12521. @item 2
  12522. optimal adaptive zoom value is determined (no borders will be
  12523. visible), see @option{zoomspeed}
  12524. @end table
  12525. Note that the value given at zoom is added to the one calculated here.
  12526. @item zoomspeed
  12527. Set percent to zoom maximally each frame (enabled when
  12528. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12529. 0.25.
  12530. @item interpol
  12531. Specify type of interpolation.
  12532. Available values are:
  12533. @table @samp
  12534. @item no
  12535. no interpolation
  12536. @item linear
  12537. linear only horizontal
  12538. @item bilinear
  12539. linear in both directions (default)
  12540. @item bicubic
  12541. cubic in both directions (slow)
  12542. @end table
  12543. @item tripod
  12544. Enable virtual tripod mode if set to 1, which is equivalent to
  12545. @code{relative=0:smoothing=0}. Default value is 0.
  12546. Use also @code{tripod} option of @ref{vidstabdetect}.
  12547. @item debug
  12548. Increase log verbosity if set to 1. Also the detected global motions
  12549. are written to the temporary file @file{global_motions.trf}. Default
  12550. value is 0.
  12551. @end table
  12552. @subsection Examples
  12553. @itemize
  12554. @item
  12555. Use @command{ffmpeg} for a typical stabilization with default values:
  12556. @example
  12557. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12558. @end example
  12559. Note the use of the @ref{unsharp} filter which is always recommended.
  12560. @item
  12561. Zoom in a bit more and load transform data from a given file:
  12562. @example
  12563. vidstabtransform=zoom=5:input="mytransforms.trf"
  12564. @end example
  12565. @item
  12566. Smoothen the video even more:
  12567. @example
  12568. vidstabtransform=smoothing=30
  12569. @end example
  12570. @end itemize
  12571. @section vflip
  12572. Flip the input video vertically.
  12573. For example, to vertically flip a video with @command{ffmpeg}:
  12574. @example
  12575. ffmpeg -i in.avi -vf "vflip" out.avi
  12576. @end example
  12577. @section vfrdet
  12578. Detect variable frame rate video.
  12579. This filter tries to detect if the input is variable or constant frame rate.
  12580. At end it will output number of frames detected as having variable delta pts,
  12581. and ones with constant delta pts.
  12582. If there was frames with variable delta, than it will also show min and max delta
  12583. encountered.
  12584. @anchor{vignette}
  12585. @section vignette
  12586. Make or reverse a natural vignetting effect.
  12587. The filter accepts the following options:
  12588. @table @option
  12589. @item angle, a
  12590. Set lens angle expression as a number of radians.
  12591. The value is clipped in the @code{[0,PI/2]} range.
  12592. Default value: @code{"PI/5"}
  12593. @item x0
  12594. @item y0
  12595. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12596. by default.
  12597. @item mode
  12598. Set forward/backward mode.
  12599. Available modes are:
  12600. @table @samp
  12601. @item forward
  12602. The larger the distance from the central point, the darker the image becomes.
  12603. @item backward
  12604. The larger the distance from the central point, the brighter the image becomes.
  12605. This can be used to reverse a vignette effect, though there is no automatic
  12606. detection to extract the lens @option{angle} and other settings (yet). It can
  12607. also be used to create a burning effect.
  12608. @end table
  12609. Default value is @samp{forward}.
  12610. @item eval
  12611. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12612. It accepts the following values:
  12613. @table @samp
  12614. @item init
  12615. Evaluate expressions only once during the filter initialization.
  12616. @item frame
  12617. Evaluate expressions for each incoming frame. This is way slower than the
  12618. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12619. allows advanced dynamic expressions.
  12620. @end table
  12621. Default value is @samp{init}.
  12622. @item dither
  12623. Set dithering to reduce the circular banding effects. Default is @code{1}
  12624. (enabled).
  12625. @item aspect
  12626. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12627. Setting this value to the SAR of the input will make a rectangular vignetting
  12628. following the dimensions of the video.
  12629. Default is @code{1/1}.
  12630. @end table
  12631. @subsection Expressions
  12632. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12633. following parameters.
  12634. @table @option
  12635. @item w
  12636. @item h
  12637. input width and height
  12638. @item n
  12639. the number of input frame, starting from 0
  12640. @item pts
  12641. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12642. @var{TB} units, NAN if undefined
  12643. @item r
  12644. frame rate of the input video, NAN if the input frame rate is unknown
  12645. @item t
  12646. the PTS (Presentation TimeStamp) of the filtered video frame,
  12647. expressed in seconds, NAN if undefined
  12648. @item tb
  12649. time base of the input video
  12650. @end table
  12651. @subsection Examples
  12652. @itemize
  12653. @item
  12654. Apply simple strong vignetting effect:
  12655. @example
  12656. vignette=PI/4
  12657. @end example
  12658. @item
  12659. Make a flickering vignetting:
  12660. @example
  12661. vignette='PI/4+random(1)*PI/50':eval=frame
  12662. @end example
  12663. @end itemize
  12664. @section vmafmotion
  12665. Obtain the average vmaf motion score of a video.
  12666. It is one of the component filters of VMAF.
  12667. The obtained average motion score is printed through the logging system.
  12668. In the below example the input file @file{ref.mpg} is being processed and score
  12669. is computed.
  12670. @example
  12671. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12672. @end example
  12673. @section vstack
  12674. Stack input videos vertically.
  12675. All streams must be of same pixel format and of same width.
  12676. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12677. to create same output.
  12678. The filter accept the following option:
  12679. @table @option
  12680. @item inputs
  12681. Set number of input streams. Default is 2.
  12682. @item shortest
  12683. If set to 1, force the output to terminate when the shortest input
  12684. terminates. Default value is 0.
  12685. @end table
  12686. @section w3fdif
  12687. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12688. Deinterlacing Filter").
  12689. Based on the process described by Martin Weston for BBC R&D, and
  12690. implemented based on the de-interlace algorithm written by Jim
  12691. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12692. uses filter coefficients calculated by BBC R&D.
  12693. There are two sets of filter coefficients, so called "simple":
  12694. and "complex". Which set of filter coefficients is used can
  12695. be set by passing an optional parameter:
  12696. @table @option
  12697. @item filter
  12698. Set the interlacing filter coefficients. Accepts one of the following values:
  12699. @table @samp
  12700. @item simple
  12701. Simple filter coefficient set.
  12702. @item complex
  12703. More-complex filter coefficient set.
  12704. @end table
  12705. Default value is @samp{complex}.
  12706. @item deint
  12707. Specify which frames to deinterlace. Accept one of the following values:
  12708. @table @samp
  12709. @item all
  12710. Deinterlace all frames,
  12711. @item interlaced
  12712. Only deinterlace frames marked as interlaced.
  12713. @end table
  12714. Default value is @samp{all}.
  12715. @end table
  12716. @section waveform
  12717. Video waveform monitor.
  12718. The waveform monitor plots color component intensity. By default luminance
  12719. only. Each column of the waveform corresponds to a column of pixels in the
  12720. source video.
  12721. It accepts the following options:
  12722. @table @option
  12723. @item mode, m
  12724. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12725. In row mode, the graph on the left side represents color component value 0 and
  12726. the right side represents value = 255. In column mode, the top side represents
  12727. color component value = 0 and bottom side represents value = 255.
  12728. @item intensity, i
  12729. Set intensity. Smaller values are useful to find out how many values of the same
  12730. luminance are distributed across input rows/columns.
  12731. Default value is @code{0.04}. Allowed range is [0, 1].
  12732. @item mirror, r
  12733. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12734. In mirrored mode, higher values will be represented on the left
  12735. side for @code{row} mode and at the top for @code{column} mode. Default is
  12736. @code{1} (mirrored).
  12737. @item display, d
  12738. Set display mode.
  12739. It accepts the following values:
  12740. @table @samp
  12741. @item overlay
  12742. Presents information identical to that in the @code{parade}, except
  12743. that the graphs representing color components are superimposed directly
  12744. over one another.
  12745. This display mode makes it easier to spot relative differences or similarities
  12746. in overlapping areas of the color components that are supposed to be identical,
  12747. such as neutral whites, grays, or blacks.
  12748. @item stack
  12749. Display separate graph for the color components side by side in
  12750. @code{row} mode or one below the other in @code{column} mode.
  12751. @item parade
  12752. Display separate graph for the color components side by side in
  12753. @code{column} mode or one below the other in @code{row} mode.
  12754. Using this display mode makes it easy to spot color casts in the highlights
  12755. and shadows of an image, by comparing the contours of the top and the bottom
  12756. graphs of each waveform. Since whites, grays, and blacks are characterized
  12757. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12758. should display three waveforms of roughly equal width/height. If not, the
  12759. correction is easy to perform by making level adjustments the three waveforms.
  12760. @end table
  12761. Default is @code{stack}.
  12762. @item components, c
  12763. Set which color components to display. Default is 1, which means only luminance
  12764. or red color component if input is in RGB colorspace. If is set for example to
  12765. 7 it will display all 3 (if) available color components.
  12766. @item envelope, e
  12767. @table @samp
  12768. @item none
  12769. No envelope, this is default.
  12770. @item instant
  12771. Instant envelope, minimum and maximum values presented in graph will be easily
  12772. visible even with small @code{step} value.
  12773. @item peak
  12774. Hold minimum and maximum values presented in graph across time. This way you
  12775. can still spot out of range values without constantly looking at waveforms.
  12776. @item peak+instant
  12777. Peak and instant envelope combined together.
  12778. @end table
  12779. @item filter, f
  12780. @table @samp
  12781. @item lowpass
  12782. No filtering, this is default.
  12783. @item flat
  12784. Luma and chroma combined together.
  12785. @item aflat
  12786. Similar as above, but shows difference between blue and red chroma.
  12787. @item xflat
  12788. Similar as above, but use different colors.
  12789. @item chroma
  12790. Displays only chroma.
  12791. @item color
  12792. Displays actual color value on waveform.
  12793. @item acolor
  12794. Similar as above, but with luma showing frequency of chroma values.
  12795. @end table
  12796. @item graticule, g
  12797. Set which graticule to display.
  12798. @table @samp
  12799. @item none
  12800. Do not display graticule.
  12801. @item green
  12802. Display green graticule showing legal broadcast ranges.
  12803. @item orange
  12804. Display orange graticule showing legal broadcast ranges.
  12805. @end table
  12806. @item opacity, o
  12807. Set graticule opacity.
  12808. @item flags, fl
  12809. Set graticule flags.
  12810. @table @samp
  12811. @item numbers
  12812. Draw numbers above lines. By default enabled.
  12813. @item dots
  12814. Draw dots instead of lines.
  12815. @end table
  12816. @item scale, s
  12817. Set scale used for displaying graticule.
  12818. @table @samp
  12819. @item digital
  12820. @item millivolts
  12821. @item ire
  12822. @end table
  12823. Default is digital.
  12824. @item bgopacity, b
  12825. Set background opacity.
  12826. @end table
  12827. @section weave, doubleweave
  12828. The @code{weave} takes a field-based video input and join
  12829. each two sequential fields into single frame, producing a new double
  12830. height clip with half the frame rate and half the frame count.
  12831. The @code{doubleweave} works same as @code{weave} but without
  12832. halving frame rate and frame count.
  12833. It accepts the following option:
  12834. @table @option
  12835. @item first_field
  12836. Set first field. Available values are:
  12837. @table @samp
  12838. @item top, t
  12839. Set the frame as top-field-first.
  12840. @item bottom, b
  12841. Set the frame as bottom-field-first.
  12842. @end table
  12843. @end table
  12844. @subsection Examples
  12845. @itemize
  12846. @item
  12847. Interlace video using @ref{select} and @ref{separatefields} filter:
  12848. @example
  12849. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12850. @end example
  12851. @end itemize
  12852. @section xbr
  12853. Apply the xBR high-quality magnification filter which is designed for pixel
  12854. art. It follows a set of edge-detection rules, see
  12855. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12856. It accepts the following option:
  12857. @table @option
  12858. @item n
  12859. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12860. @code{3xBR} and @code{4} for @code{4xBR}.
  12861. Default is @code{3}.
  12862. @end table
  12863. @anchor{yadif}
  12864. @section yadif
  12865. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12866. filter").
  12867. It accepts the following parameters:
  12868. @table @option
  12869. @item mode
  12870. The interlacing mode to adopt. It accepts one of the following values:
  12871. @table @option
  12872. @item 0, send_frame
  12873. Output one frame for each frame.
  12874. @item 1, send_field
  12875. Output one frame for each field.
  12876. @item 2, send_frame_nospatial
  12877. Like @code{send_frame}, but it skips the spatial interlacing check.
  12878. @item 3, send_field_nospatial
  12879. Like @code{send_field}, but it skips the spatial interlacing check.
  12880. @end table
  12881. The default value is @code{send_frame}.
  12882. @item parity
  12883. The picture field parity assumed for the input interlaced video. It accepts one
  12884. of the following values:
  12885. @table @option
  12886. @item 0, tff
  12887. Assume the top field is first.
  12888. @item 1, bff
  12889. Assume the bottom field is first.
  12890. @item -1, auto
  12891. Enable automatic detection of field parity.
  12892. @end table
  12893. The default value is @code{auto}.
  12894. If the interlacing is unknown or the decoder does not export this information,
  12895. top field first will be assumed.
  12896. @item deint
  12897. Specify which frames to deinterlace. Accept one of the following
  12898. values:
  12899. @table @option
  12900. @item 0, all
  12901. Deinterlace all frames.
  12902. @item 1, interlaced
  12903. Only deinterlace frames marked as interlaced.
  12904. @end table
  12905. The default value is @code{all}.
  12906. @end table
  12907. @section zoompan
  12908. Apply Zoom & Pan effect.
  12909. This filter accepts the following options:
  12910. @table @option
  12911. @item zoom, z
  12912. Set the zoom expression. Default is 1.
  12913. @item x
  12914. @item y
  12915. Set the x and y expression. Default is 0.
  12916. @item d
  12917. Set the duration expression in number of frames.
  12918. This sets for how many number of frames effect will last for
  12919. single input image.
  12920. @item s
  12921. Set the output image size, default is 'hd720'.
  12922. @item fps
  12923. Set the output frame rate, default is '25'.
  12924. @end table
  12925. Each expression can contain the following constants:
  12926. @table @option
  12927. @item in_w, iw
  12928. Input width.
  12929. @item in_h, ih
  12930. Input height.
  12931. @item out_w, ow
  12932. Output width.
  12933. @item out_h, oh
  12934. Output height.
  12935. @item in
  12936. Input frame count.
  12937. @item on
  12938. Output frame count.
  12939. @item x
  12940. @item y
  12941. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12942. for current input frame.
  12943. @item px
  12944. @item py
  12945. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12946. not yet such frame (first input frame).
  12947. @item zoom
  12948. Last calculated zoom from 'z' expression for current input frame.
  12949. @item pzoom
  12950. Last calculated zoom of last output frame of previous input frame.
  12951. @item duration
  12952. Number of output frames for current input frame. Calculated from 'd' expression
  12953. for each input frame.
  12954. @item pduration
  12955. number of output frames created for previous input frame
  12956. @item a
  12957. Rational number: input width / input height
  12958. @item sar
  12959. sample aspect ratio
  12960. @item dar
  12961. display aspect ratio
  12962. @end table
  12963. @subsection Examples
  12964. @itemize
  12965. @item
  12966. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12967. @example
  12968. 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
  12969. @end example
  12970. @item
  12971. Zoom-in up to 1.5 and pan always at center of picture:
  12972. @example
  12973. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12974. @end example
  12975. @item
  12976. Same as above but without pausing:
  12977. @example
  12978. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12979. @end example
  12980. @end itemize
  12981. @anchor{zscale}
  12982. @section zscale
  12983. Scale (resize) the input video, using the z.lib library:
  12984. https://github.com/sekrit-twc/zimg.
  12985. The zscale filter forces the output display aspect ratio to be the same
  12986. as the input, by changing the output sample aspect ratio.
  12987. If the input image format is different from the format requested by
  12988. the next filter, the zscale filter will convert the input to the
  12989. requested format.
  12990. @subsection Options
  12991. The filter accepts the following options.
  12992. @table @option
  12993. @item width, w
  12994. @item height, h
  12995. Set the output video dimension expression. Default value is the input
  12996. dimension.
  12997. If the @var{width} or @var{w} value is 0, the input width is used for
  12998. the output. If the @var{height} or @var{h} value is 0, the input height
  12999. is used for the output.
  13000. If one and only one of the values is -n with n >= 1, the zscale filter
  13001. will use a value that maintains the aspect ratio of the input image,
  13002. calculated from the other specified dimension. After that it will,
  13003. however, make sure that the calculated dimension is divisible by n and
  13004. adjust the value if necessary.
  13005. If both values are -n with n >= 1, the behavior will be identical to
  13006. both values being set to 0 as previously detailed.
  13007. See below for the list of accepted constants for use in the dimension
  13008. expression.
  13009. @item size, s
  13010. Set the video size. For the syntax of this option, check the
  13011. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13012. @item dither, d
  13013. Set the dither type.
  13014. Possible values are:
  13015. @table @var
  13016. @item none
  13017. @item ordered
  13018. @item random
  13019. @item error_diffusion
  13020. @end table
  13021. Default is none.
  13022. @item filter, f
  13023. Set the resize filter type.
  13024. Possible values are:
  13025. @table @var
  13026. @item point
  13027. @item bilinear
  13028. @item bicubic
  13029. @item spline16
  13030. @item spline36
  13031. @item lanczos
  13032. @end table
  13033. Default is bilinear.
  13034. @item range, r
  13035. Set the color range.
  13036. Possible values are:
  13037. @table @var
  13038. @item input
  13039. @item limited
  13040. @item full
  13041. @end table
  13042. Default is same as input.
  13043. @item primaries, p
  13044. Set the color primaries.
  13045. Possible values are:
  13046. @table @var
  13047. @item input
  13048. @item 709
  13049. @item unspecified
  13050. @item 170m
  13051. @item 240m
  13052. @item 2020
  13053. @end table
  13054. Default is same as input.
  13055. @item transfer, t
  13056. Set the transfer characteristics.
  13057. Possible values are:
  13058. @table @var
  13059. @item input
  13060. @item 709
  13061. @item unspecified
  13062. @item 601
  13063. @item linear
  13064. @item 2020_10
  13065. @item 2020_12
  13066. @item smpte2084
  13067. @item iec61966-2-1
  13068. @item arib-std-b67
  13069. @end table
  13070. Default is same as input.
  13071. @item matrix, m
  13072. Set the colorspace matrix.
  13073. Possible value are:
  13074. @table @var
  13075. @item input
  13076. @item 709
  13077. @item unspecified
  13078. @item 470bg
  13079. @item 170m
  13080. @item 2020_ncl
  13081. @item 2020_cl
  13082. @end table
  13083. Default is same as input.
  13084. @item rangein, rin
  13085. Set the input color range.
  13086. Possible values are:
  13087. @table @var
  13088. @item input
  13089. @item limited
  13090. @item full
  13091. @end table
  13092. Default is same as input.
  13093. @item primariesin, pin
  13094. Set the input color primaries.
  13095. Possible values are:
  13096. @table @var
  13097. @item input
  13098. @item 709
  13099. @item unspecified
  13100. @item 170m
  13101. @item 240m
  13102. @item 2020
  13103. @end table
  13104. Default is same as input.
  13105. @item transferin, tin
  13106. Set the input transfer characteristics.
  13107. Possible values are:
  13108. @table @var
  13109. @item input
  13110. @item 709
  13111. @item unspecified
  13112. @item 601
  13113. @item linear
  13114. @item 2020_10
  13115. @item 2020_12
  13116. @end table
  13117. Default is same as input.
  13118. @item matrixin, min
  13119. Set the input colorspace matrix.
  13120. Possible value are:
  13121. @table @var
  13122. @item input
  13123. @item 709
  13124. @item unspecified
  13125. @item 470bg
  13126. @item 170m
  13127. @item 2020_ncl
  13128. @item 2020_cl
  13129. @end table
  13130. @item chromal, c
  13131. Set the output chroma location.
  13132. Possible values are:
  13133. @table @var
  13134. @item input
  13135. @item left
  13136. @item center
  13137. @item topleft
  13138. @item top
  13139. @item bottomleft
  13140. @item bottom
  13141. @end table
  13142. @item chromalin, cin
  13143. Set the input chroma location.
  13144. Possible values are:
  13145. @table @var
  13146. @item input
  13147. @item left
  13148. @item center
  13149. @item topleft
  13150. @item top
  13151. @item bottomleft
  13152. @item bottom
  13153. @end table
  13154. @item npl
  13155. Set the nominal peak luminance.
  13156. @end table
  13157. The values of the @option{w} and @option{h} options are expressions
  13158. containing the following constants:
  13159. @table @var
  13160. @item in_w
  13161. @item in_h
  13162. The input width and height
  13163. @item iw
  13164. @item ih
  13165. These are the same as @var{in_w} and @var{in_h}.
  13166. @item out_w
  13167. @item out_h
  13168. The output (scaled) width and height
  13169. @item ow
  13170. @item oh
  13171. These are the same as @var{out_w} and @var{out_h}
  13172. @item a
  13173. The same as @var{iw} / @var{ih}
  13174. @item sar
  13175. input sample aspect ratio
  13176. @item dar
  13177. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13178. @item hsub
  13179. @item vsub
  13180. horizontal and vertical input chroma subsample values. For example for the
  13181. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13182. @item ohsub
  13183. @item ovsub
  13184. horizontal and vertical output chroma subsample values. For example for the
  13185. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13186. @end table
  13187. @table @option
  13188. @end table
  13189. @c man end VIDEO FILTERS
  13190. @chapter Video Sources
  13191. @c man begin VIDEO SOURCES
  13192. Below is a description of the currently available video sources.
  13193. @section buffer
  13194. Buffer video frames, and make them available to the filter chain.
  13195. This source is mainly intended for a programmatic use, in particular
  13196. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13197. It accepts the following parameters:
  13198. @table @option
  13199. @item video_size
  13200. Specify the size (width and height) of the buffered video frames. For the
  13201. syntax of this option, check the
  13202. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13203. @item width
  13204. The input video width.
  13205. @item height
  13206. The input video height.
  13207. @item pix_fmt
  13208. A string representing the pixel format of the buffered video frames.
  13209. It may be a number corresponding to a pixel format, or a pixel format
  13210. name.
  13211. @item time_base
  13212. Specify the timebase assumed by the timestamps of the buffered frames.
  13213. @item frame_rate
  13214. Specify the frame rate expected for the video stream.
  13215. @item pixel_aspect, sar
  13216. The sample (pixel) aspect ratio of the input video.
  13217. @item sws_param
  13218. Specify the optional parameters to be used for the scale filter which
  13219. is automatically inserted when an input change is detected in the
  13220. input size or format.
  13221. @item hw_frames_ctx
  13222. When using a hardware pixel format, this should be a reference to an
  13223. AVHWFramesContext describing input frames.
  13224. @end table
  13225. For example:
  13226. @example
  13227. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13228. @end example
  13229. will instruct the source to accept video frames with size 320x240 and
  13230. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13231. square pixels (1:1 sample aspect ratio).
  13232. Since the pixel format with name "yuv410p" corresponds to the number 6
  13233. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13234. this example corresponds to:
  13235. @example
  13236. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13237. @end example
  13238. Alternatively, the options can be specified as a flat string, but this
  13239. syntax is deprecated:
  13240. @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}]
  13241. @section cellauto
  13242. Create a pattern generated by an elementary cellular automaton.
  13243. The initial state of the cellular automaton can be defined through the
  13244. @option{filename} and @option{pattern} options. If such options are
  13245. not specified an initial state is created randomly.
  13246. At each new frame a new row in the video is filled with the result of
  13247. the cellular automaton next generation. The behavior when the whole
  13248. frame is filled is defined by the @option{scroll} option.
  13249. This source accepts the following options:
  13250. @table @option
  13251. @item filename, f
  13252. Read the initial cellular automaton state, i.e. the starting row, from
  13253. the specified file.
  13254. In the file, each non-whitespace character is considered an alive
  13255. cell, a newline will terminate the row, and further characters in the
  13256. file will be ignored.
  13257. @item pattern, p
  13258. Read the initial cellular automaton state, i.e. the starting row, from
  13259. the specified string.
  13260. Each non-whitespace character in the string is considered an alive
  13261. cell, a newline will terminate the row, and further characters in the
  13262. string will be ignored.
  13263. @item rate, r
  13264. Set the video rate, that is the number of frames generated per second.
  13265. Default is 25.
  13266. @item random_fill_ratio, ratio
  13267. Set the random fill ratio for the initial cellular automaton row. It
  13268. is a floating point number value ranging from 0 to 1, defaults to
  13269. 1/PHI.
  13270. This option is ignored when a file or a pattern is specified.
  13271. @item random_seed, seed
  13272. Set the seed for filling randomly the initial row, must be an integer
  13273. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13274. set to -1, the filter will try to use a good random seed on a best
  13275. effort basis.
  13276. @item rule
  13277. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13278. Default value is 110.
  13279. @item size, s
  13280. Set the size of the output video. For the syntax of this option, check the
  13281. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13282. If @option{filename} or @option{pattern} is specified, the size is set
  13283. by default to the width of the specified initial state row, and the
  13284. height is set to @var{width} * PHI.
  13285. If @option{size} is set, it must contain the width of the specified
  13286. pattern string, and the specified pattern will be centered in the
  13287. larger row.
  13288. If a filename or a pattern string is not specified, the size value
  13289. defaults to "320x518" (used for a randomly generated initial state).
  13290. @item scroll
  13291. If set to 1, scroll the output upward when all the rows in the output
  13292. have been already filled. If set to 0, the new generated row will be
  13293. written over the top row just after the bottom row is filled.
  13294. Defaults to 1.
  13295. @item start_full, full
  13296. If set to 1, completely fill the output with generated rows before
  13297. outputting the first frame.
  13298. This is the default behavior, for disabling set the value to 0.
  13299. @item stitch
  13300. If set to 1, stitch the left and right row edges together.
  13301. This is the default behavior, for disabling set the value to 0.
  13302. @end table
  13303. @subsection Examples
  13304. @itemize
  13305. @item
  13306. Read the initial state from @file{pattern}, and specify an output of
  13307. size 200x400.
  13308. @example
  13309. cellauto=f=pattern:s=200x400
  13310. @end example
  13311. @item
  13312. Generate a random initial row with a width of 200 cells, with a fill
  13313. ratio of 2/3:
  13314. @example
  13315. cellauto=ratio=2/3:s=200x200
  13316. @end example
  13317. @item
  13318. Create a pattern generated by rule 18 starting by a single alive cell
  13319. centered on an initial row with width 100:
  13320. @example
  13321. cellauto=p=@@:s=100x400:full=0:rule=18
  13322. @end example
  13323. @item
  13324. Specify a more elaborated initial pattern:
  13325. @example
  13326. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13327. @end example
  13328. @end itemize
  13329. @anchor{coreimagesrc}
  13330. @section coreimagesrc
  13331. Video source generated on GPU using Apple's CoreImage API on OSX.
  13332. This video source is a specialized version of the @ref{coreimage} video filter.
  13333. Use a core image generator at the beginning of the applied filterchain to
  13334. generate the content.
  13335. The coreimagesrc video source accepts the following options:
  13336. @table @option
  13337. @item list_generators
  13338. List all available generators along with all their respective options as well as
  13339. possible minimum and maximum values along with the default values.
  13340. @example
  13341. list_generators=true
  13342. @end example
  13343. @item size, s
  13344. Specify the size of the sourced video. For the syntax of this option, check the
  13345. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13346. The default value is @code{320x240}.
  13347. @item rate, r
  13348. Specify the frame rate of the sourced video, as the number of frames
  13349. generated per second. It has to be a string in the format
  13350. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13351. number or a valid video frame rate abbreviation. The default value is
  13352. "25".
  13353. @item sar
  13354. Set the sample aspect ratio of the sourced video.
  13355. @item duration, d
  13356. Set the duration of the sourced video. See
  13357. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13358. for the accepted syntax.
  13359. If not specified, or the expressed duration is negative, the video is
  13360. supposed to be generated forever.
  13361. @end table
  13362. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13363. A complete filterchain can be used for further processing of the
  13364. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13365. and examples for details.
  13366. @subsection Examples
  13367. @itemize
  13368. @item
  13369. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13370. given as complete and escaped command-line for Apple's standard bash shell:
  13371. @example
  13372. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13373. @end example
  13374. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13375. need for a nullsrc video source.
  13376. @end itemize
  13377. @section mandelbrot
  13378. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13379. point specified with @var{start_x} and @var{start_y}.
  13380. This source accepts the following options:
  13381. @table @option
  13382. @item end_pts
  13383. Set the terminal pts value. Default value is 400.
  13384. @item end_scale
  13385. Set the terminal scale value.
  13386. Must be a floating point value. Default value is 0.3.
  13387. @item inner
  13388. Set the inner coloring mode, that is the algorithm used to draw the
  13389. Mandelbrot fractal internal region.
  13390. It shall assume one of the following values:
  13391. @table @option
  13392. @item black
  13393. Set black mode.
  13394. @item convergence
  13395. Show time until convergence.
  13396. @item mincol
  13397. Set color based on point closest to the origin of the iterations.
  13398. @item period
  13399. Set period mode.
  13400. @end table
  13401. Default value is @var{mincol}.
  13402. @item bailout
  13403. Set the bailout value. Default value is 10.0.
  13404. @item maxiter
  13405. Set the maximum of iterations performed by the rendering
  13406. algorithm. Default value is 7189.
  13407. @item outer
  13408. Set outer coloring mode.
  13409. It shall assume one of following values:
  13410. @table @option
  13411. @item iteration_count
  13412. Set iteration cound mode.
  13413. @item normalized_iteration_count
  13414. set normalized iteration count mode.
  13415. @end table
  13416. Default value is @var{normalized_iteration_count}.
  13417. @item rate, r
  13418. Set frame rate, expressed as number of frames per second. Default
  13419. value is "25".
  13420. @item size, s
  13421. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13422. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13423. @item start_scale
  13424. Set the initial scale value. Default value is 3.0.
  13425. @item start_x
  13426. Set the initial x position. Must be a floating point value between
  13427. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13428. @item start_y
  13429. Set the initial y position. Must be a floating point value between
  13430. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13431. @end table
  13432. @section mptestsrc
  13433. Generate various test patterns, as generated by the MPlayer test filter.
  13434. The size of the generated video is fixed, and is 256x256.
  13435. This source is useful in particular for testing encoding features.
  13436. This source accepts the following options:
  13437. @table @option
  13438. @item rate, r
  13439. Specify the frame rate of the sourced video, as the number of frames
  13440. generated per second. It has to be a string in the format
  13441. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13442. number or a valid video frame rate abbreviation. The default value is
  13443. "25".
  13444. @item duration, d
  13445. Set the duration of the sourced video. See
  13446. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13447. for the accepted syntax.
  13448. If not specified, or the expressed duration is negative, the video is
  13449. supposed to be generated forever.
  13450. @item test, t
  13451. Set the number or the name of the test to perform. Supported tests are:
  13452. @table @option
  13453. @item dc_luma
  13454. @item dc_chroma
  13455. @item freq_luma
  13456. @item freq_chroma
  13457. @item amp_luma
  13458. @item amp_chroma
  13459. @item cbp
  13460. @item mv
  13461. @item ring1
  13462. @item ring2
  13463. @item all
  13464. @end table
  13465. Default value is "all", which will cycle through the list of all tests.
  13466. @end table
  13467. Some examples:
  13468. @example
  13469. mptestsrc=t=dc_luma
  13470. @end example
  13471. will generate a "dc_luma" test pattern.
  13472. @section frei0r_src
  13473. Provide a frei0r source.
  13474. To enable compilation of this filter you need to install the frei0r
  13475. header and configure FFmpeg with @code{--enable-frei0r}.
  13476. This source accepts the following parameters:
  13477. @table @option
  13478. @item size
  13479. The size of the video to generate. For the syntax of this option, check the
  13480. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13481. @item framerate
  13482. The framerate of the generated video. It may be a string of the form
  13483. @var{num}/@var{den} or a frame rate abbreviation.
  13484. @item filter_name
  13485. The name to the frei0r source to load. For more information regarding frei0r and
  13486. how to set the parameters, read the @ref{frei0r} section in the video filters
  13487. documentation.
  13488. @item filter_params
  13489. A '|'-separated list of parameters to pass to the frei0r source.
  13490. @end table
  13491. For example, to generate a frei0r partik0l source with size 200x200
  13492. and frame rate 10 which is overlaid on the overlay filter main input:
  13493. @example
  13494. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13495. @end example
  13496. @section life
  13497. Generate a life pattern.
  13498. This source is based on a generalization of John Conway's life game.
  13499. The sourced input represents a life grid, each pixel represents a cell
  13500. which can be in one of two possible states, alive or dead. Every cell
  13501. interacts with its eight neighbours, which are the cells that are
  13502. horizontally, vertically, or diagonally adjacent.
  13503. At each interaction the grid evolves according to the adopted rule,
  13504. which specifies the number of neighbor alive cells which will make a
  13505. cell stay alive or born. The @option{rule} option allows one to specify
  13506. the rule to adopt.
  13507. This source accepts the following options:
  13508. @table @option
  13509. @item filename, f
  13510. Set the file from which to read the initial grid state. In the file,
  13511. each non-whitespace character is considered an alive cell, and newline
  13512. is used to delimit the end of each row.
  13513. If this option is not specified, the initial grid is generated
  13514. randomly.
  13515. @item rate, r
  13516. Set the video rate, that is the number of frames generated per second.
  13517. Default is 25.
  13518. @item random_fill_ratio, ratio
  13519. Set the random fill ratio for the initial random grid. It is a
  13520. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13521. It is ignored when a file is specified.
  13522. @item random_seed, seed
  13523. Set the seed for filling the initial random grid, must be an integer
  13524. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13525. set to -1, the filter will try to use a good random seed on a best
  13526. effort basis.
  13527. @item rule
  13528. Set the life rule.
  13529. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13530. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13531. @var{NS} specifies the number of alive neighbor cells which make a
  13532. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13533. which make a dead cell to become alive (i.e. to "born").
  13534. "s" and "b" can be used in place of "S" and "B", respectively.
  13535. Alternatively a rule can be specified by an 18-bits integer. The 9
  13536. high order bits are used to encode the next cell state if it is alive
  13537. for each number of neighbor alive cells, the low order bits specify
  13538. the rule for "borning" new cells. Higher order bits encode for an
  13539. higher number of neighbor cells.
  13540. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13541. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13542. Default value is "S23/B3", which is the original Conway's game of life
  13543. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13544. cells, and will born a new cell if there are three alive cells around
  13545. a dead cell.
  13546. @item size, s
  13547. Set the size of the output video. For the syntax of this option, check the
  13548. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13549. If @option{filename} is specified, the size is set by default to the
  13550. same size of the input file. If @option{size} is set, it must contain
  13551. the size specified in the input file, and the initial grid defined in
  13552. that file is centered in the larger resulting area.
  13553. If a filename is not specified, the size value defaults to "320x240"
  13554. (used for a randomly generated initial grid).
  13555. @item stitch
  13556. If set to 1, stitch the left and right grid edges together, and the
  13557. top and bottom edges also. Defaults to 1.
  13558. @item mold
  13559. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13560. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13561. value from 0 to 255.
  13562. @item life_color
  13563. Set the color of living (or new born) cells.
  13564. @item death_color
  13565. Set the color of dead cells. If @option{mold} is set, this is the first color
  13566. used to represent a dead cell.
  13567. @item mold_color
  13568. Set mold color, for definitely dead and moldy cells.
  13569. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13570. ffmpeg-utils manual,ffmpeg-utils}.
  13571. @end table
  13572. @subsection Examples
  13573. @itemize
  13574. @item
  13575. Read a grid from @file{pattern}, and center it on a grid of size
  13576. 300x300 pixels:
  13577. @example
  13578. life=f=pattern:s=300x300
  13579. @end example
  13580. @item
  13581. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13582. @example
  13583. life=ratio=2/3:s=200x200
  13584. @end example
  13585. @item
  13586. Specify a custom rule for evolving a randomly generated grid:
  13587. @example
  13588. life=rule=S14/B34
  13589. @end example
  13590. @item
  13591. Full example with slow death effect (mold) using @command{ffplay}:
  13592. @example
  13593. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13594. @end example
  13595. @end itemize
  13596. @anchor{allrgb}
  13597. @anchor{allyuv}
  13598. @anchor{color}
  13599. @anchor{haldclutsrc}
  13600. @anchor{nullsrc}
  13601. @anchor{pal75bars}
  13602. @anchor{pal100bars}
  13603. @anchor{rgbtestsrc}
  13604. @anchor{smptebars}
  13605. @anchor{smptehdbars}
  13606. @anchor{testsrc}
  13607. @anchor{testsrc2}
  13608. @anchor{yuvtestsrc}
  13609. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13610. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13611. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13612. The @code{color} source provides an uniformly colored input.
  13613. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13614. @ref{haldclut} filter.
  13615. The @code{nullsrc} source returns unprocessed video frames. It is
  13616. mainly useful to be employed in analysis / debugging tools, or as the
  13617. source for filters which ignore the input data.
  13618. The @code{pal75bars} source generates a color bars pattern, based on
  13619. EBU PAL recommendations with 75% color levels.
  13620. The @code{pal100bars} source generates a color bars pattern, based on
  13621. EBU PAL recommendations with 100% color levels.
  13622. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13623. detecting RGB vs BGR issues. You should see a red, green and blue
  13624. stripe from top to bottom.
  13625. The @code{smptebars} source generates a color bars pattern, based on
  13626. the SMPTE Engineering Guideline EG 1-1990.
  13627. The @code{smptehdbars} source generates a color bars pattern, based on
  13628. the SMPTE RP 219-2002.
  13629. The @code{testsrc} source generates a test video pattern, showing a
  13630. color pattern, a scrolling gradient and a timestamp. This is mainly
  13631. intended for testing purposes.
  13632. The @code{testsrc2} source is similar to testsrc, but supports more
  13633. pixel formats instead of just @code{rgb24}. This allows using it as an
  13634. input for other tests without requiring a format conversion.
  13635. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13636. see a y, cb and cr stripe from top to bottom.
  13637. The sources accept the following parameters:
  13638. @table @option
  13639. @item level
  13640. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13641. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13642. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13643. coded on a @code{1/(N*N)} scale.
  13644. @item color, c
  13645. Specify the color of the source, only available in the @code{color}
  13646. source. For the syntax of this option, check the
  13647. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13648. @item size, s
  13649. Specify the size of the sourced video. For the syntax of this option, check the
  13650. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13651. The default value is @code{320x240}.
  13652. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13653. @code{haldclutsrc} filters.
  13654. @item rate, r
  13655. Specify the frame rate of the sourced video, as the number of frames
  13656. generated per second. It has to be a string in the format
  13657. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13658. number or a valid video frame rate abbreviation. The default value is
  13659. "25".
  13660. @item duration, d
  13661. Set the duration of the sourced video. See
  13662. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13663. for the accepted syntax.
  13664. If not specified, or the expressed duration is negative, the video is
  13665. supposed to be generated forever.
  13666. @item sar
  13667. Set the sample aspect ratio of the sourced video.
  13668. @item alpha
  13669. Specify the alpha (opacity) of the background, only available in the
  13670. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13671. 255 (fully opaque, the default).
  13672. @item decimals, n
  13673. Set the number of decimals to show in the timestamp, only available in the
  13674. @code{testsrc} source.
  13675. The displayed timestamp value will correspond to the original
  13676. timestamp value multiplied by the power of 10 of the specified
  13677. value. Default value is 0.
  13678. @end table
  13679. @subsection Examples
  13680. @itemize
  13681. @item
  13682. Generate a video with a duration of 5.3 seconds, with size
  13683. 176x144 and a frame rate of 10 frames per second:
  13684. @example
  13685. testsrc=duration=5.3:size=qcif:rate=10
  13686. @end example
  13687. @item
  13688. The following graph description will generate a red source
  13689. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13690. frames per second:
  13691. @example
  13692. color=c=red@@0.2:s=qcif:r=10
  13693. @end example
  13694. @item
  13695. If the input content is to be ignored, @code{nullsrc} can be used. The
  13696. following command generates noise in the luminance plane by employing
  13697. the @code{geq} filter:
  13698. @example
  13699. nullsrc=s=256x256, geq=random(1)*255:128:128
  13700. @end example
  13701. @end itemize
  13702. @subsection Commands
  13703. The @code{color} source supports the following commands:
  13704. @table @option
  13705. @item c, color
  13706. Set the color of the created image. Accepts the same syntax of the
  13707. corresponding @option{color} option.
  13708. @end table
  13709. @section openclsrc
  13710. Generate video using an OpenCL program.
  13711. @table @option
  13712. @item source
  13713. OpenCL program source file.
  13714. @item kernel
  13715. Kernel name in program.
  13716. @item size, s
  13717. Size of frames to generate. This must be set.
  13718. @item format
  13719. Pixel format to use for the generated frames. This must be set.
  13720. @item rate, r
  13721. Number of frames generated every second. Default value is '25'.
  13722. @end table
  13723. For details of how the program loading works, see the @ref{program_opencl}
  13724. filter.
  13725. Example programs:
  13726. @itemize
  13727. @item
  13728. Generate a colour ramp by setting pixel values from the position of the pixel
  13729. in the output image. (Note that this will work with all pixel formats, but
  13730. the generated output will not be the same.)
  13731. @verbatim
  13732. __kernel void ramp(__write_only image2d_t dst,
  13733. unsigned int index)
  13734. {
  13735. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13736. float4 val;
  13737. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13738. write_imagef(dst, loc, val);
  13739. }
  13740. @end verbatim
  13741. @item
  13742. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13743. @verbatim
  13744. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13745. unsigned int index)
  13746. {
  13747. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13748. float4 value = 0.0f;
  13749. int x = loc.x + index;
  13750. int y = loc.y + index;
  13751. while (x > 0 || y > 0) {
  13752. if (x % 3 == 1 && y % 3 == 1) {
  13753. value = 1.0f;
  13754. break;
  13755. }
  13756. x /= 3;
  13757. y /= 3;
  13758. }
  13759. write_imagef(dst, loc, value);
  13760. }
  13761. @end verbatim
  13762. @end itemize
  13763. @c man end VIDEO SOURCES
  13764. @chapter Video Sinks
  13765. @c man begin VIDEO SINKS
  13766. Below is a description of the currently available video sinks.
  13767. @section buffersink
  13768. Buffer video frames, and make them available to the end of the filter
  13769. graph.
  13770. This sink is mainly intended for programmatic use, in particular
  13771. through the interface defined in @file{libavfilter/buffersink.h}
  13772. or the options system.
  13773. It accepts a pointer to an AVBufferSinkContext structure, which
  13774. defines the incoming buffers' formats, to be passed as the opaque
  13775. parameter to @code{avfilter_init_filter} for initialization.
  13776. @section nullsink
  13777. Null video sink: do absolutely nothing with the input video. It is
  13778. mainly useful as a template and for use in analysis / debugging
  13779. tools.
  13780. @c man end VIDEO SINKS
  13781. @chapter Multimedia Filters
  13782. @c man begin MULTIMEDIA FILTERS
  13783. Below is a description of the currently available multimedia filters.
  13784. @section abitscope
  13785. Convert input audio to a video output, displaying the audio bit scope.
  13786. The filter accepts the following options:
  13787. @table @option
  13788. @item rate, r
  13789. Set frame rate, expressed as number of frames per second. Default
  13790. value is "25".
  13791. @item size, s
  13792. Specify the video size for the output. For the syntax of this option, check the
  13793. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13794. Default value is @code{1024x256}.
  13795. @item colors
  13796. Specify list of colors separated by space or by '|' which will be used to
  13797. draw channels. Unrecognized or missing colors will be replaced
  13798. by white color.
  13799. @end table
  13800. @section ahistogram
  13801. Convert input audio to a video output, displaying the volume histogram.
  13802. The filter accepts the following options:
  13803. @table @option
  13804. @item dmode
  13805. Specify how histogram is calculated.
  13806. It accepts the following values:
  13807. @table @samp
  13808. @item single
  13809. Use single histogram for all channels.
  13810. @item separate
  13811. Use separate histogram for each channel.
  13812. @end table
  13813. Default is @code{single}.
  13814. @item rate, r
  13815. Set frame rate, expressed as number of frames per second. Default
  13816. value is "25".
  13817. @item size, s
  13818. Specify the video size for the output. For the syntax of this option, check the
  13819. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13820. Default value is @code{hd720}.
  13821. @item scale
  13822. Set display scale.
  13823. It accepts the following values:
  13824. @table @samp
  13825. @item log
  13826. logarithmic
  13827. @item sqrt
  13828. square root
  13829. @item cbrt
  13830. cubic root
  13831. @item lin
  13832. linear
  13833. @item rlog
  13834. reverse logarithmic
  13835. @end table
  13836. Default is @code{log}.
  13837. @item ascale
  13838. Set amplitude scale.
  13839. It accepts the following values:
  13840. @table @samp
  13841. @item log
  13842. logarithmic
  13843. @item lin
  13844. linear
  13845. @end table
  13846. Default is @code{log}.
  13847. @item acount
  13848. Set how much frames to accumulate in histogram.
  13849. Defauls is 1. Setting this to -1 accumulates all frames.
  13850. @item rheight
  13851. Set histogram ratio of window height.
  13852. @item slide
  13853. Set sonogram sliding.
  13854. It accepts the following values:
  13855. @table @samp
  13856. @item replace
  13857. replace old rows with new ones.
  13858. @item scroll
  13859. scroll from top to bottom.
  13860. @end table
  13861. Default is @code{replace}.
  13862. @end table
  13863. @section aphasemeter
  13864. Convert input audio to a video output, displaying the audio phase.
  13865. The filter accepts the following options:
  13866. @table @option
  13867. @item rate, r
  13868. Set the output frame rate. Default value is @code{25}.
  13869. @item size, s
  13870. Set the video size for the output. For the syntax of this option, check the
  13871. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13872. Default value is @code{800x400}.
  13873. @item rc
  13874. @item gc
  13875. @item bc
  13876. Specify the red, green, blue contrast. Default values are @code{2},
  13877. @code{7} and @code{1}.
  13878. Allowed range is @code{[0, 255]}.
  13879. @item mpc
  13880. Set color which will be used for drawing median phase. If color is
  13881. @code{none} which is default, no median phase value will be drawn.
  13882. @item video
  13883. Enable video output. Default is enabled.
  13884. @end table
  13885. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13886. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13887. The @code{-1} means left and right channels are completely out of phase and
  13888. @code{1} means channels are in phase.
  13889. @section avectorscope
  13890. Convert input audio to a video output, representing the audio vector
  13891. scope.
  13892. The filter is used to measure the difference between channels of stereo
  13893. audio stream. A monoaural signal, consisting of identical left and right
  13894. signal, results in straight vertical line. Any stereo separation is visible
  13895. as a deviation from this line, creating a Lissajous figure.
  13896. If the straight (or deviation from it) but horizontal line appears this
  13897. indicates that the left and right channels are out of phase.
  13898. The filter accepts the following options:
  13899. @table @option
  13900. @item mode, m
  13901. Set the vectorscope mode.
  13902. Available values are:
  13903. @table @samp
  13904. @item lissajous
  13905. Lissajous rotated by 45 degrees.
  13906. @item lissajous_xy
  13907. Same as above but not rotated.
  13908. @item polar
  13909. Shape resembling half of circle.
  13910. @end table
  13911. Default value is @samp{lissajous}.
  13912. @item size, s
  13913. Set the video size for the output. For the syntax of this option, check the
  13914. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13915. Default value is @code{400x400}.
  13916. @item rate, r
  13917. Set the output frame rate. Default value is @code{25}.
  13918. @item rc
  13919. @item gc
  13920. @item bc
  13921. @item ac
  13922. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13923. @code{160}, @code{80} and @code{255}.
  13924. Allowed range is @code{[0, 255]}.
  13925. @item rf
  13926. @item gf
  13927. @item bf
  13928. @item af
  13929. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13930. @code{10}, @code{5} and @code{5}.
  13931. Allowed range is @code{[0, 255]}.
  13932. @item zoom
  13933. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13934. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13935. @item draw
  13936. Set the vectorscope drawing mode.
  13937. Available values are:
  13938. @table @samp
  13939. @item dot
  13940. Draw dot for each sample.
  13941. @item line
  13942. Draw line between previous and current sample.
  13943. @end table
  13944. Default value is @samp{dot}.
  13945. @item scale
  13946. Specify amplitude scale of audio samples.
  13947. Available values are:
  13948. @table @samp
  13949. @item lin
  13950. Linear.
  13951. @item sqrt
  13952. Square root.
  13953. @item cbrt
  13954. Cubic root.
  13955. @item log
  13956. Logarithmic.
  13957. @end table
  13958. @item swap
  13959. Swap left channel axis with right channel axis.
  13960. @item mirror
  13961. Mirror axis.
  13962. @table @samp
  13963. @item none
  13964. No mirror.
  13965. @item x
  13966. Mirror only x axis.
  13967. @item y
  13968. Mirror only y axis.
  13969. @item xy
  13970. Mirror both axis.
  13971. @end table
  13972. @end table
  13973. @subsection Examples
  13974. @itemize
  13975. @item
  13976. Complete example using @command{ffplay}:
  13977. @example
  13978. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13979. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13980. @end example
  13981. @end itemize
  13982. @section bench, abench
  13983. Benchmark part of a filtergraph.
  13984. The filter accepts the following options:
  13985. @table @option
  13986. @item action
  13987. Start or stop a timer.
  13988. Available values are:
  13989. @table @samp
  13990. @item start
  13991. Get the current time, set it as frame metadata (using the key
  13992. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13993. @item stop
  13994. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13995. the input frame metadata to get the time difference. Time difference, average,
  13996. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13997. @code{min}) are then printed. The timestamps are expressed in seconds.
  13998. @end table
  13999. @end table
  14000. @subsection Examples
  14001. @itemize
  14002. @item
  14003. Benchmark @ref{selectivecolor} filter:
  14004. @example
  14005. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14006. @end example
  14007. @end itemize
  14008. @section concat
  14009. Concatenate audio and video streams, joining them together one after the
  14010. other.
  14011. The filter works on segments of synchronized video and audio streams. All
  14012. segments must have the same number of streams of each type, and that will
  14013. also be the number of streams at output.
  14014. The filter accepts the following options:
  14015. @table @option
  14016. @item n
  14017. Set the number of segments. Default is 2.
  14018. @item v
  14019. Set the number of output video streams, that is also the number of video
  14020. streams in each segment. Default is 1.
  14021. @item a
  14022. Set the number of output audio streams, that is also the number of audio
  14023. streams in each segment. Default is 0.
  14024. @item unsafe
  14025. Activate unsafe mode: do not fail if segments have a different format.
  14026. @end table
  14027. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14028. @var{a} audio outputs.
  14029. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14030. segment, in the same order as the outputs, then the inputs for the second
  14031. segment, etc.
  14032. Related streams do not always have exactly the same duration, for various
  14033. reasons including codec frame size or sloppy authoring. For that reason,
  14034. related synchronized streams (e.g. a video and its audio track) should be
  14035. concatenated at once. The concat filter will use the duration of the longest
  14036. stream in each segment (except the last one), and if necessary pad shorter
  14037. audio streams with silence.
  14038. For this filter to work correctly, all segments must start at timestamp 0.
  14039. All corresponding streams must have the same parameters in all segments; the
  14040. filtering system will automatically select a common pixel format for video
  14041. streams, and a common sample format, sample rate and channel layout for
  14042. audio streams, but other settings, such as resolution, must be converted
  14043. explicitly by the user.
  14044. Different frame rates are acceptable but will result in variable frame rate
  14045. at output; be sure to configure the output file to handle it.
  14046. @subsection Examples
  14047. @itemize
  14048. @item
  14049. Concatenate an opening, an episode and an ending, all in bilingual version
  14050. (video in stream 0, audio in streams 1 and 2):
  14051. @example
  14052. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14053. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14054. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14055. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14056. @end example
  14057. @item
  14058. Concatenate two parts, handling audio and video separately, using the
  14059. (a)movie sources, and adjusting the resolution:
  14060. @example
  14061. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14062. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14063. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14064. @end example
  14065. Note that a desync will happen at the stitch if the audio and video streams
  14066. do not have exactly the same duration in the first file.
  14067. @end itemize
  14068. @subsection Commands
  14069. This filter supports the following commands:
  14070. @table @option
  14071. @item next
  14072. Close the current segment and step to the next one
  14073. @end table
  14074. @section drawgraph, adrawgraph
  14075. Draw a graph using input video or audio metadata.
  14076. It accepts the following parameters:
  14077. @table @option
  14078. @item m1
  14079. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14080. @item fg1
  14081. Set 1st foreground color expression.
  14082. @item m2
  14083. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14084. @item fg2
  14085. Set 2nd foreground color expression.
  14086. @item m3
  14087. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14088. @item fg3
  14089. Set 3rd foreground color expression.
  14090. @item m4
  14091. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14092. @item fg4
  14093. Set 4th foreground color expression.
  14094. @item min
  14095. Set minimal value of metadata value.
  14096. @item max
  14097. Set maximal value of metadata value.
  14098. @item bg
  14099. Set graph background color. Default is white.
  14100. @item mode
  14101. Set graph mode.
  14102. Available values for mode is:
  14103. @table @samp
  14104. @item bar
  14105. @item dot
  14106. @item line
  14107. @end table
  14108. Default is @code{line}.
  14109. @item slide
  14110. Set slide mode.
  14111. Available values for slide is:
  14112. @table @samp
  14113. @item frame
  14114. Draw new frame when right border is reached.
  14115. @item replace
  14116. Replace old columns with new ones.
  14117. @item scroll
  14118. Scroll from right to left.
  14119. @item rscroll
  14120. Scroll from left to right.
  14121. @item picture
  14122. Draw single picture.
  14123. @end table
  14124. Default is @code{frame}.
  14125. @item size
  14126. Set size of graph video. For the syntax of this option, check the
  14127. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14128. The default value is @code{900x256}.
  14129. The foreground color expressions can use the following variables:
  14130. @table @option
  14131. @item MIN
  14132. Minimal value of metadata value.
  14133. @item MAX
  14134. Maximal value of metadata value.
  14135. @item VAL
  14136. Current metadata key value.
  14137. @end table
  14138. The color is defined as 0xAABBGGRR.
  14139. @end table
  14140. Example using metadata from @ref{signalstats} filter:
  14141. @example
  14142. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14143. @end example
  14144. Example using metadata from @ref{ebur128} filter:
  14145. @example
  14146. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14147. @end example
  14148. @anchor{ebur128}
  14149. @section ebur128
  14150. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14151. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14152. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14153. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14154. The filter also has a video output (see the @var{video} option) with a real
  14155. time graph to observe the loudness evolution. The graphic contains the logged
  14156. message mentioned above, so it is not printed anymore when this option is set,
  14157. unless the verbose logging is set. The main graphing area contains the
  14158. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14159. the momentary loudness (400 milliseconds).
  14160. More information about the Loudness Recommendation EBU R128 on
  14161. @url{http://tech.ebu.ch/loudness}.
  14162. The filter accepts the following options:
  14163. @table @option
  14164. @item video
  14165. Activate the video output. The audio stream is passed unchanged whether this
  14166. option is set or no. The video stream will be the first output stream if
  14167. activated. Default is @code{0}.
  14168. @item size
  14169. Set the video size. This option is for video only. For the syntax of this
  14170. option, check the
  14171. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14172. Default and minimum resolution is @code{640x480}.
  14173. @item meter
  14174. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14175. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14176. other integer value between this range is allowed.
  14177. @item metadata
  14178. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14179. into 100ms output frames, each of them containing various loudness information
  14180. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14181. Default is @code{0}.
  14182. @item framelog
  14183. Force the frame logging level.
  14184. Available values are:
  14185. @table @samp
  14186. @item info
  14187. information logging level
  14188. @item verbose
  14189. verbose logging level
  14190. @end table
  14191. By default, the logging level is set to @var{info}. If the @option{video} or
  14192. the @option{metadata} options are set, it switches to @var{verbose}.
  14193. @item peak
  14194. Set peak mode(s).
  14195. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14196. values are:
  14197. @table @samp
  14198. @item none
  14199. Disable any peak mode (default).
  14200. @item sample
  14201. Enable sample-peak mode.
  14202. Simple peak mode looking for the higher sample value. It logs a message
  14203. for sample-peak (identified by @code{SPK}).
  14204. @item true
  14205. Enable true-peak mode.
  14206. If enabled, the peak lookup is done on an over-sampled version of the input
  14207. stream for better peak accuracy. It logs a message for true-peak.
  14208. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14209. This mode requires a build with @code{libswresample}.
  14210. @end table
  14211. @item dualmono
  14212. Treat mono input files as "dual mono". If a mono file is intended for playback
  14213. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14214. If set to @code{true}, this option will compensate for this effect.
  14215. Multi-channel input files are not affected by this option.
  14216. @item panlaw
  14217. Set a specific pan law to be used for the measurement of dual mono files.
  14218. This parameter is optional, and has a default value of -3.01dB.
  14219. @end table
  14220. @subsection Examples
  14221. @itemize
  14222. @item
  14223. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14224. @example
  14225. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14226. @end example
  14227. @item
  14228. Run an analysis with @command{ffmpeg}:
  14229. @example
  14230. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14231. @end example
  14232. @end itemize
  14233. @section interleave, ainterleave
  14234. Temporally interleave frames from several inputs.
  14235. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14236. These filters read frames from several inputs and send the oldest
  14237. queued frame to the output.
  14238. Input streams must have well defined, monotonically increasing frame
  14239. timestamp values.
  14240. In order to submit one frame to output, these filters need to enqueue
  14241. at least one frame for each input, so they cannot work in case one
  14242. input is not yet terminated and will not receive incoming frames.
  14243. For example consider the case when one input is a @code{select} filter
  14244. which always drops input frames. The @code{interleave} filter will keep
  14245. reading from that input, but it will never be able to send new frames
  14246. to output until the input sends an end-of-stream signal.
  14247. Also, depending on inputs synchronization, the filters will drop
  14248. frames in case one input receives more frames than the other ones, and
  14249. the queue is already filled.
  14250. These filters accept the following options:
  14251. @table @option
  14252. @item nb_inputs, n
  14253. Set the number of different inputs, it is 2 by default.
  14254. @end table
  14255. @subsection Examples
  14256. @itemize
  14257. @item
  14258. Interleave frames belonging to different streams using @command{ffmpeg}:
  14259. @example
  14260. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14261. @end example
  14262. @item
  14263. Add flickering blur effect:
  14264. @example
  14265. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14266. @end example
  14267. @end itemize
  14268. @section metadata, ametadata
  14269. Manipulate frame metadata.
  14270. This filter accepts the following options:
  14271. @table @option
  14272. @item mode
  14273. Set mode of operation of the filter.
  14274. Can be one of the following:
  14275. @table @samp
  14276. @item select
  14277. If both @code{value} and @code{key} is set, select frames
  14278. which have such metadata. If only @code{key} is set, select
  14279. every frame that has such key in metadata.
  14280. @item add
  14281. Add new metadata @code{key} and @code{value}. If key is already available
  14282. do nothing.
  14283. @item modify
  14284. Modify value of already present key.
  14285. @item delete
  14286. If @code{value} is set, delete only keys that have such value.
  14287. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14288. the frame.
  14289. @item print
  14290. Print key and its value if metadata was found. If @code{key} is not set print all
  14291. metadata values available in frame.
  14292. @end table
  14293. @item key
  14294. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14295. @item value
  14296. Set metadata value which will be used. This option is mandatory for
  14297. @code{modify} and @code{add} mode.
  14298. @item function
  14299. Which function to use when comparing metadata value and @code{value}.
  14300. Can be one of following:
  14301. @table @samp
  14302. @item same_str
  14303. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14304. @item starts_with
  14305. Values are interpreted as strings, returns true if metadata value starts with
  14306. the @code{value} option string.
  14307. @item less
  14308. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14309. @item equal
  14310. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14311. @item greater
  14312. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14313. @item expr
  14314. Values are interpreted as floats, returns true if expression from option @code{expr}
  14315. evaluates to true.
  14316. @end table
  14317. @item expr
  14318. Set expression which is used when @code{function} is set to @code{expr}.
  14319. The expression is evaluated through the eval API and can contain the following
  14320. constants:
  14321. @table @option
  14322. @item VALUE1
  14323. Float representation of @code{value} from metadata key.
  14324. @item VALUE2
  14325. Float representation of @code{value} as supplied by user in @code{value} option.
  14326. @end table
  14327. @item file
  14328. If specified in @code{print} mode, output is written to the named file. Instead of
  14329. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14330. for standard output. If @code{file} option is not set, output is written to the log
  14331. with AV_LOG_INFO loglevel.
  14332. @end table
  14333. @subsection Examples
  14334. @itemize
  14335. @item
  14336. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14337. between 0 and 1.
  14338. @example
  14339. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14340. @end example
  14341. @item
  14342. Print silencedetect output to file @file{metadata.txt}.
  14343. @example
  14344. silencedetect,ametadata=mode=print:file=metadata.txt
  14345. @end example
  14346. @item
  14347. Direct all metadata to a pipe with file descriptor 4.
  14348. @example
  14349. metadata=mode=print:file='pipe\:4'
  14350. @end example
  14351. @end itemize
  14352. @section perms, aperms
  14353. Set read/write permissions for the output frames.
  14354. These filters are mainly aimed at developers to test direct path in the
  14355. following filter in the filtergraph.
  14356. The filters accept the following options:
  14357. @table @option
  14358. @item mode
  14359. Select the permissions mode.
  14360. It accepts the following values:
  14361. @table @samp
  14362. @item none
  14363. Do nothing. This is the default.
  14364. @item ro
  14365. Set all the output frames read-only.
  14366. @item rw
  14367. Set all the output frames directly writable.
  14368. @item toggle
  14369. Make the frame read-only if writable, and writable if read-only.
  14370. @item random
  14371. Set each output frame read-only or writable randomly.
  14372. @end table
  14373. @item seed
  14374. Set the seed for the @var{random} mode, must be an integer included between
  14375. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14376. @code{-1}, the filter will try to use a good random seed on a best effort
  14377. basis.
  14378. @end table
  14379. Note: in case of auto-inserted filter between the permission filter and the
  14380. following one, the permission might not be received as expected in that
  14381. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14382. perms/aperms filter can avoid this problem.
  14383. @section realtime, arealtime
  14384. Slow down filtering to match real time approximately.
  14385. These filters will pause the filtering for a variable amount of time to
  14386. match the output rate with the input timestamps.
  14387. They are similar to the @option{re} option to @code{ffmpeg}.
  14388. They accept the following options:
  14389. @table @option
  14390. @item limit
  14391. Time limit for the pauses. Any pause longer than that will be considered
  14392. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14393. @end table
  14394. @anchor{select}
  14395. @section select, aselect
  14396. Select frames to pass in output.
  14397. This filter accepts the following options:
  14398. @table @option
  14399. @item expr, e
  14400. Set expression, which is evaluated for each input frame.
  14401. If the expression is evaluated to zero, the frame is discarded.
  14402. If the evaluation result is negative or NaN, the frame is sent to the
  14403. first output; otherwise it is sent to the output with index
  14404. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14405. For example a value of @code{1.2} corresponds to the output with index
  14406. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14407. @item outputs, n
  14408. Set the number of outputs. The output to which to send the selected
  14409. frame is based on the result of the evaluation. Default value is 1.
  14410. @end table
  14411. The expression can contain the following constants:
  14412. @table @option
  14413. @item n
  14414. The (sequential) number of the filtered frame, starting from 0.
  14415. @item selected_n
  14416. The (sequential) number of the selected frame, starting from 0.
  14417. @item prev_selected_n
  14418. The sequential number of the last selected frame. It's NAN if undefined.
  14419. @item TB
  14420. The timebase of the input timestamps.
  14421. @item pts
  14422. The PTS (Presentation TimeStamp) of the filtered video frame,
  14423. expressed in @var{TB} units. It's NAN if undefined.
  14424. @item t
  14425. The PTS of the filtered video frame,
  14426. expressed in seconds. It's NAN if undefined.
  14427. @item prev_pts
  14428. The PTS of the previously filtered video frame. It's NAN if undefined.
  14429. @item prev_selected_pts
  14430. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14431. @item prev_selected_t
  14432. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14433. @item start_pts
  14434. The PTS of the first video frame in the video. It's NAN if undefined.
  14435. @item start_t
  14436. The time of the first video frame in the video. It's NAN if undefined.
  14437. @item pict_type @emph{(video only)}
  14438. The type of the filtered frame. It can assume one of the following
  14439. values:
  14440. @table @option
  14441. @item I
  14442. @item P
  14443. @item B
  14444. @item S
  14445. @item SI
  14446. @item SP
  14447. @item BI
  14448. @end table
  14449. @item interlace_type @emph{(video only)}
  14450. The frame interlace type. It can assume one of the following values:
  14451. @table @option
  14452. @item PROGRESSIVE
  14453. The frame is progressive (not interlaced).
  14454. @item TOPFIRST
  14455. The frame is top-field-first.
  14456. @item BOTTOMFIRST
  14457. The frame is bottom-field-first.
  14458. @end table
  14459. @item consumed_sample_n @emph{(audio only)}
  14460. the number of selected samples before the current frame
  14461. @item samples_n @emph{(audio only)}
  14462. the number of samples in the current frame
  14463. @item sample_rate @emph{(audio only)}
  14464. the input sample rate
  14465. @item key
  14466. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14467. @item pos
  14468. the position in the file of the filtered frame, -1 if the information
  14469. is not available (e.g. for synthetic video)
  14470. @item scene @emph{(video only)}
  14471. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14472. probability for the current frame to introduce a new scene, while a higher
  14473. value means the current frame is more likely to be one (see the example below)
  14474. @item concatdec_select
  14475. The concat demuxer can select only part of a concat input file by setting an
  14476. inpoint and an outpoint, but the output packets may not be entirely contained
  14477. in the selected interval. By using this variable, it is possible to skip frames
  14478. generated by the concat demuxer which are not exactly contained in the selected
  14479. interval.
  14480. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14481. and the @var{lavf.concat.duration} packet metadata values which are also
  14482. present in the decoded frames.
  14483. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14484. start_time and either the duration metadata is missing or the frame pts is less
  14485. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14486. missing.
  14487. That basically means that an input frame is selected if its pts is within the
  14488. interval set by the concat demuxer.
  14489. @end table
  14490. The default value of the select expression is "1".
  14491. @subsection Examples
  14492. @itemize
  14493. @item
  14494. Select all frames in input:
  14495. @example
  14496. select
  14497. @end example
  14498. The example above is the same as:
  14499. @example
  14500. select=1
  14501. @end example
  14502. @item
  14503. Skip all frames:
  14504. @example
  14505. select=0
  14506. @end example
  14507. @item
  14508. Select only I-frames:
  14509. @example
  14510. select='eq(pict_type\,I)'
  14511. @end example
  14512. @item
  14513. Select one frame every 100:
  14514. @example
  14515. select='not(mod(n\,100))'
  14516. @end example
  14517. @item
  14518. Select only frames contained in the 10-20 time interval:
  14519. @example
  14520. select=between(t\,10\,20)
  14521. @end example
  14522. @item
  14523. Select only I-frames contained in the 10-20 time interval:
  14524. @example
  14525. select=between(t\,10\,20)*eq(pict_type\,I)
  14526. @end example
  14527. @item
  14528. Select frames with a minimum distance of 10 seconds:
  14529. @example
  14530. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14531. @end example
  14532. @item
  14533. Use aselect to select only audio frames with samples number > 100:
  14534. @example
  14535. aselect='gt(samples_n\,100)'
  14536. @end example
  14537. @item
  14538. Create a mosaic of the first scenes:
  14539. @example
  14540. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14541. @end example
  14542. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14543. choice.
  14544. @item
  14545. Send even and odd frames to separate outputs, and compose them:
  14546. @example
  14547. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14548. @end example
  14549. @item
  14550. Select useful frames from an ffconcat file which is using inpoints and
  14551. outpoints but where the source files are not intra frame only.
  14552. @example
  14553. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14554. @end example
  14555. @end itemize
  14556. @section sendcmd, asendcmd
  14557. Send commands to filters in the filtergraph.
  14558. These filters read commands to be sent to other filters in the
  14559. filtergraph.
  14560. @code{sendcmd} must be inserted between two video filters,
  14561. @code{asendcmd} must be inserted between two audio filters, but apart
  14562. from that they act the same way.
  14563. The specification of commands can be provided in the filter arguments
  14564. with the @var{commands} option, or in a file specified by the
  14565. @var{filename} option.
  14566. These filters accept the following options:
  14567. @table @option
  14568. @item commands, c
  14569. Set the commands to be read and sent to the other filters.
  14570. @item filename, f
  14571. Set the filename of the commands to be read and sent to the other
  14572. filters.
  14573. @end table
  14574. @subsection Commands syntax
  14575. A commands description consists of a sequence of interval
  14576. specifications, comprising a list of commands to be executed when a
  14577. particular event related to that interval occurs. The occurring event
  14578. is typically the current frame time entering or leaving a given time
  14579. interval.
  14580. An interval is specified by the following syntax:
  14581. @example
  14582. @var{START}[-@var{END}] @var{COMMANDS};
  14583. @end example
  14584. The time interval is specified by the @var{START} and @var{END} times.
  14585. @var{END} is optional and defaults to the maximum time.
  14586. The current frame time is considered within the specified interval if
  14587. it is included in the interval [@var{START}, @var{END}), that is when
  14588. the time is greater or equal to @var{START} and is lesser than
  14589. @var{END}.
  14590. @var{COMMANDS} consists of a sequence of one or more command
  14591. specifications, separated by ",", relating to that interval. The
  14592. syntax of a command specification is given by:
  14593. @example
  14594. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14595. @end example
  14596. @var{FLAGS} is optional and specifies the type of events relating to
  14597. the time interval which enable sending the specified command, and must
  14598. be a non-null sequence of identifier flags separated by "+" or "|" and
  14599. enclosed between "[" and "]".
  14600. The following flags are recognized:
  14601. @table @option
  14602. @item enter
  14603. The command is sent when the current frame timestamp enters the
  14604. specified interval. In other words, the command is sent when the
  14605. previous frame timestamp was not in the given interval, and the
  14606. current is.
  14607. @item leave
  14608. The command is sent when the current frame timestamp leaves the
  14609. specified interval. In other words, the command is sent when the
  14610. previous frame timestamp was in the given interval, and the
  14611. current is not.
  14612. @end table
  14613. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14614. assumed.
  14615. @var{TARGET} specifies the target of the command, usually the name of
  14616. the filter class or a specific filter instance name.
  14617. @var{COMMAND} specifies the name of the command for the target filter.
  14618. @var{ARG} is optional and specifies the optional list of argument for
  14619. the given @var{COMMAND}.
  14620. Between one interval specification and another, whitespaces, or
  14621. sequences of characters starting with @code{#} until the end of line,
  14622. are ignored and can be used to annotate comments.
  14623. A simplified BNF description of the commands specification syntax
  14624. follows:
  14625. @example
  14626. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14627. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14628. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14629. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14630. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14631. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14632. @end example
  14633. @subsection Examples
  14634. @itemize
  14635. @item
  14636. Specify audio tempo change at second 4:
  14637. @example
  14638. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14639. @end example
  14640. @item
  14641. Target a specific filter instance:
  14642. @example
  14643. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14644. @end example
  14645. @item
  14646. Specify a list of drawtext and hue commands in a file.
  14647. @example
  14648. # show text in the interval 5-10
  14649. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14650. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14651. # desaturate the image in the interval 15-20
  14652. 15.0-20.0 [enter] hue s 0,
  14653. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14654. [leave] hue s 1,
  14655. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14656. # apply an exponential saturation fade-out effect, starting from time 25
  14657. 25 [enter] hue s exp(25-t)
  14658. @end example
  14659. A filtergraph allowing to read and process the above command list
  14660. stored in a file @file{test.cmd}, can be specified with:
  14661. @example
  14662. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14663. @end example
  14664. @end itemize
  14665. @anchor{setpts}
  14666. @section setpts, asetpts
  14667. Change the PTS (presentation timestamp) of the input frames.
  14668. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14669. This filter accepts the following options:
  14670. @table @option
  14671. @item expr
  14672. The expression which is evaluated for each frame to construct its timestamp.
  14673. @end table
  14674. The expression is evaluated through the eval API and can contain the following
  14675. constants:
  14676. @table @option
  14677. @item FRAME_RATE
  14678. frame rate, only defined for constant frame-rate video
  14679. @item PTS
  14680. The presentation timestamp in input
  14681. @item N
  14682. The count of the input frame for video or the number of consumed samples,
  14683. not including the current frame for audio, starting from 0.
  14684. @item NB_CONSUMED_SAMPLES
  14685. The number of consumed samples, not including the current frame (only
  14686. audio)
  14687. @item NB_SAMPLES, S
  14688. The number of samples in the current frame (only audio)
  14689. @item SAMPLE_RATE, SR
  14690. The audio sample rate.
  14691. @item STARTPTS
  14692. The PTS of the first frame.
  14693. @item STARTT
  14694. the time in seconds of the first frame
  14695. @item INTERLACED
  14696. State whether the current frame is interlaced.
  14697. @item T
  14698. the time in seconds of the current frame
  14699. @item POS
  14700. original position in the file of the frame, or undefined if undefined
  14701. for the current frame
  14702. @item PREV_INPTS
  14703. The previous input PTS.
  14704. @item PREV_INT
  14705. previous input time in seconds
  14706. @item PREV_OUTPTS
  14707. The previous output PTS.
  14708. @item PREV_OUTT
  14709. previous output time in seconds
  14710. @item RTCTIME
  14711. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14712. instead.
  14713. @item RTCSTART
  14714. The wallclock (RTC) time at the start of the movie in microseconds.
  14715. @item TB
  14716. The timebase of the input timestamps.
  14717. @end table
  14718. @subsection Examples
  14719. @itemize
  14720. @item
  14721. Start counting PTS from zero
  14722. @example
  14723. setpts=PTS-STARTPTS
  14724. @end example
  14725. @item
  14726. Apply fast motion effect:
  14727. @example
  14728. setpts=0.5*PTS
  14729. @end example
  14730. @item
  14731. Apply slow motion effect:
  14732. @example
  14733. setpts=2.0*PTS
  14734. @end example
  14735. @item
  14736. Set fixed rate of 25 frames per second:
  14737. @example
  14738. setpts=N/(25*TB)
  14739. @end example
  14740. @item
  14741. Set fixed rate 25 fps with some jitter:
  14742. @example
  14743. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14744. @end example
  14745. @item
  14746. Apply an offset of 10 seconds to the input PTS:
  14747. @example
  14748. setpts=PTS+10/TB
  14749. @end example
  14750. @item
  14751. Generate timestamps from a "live source" and rebase onto the current timebase:
  14752. @example
  14753. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14754. @end example
  14755. @item
  14756. Generate timestamps by counting samples:
  14757. @example
  14758. asetpts=N/SR/TB
  14759. @end example
  14760. @end itemize
  14761. @section setrange
  14762. Force color range for the output video frame.
  14763. The @code{setrange} filter marks the color range property for the
  14764. output frames. It does not change the input frame, but only sets the
  14765. corresponding property, which affects how the frame is treated by
  14766. following filters.
  14767. The filter accepts the following options:
  14768. @table @option
  14769. @item range
  14770. Available values are:
  14771. @table @samp
  14772. @item auto
  14773. Keep the same color range property.
  14774. @item unspecified, unknown
  14775. Set the color range as unspecified.
  14776. @item limited, tv, mpeg
  14777. Set the color range as limited.
  14778. @item full, pc, jpeg
  14779. Set the color range as full.
  14780. @end table
  14781. @end table
  14782. @section settb, asettb
  14783. Set the timebase to use for the output frames timestamps.
  14784. It is mainly useful for testing timebase configuration.
  14785. It accepts the following parameters:
  14786. @table @option
  14787. @item expr, tb
  14788. The expression which is evaluated into the output timebase.
  14789. @end table
  14790. The value for @option{tb} is an arithmetic expression representing a
  14791. rational. The expression can contain the constants "AVTB" (the default
  14792. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14793. audio only). Default value is "intb".
  14794. @subsection Examples
  14795. @itemize
  14796. @item
  14797. Set the timebase to 1/25:
  14798. @example
  14799. settb=expr=1/25
  14800. @end example
  14801. @item
  14802. Set the timebase to 1/10:
  14803. @example
  14804. settb=expr=0.1
  14805. @end example
  14806. @item
  14807. Set the timebase to 1001/1000:
  14808. @example
  14809. settb=1+0.001
  14810. @end example
  14811. @item
  14812. Set the timebase to 2*intb:
  14813. @example
  14814. settb=2*intb
  14815. @end example
  14816. @item
  14817. Set the default timebase value:
  14818. @example
  14819. settb=AVTB
  14820. @end example
  14821. @end itemize
  14822. @section showcqt
  14823. Convert input audio to a video output representing frequency spectrum
  14824. logarithmically using Brown-Puckette constant Q transform algorithm with
  14825. direct frequency domain coefficient calculation (but the transform itself
  14826. is not really constant Q, instead the Q factor is actually variable/clamped),
  14827. with musical tone scale, from E0 to D#10.
  14828. The filter accepts the following options:
  14829. @table @option
  14830. @item size, s
  14831. Specify the video size for the output. It must be even. For the syntax of this option,
  14832. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14833. Default value is @code{1920x1080}.
  14834. @item fps, rate, r
  14835. Set the output frame rate. Default value is @code{25}.
  14836. @item bar_h
  14837. Set the bargraph height. It must be even. Default value is @code{-1} which
  14838. computes the bargraph height automatically.
  14839. @item axis_h
  14840. Set the axis height. It must be even. Default value is @code{-1} which computes
  14841. the axis height automatically.
  14842. @item sono_h
  14843. Set the sonogram height. It must be even. Default value is @code{-1} which
  14844. computes the sonogram height automatically.
  14845. @item fullhd
  14846. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14847. instead. Default value is @code{1}.
  14848. @item sono_v, volume
  14849. Specify the sonogram volume expression. It can contain variables:
  14850. @table @option
  14851. @item bar_v
  14852. the @var{bar_v} evaluated expression
  14853. @item frequency, freq, f
  14854. the frequency where it is evaluated
  14855. @item timeclamp, tc
  14856. the value of @var{timeclamp} option
  14857. @end table
  14858. and functions:
  14859. @table @option
  14860. @item a_weighting(f)
  14861. A-weighting of equal loudness
  14862. @item b_weighting(f)
  14863. B-weighting of equal loudness
  14864. @item c_weighting(f)
  14865. C-weighting of equal loudness.
  14866. @end table
  14867. Default value is @code{16}.
  14868. @item bar_v, volume2
  14869. Specify the bargraph volume expression. It can contain variables:
  14870. @table @option
  14871. @item sono_v
  14872. the @var{sono_v} evaluated expression
  14873. @item frequency, freq, f
  14874. the frequency where it is evaluated
  14875. @item timeclamp, tc
  14876. the value of @var{timeclamp} option
  14877. @end table
  14878. and functions:
  14879. @table @option
  14880. @item a_weighting(f)
  14881. A-weighting of equal loudness
  14882. @item b_weighting(f)
  14883. B-weighting of equal loudness
  14884. @item c_weighting(f)
  14885. C-weighting of equal loudness.
  14886. @end table
  14887. Default value is @code{sono_v}.
  14888. @item sono_g, gamma
  14889. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14890. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14891. Acceptable range is @code{[1, 7]}.
  14892. @item bar_g, gamma2
  14893. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14894. @code{[1, 7]}.
  14895. @item bar_t
  14896. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14897. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14898. @item timeclamp, tc
  14899. Specify the transform timeclamp. At low frequency, there is trade-off between
  14900. accuracy in time domain and frequency domain. If timeclamp is lower,
  14901. event in time domain is represented more accurately (such as fast bass drum),
  14902. otherwise event in frequency domain is represented more accurately
  14903. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14904. @item attack
  14905. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14906. limits future samples by applying asymmetric windowing in time domain, useful
  14907. when low latency is required. Accepted range is @code{[0, 1]}.
  14908. @item basefreq
  14909. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14910. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14911. @item endfreq
  14912. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14913. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14914. @item coeffclamp
  14915. This option is deprecated and ignored.
  14916. @item tlength
  14917. Specify the transform length in time domain. Use this option to control accuracy
  14918. trade-off between time domain and frequency domain at every frequency sample.
  14919. It can contain variables:
  14920. @table @option
  14921. @item frequency, freq, f
  14922. the frequency where it is evaluated
  14923. @item timeclamp, tc
  14924. the value of @var{timeclamp} option.
  14925. @end table
  14926. Default value is @code{384*tc/(384+tc*f)}.
  14927. @item count
  14928. Specify the transform count for every video frame. Default value is @code{6}.
  14929. Acceptable range is @code{[1, 30]}.
  14930. @item fcount
  14931. Specify the transform count for every single pixel. Default value is @code{0},
  14932. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14933. @item fontfile
  14934. Specify font file for use with freetype to draw the axis. If not specified,
  14935. use embedded font. Note that drawing with font file or embedded font is not
  14936. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14937. option instead.
  14938. @item font
  14939. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14940. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14941. @item fontcolor
  14942. Specify font color expression. This is arithmetic expression that should return
  14943. integer value 0xRRGGBB. It can contain variables:
  14944. @table @option
  14945. @item frequency, freq, f
  14946. the frequency where it is evaluated
  14947. @item timeclamp, tc
  14948. the value of @var{timeclamp} option
  14949. @end table
  14950. and functions:
  14951. @table @option
  14952. @item midi(f)
  14953. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14954. @item r(x), g(x), b(x)
  14955. red, green, and blue value of intensity x.
  14956. @end table
  14957. Default value is @code{st(0, (midi(f)-59.5)/12);
  14958. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14959. r(1-ld(1)) + b(ld(1))}.
  14960. @item axisfile
  14961. Specify image file to draw the axis. This option override @var{fontfile} and
  14962. @var{fontcolor} option.
  14963. @item axis, text
  14964. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14965. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14966. Default value is @code{1}.
  14967. @item csp
  14968. Set colorspace. The accepted values are:
  14969. @table @samp
  14970. @item unspecified
  14971. Unspecified (default)
  14972. @item bt709
  14973. BT.709
  14974. @item fcc
  14975. FCC
  14976. @item bt470bg
  14977. BT.470BG or BT.601-6 625
  14978. @item smpte170m
  14979. SMPTE-170M or BT.601-6 525
  14980. @item smpte240m
  14981. SMPTE-240M
  14982. @item bt2020ncl
  14983. BT.2020 with non-constant luminance
  14984. @end table
  14985. @item cscheme
  14986. Set spectrogram color scheme. This is list of floating point values with format
  14987. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14988. The default is @code{1|0.5|0|0|0.5|1}.
  14989. @end table
  14990. @subsection Examples
  14991. @itemize
  14992. @item
  14993. Playing audio while showing the spectrum:
  14994. @example
  14995. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14996. @end example
  14997. @item
  14998. Same as above, but with frame rate 30 fps:
  14999. @example
  15000. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15001. @end example
  15002. @item
  15003. Playing at 1280x720:
  15004. @example
  15005. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15006. @end example
  15007. @item
  15008. Disable sonogram display:
  15009. @example
  15010. sono_h=0
  15011. @end example
  15012. @item
  15013. A1 and its harmonics: A1, A2, (near)E3, A3:
  15014. @example
  15015. 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),
  15016. asplit[a][out1]; [a] showcqt [out0]'
  15017. @end example
  15018. @item
  15019. Same as above, but with more accuracy in frequency domain:
  15020. @example
  15021. 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),
  15022. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15023. @end example
  15024. @item
  15025. Custom volume:
  15026. @example
  15027. bar_v=10:sono_v=bar_v*a_weighting(f)
  15028. @end example
  15029. @item
  15030. Custom gamma, now spectrum is linear to the amplitude.
  15031. @example
  15032. bar_g=2:sono_g=2
  15033. @end example
  15034. @item
  15035. Custom tlength equation:
  15036. @example
  15037. 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)))'
  15038. @end example
  15039. @item
  15040. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15041. @example
  15042. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15043. @end example
  15044. @item
  15045. Custom font using fontconfig:
  15046. @example
  15047. font='Courier New,Monospace,mono|bold'
  15048. @end example
  15049. @item
  15050. Custom frequency range with custom axis using image file:
  15051. @example
  15052. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15053. @end example
  15054. @end itemize
  15055. @section showfreqs
  15056. Convert input audio to video output representing the audio power spectrum.
  15057. Audio amplitude is on Y-axis while frequency is on X-axis.
  15058. The filter accepts the following options:
  15059. @table @option
  15060. @item size, s
  15061. Specify size of video. For the syntax of this option, check the
  15062. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15063. Default is @code{1024x512}.
  15064. @item mode
  15065. Set display mode.
  15066. This set how each frequency bin will be represented.
  15067. It accepts the following values:
  15068. @table @samp
  15069. @item line
  15070. @item bar
  15071. @item dot
  15072. @end table
  15073. Default is @code{bar}.
  15074. @item ascale
  15075. Set amplitude scale.
  15076. It accepts the following values:
  15077. @table @samp
  15078. @item lin
  15079. Linear scale.
  15080. @item sqrt
  15081. Square root scale.
  15082. @item cbrt
  15083. Cubic root scale.
  15084. @item log
  15085. Logarithmic scale.
  15086. @end table
  15087. Default is @code{log}.
  15088. @item fscale
  15089. Set frequency scale.
  15090. It accepts the following values:
  15091. @table @samp
  15092. @item lin
  15093. Linear scale.
  15094. @item log
  15095. Logarithmic scale.
  15096. @item rlog
  15097. Reverse logarithmic scale.
  15098. @end table
  15099. Default is @code{lin}.
  15100. @item win_size
  15101. Set window size.
  15102. It accepts the following values:
  15103. @table @samp
  15104. @item w16
  15105. @item w32
  15106. @item w64
  15107. @item w128
  15108. @item w256
  15109. @item w512
  15110. @item w1024
  15111. @item w2048
  15112. @item w4096
  15113. @item w8192
  15114. @item w16384
  15115. @item w32768
  15116. @item w65536
  15117. @end table
  15118. Default is @code{w2048}
  15119. @item win_func
  15120. Set windowing function.
  15121. It accepts the following values:
  15122. @table @samp
  15123. @item rect
  15124. @item bartlett
  15125. @item hanning
  15126. @item hamming
  15127. @item blackman
  15128. @item welch
  15129. @item flattop
  15130. @item bharris
  15131. @item bnuttall
  15132. @item bhann
  15133. @item sine
  15134. @item nuttall
  15135. @item lanczos
  15136. @item gauss
  15137. @item tukey
  15138. @item dolph
  15139. @item cauchy
  15140. @item parzen
  15141. @item poisson
  15142. @end table
  15143. Default is @code{hanning}.
  15144. @item overlap
  15145. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15146. which means optimal overlap for selected window function will be picked.
  15147. @item averaging
  15148. Set time averaging. Setting this to 0 will display current maximal peaks.
  15149. Default is @code{1}, which means time averaging is disabled.
  15150. @item colors
  15151. Specify list of colors separated by space or by '|' which will be used to
  15152. draw channel frequencies. Unrecognized or missing colors will be replaced
  15153. by white color.
  15154. @item cmode
  15155. Set channel display mode.
  15156. It accepts the following values:
  15157. @table @samp
  15158. @item combined
  15159. @item separate
  15160. @end table
  15161. Default is @code{combined}.
  15162. @item minamp
  15163. Set minimum amplitude used in @code{log} amplitude scaler.
  15164. @end table
  15165. @anchor{showspectrum}
  15166. @section showspectrum
  15167. Convert input audio to a video output, representing the audio frequency
  15168. spectrum.
  15169. The filter accepts the following options:
  15170. @table @option
  15171. @item size, s
  15172. Specify the video size for the output. For the syntax of this option, check the
  15173. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15174. Default value is @code{640x512}.
  15175. @item slide
  15176. Specify how the spectrum should slide along the window.
  15177. It accepts the following values:
  15178. @table @samp
  15179. @item replace
  15180. the samples start again on the left when they reach the right
  15181. @item scroll
  15182. the samples scroll from right to left
  15183. @item fullframe
  15184. frames are only produced when the samples reach the right
  15185. @item rscroll
  15186. the samples scroll from left to right
  15187. @end table
  15188. Default value is @code{replace}.
  15189. @item mode
  15190. Specify display mode.
  15191. It accepts the following values:
  15192. @table @samp
  15193. @item combined
  15194. all channels are displayed in the same row
  15195. @item separate
  15196. all channels are displayed in separate rows
  15197. @end table
  15198. Default value is @samp{combined}.
  15199. @item color
  15200. Specify display color mode.
  15201. It accepts the following values:
  15202. @table @samp
  15203. @item channel
  15204. each channel is displayed in a separate color
  15205. @item intensity
  15206. each channel is displayed using the same color scheme
  15207. @item rainbow
  15208. each channel is displayed using the rainbow color scheme
  15209. @item moreland
  15210. each channel is displayed using the moreland color scheme
  15211. @item nebulae
  15212. each channel is displayed using the nebulae color scheme
  15213. @item fire
  15214. each channel is displayed using the fire color scheme
  15215. @item fiery
  15216. each channel is displayed using the fiery color scheme
  15217. @item fruit
  15218. each channel is displayed using the fruit color scheme
  15219. @item cool
  15220. each channel is displayed using the cool color scheme
  15221. @end table
  15222. Default value is @samp{channel}.
  15223. @item scale
  15224. Specify scale used for calculating intensity color values.
  15225. It accepts the following values:
  15226. @table @samp
  15227. @item lin
  15228. linear
  15229. @item sqrt
  15230. square root, default
  15231. @item cbrt
  15232. cubic root
  15233. @item log
  15234. logarithmic
  15235. @item 4thrt
  15236. 4th root
  15237. @item 5thrt
  15238. 5th root
  15239. @end table
  15240. Default value is @samp{sqrt}.
  15241. @item saturation
  15242. Set saturation modifier for displayed colors. Negative values provide
  15243. alternative color scheme. @code{0} is no saturation at all.
  15244. Saturation must be in [-10.0, 10.0] range.
  15245. Default value is @code{1}.
  15246. @item win_func
  15247. Set window function.
  15248. It accepts the following values:
  15249. @table @samp
  15250. @item rect
  15251. @item bartlett
  15252. @item hann
  15253. @item hanning
  15254. @item hamming
  15255. @item blackman
  15256. @item welch
  15257. @item flattop
  15258. @item bharris
  15259. @item bnuttall
  15260. @item bhann
  15261. @item sine
  15262. @item nuttall
  15263. @item lanczos
  15264. @item gauss
  15265. @item tukey
  15266. @item dolph
  15267. @item cauchy
  15268. @item parzen
  15269. @item poisson
  15270. @end table
  15271. Default value is @code{hann}.
  15272. @item orientation
  15273. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15274. @code{horizontal}. Default is @code{vertical}.
  15275. @item overlap
  15276. Set ratio of overlap window. Default value is @code{0}.
  15277. When value is @code{1} overlap is set to recommended size for specific
  15278. window function currently used.
  15279. @item gain
  15280. Set scale gain for calculating intensity color values.
  15281. Default value is @code{1}.
  15282. @item data
  15283. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15284. @item rotation
  15285. Set color rotation, must be in [-1.0, 1.0] range.
  15286. Default value is @code{0}.
  15287. @end table
  15288. The usage is very similar to the showwaves filter; see the examples in that
  15289. section.
  15290. @subsection Examples
  15291. @itemize
  15292. @item
  15293. Large window with logarithmic color scaling:
  15294. @example
  15295. showspectrum=s=1280x480:scale=log
  15296. @end example
  15297. @item
  15298. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15299. @example
  15300. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15301. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15302. @end example
  15303. @end itemize
  15304. @section showspectrumpic
  15305. Convert input audio to a single video frame, representing the audio frequency
  15306. spectrum.
  15307. The filter accepts the following options:
  15308. @table @option
  15309. @item size, s
  15310. Specify the video size for the output. For the syntax of this option, check the
  15311. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15312. Default value is @code{4096x2048}.
  15313. @item mode
  15314. Specify display mode.
  15315. It accepts the following values:
  15316. @table @samp
  15317. @item combined
  15318. all channels are displayed in the same row
  15319. @item separate
  15320. all channels are displayed in separate rows
  15321. @end table
  15322. Default value is @samp{combined}.
  15323. @item color
  15324. Specify display color mode.
  15325. It accepts the following values:
  15326. @table @samp
  15327. @item channel
  15328. each channel is displayed in a separate color
  15329. @item intensity
  15330. each channel is displayed using the same color scheme
  15331. @item rainbow
  15332. each channel is displayed using the rainbow color scheme
  15333. @item moreland
  15334. each channel is displayed using the moreland color scheme
  15335. @item nebulae
  15336. each channel is displayed using the nebulae color scheme
  15337. @item fire
  15338. each channel is displayed using the fire color scheme
  15339. @item fiery
  15340. each channel is displayed using the fiery color scheme
  15341. @item fruit
  15342. each channel is displayed using the fruit color scheme
  15343. @item cool
  15344. each channel is displayed using the cool color scheme
  15345. @end table
  15346. Default value is @samp{intensity}.
  15347. @item scale
  15348. Specify scale used for calculating intensity color values.
  15349. It accepts the following values:
  15350. @table @samp
  15351. @item lin
  15352. linear
  15353. @item sqrt
  15354. square root, default
  15355. @item cbrt
  15356. cubic root
  15357. @item log
  15358. logarithmic
  15359. @item 4thrt
  15360. 4th root
  15361. @item 5thrt
  15362. 5th root
  15363. @end table
  15364. Default value is @samp{log}.
  15365. @item saturation
  15366. Set saturation modifier for displayed colors. Negative values provide
  15367. alternative color scheme. @code{0} is no saturation at all.
  15368. Saturation must be in [-10.0, 10.0] range.
  15369. Default value is @code{1}.
  15370. @item win_func
  15371. Set window function.
  15372. It accepts the following values:
  15373. @table @samp
  15374. @item rect
  15375. @item bartlett
  15376. @item hann
  15377. @item hanning
  15378. @item hamming
  15379. @item blackman
  15380. @item welch
  15381. @item flattop
  15382. @item bharris
  15383. @item bnuttall
  15384. @item bhann
  15385. @item sine
  15386. @item nuttall
  15387. @item lanczos
  15388. @item gauss
  15389. @item tukey
  15390. @item dolph
  15391. @item cauchy
  15392. @item parzen
  15393. @item poisson
  15394. @end table
  15395. Default value is @code{hann}.
  15396. @item orientation
  15397. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15398. @code{horizontal}. Default is @code{vertical}.
  15399. @item gain
  15400. Set scale gain for calculating intensity color values.
  15401. Default value is @code{1}.
  15402. @item legend
  15403. Draw time and frequency axes and legends. Default is enabled.
  15404. @item rotation
  15405. Set color rotation, must be in [-1.0, 1.0] range.
  15406. Default value is @code{0}.
  15407. @end table
  15408. @subsection Examples
  15409. @itemize
  15410. @item
  15411. Extract an audio spectrogram of a whole audio track
  15412. in a 1024x1024 picture using @command{ffmpeg}:
  15413. @example
  15414. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15415. @end example
  15416. @end itemize
  15417. @section showvolume
  15418. Convert input audio volume to a video output.
  15419. The filter accepts the following options:
  15420. @table @option
  15421. @item rate, r
  15422. Set video rate.
  15423. @item b
  15424. Set border width, allowed range is [0, 5]. Default is 1.
  15425. @item w
  15426. Set channel width, allowed range is [80, 8192]. Default is 400.
  15427. @item h
  15428. Set channel height, allowed range is [1, 900]. Default is 20.
  15429. @item f
  15430. Set fade, allowed range is [0, 1]. Default is 0.95.
  15431. @item c
  15432. Set volume color expression.
  15433. The expression can use the following variables:
  15434. @table @option
  15435. @item VOLUME
  15436. Current max volume of channel in dB.
  15437. @item PEAK
  15438. Current peak.
  15439. @item CHANNEL
  15440. Current channel number, starting from 0.
  15441. @end table
  15442. @item t
  15443. If set, displays channel names. Default is enabled.
  15444. @item v
  15445. If set, displays volume values. Default is enabled.
  15446. @item o
  15447. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15448. default is @code{h}.
  15449. @item s
  15450. Set step size, allowed range is [0, 5]. Default is 0, which means
  15451. step is disabled.
  15452. @item p
  15453. Set background opacity, allowed range is [0, 1]. Default is 0.
  15454. @item m
  15455. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15456. default is @code{p}.
  15457. @item ds
  15458. Set display scale, can be linear: @code{lin} or log: @code{log},
  15459. default is @code{lin}.
  15460. @item dm
  15461. In second.
  15462. If set to > 0., display a line for the max level
  15463. in the previous seconds.
  15464. default is disabled: @code{0.}
  15465. @item dmc
  15466. The color of the max line. Use when @code{dm} option is set to > 0.
  15467. default is: @code{orange}
  15468. @end table
  15469. @section showwaves
  15470. Convert input audio to a video output, representing the samples waves.
  15471. The filter accepts the following options:
  15472. @table @option
  15473. @item size, s
  15474. Specify the video size for the output. For the syntax of this option, check the
  15475. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15476. Default value is @code{600x240}.
  15477. @item mode
  15478. Set display mode.
  15479. Available values are:
  15480. @table @samp
  15481. @item point
  15482. Draw a point for each sample.
  15483. @item line
  15484. Draw a vertical line for each sample.
  15485. @item p2p
  15486. Draw a point for each sample and a line between them.
  15487. @item cline
  15488. Draw a centered vertical line for each sample.
  15489. @end table
  15490. Default value is @code{point}.
  15491. @item n
  15492. Set the number of samples which are printed on the same column. A
  15493. larger value will decrease the frame rate. Must be a positive
  15494. integer. This option can be set only if the value for @var{rate}
  15495. is not explicitly specified.
  15496. @item rate, r
  15497. Set the (approximate) output frame rate. This is done by setting the
  15498. option @var{n}. Default value is "25".
  15499. @item split_channels
  15500. Set if channels should be drawn separately or overlap. Default value is 0.
  15501. @item colors
  15502. Set colors separated by '|' which are going to be used for drawing of each channel.
  15503. @item scale
  15504. Set amplitude scale.
  15505. Available values are:
  15506. @table @samp
  15507. @item lin
  15508. Linear.
  15509. @item log
  15510. Logarithmic.
  15511. @item sqrt
  15512. Square root.
  15513. @item cbrt
  15514. Cubic root.
  15515. @end table
  15516. Default is linear.
  15517. @item draw
  15518. Set the draw mode. This is mostly useful to set for high @var{n}.
  15519. Available values are:
  15520. @table @samp
  15521. @item scale
  15522. Scale pixel values for each drawn sample.
  15523. @item full
  15524. Draw every sample directly.
  15525. @end table
  15526. Default value is @code{scale}.
  15527. @end table
  15528. @subsection Examples
  15529. @itemize
  15530. @item
  15531. Output the input file audio and the corresponding video representation
  15532. at the same time:
  15533. @example
  15534. amovie=a.mp3,asplit[out0],showwaves[out1]
  15535. @end example
  15536. @item
  15537. Create a synthetic signal and show it with showwaves, forcing a
  15538. frame rate of 30 frames per second:
  15539. @example
  15540. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15541. @end example
  15542. @end itemize
  15543. @section showwavespic
  15544. Convert input audio to a single video frame, representing the samples waves.
  15545. The filter accepts the following options:
  15546. @table @option
  15547. @item size, s
  15548. Specify the video size for the output. For the syntax of this option, check the
  15549. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15550. Default value is @code{600x240}.
  15551. @item split_channels
  15552. Set if channels should be drawn separately or overlap. Default value is 0.
  15553. @item colors
  15554. Set colors separated by '|' which are going to be used for drawing of each channel.
  15555. @item scale
  15556. Set amplitude scale.
  15557. Available values are:
  15558. @table @samp
  15559. @item lin
  15560. Linear.
  15561. @item log
  15562. Logarithmic.
  15563. @item sqrt
  15564. Square root.
  15565. @item cbrt
  15566. Cubic root.
  15567. @end table
  15568. Default is linear.
  15569. @end table
  15570. @subsection Examples
  15571. @itemize
  15572. @item
  15573. Extract a channel split representation of the wave form of a whole audio track
  15574. in a 1024x800 picture using @command{ffmpeg}:
  15575. @example
  15576. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15577. @end example
  15578. @end itemize
  15579. @section sidedata, asidedata
  15580. Delete frame side data, or select frames based on it.
  15581. This filter accepts the following options:
  15582. @table @option
  15583. @item mode
  15584. Set mode of operation of the filter.
  15585. Can be one of the following:
  15586. @table @samp
  15587. @item select
  15588. Select every frame with side data of @code{type}.
  15589. @item delete
  15590. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15591. data in the frame.
  15592. @end table
  15593. @item type
  15594. Set side data type used with all modes. Must be set for @code{select} mode. For
  15595. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15596. in @file{libavutil/frame.h}. For example, to choose
  15597. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15598. @end table
  15599. @section spectrumsynth
  15600. Sythesize audio from 2 input video spectrums, first input stream represents
  15601. magnitude across time and second represents phase across time.
  15602. The filter will transform from frequency domain as displayed in videos back
  15603. to time domain as presented in audio output.
  15604. This filter is primarily created for reversing processed @ref{showspectrum}
  15605. filter outputs, but can synthesize sound from other spectrograms too.
  15606. But in such case results are going to be poor if the phase data is not
  15607. available, because in such cases phase data need to be recreated, usually
  15608. its just recreated from random noise.
  15609. For best results use gray only output (@code{channel} color mode in
  15610. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15611. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15612. @code{data} option. Inputs videos should generally use @code{fullframe}
  15613. slide mode as that saves resources needed for decoding video.
  15614. The filter accepts the following options:
  15615. @table @option
  15616. @item sample_rate
  15617. Specify sample rate of output audio, the sample rate of audio from which
  15618. spectrum was generated may differ.
  15619. @item channels
  15620. Set number of channels represented in input video spectrums.
  15621. @item scale
  15622. Set scale which was used when generating magnitude input spectrum.
  15623. Can be @code{lin} or @code{log}. Default is @code{log}.
  15624. @item slide
  15625. Set slide which was used when generating inputs spectrums.
  15626. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15627. Default is @code{fullframe}.
  15628. @item win_func
  15629. Set window function used for resynthesis.
  15630. @item overlap
  15631. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15632. which means optimal overlap for selected window function will be picked.
  15633. @item orientation
  15634. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15635. Default is @code{vertical}.
  15636. @end table
  15637. @subsection Examples
  15638. @itemize
  15639. @item
  15640. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15641. then resynthesize videos back to audio with spectrumsynth:
  15642. @example
  15643. 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
  15644. 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
  15645. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15646. @end example
  15647. @end itemize
  15648. @section split, asplit
  15649. Split input into several identical outputs.
  15650. @code{asplit} works with audio input, @code{split} with video.
  15651. The filter accepts a single parameter which specifies the number of outputs. If
  15652. unspecified, it defaults to 2.
  15653. @subsection Examples
  15654. @itemize
  15655. @item
  15656. Create two separate outputs from the same input:
  15657. @example
  15658. [in] split [out0][out1]
  15659. @end example
  15660. @item
  15661. To create 3 or more outputs, you need to specify the number of
  15662. outputs, like in:
  15663. @example
  15664. [in] asplit=3 [out0][out1][out2]
  15665. @end example
  15666. @item
  15667. Create two separate outputs from the same input, one cropped and
  15668. one padded:
  15669. @example
  15670. [in] split [splitout1][splitout2];
  15671. [splitout1] crop=100:100:0:0 [cropout];
  15672. [splitout2] pad=200:200:100:100 [padout];
  15673. @end example
  15674. @item
  15675. Create 5 copies of the input audio with @command{ffmpeg}:
  15676. @example
  15677. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15678. @end example
  15679. @end itemize
  15680. @section zmq, azmq
  15681. Receive commands sent through a libzmq client, and forward them to
  15682. filters in the filtergraph.
  15683. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15684. must be inserted between two video filters, @code{azmq} between two
  15685. audio filters. Both are capable to send messages to any filter type.
  15686. To enable these filters you need to install the libzmq library and
  15687. headers and configure FFmpeg with @code{--enable-libzmq}.
  15688. For more information about libzmq see:
  15689. @url{http://www.zeromq.org/}
  15690. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15691. receives messages sent through a network interface defined by the
  15692. @option{bind_address} (or the abbreviation "@option{b}") option.
  15693. Default value of this option is @file{tcp://localhost:5555}. You may
  15694. want to alter this value to your needs, but do not forget to escape any
  15695. ':' signs (see @ref{filtergraph escaping}).
  15696. The received message must be in the form:
  15697. @example
  15698. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15699. @end example
  15700. @var{TARGET} specifies the target of the command, usually the name of
  15701. the filter class or a specific filter instance name. The default
  15702. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15703. but you can override this by using the @samp{filter_name@@id} syntax
  15704. (see @ref{Filtergraph syntax}).
  15705. @var{COMMAND} specifies the name of the command for the target filter.
  15706. @var{ARG} is optional and specifies the optional argument list for the
  15707. given @var{COMMAND}.
  15708. Upon reception, the message is processed and the corresponding command
  15709. is injected into the filtergraph. Depending on the result, the filter
  15710. will send a reply to the client, adopting the format:
  15711. @example
  15712. @var{ERROR_CODE} @var{ERROR_REASON}
  15713. @var{MESSAGE}
  15714. @end example
  15715. @var{MESSAGE} is optional.
  15716. @subsection Examples
  15717. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15718. be used to send commands processed by these filters.
  15719. Consider the following filtergraph generated by @command{ffplay}.
  15720. In this example the last overlay filter has an instance name. All other
  15721. filters will have default instance names.
  15722. @example
  15723. ffplay -dumpgraph 1 -f lavfi "
  15724. color=s=100x100:c=red [l];
  15725. color=s=100x100:c=blue [r];
  15726. nullsrc=s=200x100, zmq [bg];
  15727. [bg][l] overlay [bg+l];
  15728. [bg+l][r] overlay@@my=x=100 "
  15729. @end example
  15730. To change the color of the left side of the video, the following
  15731. command can be used:
  15732. @example
  15733. echo Parsed_color_0 c yellow | tools/zmqsend
  15734. @end example
  15735. To change the right side:
  15736. @example
  15737. echo Parsed_color_1 c pink | tools/zmqsend
  15738. @end example
  15739. To change the position of the right side:
  15740. @example
  15741. echo overlay@@my x 150 | tools/zmqsend
  15742. @end example
  15743. @c man end MULTIMEDIA FILTERS
  15744. @chapter Multimedia Sources
  15745. @c man begin MULTIMEDIA SOURCES
  15746. Below is a description of the currently available multimedia sources.
  15747. @section amovie
  15748. This is the same as @ref{movie} source, except it selects an audio
  15749. stream by default.
  15750. @anchor{movie}
  15751. @section movie
  15752. Read audio and/or video stream(s) from a movie container.
  15753. It accepts the following parameters:
  15754. @table @option
  15755. @item filename
  15756. The name of the resource to read (not necessarily a file; it can also be a
  15757. device or a stream accessed through some protocol).
  15758. @item format_name, f
  15759. Specifies the format assumed for the movie to read, and can be either
  15760. the name of a container or an input device. If not specified, the
  15761. format is guessed from @var{movie_name} or by probing.
  15762. @item seek_point, sp
  15763. Specifies the seek point in seconds. The frames will be output
  15764. starting from this seek point. The parameter is evaluated with
  15765. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15766. postfix. The default value is "0".
  15767. @item streams, s
  15768. Specifies the streams to read. Several streams can be specified,
  15769. separated by "+". The source will then have as many outputs, in the
  15770. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15771. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15772. respectively the default (best suited) video and audio stream. Default
  15773. is "dv", or "da" if the filter is called as "amovie".
  15774. @item stream_index, si
  15775. Specifies the index of the video stream to read. If the value is -1,
  15776. the most suitable video stream will be automatically selected. The default
  15777. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15778. audio instead of video.
  15779. @item loop
  15780. Specifies how many times to read the stream in sequence.
  15781. If the value is 0, the stream will be looped infinitely.
  15782. Default value is "1".
  15783. Note that when the movie is looped the source timestamps are not
  15784. changed, so it will generate non monotonically increasing timestamps.
  15785. @item discontinuity
  15786. Specifies the time difference between frames above which the point is
  15787. considered a timestamp discontinuity which is removed by adjusting the later
  15788. timestamps.
  15789. @end table
  15790. It allows overlaying a second video on top of the main input of
  15791. a filtergraph, as shown in this graph:
  15792. @example
  15793. input -----------> deltapts0 --> overlay --> output
  15794. ^
  15795. |
  15796. movie --> scale--> deltapts1 -------+
  15797. @end example
  15798. @subsection Examples
  15799. @itemize
  15800. @item
  15801. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15802. on top of the input labelled "in":
  15803. @example
  15804. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15805. [in] setpts=PTS-STARTPTS [main];
  15806. [main][over] overlay=16:16 [out]
  15807. @end example
  15808. @item
  15809. Read from a video4linux2 device, and overlay it on top of the input
  15810. labelled "in":
  15811. @example
  15812. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15813. [in] setpts=PTS-STARTPTS [main];
  15814. [main][over] overlay=16:16 [out]
  15815. @end example
  15816. @item
  15817. Read the first video stream and the audio stream with id 0x81 from
  15818. dvd.vob; the video is connected to the pad named "video" and the audio is
  15819. connected to the pad named "audio":
  15820. @example
  15821. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15822. @end example
  15823. @end itemize
  15824. @subsection Commands
  15825. Both movie and amovie support the following commands:
  15826. @table @option
  15827. @item seek
  15828. Perform seek using "av_seek_frame".
  15829. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15830. @itemize
  15831. @item
  15832. @var{stream_index}: If stream_index is -1, a default
  15833. stream is selected, and @var{timestamp} is automatically converted
  15834. from AV_TIME_BASE units to the stream specific time_base.
  15835. @item
  15836. @var{timestamp}: Timestamp in AVStream.time_base units
  15837. or, if no stream is specified, in AV_TIME_BASE units.
  15838. @item
  15839. @var{flags}: Flags which select direction and seeking mode.
  15840. @end itemize
  15841. @item get_duration
  15842. Get movie duration in AV_TIME_BASE units.
  15843. @end table
  15844. @c man end MULTIMEDIA SOURCES