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.

20039 lines
531KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @section afir
  735. Apply an arbitrary Frequency Impulse Response filter.
  736. This filter is designed for applying long FIR filters,
  737. up to 30 seconds long.
  738. It can be used as component for digital crossover filters,
  739. room equalization, cross talk cancellation, wavefield synthesis,
  740. auralization, ambiophonics and ambisonics.
  741. This filter uses second stream as FIR coefficients.
  742. If second stream holds single channel, it will be used
  743. for all input channels in first stream, otherwise
  744. number of channels in second stream must be same as
  745. number of channels in first stream.
  746. It accepts the following parameters:
  747. @table @option
  748. @item dry
  749. Set dry gain. This sets input gain.
  750. @item wet
  751. Set wet gain. This sets final output gain.
  752. @item length
  753. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  754. @item again
  755. Enable applying gain measured from power of IR.
  756. @end table
  757. @subsection Examples
  758. @itemize
  759. @item
  760. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  761. @example
  762. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  763. @end example
  764. @end itemize
  765. @anchor{aformat}
  766. @section aformat
  767. Set output format constraints for the input audio. The framework will
  768. negotiate the most appropriate format to minimize conversions.
  769. It accepts the following parameters:
  770. @table @option
  771. @item sample_fmts
  772. A '|'-separated list of requested sample formats.
  773. @item sample_rates
  774. A '|'-separated list of requested sample rates.
  775. @item channel_layouts
  776. A '|'-separated list of requested channel layouts.
  777. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  778. for the required syntax.
  779. @end table
  780. If a parameter is omitted, all values are allowed.
  781. Force the output to either unsigned 8-bit or signed 16-bit stereo
  782. @example
  783. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  784. @end example
  785. @section agate
  786. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  787. processing reduces disturbing noise between useful signals.
  788. Gating is done by detecting the volume below a chosen level @var{threshold}
  789. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  790. floor is set via @var{range}. Because an exact manipulation of the signal
  791. would cause distortion of the waveform the reduction can be levelled over
  792. time. This is done by setting @var{attack} and @var{release}.
  793. @var{attack} determines how long the signal has to fall below the threshold
  794. before any reduction will occur and @var{release} sets the time the signal
  795. has to rise above the threshold to reduce the reduction again.
  796. Shorter signals than the chosen attack time will be left untouched.
  797. @table @option
  798. @item level_in
  799. Set input level before filtering.
  800. Default is 1. Allowed range is from 0.015625 to 64.
  801. @item range
  802. Set the level of gain reduction when the signal is below the threshold.
  803. Default is 0.06125. Allowed range is from 0 to 1.
  804. @item threshold
  805. If a signal rises above this level the gain reduction is released.
  806. Default is 0.125. Allowed range is from 0 to 1.
  807. @item ratio
  808. Set a ratio by which the signal is reduced.
  809. Default is 2. Allowed range is from 1 to 9000.
  810. @item attack
  811. Amount of milliseconds the signal has to rise above the threshold before gain
  812. reduction stops.
  813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  814. @item release
  815. Amount of milliseconds the signal has to fall below the threshold before the
  816. reduction is increased again. Default is 250 milliseconds.
  817. Allowed range is from 0.01 to 9000.
  818. @item makeup
  819. Set amount of amplification of signal after processing.
  820. Default is 1. Allowed range is from 1 to 64.
  821. @item knee
  822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  823. Default is 2.828427125. Allowed range is from 1 to 8.
  824. @item detection
  825. Choose if exact signal should be taken for detection or an RMS like one.
  826. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  827. @item link
  828. Choose if the average level between all channels or the louder channel affects
  829. the reduction.
  830. Default is @code{average}. Can be @code{average} or @code{maximum}.
  831. @end table
  832. @section alimiter
  833. The limiter prevents an input signal from rising over a desired threshold.
  834. This limiter uses lookahead technology to prevent your signal from distorting.
  835. It means that there is a small delay after the signal is processed. Keep in mind
  836. that the delay it produces is the attack time you set.
  837. The filter accepts the following options:
  838. @table @option
  839. @item level_in
  840. Set input gain. Default is 1.
  841. @item level_out
  842. Set output gain. Default is 1.
  843. @item limit
  844. Don't let signals above this level pass the limiter. Default is 1.
  845. @item attack
  846. The limiter will reach its attenuation level in this amount of time in
  847. milliseconds. Default is 5 milliseconds.
  848. @item release
  849. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  850. Default is 50 milliseconds.
  851. @item asc
  852. When gain reduction is always needed ASC takes care of releasing to an
  853. average reduction level rather than reaching a reduction of 0 in the release
  854. time.
  855. @item asc_level
  856. Select how much the release time is affected by ASC, 0 means nearly no changes
  857. in release time while 1 produces higher release times.
  858. @item level
  859. Auto level output signal. Default is enabled.
  860. This normalizes audio back to 0dB if enabled.
  861. @end table
  862. Depending on picked setting it is recommended to upsample input 2x or 4x times
  863. with @ref{aresample} before applying this filter.
  864. @section allpass
  865. Apply a two-pole all-pass filter with central frequency (in Hz)
  866. @var{frequency}, and filter-width @var{width}.
  867. An all-pass filter changes the audio's frequency to phase relationship
  868. without changing its frequency to amplitude relationship.
  869. The filter accepts the following options:
  870. @table @option
  871. @item frequency, f
  872. Set frequency in Hz.
  873. @item width_type, t
  874. Set method to specify band-width of filter.
  875. @table @option
  876. @item h
  877. Hz
  878. @item q
  879. Q-Factor
  880. @item o
  881. octave
  882. @item s
  883. slope
  884. @item k
  885. kHz
  886. @end table
  887. @item width, w
  888. Specify the band-width of a filter in width_type units.
  889. @item channels, c
  890. Specify which channels to filter, by default all available are filtered.
  891. @end table
  892. @subsection Commands
  893. This filter supports the following commands:
  894. @table @option
  895. @item frequency, f
  896. Change allpass frequency.
  897. Syntax for the command is : "@var{frequency}"
  898. @item width_type, t
  899. Change allpass width_type.
  900. Syntax for the command is : "@var{width_type}"
  901. @item width, w
  902. Change allpass width.
  903. Syntax for the command is : "@var{width}"
  904. @end table
  905. @section aloop
  906. Loop audio samples.
  907. The filter accepts the following options:
  908. @table @option
  909. @item loop
  910. Set the number of loops. Setting this value to -1 will result in infinite loops.
  911. Default is 0.
  912. @item size
  913. Set maximal number of samples. Default is 0.
  914. @item start
  915. Set first sample of loop. Default is 0.
  916. @end table
  917. @anchor{amerge}
  918. @section amerge
  919. Merge two or more audio streams into a single multi-channel stream.
  920. The filter accepts the following options:
  921. @table @option
  922. @item inputs
  923. Set the number of inputs. Default is 2.
  924. @end table
  925. If the channel layouts of the inputs are disjoint, and therefore compatible,
  926. the channel layout of the output will be set accordingly and the channels
  927. will be reordered as necessary. If the channel layouts of the inputs are not
  928. disjoint, the output will have all the channels of the first input then all
  929. the channels of the second input, in that order, and the channel layout of
  930. the output will be the default value corresponding to the total number of
  931. channels.
  932. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  933. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  934. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  935. first input, b1 is the first channel of the second input).
  936. On the other hand, if both input are in stereo, the output channels will be
  937. in the default order: a1, a2, b1, b2, and the channel layout will be
  938. arbitrarily set to 4.0, which may or may not be the expected value.
  939. All inputs must have the same sample rate, and format.
  940. If inputs do not have the same duration, the output will stop with the
  941. shortest.
  942. @subsection Examples
  943. @itemize
  944. @item
  945. Merge two mono files into a stereo stream:
  946. @example
  947. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  948. @end example
  949. @item
  950. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  951. @example
  952. 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
  953. @end example
  954. @end itemize
  955. @section amix
  956. Mixes multiple audio inputs into a single output.
  957. Note that this filter only supports float samples (the @var{amerge}
  958. and @var{pan} audio filters support many formats). If the @var{amix}
  959. input has integer samples then @ref{aresample} will be automatically
  960. inserted to perform the conversion to float samples.
  961. For example
  962. @example
  963. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  964. @end example
  965. will mix 3 input audio streams to a single output with the same duration as the
  966. first input and a dropout transition time of 3 seconds.
  967. It accepts the following parameters:
  968. @table @option
  969. @item inputs
  970. The number of inputs. If unspecified, it defaults to 2.
  971. @item duration
  972. How to determine the end-of-stream.
  973. @table @option
  974. @item longest
  975. The duration of the longest input. (default)
  976. @item shortest
  977. The duration of the shortest input.
  978. @item first
  979. The duration of the first input.
  980. @end table
  981. @item dropout_transition
  982. The transition time, in seconds, for volume renormalization when an input
  983. stream ends. The default value is 2 seconds.
  984. @end table
  985. @section anequalizer
  986. High-order parametric multiband equalizer for each channel.
  987. It accepts the following parameters:
  988. @table @option
  989. @item params
  990. This option string is in format:
  991. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  992. Each equalizer band is separated by '|'.
  993. @table @option
  994. @item chn
  995. Set channel number to which equalization will be applied.
  996. If input doesn't have that channel the entry is ignored.
  997. @item f
  998. Set central frequency for band.
  999. If input doesn't have that frequency the entry is ignored.
  1000. @item w
  1001. Set band width in hertz.
  1002. @item g
  1003. Set band gain in dB.
  1004. @item t
  1005. Set filter type for band, optional, can be:
  1006. @table @samp
  1007. @item 0
  1008. Butterworth, this is default.
  1009. @item 1
  1010. Chebyshev type 1.
  1011. @item 2
  1012. Chebyshev type 2.
  1013. @end table
  1014. @end table
  1015. @item curves
  1016. With this option activated frequency response of anequalizer is displayed
  1017. in video stream.
  1018. @item size
  1019. Set video stream size. Only useful if curves option is activated.
  1020. @item mgain
  1021. Set max gain that will be displayed. Only useful if curves option is activated.
  1022. Setting this to a reasonable value makes it possible to display gain which is derived from
  1023. neighbour bands which are too close to each other and thus produce higher gain
  1024. when both are activated.
  1025. @item fscale
  1026. Set frequency scale used to draw frequency response in video output.
  1027. Can be linear or logarithmic. Default is logarithmic.
  1028. @item colors
  1029. Set color for each channel curve which is going to be displayed in video stream.
  1030. This is list of color names separated by space or by '|'.
  1031. Unrecognised or missing colors will be replaced by white color.
  1032. @end table
  1033. @subsection Examples
  1034. @itemize
  1035. @item
  1036. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1037. for first 2 channels using Chebyshev type 1 filter:
  1038. @example
  1039. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1040. @end example
  1041. @end itemize
  1042. @subsection Commands
  1043. This filter supports the following commands:
  1044. @table @option
  1045. @item change
  1046. Alter existing filter parameters.
  1047. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1048. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1049. error is returned.
  1050. @var{freq} set new frequency parameter.
  1051. @var{width} set new width parameter in herz.
  1052. @var{gain} set new gain parameter in dB.
  1053. Full filter invocation with asendcmd may look like this:
  1054. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1055. @end table
  1056. @section anull
  1057. Pass the audio source unchanged to the output.
  1058. @section apad
  1059. Pad the end of an audio stream with silence.
  1060. This can be used together with @command{ffmpeg} @option{-shortest} to
  1061. extend audio streams to the same length as the video stream.
  1062. A description of the accepted options follows.
  1063. @table @option
  1064. @item packet_size
  1065. Set silence packet size. Default value is 4096.
  1066. @item pad_len
  1067. Set the number of samples of silence to add to the end. After the
  1068. value is reached, the stream is terminated. This option is mutually
  1069. exclusive with @option{whole_len}.
  1070. @item whole_len
  1071. Set the minimum total number of samples in the output audio stream. If
  1072. the value is longer than the input audio length, silence is added to
  1073. the end, until the value is reached. This option is mutually exclusive
  1074. with @option{pad_len}.
  1075. @end table
  1076. If neither the @option{pad_len} nor the @option{whole_len} option is
  1077. set, the filter will add silence to the end of the input stream
  1078. indefinitely.
  1079. @subsection Examples
  1080. @itemize
  1081. @item
  1082. Add 1024 samples of silence to the end of the input:
  1083. @example
  1084. apad=pad_len=1024
  1085. @end example
  1086. @item
  1087. Make sure the audio output will contain at least 10000 samples, pad
  1088. the input with silence if required:
  1089. @example
  1090. apad=whole_len=10000
  1091. @end example
  1092. @item
  1093. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1094. video stream will always result the shortest and will be converted
  1095. until the end in the output file when using the @option{shortest}
  1096. option:
  1097. @example
  1098. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1099. @end example
  1100. @end itemize
  1101. @section aphaser
  1102. Add a phasing effect to the input audio.
  1103. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1104. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1105. A description of the accepted parameters follows.
  1106. @table @option
  1107. @item in_gain
  1108. Set input gain. Default is 0.4.
  1109. @item out_gain
  1110. Set output gain. Default is 0.74
  1111. @item delay
  1112. Set delay in milliseconds. Default is 3.0.
  1113. @item decay
  1114. Set decay. Default is 0.4.
  1115. @item speed
  1116. Set modulation speed in Hz. Default is 0.5.
  1117. @item type
  1118. Set modulation type. Default is triangular.
  1119. It accepts the following values:
  1120. @table @samp
  1121. @item triangular, t
  1122. @item sinusoidal, s
  1123. @end table
  1124. @end table
  1125. @section apulsator
  1126. Audio pulsator is something between an autopanner and a tremolo.
  1127. But it can produce funny stereo effects as well. Pulsator changes the volume
  1128. of the left and right channel based on a LFO (low frequency oscillator) with
  1129. different waveforms and shifted phases.
  1130. This filter have the ability to define an offset between left and right
  1131. channel. An offset of 0 means that both LFO shapes match each other.
  1132. The left and right channel are altered equally - a conventional tremolo.
  1133. An offset of 50% means that the shape of the right channel is exactly shifted
  1134. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1135. an autopanner. At 1 both curves match again. Every setting in between moves the
  1136. phase shift gapless between all stages and produces some "bypassing" sounds with
  1137. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1138. the 0.5) the faster the signal passes from the left to the right speaker.
  1139. The filter accepts the following options:
  1140. @table @option
  1141. @item level_in
  1142. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1143. @item level_out
  1144. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1145. @item mode
  1146. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1147. sawup or sawdown. Default is sine.
  1148. @item amount
  1149. Set modulation. Define how much of original signal is affected by the LFO.
  1150. @item offset_l
  1151. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1152. @item offset_r
  1153. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1154. @item width
  1155. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1156. @item timing
  1157. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1158. @item bpm
  1159. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1160. is set to bpm.
  1161. @item ms
  1162. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1163. is set to ms.
  1164. @item hz
  1165. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1166. if timing is set to hz.
  1167. @end table
  1168. @anchor{aresample}
  1169. @section aresample
  1170. Resample the input audio to the specified parameters, using the
  1171. libswresample library. If none are specified then the filter will
  1172. automatically convert between its input and output.
  1173. This filter is also able to stretch/squeeze the audio data to make it match
  1174. the timestamps or to inject silence / cut out audio to make it match the
  1175. timestamps, do a combination of both or do neither.
  1176. The filter accepts the syntax
  1177. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1178. expresses a sample rate and @var{resampler_options} is a list of
  1179. @var{key}=@var{value} pairs, separated by ":". See the
  1180. @ref{Resampler Options,,the "Resampler Options" section in the
  1181. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1182. for the complete list of supported options.
  1183. @subsection Examples
  1184. @itemize
  1185. @item
  1186. Resample the input audio to 44100Hz:
  1187. @example
  1188. aresample=44100
  1189. @end example
  1190. @item
  1191. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1192. samples per second compensation:
  1193. @example
  1194. aresample=async=1000
  1195. @end example
  1196. @end itemize
  1197. @section areverse
  1198. Reverse an audio clip.
  1199. Warning: This filter requires memory to buffer the entire clip, so trimming
  1200. is suggested.
  1201. @subsection Examples
  1202. @itemize
  1203. @item
  1204. Take the first 5 seconds of a clip, and reverse it.
  1205. @example
  1206. atrim=end=5,areverse
  1207. @end example
  1208. @end itemize
  1209. @section asetnsamples
  1210. Set the number of samples per each output audio frame.
  1211. The last output packet may contain a different number of samples, as
  1212. the filter will flush all the remaining samples when the input audio
  1213. signals its end.
  1214. The filter accepts the following options:
  1215. @table @option
  1216. @item nb_out_samples, n
  1217. Set the number of frames per each output audio frame. The number is
  1218. intended as the number of samples @emph{per each channel}.
  1219. Default value is 1024.
  1220. @item pad, p
  1221. If set to 1, the filter will pad the last audio frame with zeroes, so
  1222. that the last frame will contain the same number of samples as the
  1223. previous ones. Default value is 1.
  1224. @end table
  1225. For example, to set the number of per-frame samples to 1234 and
  1226. disable padding for the last frame, use:
  1227. @example
  1228. asetnsamples=n=1234:p=0
  1229. @end example
  1230. @section asetrate
  1231. Set the sample rate without altering the PCM data.
  1232. This will result in a change of speed and pitch.
  1233. The filter accepts the following options:
  1234. @table @option
  1235. @item sample_rate, r
  1236. Set the output sample rate. Default is 44100 Hz.
  1237. @end table
  1238. @section ashowinfo
  1239. Show a line containing various information for each input audio frame.
  1240. The input audio is not modified.
  1241. The shown line contains a sequence of key/value pairs of the form
  1242. @var{key}:@var{value}.
  1243. The following values are shown in the output:
  1244. @table @option
  1245. @item n
  1246. The (sequential) number of the input frame, starting from 0.
  1247. @item pts
  1248. The presentation timestamp of the input frame, in time base units; the time base
  1249. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1250. @item pts_time
  1251. The presentation timestamp of the input frame in seconds.
  1252. @item pos
  1253. position of the frame in the input stream, -1 if this information in
  1254. unavailable and/or meaningless (for example in case of synthetic audio)
  1255. @item fmt
  1256. The sample format.
  1257. @item chlayout
  1258. The channel layout.
  1259. @item rate
  1260. The sample rate for the audio frame.
  1261. @item nb_samples
  1262. The number of samples (per channel) in the frame.
  1263. @item checksum
  1264. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1265. audio, the data is treated as if all the planes were concatenated.
  1266. @item plane_checksums
  1267. A list of Adler-32 checksums for each data plane.
  1268. @end table
  1269. @anchor{astats}
  1270. @section astats
  1271. Display time domain statistical information about the audio channels.
  1272. Statistics are calculated and displayed for each audio channel and,
  1273. where applicable, an overall figure is also given.
  1274. It accepts the following option:
  1275. @table @option
  1276. @item length
  1277. Short window length in seconds, used for peak and trough RMS measurement.
  1278. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1279. @item metadata
  1280. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1281. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1282. disabled.
  1283. Available keys for each channel are:
  1284. DC_offset
  1285. Min_level
  1286. Max_level
  1287. Min_difference
  1288. Max_difference
  1289. Mean_difference
  1290. RMS_difference
  1291. Peak_level
  1292. RMS_peak
  1293. RMS_trough
  1294. Crest_factor
  1295. Flat_factor
  1296. Peak_count
  1297. Bit_depth
  1298. Dynamic_range
  1299. and for Overall:
  1300. DC_offset
  1301. Min_level
  1302. Max_level
  1303. Min_difference
  1304. Max_difference
  1305. Mean_difference
  1306. RMS_difference
  1307. Peak_level
  1308. RMS_level
  1309. RMS_peak
  1310. RMS_trough
  1311. Flat_factor
  1312. Peak_count
  1313. Bit_depth
  1314. Number_of_samples
  1315. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1316. this @code{lavfi.astats.Overall.Peak_count}.
  1317. For description what each key means read below.
  1318. @item reset
  1319. Set number of frame after which stats are going to be recalculated.
  1320. Default is disabled.
  1321. @end table
  1322. A description of each shown parameter follows:
  1323. @table @option
  1324. @item DC offset
  1325. Mean amplitude displacement from zero.
  1326. @item Min level
  1327. Minimal sample level.
  1328. @item Max level
  1329. Maximal sample level.
  1330. @item Min difference
  1331. Minimal difference between two consecutive samples.
  1332. @item Max difference
  1333. Maximal difference between two consecutive samples.
  1334. @item Mean difference
  1335. Mean difference between two consecutive samples.
  1336. The average of each difference between two consecutive samples.
  1337. @item RMS difference
  1338. Root Mean Square difference between two consecutive samples.
  1339. @item Peak level dB
  1340. @item RMS level dB
  1341. Standard peak and RMS level measured in dBFS.
  1342. @item RMS peak dB
  1343. @item RMS trough dB
  1344. Peak and trough values for RMS level measured over a short window.
  1345. @item Crest factor
  1346. Standard ratio of peak to RMS level (note: not in dB).
  1347. @item Flat factor
  1348. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1349. (i.e. either @var{Min level} or @var{Max level}).
  1350. @item Peak count
  1351. Number of occasions (not the number of samples) that the signal attained either
  1352. @var{Min level} or @var{Max level}.
  1353. @item Bit depth
  1354. Overall bit depth of audio. Number of bits used for each sample.
  1355. @item Dynamic range
  1356. Measured dynamic range of audio in dB.
  1357. @end table
  1358. @section atempo
  1359. Adjust audio tempo.
  1360. The filter accepts exactly one parameter, the audio tempo. If not
  1361. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1362. be in the [0.5, 2.0] range.
  1363. @subsection Examples
  1364. @itemize
  1365. @item
  1366. Slow down audio to 80% tempo:
  1367. @example
  1368. atempo=0.8
  1369. @end example
  1370. @item
  1371. To speed up audio to 125% tempo:
  1372. @example
  1373. atempo=1.25
  1374. @end example
  1375. @end itemize
  1376. @section atrim
  1377. Trim the input so that the output contains one continuous subpart of the input.
  1378. It accepts the following parameters:
  1379. @table @option
  1380. @item start
  1381. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1382. sample with the timestamp @var{start} will be the first sample in the output.
  1383. @item end
  1384. Specify time of the first audio sample that will be dropped, i.e. the
  1385. audio sample immediately preceding the one with the timestamp @var{end} will be
  1386. the last sample in the output.
  1387. @item start_pts
  1388. Same as @var{start}, except this option sets the start timestamp in samples
  1389. instead of seconds.
  1390. @item end_pts
  1391. Same as @var{end}, except this option sets the end timestamp in samples instead
  1392. of seconds.
  1393. @item duration
  1394. The maximum duration of the output in seconds.
  1395. @item start_sample
  1396. The number of the first sample that should be output.
  1397. @item end_sample
  1398. The number of the first sample that should be dropped.
  1399. @end table
  1400. @option{start}, @option{end}, and @option{duration} are expressed as time
  1401. duration specifications; see
  1402. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1403. Note that the first two sets of the start/end options and the @option{duration}
  1404. option look at the frame timestamp, while the _sample options simply count the
  1405. samples that pass through the filter. So start/end_pts and start/end_sample will
  1406. give different results when the timestamps are wrong, inexact or do not start at
  1407. zero. Also note that this filter does not modify the timestamps. If you wish
  1408. to have the output timestamps start at zero, insert the asetpts filter after the
  1409. atrim filter.
  1410. If multiple start or end options are set, this filter tries to be greedy and
  1411. keep all samples that match at least one of the specified constraints. To keep
  1412. only the part that matches all the constraints at once, chain multiple atrim
  1413. filters.
  1414. The defaults are such that all the input is kept. So it is possible to set e.g.
  1415. just the end values to keep everything before the specified time.
  1416. Examples:
  1417. @itemize
  1418. @item
  1419. Drop everything except the second minute of input:
  1420. @example
  1421. ffmpeg -i INPUT -af atrim=60:120
  1422. @end example
  1423. @item
  1424. Keep only the first 1000 samples:
  1425. @example
  1426. ffmpeg -i INPUT -af atrim=end_sample=1000
  1427. @end example
  1428. @end itemize
  1429. @section bandpass
  1430. Apply a two-pole Butterworth band-pass filter with central
  1431. frequency @var{frequency}, and (3dB-point) band-width width.
  1432. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1433. instead of the default: constant 0dB peak gain.
  1434. The filter roll off at 6dB per octave (20dB per decade).
  1435. The filter accepts the following options:
  1436. @table @option
  1437. @item frequency, f
  1438. Set the filter's central frequency. Default is @code{3000}.
  1439. @item csg
  1440. Constant skirt gain if set to 1. Defaults to 0.
  1441. @item width_type, t
  1442. Set method to specify band-width of filter.
  1443. @table @option
  1444. @item h
  1445. Hz
  1446. @item q
  1447. Q-Factor
  1448. @item o
  1449. octave
  1450. @item s
  1451. slope
  1452. @item k
  1453. kHz
  1454. @end table
  1455. @item width, w
  1456. Specify the band-width of a filter in width_type units.
  1457. @item channels, c
  1458. Specify which channels to filter, by default all available are filtered.
  1459. @end table
  1460. @subsection Commands
  1461. This filter supports the following commands:
  1462. @table @option
  1463. @item frequency, f
  1464. Change bandpass frequency.
  1465. Syntax for the command is : "@var{frequency}"
  1466. @item width_type, t
  1467. Change bandpass width_type.
  1468. Syntax for the command is : "@var{width_type}"
  1469. @item width, w
  1470. Change bandpass width.
  1471. Syntax for the command is : "@var{width}"
  1472. @end table
  1473. @section bandreject
  1474. Apply a two-pole Butterworth band-reject filter with central
  1475. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1476. The filter roll off at 6dB per octave (20dB per decade).
  1477. The filter accepts the following options:
  1478. @table @option
  1479. @item frequency, f
  1480. Set the filter's central frequency. Default is @code{3000}.
  1481. @item width_type, t
  1482. Set method to specify band-width of filter.
  1483. @table @option
  1484. @item h
  1485. Hz
  1486. @item q
  1487. Q-Factor
  1488. @item o
  1489. octave
  1490. @item s
  1491. slope
  1492. @item k
  1493. kHz
  1494. @end table
  1495. @item width, w
  1496. Specify the band-width of a filter in width_type units.
  1497. @item channels, c
  1498. Specify which channels to filter, by default all available are filtered.
  1499. @end table
  1500. @subsection Commands
  1501. This filter supports the following commands:
  1502. @table @option
  1503. @item frequency, f
  1504. Change bandreject frequency.
  1505. Syntax for the command is : "@var{frequency}"
  1506. @item width_type, t
  1507. Change bandreject width_type.
  1508. Syntax for the command is : "@var{width_type}"
  1509. @item width, w
  1510. Change bandreject width.
  1511. Syntax for the command is : "@var{width}"
  1512. @end table
  1513. @section bass
  1514. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1515. shelving filter with a response similar to that of a standard
  1516. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1517. The filter accepts the following options:
  1518. @table @option
  1519. @item gain, g
  1520. Give the gain at 0 Hz. Its useful range is about -20
  1521. (for a large cut) to +20 (for a large boost).
  1522. Beware of clipping when using a positive gain.
  1523. @item frequency, f
  1524. Set the filter's central frequency and so can be used
  1525. to extend or reduce the frequency range to be boosted or cut.
  1526. The default value is @code{100} Hz.
  1527. @item width_type, t
  1528. Set method to specify band-width of filter.
  1529. @table @option
  1530. @item h
  1531. Hz
  1532. @item q
  1533. Q-Factor
  1534. @item o
  1535. octave
  1536. @item s
  1537. slope
  1538. @item k
  1539. kHz
  1540. @end table
  1541. @item width, w
  1542. Determine how steep is the filter's shelf transition.
  1543. @item channels, c
  1544. Specify which channels to filter, by default all available are filtered.
  1545. @end table
  1546. @subsection Commands
  1547. This filter supports the following commands:
  1548. @table @option
  1549. @item frequency, f
  1550. Change bass frequency.
  1551. Syntax for the command is : "@var{frequency}"
  1552. @item width_type, t
  1553. Change bass width_type.
  1554. Syntax for the command is : "@var{width_type}"
  1555. @item width, w
  1556. Change bass width.
  1557. Syntax for the command is : "@var{width}"
  1558. @item gain, g
  1559. Change bass gain.
  1560. Syntax for the command is : "@var{gain}"
  1561. @end table
  1562. @section biquad
  1563. Apply a biquad IIR filter with the given coefficients.
  1564. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1565. are the numerator and denominator coefficients respectively.
  1566. and @var{channels}, @var{c} specify which channels to filter, by default all
  1567. available are filtered.
  1568. @subsection Commands
  1569. This filter supports the following commands:
  1570. @table @option
  1571. @item a0
  1572. @item a1
  1573. @item a2
  1574. @item b0
  1575. @item b1
  1576. @item b2
  1577. Change biquad parameter.
  1578. Syntax for the command is : "@var{value}"
  1579. @end table
  1580. @section bs2b
  1581. Bauer stereo to binaural transformation, which improves headphone listening of
  1582. stereo audio records.
  1583. To enable compilation of this filter you need to configure FFmpeg with
  1584. @code{--enable-libbs2b}.
  1585. It accepts the following parameters:
  1586. @table @option
  1587. @item profile
  1588. Pre-defined crossfeed level.
  1589. @table @option
  1590. @item default
  1591. Default level (fcut=700, feed=50).
  1592. @item cmoy
  1593. Chu Moy circuit (fcut=700, feed=60).
  1594. @item jmeier
  1595. Jan Meier circuit (fcut=650, feed=95).
  1596. @end table
  1597. @item fcut
  1598. Cut frequency (in Hz).
  1599. @item feed
  1600. Feed level (in Hz).
  1601. @end table
  1602. @section channelmap
  1603. Remap input channels to new locations.
  1604. It accepts the following parameters:
  1605. @table @option
  1606. @item map
  1607. Map channels from input to output. The argument is a '|'-separated list of
  1608. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1609. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1610. channel (e.g. FL for front left) or its index in the input channel layout.
  1611. @var{out_channel} is the name of the output channel or its index in the output
  1612. channel layout. If @var{out_channel} is not given then it is implicitly an
  1613. index, starting with zero and increasing by one for each mapping.
  1614. @item channel_layout
  1615. The channel layout of the output stream.
  1616. @end table
  1617. If no mapping is present, the filter will implicitly map input channels to
  1618. output channels, preserving indices.
  1619. For example, assuming a 5.1+downmix input MOV file,
  1620. @example
  1621. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1622. @end example
  1623. will create an output WAV file tagged as stereo from the downmix channels of
  1624. the input.
  1625. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1626. @example
  1627. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1628. @end example
  1629. @section channelsplit
  1630. Split each channel from an input audio stream into a separate output stream.
  1631. It accepts the following parameters:
  1632. @table @option
  1633. @item channel_layout
  1634. The channel layout of the input stream. The default is "stereo".
  1635. @end table
  1636. For example, assuming a stereo input MP3 file,
  1637. @example
  1638. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1639. @end example
  1640. will create an output Matroska file with two audio streams, one containing only
  1641. the left channel and the other the right channel.
  1642. Split a 5.1 WAV file into per-channel files:
  1643. @example
  1644. ffmpeg -i in.wav -filter_complex
  1645. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1646. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1647. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1648. side_right.wav
  1649. @end example
  1650. @section chorus
  1651. Add a chorus effect to the audio.
  1652. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1653. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1654. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1655. The modulation depth defines the range the modulated delay is played before or after
  1656. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1657. sound tuned around the original one, like in a chorus where some vocals are slightly
  1658. off key.
  1659. It accepts the following parameters:
  1660. @table @option
  1661. @item in_gain
  1662. Set input gain. Default is 0.4.
  1663. @item out_gain
  1664. Set output gain. Default is 0.4.
  1665. @item delays
  1666. Set delays. A typical delay is around 40ms to 60ms.
  1667. @item decays
  1668. Set decays.
  1669. @item speeds
  1670. Set speeds.
  1671. @item depths
  1672. Set depths.
  1673. @end table
  1674. @subsection Examples
  1675. @itemize
  1676. @item
  1677. A single delay:
  1678. @example
  1679. chorus=0.7:0.9:55:0.4:0.25:2
  1680. @end example
  1681. @item
  1682. Two delays:
  1683. @example
  1684. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1685. @end example
  1686. @item
  1687. Fuller sounding chorus with three delays:
  1688. @example
  1689. 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
  1690. @end example
  1691. @end itemize
  1692. @section compand
  1693. Compress or expand the audio's dynamic range.
  1694. It accepts the following parameters:
  1695. @table @option
  1696. @item attacks
  1697. @item decays
  1698. A list of times in seconds for each channel over which the instantaneous level
  1699. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1700. increase of volume and @var{decays} refers to decrease of volume. For most
  1701. situations, the attack time (response to the audio getting louder) should be
  1702. shorter than the decay time, because the human ear is more sensitive to sudden
  1703. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1704. a typical value for decay is 0.8 seconds.
  1705. If specified number of attacks & decays is lower than number of channels, the last
  1706. set attack/decay will be used for all remaining channels.
  1707. @item points
  1708. A list of points for the transfer function, specified in dB relative to the
  1709. maximum possible signal amplitude. Each key points list must be defined using
  1710. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1711. @code{x0/y0 x1/y1 x2/y2 ....}
  1712. The input values must be in strictly increasing order but the transfer function
  1713. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1714. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1715. function are @code{-70/-70|-60/-20|1/0}.
  1716. @item soft-knee
  1717. Set the curve radius in dB for all joints. It defaults to 0.01.
  1718. @item gain
  1719. Set the additional gain in dB to be applied at all points on the transfer
  1720. function. This allows for easy adjustment of the overall gain.
  1721. It defaults to 0.
  1722. @item volume
  1723. Set an initial volume, in dB, to be assumed for each channel when filtering
  1724. starts. This permits the user to supply a nominal level initially, so that, for
  1725. example, a very large gain is not applied to initial signal levels before the
  1726. companding has begun to operate. A typical value for audio which is initially
  1727. quiet is -90 dB. It defaults to 0.
  1728. @item delay
  1729. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1730. delayed before being fed to the volume adjuster. Specifying a delay
  1731. approximately equal to the attack/decay times allows the filter to effectively
  1732. operate in predictive rather than reactive mode. It defaults to 0.
  1733. @end table
  1734. @subsection Examples
  1735. @itemize
  1736. @item
  1737. Make music with both quiet and loud passages suitable for listening to in a
  1738. noisy environment:
  1739. @example
  1740. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1741. @end example
  1742. Another example for audio with whisper and explosion parts:
  1743. @example
  1744. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1745. @end example
  1746. @item
  1747. A noise gate for when the noise is at a lower level than the signal:
  1748. @example
  1749. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1750. @end example
  1751. @item
  1752. Here is another noise gate, this time for when the noise is at a higher level
  1753. than the signal (making it, in some ways, similar to squelch):
  1754. @example
  1755. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1756. @end example
  1757. @item
  1758. 2:1 compression starting at -6dB:
  1759. @example
  1760. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1761. @end example
  1762. @item
  1763. 2:1 compression starting at -9dB:
  1764. @example
  1765. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1766. @end example
  1767. @item
  1768. 2:1 compression starting at -12dB:
  1769. @example
  1770. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1771. @end example
  1772. @item
  1773. 2:1 compression starting at -18dB:
  1774. @example
  1775. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1776. @end example
  1777. @item
  1778. 3:1 compression starting at -15dB:
  1779. @example
  1780. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1781. @end example
  1782. @item
  1783. Compressor/Gate:
  1784. @example
  1785. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1786. @end example
  1787. @item
  1788. Expander:
  1789. @example
  1790. 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
  1791. @end example
  1792. @item
  1793. Hard limiter at -6dB:
  1794. @example
  1795. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1796. @end example
  1797. @item
  1798. Hard limiter at -12dB:
  1799. @example
  1800. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1801. @end example
  1802. @item
  1803. Hard noise gate at -35 dB:
  1804. @example
  1805. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1806. @end example
  1807. @item
  1808. Soft limiter:
  1809. @example
  1810. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1811. @end example
  1812. @end itemize
  1813. @section compensationdelay
  1814. Compensation Delay Line is a metric based delay to compensate differing
  1815. positions of microphones or speakers.
  1816. For example, you have recorded guitar with two microphones placed in
  1817. different location. Because the front of sound wave has fixed speed in
  1818. normal conditions, the phasing of microphones can vary and depends on
  1819. their location and interposition. The best sound mix can be achieved when
  1820. these microphones are in phase (synchronized). Note that distance of
  1821. ~30 cm between microphones makes one microphone to capture signal in
  1822. antiphase to another microphone. That makes the final mix sounding moody.
  1823. This filter helps to solve phasing problems by adding different delays
  1824. to each microphone track and make them synchronized.
  1825. The best result can be reached when you take one track as base and
  1826. synchronize other tracks one by one with it.
  1827. Remember that synchronization/delay tolerance depends on sample rate, too.
  1828. Higher sample rates will give more tolerance.
  1829. It accepts the following parameters:
  1830. @table @option
  1831. @item mm
  1832. Set millimeters distance. This is compensation distance for fine tuning.
  1833. Default is 0.
  1834. @item cm
  1835. Set cm distance. This is compensation distance for tightening distance setup.
  1836. Default is 0.
  1837. @item m
  1838. Set meters distance. This is compensation distance for hard distance setup.
  1839. Default is 0.
  1840. @item dry
  1841. Set dry amount. Amount of unprocessed (dry) signal.
  1842. Default is 0.
  1843. @item wet
  1844. Set wet amount. Amount of processed (wet) signal.
  1845. Default is 1.
  1846. @item temp
  1847. Set temperature degree in Celsius. This is the temperature of the environment.
  1848. Default is 20.
  1849. @end table
  1850. @section crossfeed
  1851. Apply headphone crossfeed filter.
  1852. Crossfeed is the process of blending the left and right channels of stereo
  1853. audio recording.
  1854. It is mainly used to reduce extreme stereo separation of low frequencies.
  1855. The intent is to produce more speaker like sound to the listener.
  1856. The filter accepts the following options:
  1857. @table @option
  1858. @item strength
  1859. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1860. This sets gain of low shelf filter for side part of stereo image.
  1861. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1862. @item range
  1863. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1864. This sets cut off frequency of low shelf filter. Default is cut off near
  1865. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1866. @item level_in
  1867. Set input gain. Default is 0.9.
  1868. @item level_out
  1869. Set output gain. Default is 1.
  1870. @end table
  1871. @section crystalizer
  1872. Simple algorithm to expand audio dynamic range.
  1873. The filter accepts the following options:
  1874. @table @option
  1875. @item i
  1876. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1877. (unchanged sound) to 10.0 (maximum effect).
  1878. @item c
  1879. Enable clipping. By default is enabled.
  1880. @end table
  1881. @section dcshift
  1882. Apply a DC shift to the audio.
  1883. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1884. in the recording chain) from the audio. The effect of a DC offset is reduced
  1885. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1886. a signal has a DC offset.
  1887. @table @option
  1888. @item shift
  1889. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1890. the audio.
  1891. @item limitergain
  1892. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1893. used to prevent clipping.
  1894. @end table
  1895. @section dynaudnorm
  1896. Dynamic Audio Normalizer.
  1897. This filter applies a certain amount of gain to the input audio in order
  1898. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1899. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1900. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1901. This allows for applying extra gain to the "quiet" sections of the audio
  1902. while avoiding distortions or clipping the "loud" sections. In other words:
  1903. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1904. sections, in the sense that the volume of each section is brought to the
  1905. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1906. this goal *without* applying "dynamic range compressing". It will retain 100%
  1907. of the dynamic range *within* each section of the audio file.
  1908. @table @option
  1909. @item f
  1910. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1911. Default is 500 milliseconds.
  1912. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1913. referred to as frames. This is required, because a peak magnitude has no
  1914. meaning for just a single sample value. Instead, we need to determine the
  1915. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1916. normalizer would simply use the peak magnitude of the complete file, the
  1917. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1918. frame. The length of a frame is specified in milliseconds. By default, the
  1919. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1920. been found to give good results with most files.
  1921. Note that the exact frame length, in number of samples, will be determined
  1922. automatically, based on the sampling rate of the individual input audio file.
  1923. @item g
  1924. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1925. number. Default is 31.
  1926. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1927. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1928. is specified in frames, centered around the current frame. For the sake of
  1929. simplicity, this must be an odd number. Consequently, the default value of 31
  1930. takes into account the current frame, as well as the 15 preceding frames and
  1931. the 15 subsequent frames. Using a larger window results in a stronger
  1932. smoothing effect and thus in less gain variation, i.e. slower gain
  1933. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1934. effect and thus in more gain variation, i.e. faster gain adaptation.
  1935. In other words, the more you increase this value, the more the Dynamic Audio
  1936. Normalizer will behave like a "traditional" normalization filter. On the
  1937. contrary, the more you decrease this value, the more the Dynamic Audio
  1938. Normalizer will behave like a dynamic range compressor.
  1939. @item p
  1940. Set the target peak value. This specifies the highest permissible magnitude
  1941. level for the normalized audio input. This filter will try to approach the
  1942. target peak magnitude as closely as possible, but at the same time it also
  1943. makes sure that the normalized signal will never exceed the peak magnitude.
  1944. A frame's maximum local gain factor is imposed directly by the target peak
  1945. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1946. It is not recommended to go above this value.
  1947. @item m
  1948. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1949. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1950. factor for each input frame, i.e. the maximum gain factor that does not
  1951. result in clipping or distortion. The maximum gain factor is determined by
  1952. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1953. additionally bounds the frame's maximum gain factor by a predetermined
  1954. (global) maximum gain factor. This is done in order to avoid excessive gain
  1955. factors in "silent" or almost silent frames. By default, the maximum gain
  1956. factor is 10.0, For most inputs the default value should be sufficient and
  1957. it usually is not recommended to increase this value. Though, for input
  1958. with an extremely low overall volume level, it may be necessary to allow even
  1959. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1960. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1961. Instead, a "sigmoid" threshold function will be applied. This way, the
  1962. gain factors will smoothly approach the threshold value, but never exceed that
  1963. value.
  1964. @item r
  1965. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1966. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1967. This means that the maximum local gain factor for each frame is defined
  1968. (only) by the frame's highest magnitude sample. This way, the samples can
  1969. be amplified as much as possible without exceeding the maximum signal
  1970. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1971. Normalizer can also take into account the frame's root mean square,
  1972. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1973. determine the power of a time-varying signal. It is therefore considered
  1974. that the RMS is a better approximation of the "perceived loudness" than
  1975. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1976. frames to a constant RMS value, a uniform "perceived loudness" can be
  1977. established. If a target RMS value has been specified, a frame's local gain
  1978. factor is defined as the factor that would result in exactly that RMS value.
  1979. Note, however, that the maximum local gain factor is still restricted by the
  1980. frame's highest magnitude sample, in order to prevent clipping.
  1981. @item n
  1982. Enable channels coupling. By default is enabled.
  1983. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1984. amount. This means the same gain factor will be applied to all channels, i.e.
  1985. the maximum possible gain factor is determined by the "loudest" channel.
  1986. However, in some recordings, it may happen that the volume of the different
  1987. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1988. In this case, this option can be used to disable the channel coupling. This way,
  1989. the gain factor will be determined independently for each channel, depending
  1990. only on the individual channel's highest magnitude sample. This allows for
  1991. harmonizing the volume of the different channels.
  1992. @item c
  1993. Enable DC bias correction. By default is disabled.
  1994. An audio signal (in the time domain) is a sequence of sample values.
  1995. In the Dynamic Audio Normalizer these sample values are represented in the
  1996. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1997. audio signal, or "waveform", should be centered around the zero point.
  1998. That means if we calculate the mean value of all samples in a file, or in a
  1999. single frame, then the result should be 0.0 or at least very close to that
  2000. value. If, however, there is a significant deviation of the mean value from
  2001. 0.0, in either positive or negative direction, this is referred to as a
  2002. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2003. Audio Normalizer provides optional DC bias correction.
  2004. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2005. the mean value, or "DC correction" offset, of each input frame and subtract
  2006. that value from all of the frame's sample values which ensures those samples
  2007. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2008. boundaries, the DC correction offset values will be interpolated smoothly
  2009. between neighbouring frames.
  2010. @item b
  2011. Enable alternative boundary mode. By default is disabled.
  2012. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2013. around each frame. This includes the preceding frames as well as the
  2014. subsequent frames. However, for the "boundary" frames, located at the very
  2015. beginning and at the very end of the audio file, not all neighbouring
  2016. frames are available. In particular, for the first few frames in the audio
  2017. file, the preceding frames are not known. And, similarly, for the last few
  2018. frames in the audio file, the subsequent frames are not known. Thus, the
  2019. question arises which gain factors should be assumed for the missing frames
  2020. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2021. to deal with this situation. The default boundary mode assumes a gain factor
  2022. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2023. "fade out" at the beginning and at the end of the input, respectively.
  2024. @item s
  2025. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2026. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2027. compression. This means that signal peaks will not be pruned and thus the
  2028. full dynamic range will be retained within each local neighbourhood. However,
  2029. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2030. normalization algorithm with a more "traditional" compression.
  2031. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2032. (thresholding) function. If (and only if) the compression feature is enabled,
  2033. all input frames will be processed by a soft knee thresholding function prior
  2034. to the actual normalization process. Put simply, the thresholding function is
  2035. going to prune all samples whose magnitude exceeds a certain threshold value.
  2036. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2037. value. Instead, the threshold value will be adjusted for each individual
  2038. frame.
  2039. In general, smaller parameters result in stronger compression, and vice versa.
  2040. Values below 3.0 are not recommended, because audible distortion may appear.
  2041. @end table
  2042. @section earwax
  2043. Make audio easier to listen to on headphones.
  2044. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2045. so that when listened to on headphones the stereo image is moved from
  2046. inside your head (standard for headphones) to outside and in front of
  2047. the listener (standard for speakers).
  2048. Ported from SoX.
  2049. @section equalizer
  2050. Apply a two-pole peaking equalisation (EQ) filter. With this
  2051. filter, the signal-level at and around a selected frequency can
  2052. be increased or decreased, whilst (unlike bandpass and bandreject
  2053. filters) that at all other frequencies is unchanged.
  2054. In order to produce complex equalisation curves, this filter can
  2055. be given several times, each with a different central frequency.
  2056. The filter accepts the following options:
  2057. @table @option
  2058. @item frequency, f
  2059. Set the filter's central frequency in Hz.
  2060. @item width_type, t
  2061. Set method to specify band-width of filter.
  2062. @table @option
  2063. @item h
  2064. Hz
  2065. @item q
  2066. Q-Factor
  2067. @item o
  2068. octave
  2069. @item s
  2070. slope
  2071. @item k
  2072. kHz
  2073. @end table
  2074. @item width, w
  2075. Specify the band-width of a filter in width_type units.
  2076. @item gain, g
  2077. Set the required gain or attenuation in dB.
  2078. Beware of clipping when using a positive gain.
  2079. @item channels, c
  2080. Specify which channels to filter, by default all available are filtered.
  2081. @end table
  2082. @subsection Examples
  2083. @itemize
  2084. @item
  2085. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2086. @example
  2087. equalizer=f=1000:t=h:width=200:g=-10
  2088. @end example
  2089. @item
  2090. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2091. @example
  2092. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2093. @end example
  2094. @end itemize
  2095. @subsection Commands
  2096. This filter supports the following commands:
  2097. @table @option
  2098. @item frequency, f
  2099. Change equalizer frequency.
  2100. Syntax for the command is : "@var{frequency}"
  2101. @item width_type, t
  2102. Change equalizer width_type.
  2103. Syntax for the command is : "@var{width_type}"
  2104. @item width, w
  2105. Change equalizer width.
  2106. Syntax for the command is : "@var{width}"
  2107. @item gain, g
  2108. Change equalizer gain.
  2109. Syntax for the command is : "@var{gain}"
  2110. @end table
  2111. @section extrastereo
  2112. Linearly increases the difference between left and right channels which
  2113. adds some sort of "live" effect to playback.
  2114. The filter accepts the following options:
  2115. @table @option
  2116. @item m
  2117. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2118. (average of both channels), with 1.0 sound will be unchanged, with
  2119. -1.0 left and right channels will be swapped.
  2120. @item c
  2121. Enable clipping. By default is enabled.
  2122. @end table
  2123. @section firequalizer
  2124. Apply FIR Equalization using arbitrary frequency response.
  2125. The filter accepts the following option:
  2126. @table @option
  2127. @item gain
  2128. Set gain curve equation (in dB). The expression can contain variables:
  2129. @table @option
  2130. @item f
  2131. the evaluated frequency
  2132. @item sr
  2133. sample rate
  2134. @item ch
  2135. channel number, set to 0 when multichannels evaluation is disabled
  2136. @item chid
  2137. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2138. multichannels evaluation is disabled
  2139. @item chs
  2140. number of channels
  2141. @item chlayout
  2142. channel_layout, see libavutil/channel_layout.h
  2143. @end table
  2144. and functions:
  2145. @table @option
  2146. @item gain_interpolate(f)
  2147. interpolate gain on frequency f based on gain_entry
  2148. @item cubic_interpolate(f)
  2149. same as gain_interpolate, but smoother
  2150. @end table
  2151. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2152. @item gain_entry
  2153. Set gain entry for gain_interpolate function. The expression can
  2154. contain functions:
  2155. @table @option
  2156. @item entry(f, g)
  2157. store gain entry at frequency f with value g
  2158. @end table
  2159. This option is also available as command.
  2160. @item delay
  2161. Set filter delay in seconds. Higher value means more accurate.
  2162. Default is @code{0.01}.
  2163. @item accuracy
  2164. Set filter accuracy in Hz. Lower value means more accurate.
  2165. Default is @code{5}.
  2166. @item wfunc
  2167. Set window function. Acceptable values are:
  2168. @table @option
  2169. @item rectangular
  2170. rectangular window, useful when gain curve is already smooth
  2171. @item hann
  2172. hann window (default)
  2173. @item hamming
  2174. hamming window
  2175. @item blackman
  2176. blackman window
  2177. @item nuttall3
  2178. 3-terms continuous 1st derivative nuttall window
  2179. @item mnuttall3
  2180. minimum 3-terms discontinuous nuttall window
  2181. @item nuttall
  2182. 4-terms continuous 1st derivative nuttall window
  2183. @item bnuttall
  2184. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2185. @item bharris
  2186. blackman-harris window
  2187. @item tukey
  2188. tukey window
  2189. @end table
  2190. @item fixed
  2191. If enabled, use fixed number of audio samples. This improves speed when
  2192. filtering with large delay. Default is disabled.
  2193. @item multi
  2194. Enable multichannels evaluation on gain. Default is disabled.
  2195. @item zero_phase
  2196. Enable zero phase mode by subtracting timestamp to compensate delay.
  2197. Default is disabled.
  2198. @item scale
  2199. Set scale used by gain. Acceptable values are:
  2200. @table @option
  2201. @item linlin
  2202. linear frequency, linear gain
  2203. @item linlog
  2204. linear frequency, logarithmic (in dB) gain (default)
  2205. @item loglin
  2206. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2207. @item loglog
  2208. logarithmic frequency, logarithmic gain
  2209. @end table
  2210. @item dumpfile
  2211. Set file for dumping, suitable for gnuplot.
  2212. @item dumpscale
  2213. Set scale for dumpfile. Acceptable values are same with scale option.
  2214. Default is linlog.
  2215. @item fft2
  2216. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2217. Default is disabled.
  2218. @item min_phase
  2219. Enable minimum phase impulse response. Default is disabled.
  2220. @end table
  2221. @subsection Examples
  2222. @itemize
  2223. @item
  2224. lowpass at 1000 Hz:
  2225. @example
  2226. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2227. @end example
  2228. @item
  2229. lowpass at 1000 Hz with gain_entry:
  2230. @example
  2231. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2232. @end example
  2233. @item
  2234. custom equalization:
  2235. @example
  2236. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2237. @end example
  2238. @item
  2239. higher delay with zero phase to compensate delay:
  2240. @example
  2241. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2242. @end example
  2243. @item
  2244. lowpass on left channel, highpass on right channel:
  2245. @example
  2246. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2247. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2248. @end example
  2249. @end itemize
  2250. @section flanger
  2251. Apply a flanging effect to the audio.
  2252. The filter accepts the following options:
  2253. @table @option
  2254. @item delay
  2255. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2256. @item depth
  2257. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2258. @item regen
  2259. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2260. Default value is 0.
  2261. @item width
  2262. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2263. Default value is 71.
  2264. @item speed
  2265. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2266. @item shape
  2267. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2268. Default value is @var{sinusoidal}.
  2269. @item phase
  2270. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2271. Default value is 25.
  2272. @item interp
  2273. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2274. Default is @var{linear}.
  2275. @end table
  2276. @section haas
  2277. Apply Haas effect to audio.
  2278. Note that this makes most sense to apply on mono signals.
  2279. With this filter applied to mono signals it give some directionality and
  2280. stretches its stereo image.
  2281. The filter accepts the following options:
  2282. @table @option
  2283. @item level_in
  2284. Set input level. By default is @var{1}, or 0dB
  2285. @item level_out
  2286. Set output level. By default is @var{1}, or 0dB.
  2287. @item side_gain
  2288. Set gain applied to side part of signal. By default is @var{1}.
  2289. @item middle_source
  2290. Set kind of middle source. Can be one of the following:
  2291. @table @samp
  2292. @item left
  2293. Pick left channel.
  2294. @item right
  2295. Pick right channel.
  2296. @item mid
  2297. Pick middle part signal of stereo image.
  2298. @item side
  2299. Pick side part signal of stereo image.
  2300. @end table
  2301. @item middle_phase
  2302. Change middle phase. By default is disabled.
  2303. @item left_delay
  2304. Set left channel delay. By default is @var{2.05} milliseconds.
  2305. @item left_balance
  2306. Set left channel balance. By default is @var{-1}.
  2307. @item left_gain
  2308. Set left channel gain. By default is @var{1}.
  2309. @item left_phase
  2310. Change left phase. By default is disabled.
  2311. @item right_delay
  2312. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2313. @item right_balance
  2314. Set right channel balance. By default is @var{1}.
  2315. @item right_gain
  2316. Set right channel gain. By default is @var{1}.
  2317. @item right_phase
  2318. Change right phase. By default is enabled.
  2319. @end table
  2320. @section hdcd
  2321. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2322. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2323. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2324. of HDCD, and detects the Transient Filter flag.
  2325. @example
  2326. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2327. @end example
  2328. When using the filter with wav, note the default encoding for wav is 16-bit,
  2329. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2330. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2331. @example
  2332. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2333. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2334. @end example
  2335. The filter accepts the following options:
  2336. @table @option
  2337. @item disable_autoconvert
  2338. Disable any automatic format conversion or resampling in the filter graph.
  2339. @item process_stereo
  2340. Process the stereo channels together. If target_gain does not match between
  2341. channels, consider it invalid and use the last valid target_gain.
  2342. @item cdt_ms
  2343. Set the code detect timer period in ms.
  2344. @item force_pe
  2345. Always extend peaks above -3dBFS even if PE isn't signaled.
  2346. @item analyze_mode
  2347. Replace audio with a solid tone and adjust the amplitude to signal some
  2348. specific aspect of the decoding process. The output file can be loaded in
  2349. an audio editor alongside the original to aid analysis.
  2350. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2351. Modes are:
  2352. @table @samp
  2353. @item 0, off
  2354. Disabled
  2355. @item 1, lle
  2356. Gain adjustment level at each sample
  2357. @item 2, pe
  2358. Samples where peak extend occurs
  2359. @item 3, cdt
  2360. Samples where the code detect timer is active
  2361. @item 4, tgm
  2362. Samples where the target gain does not match between channels
  2363. @end table
  2364. @end table
  2365. @section headphone
  2366. Apply head-related transfer functions (HRTFs) to create virtual
  2367. loudspeakers around the user for binaural listening via headphones.
  2368. The HRIRs are provided via additional streams, for each channel
  2369. one stereo input stream is needed.
  2370. The filter accepts the following options:
  2371. @table @option
  2372. @item map
  2373. Set mapping of input streams for convolution.
  2374. The argument is a '|'-separated list of channel names in order as they
  2375. are given as additional stream inputs for filter.
  2376. This also specify number of input streams. Number of input streams
  2377. must be not less than number of channels in first stream plus one.
  2378. @item gain
  2379. Set gain applied to audio. Value is in dB. Default is 0.
  2380. @item type
  2381. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2382. processing audio in time domain which is slow.
  2383. @var{freq} is processing audio in frequency domain which is fast.
  2384. Default is @var{freq}.
  2385. @item lfe
  2386. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2387. @end table
  2388. @subsection Examples
  2389. @itemize
  2390. @item
  2391. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2392. each amovie filter use stereo file with IR coefficients as input.
  2393. The files give coefficients for each position of virtual loudspeaker:
  2394. @example
  2395. 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"
  2396. output.wav
  2397. @end example
  2398. @end itemize
  2399. @section highpass
  2400. Apply a high-pass filter with 3dB point frequency.
  2401. The filter can be either single-pole, or double-pole (the default).
  2402. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2403. The filter accepts the following options:
  2404. @table @option
  2405. @item frequency, f
  2406. Set frequency in Hz. Default is 3000.
  2407. @item poles, p
  2408. Set number of poles. Default is 2.
  2409. @item width_type, t
  2410. Set method to specify band-width of filter.
  2411. @table @option
  2412. @item h
  2413. Hz
  2414. @item q
  2415. Q-Factor
  2416. @item o
  2417. octave
  2418. @item s
  2419. slope
  2420. @item k
  2421. kHz
  2422. @end table
  2423. @item width, w
  2424. Specify the band-width of a filter in width_type units.
  2425. Applies only to double-pole filter.
  2426. The default is 0.707q and gives a Butterworth response.
  2427. @item channels, c
  2428. Specify which channels to filter, by default all available are filtered.
  2429. @end table
  2430. @subsection Commands
  2431. This filter supports the following commands:
  2432. @table @option
  2433. @item frequency, f
  2434. Change highpass frequency.
  2435. Syntax for the command is : "@var{frequency}"
  2436. @item width_type, t
  2437. Change highpass width_type.
  2438. Syntax for the command is : "@var{width_type}"
  2439. @item width, w
  2440. Change highpass width.
  2441. Syntax for the command is : "@var{width}"
  2442. @end table
  2443. @section join
  2444. Join multiple input streams into one multi-channel stream.
  2445. It accepts the following parameters:
  2446. @table @option
  2447. @item inputs
  2448. The number of input streams. It defaults to 2.
  2449. @item channel_layout
  2450. The desired output channel layout. It defaults to stereo.
  2451. @item map
  2452. Map channels from inputs to output. The argument is a '|'-separated list of
  2453. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2454. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2455. can be either the name of the input channel (e.g. FL for front left) or its
  2456. index in the specified input stream. @var{out_channel} is the name of the output
  2457. channel.
  2458. @end table
  2459. The filter will attempt to guess the mappings when they are not specified
  2460. explicitly. It does so by first trying to find an unused matching input channel
  2461. and if that fails it picks the first unused input channel.
  2462. Join 3 inputs (with properly set channel layouts):
  2463. @example
  2464. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2465. @end example
  2466. Build a 5.1 output from 6 single-channel streams:
  2467. @example
  2468. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2469. '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'
  2470. out
  2471. @end example
  2472. @section ladspa
  2473. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2474. To enable compilation of this filter you need to configure FFmpeg with
  2475. @code{--enable-ladspa}.
  2476. @table @option
  2477. @item file, f
  2478. Specifies the name of LADSPA plugin library to load. If the environment
  2479. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2480. each one of the directories specified by the colon separated list in
  2481. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2482. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2483. @file{/usr/lib/ladspa/}.
  2484. @item plugin, p
  2485. Specifies the plugin within the library. Some libraries contain only
  2486. one plugin, but others contain many of them. If this is not set filter
  2487. will list all available plugins within the specified library.
  2488. @item controls, c
  2489. Set the '|' separated list of controls which are zero or more floating point
  2490. values that determine the behavior of the loaded plugin (for example delay,
  2491. threshold or gain).
  2492. Controls need to be defined using the following syntax:
  2493. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2494. @var{valuei} is the value set on the @var{i}-th control.
  2495. Alternatively they can be also defined using the following syntax:
  2496. @var{value0}|@var{value1}|@var{value2}|..., where
  2497. @var{valuei} is the value set on the @var{i}-th control.
  2498. If @option{controls} is set to @code{help}, all available controls and
  2499. their valid ranges are printed.
  2500. @item sample_rate, s
  2501. Specify the sample rate, default to 44100. Only used if plugin have
  2502. zero inputs.
  2503. @item nb_samples, n
  2504. Set the number of samples per channel per each output frame, default
  2505. is 1024. Only used if plugin have zero inputs.
  2506. @item duration, d
  2507. Set the minimum duration of the sourced audio. See
  2508. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2509. for the accepted syntax.
  2510. Note that the resulting duration may be greater than the specified duration,
  2511. as the generated audio is always cut at the end of a complete frame.
  2512. If not specified, or the expressed duration is negative, the audio is
  2513. supposed to be generated forever.
  2514. Only used if plugin have zero inputs.
  2515. @end table
  2516. @subsection Examples
  2517. @itemize
  2518. @item
  2519. List all available plugins within amp (LADSPA example plugin) library:
  2520. @example
  2521. ladspa=file=amp
  2522. @end example
  2523. @item
  2524. List all available controls and their valid ranges for @code{vcf_notch}
  2525. plugin from @code{VCF} library:
  2526. @example
  2527. ladspa=f=vcf:p=vcf_notch:c=help
  2528. @end example
  2529. @item
  2530. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2531. plugin library:
  2532. @example
  2533. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2534. @end example
  2535. @item
  2536. Add reverberation to the audio using TAP-plugins
  2537. (Tom's Audio Processing plugins):
  2538. @example
  2539. ladspa=file=tap_reverb:tap_reverb
  2540. @end example
  2541. @item
  2542. Generate white noise, with 0.2 amplitude:
  2543. @example
  2544. ladspa=file=cmt:noise_source_white:c=c0=.2
  2545. @end example
  2546. @item
  2547. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2548. @code{C* Audio Plugin Suite} (CAPS) library:
  2549. @example
  2550. ladspa=file=caps:Click:c=c1=20'
  2551. @end example
  2552. @item
  2553. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2554. @example
  2555. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2556. @end example
  2557. @item
  2558. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2559. @code{SWH Plugins} collection:
  2560. @example
  2561. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2562. @end example
  2563. @item
  2564. Attenuate low frequencies using Multiband EQ from Steve Harris
  2565. @code{SWH Plugins} collection:
  2566. @example
  2567. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2568. @end example
  2569. @item
  2570. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2571. (CAPS) library:
  2572. @example
  2573. ladspa=caps:Narrower
  2574. @end example
  2575. @item
  2576. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2577. @example
  2578. ladspa=caps:White:.2
  2579. @end example
  2580. @item
  2581. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2582. @example
  2583. ladspa=caps:Fractal:c=c1=1
  2584. @end example
  2585. @item
  2586. Dynamic volume normalization using @code{VLevel} plugin:
  2587. @example
  2588. ladspa=vlevel-ladspa:vlevel_mono
  2589. @end example
  2590. @end itemize
  2591. @subsection Commands
  2592. This filter supports the following commands:
  2593. @table @option
  2594. @item cN
  2595. Modify the @var{N}-th control value.
  2596. If the specified value is not valid, it is ignored and prior one is kept.
  2597. @end table
  2598. @section loudnorm
  2599. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2600. Support for both single pass (livestreams, files) and double pass (files) modes.
  2601. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2602. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2603. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2604. The filter accepts the following options:
  2605. @table @option
  2606. @item I, i
  2607. Set integrated loudness target.
  2608. Range is -70.0 - -5.0. Default value is -24.0.
  2609. @item LRA, lra
  2610. Set loudness range target.
  2611. Range is 1.0 - 20.0. Default value is 7.0.
  2612. @item TP, tp
  2613. Set maximum true peak.
  2614. Range is -9.0 - +0.0. Default value is -2.0.
  2615. @item measured_I, measured_i
  2616. Measured IL of input file.
  2617. Range is -99.0 - +0.0.
  2618. @item measured_LRA, measured_lra
  2619. Measured LRA of input file.
  2620. Range is 0.0 - 99.0.
  2621. @item measured_TP, measured_tp
  2622. Measured true peak of input file.
  2623. Range is -99.0 - +99.0.
  2624. @item measured_thresh
  2625. Measured threshold of input file.
  2626. Range is -99.0 - +0.0.
  2627. @item offset
  2628. Set offset gain. Gain is applied before the true-peak limiter.
  2629. Range is -99.0 - +99.0. Default is +0.0.
  2630. @item linear
  2631. Normalize linearly if possible.
  2632. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2633. to be specified in order to use this mode.
  2634. Options are true or false. Default is true.
  2635. @item dual_mono
  2636. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2637. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2638. If set to @code{true}, this option will compensate for this effect.
  2639. Multi-channel input files are not affected by this option.
  2640. Options are true or false. Default is false.
  2641. @item print_format
  2642. Set print format for stats. Options are summary, json, or none.
  2643. Default value is none.
  2644. @end table
  2645. @section lowpass
  2646. Apply a low-pass filter with 3dB point frequency.
  2647. The filter can be either single-pole or double-pole (the default).
  2648. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2649. The filter accepts the following options:
  2650. @table @option
  2651. @item frequency, f
  2652. Set frequency in Hz. Default is 500.
  2653. @item poles, p
  2654. Set number of poles. Default is 2.
  2655. @item width_type, t
  2656. Set method to specify band-width of filter.
  2657. @table @option
  2658. @item h
  2659. Hz
  2660. @item q
  2661. Q-Factor
  2662. @item o
  2663. octave
  2664. @item s
  2665. slope
  2666. @item k
  2667. kHz
  2668. @end table
  2669. @item width, w
  2670. Specify the band-width of a filter in width_type units.
  2671. Applies only to double-pole filter.
  2672. The default is 0.707q and gives a Butterworth response.
  2673. @item channels, c
  2674. Specify which channels to filter, by default all available are filtered.
  2675. @end table
  2676. @subsection Examples
  2677. @itemize
  2678. @item
  2679. Lowpass only LFE channel, it LFE is not present it does nothing:
  2680. @example
  2681. lowpass=c=LFE
  2682. @end example
  2683. @end itemize
  2684. @subsection Commands
  2685. This filter supports the following commands:
  2686. @table @option
  2687. @item frequency, f
  2688. Change lowpass frequency.
  2689. Syntax for the command is : "@var{frequency}"
  2690. @item width_type, t
  2691. Change lowpass width_type.
  2692. Syntax for the command is : "@var{width_type}"
  2693. @item width, w
  2694. Change lowpass width.
  2695. Syntax for the command is : "@var{width}"
  2696. @end table
  2697. @section lv2
  2698. Load a LV2 (LADSPA Version 2) plugin.
  2699. To enable compilation of this filter you need to configure FFmpeg with
  2700. @code{--enable-lv2}.
  2701. @table @option
  2702. @item plugin, p
  2703. Specifies the plugin URI. You may need to escape ':'.
  2704. @item controls, c
  2705. Set the '|' separated list of controls which are zero or more floating point
  2706. values that determine the behavior of the loaded plugin (for example delay,
  2707. threshold or gain).
  2708. If @option{controls} is set to @code{help}, all available controls and
  2709. their valid ranges are printed.
  2710. @item sample_rate, s
  2711. Specify the sample rate, default to 44100. Only used if plugin have
  2712. zero inputs.
  2713. @item nb_samples, n
  2714. Set the number of samples per channel per each output frame, default
  2715. is 1024. Only used if plugin have zero inputs.
  2716. @item duration, d
  2717. Set the minimum duration of the sourced audio. See
  2718. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2719. for the accepted syntax.
  2720. Note that the resulting duration may be greater than the specified duration,
  2721. as the generated audio is always cut at the end of a complete frame.
  2722. If not specified, or the expressed duration is negative, the audio is
  2723. supposed to be generated forever.
  2724. Only used if plugin have zero inputs.
  2725. @end table
  2726. @subsection Examples
  2727. @itemize
  2728. @item
  2729. Apply bass enhancer plugin from Calf:
  2730. @example
  2731. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2732. @end example
  2733. @item
  2734. Apply bass vinyl plugin from Calf:
  2735. @example
  2736. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2737. @end example
  2738. @item
  2739. Apply bit crusher plugin from ArtyFX:
  2740. @example
  2741. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2742. @end example
  2743. @end itemize
  2744. @section mcompand
  2745. Multiband Compress or expand the audio's dynamic range.
  2746. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2747. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2748. response when absent compander action.
  2749. It accepts the following parameters:
  2750. @table @option
  2751. @item args
  2752. This option syntax is:
  2753. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2754. For explanation of each item refer to compand filter documentation.
  2755. @end table
  2756. @anchor{pan}
  2757. @section pan
  2758. Mix channels with specific gain levels. The filter accepts the output
  2759. channel layout followed by a set of channels definitions.
  2760. This filter is also designed to efficiently remap the channels of an audio
  2761. stream.
  2762. The filter accepts parameters of the form:
  2763. "@var{l}|@var{outdef}|@var{outdef}|..."
  2764. @table @option
  2765. @item l
  2766. output channel layout or number of channels
  2767. @item outdef
  2768. output channel specification, of the form:
  2769. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2770. @item out_name
  2771. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2772. number (c0, c1, etc.)
  2773. @item gain
  2774. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2775. @item in_name
  2776. input channel to use, see out_name for details; it is not possible to mix
  2777. named and numbered input channels
  2778. @end table
  2779. If the `=' in a channel specification is replaced by `<', then the gains for
  2780. that specification will be renormalized so that the total is 1, thus
  2781. avoiding clipping noise.
  2782. @subsection Mixing examples
  2783. For example, if you want to down-mix from stereo to mono, but with a bigger
  2784. factor for the left channel:
  2785. @example
  2786. pan=1c|c0=0.9*c0+0.1*c1
  2787. @end example
  2788. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2789. 7-channels surround:
  2790. @example
  2791. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2792. @end example
  2793. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2794. that should be preferred (see "-ac" option) unless you have very specific
  2795. needs.
  2796. @subsection Remapping examples
  2797. The channel remapping will be effective if, and only if:
  2798. @itemize
  2799. @item gain coefficients are zeroes or ones,
  2800. @item only one input per channel output,
  2801. @end itemize
  2802. If all these conditions are satisfied, the filter will notify the user ("Pure
  2803. channel mapping detected"), and use an optimized and lossless method to do the
  2804. remapping.
  2805. For example, if you have a 5.1 source and want a stereo audio stream by
  2806. dropping the extra channels:
  2807. @example
  2808. pan="stereo| c0=FL | c1=FR"
  2809. @end example
  2810. Given the same source, you can also switch front left and front right channels
  2811. and keep the input channel layout:
  2812. @example
  2813. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2814. @end example
  2815. If the input is a stereo audio stream, you can mute the front left channel (and
  2816. still keep the stereo channel layout) with:
  2817. @example
  2818. pan="stereo|c1=c1"
  2819. @end example
  2820. Still with a stereo audio stream input, you can copy the right channel in both
  2821. front left and right:
  2822. @example
  2823. pan="stereo| c0=FR | c1=FR"
  2824. @end example
  2825. @section replaygain
  2826. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2827. outputs it unchanged.
  2828. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2829. @section resample
  2830. Convert the audio sample format, sample rate and channel layout. It is
  2831. not meant to be used directly.
  2832. @section rubberband
  2833. Apply time-stretching and pitch-shifting with librubberband.
  2834. The filter accepts the following options:
  2835. @table @option
  2836. @item tempo
  2837. Set tempo scale factor.
  2838. @item pitch
  2839. Set pitch scale factor.
  2840. @item transients
  2841. Set transients detector.
  2842. Possible values are:
  2843. @table @var
  2844. @item crisp
  2845. @item mixed
  2846. @item smooth
  2847. @end table
  2848. @item detector
  2849. Set detector.
  2850. Possible values are:
  2851. @table @var
  2852. @item compound
  2853. @item percussive
  2854. @item soft
  2855. @end table
  2856. @item phase
  2857. Set phase.
  2858. Possible values are:
  2859. @table @var
  2860. @item laminar
  2861. @item independent
  2862. @end table
  2863. @item window
  2864. Set processing window size.
  2865. Possible values are:
  2866. @table @var
  2867. @item standard
  2868. @item short
  2869. @item long
  2870. @end table
  2871. @item smoothing
  2872. Set smoothing.
  2873. Possible values are:
  2874. @table @var
  2875. @item off
  2876. @item on
  2877. @end table
  2878. @item formant
  2879. Enable formant preservation when shift pitching.
  2880. Possible values are:
  2881. @table @var
  2882. @item shifted
  2883. @item preserved
  2884. @end table
  2885. @item pitchq
  2886. Set pitch quality.
  2887. Possible values are:
  2888. @table @var
  2889. @item quality
  2890. @item speed
  2891. @item consistency
  2892. @end table
  2893. @item channels
  2894. Set channels.
  2895. Possible values are:
  2896. @table @var
  2897. @item apart
  2898. @item together
  2899. @end table
  2900. @end table
  2901. @section sidechaincompress
  2902. This filter acts like normal compressor but has the ability to compress
  2903. detected signal using second input signal.
  2904. It needs two input streams and returns one output stream.
  2905. First input stream will be processed depending on second stream signal.
  2906. The filtered signal then can be filtered with other filters in later stages of
  2907. processing. See @ref{pan} and @ref{amerge} filter.
  2908. The filter accepts the following options:
  2909. @table @option
  2910. @item level_in
  2911. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2912. @item threshold
  2913. If a signal of second stream raises above this level it will affect the gain
  2914. reduction of first stream.
  2915. By default is 0.125. Range is between 0.00097563 and 1.
  2916. @item ratio
  2917. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2918. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2919. Default is 2. Range is between 1 and 20.
  2920. @item attack
  2921. Amount of milliseconds the signal has to rise above the threshold before gain
  2922. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2923. @item release
  2924. Amount of milliseconds the signal has to fall below the threshold before
  2925. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2926. @item makeup
  2927. Set the amount by how much signal will be amplified after processing.
  2928. Default is 1. Range is from 1 to 64.
  2929. @item knee
  2930. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2931. Default is 2.82843. Range is between 1 and 8.
  2932. @item link
  2933. Choose if the @code{average} level between all channels of side-chain stream
  2934. or the louder(@code{maximum}) channel of side-chain stream affects the
  2935. reduction. Default is @code{average}.
  2936. @item detection
  2937. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2938. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2939. @item level_sc
  2940. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2941. @item mix
  2942. How much to use compressed signal in output. Default is 1.
  2943. Range is between 0 and 1.
  2944. @end table
  2945. @subsection Examples
  2946. @itemize
  2947. @item
  2948. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2949. depending on the signal of 2nd input and later compressed signal to be
  2950. merged with 2nd input:
  2951. @example
  2952. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2953. @end example
  2954. @end itemize
  2955. @section sidechaingate
  2956. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2957. filter the detected signal before sending it to the gain reduction stage.
  2958. Normally a gate uses the full range signal to detect a level above the
  2959. threshold.
  2960. For example: If you cut all lower frequencies from your sidechain signal
  2961. the gate will decrease the volume of your track only if not enough highs
  2962. appear. With this technique you are able to reduce the resonation of a
  2963. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2964. guitar.
  2965. It needs two input streams and returns one output stream.
  2966. First input stream will be processed depending on second stream signal.
  2967. The filter accepts the following options:
  2968. @table @option
  2969. @item level_in
  2970. Set input level before filtering.
  2971. Default is 1. Allowed range is from 0.015625 to 64.
  2972. @item range
  2973. Set the level of gain reduction when the signal is below the threshold.
  2974. Default is 0.06125. Allowed range is from 0 to 1.
  2975. @item threshold
  2976. If a signal rises above this level the gain reduction is released.
  2977. Default is 0.125. Allowed range is from 0 to 1.
  2978. @item ratio
  2979. Set a ratio about which the signal is reduced.
  2980. Default is 2. Allowed range is from 1 to 9000.
  2981. @item attack
  2982. Amount of milliseconds the signal has to rise above the threshold before gain
  2983. reduction stops.
  2984. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2985. @item release
  2986. Amount of milliseconds the signal has to fall below the threshold before the
  2987. reduction is increased again. Default is 250 milliseconds.
  2988. Allowed range is from 0.01 to 9000.
  2989. @item makeup
  2990. Set amount of amplification of signal after processing.
  2991. Default is 1. Allowed range is from 1 to 64.
  2992. @item knee
  2993. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2994. Default is 2.828427125. Allowed range is from 1 to 8.
  2995. @item detection
  2996. Choose if exact signal should be taken for detection or an RMS like one.
  2997. Default is rms. Can be peak or rms.
  2998. @item link
  2999. Choose if the average level between all channels or the louder channel affects
  3000. the reduction.
  3001. Default is average. Can be average or maximum.
  3002. @item level_sc
  3003. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3004. @end table
  3005. @section silencedetect
  3006. Detect silence in an audio stream.
  3007. This filter logs a message when it detects that the input audio volume is less
  3008. or equal to a noise tolerance value for a duration greater or equal to the
  3009. minimum detected noise duration.
  3010. The printed times and duration are expressed in seconds.
  3011. The filter accepts the following options:
  3012. @table @option
  3013. @item duration, d
  3014. Set silence duration until notification (default is 2 seconds).
  3015. @item noise, n
  3016. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3017. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3018. @end table
  3019. @subsection Examples
  3020. @itemize
  3021. @item
  3022. Detect 5 seconds of silence with -50dB noise tolerance:
  3023. @example
  3024. silencedetect=n=-50dB:d=5
  3025. @end example
  3026. @item
  3027. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3028. tolerance in @file{silence.mp3}:
  3029. @example
  3030. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3031. @end example
  3032. @end itemize
  3033. @section silenceremove
  3034. Remove silence from the beginning, middle or end of the audio.
  3035. The filter accepts the following options:
  3036. @table @option
  3037. @item start_periods
  3038. This value is used to indicate if audio should be trimmed at beginning of
  3039. the audio. A value of zero indicates no silence should be trimmed from the
  3040. beginning. When specifying a non-zero value, it trims audio up until it
  3041. finds non-silence. Normally, when trimming silence from beginning of audio
  3042. the @var{start_periods} will be @code{1} but it can be increased to higher
  3043. values to trim all audio up to specific count of non-silence periods.
  3044. Default value is @code{0}.
  3045. @item start_duration
  3046. Specify the amount of time that non-silence must be detected before it stops
  3047. trimming audio. By increasing the duration, bursts of noises can be treated
  3048. as silence and trimmed off. Default value is @code{0}.
  3049. @item start_threshold
  3050. This indicates what sample value should be treated as silence. For digital
  3051. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3052. you may wish to increase the value to account for background noise.
  3053. Can be specified in dB (in case "dB" is appended to the specified value)
  3054. or amplitude ratio. Default value is @code{0}.
  3055. @item stop_periods
  3056. Set the count for trimming silence from the end of audio.
  3057. To remove silence from the middle of a file, specify a @var{stop_periods}
  3058. that is negative. This value is then treated as a positive value and is
  3059. used to indicate the effect should restart processing as specified by
  3060. @var{start_periods}, making it suitable for removing periods of silence
  3061. in the middle of the audio.
  3062. Default value is @code{0}.
  3063. @item stop_duration
  3064. Specify a duration of silence that must exist before audio is not copied any
  3065. more. By specifying a higher duration, silence that is wanted can be left in
  3066. the audio.
  3067. Default value is @code{0}.
  3068. @item stop_threshold
  3069. This is the same as @option{start_threshold} but for trimming silence from
  3070. the end of audio.
  3071. Can be specified in dB (in case "dB" is appended to the specified value)
  3072. or amplitude ratio. Default value is @code{0}.
  3073. @item leave_silence
  3074. This indicates that @var{stop_duration} length of audio should be left intact
  3075. at the beginning of each period of silence.
  3076. For example, if you want to remove long pauses between words but do not want
  3077. to remove the pauses completely. Default value is @code{0}.
  3078. @item detection
  3079. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3080. and works better with digital silence which is exactly 0.
  3081. Default value is @code{rms}.
  3082. @item window
  3083. Set ratio used to calculate size of window for detecting silence.
  3084. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3085. @end table
  3086. @subsection Examples
  3087. @itemize
  3088. @item
  3089. The following example shows how this filter can be used to start a recording
  3090. that does not contain the delay at the start which usually occurs between
  3091. pressing the record button and the start of the performance:
  3092. @example
  3093. silenceremove=1:5:0.02
  3094. @end example
  3095. @item
  3096. Trim all silence encountered from beginning to end where there is more than 1
  3097. second of silence in audio:
  3098. @example
  3099. silenceremove=0:0:0:-1:1:-90dB
  3100. @end example
  3101. @end itemize
  3102. @section sofalizer
  3103. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3104. loudspeakers around the user for binaural listening via headphones (audio
  3105. formats up to 9 channels supported).
  3106. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3107. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3108. Austrian Academy of Sciences.
  3109. To enable compilation of this filter you need to configure FFmpeg with
  3110. @code{--enable-libmysofa}.
  3111. The filter accepts the following options:
  3112. @table @option
  3113. @item sofa
  3114. Set the SOFA file used for rendering.
  3115. @item gain
  3116. Set gain applied to audio. Value is in dB. Default is 0.
  3117. @item rotation
  3118. Set rotation of virtual loudspeakers in deg. Default is 0.
  3119. @item elevation
  3120. Set elevation of virtual speakers in deg. Default is 0.
  3121. @item radius
  3122. Set distance in meters between loudspeakers and the listener with near-field
  3123. HRTFs. Default is 1.
  3124. @item type
  3125. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3126. processing audio in time domain which is slow.
  3127. @var{freq} is processing audio in frequency domain which is fast.
  3128. Default is @var{freq}.
  3129. @item speakers
  3130. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3131. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3132. Each virtual loudspeaker is described with short channel name following with
  3133. azimuth and elevation in degrees.
  3134. Each virtual loudspeaker description is separated by '|'.
  3135. For example to override front left and front right channel positions use:
  3136. 'speakers=FL 45 15|FR 345 15'.
  3137. Descriptions with unrecognised channel names are ignored.
  3138. @item lfegain
  3139. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3140. @end table
  3141. @subsection Examples
  3142. @itemize
  3143. @item
  3144. Using ClubFritz6 sofa file:
  3145. @example
  3146. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3147. @end example
  3148. @item
  3149. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3150. @example
  3151. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3152. @end example
  3153. @item
  3154. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3155. and also with custom gain:
  3156. @example
  3157. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3158. @end example
  3159. @end itemize
  3160. @section stereotools
  3161. This filter has some handy utilities to manage stereo signals, for converting
  3162. M/S stereo recordings to L/R signal while having control over the parameters
  3163. or spreading the stereo image of master track.
  3164. The filter accepts the following options:
  3165. @table @option
  3166. @item level_in
  3167. Set input level before filtering for both channels. Defaults is 1.
  3168. Allowed range is from 0.015625 to 64.
  3169. @item level_out
  3170. Set output level after filtering for both channels. Defaults is 1.
  3171. Allowed range is from 0.015625 to 64.
  3172. @item balance_in
  3173. Set input balance between both channels. Default is 0.
  3174. Allowed range is from -1 to 1.
  3175. @item balance_out
  3176. Set output balance between both channels. Default is 0.
  3177. Allowed range is from -1 to 1.
  3178. @item softclip
  3179. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3180. clipping. Disabled by default.
  3181. @item mutel
  3182. Mute the left channel. Disabled by default.
  3183. @item muter
  3184. Mute the right channel. Disabled by default.
  3185. @item phasel
  3186. Change the phase of the left channel. Disabled by default.
  3187. @item phaser
  3188. Change the phase of the right channel. Disabled by default.
  3189. @item mode
  3190. Set stereo mode. Available values are:
  3191. @table @samp
  3192. @item lr>lr
  3193. Left/Right to Left/Right, this is default.
  3194. @item lr>ms
  3195. Left/Right to Mid/Side.
  3196. @item ms>lr
  3197. Mid/Side to Left/Right.
  3198. @item lr>ll
  3199. Left/Right to Left/Left.
  3200. @item lr>rr
  3201. Left/Right to Right/Right.
  3202. @item lr>l+r
  3203. Left/Right to Left + Right.
  3204. @item lr>rl
  3205. Left/Right to Right/Left.
  3206. @item ms>ll
  3207. Mid/Side to Left/Left.
  3208. @item ms>rr
  3209. Mid/Side to Right/Right.
  3210. @end table
  3211. @item slev
  3212. Set level of side signal. Default is 1.
  3213. Allowed range is from 0.015625 to 64.
  3214. @item sbal
  3215. Set balance of side signal. Default is 0.
  3216. Allowed range is from -1 to 1.
  3217. @item mlev
  3218. Set level of the middle signal. Default is 1.
  3219. Allowed range is from 0.015625 to 64.
  3220. @item mpan
  3221. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3222. @item base
  3223. Set stereo base between mono and inversed channels. Default is 0.
  3224. Allowed range is from -1 to 1.
  3225. @item delay
  3226. Set delay in milliseconds how much to delay left from right channel and
  3227. vice versa. Default is 0. Allowed range is from -20 to 20.
  3228. @item sclevel
  3229. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3230. @item phase
  3231. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3232. @item bmode_in, bmode_out
  3233. Set balance mode for balance_in/balance_out option.
  3234. Can be one of the following:
  3235. @table @samp
  3236. @item balance
  3237. Classic balance mode. Attenuate one channel at time.
  3238. Gain is raised up to 1.
  3239. @item amplitude
  3240. Similar as classic mode above but gain is raised up to 2.
  3241. @item power
  3242. Equal power distribution, from -6dB to +6dB range.
  3243. @end table
  3244. @end table
  3245. @subsection Examples
  3246. @itemize
  3247. @item
  3248. Apply karaoke like effect:
  3249. @example
  3250. stereotools=mlev=0.015625
  3251. @end example
  3252. @item
  3253. Convert M/S signal to L/R:
  3254. @example
  3255. "stereotools=mode=ms>lr"
  3256. @end example
  3257. @end itemize
  3258. @section stereowiden
  3259. This filter enhance the stereo effect by suppressing signal common to both
  3260. channels and by delaying the signal of left into right and vice versa,
  3261. thereby widening the stereo effect.
  3262. The filter accepts the following options:
  3263. @table @option
  3264. @item delay
  3265. Time in milliseconds of the delay of left signal into right and vice versa.
  3266. Default is 20 milliseconds.
  3267. @item feedback
  3268. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3269. effect of left signal in right output and vice versa which gives widening
  3270. effect. Default is 0.3.
  3271. @item crossfeed
  3272. Cross feed of left into right with inverted phase. This helps in suppressing
  3273. the mono. If the value is 1 it will cancel all the signal common to both
  3274. channels. Default is 0.3.
  3275. @item drymix
  3276. Set level of input signal of original channel. Default is 0.8.
  3277. @end table
  3278. @section superequalizer
  3279. Apply 18 band equalizer.
  3280. The filter accepts the following options:
  3281. @table @option
  3282. @item 1b
  3283. Set 65Hz band gain.
  3284. @item 2b
  3285. Set 92Hz band gain.
  3286. @item 3b
  3287. Set 131Hz band gain.
  3288. @item 4b
  3289. Set 185Hz band gain.
  3290. @item 5b
  3291. Set 262Hz band gain.
  3292. @item 6b
  3293. Set 370Hz band gain.
  3294. @item 7b
  3295. Set 523Hz band gain.
  3296. @item 8b
  3297. Set 740Hz band gain.
  3298. @item 9b
  3299. Set 1047Hz band gain.
  3300. @item 10b
  3301. Set 1480Hz band gain.
  3302. @item 11b
  3303. Set 2093Hz band gain.
  3304. @item 12b
  3305. Set 2960Hz band gain.
  3306. @item 13b
  3307. Set 4186Hz band gain.
  3308. @item 14b
  3309. Set 5920Hz band gain.
  3310. @item 15b
  3311. Set 8372Hz band gain.
  3312. @item 16b
  3313. Set 11840Hz band gain.
  3314. @item 17b
  3315. Set 16744Hz band gain.
  3316. @item 18b
  3317. Set 20000Hz band gain.
  3318. @end table
  3319. @section surround
  3320. Apply audio surround upmix filter.
  3321. This filter allows to produce multichannel output from audio stream.
  3322. The filter accepts the following options:
  3323. @table @option
  3324. @item chl_out
  3325. Set output channel layout. By default, this is @var{5.1}.
  3326. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3327. for the required syntax.
  3328. @item chl_in
  3329. Set input channel layout. By default, this is @var{stereo}.
  3330. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3331. for the required syntax.
  3332. @item level_in
  3333. Set input volume level. By default, this is @var{1}.
  3334. @item level_out
  3335. Set output volume level. By default, this is @var{1}.
  3336. @item lfe
  3337. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3338. @item lfe_low
  3339. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3340. @item lfe_high
  3341. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3342. @item fc_in
  3343. Set front center input volume. By default, this is @var{1}.
  3344. @item fc_out
  3345. Set front center output volume. By default, this is @var{1}.
  3346. @item lfe_in
  3347. Set LFE input volume. By default, this is @var{1}.
  3348. @item lfe_out
  3349. Set LFE output volume. By default, this is @var{1}.
  3350. @end table
  3351. @section treble
  3352. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3353. shelving filter with a response similar to that of a standard
  3354. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3355. The filter accepts the following options:
  3356. @table @option
  3357. @item gain, g
  3358. Give the gain at whichever is the lower of ~22 kHz and the
  3359. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3360. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3361. @item frequency, f
  3362. Set the filter's central frequency and so can be used
  3363. to extend or reduce the frequency range to be boosted or cut.
  3364. The default value is @code{3000} Hz.
  3365. @item width_type, t
  3366. Set method to specify band-width of filter.
  3367. @table @option
  3368. @item h
  3369. Hz
  3370. @item q
  3371. Q-Factor
  3372. @item o
  3373. octave
  3374. @item s
  3375. slope
  3376. @item k
  3377. kHz
  3378. @end table
  3379. @item width, w
  3380. Determine how steep is the filter's shelf transition.
  3381. @item channels, c
  3382. Specify which channels to filter, by default all available are filtered.
  3383. @end table
  3384. @subsection Commands
  3385. This filter supports the following commands:
  3386. @table @option
  3387. @item frequency, f
  3388. Change treble frequency.
  3389. Syntax for the command is : "@var{frequency}"
  3390. @item width_type, t
  3391. Change treble width_type.
  3392. Syntax for the command is : "@var{width_type}"
  3393. @item width, w
  3394. Change treble width.
  3395. Syntax for the command is : "@var{width}"
  3396. @item gain, g
  3397. Change treble gain.
  3398. Syntax for the command is : "@var{gain}"
  3399. @end table
  3400. @section tremolo
  3401. Sinusoidal amplitude modulation.
  3402. The filter accepts the following options:
  3403. @table @option
  3404. @item f
  3405. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3406. (20 Hz or lower) will result in a tremolo effect.
  3407. This filter may also be used as a ring modulator by specifying
  3408. a modulation frequency higher than 20 Hz.
  3409. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3410. @item d
  3411. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3412. Default value is 0.5.
  3413. @end table
  3414. @section vibrato
  3415. Sinusoidal phase modulation.
  3416. The filter accepts the following options:
  3417. @table @option
  3418. @item f
  3419. Modulation frequency in Hertz.
  3420. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3421. @item d
  3422. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3423. Default value is 0.5.
  3424. @end table
  3425. @section volume
  3426. Adjust the input audio volume.
  3427. It accepts the following parameters:
  3428. @table @option
  3429. @item volume
  3430. Set audio volume expression.
  3431. Output values are clipped to the maximum value.
  3432. The output audio volume is given by the relation:
  3433. @example
  3434. @var{output_volume} = @var{volume} * @var{input_volume}
  3435. @end example
  3436. The default value for @var{volume} is "1.0".
  3437. @item precision
  3438. This parameter represents the mathematical precision.
  3439. It determines which input sample formats will be allowed, which affects the
  3440. precision of the volume scaling.
  3441. @table @option
  3442. @item fixed
  3443. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3444. @item float
  3445. 32-bit floating-point; this limits input sample format to FLT. (default)
  3446. @item double
  3447. 64-bit floating-point; this limits input sample format to DBL.
  3448. @end table
  3449. @item replaygain
  3450. Choose the behaviour on encountering ReplayGain side data in input frames.
  3451. @table @option
  3452. @item drop
  3453. Remove ReplayGain side data, ignoring its contents (the default).
  3454. @item ignore
  3455. Ignore ReplayGain side data, but leave it in the frame.
  3456. @item track
  3457. Prefer the track gain, if present.
  3458. @item album
  3459. Prefer the album gain, if present.
  3460. @end table
  3461. @item replaygain_preamp
  3462. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3463. Default value for @var{replaygain_preamp} is 0.0.
  3464. @item eval
  3465. Set when the volume expression is evaluated.
  3466. It accepts the following values:
  3467. @table @samp
  3468. @item once
  3469. only evaluate expression once during the filter initialization, or
  3470. when the @samp{volume} command is sent
  3471. @item frame
  3472. evaluate expression for each incoming frame
  3473. @end table
  3474. Default value is @samp{once}.
  3475. @end table
  3476. The volume expression can contain the following parameters.
  3477. @table @option
  3478. @item n
  3479. frame number (starting at zero)
  3480. @item nb_channels
  3481. number of channels
  3482. @item nb_consumed_samples
  3483. number of samples consumed by the filter
  3484. @item nb_samples
  3485. number of samples in the current frame
  3486. @item pos
  3487. original frame position in the file
  3488. @item pts
  3489. frame PTS
  3490. @item sample_rate
  3491. sample rate
  3492. @item startpts
  3493. PTS at start of stream
  3494. @item startt
  3495. time at start of stream
  3496. @item t
  3497. frame time
  3498. @item tb
  3499. timestamp timebase
  3500. @item volume
  3501. last set volume value
  3502. @end table
  3503. Note that when @option{eval} is set to @samp{once} only the
  3504. @var{sample_rate} and @var{tb} variables are available, all other
  3505. variables will evaluate to NAN.
  3506. @subsection Commands
  3507. This filter supports the following commands:
  3508. @table @option
  3509. @item volume
  3510. Modify the volume expression.
  3511. The command accepts the same syntax of the corresponding option.
  3512. If the specified expression is not valid, it is kept at its current
  3513. value.
  3514. @item replaygain_noclip
  3515. Prevent clipping by limiting the gain applied.
  3516. Default value for @var{replaygain_noclip} is 1.
  3517. @end table
  3518. @subsection Examples
  3519. @itemize
  3520. @item
  3521. Halve the input audio volume:
  3522. @example
  3523. volume=volume=0.5
  3524. volume=volume=1/2
  3525. volume=volume=-6.0206dB
  3526. @end example
  3527. In all the above example the named key for @option{volume} can be
  3528. omitted, for example like in:
  3529. @example
  3530. volume=0.5
  3531. @end example
  3532. @item
  3533. Increase input audio power by 6 decibels using fixed-point precision:
  3534. @example
  3535. volume=volume=6dB:precision=fixed
  3536. @end example
  3537. @item
  3538. Fade volume after time 10 with an annihilation period of 5 seconds:
  3539. @example
  3540. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3541. @end example
  3542. @end itemize
  3543. @section volumedetect
  3544. Detect the volume of the input video.
  3545. The filter has no parameters. The input is not modified. Statistics about
  3546. the volume will be printed in the log when the input stream end is reached.
  3547. In particular it will show the mean volume (root mean square), maximum
  3548. volume (on a per-sample basis), and the beginning of a histogram of the
  3549. registered volume values (from the maximum value to a cumulated 1/1000 of
  3550. the samples).
  3551. All volumes are in decibels relative to the maximum PCM value.
  3552. @subsection Examples
  3553. Here is an excerpt of the output:
  3554. @example
  3555. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3556. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3557. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3558. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3559. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3560. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3561. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3562. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3563. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3564. @end example
  3565. It means that:
  3566. @itemize
  3567. @item
  3568. The mean square energy is approximately -27 dB, or 10^-2.7.
  3569. @item
  3570. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3571. @item
  3572. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3573. @end itemize
  3574. In other words, raising the volume by +4 dB does not cause any clipping,
  3575. raising it by +5 dB causes clipping for 6 samples, etc.
  3576. @c man end AUDIO FILTERS
  3577. @chapter Audio Sources
  3578. @c man begin AUDIO SOURCES
  3579. Below is a description of the currently available audio sources.
  3580. @section abuffer
  3581. Buffer audio frames, and make them available to the filter chain.
  3582. This source is mainly intended for a programmatic use, in particular
  3583. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3584. It accepts the following parameters:
  3585. @table @option
  3586. @item time_base
  3587. The timebase which will be used for timestamps of submitted frames. It must be
  3588. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3589. @item sample_rate
  3590. The sample rate of the incoming audio buffers.
  3591. @item sample_fmt
  3592. The sample format of the incoming audio buffers.
  3593. Either a sample format name or its corresponding integer representation from
  3594. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3595. @item channel_layout
  3596. The channel layout of the incoming audio buffers.
  3597. Either a channel layout name from channel_layout_map in
  3598. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3599. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3600. @item channels
  3601. The number of channels of the incoming audio buffers.
  3602. If both @var{channels} and @var{channel_layout} are specified, then they
  3603. must be consistent.
  3604. @end table
  3605. @subsection Examples
  3606. @example
  3607. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3608. @end example
  3609. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3610. Since the sample format with name "s16p" corresponds to the number
  3611. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3612. equivalent to:
  3613. @example
  3614. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3615. @end example
  3616. @section aevalsrc
  3617. Generate an audio signal specified by an expression.
  3618. This source accepts in input one or more expressions (one for each
  3619. channel), which are evaluated and used to generate a corresponding
  3620. audio signal.
  3621. This source accepts the following options:
  3622. @table @option
  3623. @item exprs
  3624. Set the '|'-separated expressions list for each separate channel. In case the
  3625. @option{channel_layout} option is not specified, the selected channel layout
  3626. depends on the number of provided expressions. Otherwise the last
  3627. specified expression is applied to the remaining output channels.
  3628. @item channel_layout, c
  3629. Set the channel layout. The number of channels in the specified layout
  3630. must be equal to the number of specified expressions.
  3631. @item duration, d
  3632. Set the minimum duration of the sourced audio. See
  3633. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3634. for the accepted syntax.
  3635. Note that the resulting duration may be greater than the specified
  3636. duration, as the generated audio is always cut at the end of a
  3637. complete frame.
  3638. If not specified, or the expressed duration is negative, the audio is
  3639. supposed to be generated forever.
  3640. @item nb_samples, n
  3641. Set the number of samples per channel per each output frame,
  3642. default to 1024.
  3643. @item sample_rate, s
  3644. Specify the sample rate, default to 44100.
  3645. @end table
  3646. Each expression in @var{exprs} can contain the following constants:
  3647. @table @option
  3648. @item n
  3649. number of the evaluated sample, starting from 0
  3650. @item t
  3651. time of the evaluated sample expressed in seconds, starting from 0
  3652. @item s
  3653. sample rate
  3654. @end table
  3655. @subsection Examples
  3656. @itemize
  3657. @item
  3658. Generate silence:
  3659. @example
  3660. aevalsrc=0
  3661. @end example
  3662. @item
  3663. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3664. 8000 Hz:
  3665. @example
  3666. aevalsrc="sin(440*2*PI*t):s=8000"
  3667. @end example
  3668. @item
  3669. Generate a two channels signal, specify the channel layout (Front
  3670. Center + Back Center) explicitly:
  3671. @example
  3672. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3673. @end example
  3674. @item
  3675. Generate white noise:
  3676. @example
  3677. aevalsrc="-2+random(0)"
  3678. @end example
  3679. @item
  3680. Generate an amplitude modulated signal:
  3681. @example
  3682. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3683. @end example
  3684. @item
  3685. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3686. @example
  3687. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3688. @end example
  3689. @end itemize
  3690. @section anullsrc
  3691. The null audio source, return unprocessed audio frames. It is mainly useful
  3692. as a template and to be employed in analysis / debugging tools, or as
  3693. the source for filters which ignore the input data (for example the sox
  3694. synth filter).
  3695. This source accepts the following options:
  3696. @table @option
  3697. @item channel_layout, cl
  3698. Specifies the channel layout, and can be either an integer or a string
  3699. representing a channel layout. The default value of @var{channel_layout}
  3700. is "stereo".
  3701. Check the channel_layout_map definition in
  3702. @file{libavutil/channel_layout.c} for the mapping between strings and
  3703. channel layout values.
  3704. @item sample_rate, r
  3705. Specifies the sample rate, and defaults to 44100.
  3706. @item nb_samples, n
  3707. Set the number of samples per requested frames.
  3708. @end table
  3709. @subsection Examples
  3710. @itemize
  3711. @item
  3712. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3713. @example
  3714. anullsrc=r=48000:cl=4
  3715. @end example
  3716. @item
  3717. Do the same operation with a more obvious syntax:
  3718. @example
  3719. anullsrc=r=48000:cl=mono
  3720. @end example
  3721. @end itemize
  3722. All the parameters need to be explicitly defined.
  3723. @section flite
  3724. Synthesize a voice utterance using the libflite library.
  3725. To enable compilation of this filter you need to configure FFmpeg with
  3726. @code{--enable-libflite}.
  3727. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3728. The filter accepts the following options:
  3729. @table @option
  3730. @item list_voices
  3731. If set to 1, list the names of the available voices and exit
  3732. immediately. Default value is 0.
  3733. @item nb_samples, n
  3734. Set the maximum number of samples per frame. Default value is 512.
  3735. @item textfile
  3736. Set the filename containing the text to speak.
  3737. @item text
  3738. Set the text to speak.
  3739. @item voice, v
  3740. Set the voice to use for the speech synthesis. Default value is
  3741. @code{kal}. See also the @var{list_voices} option.
  3742. @end table
  3743. @subsection Examples
  3744. @itemize
  3745. @item
  3746. Read from file @file{speech.txt}, and synthesize the text using the
  3747. standard flite voice:
  3748. @example
  3749. flite=textfile=speech.txt
  3750. @end example
  3751. @item
  3752. Read the specified text selecting the @code{slt} voice:
  3753. @example
  3754. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3755. @end example
  3756. @item
  3757. Input text to ffmpeg:
  3758. @example
  3759. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3760. @end example
  3761. @item
  3762. Make @file{ffplay} speak the specified text, using @code{flite} and
  3763. the @code{lavfi} device:
  3764. @example
  3765. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3766. @end example
  3767. @end itemize
  3768. For more information about libflite, check:
  3769. @url{http://www.festvox.org/flite/}
  3770. @section anoisesrc
  3771. Generate a noise audio signal.
  3772. The filter accepts the following options:
  3773. @table @option
  3774. @item sample_rate, r
  3775. Specify the sample rate. Default value is 48000 Hz.
  3776. @item amplitude, a
  3777. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3778. is 1.0.
  3779. @item duration, d
  3780. Specify the duration of the generated audio stream. Not specifying this option
  3781. results in noise with an infinite length.
  3782. @item color, colour, c
  3783. Specify the color of noise. Available noise colors are white, pink, brown,
  3784. blue and violet. Default color is white.
  3785. @item seed, s
  3786. Specify a value used to seed the PRNG.
  3787. @item nb_samples, n
  3788. Set the number of samples per each output frame, default is 1024.
  3789. @end table
  3790. @subsection Examples
  3791. @itemize
  3792. @item
  3793. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3794. @example
  3795. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3796. @end example
  3797. @end itemize
  3798. @section sine
  3799. Generate an audio signal made of a sine wave with amplitude 1/8.
  3800. The audio signal is bit-exact.
  3801. The filter accepts the following options:
  3802. @table @option
  3803. @item frequency, f
  3804. Set the carrier frequency. Default is 440 Hz.
  3805. @item beep_factor, b
  3806. Enable a periodic beep every second with frequency @var{beep_factor} times
  3807. the carrier frequency. Default is 0, meaning the beep is disabled.
  3808. @item sample_rate, r
  3809. Specify the sample rate, default is 44100.
  3810. @item duration, d
  3811. Specify the duration of the generated audio stream.
  3812. @item samples_per_frame
  3813. Set the number of samples per output frame.
  3814. The expression can contain the following constants:
  3815. @table @option
  3816. @item n
  3817. The (sequential) number of the output audio frame, starting from 0.
  3818. @item pts
  3819. The PTS (Presentation TimeStamp) of the output audio frame,
  3820. expressed in @var{TB} units.
  3821. @item t
  3822. The PTS of the output audio frame, expressed in seconds.
  3823. @item TB
  3824. The timebase of the output audio frames.
  3825. @end table
  3826. Default is @code{1024}.
  3827. @end table
  3828. @subsection Examples
  3829. @itemize
  3830. @item
  3831. Generate a simple 440 Hz sine wave:
  3832. @example
  3833. sine
  3834. @end example
  3835. @item
  3836. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3837. @example
  3838. sine=220:4:d=5
  3839. sine=f=220:b=4:d=5
  3840. sine=frequency=220:beep_factor=4:duration=5
  3841. @end example
  3842. @item
  3843. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3844. pattern:
  3845. @example
  3846. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3847. @end example
  3848. @end itemize
  3849. @c man end AUDIO SOURCES
  3850. @chapter Audio Sinks
  3851. @c man begin AUDIO SINKS
  3852. Below is a description of the currently available audio sinks.
  3853. @section abuffersink
  3854. Buffer audio frames, and make them available to the end of filter chain.
  3855. This sink is mainly intended for programmatic use, in particular
  3856. through the interface defined in @file{libavfilter/buffersink.h}
  3857. or the options system.
  3858. It accepts a pointer to an AVABufferSinkContext structure, which
  3859. defines the incoming buffers' formats, to be passed as the opaque
  3860. parameter to @code{avfilter_init_filter} for initialization.
  3861. @section anullsink
  3862. Null audio sink; do absolutely nothing with the input audio. It is
  3863. mainly useful as a template and for use in analysis / debugging
  3864. tools.
  3865. @c man end AUDIO SINKS
  3866. @chapter Video Filters
  3867. @c man begin VIDEO FILTERS
  3868. When you configure your FFmpeg build, you can disable any of the
  3869. existing filters using @code{--disable-filters}.
  3870. The configure output will show the video filters included in your
  3871. build.
  3872. Below is a description of the currently available video filters.
  3873. @section alphaextract
  3874. Extract the alpha component from the input as a grayscale video. This
  3875. is especially useful with the @var{alphamerge} filter.
  3876. @section alphamerge
  3877. Add or replace the alpha component of the primary input with the
  3878. grayscale value of a second input. This is intended for use with
  3879. @var{alphaextract} to allow the transmission or storage of frame
  3880. sequences that have alpha in a format that doesn't support an alpha
  3881. channel.
  3882. For example, to reconstruct full frames from a normal YUV-encoded video
  3883. and a separate video created with @var{alphaextract}, you might use:
  3884. @example
  3885. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3886. @end example
  3887. Since this filter is designed for reconstruction, it operates on frame
  3888. sequences without considering timestamps, and terminates when either
  3889. input reaches end of stream. This will cause problems if your encoding
  3890. pipeline drops frames. If you're trying to apply an image as an
  3891. overlay to a video stream, consider the @var{overlay} filter instead.
  3892. @section ass
  3893. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3894. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3895. Substation Alpha) subtitles files.
  3896. This filter accepts the following option in addition to the common options from
  3897. the @ref{subtitles} filter:
  3898. @table @option
  3899. @item shaping
  3900. Set the shaping engine
  3901. Available values are:
  3902. @table @samp
  3903. @item auto
  3904. The default libass shaping engine, which is the best available.
  3905. @item simple
  3906. Fast, font-agnostic shaper that can do only substitutions
  3907. @item complex
  3908. Slower shaper using OpenType for substitutions and positioning
  3909. @end table
  3910. The default is @code{auto}.
  3911. @end table
  3912. @section atadenoise
  3913. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3914. The filter accepts the following options:
  3915. @table @option
  3916. @item 0a
  3917. Set threshold A for 1st plane. Default is 0.02.
  3918. Valid range is 0 to 0.3.
  3919. @item 0b
  3920. Set threshold B for 1st plane. Default is 0.04.
  3921. Valid range is 0 to 5.
  3922. @item 1a
  3923. Set threshold A for 2nd plane. Default is 0.02.
  3924. Valid range is 0 to 0.3.
  3925. @item 1b
  3926. Set threshold B for 2nd plane. Default is 0.04.
  3927. Valid range is 0 to 5.
  3928. @item 2a
  3929. Set threshold A for 3rd plane. Default is 0.02.
  3930. Valid range is 0 to 0.3.
  3931. @item 2b
  3932. Set threshold B for 3rd plane. Default is 0.04.
  3933. Valid range is 0 to 5.
  3934. Threshold A is designed to react on abrupt changes in the input signal and
  3935. threshold B is designed to react on continuous changes in the input signal.
  3936. @item s
  3937. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3938. number in range [5, 129].
  3939. @item p
  3940. Set what planes of frame filter will use for averaging. Default is all.
  3941. @end table
  3942. @section avgblur
  3943. Apply average blur filter.
  3944. The filter accepts the following options:
  3945. @table @option
  3946. @item sizeX
  3947. Set horizontal kernel size.
  3948. @item planes
  3949. Set which planes to filter. By default all planes are filtered.
  3950. @item sizeY
  3951. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3952. Default is @code{0}.
  3953. @end table
  3954. @section bbox
  3955. Compute the bounding box for the non-black pixels in the input frame
  3956. luminance plane.
  3957. This filter computes the bounding box containing all the pixels with a
  3958. luminance value greater than the minimum allowed value.
  3959. The parameters describing the bounding box are printed on the filter
  3960. log.
  3961. The filter accepts the following option:
  3962. @table @option
  3963. @item min_val
  3964. Set the minimal luminance value. Default is @code{16}.
  3965. @end table
  3966. @section bitplanenoise
  3967. Show and measure bit plane noise.
  3968. The filter accepts the following options:
  3969. @table @option
  3970. @item bitplane
  3971. Set which plane to analyze. Default is @code{1}.
  3972. @item filter
  3973. Filter out noisy pixels from @code{bitplane} set above.
  3974. Default is disabled.
  3975. @end table
  3976. @section blackdetect
  3977. Detect video intervals that are (almost) completely black. Can be
  3978. useful to detect chapter transitions, commercials, or invalid
  3979. recordings. Output lines contains the time for the start, end and
  3980. duration of the detected black interval expressed in seconds.
  3981. In order to display the output lines, you need to set the loglevel at
  3982. least to the AV_LOG_INFO value.
  3983. The filter accepts the following options:
  3984. @table @option
  3985. @item black_min_duration, d
  3986. Set the minimum detected black duration expressed in seconds. It must
  3987. be a non-negative floating point number.
  3988. Default value is 2.0.
  3989. @item picture_black_ratio_th, pic_th
  3990. Set the threshold for considering a picture "black".
  3991. Express the minimum value for the ratio:
  3992. @example
  3993. @var{nb_black_pixels} / @var{nb_pixels}
  3994. @end example
  3995. for which a picture is considered black.
  3996. Default value is 0.98.
  3997. @item pixel_black_th, pix_th
  3998. Set the threshold for considering a pixel "black".
  3999. The threshold expresses the maximum pixel luminance value for which a
  4000. pixel is considered "black". The provided value is scaled according to
  4001. the following equation:
  4002. @example
  4003. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4004. @end example
  4005. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4006. the input video format, the range is [0-255] for YUV full-range
  4007. formats and [16-235] for YUV non full-range formats.
  4008. Default value is 0.10.
  4009. @end table
  4010. The following example sets the maximum pixel threshold to the minimum
  4011. value, and detects only black intervals of 2 or more seconds:
  4012. @example
  4013. blackdetect=d=2:pix_th=0.00
  4014. @end example
  4015. @section blackframe
  4016. Detect frames that are (almost) completely black. Can be useful to
  4017. detect chapter transitions or commercials. Output lines consist of
  4018. the frame number of the detected frame, the percentage of blackness,
  4019. the position in the file if known or -1 and the timestamp in seconds.
  4020. In order to display the output lines, you need to set the loglevel at
  4021. least to the AV_LOG_INFO value.
  4022. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4023. The value represents the percentage of pixels in the picture that
  4024. are below the threshold value.
  4025. It accepts the following parameters:
  4026. @table @option
  4027. @item amount
  4028. The percentage of the pixels that have to be below the threshold; it defaults to
  4029. @code{98}.
  4030. @item threshold, thresh
  4031. The threshold below which a pixel value is considered black; it defaults to
  4032. @code{32}.
  4033. @end table
  4034. @section blend, tblend
  4035. Blend two video frames into each other.
  4036. The @code{blend} filter takes two input streams and outputs one
  4037. stream, the first input is the "top" layer and second input is
  4038. "bottom" layer. By default, the output terminates when the longest input terminates.
  4039. The @code{tblend} (time blend) filter takes two consecutive frames
  4040. from one single stream, and outputs the result obtained by blending
  4041. the new frame on top of the old frame.
  4042. A description of the accepted options follows.
  4043. @table @option
  4044. @item c0_mode
  4045. @item c1_mode
  4046. @item c2_mode
  4047. @item c3_mode
  4048. @item all_mode
  4049. Set blend mode for specific pixel component or all pixel components in case
  4050. of @var{all_mode}. Default value is @code{normal}.
  4051. Available values for component modes are:
  4052. @table @samp
  4053. @item addition
  4054. @item grainmerge
  4055. @item and
  4056. @item average
  4057. @item burn
  4058. @item darken
  4059. @item difference
  4060. @item grainextract
  4061. @item divide
  4062. @item dodge
  4063. @item freeze
  4064. @item exclusion
  4065. @item extremity
  4066. @item glow
  4067. @item hardlight
  4068. @item hardmix
  4069. @item heat
  4070. @item lighten
  4071. @item linearlight
  4072. @item multiply
  4073. @item multiply128
  4074. @item negation
  4075. @item normal
  4076. @item or
  4077. @item overlay
  4078. @item phoenix
  4079. @item pinlight
  4080. @item reflect
  4081. @item screen
  4082. @item softlight
  4083. @item subtract
  4084. @item vividlight
  4085. @item xor
  4086. @end table
  4087. @item c0_opacity
  4088. @item c1_opacity
  4089. @item c2_opacity
  4090. @item c3_opacity
  4091. @item all_opacity
  4092. Set blend opacity for specific pixel component or all pixel components in case
  4093. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4094. @item c0_expr
  4095. @item c1_expr
  4096. @item c2_expr
  4097. @item c3_expr
  4098. @item all_expr
  4099. Set blend expression for specific pixel component or all pixel components in case
  4100. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4101. The expressions can use the following variables:
  4102. @table @option
  4103. @item N
  4104. The sequential number of the filtered frame, starting from @code{0}.
  4105. @item X
  4106. @item Y
  4107. the coordinates of the current sample
  4108. @item W
  4109. @item H
  4110. the width and height of currently filtered plane
  4111. @item SW
  4112. @item SH
  4113. Width and height scale depending on the currently filtered plane. It is the
  4114. ratio between the corresponding luma plane number of pixels and the current
  4115. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4116. @code{0.5,0.5} for chroma planes.
  4117. @item T
  4118. Time of the current frame, expressed in seconds.
  4119. @item TOP, A
  4120. Value of pixel component at current location for first video frame (top layer).
  4121. @item BOTTOM, B
  4122. Value of pixel component at current location for second video frame (bottom layer).
  4123. @end table
  4124. @end table
  4125. The @code{blend} filter also supports the @ref{framesync} options.
  4126. @subsection Examples
  4127. @itemize
  4128. @item
  4129. Apply transition from bottom layer to top layer in first 10 seconds:
  4130. @example
  4131. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4132. @end example
  4133. @item
  4134. Apply linear horizontal transition from top layer to bottom layer:
  4135. @example
  4136. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4137. @end example
  4138. @item
  4139. Apply 1x1 checkerboard effect:
  4140. @example
  4141. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4142. @end example
  4143. @item
  4144. Apply uncover left effect:
  4145. @example
  4146. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4147. @end example
  4148. @item
  4149. Apply uncover down effect:
  4150. @example
  4151. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4152. @end example
  4153. @item
  4154. Apply uncover up-left effect:
  4155. @example
  4156. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4157. @end example
  4158. @item
  4159. Split diagonally video and shows top and bottom layer on each side:
  4160. @example
  4161. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4162. @end example
  4163. @item
  4164. Display differences between the current and the previous frame:
  4165. @example
  4166. tblend=all_mode=grainextract
  4167. @end example
  4168. @end itemize
  4169. @section boxblur
  4170. Apply a boxblur algorithm to the input video.
  4171. It accepts the following parameters:
  4172. @table @option
  4173. @item luma_radius, lr
  4174. @item luma_power, lp
  4175. @item chroma_radius, cr
  4176. @item chroma_power, cp
  4177. @item alpha_radius, ar
  4178. @item alpha_power, ap
  4179. @end table
  4180. A description of the accepted options follows.
  4181. @table @option
  4182. @item luma_radius, lr
  4183. @item chroma_radius, cr
  4184. @item alpha_radius, ar
  4185. Set an expression for the box radius in pixels used for blurring the
  4186. corresponding input plane.
  4187. The radius value must be a non-negative number, and must not be
  4188. greater than the value of the expression @code{min(w,h)/2} for the
  4189. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4190. planes.
  4191. Default value for @option{luma_radius} is "2". If not specified,
  4192. @option{chroma_radius} and @option{alpha_radius} default to the
  4193. corresponding value set for @option{luma_radius}.
  4194. The expressions can contain the following constants:
  4195. @table @option
  4196. @item w
  4197. @item h
  4198. The input width and height in pixels.
  4199. @item cw
  4200. @item ch
  4201. The input chroma image width and height in pixels.
  4202. @item hsub
  4203. @item vsub
  4204. The horizontal and vertical chroma subsample values. For example, for the
  4205. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4206. @end table
  4207. @item luma_power, lp
  4208. @item chroma_power, cp
  4209. @item alpha_power, ap
  4210. Specify how many times the boxblur filter is applied to the
  4211. corresponding plane.
  4212. Default value for @option{luma_power} is 2. If not specified,
  4213. @option{chroma_power} and @option{alpha_power} default to the
  4214. corresponding value set for @option{luma_power}.
  4215. A value of 0 will disable the effect.
  4216. @end table
  4217. @subsection Examples
  4218. @itemize
  4219. @item
  4220. Apply a boxblur filter with the luma, chroma, and alpha radii
  4221. set to 2:
  4222. @example
  4223. boxblur=luma_radius=2:luma_power=1
  4224. boxblur=2:1
  4225. @end example
  4226. @item
  4227. Set the luma radius to 2, and alpha and chroma radius to 0:
  4228. @example
  4229. boxblur=2:1:cr=0:ar=0
  4230. @end example
  4231. @item
  4232. Set the luma and chroma radii to a fraction of the video dimension:
  4233. @example
  4234. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4235. @end example
  4236. @end itemize
  4237. @section bwdif
  4238. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4239. Deinterlacing Filter").
  4240. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4241. interpolation algorithms.
  4242. It accepts the following parameters:
  4243. @table @option
  4244. @item mode
  4245. The interlacing mode to adopt. It accepts one of the following values:
  4246. @table @option
  4247. @item 0, send_frame
  4248. Output one frame for each frame.
  4249. @item 1, send_field
  4250. Output one frame for each field.
  4251. @end table
  4252. The default value is @code{send_field}.
  4253. @item parity
  4254. The picture field parity assumed for the input interlaced video. It accepts one
  4255. of the following values:
  4256. @table @option
  4257. @item 0, tff
  4258. Assume the top field is first.
  4259. @item 1, bff
  4260. Assume the bottom field is first.
  4261. @item -1, auto
  4262. Enable automatic detection of field parity.
  4263. @end table
  4264. The default value is @code{auto}.
  4265. If the interlacing is unknown or the decoder does not export this information,
  4266. top field first will be assumed.
  4267. @item deint
  4268. Specify which frames to deinterlace. Accept one of the following
  4269. values:
  4270. @table @option
  4271. @item 0, all
  4272. Deinterlace all frames.
  4273. @item 1, interlaced
  4274. Only deinterlace frames marked as interlaced.
  4275. @end table
  4276. The default value is @code{all}.
  4277. @end table
  4278. @section chromakey
  4279. YUV colorspace color/chroma keying.
  4280. The filter accepts the following options:
  4281. @table @option
  4282. @item color
  4283. The color which will be replaced with transparency.
  4284. @item similarity
  4285. Similarity percentage with the key color.
  4286. 0.01 matches only the exact key color, while 1.0 matches everything.
  4287. @item blend
  4288. Blend percentage.
  4289. 0.0 makes pixels either fully transparent, or not transparent at all.
  4290. Higher values result in semi-transparent pixels, with a higher transparency
  4291. the more similar the pixels color is to the key color.
  4292. @item yuv
  4293. Signals that the color passed is already in YUV instead of RGB.
  4294. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4295. This can be used to pass exact YUV values as hexadecimal numbers.
  4296. @end table
  4297. @subsection Examples
  4298. @itemize
  4299. @item
  4300. Make every green pixel in the input image transparent:
  4301. @example
  4302. ffmpeg -i input.png -vf chromakey=green out.png
  4303. @end example
  4304. @item
  4305. Overlay a greenscreen-video on top of a static black background.
  4306. @example
  4307. 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
  4308. @end example
  4309. @end itemize
  4310. @section ciescope
  4311. Display CIE color diagram with pixels overlaid onto it.
  4312. The filter accepts the following options:
  4313. @table @option
  4314. @item system
  4315. Set color system.
  4316. @table @samp
  4317. @item ntsc, 470m
  4318. @item ebu, 470bg
  4319. @item smpte
  4320. @item 240m
  4321. @item apple
  4322. @item widergb
  4323. @item cie1931
  4324. @item rec709, hdtv
  4325. @item uhdtv, rec2020
  4326. @end table
  4327. @item cie
  4328. Set CIE system.
  4329. @table @samp
  4330. @item xyy
  4331. @item ucs
  4332. @item luv
  4333. @end table
  4334. @item gamuts
  4335. Set what gamuts to draw.
  4336. See @code{system} option for available values.
  4337. @item size, s
  4338. Set ciescope size, by default set to 512.
  4339. @item intensity, i
  4340. Set intensity used to map input pixel values to CIE diagram.
  4341. @item contrast
  4342. Set contrast used to draw tongue colors that are out of active color system gamut.
  4343. @item corrgamma
  4344. Correct gamma displayed on scope, by default enabled.
  4345. @item showwhite
  4346. Show white point on CIE diagram, by default disabled.
  4347. @item gamma
  4348. Set input gamma. Used only with XYZ input color space.
  4349. @end table
  4350. @section codecview
  4351. Visualize information exported by some codecs.
  4352. Some codecs can export information through frames using side-data or other
  4353. means. For example, some MPEG based codecs export motion vectors through the
  4354. @var{export_mvs} flag in the codec @option{flags2} option.
  4355. The filter accepts the following option:
  4356. @table @option
  4357. @item mv
  4358. Set motion vectors to visualize.
  4359. Available flags for @var{mv} are:
  4360. @table @samp
  4361. @item pf
  4362. forward predicted MVs of P-frames
  4363. @item bf
  4364. forward predicted MVs of B-frames
  4365. @item bb
  4366. backward predicted MVs of B-frames
  4367. @end table
  4368. @item qp
  4369. Display quantization parameters using the chroma planes.
  4370. @item mv_type, mvt
  4371. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4372. Available flags for @var{mv_type} are:
  4373. @table @samp
  4374. @item fp
  4375. forward predicted MVs
  4376. @item bp
  4377. backward predicted MVs
  4378. @end table
  4379. @item frame_type, ft
  4380. Set frame type to visualize motion vectors of.
  4381. Available flags for @var{frame_type} are:
  4382. @table @samp
  4383. @item if
  4384. intra-coded frames (I-frames)
  4385. @item pf
  4386. predicted frames (P-frames)
  4387. @item bf
  4388. bi-directionally predicted frames (B-frames)
  4389. @end table
  4390. @end table
  4391. @subsection Examples
  4392. @itemize
  4393. @item
  4394. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4395. @example
  4396. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4397. @end example
  4398. @item
  4399. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4400. @example
  4401. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4402. @end example
  4403. @end itemize
  4404. @section colorbalance
  4405. Modify intensity of primary colors (red, green and blue) of input frames.
  4406. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4407. regions for the red-cyan, green-magenta or blue-yellow balance.
  4408. A positive adjustment value shifts the balance towards the primary color, a negative
  4409. value towards the complementary color.
  4410. The filter accepts the following options:
  4411. @table @option
  4412. @item rs
  4413. @item gs
  4414. @item bs
  4415. Adjust red, green and blue shadows (darkest pixels).
  4416. @item rm
  4417. @item gm
  4418. @item bm
  4419. Adjust red, green and blue midtones (medium pixels).
  4420. @item rh
  4421. @item gh
  4422. @item bh
  4423. Adjust red, green and blue highlights (brightest pixels).
  4424. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4425. @end table
  4426. @subsection Examples
  4427. @itemize
  4428. @item
  4429. Add red color cast to shadows:
  4430. @example
  4431. colorbalance=rs=.3
  4432. @end example
  4433. @end itemize
  4434. @section colorkey
  4435. RGB colorspace color keying.
  4436. The filter accepts the following options:
  4437. @table @option
  4438. @item color
  4439. The color which will be replaced with transparency.
  4440. @item similarity
  4441. Similarity percentage with the key color.
  4442. 0.01 matches only the exact key color, while 1.0 matches everything.
  4443. @item blend
  4444. Blend percentage.
  4445. 0.0 makes pixels either fully transparent, or not transparent at all.
  4446. Higher values result in semi-transparent pixels, with a higher transparency
  4447. the more similar the pixels color is to the key color.
  4448. @end table
  4449. @subsection Examples
  4450. @itemize
  4451. @item
  4452. Make every green pixel in the input image transparent:
  4453. @example
  4454. ffmpeg -i input.png -vf colorkey=green out.png
  4455. @end example
  4456. @item
  4457. Overlay a greenscreen-video on top of a static background image.
  4458. @example
  4459. 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
  4460. @end example
  4461. @end itemize
  4462. @section colorlevels
  4463. Adjust video input frames using levels.
  4464. The filter accepts the following options:
  4465. @table @option
  4466. @item rimin
  4467. @item gimin
  4468. @item bimin
  4469. @item aimin
  4470. Adjust red, green, blue and alpha input black point.
  4471. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4472. @item rimax
  4473. @item gimax
  4474. @item bimax
  4475. @item aimax
  4476. Adjust red, green, blue and alpha input white point.
  4477. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4478. Input levels are used to lighten highlights (bright tones), darken shadows
  4479. (dark tones), change the balance of bright and dark tones.
  4480. @item romin
  4481. @item gomin
  4482. @item bomin
  4483. @item aomin
  4484. Adjust red, green, blue and alpha output black point.
  4485. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4486. @item romax
  4487. @item gomax
  4488. @item bomax
  4489. @item aomax
  4490. Adjust red, green, blue and alpha output white point.
  4491. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4492. Output levels allows manual selection of a constrained output level range.
  4493. @end table
  4494. @subsection Examples
  4495. @itemize
  4496. @item
  4497. Make video output darker:
  4498. @example
  4499. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4500. @end example
  4501. @item
  4502. Increase contrast:
  4503. @example
  4504. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4505. @end example
  4506. @item
  4507. Make video output lighter:
  4508. @example
  4509. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4510. @end example
  4511. @item
  4512. Increase brightness:
  4513. @example
  4514. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4515. @end example
  4516. @end itemize
  4517. @section colorchannelmixer
  4518. Adjust video input frames by re-mixing color channels.
  4519. This filter modifies a color channel by adding the values associated to
  4520. the other channels of the same pixels. For example if the value to
  4521. modify is red, the output value will be:
  4522. @example
  4523. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4524. @end example
  4525. The filter accepts the following options:
  4526. @table @option
  4527. @item rr
  4528. @item rg
  4529. @item rb
  4530. @item ra
  4531. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4532. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4533. @item gr
  4534. @item gg
  4535. @item gb
  4536. @item ga
  4537. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4538. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4539. @item br
  4540. @item bg
  4541. @item bb
  4542. @item ba
  4543. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4544. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4545. @item ar
  4546. @item ag
  4547. @item ab
  4548. @item aa
  4549. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4550. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4551. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4552. @end table
  4553. @subsection Examples
  4554. @itemize
  4555. @item
  4556. Convert source to grayscale:
  4557. @example
  4558. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4559. @end example
  4560. @item
  4561. Simulate sepia tones:
  4562. @example
  4563. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4564. @end example
  4565. @end itemize
  4566. @section colormatrix
  4567. Convert color matrix.
  4568. The filter accepts the following options:
  4569. @table @option
  4570. @item src
  4571. @item dst
  4572. Specify the source and destination color matrix. Both values must be
  4573. specified.
  4574. The accepted values are:
  4575. @table @samp
  4576. @item bt709
  4577. BT.709
  4578. @item fcc
  4579. FCC
  4580. @item bt601
  4581. BT.601
  4582. @item bt470
  4583. BT.470
  4584. @item bt470bg
  4585. BT.470BG
  4586. @item smpte170m
  4587. SMPTE-170M
  4588. @item smpte240m
  4589. SMPTE-240M
  4590. @item bt2020
  4591. BT.2020
  4592. @end table
  4593. @end table
  4594. For example to convert from BT.601 to SMPTE-240M, use the command:
  4595. @example
  4596. colormatrix=bt601:smpte240m
  4597. @end example
  4598. @section colorspace
  4599. Convert colorspace, transfer characteristics or color primaries.
  4600. Input video needs to have an even size.
  4601. The filter accepts the following options:
  4602. @table @option
  4603. @anchor{all}
  4604. @item all
  4605. Specify all color properties at once.
  4606. The accepted values are:
  4607. @table @samp
  4608. @item bt470m
  4609. BT.470M
  4610. @item bt470bg
  4611. BT.470BG
  4612. @item bt601-6-525
  4613. BT.601-6 525
  4614. @item bt601-6-625
  4615. BT.601-6 625
  4616. @item bt709
  4617. BT.709
  4618. @item smpte170m
  4619. SMPTE-170M
  4620. @item smpte240m
  4621. SMPTE-240M
  4622. @item bt2020
  4623. BT.2020
  4624. @end table
  4625. @anchor{space}
  4626. @item space
  4627. Specify output colorspace.
  4628. The accepted values are:
  4629. @table @samp
  4630. @item bt709
  4631. BT.709
  4632. @item fcc
  4633. FCC
  4634. @item bt470bg
  4635. BT.470BG or BT.601-6 625
  4636. @item smpte170m
  4637. SMPTE-170M or BT.601-6 525
  4638. @item smpte240m
  4639. SMPTE-240M
  4640. @item ycgco
  4641. YCgCo
  4642. @item bt2020ncl
  4643. BT.2020 with non-constant luminance
  4644. @end table
  4645. @anchor{trc}
  4646. @item trc
  4647. Specify output transfer characteristics.
  4648. The accepted values are:
  4649. @table @samp
  4650. @item bt709
  4651. BT.709
  4652. @item bt470m
  4653. BT.470M
  4654. @item bt470bg
  4655. BT.470BG
  4656. @item gamma22
  4657. Constant gamma of 2.2
  4658. @item gamma28
  4659. Constant gamma of 2.8
  4660. @item smpte170m
  4661. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4662. @item smpte240m
  4663. SMPTE-240M
  4664. @item srgb
  4665. SRGB
  4666. @item iec61966-2-1
  4667. iec61966-2-1
  4668. @item iec61966-2-4
  4669. iec61966-2-4
  4670. @item xvycc
  4671. xvycc
  4672. @item bt2020-10
  4673. BT.2020 for 10-bits content
  4674. @item bt2020-12
  4675. BT.2020 for 12-bits content
  4676. @end table
  4677. @anchor{primaries}
  4678. @item primaries
  4679. Specify output color primaries.
  4680. The accepted values are:
  4681. @table @samp
  4682. @item bt709
  4683. BT.709
  4684. @item bt470m
  4685. BT.470M
  4686. @item bt470bg
  4687. BT.470BG or BT.601-6 625
  4688. @item smpte170m
  4689. SMPTE-170M or BT.601-6 525
  4690. @item smpte240m
  4691. SMPTE-240M
  4692. @item film
  4693. film
  4694. @item smpte431
  4695. SMPTE-431
  4696. @item smpte432
  4697. SMPTE-432
  4698. @item bt2020
  4699. BT.2020
  4700. @item jedec-p22
  4701. JEDEC P22 phosphors
  4702. @end table
  4703. @anchor{range}
  4704. @item range
  4705. Specify output color range.
  4706. The accepted values are:
  4707. @table @samp
  4708. @item tv
  4709. TV (restricted) range
  4710. @item mpeg
  4711. MPEG (restricted) range
  4712. @item pc
  4713. PC (full) range
  4714. @item jpeg
  4715. JPEG (full) range
  4716. @end table
  4717. @item format
  4718. Specify output color format.
  4719. The accepted values are:
  4720. @table @samp
  4721. @item yuv420p
  4722. YUV 4:2:0 planar 8-bits
  4723. @item yuv420p10
  4724. YUV 4:2:0 planar 10-bits
  4725. @item yuv420p12
  4726. YUV 4:2:0 planar 12-bits
  4727. @item yuv422p
  4728. YUV 4:2:2 planar 8-bits
  4729. @item yuv422p10
  4730. YUV 4:2:2 planar 10-bits
  4731. @item yuv422p12
  4732. YUV 4:2:2 planar 12-bits
  4733. @item yuv444p
  4734. YUV 4:4:4 planar 8-bits
  4735. @item yuv444p10
  4736. YUV 4:4:4 planar 10-bits
  4737. @item yuv444p12
  4738. YUV 4:4:4 planar 12-bits
  4739. @end table
  4740. @item fast
  4741. Do a fast conversion, which skips gamma/primary correction. This will take
  4742. significantly less CPU, but will be mathematically incorrect. To get output
  4743. compatible with that produced by the colormatrix filter, use fast=1.
  4744. @item dither
  4745. Specify dithering mode.
  4746. The accepted values are:
  4747. @table @samp
  4748. @item none
  4749. No dithering
  4750. @item fsb
  4751. Floyd-Steinberg dithering
  4752. @end table
  4753. @item wpadapt
  4754. Whitepoint adaptation mode.
  4755. The accepted values are:
  4756. @table @samp
  4757. @item bradford
  4758. Bradford whitepoint adaptation
  4759. @item vonkries
  4760. von Kries whitepoint adaptation
  4761. @item identity
  4762. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4763. @end table
  4764. @item iall
  4765. Override all input properties at once. Same accepted values as @ref{all}.
  4766. @item ispace
  4767. Override input colorspace. Same accepted values as @ref{space}.
  4768. @item iprimaries
  4769. Override input color primaries. Same accepted values as @ref{primaries}.
  4770. @item itrc
  4771. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4772. @item irange
  4773. Override input color range. Same accepted values as @ref{range}.
  4774. @end table
  4775. The filter converts the transfer characteristics, color space and color
  4776. primaries to the specified user values. The output value, if not specified,
  4777. is set to a default value based on the "all" property. If that property is
  4778. also not specified, the filter will log an error. The output color range and
  4779. format default to the same value as the input color range and format. The
  4780. input transfer characteristics, color space, color primaries and color range
  4781. should be set on the input data. If any of these are missing, the filter will
  4782. log an error and no conversion will take place.
  4783. For example to convert the input to SMPTE-240M, use the command:
  4784. @example
  4785. colorspace=smpte240m
  4786. @end example
  4787. @section convolution
  4788. Apply convolution 3x3, 5x5 or 7x7 filter.
  4789. The filter accepts the following options:
  4790. @table @option
  4791. @item 0m
  4792. @item 1m
  4793. @item 2m
  4794. @item 3m
  4795. Set matrix for each plane.
  4796. Matrix is sequence of 9, 25 or 49 signed integers.
  4797. @item 0rdiv
  4798. @item 1rdiv
  4799. @item 2rdiv
  4800. @item 3rdiv
  4801. Set multiplier for calculated value for each plane.
  4802. @item 0bias
  4803. @item 1bias
  4804. @item 2bias
  4805. @item 3bias
  4806. Set bias for each plane. This value is added to the result of the multiplication.
  4807. Useful for making the overall image brighter or darker. Default is 0.0.
  4808. @end table
  4809. @subsection Examples
  4810. @itemize
  4811. @item
  4812. Apply sharpen:
  4813. @example
  4814. 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"
  4815. @end example
  4816. @item
  4817. Apply blur:
  4818. @example
  4819. 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"
  4820. @end example
  4821. @item
  4822. Apply edge enhance:
  4823. @example
  4824. 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"
  4825. @end example
  4826. @item
  4827. Apply edge detect:
  4828. @example
  4829. 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"
  4830. @end example
  4831. @item
  4832. Apply laplacian edge detector which includes diagonals:
  4833. @example
  4834. 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"
  4835. @end example
  4836. @item
  4837. Apply emboss:
  4838. @example
  4839. 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"
  4840. @end example
  4841. @end itemize
  4842. @section convolve
  4843. Apply 2D convolution of video stream in frequency domain using second stream
  4844. as impulse.
  4845. The filter accepts the following options:
  4846. @table @option
  4847. @item planes
  4848. Set which planes to process.
  4849. @item impulse
  4850. Set which impulse video frames will be processed, can be @var{first}
  4851. or @var{all}. Default is @var{all}.
  4852. @end table
  4853. The @code{convolve} filter also supports the @ref{framesync} options.
  4854. @section copy
  4855. Copy the input video source unchanged to the output. This is mainly useful for
  4856. testing purposes.
  4857. @anchor{coreimage}
  4858. @section coreimage
  4859. Video filtering on GPU using Apple's CoreImage API on OSX.
  4860. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4861. processed by video hardware. However, software-based OpenGL implementations
  4862. exist which means there is no guarantee for hardware processing. It depends on
  4863. the respective OSX.
  4864. There are many filters and image generators provided by Apple that come with a
  4865. large variety of options. The filter has to be referenced by its name along
  4866. with its options.
  4867. The coreimage filter accepts the following options:
  4868. @table @option
  4869. @item list_filters
  4870. List all available filters and generators along with all their respective
  4871. options as well as possible minimum and maximum values along with the default
  4872. values.
  4873. @example
  4874. list_filters=true
  4875. @end example
  4876. @item filter
  4877. Specify all filters by their respective name and options.
  4878. Use @var{list_filters} to determine all valid filter names and options.
  4879. Numerical options are specified by a float value and are automatically clamped
  4880. to their respective value range. Vector and color options have to be specified
  4881. by a list of space separated float values. Character escaping has to be done.
  4882. A special option name @code{default} is available to use default options for a
  4883. filter.
  4884. It is required to specify either @code{default} or at least one of the filter options.
  4885. All omitted options are used with their default values.
  4886. The syntax of the filter string is as follows:
  4887. @example
  4888. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4889. @end example
  4890. @item output_rect
  4891. Specify a rectangle where the output of the filter chain is copied into the
  4892. input image. It is given by a list of space separated float values:
  4893. @example
  4894. output_rect=x\ y\ width\ height
  4895. @end example
  4896. If not given, the output rectangle equals the dimensions of the input image.
  4897. The output rectangle is automatically cropped at the borders of the input
  4898. image. Negative values are valid for each component.
  4899. @example
  4900. output_rect=25\ 25\ 100\ 100
  4901. @end example
  4902. @end table
  4903. Several filters can be chained for successive processing without GPU-HOST
  4904. transfers allowing for fast processing of complex filter chains.
  4905. Currently, only filters with zero (generators) or exactly one (filters) input
  4906. image and one output image are supported. Also, transition filters are not yet
  4907. usable as intended.
  4908. Some filters generate output images with additional padding depending on the
  4909. respective filter kernel. The padding is automatically removed to ensure the
  4910. filter output has the same size as the input image.
  4911. For image generators, the size of the output image is determined by the
  4912. previous output image of the filter chain or the input image of the whole
  4913. filterchain, respectively. The generators do not use the pixel information of
  4914. this image to generate their output. However, the generated output is
  4915. blended onto this image, resulting in partial or complete coverage of the
  4916. output image.
  4917. The @ref{coreimagesrc} video source can be used for generating input images
  4918. which are directly fed into the filter chain. By using it, providing input
  4919. images by another video source or an input video is not required.
  4920. @subsection Examples
  4921. @itemize
  4922. @item
  4923. List all filters available:
  4924. @example
  4925. coreimage=list_filters=true
  4926. @end example
  4927. @item
  4928. Use the CIBoxBlur filter with default options to blur an image:
  4929. @example
  4930. coreimage=filter=CIBoxBlur@@default
  4931. @end example
  4932. @item
  4933. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4934. its center at 100x100 and a radius of 50 pixels:
  4935. @example
  4936. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4937. @end example
  4938. @item
  4939. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4940. given as complete and escaped command-line for Apple's standard bash shell:
  4941. @example
  4942. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4943. @end example
  4944. @end itemize
  4945. @section crop
  4946. Crop the input video to given dimensions.
  4947. It accepts the following parameters:
  4948. @table @option
  4949. @item w, out_w
  4950. The width of the output video. It defaults to @code{iw}.
  4951. This expression is evaluated only once during the filter
  4952. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4953. @item h, out_h
  4954. The height of the output video. It defaults to @code{ih}.
  4955. This expression is evaluated only once during the filter
  4956. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4957. @item x
  4958. The horizontal position, in the input video, of the left edge of the output
  4959. video. It defaults to @code{(in_w-out_w)/2}.
  4960. This expression is evaluated per-frame.
  4961. @item y
  4962. The vertical position, in the input video, of the top edge of the output video.
  4963. It defaults to @code{(in_h-out_h)/2}.
  4964. This expression is evaluated per-frame.
  4965. @item keep_aspect
  4966. If set to 1 will force the output display aspect ratio
  4967. to be the same of the input, by changing the output sample aspect
  4968. ratio. It defaults to 0.
  4969. @item exact
  4970. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4971. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4972. It defaults to 0.
  4973. @end table
  4974. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4975. expressions containing the following constants:
  4976. @table @option
  4977. @item x
  4978. @item y
  4979. The computed values for @var{x} and @var{y}. They are evaluated for
  4980. each new frame.
  4981. @item in_w
  4982. @item in_h
  4983. The input width and height.
  4984. @item iw
  4985. @item ih
  4986. These are the same as @var{in_w} and @var{in_h}.
  4987. @item out_w
  4988. @item out_h
  4989. The output (cropped) width and height.
  4990. @item ow
  4991. @item oh
  4992. These are the same as @var{out_w} and @var{out_h}.
  4993. @item a
  4994. same as @var{iw} / @var{ih}
  4995. @item sar
  4996. input sample aspect ratio
  4997. @item dar
  4998. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4999. @item hsub
  5000. @item vsub
  5001. horizontal and vertical chroma subsample values. For example for the
  5002. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5003. @item n
  5004. The number of the input frame, starting from 0.
  5005. @item pos
  5006. the position in the file of the input frame, NAN if unknown
  5007. @item t
  5008. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5009. @end table
  5010. The expression for @var{out_w} may depend on the value of @var{out_h},
  5011. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5012. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5013. evaluated after @var{out_w} and @var{out_h}.
  5014. The @var{x} and @var{y} parameters specify the expressions for the
  5015. position of the top-left corner of the output (non-cropped) area. They
  5016. are evaluated for each frame. If the evaluated value is not valid, it
  5017. is approximated to the nearest valid value.
  5018. The expression for @var{x} may depend on @var{y}, and the expression
  5019. for @var{y} may depend on @var{x}.
  5020. @subsection Examples
  5021. @itemize
  5022. @item
  5023. Crop area with size 100x100 at position (12,34).
  5024. @example
  5025. crop=100:100:12:34
  5026. @end example
  5027. Using named options, the example above becomes:
  5028. @example
  5029. crop=w=100:h=100:x=12:y=34
  5030. @end example
  5031. @item
  5032. Crop the central input area with size 100x100:
  5033. @example
  5034. crop=100:100
  5035. @end example
  5036. @item
  5037. Crop the central input area with size 2/3 of the input video:
  5038. @example
  5039. crop=2/3*in_w:2/3*in_h
  5040. @end example
  5041. @item
  5042. Crop the input video central square:
  5043. @example
  5044. crop=out_w=in_h
  5045. crop=in_h
  5046. @end example
  5047. @item
  5048. Delimit the rectangle with the top-left corner placed at position
  5049. 100:100 and the right-bottom corner corresponding to the right-bottom
  5050. corner of the input image.
  5051. @example
  5052. crop=in_w-100:in_h-100:100:100
  5053. @end example
  5054. @item
  5055. Crop 10 pixels from the left and right borders, and 20 pixels from
  5056. the top and bottom borders
  5057. @example
  5058. crop=in_w-2*10:in_h-2*20
  5059. @end example
  5060. @item
  5061. Keep only the bottom right quarter of the input image:
  5062. @example
  5063. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5064. @end example
  5065. @item
  5066. Crop height for getting Greek harmony:
  5067. @example
  5068. crop=in_w:1/PHI*in_w
  5069. @end example
  5070. @item
  5071. Apply trembling effect:
  5072. @example
  5073. 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)
  5074. @end example
  5075. @item
  5076. Apply erratic camera effect depending on timestamp:
  5077. @example
  5078. 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)"
  5079. @end example
  5080. @item
  5081. Set x depending on the value of y:
  5082. @example
  5083. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5084. @end example
  5085. @end itemize
  5086. @subsection Commands
  5087. This filter supports the following commands:
  5088. @table @option
  5089. @item w, out_w
  5090. @item h, out_h
  5091. @item x
  5092. @item y
  5093. Set width/height of the output video and the horizontal/vertical position
  5094. in the input video.
  5095. The command accepts the same syntax of the corresponding option.
  5096. If the specified expression is not valid, it is kept at its current
  5097. value.
  5098. @end table
  5099. @section cropdetect
  5100. Auto-detect the crop size.
  5101. It calculates the necessary cropping parameters and prints the
  5102. recommended parameters via the logging system. The detected dimensions
  5103. correspond to the non-black area of the input video.
  5104. It accepts the following parameters:
  5105. @table @option
  5106. @item limit
  5107. Set higher black value threshold, which can be optionally specified
  5108. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5109. value greater to the set value is considered non-black. It defaults to 24.
  5110. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5111. on the bitdepth of the pixel format.
  5112. @item round
  5113. The value which the width/height should be divisible by. It defaults to
  5114. 16. The offset is automatically adjusted to center the video. Use 2 to
  5115. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5116. encoding to most video codecs.
  5117. @item reset_count, reset
  5118. Set the counter that determines after how many frames cropdetect will
  5119. reset the previously detected largest video area and start over to
  5120. detect the current optimal crop area. Default value is 0.
  5121. This can be useful when channel logos distort the video area. 0
  5122. indicates 'never reset', and returns the largest area encountered during
  5123. playback.
  5124. @end table
  5125. @anchor{curves}
  5126. @section curves
  5127. Apply color adjustments using curves.
  5128. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5129. component (red, green and blue) has its values defined by @var{N} key points
  5130. tied from each other using a smooth curve. The x-axis represents the pixel
  5131. values from the input frame, and the y-axis the new pixel values to be set for
  5132. the output frame.
  5133. By default, a component curve is defined by the two points @var{(0;0)} and
  5134. @var{(1;1)}. This creates a straight line where each original pixel value is
  5135. "adjusted" to its own value, which means no change to the image.
  5136. The filter allows you to redefine these two points and add some more. A new
  5137. curve (using a natural cubic spline interpolation) will be define to pass
  5138. smoothly through all these new coordinates. The new defined points needs to be
  5139. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5140. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5141. the vector spaces, the values will be clipped accordingly.
  5142. The filter accepts the following options:
  5143. @table @option
  5144. @item preset
  5145. Select one of the available color presets. This option can be used in addition
  5146. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5147. options takes priority on the preset values.
  5148. Available presets are:
  5149. @table @samp
  5150. @item none
  5151. @item color_negative
  5152. @item cross_process
  5153. @item darker
  5154. @item increase_contrast
  5155. @item lighter
  5156. @item linear_contrast
  5157. @item medium_contrast
  5158. @item negative
  5159. @item strong_contrast
  5160. @item vintage
  5161. @end table
  5162. Default is @code{none}.
  5163. @item master, m
  5164. Set the master key points. These points will define a second pass mapping. It
  5165. is sometimes called a "luminance" or "value" mapping. It can be used with
  5166. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5167. post-processing LUT.
  5168. @item red, r
  5169. Set the key points for the red component.
  5170. @item green, g
  5171. Set the key points for the green component.
  5172. @item blue, b
  5173. Set the key points for the blue component.
  5174. @item all
  5175. Set the key points for all components (not including master).
  5176. Can be used in addition to the other key points component
  5177. options. In this case, the unset component(s) will fallback on this
  5178. @option{all} setting.
  5179. @item psfile
  5180. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5181. @item plot
  5182. Save Gnuplot script of the curves in specified file.
  5183. @end table
  5184. To avoid some filtergraph syntax conflicts, each key points list need to be
  5185. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5186. @subsection Examples
  5187. @itemize
  5188. @item
  5189. Increase slightly the middle level of blue:
  5190. @example
  5191. curves=blue='0/0 0.5/0.58 1/1'
  5192. @end example
  5193. @item
  5194. Vintage effect:
  5195. @example
  5196. 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'
  5197. @end example
  5198. Here we obtain the following coordinates for each components:
  5199. @table @var
  5200. @item red
  5201. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5202. @item green
  5203. @code{(0;0) (0.50;0.48) (1;1)}
  5204. @item blue
  5205. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5206. @end table
  5207. @item
  5208. The previous example can also be achieved with the associated built-in preset:
  5209. @example
  5210. curves=preset=vintage
  5211. @end example
  5212. @item
  5213. Or simply:
  5214. @example
  5215. curves=vintage
  5216. @end example
  5217. @item
  5218. Use a Photoshop preset and redefine the points of the green component:
  5219. @example
  5220. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5221. @end example
  5222. @item
  5223. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5224. and @command{gnuplot}:
  5225. @example
  5226. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5227. gnuplot -p /tmp/curves.plt
  5228. @end example
  5229. @end itemize
  5230. @section datascope
  5231. Video data analysis filter.
  5232. This filter shows hexadecimal pixel values of part of video.
  5233. The filter accepts the following options:
  5234. @table @option
  5235. @item size, s
  5236. Set output video size.
  5237. @item x
  5238. Set x offset from where to pick pixels.
  5239. @item y
  5240. Set y offset from where to pick pixels.
  5241. @item mode
  5242. Set scope mode, can be one of the following:
  5243. @table @samp
  5244. @item mono
  5245. Draw hexadecimal pixel values with white color on black background.
  5246. @item color
  5247. Draw hexadecimal pixel values with input video pixel color on black
  5248. background.
  5249. @item color2
  5250. Draw hexadecimal pixel values on color background picked from input video,
  5251. the text color is picked in such way so its always visible.
  5252. @end table
  5253. @item axis
  5254. Draw rows and columns numbers on left and top of video.
  5255. @item opacity
  5256. Set background opacity.
  5257. @end table
  5258. @section dctdnoiz
  5259. Denoise frames using 2D DCT (frequency domain filtering).
  5260. This filter is not designed for real time.
  5261. The filter accepts the following options:
  5262. @table @option
  5263. @item sigma, s
  5264. Set the noise sigma constant.
  5265. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5266. coefficient (absolute value) below this threshold with be dropped.
  5267. If you need a more advanced filtering, see @option{expr}.
  5268. Default is @code{0}.
  5269. @item overlap
  5270. Set number overlapping pixels for each block. Since the filter can be slow, you
  5271. may want to reduce this value, at the cost of a less effective filter and the
  5272. risk of various artefacts.
  5273. If the overlapping value doesn't permit processing the whole input width or
  5274. height, a warning will be displayed and according borders won't be denoised.
  5275. Default value is @var{blocksize}-1, which is the best possible setting.
  5276. @item expr, e
  5277. Set the coefficient factor expression.
  5278. For each coefficient of a DCT block, this expression will be evaluated as a
  5279. multiplier value for the coefficient.
  5280. If this is option is set, the @option{sigma} option will be ignored.
  5281. The absolute value of the coefficient can be accessed through the @var{c}
  5282. variable.
  5283. @item n
  5284. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5285. @var{blocksize}, which is the width and height of the processed blocks.
  5286. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5287. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5288. on the speed processing. Also, a larger block size does not necessarily means a
  5289. better de-noising.
  5290. @end table
  5291. @subsection Examples
  5292. Apply a denoise with a @option{sigma} of @code{4.5}:
  5293. @example
  5294. dctdnoiz=4.5
  5295. @end example
  5296. The same operation can be achieved using the expression system:
  5297. @example
  5298. dctdnoiz=e='gte(c, 4.5*3)'
  5299. @end example
  5300. Violent denoise using a block size of @code{16x16}:
  5301. @example
  5302. dctdnoiz=15:n=4
  5303. @end example
  5304. @section deband
  5305. Remove banding artifacts from input video.
  5306. It works by replacing banded pixels with average value of referenced pixels.
  5307. The filter accepts the following options:
  5308. @table @option
  5309. @item 1thr
  5310. @item 2thr
  5311. @item 3thr
  5312. @item 4thr
  5313. Set banding detection threshold for each plane. Default is 0.02.
  5314. Valid range is 0.00003 to 0.5.
  5315. If difference between current pixel and reference pixel is less than threshold,
  5316. it will be considered as banded.
  5317. @item range, r
  5318. Banding detection range in pixels. Default is 16. If positive, random number
  5319. in range 0 to set value will be used. If negative, exact absolute value
  5320. will be used.
  5321. The range defines square of four pixels around current pixel.
  5322. @item direction, d
  5323. Set direction in radians from which four pixel will be compared. If positive,
  5324. random direction from 0 to set direction will be picked. If negative, exact of
  5325. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5326. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5327. column.
  5328. @item blur, b
  5329. If enabled, current pixel is compared with average value of all four
  5330. surrounding pixels. The default is enabled. If disabled current pixel is
  5331. compared with all four surrounding pixels. The pixel is considered banded
  5332. if only all four differences with surrounding pixels are less than threshold.
  5333. @item coupling, c
  5334. If enabled, current pixel is changed if and only if all pixel components are banded,
  5335. e.g. banding detection threshold is triggered for all color components.
  5336. The default is disabled.
  5337. @end table
  5338. @anchor{decimate}
  5339. @section decimate
  5340. Drop duplicated frames at regular intervals.
  5341. The filter accepts the following options:
  5342. @table @option
  5343. @item cycle
  5344. Set the number of frames from which one will be dropped. Setting this to
  5345. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5346. Default is @code{5}.
  5347. @item dupthresh
  5348. Set the threshold for duplicate detection. If the difference metric for a frame
  5349. is less than or equal to this value, then it is declared as duplicate. Default
  5350. is @code{1.1}
  5351. @item scthresh
  5352. Set scene change threshold. Default is @code{15}.
  5353. @item blockx
  5354. @item blocky
  5355. Set the size of the x and y-axis blocks used during metric calculations.
  5356. Larger blocks give better noise suppression, but also give worse detection of
  5357. small movements. Must be a power of two. Default is @code{32}.
  5358. @item ppsrc
  5359. Mark main input as a pre-processed input and activate clean source input
  5360. stream. This allows the input to be pre-processed with various filters to help
  5361. the metrics calculation while keeping the frame selection lossless. When set to
  5362. @code{1}, the first stream is for the pre-processed input, and the second
  5363. stream is the clean source from where the kept frames are chosen. Default is
  5364. @code{0}.
  5365. @item chroma
  5366. Set whether or not chroma is considered in the metric calculations. Default is
  5367. @code{1}.
  5368. @end table
  5369. @section deconvolve
  5370. Apply 2D deconvolution of video stream in frequency domain using second stream
  5371. as impulse.
  5372. The filter accepts the following options:
  5373. @table @option
  5374. @item planes
  5375. Set which planes to process.
  5376. @item impulse
  5377. Set which impulse video frames will be processed, can be @var{first}
  5378. or @var{all}. Default is @var{all}.
  5379. @item noise
  5380. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5381. and height are not same and not power of 2 or if stream prior to convolving
  5382. had noise.
  5383. @end table
  5384. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5385. @section deflate
  5386. Apply deflate effect to the video.
  5387. This filter replaces the pixel by the local(3x3) average by taking into account
  5388. only values lower than the pixel.
  5389. It accepts the following options:
  5390. @table @option
  5391. @item threshold0
  5392. @item threshold1
  5393. @item threshold2
  5394. @item threshold3
  5395. Limit the maximum change for each plane, default is 65535.
  5396. If 0, plane will remain unchanged.
  5397. @end table
  5398. @section deflicker
  5399. Remove temporal frame luminance variations.
  5400. It accepts the following options:
  5401. @table @option
  5402. @item size, s
  5403. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5404. @item mode, m
  5405. Set averaging mode to smooth temporal luminance variations.
  5406. Available values are:
  5407. @table @samp
  5408. @item am
  5409. Arithmetic mean
  5410. @item gm
  5411. Geometric mean
  5412. @item hm
  5413. Harmonic mean
  5414. @item qm
  5415. Quadratic mean
  5416. @item cm
  5417. Cubic mean
  5418. @item pm
  5419. Power mean
  5420. @item median
  5421. Median
  5422. @end table
  5423. @item bypass
  5424. Do not actually modify frame. Useful when one only wants metadata.
  5425. @end table
  5426. @section dejudder
  5427. Remove judder produced by partially interlaced telecined content.
  5428. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5429. source was partially telecined content then the output of @code{pullup,dejudder}
  5430. will have a variable frame rate. May change the recorded frame rate of the
  5431. container. Aside from that change, this filter will not affect constant frame
  5432. rate video.
  5433. The option available in this filter is:
  5434. @table @option
  5435. @item cycle
  5436. Specify the length of the window over which the judder repeats.
  5437. Accepts any integer greater than 1. Useful values are:
  5438. @table @samp
  5439. @item 4
  5440. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5441. @item 5
  5442. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5443. @item 20
  5444. If a mixture of the two.
  5445. @end table
  5446. The default is @samp{4}.
  5447. @end table
  5448. @section delogo
  5449. Suppress a TV station logo by a simple interpolation of the surrounding
  5450. pixels. Just set a rectangle covering the logo and watch it disappear
  5451. (and sometimes something even uglier appear - your mileage may vary).
  5452. It accepts the following parameters:
  5453. @table @option
  5454. @item x
  5455. @item y
  5456. Specify the top left corner coordinates of the logo. They must be
  5457. specified.
  5458. @item w
  5459. @item h
  5460. Specify the width and height of the logo to clear. They must be
  5461. specified.
  5462. @item band, t
  5463. Specify the thickness of the fuzzy edge of the rectangle (added to
  5464. @var{w} and @var{h}). The default value is 1. This option is
  5465. deprecated, setting higher values should no longer be necessary and
  5466. is not recommended.
  5467. @item show
  5468. When set to 1, a green rectangle is drawn on the screen to simplify
  5469. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5470. The default value is 0.
  5471. The rectangle is drawn on the outermost pixels which will be (partly)
  5472. replaced with interpolated values. The values of the next pixels
  5473. immediately outside this rectangle in each direction will be used to
  5474. compute the interpolated pixel values inside the rectangle.
  5475. @end table
  5476. @subsection Examples
  5477. @itemize
  5478. @item
  5479. Set a rectangle covering the area with top left corner coordinates 0,0
  5480. and size 100x77, and a band of size 10:
  5481. @example
  5482. delogo=x=0:y=0:w=100:h=77:band=10
  5483. @end example
  5484. @end itemize
  5485. @section deshake
  5486. Attempt to fix small changes in horizontal and/or vertical shift. This
  5487. filter helps remove camera shake from hand-holding a camera, bumping a
  5488. tripod, moving on a vehicle, etc.
  5489. The filter accepts the following options:
  5490. @table @option
  5491. @item x
  5492. @item y
  5493. @item w
  5494. @item h
  5495. Specify a rectangular area where to limit the search for motion
  5496. vectors.
  5497. If desired the search for motion vectors can be limited to a
  5498. rectangular area of the frame defined by its top left corner, width
  5499. and height. These parameters have the same meaning as the drawbox
  5500. filter which can be used to visualise the position of the bounding
  5501. box.
  5502. This is useful when simultaneous movement of subjects within the frame
  5503. might be confused for camera motion by the motion vector search.
  5504. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5505. then the full frame is used. This allows later options to be set
  5506. without specifying the bounding box for the motion vector search.
  5507. Default - search the whole frame.
  5508. @item rx
  5509. @item ry
  5510. Specify the maximum extent of movement in x and y directions in the
  5511. range 0-64 pixels. Default 16.
  5512. @item edge
  5513. Specify how to generate pixels to fill blanks at the edge of the
  5514. frame. Available values are:
  5515. @table @samp
  5516. @item blank, 0
  5517. Fill zeroes at blank locations
  5518. @item original, 1
  5519. Original image at blank locations
  5520. @item clamp, 2
  5521. Extruded edge value at blank locations
  5522. @item mirror, 3
  5523. Mirrored edge at blank locations
  5524. @end table
  5525. Default value is @samp{mirror}.
  5526. @item blocksize
  5527. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5528. default 8.
  5529. @item contrast
  5530. Specify the contrast threshold for blocks. Only blocks with more than
  5531. the specified contrast (difference between darkest and lightest
  5532. pixels) will be considered. Range 1-255, default 125.
  5533. @item search
  5534. Specify the search strategy. Available values are:
  5535. @table @samp
  5536. @item exhaustive, 0
  5537. Set exhaustive search
  5538. @item less, 1
  5539. Set less exhaustive search.
  5540. @end table
  5541. Default value is @samp{exhaustive}.
  5542. @item filename
  5543. If set then a detailed log of the motion search is written to the
  5544. specified file.
  5545. @end table
  5546. @section despill
  5547. Remove unwanted contamination of foreground colors, caused by reflected color of
  5548. greenscreen or bluescreen.
  5549. This filter accepts the following options:
  5550. @table @option
  5551. @item type
  5552. Set what type of despill to use.
  5553. @item mix
  5554. Set how spillmap will be generated.
  5555. @item expand
  5556. Set how much to get rid of still remaining spill.
  5557. @item red
  5558. Controls amount of red in spill area.
  5559. @item green
  5560. Controls amount of green in spill area.
  5561. Should be -1 for greenscreen.
  5562. @item blue
  5563. Controls amount of blue in spill area.
  5564. Should be -1 for bluescreen.
  5565. @item brightness
  5566. Controls brightness of spill area, preserving colors.
  5567. @item alpha
  5568. Modify alpha from generated spillmap.
  5569. @end table
  5570. @section detelecine
  5571. Apply an exact inverse of the telecine operation. It requires a predefined
  5572. pattern specified using the pattern option which must be the same as that passed
  5573. to the telecine filter.
  5574. This filter accepts the following options:
  5575. @table @option
  5576. @item first_field
  5577. @table @samp
  5578. @item top, t
  5579. top field first
  5580. @item bottom, b
  5581. bottom field first
  5582. The default value is @code{top}.
  5583. @end table
  5584. @item pattern
  5585. A string of numbers representing the pulldown pattern you wish to apply.
  5586. The default value is @code{23}.
  5587. @item start_frame
  5588. A number representing position of the first frame with respect to the telecine
  5589. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5590. @end table
  5591. @section dilation
  5592. Apply dilation effect to the video.
  5593. This filter replaces the pixel by the local(3x3) maximum.
  5594. It accepts the following options:
  5595. @table @option
  5596. @item threshold0
  5597. @item threshold1
  5598. @item threshold2
  5599. @item threshold3
  5600. Limit the maximum change for each plane, default is 65535.
  5601. If 0, plane will remain unchanged.
  5602. @item coordinates
  5603. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5604. pixels are used.
  5605. Flags to local 3x3 coordinates maps like this:
  5606. 1 2 3
  5607. 4 5
  5608. 6 7 8
  5609. @end table
  5610. @section displace
  5611. Displace pixels as indicated by second and third input stream.
  5612. It takes three input streams and outputs one stream, the first input is the
  5613. source, and second and third input are displacement maps.
  5614. The second input specifies how much to displace pixels along the
  5615. x-axis, while the third input specifies how much to displace pixels
  5616. along the y-axis.
  5617. If one of displacement map streams terminates, last frame from that
  5618. displacement map will be used.
  5619. Note that once generated, displacements maps can be reused over and over again.
  5620. A description of the accepted options follows.
  5621. @table @option
  5622. @item edge
  5623. Set displace behavior for pixels that are out of range.
  5624. Available values are:
  5625. @table @samp
  5626. @item blank
  5627. Missing pixels are replaced by black pixels.
  5628. @item smear
  5629. Adjacent pixels will spread out to replace missing pixels.
  5630. @item wrap
  5631. Out of range pixels are wrapped so they point to pixels of other side.
  5632. @item mirror
  5633. Out of range pixels will be replaced with mirrored pixels.
  5634. @end table
  5635. Default is @samp{smear}.
  5636. @end table
  5637. @subsection Examples
  5638. @itemize
  5639. @item
  5640. Add ripple effect to rgb input of video size hd720:
  5641. @example
  5642. 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
  5643. @end example
  5644. @item
  5645. Add wave effect to rgb input of video size hd720:
  5646. @example
  5647. 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
  5648. @end example
  5649. @end itemize
  5650. @section drawbox
  5651. Draw a colored box on the input image.
  5652. It accepts the following parameters:
  5653. @table @option
  5654. @item x
  5655. @item y
  5656. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5657. @item width, w
  5658. @item height, h
  5659. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5660. the input width and height. It defaults to 0.
  5661. @item color, c
  5662. Specify the color of the box to write. For the general syntax of this option,
  5663. check the "Color" section in the ffmpeg-utils manual. If the special
  5664. value @code{invert} is used, the box edge color is the same as the
  5665. video with inverted luma.
  5666. @item thickness, t
  5667. The expression which sets the thickness of the box edge.
  5668. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5669. See below for the list of accepted constants.
  5670. @item replace
  5671. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5672. will overwrite the video's color and alpha pixels.
  5673. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5674. @end table
  5675. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5676. following constants:
  5677. @table @option
  5678. @item dar
  5679. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5680. @item hsub
  5681. @item vsub
  5682. horizontal and vertical chroma subsample values. For example for the
  5683. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5684. @item in_h, ih
  5685. @item in_w, iw
  5686. The input width and height.
  5687. @item sar
  5688. The input sample aspect ratio.
  5689. @item x
  5690. @item y
  5691. The x and y offset coordinates where the box is drawn.
  5692. @item w
  5693. @item h
  5694. The width and height of the drawn box.
  5695. @item t
  5696. The thickness of the drawn box.
  5697. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5698. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5699. @end table
  5700. @subsection Examples
  5701. @itemize
  5702. @item
  5703. Draw a black box around the edge of the input image:
  5704. @example
  5705. drawbox
  5706. @end example
  5707. @item
  5708. Draw a box with color red and an opacity of 50%:
  5709. @example
  5710. drawbox=10:20:200:60:red@@0.5
  5711. @end example
  5712. The previous example can be specified as:
  5713. @example
  5714. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5715. @end example
  5716. @item
  5717. Fill the box with pink color:
  5718. @example
  5719. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5720. @end example
  5721. @item
  5722. Draw a 2-pixel red 2.40:1 mask:
  5723. @example
  5724. 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
  5725. @end example
  5726. @end itemize
  5727. @section drawgrid
  5728. Draw a grid on the input image.
  5729. It accepts the following parameters:
  5730. @table @option
  5731. @item x
  5732. @item y
  5733. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5734. @item width, w
  5735. @item height, h
  5736. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5737. input width and height, respectively, minus @code{thickness}, so image gets
  5738. framed. Default to 0.
  5739. @item color, c
  5740. Specify the color of the grid. For the general syntax of this option,
  5741. check the "Color" section in the ffmpeg-utils manual. If the special
  5742. value @code{invert} is used, the grid color is the same as the
  5743. video with inverted luma.
  5744. @item thickness, t
  5745. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5746. See below for the list of accepted constants.
  5747. @item replace
  5748. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5749. will overwrite the video's color and alpha pixels.
  5750. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5751. @end table
  5752. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5753. following constants:
  5754. @table @option
  5755. @item dar
  5756. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5757. @item hsub
  5758. @item vsub
  5759. horizontal and vertical chroma subsample values. For example for the
  5760. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5761. @item in_h, ih
  5762. @item in_w, iw
  5763. The input grid cell width and height.
  5764. @item sar
  5765. The input sample aspect ratio.
  5766. @item x
  5767. @item y
  5768. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5769. @item w
  5770. @item h
  5771. The width and height of the drawn cell.
  5772. @item t
  5773. The thickness of the drawn cell.
  5774. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5775. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5776. @end table
  5777. @subsection Examples
  5778. @itemize
  5779. @item
  5780. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5781. @example
  5782. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5783. @end example
  5784. @item
  5785. Draw a white 3x3 grid with an opacity of 50%:
  5786. @example
  5787. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5788. @end example
  5789. @end itemize
  5790. @anchor{drawtext}
  5791. @section drawtext
  5792. Draw a text string or text from a specified file on top of a video, using the
  5793. libfreetype library.
  5794. To enable compilation of this filter, you need to configure FFmpeg with
  5795. @code{--enable-libfreetype}.
  5796. To enable default font fallback and the @var{font} option you need to
  5797. configure FFmpeg with @code{--enable-libfontconfig}.
  5798. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5799. @code{--enable-libfribidi}.
  5800. @subsection Syntax
  5801. It accepts the following parameters:
  5802. @table @option
  5803. @item box
  5804. Used to draw a box around text using the background color.
  5805. The value must be either 1 (enable) or 0 (disable).
  5806. The default value of @var{box} is 0.
  5807. @item boxborderw
  5808. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5809. The default value of @var{boxborderw} is 0.
  5810. @item boxcolor
  5811. The color to be used for drawing box around text. For the syntax of this
  5812. option, check the "Color" section in the ffmpeg-utils manual.
  5813. The default value of @var{boxcolor} is "white".
  5814. @item line_spacing
  5815. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5816. The default value of @var{line_spacing} is 0.
  5817. @item borderw
  5818. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5819. The default value of @var{borderw} is 0.
  5820. @item bordercolor
  5821. Set the color to be used for drawing border around text. For the syntax of this
  5822. option, check the "Color" section in the ffmpeg-utils manual.
  5823. The default value of @var{bordercolor} is "black".
  5824. @item expansion
  5825. Select how the @var{text} is expanded. Can be either @code{none},
  5826. @code{strftime} (deprecated) or
  5827. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5828. below for details.
  5829. @item basetime
  5830. Set a start time for the count. Value is in microseconds. Only applied
  5831. in the deprecated strftime expansion mode. To emulate in normal expansion
  5832. mode use the @code{pts} function, supplying the start time (in seconds)
  5833. as the second argument.
  5834. @item fix_bounds
  5835. If true, check and fix text coords to avoid clipping.
  5836. @item fontcolor
  5837. The color to be used for drawing fonts. For the syntax of this option, check
  5838. the "Color" section in the ffmpeg-utils manual.
  5839. The default value of @var{fontcolor} is "black".
  5840. @item fontcolor_expr
  5841. String which is expanded the same way as @var{text} to obtain dynamic
  5842. @var{fontcolor} value. By default this option has empty value and is not
  5843. processed. When this option is set, it overrides @var{fontcolor} option.
  5844. @item font
  5845. The font family to be used for drawing text. By default Sans.
  5846. @item fontfile
  5847. The font file to be used for drawing text. The path must be included.
  5848. This parameter is mandatory if the fontconfig support is disabled.
  5849. @item alpha
  5850. Draw the text applying alpha blending. The value can
  5851. be a number between 0.0 and 1.0.
  5852. The expression accepts the same variables @var{x, y} as well.
  5853. The default value is 1.
  5854. Please see @var{fontcolor_expr}.
  5855. @item fontsize
  5856. The font size to be used for drawing text.
  5857. The default value of @var{fontsize} is 16.
  5858. @item text_shaping
  5859. If set to 1, attempt to shape the text (for example, reverse the order of
  5860. right-to-left text and join Arabic characters) before drawing it.
  5861. Otherwise, just draw the text exactly as given.
  5862. By default 1 (if supported).
  5863. @item ft_load_flags
  5864. The flags to be used for loading the fonts.
  5865. The flags map the corresponding flags supported by libfreetype, and are
  5866. a combination of the following values:
  5867. @table @var
  5868. @item default
  5869. @item no_scale
  5870. @item no_hinting
  5871. @item render
  5872. @item no_bitmap
  5873. @item vertical_layout
  5874. @item force_autohint
  5875. @item crop_bitmap
  5876. @item pedantic
  5877. @item ignore_global_advance_width
  5878. @item no_recurse
  5879. @item ignore_transform
  5880. @item monochrome
  5881. @item linear_design
  5882. @item no_autohint
  5883. @end table
  5884. Default value is "default".
  5885. For more information consult the documentation for the FT_LOAD_*
  5886. libfreetype flags.
  5887. @item shadowcolor
  5888. The color to be used for drawing a shadow behind the drawn text. For the
  5889. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5890. The default value of @var{shadowcolor} is "black".
  5891. @item shadowx
  5892. @item shadowy
  5893. The x and y offsets for the text shadow position with respect to the
  5894. position of the text. They can be either positive or negative
  5895. values. The default value for both is "0".
  5896. @item start_number
  5897. The starting frame number for the n/frame_num variable. The default value
  5898. is "0".
  5899. @item tabsize
  5900. The size in number of spaces to use for rendering the tab.
  5901. Default value is 4.
  5902. @item timecode
  5903. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5904. format. It can be used with or without text parameter. @var{timecode_rate}
  5905. option must be specified.
  5906. @item timecode_rate, rate, r
  5907. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5908. integer. Minimum value is "1".
  5909. Drop-frame timecode is supported for frame rates 30 & 60.
  5910. @item tc24hmax
  5911. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5912. Default is 0 (disabled).
  5913. @item text
  5914. The text string to be drawn. The text must be a sequence of UTF-8
  5915. encoded characters.
  5916. This parameter is mandatory if no file is specified with the parameter
  5917. @var{textfile}.
  5918. @item textfile
  5919. A text file containing text to be drawn. The text must be a sequence
  5920. of UTF-8 encoded characters.
  5921. This parameter is mandatory if no text string is specified with the
  5922. parameter @var{text}.
  5923. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5924. @item reload
  5925. If set to 1, the @var{textfile} will be reloaded before each frame.
  5926. Be sure to update it atomically, or it may be read partially, or even fail.
  5927. @item x
  5928. @item y
  5929. The expressions which specify the offsets where text will be drawn
  5930. within the video frame. They are relative to the top/left border of the
  5931. output image.
  5932. The default value of @var{x} and @var{y} is "0".
  5933. See below for the list of accepted constants and functions.
  5934. @end table
  5935. The parameters for @var{x} and @var{y} are expressions containing the
  5936. following constants and functions:
  5937. @table @option
  5938. @item dar
  5939. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5940. @item hsub
  5941. @item vsub
  5942. horizontal and vertical chroma subsample values. For example for the
  5943. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5944. @item line_h, lh
  5945. the height of each text line
  5946. @item main_h, h, H
  5947. the input height
  5948. @item main_w, w, W
  5949. the input width
  5950. @item max_glyph_a, ascent
  5951. the maximum distance from the baseline to the highest/upper grid
  5952. coordinate used to place a glyph outline point, for all the rendered
  5953. glyphs.
  5954. It is a positive value, due to the grid's orientation with the Y axis
  5955. upwards.
  5956. @item max_glyph_d, descent
  5957. the maximum distance from the baseline to the lowest grid coordinate
  5958. used to place a glyph outline point, for all the rendered glyphs.
  5959. This is a negative value, due to the grid's orientation, with the Y axis
  5960. upwards.
  5961. @item max_glyph_h
  5962. maximum glyph height, that is the maximum height for all the glyphs
  5963. contained in the rendered text, it is equivalent to @var{ascent} -
  5964. @var{descent}.
  5965. @item max_glyph_w
  5966. maximum glyph width, that is the maximum width for all the glyphs
  5967. contained in the rendered text
  5968. @item n
  5969. the number of input frame, starting from 0
  5970. @item rand(min, max)
  5971. return a random number included between @var{min} and @var{max}
  5972. @item sar
  5973. The input sample aspect ratio.
  5974. @item t
  5975. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5976. @item text_h, th
  5977. the height of the rendered text
  5978. @item text_w, tw
  5979. the width of the rendered text
  5980. @item x
  5981. @item y
  5982. the x and y offset coordinates where the text is drawn.
  5983. These parameters allow the @var{x} and @var{y} expressions to refer
  5984. each other, so you can for example specify @code{y=x/dar}.
  5985. @end table
  5986. @anchor{drawtext_expansion}
  5987. @subsection Text expansion
  5988. If @option{expansion} is set to @code{strftime},
  5989. the filter recognizes strftime() sequences in the provided text and
  5990. expands them accordingly. Check the documentation of strftime(). This
  5991. feature is deprecated.
  5992. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5993. If @option{expansion} is set to @code{normal} (which is the default),
  5994. the following expansion mechanism is used.
  5995. The backslash character @samp{\}, followed by any character, always expands to
  5996. the second character.
  5997. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5998. braces is a function name, possibly followed by arguments separated by ':'.
  5999. If the arguments contain special characters or delimiters (':' or '@}'),
  6000. they should be escaped.
  6001. Note that they probably must also be escaped as the value for the
  6002. @option{text} option in the filter argument string and as the filter
  6003. argument in the filtergraph description, and possibly also for the shell,
  6004. that makes up to four levels of escaping; using a text file avoids these
  6005. problems.
  6006. The following functions are available:
  6007. @table @command
  6008. @item expr, e
  6009. The expression evaluation result.
  6010. It must take one argument specifying the expression to be evaluated,
  6011. which accepts the same constants and functions as the @var{x} and
  6012. @var{y} values. Note that not all constants should be used, for
  6013. example the text size is not known when evaluating the expression, so
  6014. the constants @var{text_w} and @var{text_h} will have an undefined
  6015. value.
  6016. @item expr_int_format, eif
  6017. Evaluate the expression's value and output as formatted integer.
  6018. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6019. The second argument specifies the output format. Allowed values are @samp{x},
  6020. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6021. @code{printf} function.
  6022. The third parameter is optional and sets the number of positions taken by the output.
  6023. It can be used to add padding with zeros from the left.
  6024. @item gmtime
  6025. The time at which the filter is running, expressed in UTC.
  6026. It can accept an argument: a strftime() format string.
  6027. @item localtime
  6028. The time at which the filter is running, expressed in the local time zone.
  6029. It can accept an argument: a strftime() format string.
  6030. @item metadata
  6031. Frame metadata. Takes one or two arguments.
  6032. The first argument is mandatory and specifies the metadata key.
  6033. The second argument is optional and specifies a default value, used when the
  6034. metadata key is not found or empty.
  6035. @item n, frame_num
  6036. The frame number, starting from 0.
  6037. @item pict_type
  6038. A 1 character description of the current picture type.
  6039. @item pts
  6040. The timestamp of the current frame.
  6041. It can take up to three arguments.
  6042. The first argument is the format of the timestamp; it defaults to @code{flt}
  6043. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6044. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6045. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6046. @code{localtime} stands for the timestamp of the frame formatted as
  6047. local time zone time.
  6048. The second argument is an offset added to the timestamp.
  6049. If the format is set to @code{localtime} or @code{gmtime},
  6050. a third argument may be supplied: a strftime() format string.
  6051. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6052. @end table
  6053. @subsection Examples
  6054. @itemize
  6055. @item
  6056. Draw "Test Text" with font FreeSerif, using the default values for the
  6057. optional parameters.
  6058. @example
  6059. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6060. @end example
  6061. @item
  6062. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6063. and y=50 (counting from the top-left corner of the screen), text is
  6064. yellow with a red box around it. Both the text and the box have an
  6065. opacity of 20%.
  6066. @example
  6067. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6068. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6069. @end example
  6070. Note that the double quotes are not necessary if spaces are not used
  6071. within the parameter list.
  6072. @item
  6073. Show the text at the center of the video frame:
  6074. @example
  6075. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6076. @end example
  6077. @item
  6078. Show the text at a random position, switching to a new position every 30 seconds:
  6079. @example
  6080. 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)"
  6081. @end example
  6082. @item
  6083. Show a text line sliding from right to left in the last row of the video
  6084. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6085. with no newlines.
  6086. @example
  6087. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6088. @end example
  6089. @item
  6090. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6091. @example
  6092. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6093. @end example
  6094. @item
  6095. Draw a single green letter "g", at the center of the input video.
  6096. The glyph baseline is placed at half screen height.
  6097. @example
  6098. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6099. @end example
  6100. @item
  6101. Show text for 1 second every 3 seconds:
  6102. @example
  6103. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6104. @end example
  6105. @item
  6106. Use fontconfig to set the font. Note that the colons need to be escaped.
  6107. @example
  6108. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6109. @end example
  6110. @item
  6111. Print the date of a real-time encoding (see strftime(3)):
  6112. @example
  6113. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6114. @end example
  6115. @item
  6116. Show text fading in and out (appearing/disappearing):
  6117. @example
  6118. #!/bin/sh
  6119. DS=1.0 # display start
  6120. DE=10.0 # display end
  6121. FID=1.5 # fade in duration
  6122. FOD=5 # fade out duration
  6123. 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 @}"
  6124. @end example
  6125. @item
  6126. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6127. and the @option{fontsize} value are included in the @option{y} offset.
  6128. @example
  6129. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6130. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6131. @end example
  6132. @end itemize
  6133. For more information about libfreetype, check:
  6134. @url{http://www.freetype.org/}.
  6135. For more information about fontconfig, check:
  6136. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6137. For more information about libfribidi, check:
  6138. @url{http://fribidi.org/}.
  6139. @section edgedetect
  6140. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6141. The filter accepts the following options:
  6142. @table @option
  6143. @item low
  6144. @item high
  6145. Set low and high threshold values used by the Canny thresholding
  6146. algorithm.
  6147. The high threshold selects the "strong" edge pixels, which are then
  6148. connected through 8-connectivity with the "weak" edge pixels selected
  6149. by the low threshold.
  6150. @var{low} and @var{high} threshold values must be chosen in the range
  6151. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6152. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6153. is @code{50/255}.
  6154. @item mode
  6155. Define the drawing mode.
  6156. @table @samp
  6157. @item wires
  6158. Draw white/gray wires on black background.
  6159. @item colormix
  6160. Mix the colors to create a paint/cartoon effect.
  6161. @end table
  6162. Default value is @var{wires}.
  6163. @end table
  6164. @subsection Examples
  6165. @itemize
  6166. @item
  6167. Standard edge detection with custom values for the hysteresis thresholding:
  6168. @example
  6169. edgedetect=low=0.1:high=0.4
  6170. @end example
  6171. @item
  6172. Painting effect without thresholding:
  6173. @example
  6174. edgedetect=mode=colormix:high=0
  6175. @end example
  6176. @end itemize
  6177. @section eq
  6178. Set brightness, contrast, saturation and approximate gamma adjustment.
  6179. The filter accepts the following options:
  6180. @table @option
  6181. @item contrast
  6182. Set the contrast expression. The value must be a float value in range
  6183. @code{-2.0} to @code{2.0}. The default value is "1".
  6184. @item brightness
  6185. Set the brightness expression. The value must be a float value in
  6186. range @code{-1.0} to @code{1.0}. The default value is "0".
  6187. @item saturation
  6188. Set the saturation expression. The value must be a float in
  6189. range @code{0.0} to @code{3.0}. The default value is "1".
  6190. @item gamma
  6191. Set the gamma expression. The value must be a float in range
  6192. @code{0.1} to @code{10.0}. The default value is "1".
  6193. @item gamma_r
  6194. Set the gamma expression for red. The value must be a float in
  6195. range @code{0.1} to @code{10.0}. The default value is "1".
  6196. @item gamma_g
  6197. Set the gamma expression for green. The value must be a float in range
  6198. @code{0.1} to @code{10.0}. The default value is "1".
  6199. @item gamma_b
  6200. Set the gamma expression for blue. The value must be a float in range
  6201. @code{0.1} to @code{10.0}. The default value is "1".
  6202. @item gamma_weight
  6203. Set the gamma weight expression. It can be used to reduce the effect
  6204. of a high gamma value on bright image areas, e.g. keep them from
  6205. getting overamplified and just plain white. The value must be a float
  6206. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6207. gamma correction all the way down while @code{1.0} leaves it at its
  6208. full strength. Default is "1".
  6209. @item eval
  6210. Set when the expressions for brightness, contrast, saturation and
  6211. gamma expressions are evaluated.
  6212. It accepts the following values:
  6213. @table @samp
  6214. @item init
  6215. only evaluate expressions once during the filter initialization or
  6216. when a command is processed
  6217. @item frame
  6218. evaluate expressions for each incoming frame
  6219. @end table
  6220. Default value is @samp{init}.
  6221. @end table
  6222. The expressions accept the following parameters:
  6223. @table @option
  6224. @item n
  6225. frame count of the input frame starting from 0
  6226. @item pos
  6227. byte position of the corresponding packet in the input file, NAN if
  6228. unspecified
  6229. @item r
  6230. frame rate of the input video, NAN if the input frame rate is unknown
  6231. @item t
  6232. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6233. @end table
  6234. @subsection Commands
  6235. The filter supports the following commands:
  6236. @table @option
  6237. @item contrast
  6238. Set the contrast expression.
  6239. @item brightness
  6240. Set the brightness expression.
  6241. @item saturation
  6242. Set the saturation expression.
  6243. @item gamma
  6244. Set the gamma expression.
  6245. @item gamma_r
  6246. Set the gamma_r expression.
  6247. @item gamma_g
  6248. Set gamma_g expression.
  6249. @item gamma_b
  6250. Set gamma_b expression.
  6251. @item gamma_weight
  6252. Set gamma_weight expression.
  6253. The command accepts the same syntax of the corresponding option.
  6254. If the specified expression is not valid, it is kept at its current
  6255. value.
  6256. @end table
  6257. @section erosion
  6258. Apply erosion effect to the video.
  6259. This filter replaces the pixel by the local(3x3) minimum.
  6260. It accepts the following options:
  6261. @table @option
  6262. @item threshold0
  6263. @item threshold1
  6264. @item threshold2
  6265. @item threshold3
  6266. Limit the maximum change for each plane, default is 65535.
  6267. If 0, plane will remain unchanged.
  6268. @item coordinates
  6269. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6270. pixels are used.
  6271. Flags to local 3x3 coordinates maps like this:
  6272. 1 2 3
  6273. 4 5
  6274. 6 7 8
  6275. @end table
  6276. @section extractplanes
  6277. Extract color channel components from input video stream into
  6278. separate grayscale video streams.
  6279. The filter accepts the following option:
  6280. @table @option
  6281. @item planes
  6282. Set plane(s) to extract.
  6283. Available values for planes are:
  6284. @table @samp
  6285. @item y
  6286. @item u
  6287. @item v
  6288. @item a
  6289. @item r
  6290. @item g
  6291. @item b
  6292. @end table
  6293. Choosing planes not available in the input will result in an error.
  6294. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6295. with @code{y}, @code{u}, @code{v} planes at same time.
  6296. @end table
  6297. @subsection Examples
  6298. @itemize
  6299. @item
  6300. Extract luma, u and v color channel component from input video frame
  6301. into 3 grayscale outputs:
  6302. @example
  6303. 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
  6304. @end example
  6305. @end itemize
  6306. @section elbg
  6307. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6308. For each input image, the filter will compute the optimal mapping from
  6309. the input to the output given the codebook length, that is the number
  6310. of distinct output colors.
  6311. This filter accepts the following options.
  6312. @table @option
  6313. @item codebook_length, l
  6314. Set codebook length. The value must be a positive integer, and
  6315. represents the number of distinct output colors. Default value is 256.
  6316. @item nb_steps, n
  6317. Set the maximum number of iterations to apply for computing the optimal
  6318. mapping. The higher the value the better the result and the higher the
  6319. computation time. Default value is 1.
  6320. @item seed, s
  6321. Set a random seed, must be an integer included between 0 and
  6322. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6323. will try to use a good random seed on a best effort basis.
  6324. @item pal8
  6325. Set pal8 output pixel format. This option does not work with codebook
  6326. length greater than 256.
  6327. @end table
  6328. @section fade
  6329. Apply a fade-in/out effect to the input video.
  6330. It accepts the following parameters:
  6331. @table @option
  6332. @item type, t
  6333. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6334. effect.
  6335. Default is @code{in}.
  6336. @item start_frame, s
  6337. Specify the number of the frame to start applying the fade
  6338. effect at. Default is 0.
  6339. @item nb_frames, n
  6340. The number of frames that the fade effect lasts. At the end of the
  6341. fade-in effect, the output video will have the same intensity as the input video.
  6342. At the end of the fade-out transition, the output video will be filled with the
  6343. selected @option{color}.
  6344. Default is 25.
  6345. @item alpha
  6346. If set to 1, fade only alpha channel, if one exists on the input.
  6347. Default value is 0.
  6348. @item start_time, st
  6349. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6350. effect. If both start_frame and start_time are specified, the fade will start at
  6351. whichever comes last. Default is 0.
  6352. @item duration, d
  6353. The number of seconds for which the fade effect has to last. At the end of the
  6354. fade-in effect the output video will have the same intensity as the input video,
  6355. at the end of the fade-out transition the output video will be filled with the
  6356. selected @option{color}.
  6357. If both duration and nb_frames are specified, duration is used. Default is 0
  6358. (nb_frames is used by default).
  6359. @item color, c
  6360. Specify the color of the fade. Default is "black".
  6361. @end table
  6362. @subsection Examples
  6363. @itemize
  6364. @item
  6365. Fade in the first 30 frames of video:
  6366. @example
  6367. fade=in:0:30
  6368. @end example
  6369. The command above is equivalent to:
  6370. @example
  6371. fade=t=in:s=0:n=30
  6372. @end example
  6373. @item
  6374. Fade out the last 45 frames of a 200-frame video:
  6375. @example
  6376. fade=out:155:45
  6377. fade=type=out:start_frame=155:nb_frames=45
  6378. @end example
  6379. @item
  6380. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6381. @example
  6382. fade=in:0:25, fade=out:975:25
  6383. @end example
  6384. @item
  6385. Make the first 5 frames yellow, then fade in from frame 5-24:
  6386. @example
  6387. fade=in:5:20:color=yellow
  6388. @end example
  6389. @item
  6390. Fade in alpha over first 25 frames of video:
  6391. @example
  6392. fade=in:0:25:alpha=1
  6393. @end example
  6394. @item
  6395. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6396. @example
  6397. fade=t=in:st=5.5:d=0.5
  6398. @end example
  6399. @end itemize
  6400. @section fftfilt
  6401. Apply arbitrary expressions to samples in frequency domain
  6402. @table @option
  6403. @item dc_Y
  6404. Adjust the dc value (gain) of the luma plane of the image. The filter
  6405. accepts an integer value in range @code{0} to @code{1000}. The default
  6406. value is set to @code{0}.
  6407. @item dc_U
  6408. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6409. filter accepts an integer value in range @code{0} to @code{1000}. The
  6410. default value is set to @code{0}.
  6411. @item dc_V
  6412. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6413. filter accepts an integer value in range @code{0} to @code{1000}. The
  6414. default value is set to @code{0}.
  6415. @item weight_Y
  6416. Set the frequency domain weight expression for the luma plane.
  6417. @item weight_U
  6418. Set the frequency domain weight expression for the 1st chroma plane.
  6419. @item weight_V
  6420. Set the frequency domain weight expression for the 2nd chroma plane.
  6421. @item eval
  6422. Set when the expressions are evaluated.
  6423. It accepts the following values:
  6424. @table @samp
  6425. @item init
  6426. Only evaluate expressions once during the filter initialization.
  6427. @item frame
  6428. Evaluate expressions for each incoming frame.
  6429. @end table
  6430. Default value is @samp{init}.
  6431. The filter accepts the following variables:
  6432. @item X
  6433. @item Y
  6434. The coordinates of the current sample.
  6435. @item W
  6436. @item H
  6437. The width and height of the image.
  6438. @item N
  6439. The number of input frame, starting from 0.
  6440. @end table
  6441. @subsection Examples
  6442. @itemize
  6443. @item
  6444. High-pass:
  6445. @example
  6446. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6447. @end example
  6448. @item
  6449. Low-pass:
  6450. @example
  6451. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6452. @end example
  6453. @item
  6454. Sharpen:
  6455. @example
  6456. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6457. @end example
  6458. @item
  6459. Blur:
  6460. @example
  6461. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6462. @end example
  6463. @end itemize
  6464. @section field
  6465. Extract a single field from an interlaced image using stride
  6466. arithmetic to avoid wasting CPU time. The output frames are marked as
  6467. non-interlaced.
  6468. The filter accepts the following options:
  6469. @table @option
  6470. @item type
  6471. Specify whether to extract the top (if the value is @code{0} or
  6472. @code{top}) or the bottom field (if the value is @code{1} or
  6473. @code{bottom}).
  6474. @end table
  6475. @section fieldhint
  6476. Create new frames by copying the top and bottom fields from surrounding frames
  6477. supplied as numbers by the hint file.
  6478. @table @option
  6479. @item hint
  6480. Set file containing hints: absolute/relative frame numbers.
  6481. There must be one line for each frame in a clip. Each line must contain two
  6482. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6483. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6484. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6485. for @code{relative} mode. First number tells from which frame to pick up top
  6486. field and second number tells from which frame to pick up bottom field.
  6487. If optionally followed by @code{+} output frame will be marked as interlaced,
  6488. else if followed by @code{-} output frame will be marked as progressive, else
  6489. it will be marked same as input frame.
  6490. If line starts with @code{#} or @code{;} that line is skipped.
  6491. @item mode
  6492. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6493. @end table
  6494. Example of first several lines of @code{hint} file for @code{relative} mode:
  6495. @example
  6496. 0,0 - # first frame
  6497. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6498. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6499. 1,0 -
  6500. 0,0 -
  6501. 0,0 -
  6502. 1,0 -
  6503. 1,0 -
  6504. 1,0 -
  6505. 0,0 -
  6506. 0,0 -
  6507. 1,0 -
  6508. 1,0 -
  6509. 1,0 -
  6510. 0,0 -
  6511. @end example
  6512. @section fieldmatch
  6513. Field matching filter for inverse telecine. It is meant to reconstruct the
  6514. progressive frames from a telecined stream. The filter does not drop duplicated
  6515. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6516. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6517. The separation of the field matching and the decimation is notably motivated by
  6518. the possibility of inserting a de-interlacing filter fallback between the two.
  6519. If the source has mixed telecined and real interlaced content,
  6520. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6521. But these remaining combed frames will be marked as interlaced, and thus can be
  6522. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6523. In addition to the various configuration options, @code{fieldmatch} can take an
  6524. optional second stream, activated through the @option{ppsrc} option. If
  6525. enabled, the frames reconstruction will be based on the fields and frames from
  6526. this second stream. This allows the first input to be pre-processed in order to
  6527. help the various algorithms of the filter, while keeping the output lossless
  6528. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6529. or brightness/contrast adjustments can help.
  6530. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6531. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6532. which @code{fieldmatch} is based on. While the semantic and usage are very
  6533. close, some behaviour and options names can differ.
  6534. The @ref{decimate} filter currently only works for constant frame rate input.
  6535. If your input has mixed telecined (30fps) and progressive content with a lower
  6536. framerate like 24fps use the following filterchain to produce the necessary cfr
  6537. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6538. The filter accepts the following options:
  6539. @table @option
  6540. @item order
  6541. Specify the assumed field order of the input stream. Available values are:
  6542. @table @samp
  6543. @item auto
  6544. Auto detect parity (use FFmpeg's internal parity value).
  6545. @item bff
  6546. Assume bottom field first.
  6547. @item tff
  6548. Assume top field first.
  6549. @end table
  6550. Note that it is sometimes recommended not to trust the parity announced by the
  6551. stream.
  6552. Default value is @var{auto}.
  6553. @item mode
  6554. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6555. sense that it won't risk creating jerkiness due to duplicate frames when
  6556. possible, but if there are bad edits or blended fields it will end up
  6557. outputting combed frames when a good match might actually exist. On the other
  6558. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6559. but will almost always find a good frame if there is one. The other values are
  6560. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6561. jerkiness and creating duplicate frames versus finding good matches in sections
  6562. with bad edits, orphaned fields, blended fields, etc.
  6563. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6564. Available values are:
  6565. @table @samp
  6566. @item pc
  6567. 2-way matching (p/c)
  6568. @item pc_n
  6569. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6570. @item pc_u
  6571. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6572. @item pc_n_ub
  6573. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6574. still combed (p/c + n + u/b)
  6575. @item pcn
  6576. 3-way matching (p/c/n)
  6577. @item pcn_ub
  6578. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6579. detected as combed (p/c/n + u/b)
  6580. @end table
  6581. The parenthesis at the end indicate the matches that would be used for that
  6582. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6583. @var{top}).
  6584. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6585. the slowest.
  6586. Default value is @var{pc_n}.
  6587. @item ppsrc
  6588. Mark the main input stream as a pre-processed input, and enable the secondary
  6589. input stream as the clean source to pick the fields from. See the filter
  6590. introduction for more details. It is similar to the @option{clip2} feature from
  6591. VFM/TFM.
  6592. Default value is @code{0} (disabled).
  6593. @item field
  6594. Set the field to match from. It is recommended to set this to the same value as
  6595. @option{order} unless you experience matching failures with that setting. In
  6596. certain circumstances changing the field that is used to match from can have a
  6597. large impact on matching performance. Available values are:
  6598. @table @samp
  6599. @item auto
  6600. Automatic (same value as @option{order}).
  6601. @item bottom
  6602. Match from the bottom field.
  6603. @item top
  6604. Match from the top field.
  6605. @end table
  6606. Default value is @var{auto}.
  6607. @item mchroma
  6608. Set whether or not chroma is included during the match comparisons. In most
  6609. cases it is recommended to leave this enabled. You should set this to @code{0}
  6610. only if your clip has bad chroma problems such as heavy rainbowing or other
  6611. artifacts. Setting this to @code{0} could also be used to speed things up at
  6612. the cost of some accuracy.
  6613. Default value is @code{1}.
  6614. @item y0
  6615. @item y1
  6616. These define an exclusion band which excludes the lines between @option{y0} and
  6617. @option{y1} from being included in the field matching decision. An exclusion
  6618. band can be used to ignore subtitles, a logo, or other things that may
  6619. interfere with the matching. @option{y0} sets the starting scan line and
  6620. @option{y1} sets the ending line; all lines in between @option{y0} and
  6621. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6622. @option{y0} and @option{y1} to the same value will disable the feature.
  6623. @option{y0} and @option{y1} defaults to @code{0}.
  6624. @item scthresh
  6625. Set the scene change detection threshold as a percentage of maximum change on
  6626. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6627. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6628. @option{scthresh} is @code{[0.0, 100.0]}.
  6629. Default value is @code{12.0}.
  6630. @item combmatch
  6631. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6632. account the combed scores of matches when deciding what match to use as the
  6633. final match. Available values are:
  6634. @table @samp
  6635. @item none
  6636. No final matching based on combed scores.
  6637. @item sc
  6638. Combed scores are only used when a scene change is detected.
  6639. @item full
  6640. Use combed scores all the time.
  6641. @end table
  6642. Default is @var{sc}.
  6643. @item combdbg
  6644. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6645. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6646. Available values are:
  6647. @table @samp
  6648. @item none
  6649. No forced calculation.
  6650. @item pcn
  6651. Force p/c/n calculations.
  6652. @item pcnub
  6653. Force p/c/n/u/b calculations.
  6654. @end table
  6655. Default value is @var{none}.
  6656. @item cthresh
  6657. This is the area combing threshold used for combed frame detection. This
  6658. essentially controls how "strong" or "visible" combing must be to be detected.
  6659. Larger values mean combing must be more visible and smaller values mean combing
  6660. can be less visible or strong and still be detected. Valid settings are from
  6661. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6662. be detected as combed). This is basically a pixel difference value. A good
  6663. range is @code{[8, 12]}.
  6664. Default value is @code{9}.
  6665. @item chroma
  6666. Sets whether or not chroma is considered in the combed frame decision. Only
  6667. disable this if your source has chroma problems (rainbowing, etc.) that are
  6668. causing problems for the combed frame detection with chroma enabled. Actually,
  6669. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6670. where there is chroma only combing in the source.
  6671. Default value is @code{0}.
  6672. @item blockx
  6673. @item blocky
  6674. Respectively set the x-axis and y-axis size of the window used during combed
  6675. frame detection. This has to do with the size of the area in which
  6676. @option{combpel} pixels are required to be detected as combed for a frame to be
  6677. declared combed. See the @option{combpel} parameter description for more info.
  6678. Possible values are any number that is a power of 2 starting at 4 and going up
  6679. to 512.
  6680. Default value is @code{16}.
  6681. @item combpel
  6682. The number of combed pixels inside any of the @option{blocky} by
  6683. @option{blockx} size blocks on the frame for the frame to be detected as
  6684. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6685. setting controls "how much" combing there must be in any localized area (a
  6686. window defined by the @option{blockx} and @option{blocky} settings) on the
  6687. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6688. which point no frames will ever be detected as combed). This setting is known
  6689. as @option{MI} in TFM/VFM vocabulary.
  6690. Default value is @code{80}.
  6691. @end table
  6692. @anchor{p/c/n/u/b meaning}
  6693. @subsection p/c/n/u/b meaning
  6694. @subsubsection p/c/n
  6695. We assume the following telecined stream:
  6696. @example
  6697. Top fields: 1 2 2 3 4
  6698. Bottom fields: 1 2 3 4 4
  6699. @end example
  6700. The numbers correspond to the progressive frame the fields relate to. Here, the
  6701. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6702. When @code{fieldmatch} is configured to run a matching from bottom
  6703. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6704. @example
  6705. Input stream:
  6706. T 1 2 2 3 4
  6707. B 1 2 3 4 4 <-- matching reference
  6708. Matches: c c n n c
  6709. Output stream:
  6710. T 1 2 3 4 4
  6711. B 1 2 3 4 4
  6712. @end example
  6713. As a result of the field matching, we can see that some frames get duplicated.
  6714. To perform a complete inverse telecine, you need to rely on a decimation filter
  6715. after this operation. See for instance the @ref{decimate} filter.
  6716. The same operation now matching from top fields (@option{field}=@var{top})
  6717. looks like this:
  6718. @example
  6719. Input stream:
  6720. T 1 2 2 3 4 <-- matching reference
  6721. B 1 2 3 4 4
  6722. Matches: c c p p c
  6723. Output stream:
  6724. T 1 2 2 3 4
  6725. B 1 2 2 3 4
  6726. @end example
  6727. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6728. basically, they refer to the frame and field of the opposite parity:
  6729. @itemize
  6730. @item @var{p} matches the field of the opposite parity in the previous frame
  6731. @item @var{c} matches the field of the opposite parity in the current frame
  6732. @item @var{n} matches the field of the opposite parity in the next frame
  6733. @end itemize
  6734. @subsubsection u/b
  6735. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6736. from the opposite parity flag. In the following examples, we assume that we are
  6737. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6738. 'x' is placed above and below each matched fields.
  6739. With bottom matching (@option{field}=@var{bottom}):
  6740. @example
  6741. Match: c p n b u
  6742. x x x x x
  6743. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6744. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6745. x x x x x
  6746. Output frames:
  6747. 2 1 2 2 2
  6748. 2 2 2 1 3
  6749. @end example
  6750. With top matching (@option{field}=@var{top}):
  6751. @example
  6752. Match: c p n b u
  6753. x x x x x
  6754. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6755. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6756. x x x x x
  6757. Output frames:
  6758. 2 2 2 1 2
  6759. 2 1 3 2 2
  6760. @end example
  6761. @subsection Examples
  6762. Simple IVTC of a top field first telecined stream:
  6763. @example
  6764. fieldmatch=order=tff:combmatch=none, decimate
  6765. @end example
  6766. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6767. @example
  6768. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6769. @end example
  6770. @section fieldorder
  6771. Transform the field order of the input video.
  6772. It accepts the following parameters:
  6773. @table @option
  6774. @item order
  6775. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6776. for bottom field first.
  6777. @end table
  6778. The default value is @samp{tff}.
  6779. The transformation is done by shifting the picture content up or down
  6780. by one line, and filling the remaining line with appropriate picture content.
  6781. This method is consistent with most broadcast field order converters.
  6782. If the input video is not flagged as being interlaced, or it is already
  6783. flagged as being of the required output field order, then this filter does
  6784. not alter the incoming video.
  6785. It is very useful when converting to or from PAL DV material,
  6786. which is bottom field first.
  6787. For example:
  6788. @example
  6789. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6790. @end example
  6791. @section fifo, afifo
  6792. Buffer input images and send them when they are requested.
  6793. It is mainly useful when auto-inserted by the libavfilter
  6794. framework.
  6795. It does not take parameters.
  6796. @section fillborders
  6797. Fill borders of the input video, without changing video stream dimensions.
  6798. Sometimes video can have garbage at the four edges and you may not want to
  6799. crop video input to keep size multiple of some number.
  6800. This filter accepts the following options:
  6801. @table @option
  6802. @item left
  6803. Number of pixels to fill from left border.
  6804. @item right
  6805. Number of pixels to fill from right border.
  6806. @item top
  6807. Number of pixels to fill from top border.
  6808. @item bottom
  6809. Number of pixels to fill from bottom border.
  6810. @item mode
  6811. Set fill mode.
  6812. It accepts the following values:
  6813. @table @samp
  6814. @item smear
  6815. fill pixels using outermost pixels
  6816. @item mirror
  6817. fill pixels using mirroring
  6818. @item fixed
  6819. fill pixels with constant value
  6820. @end table
  6821. Default is @var{smear}.
  6822. @item color
  6823. Set color for pixels in fixed mode. Default is @var{black}.
  6824. @end table
  6825. @section find_rect
  6826. Find a rectangular object
  6827. It accepts the following options:
  6828. @table @option
  6829. @item object
  6830. Filepath of the object image, needs to be in gray8.
  6831. @item threshold
  6832. Detection threshold, default is 0.5.
  6833. @item mipmaps
  6834. Number of mipmaps, default is 3.
  6835. @item xmin, ymin, xmax, ymax
  6836. Specifies the rectangle in which to search.
  6837. @end table
  6838. @subsection Examples
  6839. @itemize
  6840. @item
  6841. Generate a representative palette of a given video using @command{ffmpeg}:
  6842. @example
  6843. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6844. @end example
  6845. @end itemize
  6846. @section cover_rect
  6847. Cover a rectangular object
  6848. It accepts the following options:
  6849. @table @option
  6850. @item cover
  6851. Filepath of the optional cover image, needs to be in yuv420.
  6852. @item mode
  6853. Set covering mode.
  6854. It accepts the following values:
  6855. @table @samp
  6856. @item cover
  6857. cover it by the supplied image
  6858. @item blur
  6859. cover it by interpolating the surrounding pixels
  6860. @end table
  6861. Default value is @var{blur}.
  6862. @end table
  6863. @subsection Examples
  6864. @itemize
  6865. @item
  6866. Generate a representative palette of a given video using @command{ffmpeg}:
  6867. @example
  6868. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6869. @end example
  6870. @end itemize
  6871. @section floodfill
  6872. Flood area with values of same pixel components with another values.
  6873. It accepts the following options:
  6874. @table @option
  6875. @item x
  6876. Set pixel x coordinate.
  6877. @item y
  6878. Set pixel y coordinate.
  6879. @item s0
  6880. Set source #0 component value.
  6881. @item s1
  6882. Set source #1 component value.
  6883. @item s2
  6884. Set source #2 component value.
  6885. @item s3
  6886. Set source #3 component value.
  6887. @item d0
  6888. Set destination #0 component value.
  6889. @item d1
  6890. Set destination #1 component value.
  6891. @item d2
  6892. Set destination #2 component value.
  6893. @item d3
  6894. Set destination #3 component value.
  6895. @end table
  6896. @anchor{format}
  6897. @section format
  6898. Convert the input video to one of the specified pixel formats.
  6899. Libavfilter will try to pick one that is suitable as input to
  6900. the next filter.
  6901. It accepts the following parameters:
  6902. @table @option
  6903. @item pix_fmts
  6904. A '|'-separated list of pixel format names, such as
  6905. "pix_fmts=yuv420p|monow|rgb24".
  6906. @end table
  6907. @subsection Examples
  6908. @itemize
  6909. @item
  6910. Convert the input video to the @var{yuv420p} format
  6911. @example
  6912. format=pix_fmts=yuv420p
  6913. @end example
  6914. Convert the input video to any of the formats in the list
  6915. @example
  6916. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6917. @end example
  6918. @end itemize
  6919. @anchor{fps}
  6920. @section fps
  6921. Convert the video to specified constant frame rate by duplicating or dropping
  6922. frames as necessary.
  6923. It accepts the following parameters:
  6924. @table @option
  6925. @item fps
  6926. The desired output frame rate. The default is @code{25}.
  6927. @item start_time
  6928. Assume the first PTS should be the given value, in seconds. This allows for
  6929. padding/trimming at the start of stream. By default, no assumption is made
  6930. about the first frame's expected PTS, so no padding or trimming is done.
  6931. For example, this could be set to 0 to pad the beginning with duplicates of
  6932. the first frame if a video stream starts after the audio stream or to trim any
  6933. frames with a negative PTS.
  6934. @item round
  6935. Timestamp (PTS) rounding method.
  6936. Possible values are:
  6937. @table @option
  6938. @item zero
  6939. round towards 0
  6940. @item inf
  6941. round away from 0
  6942. @item down
  6943. round towards -infinity
  6944. @item up
  6945. round towards +infinity
  6946. @item near
  6947. round to nearest
  6948. @end table
  6949. The default is @code{near}.
  6950. @item eof_action
  6951. Action performed when reading the last frame.
  6952. Possible values are:
  6953. @table @option
  6954. @item round
  6955. Use same timestamp rounding method as used for other frames.
  6956. @item pass
  6957. Pass through last frame if input duration has not been reached yet.
  6958. @end table
  6959. The default is @code{round}.
  6960. @end table
  6961. Alternatively, the options can be specified as a flat string:
  6962. @var{fps}[:@var{start_time}[:@var{round}]].
  6963. See also the @ref{setpts} filter.
  6964. @subsection Examples
  6965. @itemize
  6966. @item
  6967. A typical usage in order to set the fps to 25:
  6968. @example
  6969. fps=fps=25
  6970. @end example
  6971. @item
  6972. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6973. @example
  6974. fps=fps=film:round=near
  6975. @end example
  6976. @end itemize
  6977. @section framepack
  6978. Pack two different video streams into a stereoscopic video, setting proper
  6979. metadata on supported codecs. The two views should have the same size and
  6980. framerate and processing will stop when the shorter video ends. Please note
  6981. that you may conveniently adjust view properties with the @ref{scale} and
  6982. @ref{fps} filters.
  6983. It accepts the following parameters:
  6984. @table @option
  6985. @item format
  6986. The desired packing format. Supported values are:
  6987. @table @option
  6988. @item sbs
  6989. The views are next to each other (default).
  6990. @item tab
  6991. The views are on top of each other.
  6992. @item lines
  6993. The views are packed by line.
  6994. @item columns
  6995. The views are packed by column.
  6996. @item frameseq
  6997. The views are temporally interleaved.
  6998. @end table
  6999. @end table
  7000. Some examples:
  7001. @example
  7002. # Convert left and right views into a frame-sequential video
  7003. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7004. # Convert views into a side-by-side video with the same output resolution as the input
  7005. 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
  7006. @end example
  7007. @section framerate
  7008. Change the frame rate by interpolating new video output frames from the source
  7009. frames.
  7010. This filter is not designed to function correctly with interlaced media. If
  7011. you wish to change the frame rate of interlaced media then you are required
  7012. to deinterlace before this filter and re-interlace after this filter.
  7013. A description of the accepted options follows.
  7014. @table @option
  7015. @item fps
  7016. Specify the output frames per second. This option can also be specified
  7017. as a value alone. The default is @code{50}.
  7018. @item interp_start
  7019. Specify the start of a range where the output frame will be created as a
  7020. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7021. the default is @code{15}.
  7022. @item interp_end
  7023. Specify the end of a range where the output frame will be created as a
  7024. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7025. the default is @code{240}.
  7026. @item scene
  7027. Specify the level at which a scene change is detected as a value between
  7028. 0 and 100 to indicate a new scene; a low value reflects a low
  7029. probability for the current frame to introduce a new scene, while a higher
  7030. value means the current frame is more likely to be one.
  7031. The default is @code{8.2}.
  7032. @item flags
  7033. Specify flags influencing the filter process.
  7034. Available value for @var{flags} is:
  7035. @table @option
  7036. @item scene_change_detect, scd
  7037. Enable scene change detection using the value of the option @var{scene}.
  7038. This flag is enabled by default.
  7039. @end table
  7040. @end table
  7041. @section framestep
  7042. Select one frame every N-th frame.
  7043. This filter accepts the following option:
  7044. @table @option
  7045. @item step
  7046. Select frame after every @code{step} frames.
  7047. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7048. @end table
  7049. @anchor{frei0r}
  7050. @section frei0r
  7051. Apply a frei0r effect to the input video.
  7052. To enable the compilation of this filter, you need to install the frei0r
  7053. header and configure FFmpeg with @code{--enable-frei0r}.
  7054. It accepts the following parameters:
  7055. @table @option
  7056. @item filter_name
  7057. The name of the frei0r effect to load. If the environment variable
  7058. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7059. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7060. Otherwise, the standard frei0r paths are searched, in this order:
  7061. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7062. @file{/usr/lib/frei0r-1/}.
  7063. @item filter_params
  7064. A '|'-separated list of parameters to pass to the frei0r effect.
  7065. @end table
  7066. A frei0r effect parameter can be a boolean (its value is either
  7067. "y" or "n"), a double, a color (specified as
  7068. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7069. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  7070. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  7071. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7072. The number and types of parameters depend on the loaded effect. If an
  7073. effect parameter is not specified, the default value is set.
  7074. @subsection Examples
  7075. @itemize
  7076. @item
  7077. Apply the distort0r effect, setting the first two double parameters:
  7078. @example
  7079. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7080. @end example
  7081. @item
  7082. Apply the colordistance effect, taking a color as the first parameter:
  7083. @example
  7084. frei0r=colordistance:0.2/0.3/0.4
  7085. frei0r=colordistance:violet
  7086. frei0r=colordistance:0x112233
  7087. @end example
  7088. @item
  7089. Apply the perspective effect, specifying the top left and top right image
  7090. positions:
  7091. @example
  7092. frei0r=perspective:0.2/0.2|0.8/0.2
  7093. @end example
  7094. @end itemize
  7095. For more information, see
  7096. @url{http://frei0r.dyne.org}
  7097. @section fspp
  7098. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7099. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7100. processing filter, one of them is performed once per block, not per pixel.
  7101. This allows for much higher speed.
  7102. The filter accepts the following options:
  7103. @table @option
  7104. @item quality
  7105. Set quality. This option defines the number of levels for averaging. It accepts
  7106. an integer in the range 4-5. Default value is @code{4}.
  7107. @item qp
  7108. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7109. If not set, the filter will use the QP from the video stream (if available).
  7110. @item strength
  7111. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7112. more details but also more artifacts, while higher values make the image smoother
  7113. but also blurrier. Default value is @code{0} − PSNR optimal.
  7114. @item use_bframe_qp
  7115. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7116. option may cause flicker since the B-Frames have often larger QP. Default is
  7117. @code{0} (not enabled).
  7118. @end table
  7119. @section gblur
  7120. Apply Gaussian blur filter.
  7121. The filter accepts the following options:
  7122. @table @option
  7123. @item sigma
  7124. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7125. @item steps
  7126. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7127. @item planes
  7128. Set which planes to filter. By default all planes are filtered.
  7129. @item sigmaV
  7130. Set vertical sigma, if negative it will be same as @code{sigma}.
  7131. Default is @code{-1}.
  7132. @end table
  7133. @section geq
  7134. The filter accepts the following options:
  7135. @table @option
  7136. @item lum_expr, lum
  7137. Set the luminance expression.
  7138. @item cb_expr, cb
  7139. Set the chrominance blue expression.
  7140. @item cr_expr, cr
  7141. Set the chrominance red expression.
  7142. @item alpha_expr, a
  7143. Set the alpha expression.
  7144. @item red_expr, r
  7145. Set the red expression.
  7146. @item green_expr, g
  7147. Set the green expression.
  7148. @item blue_expr, b
  7149. Set the blue expression.
  7150. @end table
  7151. The colorspace is selected according to the specified options. If one
  7152. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7153. options is specified, the filter will automatically select a YCbCr
  7154. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7155. @option{blue_expr} options is specified, it will select an RGB
  7156. colorspace.
  7157. If one of the chrominance expression is not defined, it falls back on the other
  7158. one. If no alpha expression is specified it will evaluate to opaque value.
  7159. If none of chrominance expressions are specified, they will evaluate
  7160. to the luminance expression.
  7161. The expressions can use the following variables and functions:
  7162. @table @option
  7163. @item N
  7164. The sequential number of the filtered frame, starting from @code{0}.
  7165. @item X
  7166. @item Y
  7167. The coordinates of the current sample.
  7168. @item W
  7169. @item H
  7170. The width and height of the image.
  7171. @item SW
  7172. @item SH
  7173. Width and height scale depending on the currently filtered plane. It is the
  7174. ratio between the corresponding luma plane number of pixels and the current
  7175. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7176. @code{0.5,0.5} for chroma planes.
  7177. @item T
  7178. Time of the current frame, expressed in seconds.
  7179. @item p(x, y)
  7180. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7181. plane.
  7182. @item lum(x, y)
  7183. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7184. plane.
  7185. @item cb(x, y)
  7186. Return the value of the pixel at location (@var{x},@var{y}) of the
  7187. blue-difference chroma plane. Return 0 if there is no such plane.
  7188. @item cr(x, y)
  7189. Return the value of the pixel at location (@var{x},@var{y}) of the
  7190. red-difference chroma plane. Return 0 if there is no such plane.
  7191. @item r(x, y)
  7192. @item g(x, y)
  7193. @item b(x, y)
  7194. Return the value of the pixel at location (@var{x},@var{y}) of the
  7195. red/green/blue component. Return 0 if there is no such component.
  7196. @item alpha(x, y)
  7197. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7198. plane. Return 0 if there is no such plane.
  7199. @end table
  7200. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7201. automatically clipped to the closer edge.
  7202. @subsection Examples
  7203. @itemize
  7204. @item
  7205. Flip the image horizontally:
  7206. @example
  7207. geq=p(W-X\,Y)
  7208. @end example
  7209. @item
  7210. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7211. wavelength of 100 pixels:
  7212. @example
  7213. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7214. @end example
  7215. @item
  7216. Generate a fancy enigmatic moving light:
  7217. @example
  7218. 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
  7219. @end example
  7220. @item
  7221. Generate a quick emboss effect:
  7222. @example
  7223. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7224. @end example
  7225. @item
  7226. Modify RGB components depending on pixel position:
  7227. @example
  7228. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7229. @end example
  7230. @item
  7231. Create a radial gradient that is the same size as the input (also see
  7232. the @ref{vignette} filter):
  7233. @example
  7234. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7235. @end example
  7236. @end itemize
  7237. @section gradfun
  7238. Fix the banding artifacts that are sometimes introduced into nearly flat
  7239. regions by truncation to 8-bit color depth.
  7240. Interpolate the gradients that should go where the bands are, and
  7241. dither them.
  7242. It is designed for playback only. Do not use it prior to
  7243. lossy compression, because compression tends to lose the dither and
  7244. bring back the bands.
  7245. It accepts the following parameters:
  7246. @table @option
  7247. @item strength
  7248. The maximum amount by which the filter will change any one pixel. This is also
  7249. the threshold for detecting nearly flat regions. Acceptable values range from
  7250. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7251. valid range.
  7252. @item radius
  7253. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7254. gradients, but also prevents the filter from modifying the pixels near detailed
  7255. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7256. values will be clipped to the valid range.
  7257. @end table
  7258. Alternatively, the options can be specified as a flat string:
  7259. @var{strength}[:@var{radius}]
  7260. @subsection Examples
  7261. @itemize
  7262. @item
  7263. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7264. @example
  7265. gradfun=3.5:8
  7266. @end example
  7267. @item
  7268. Specify radius, omitting the strength (which will fall-back to the default
  7269. value):
  7270. @example
  7271. gradfun=radius=8
  7272. @end example
  7273. @end itemize
  7274. @anchor{haldclut}
  7275. @section haldclut
  7276. Apply a Hald CLUT to a video stream.
  7277. First input is the video stream to process, and second one is the Hald CLUT.
  7278. The Hald CLUT input can be a simple picture or a complete video stream.
  7279. The filter accepts the following options:
  7280. @table @option
  7281. @item shortest
  7282. Force termination when the shortest input terminates. Default is @code{0}.
  7283. @item repeatlast
  7284. Continue applying the last CLUT after the end of the stream. A value of
  7285. @code{0} disable the filter after the last frame of the CLUT is reached.
  7286. Default is @code{1}.
  7287. @end table
  7288. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7289. filters share the same internals).
  7290. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7291. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7292. @subsection Workflow examples
  7293. @subsubsection Hald CLUT video stream
  7294. Generate an identity Hald CLUT stream altered with various effects:
  7295. @example
  7296. 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
  7297. @end example
  7298. Note: make sure you use a lossless codec.
  7299. Then use it with @code{haldclut} to apply it on some random stream:
  7300. @example
  7301. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7302. @end example
  7303. The Hald CLUT will be applied to the 10 first seconds (duration of
  7304. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7305. to the remaining frames of the @code{mandelbrot} stream.
  7306. @subsubsection Hald CLUT with preview
  7307. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7308. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7309. biggest possible square starting at the top left of the picture. The remaining
  7310. padding pixels (bottom or right) will be ignored. This area can be used to add
  7311. a preview of the Hald CLUT.
  7312. Typically, the following generated Hald CLUT will be supported by the
  7313. @code{haldclut} filter:
  7314. @example
  7315. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7316. pad=iw+320 [padded_clut];
  7317. smptebars=s=320x256, split [a][b];
  7318. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7319. [main][b] overlay=W-320" -frames:v 1 clut.png
  7320. @end example
  7321. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7322. bars are displayed on the right-top, and below the same color bars processed by
  7323. the color changes.
  7324. Then, the effect of this Hald CLUT can be visualized with:
  7325. @example
  7326. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7327. @end example
  7328. @section hflip
  7329. Flip the input video horizontally.
  7330. For example, to horizontally flip the input video with @command{ffmpeg}:
  7331. @example
  7332. ffmpeg -i in.avi -vf "hflip" out.avi
  7333. @end example
  7334. @section histeq
  7335. This filter applies a global color histogram equalization on a
  7336. per-frame basis.
  7337. It can be used to correct video that has a compressed range of pixel
  7338. intensities. The filter redistributes the pixel intensities to
  7339. equalize their distribution across the intensity range. It may be
  7340. viewed as an "automatically adjusting contrast filter". This filter is
  7341. useful only for correcting degraded or poorly captured source
  7342. video.
  7343. The filter accepts the following options:
  7344. @table @option
  7345. @item strength
  7346. Determine the amount of equalization to be applied. As the strength
  7347. is reduced, the distribution of pixel intensities more-and-more
  7348. approaches that of the input frame. The value must be a float number
  7349. in the range [0,1] and defaults to 0.200.
  7350. @item intensity
  7351. Set the maximum intensity that can generated and scale the output
  7352. values appropriately. The strength should be set as desired and then
  7353. the intensity can be limited if needed to avoid washing-out. The value
  7354. must be a float number in the range [0,1] and defaults to 0.210.
  7355. @item antibanding
  7356. Set the antibanding level. If enabled the filter will randomly vary
  7357. the luminance of output pixels by a small amount to avoid banding of
  7358. the histogram. Possible values are @code{none}, @code{weak} or
  7359. @code{strong}. It defaults to @code{none}.
  7360. @end table
  7361. @section histogram
  7362. Compute and draw a color distribution histogram for the input video.
  7363. The computed histogram is a representation of the color component
  7364. distribution in an image.
  7365. Standard histogram displays the color components distribution in an image.
  7366. Displays color graph for each color component. Shows distribution of
  7367. the Y, U, V, A or R, G, B components, depending on input format, in the
  7368. current frame. Below each graph a color component scale meter is shown.
  7369. The filter accepts the following options:
  7370. @table @option
  7371. @item level_height
  7372. Set height of level. Default value is @code{200}.
  7373. Allowed range is [50, 2048].
  7374. @item scale_height
  7375. Set height of color scale. Default value is @code{12}.
  7376. Allowed range is [0, 40].
  7377. @item display_mode
  7378. Set display mode.
  7379. It accepts the following values:
  7380. @table @samp
  7381. @item stack
  7382. Per color component graphs are placed below each other.
  7383. @item parade
  7384. Per color component graphs are placed side by side.
  7385. @item overlay
  7386. Presents information identical to that in the @code{parade}, except
  7387. that the graphs representing color components are superimposed directly
  7388. over one another.
  7389. @end table
  7390. Default is @code{stack}.
  7391. @item levels_mode
  7392. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7393. Default is @code{linear}.
  7394. @item components
  7395. Set what color components to display.
  7396. Default is @code{7}.
  7397. @item fgopacity
  7398. Set foreground opacity. Default is @code{0.7}.
  7399. @item bgopacity
  7400. Set background opacity. Default is @code{0.5}.
  7401. @end table
  7402. @subsection Examples
  7403. @itemize
  7404. @item
  7405. Calculate and draw histogram:
  7406. @example
  7407. ffplay -i input -vf histogram
  7408. @end example
  7409. @end itemize
  7410. @anchor{hqdn3d}
  7411. @section hqdn3d
  7412. This is a high precision/quality 3d denoise filter. It aims to reduce
  7413. image noise, producing smooth images and making still images really
  7414. still. It should enhance compressibility.
  7415. It accepts the following optional parameters:
  7416. @table @option
  7417. @item luma_spatial
  7418. A non-negative floating point number which specifies spatial luma strength.
  7419. It defaults to 4.0.
  7420. @item chroma_spatial
  7421. A non-negative floating point number which specifies spatial chroma strength.
  7422. It defaults to 3.0*@var{luma_spatial}/4.0.
  7423. @item luma_tmp
  7424. A floating point number which specifies luma temporal strength. It defaults to
  7425. 6.0*@var{luma_spatial}/4.0.
  7426. @item chroma_tmp
  7427. A floating point number which specifies chroma temporal strength. It defaults to
  7428. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7429. @end table
  7430. @section hwdownload
  7431. Download hardware frames to system memory.
  7432. The input must be in hardware frames, and the output a non-hardware format.
  7433. Not all formats will be supported on the output - it may be necessary to insert
  7434. an additional @option{format} filter immediately following in the graph to get
  7435. the output in a supported format.
  7436. @section hwmap
  7437. Map hardware frames to system memory or to another device.
  7438. This filter has several different modes of operation; which one is used depends
  7439. on the input and output formats:
  7440. @itemize
  7441. @item
  7442. Hardware frame input, normal frame output
  7443. Map the input frames to system memory and pass them to the output. If the
  7444. original hardware frame is later required (for example, after overlaying
  7445. something else on part of it), the @option{hwmap} filter can be used again
  7446. in the next mode to retrieve it.
  7447. @item
  7448. Normal frame input, hardware frame output
  7449. If the input is actually a software-mapped hardware frame, then unmap it -
  7450. that is, return the original hardware frame.
  7451. Otherwise, a device must be provided. Create new hardware surfaces on that
  7452. device for the output, then map them back to the software format at the input
  7453. and give those frames to the preceding filter. This will then act like the
  7454. @option{hwupload} filter, but may be able to avoid an additional copy when
  7455. the input is already in a compatible format.
  7456. @item
  7457. Hardware frame input and output
  7458. A device must be supplied for the output, either directly or with the
  7459. @option{derive_device} option. The input and output devices must be of
  7460. different types and compatible - the exact meaning of this is
  7461. system-dependent, but typically it means that they must refer to the same
  7462. underlying hardware context (for example, refer to the same graphics card).
  7463. If the input frames were originally created on the output device, then unmap
  7464. to retrieve the original frames.
  7465. Otherwise, map the frames to the output device - create new hardware frames
  7466. on the output corresponding to the frames on the input.
  7467. @end itemize
  7468. The following additional parameters are accepted:
  7469. @table @option
  7470. @item mode
  7471. Set the frame mapping mode. Some combination of:
  7472. @table @var
  7473. @item read
  7474. The mapped frame should be readable.
  7475. @item write
  7476. The mapped frame should be writeable.
  7477. @item overwrite
  7478. The mapping will always overwrite the entire frame.
  7479. This may improve performance in some cases, as the original contents of the
  7480. frame need not be loaded.
  7481. @item direct
  7482. The mapping must not involve any copying.
  7483. Indirect mappings to copies of frames are created in some cases where either
  7484. direct mapping is not possible or it would have unexpected properties.
  7485. Setting this flag ensures that the mapping is direct and will fail if that is
  7486. not possible.
  7487. @end table
  7488. Defaults to @var{read+write} if not specified.
  7489. @item derive_device @var{type}
  7490. Rather than using the device supplied at initialisation, instead derive a new
  7491. device of type @var{type} from the device the input frames exist on.
  7492. @item reverse
  7493. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7494. and map them back to the source. This may be necessary in some cases where
  7495. a mapping in one direction is required but only the opposite direction is
  7496. supported by the devices being used.
  7497. This option is dangerous - it may break the preceding filter in undefined
  7498. ways if there are any additional constraints on that filter's output.
  7499. Do not use it without fully understanding the implications of its use.
  7500. @end table
  7501. @section hwupload
  7502. Upload system memory frames to hardware surfaces.
  7503. The device to upload to must be supplied when the filter is initialised. If
  7504. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7505. option.
  7506. @anchor{hwupload_cuda}
  7507. @section hwupload_cuda
  7508. Upload system memory frames to a CUDA device.
  7509. It accepts the following optional parameters:
  7510. @table @option
  7511. @item device
  7512. The number of the CUDA device to use
  7513. @end table
  7514. @section hqx
  7515. Apply a high-quality magnification filter designed for pixel art. This filter
  7516. was originally created by Maxim Stepin.
  7517. It accepts the following option:
  7518. @table @option
  7519. @item n
  7520. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7521. @code{hq3x} and @code{4} for @code{hq4x}.
  7522. Default is @code{3}.
  7523. @end table
  7524. @section hstack
  7525. Stack input videos horizontally.
  7526. All streams must be of same pixel format and of same height.
  7527. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7528. to create same output.
  7529. The filter accept the following option:
  7530. @table @option
  7531. @item inputs
  7532. Set number of input streams. Default is 2.
  7533. @item shortest
  7534. If set to 1, force the output to terminate when the shortest input
  7535. terminates. Default value is 0.
  7536. @end table
  7537. @section hue
  7538. Modify the hue and/or the saturation of the input.
  7539. It accepts the following parameters:
  7540. @table @option
  7541. @item h
  7542. Specify the hue angle as a number of degrees. It accepts an expression,
  7543. and defaults to "0".
  7544. @item s
  7545. Specify the saturation in the [-10,10] range. It accepts an expression and
  7546. defaults to "1".
  7547. @item H
  7548. Specify the hue angle as a number of radians. It accepts an
  7549. expression, and defaults to "0".
  7550. @item b
  7551. Specify the brightness in the [-10,10] range. It accepts an expression and
  7552. defaults to "0".
  7553. @end table
  7554. @option{h} and @option{H} are mutually exclusive, and can't be
  7555. specified at the same time.
  7556. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7557. expressions containing the following constants:
  7558. @table @option
  7559. @item n
  7560. frame count of the input frame starting from 0
  7561. @item pts
  7562. presentation timestamp of the input frame expressed in time base units
  7563. @item r
  7564. frame rate of the input video, NAN if the input frame rate is unknown
  7565. @item t
  7566. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7567. @item tb
  7568. time base of the input video
  7569. @end table
  7570. @subsection Examples
  7571. @itemize
  7572. @item
  7573. Set the hue to 90 degrees and the saturation to 1.0:
  7574. @example
  7575. hue=h=90:s=1
  7576. @end example
  7577. @item
  7578. Same command but expressing the hue in radians:
  7579. @example
  7580. hue=H=PI/2:s=1
  7581. @end example
  7582. @item
  7583. Rotate hue and make the saturation swing between 0
  7584. and 2 over a period of 1 second:
  7585. @example
  7586. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7587. @end example
  7588. @item
  7589. Apply a 3 seconds saturation fade-in effect starting at 0:
  7590. @example
  7591. hue="s=min(t/3\,1)"
  7592. @end example
  7593. The general fade-in expression can be written as:
  7594. @example
  7595. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7596. @end example
  7597. @item
  7598. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7599. @example
  7600. hue="s=max(0\, min(1\, (8-t)/3))"
  7601. @end example
  7602. The general fade-out expression can be written as:
  7603. @example
  7604. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7605. @end example
  7606. @end itemize
  7607. @subsection Commands
  7608. This filter supports the following commands:
  7609. @table @option
  7610. @item b
  7611. @item s
  7612. @item h
  7613. @item H
  7614. Modify the hue and/or the saturation and/or brightness of the input video.
  7615. The command accepts the same syntax of the corresponding option.
  7616. If the specified expression is not valid, it is kept at its current
  7617. value.
  7618. @end table
  7619. @section hysteresis
  7620. Grow first stream into second stream by connecting components.
  7621. This makes it possible to build more robust edge masks.
  7622. This filter accepts the following options:
  7623. @table @option
  7624. @item planes
  7625. Set which planes will be processed as bitmap, unprocessed planes will be
  7626. copied from first stream.
  7627. By default value 0xf, all planes will be processed.
  7628. @item threshold
  7629. Set threshold which is used in filtering. If pixel component value is higher than
  7630. this value filter algorithm for connecting components is activated.
  7631. By default value is 0.
  7632. @end table
  7633. @section idet
  7634. Detect video interlacing type.
  7635. This filter tries to detect if the input frames are interlaced, progressive,
  7636. top or bottom field first. It will also try to detect fields that are
  7637. repeated between adjacent frames (a sign of telecine).
  7638. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7639. Multiple frame detection incorporates the classification history of previous frames.
  7640. The filter will log these metadata values:
  7641. @table @option
  7642. @item single.current_frame
  7643. Detected type of current frame using single-frame detection. One of:
  7644. ``tff'' (top field first), ``bff'' (bottom field first),
  7645. ``progressive'', or ``undetermined''
  7646. @item single.tff
  7647. Cumulative number of frames detected as top field first using single-frame detection.
  7648. @item multiple.tff
  7649. Cumulative number of frames detected as top field first using multiple-frame detection.
  7650. @item single.bff
  7651. Cumulative number of frames detected as bottom field first using single-frame detection.
  7652. @item multiple.current_frame
  7653. Detected type of current frame using multiple-frame detection. One of:
  7654. ``tff'' (top field first), ``bff'' (bottom field first),
  7655. ``progressive'', or ``undetermined''
  7656. @item multiple.bff
  7657. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7658. @item single.progressive
  7659. Cumulative number of frames detected as progressive using single-frame detection.
  7660. @item multiple.progressive
  7661. Cumulative number of frames detected as progressive using multiple-frame detection.
  7662. @item single.undetermined
  7663. Cumulative number of frames that could not be classified using single-frame detection.
  7664. @item multiple.undetermined
  7665. Cumulative number of frames that could not be classified using multiple-frame detection.
  7666. @item repeated.current_frame
  7667. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7668. @item repeated.neither
  7669. Cumulative number of frames with no repeated field.
  7670. @item repeated.top
  7671. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7672. @item repeated.bottom
  7673. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7674. @end table
  7675. The filter accepts the following options:
  7676. @table @option
  7677. @item intl_thres
  7678. Set interlacing threshold.
  7679. @item prog_thres
  7680. Set progressive threshold.
  7681. @item rep_thres
  7682. Threshold for repeated field detection.
  7683. @item half_life
  7684. Number of frames after which a given frame's contribution to the
  7685. statistics is halved (i.e., it contributes only 0.5 to its
  7686. classification). The default of 0 means that all frames seen are given
  7687. full weight of 1.0 forever.
  7688. @item analyze_interlaced_flag
  7689. When this is not 0 then idet will use the specified number of frames to determine
  7690. if the interlaced flag is accurate, it will not count undetermined frames.
  7691. If the flag is found to be accurate it will be used without any further
  7692. computations, if it is found to be inaccurate it will be cleared without any
  7693. further computations. This allows inserting the idet filter as a low computational
  7694. method to clean up the interlaced flag
  7695. @end table
  7696. @section il
  7697. Deinterleave or interleave fields.
  7698. This filter allows one to process interlaced images fields without
  7699. deinterlacing them. Deinterleaving splits the input frame into 2
  7700. fields (so called half pictures). Odd lines are moved to the top
  7701. half of the output image, even lines to the bottom half.
  7702. You can process (filter) them independently and then re-interleave them.
  7703. The filter accepts the following options:
  7704. @table @option
  7705. @item luma_mode, l
  7706. @item chroma_mode, c
  7707. @item alpha_mode, a
  7708. Available values for @var{luma_mode}, @var{chroma_mode} and
  7709. @var{alpha_mode} are:
  7710. @table @samp
  7711. @item none
  7712. Do nothing.
  7713. @item deinterleave, d
  7714. Deinterleave fields, placing one above the other.
  7715. @item interleave, i
  7716. Interleave fields. Reverse the effect of deinterleaving.
  7717. @end table
  7718. Default value is @code{none}.
  7719. @item luma_swap, ls
  7720. @item chroma_swap, cs
  7721. @item alpha_swap, as
  7722. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7723. @end table
  7724. @section inflate
  7725. Apply inflate effect to the video.
  7726. This filter replaces the pixel by the local(3x3) average by taking into account
  7727. only values higher than the pixel.
  7728. It accepts the following options:
  7729. @table @option
  7730. @item threshold0
  7731. @item threshold1
  7732. @item threshold2
  7733. @item threshold3
  7734. Limit the maximum change for each plane, default is 65535.
  7735. If 0, plane will remain unchanged.
  7736. @end table
  7737. @section interlace
  7738. Simple interlacing filter from progressive contents. This interleaves upper (or
  7739. lower) lines from odd frames with lower (or upper) lines from even frames,
  7740. halving the frame rate and preserving image height.
  7741. @example
  7742. Original Original New Frame
  7743. Frame 'j' Frame 'j+1' (tff)
  7744. ========== =========== ==================
  7745. Line 0 --------------------> Frame 'j' Line 0
  7746. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7747. Line 2 ---------------------> Frame 'j' Line 2
  7748. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7749. ... ... ...
  7750. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7751. @end example
  7752. It accepts the following optional parameters:
  7753. @table @option
  7754. @item scan
  7755. This determines whether the interlaced frame is taken from the even
  7756. (tff - default) or odd (bff) lines of the progressive frame.
  7757. @item lowpass
  7758. Vertical lowpass filter to avoid twitter interlacing and
  7759. reduce moire patterns.
  7760. @table @samp
  7761. @item 0, off
  7762. Disable vertical lowpass filter
  7763. @item 1, linear
  7764. Enable linear filter (default)
  7765. @item 2, complex
  7766. Enable complex filter. This will slightly less reduce twitter and moire
  7767. but better retain detail and subjective sharpness impression.
  7768. @end table
  7769. @end table
  7770. @section kerndeint
  7771. Deinterlace input video by applying Donald Graft's adaptive kernel
  7772. deinterling. Work on interlaced parts of a video to produce
  7773. progressive frames.
  7774. The description of the accepted parameters follows.
  7775. @table @option
  7776. @item thresh
  7777. Set the threshold which affects the filter's tolerance when
  7778. determining if a pixel line must be processed. It must be an integer
  7779. in the range [0,255] and defaults to 10. A value of 0 will result in
  7780. applying the process on every pixels.
  7781. @item map
  7782. Paint pixels exceeding the threshold value to white if set to 1.
  7783. Default is 0.
  7784. @item order
  7785. Set the fields order. Swap fields if set to 1, leave fields alone if
  7786. 0. Default is 0.
  7787. @item sharp
  7788. Enable additional sharpening if set to 1. Default is 0.
  7789. @item twoway
  7790. Enable twoway sharpening if set to 1. Default is 0.
  7791. @end table
  7792. @subsection Examples
  7793. @itemize
  7794. @item
  7795. Apply default values:
  7796. @example
  7797. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7798. @end example
  7799. @item
  7800. Enable additional sharpening:
  7801. @example
  7802. kerndeint=sharp=1
  7803. @end example
  7804. @item
  7805. Paint processed pixels in white:
  7806. @example
  7807. kerndeint=map=1
  7808. @end example
  7809. @end itemize
  7810. @section lenscorrection
  7811. Correct radial lens distortion
  7812. This filter can be used to correct for radial distortion as can result from the use
  7813. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7814. one can use tools available for example as part of opencv or simply trial-and-error.
  7815. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7816. and extract the k1 and k2 coefficients from the resulting matrix.
  7817. Note that effectively the same filter is available in the open-source tools Krita and
  7818. Digikam from the KDE project.
  7819. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7820. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7821. brightness distribution, so you may want to use both filters together in certain
  7822. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7823. be applied before or after lens correction.
  7824. @subsection Options
  7825. The filter accepts the following options:
  7826. @table @option
  7827. @item cx
  7828. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7829. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7830. width.
  7831. @item cy
  7832. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7833. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7834. height.
  7835. @item k1
  7836. Coefficient of the quadratic correction term. 0.5 means no correction.
  7837. @item k2
  7838. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7839. @end table
  7840. The formula that generates the correction is:
  7841. @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)
  7842. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7843. distances from the focal point in the source and target images, respectively.
  7844. @section libvmaf
  7845. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7846. score between two input videos.
  7847. The obtained VMAF score is printed through the logging system.
  7848. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7849. After installing the library it can be enabled using:
  7850. @code{./configure --enable-libvmaf}.
  7851. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7852. The filter has following options:
  7853. @table @option
  7854. @item model_path
  7855. Set the model path which is to be used for SVM.
  7856. Default value: @code{"vmaf_v0.6.1.pkl"}
  7857. @item log_path
  7858. Set the file path to be used to store logs.
  7859. @item log_fmt
  7860. Set the format of the log file (xml or json).
  7861. @item enable_transform
  7862. Enables transform for computing vmaf.
  7863. @item phone_model
  7864. Invokes the phone model which will generate VMAF scores higher than in the
  7865. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7866. @item psnr
  7867. Enables computing psnr along with vmaf.
  7868. @item ssim
  7869. Enables computing ssim along with vmaf.
  7870. @item ms_ssim
  7871. Enables computing ms_ssim along with vmaf.
  7872. @item pool
  7873. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7874. @end table
  7875. This filter also supports the @ref{framesync} options.
  7876. On the below examples the input file @file{main.mpg} being processed is
  7877. compared with the reference file @file{ref.mpg}.
  7878. @example
  7879. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7880. @end example
  7881. Example with options:
  7882. @example
  7883. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7884. @end example
  7885. @section limiter
  7886. Limits the pixel components values to the specified range [min, max].
  7887. The filter accepts the following options:
  7888. @table @option
  7889. @item min
  7890. Lower bound. Defaults to the lowest allowed value for the input.
  7891. @item max
  7892. Upper bound. Defaults to the highest allowed value for the input.
  7893. @item planes
  7894. Specify which planes will be processed. Defaults to all available.
  7895. @end table
  7896. @section loop
  7897. Loop video frames.
  7898. The filter accepts the following options:
  7899. @table @option
  7900. @item loop
  7901. Set the number of loops. Setting this value to -1 will result in infinite loops.
  7902. Default is 0.
  7903. @item size
  7904. Set maximal size in number of frames. Default is 0.
  7905. @item start
  7906. Set first frame of loop. Default is 0.
  7907. @end table
  7908. @anchor{lut3d}
  7909. @section lut3d
  7910. Apply a 3D LUT to an input video.
  7911. The filter accepts the following options:
  7912. @table @option
  7913. @item file
  7914. Set the 3D LUT file name.
  7915. Currently supported formats:
  7916. @table @samp
  7917. @item 3dl
  7918. AfterEffects
  7919. @item cube
  7920. Iridas
  7921. @item dat
  7922. DaVinci
  7923. @item m3d
  7924. Pandora
  7925. @end table
  7926. @item interp
  7927. Select interpolation mode.
  7928. Available values are:
  7929. @table @samp
  7930. @item nearest
  7931. Use values from the nearest defined point.
  7932. @item trilinear
  7933. Interpolate values using the 8 points defining a cube.
  7934. @item tetrahedral
  7935. Interpolate values using a tetrahedron.
  7936. @end table
  7937. @end table
  7938. This filter also supports the @ref{framesync} options.
  7939. @section lumakey
  7940. Turn certain luma values into transparency.
  7941. The filter accepts the following options:
  7942. @table @option
  7943. @item threshold
  7944. Set the luma which will be used as base for transparency.
  7945. Default value is @code{0}.
  7946. @item tolerance
  7947. Set the range of luma values to be keyed out.
  7948. Default value is @code{0}.
  7949. @item softness
  7950. Set the range of softness. Default value is @code{0}.
  7951. Use this to control gradual transition from zero to full transparency.
  7952. @end table
  7953. @section lut, lutrgb, lutyuv
  7954. Compute a look-up table for binding each pixel component input value
  7955. to an output value, and apply it to the input video.
  7956. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7957. to an RGB input video.
  7958. These filters accept the following parameters:
  7959. @table @option
  7960. @item c0
  7961. set first pixel component expression
  7962. @item c1
  7963. set second pixel component expression
  7964. @item c2
  7965. set third pixel component expression
  7966. @item c3
  7967. set fourth pixel component expression, corresponds to the alpha component
  7968. @item r
  7969. set red component expression
  7970. @item g
  7971. set green component expression
  7972. @item b
  7973. set blue component expression
  7974. @item a
  7975. alpha component expression
  7976. @item y
  7977. set Y/luminance component expression
  7978. @item u
  7979. set U/Cb component expression
  7980. @item v
  7981. set V/Cr component expression
  7982. @end table
  7983. Each of them specifies the expression to use for computing the lookup table for
  7984. the corresponding pixel component values.
  7985. The exact component associated to each of the @var{c*} options depends on the
  7986. format in input.
  7987. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7988. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7989. The expressions can contain the following constants and functions:
  7990. @table @option
  7991. @item w
  7992. @item h
  7993. The input width and height.
  7994. @item val
  7995. The input value for the pixel component.
  7996. @item clipval
  7997. The input value, clipped to the @var{minval}-@var{maxval} range.
  7998. @item maxval
  7999. The maximum value for the pixel component.
  8000. @item minval
  8001. The minimum value for the pixel component.
  8002. @item negval
  8003. The negated value for the pixel component value, clipped to the
  8004. @var{minval}-@var{maxval} range; it corresponds to the expression
  8005. "maxval-clipval+minval".
  8006. @item clip(val)
  8007. The computed value in @var{val}, clipped to the
  8008. @var{minval}-@var{maxval} range.
  8009. @item gammaval(gamma)
  8010. The computed gamma correction value of the pixel component value,
  8011. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8012. expression
  8013. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8014. @end table
  8015. All expressions default to "val".
  8016. @subsection Examples
  8017. @itemize
  8018. @item
  8019. Negate input video:
  8020. @example
  8021. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8022. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8023. @end example
  8024. The above is the same as:
  8025. @example
  8026. lutrgb="r=negval:g=negval:b=negval"
  8027. lutyuv="y=negval:u=negval:v=negval"
  8028. @end example
  8029. @item
  8030. Negate luminance:
  8031. @example
  8032. lutyuv=y=negval
  8033. @end example
  8034. @item
  8035. Remove chroma components, turning the video into a graytone image:
  8036. @example
  8037. lutyuv="u=128:v=128"
  8038. @end example
  8039. @item
  8040. Apply a luma burning effect:
  8041. @example
  8042. lutyuv="y=2*val"
  8043. @end example
  8044. @item
  8045. Remove green and blue components:
  8046. @example
  8047. lutrgb="g=0:b=0"
  8048. @end example
  8049. @item
  8050. Set a constant alpha channel value on input:
  8051. @example
  8052. format=rgba,lutrgb=a="maxval-minval/2"
  8053. @end example
  8054. @item
  8055. Correct luminance gamma by a factor of 0.5:
  8056. @example
  8057. lutyuv=y=gammaval(0.5)
  8058. @end example
  8059. @item
  8060. Discard least significant bits of luma:
  8061. @example
  8062. lutyuv=y='bitand(val, 128+64+32)'
  8063. @end example
  8064. @item
  8065. Technicolor like effect:
  8066. @example
  8067. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8068. @end example
  8069. @end itemize
  8070. @section lut2, tlut2
  8071. The @code{lut2} filter takes two input streams and outputs one
  8072. stream.
  8073. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8074. from one single stream.
  8075. This filter accepts the following parameters:
  8076. @table @option
  8077. @item c0
  8078. set first pixel component expression
  8079. @item c1
  8080. set second pixel component expression
  8081. @item c2
  8082. set third pixel component expression
  8083. @item c3
  8084. set fourth pixel component expression, corresponds to the alpha component
  8085. @end table
  8086. Each of them specifies the expression to use for computing the lookup table for
  8087. the corresponding pixel component values.
  8088. The exact component associated to each of the @var{c*} options depends on the
  8089. format in inputs.
  8090. The expressions can contain the following constants:
  8091. @table @option
  8092. @item w
  8093. @item h
  8094. The input width and height.
  8095. @item x
  8096. The first input value for the pixel component.
  8097. @item y
  8098. The second input value for the pixel component.
  8099. @item bdx
  8100. The first input video bit depth.
  8101. @item bdy
  8102. The second input video bit depth.
  8103. @end table
  8104. All expressions default to "x".
  8105. @subsection Examples
  8106. @itemize
  8107. @item
  8108. Highlight differences between two RGB video streams:
  8109. @example
  8110. 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)'
  8111. @end example
  8112. @item
  8113. Highlight differences between two YUV video streams:
  8114. @example
  8115. 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)'
  8116. @end example
  8117. @item
  8118. Show max difference between two video streams:
  8119. @example
  8120. 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)))'
  8121. @end example
  8122. @end itemize
  8123. @section maskedclamp
  8124. Clamp the first input stream with the second input and third input stream.
  8125. Returns the value of first stream to be between second input
  8126. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8127. This filter accepts the following options:
  8128. @table @option
  8129. @item undershoot
  8130. Default value is @code{0}.
  8131. @item overshoot
  8132. Default value is @code{0}.
  8133. @item planes
  8134. Set which planes will be processed as bitmap, unprocessed planes will be
  8135. copied from first stream.
  8136. By default value 0xf, all planes will be processed.
  8137. @end table
  8138. @section maskedmerge
  8139. Merge the first input stream with the second input stream using per pixel
  8140. weights in the third input stream.
  8141. A value of 0 in the third stream pixel component means that pixel component
  8142. from first stream is returned unchanged, while maximum value (eg. 255 for
  8143. 8-bit videos) means that pixel component from second stream is returned
  8144. unchanged. Intermediate values define the amount of merging between both
  8145. input stream's pixel components.
  8146. This filter accepts the following options:
  8147. @table @option
  8148. @item planes
  8149. Set which planes will be processed as bitmap, unprocessed planes will be
  8150. copied from first stream.
  8151. By default value 0xf, all planes will be processed.
  8152. @end table
  8153. @section mcdeint
  8154. Apply motion-compensation deinterlacing.
  8155. It needs one field per frame as input and must thus be used together
  8156. with yadif=1/3 or equivalent.
  8157. This filter accepts the following options:
  8158. @table @option
  8159. @item mode
  8160. Set the deinterlacing mode.
  8161. It accepts one of the following values:
  8162. @table @samp
  8163. @item fast
  8164. @item medium
  8165. @item slow
  8166. use iterative motion estimation
  8167. @item extra_slow
  8168. like @samp{slow}, but use multiple reference frames.
  8169. @end table
  8170. Default value is @samp{fast}.
  8171. @item parity
  8172. Set the picture field parity assumed for the input video. It must be
  8173. one of the following values:
  8174. @table @samp
  8175. @item 0, tff
  8176. assume top field first
  8177. @item 1, bff
  8178. assume bottom field first
  8179. @end table
  8180. Default value is @samp{bff}.
  8181. @item qp
  8182. Set per-block quantization parameter (QP) used by the internal
  8183. encoder.
  8184. Higher values should result in a smoother motion vector field but less
  8185. optimal individual vectors. Default value is 1.
  8186. @end table
  8187. @section mergeplanes
  8188. Merge color channel components from several video streams.
  8189. The filter accepts up to 4 input streams, and merge selected input
  8190. planes to the output video.
  8191. This filter accepts the following options:
  8192. @table @option
  8193. @item mapping
  8194. Set input to output plane mapping. Default is @code{0}.
  8195. The mappings is specified as a bitmap. It should be specified as a
  8196. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8197. mapping for the first plane of the output stream. 'A' sets the number of
  8198. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8199. corresponding input to use (from 0 to 3). The rest of the mappings is
  8200. similar, 'Bb' describes the mapping for the output stream second
  8201. plane, 'Cc' describes the mapping for the output stream third plane and
  8202. 'Dd' describes the mapping for the output stream fourth plane.
  8203. @item format
  8204. Set output pixel format. Default is @code{yuva444p}.
  8205. @end table
  8206. @subsection Examples
  8207. @itemize
  8208. @item
  8209. Merge three gray video streams of same width and height into single video stream:
  8210. @example
  8211. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8212. @end example
  8213. @item
  8214. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8215. @example
  8216. [a0][a1]mergeplanes=0x00010210:yuva444p
  8217. @end example
  8218. @item
  8219. Swap Y and A plane in yuva444p stream:
  8220. @example
  8221. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8222. @end example
  8223. @item
  8224. Swap U and V plane in yuv420p stream:
  8225. @example
  8226. format=yuv420p,mergeplanes=0x000201:yuv420p
  8227. @end example
  8228. @item
  8229. Cast a rgb24 clip to yuv444p:
  8230. @example
  8231. format=rgb24,mergeplanes=0x000102:yuv444p
  8232. @end example
  8233. @end itemize
  8234. @section mestimate
  8235. Estimate and export motion vectors using block matching algorithms.
  8236. Motion vectors are stored in frame side data to be used by other filters.
  8237. This filter accepts the following options:
  8238. @table @option
  8239. @item method
  8240. Specify the motion estimation method. Accepts one of the following values:
  8241. @table @samp
  8242. @item esa
  8243. Exhaustive search algorithm.
  8244. @item tss
  8245. Three step search algorithm.
  8246. @item tdls
  8247. Two dimensional logarithmic search algorithm.
  8248. @item ntss
  8249. New three step search algorithm.
  8250. @item fss
  8251. Four step search algorithm.
  8252. @item ds
  8253. Diamond search algorithm.
  8254. @item hexbs
  8255. Hexagon-based search algorithm.
  8256. @item epzs
  8257. Enhanced predictive zonal search algorithm.
  8258. @item umh
  8259. Uneven multi-hexagon search algorithm.
  8260. @end table
  8261. Default value is @samp{esa}.
  8262. @item mb_size
  8263. Macroblock size. Default @code{16}.
  8264. @item search_param
  8265. Search parameter. Default @code{7}.
  8266. @end table
  8267. @section midequalizer
  8268. Apply Midway Image Equalization effect using two video streams.
  8269. Midway Image Equalization adjusts a pair of images to have the same
  8270. histogram, while maintaining their dynamics as much as possible. It's
  8271. useful for e.g. matching exposures from a pair of stereo cameras.
  8272. This filter has two inputs and one output, which must be of same pixel format, but
  8273. may be of different sizes. The output of filter is first input adjusted with
  8274. midway histogram of both inputs.
  8275. This filter accepts the following option:
  8276. @table @option
  8277. @item planes
  8278. Set which planes to process. Default is @code{15}, which is all available planes.
  8279. @end table
  8280. @section minterpolate
  8281. Convert the video to specified frame rate using motion interpolation.
  8282. This filter accepts the following options:
  8283. @table @option
  8284. @item fps
  8285. 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}.
  8286. @item mi_mode
  8287. Motion interpolation mode. Following values are accepted:
  8288. @table @samp
  8289. @item dup
  8290. Duplicate previous or next frame for interpolating new ones.
  8291. @item blend
  8292. Blend source frames. Interpolated frame is mean of previous and next frames.
  8293. @item mci
  8294. Motion compensated interpolation. Following options are effective when this mode is selected:
  8295. @table @samp
  8296. @item mc_mode
  8297. Motion compensation mode. Following values are accepted:
  8298. @table @samp
  8299. @item obmc
  8300. Overlapped block motion compensation.
  8301. @item aobmc
  8302. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8303. @end table
  8304. Default mode is @samp{obmc}.
  8305. @item me_mode
  8306. Motion estimation mode. Following values are accepted:
  8307. @table @samp
  8308. @item bidir
  8309. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8310. @item bilat
  8311. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8312. @end table
  8313. Default mode is @samp{bilat}.
  8314. @item me
  8315. The algorithm to be used for motion estimation. Following values are accepted:
  8316. @table @samp
  8317. @item esa
  8318. Exhaustive search algorithm.
  8319. @item tss
  8320. Three step search algorithm.
  8321. @item tdls
  8322. Two dimensional logarithmic search algorithm.
  8323. @item ntss
  8324. New three step search algorithm.
  8325. @item fss
  8326. Four step search algorithm.
  8327. @item ds
  8328. Diamond search algorithm.
  8329. @item hexbs
  8330. Hexagon-based search algorithm.
  8331. @item epzs
  8332. Enhanced predictive zonal search algorithm.
  8333. @item umh
  8334. Uneven multi-hexagon search algorithm.
  8335. @end table
  8336. Default algorithm is @samp{epzs}.
  8337. @item mb_size
  8338. Macroblock size. Default @code{16}.
  8339. @item search_param
  8340. Motion estimation search parameter. Default @code{32}.
  8341. @item vsbmc
  8342. 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).
  8343. @end table
  8344. @end table
  8345. @item scd
  8346. 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:
  8347. @table @samp
  8348. @item none
  8349. Disable scene change detection.
  8350. @item fdiff
  8351. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8352. @end table
  8353. Default method is @samp{fdiff}.
  8354. @item scd_threshold
  8355. Scene change detection threshold. Default is @code{5.0}.
  8356. @end table
  8357. @section mix
  8358. Mix several video input streams into one video stream.
  8359. A description of the accepted options follows.
  8360. @table @option
  8361. @item nb_inputs
  8362. The number of inputs. If unspecified, it defaults to 2.
  8363. @item weights
  8364. Specify weight of each input video stream as sequence.
  8365. Each weight is separated by space.
  8366. @item duration
  8367. Specify how end of stream is determined.
  8368. @table @samp
  8369. @item longest
  8370. The duration of the longest input. (default)
  8371. @item shortest
  8372. The duration of the shortest input.
  8373. @item first
  8374. The duration of the first input.
  8375. @end table
  8376. @end table
  8377. @section mpdecimate
  8378. Drop frames that do not differ greatly from the previous frame in
  8379. order to reduce frame rate.
  8380. The main use of this filter is for very-low-bitrate encoding
  8381. (e.g. streaming over dialup modem), but it could in theory be used for
  8382. fixing movies that were inverse-telecined incorrectly.
  8383. A description of the accepted options follows.
  8384. @table @option
  8385. @item max
  8386. Set the maximum number of consecutive frames which can be dropped (if
  8387. positive), or the minimum interval between dropped frames (if
  8388. negative). If the value is 0, the frame is dropped disregarding the
  8389. number of previous sequentially dropped frames.
  8390. Default value is 0.
  8391. @item hi
  8392. @item lo
  8393. @item frac
  8394. Set the dropping threshold values.
  8395. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8396. represent actual pixel value differences, so a threshold of 64
  8397. corresponds to 1 unit of difference for each pixel, or the same spread
  8398. out differently over the block.
  8399. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8400. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8401. meaning the whole image) differ by more than a threshold of @option{lo}.
  8402. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8403. 64*5, and default value for @option{frac} is 0.33.
  8404. @end table
  8405. @section negate
  8406. Negate input video.
  8407. It accepts an integer in input; if non-zero it negates the
  8408. alpha component (if available). The default value in input is 0.
  8409. @section nlmeans
  8410. Denoise frames using Non-Local Means algorithm.
  8411. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8412. context similarity is defined by comparing their surrounding patches of size
  8413. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8414. around the pixel.
  8415. Note that the research area defines centers for patches, which means some
  8416. patches will be made of pixels outside that research area.
  8417. The filter accepts the following options.
  8418. @table @option
  8419. @item s
  8420. Set denoising strength.
  8421. @item p
  8422. Set patch size.
  8423. @item pc
  8424. Same as @option{p} but for chroma planes.
  8425. The default value is @var{0} and means automatic.
  8426. @item r
  8427. Set research size.
  8428. @item rc
  8429. Same as @option{r} but for chroma planes.
  8430. The default value is @var{0} and means automatic.
  8431. @end table
  8432. @section nnedi
  8433. Deinterlace video using neural network edge directed interpolation.
  8434. This filter accepts the following options:
  8435. @table @option
  8436. @item weights
  8437. Mandatory option, without binary file filter can not work.
  8438. Currently file can be found here:
  8439. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8440. @item deint
  8441. Set which frames to deinterlace, by default it is @code{all}.
  8442. Can be @code{all} or @code{interlaced}.
  8443. @item field
  8444. Set mode of operation.
  8445. Can be one of the following:
  8446. @table @samp
  8447. @item af
  8448. Use frame flags, both fields.
  8449. @item a
  8450. Use frame flags, single field.
  8451. @item t
  8452. Use top field only.
  8453. @item b
  8454. Use bottom field only.
  8455. @item tf
  8456. Use both fields, top first.
  8457. @item bf
  8458. Use both fields, bottom first.
  8459. @end table
  8460. @item planes
  8461. Set which planes to process, by default filter process all frames.
  8462. @item nsize
  8463. Set size of local neighborhood around each pixel, used by the predictor neural
  8464. network.
  8465. Can be one of the following:
  8466. @table @samp
  8467. @item s8x6
  8468. @item s16x6
  8469. @item s32x6
  8470. @item s48x6
  8471. @item s8x4
  8472. @item s16x4
  8473. @item s32x4
  8474. @end table
  8475. @item nns
  8476. Set the number of neurons in predictor neural network.
  8477. Can be one of the following:
  8478. @table @samp
  8479. @item n16
  8480. @item n32
  8481. @item n64
  8482. @item n128
  8483. @item n256
  8484. @end table
  8485. @item qual
  8486. Controls the number of different neural network predictions that are blended
  8487. together to compute the final output value. Can be @code{fast}, default or
  8488. @code{slow}.
  8489. @item etype
  8490. Set which set of weights to use in the predictor.
  8491. Can be one of the following:
  8492. @table @samp
  8493. @item a
  8494. weights trained to minimize absolute error
  8495. @item s
  8496. weights trained to minimize squared error
  8497. @end table
  8498. @item pscrn
  8499. Controls whether or not the prescreener neural network is used to decide
  8500. which pixels should be processed by the predictor neural network and which
  8501. can be handled by simple cubic interpolation.
  8502. The prescreener is trained to know whether cubic interpolation will be
  8503. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8504. The computational complexity of the prescreener nn is much less than that of
  8505. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8506. using the prescreener generally results in much faster processing.
  8507. The prescreener is pretty accurate, so the difference between using it and not
  8508. using it is almost always unnoticeable.
  8509. Can be one of the following:
  8510. @table @samp
  8511. @item none
  8512. @item original
  8513. @item new
  8514. @end table
  8515. Default is @code{new}.
  8516. @item fapprox
  8517. Set various debugging flags.
  8518. @end table
  8519. @section noformat
  8520. Force libavfilter not to use any of the specified pixel formats for the
  8521. input to the next filter.
  8522. It accepts the following parameters:
  8523. @table @option
  8524. @item pix_fmts
  8525. A '|'-separated list of pixel format names, such as
  8526. pix_fmts=yuv420p|monow|rgb24".
  8527. @end table
  8528. @subsection Examples
  8529. @itemize
  8530. @item
  8531. Force libavfilter to use a format different from @var{yuv420p} for the
  8532. input to the vflip filter:
  8533. @example
  8534. noformat=pix_fmts=yuv420p,vflip
  8535. @end example
  8536. @item
  8537. Convert the input video to any of the formats not contained in the list:
  8538. @example
  8539. noformat=yuv420p|yuv444p|yuv410p
  8540. @end example
  8541. @end itemize
  8542. @section noise
  8543. Add noise on video input frame.
  8544. The filter accepts the following options:
  8545. @table @option
  8546. @item all_seed
  8547. @item c0_seed
  8548. @item c1_seed
  8549. @item c2_seed
  8550. @item c3_seed
  8551. Set noise seed for specific pixel component or all pixel components in case
  8552. of @var{all_seed}. Default value is @code{123457}.
  8553. @item all_strength, alls
  8554. @item c0_strength, c0s
  8555. @item c1_strength, c1s
  8556. @item c2_strength, c2s
  8557. @item c3_strength, c3s
  8558. Set noise strength for specific pixel component or all pixel components in case
  8559. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8560. @item all_flags, allf
  8561. @item c0_flags, c0f
  8562. @item c1_flags, c1f
  8563. @item c2_flags, c2f
  8564. @item c3_flags, c3f
  8565. Set pixel component flags or set flags for all components if @var{all_flags}.
  8566. Available values for component flags are:
  8567. @table @samp
  8568. @item a
  8569. averaged temporal noise (smoother)
  8570. @item p
  8571. mix random noise with a (semi)regular pattern
  8572. @item t
  8573. temporal noise (noise pattern changes between frames)
  8574. @item u
  8575. uniform noise (gaussian otherwise)
  8576. @end table
  8577. @end table
  8578. @subsection Examples
  8579. Add temporal and uniform noise to input video:
  8580. @example
  8581. noise=alls=20:allf=t+u
  8582. @end example
  8583. @section normalize
  8584. Normalize RGB video (aka histogram stretching, contrast stretching).
  8585. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8586. For each channel of each frame, the filter computes the input range and maps
  8587. it linearly to the user-specified output range. The output range defaults
  8588. to the full dynamic range from pure black to pure white.
  8589. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8590. changes in brightness) caused when small dark or bright objects enter or leave
  8591. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8592. video camera, and, like a video camera, it may cause a period of over- or
  8593. under-exposure of the video.
  8594. The R,G,B channels can be normalized independently, which may cause some
  8595. color shifting, or linked together as a single channel, which prevents
  8596. color shifting. Linked normalization preserves hue. Independent normalization
  8597. does not, so it can be used to remove some color casts. Independent and linked
  8598. normalization can be combined in any ratio.
  8599. The normalize filter accepts the following options:
  8600. @table @option
  8601. @item blackpt
  8602. @item whitept
  8603. Colors which define the output range. The minimum input value is mapped to
  8604. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8605. The defaults are black and white respectively. Specifying white for
  8606. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8607. normalized video. Shades of grey can be used to reduce the dynamic range
  8608. (contrast). Specifying saturated colors here can create some interesting
  8609. effects.
  8610. @item smoothing
  8611. The number of previous frames to use for temporal smoothing. The input range
  8612. of each channel is smoothed using a rolling average over the current frame
  8613. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8614. smoothing).
  8615. @item independence
  8616. Controls the ratio of independent (color shifting) channel normalization to
  8617. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8618. independent. Defaults to 1.0 (fully independent).
  8619. @item strength
  8620. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8621. expensive no-op. Defaults to 1.0 (full strength).
  8622. @end table
  8623. @subsection Examples
  8624. Stretch video contrast to use the full dynamic range, with no temporal
  8625. smoothing; may flicker depending on the source content:
  8626. @example
  8627. normalize=blackpt=black:whitept=white:smoothing=0
  8628. @end example
  8629. As above, but with 50 frames of temporal smoothing; flicker should be
  8630. reduced, depending on the source content:
  8631. @example
  8632. normalize=blackpt=black:whitept=white:smoothing=50
  8633. @end example
  8634. As above, but with hue-preserving linked channel normalization:
  8635. @example
  8636. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8637. @end example
  8638. As above, but with half strength:
  8639. @example
  8640. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8641. @end example
  8642. Map the darkest input color to red, the brightest input color to cyan:
  8643. @example
  8644. normalize=blackpt=red:whitept=cyan
  8645. @end example
  8646. @section null
  8647. Pass the video source unchanged to the output.
  8648. @section ocr
  8649. Optical Character Recognition
  8650. This filter uses Tesseract for optical character recognition.
  8651. It accepts the following options:
  8652. @table @option
  8653. @item datapath
  8654. Set datapath to tesseract data. Default is to use whatever was
  8655. set at installation.
  8656. @item language
  8657. Set language, default is "eng".
  8658. @item whitelist
  8659. Set character whitelist.
  8660. @item blacklist
  8661. Set character blacklist.
  8662. @end table
  8663. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8664. @section ocv
  8665. Apply a video transform using libopencv.
  8666. To enable this filter, install the libopencv library and headers and
  8667. configure FFmpeg with @code{--enable-libopencv}.
  8668. It accepts the following parameters:
  8669. @table @option
  8670. @item filter_name
  8671. The name of the libopencv filter to apply.
  8672. @item filter_params
  8673. The parameters to pass to the libopencv filter. If not specified, the default
  8674. values are assumed.
  8675. @end table
  8676. Refer to the official libopencv documentation for more precise
  8677. information:
  8678. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8679. Several libopencv filters are supported; see the following subsections.
  8680. @anchor{dilate}
  8681. @subsection dilate
  8682. Dilate an image by using a specific structuring element.
  8683. It corresponds to the libopencv function @code{cvDilate}.
  8684. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8685. @var{struct_el} represents a structuring element, and has the syntax:
  8686. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8687. @var{cols} and @var{rows} represent the number of columns and rows of
  8688. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8689. point, and @var{shape} the shape for the structuring element. @var{shape}
  8690. must be "rect", "cross", "ellipse", or "custom".
  8691. If the value for @var{shape} is "custom", it must be followed by a
  8692. string of the form "=@var{filename}". The file with name
  8693. @var{filename} is assumed to represent a binary image, with each
  8694. printable character corresponding to a bright pixel. When a custom
  8695. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8696. or columns and rows of the read file are assumed instead.
  8697. The default value for @var{struct_el} is "3x3+0x0/rect".
  8698. @var{nb_iterations} specifies the number of times the transform is
  8699. applied to the image, and defaults to 1.
  8700. Some examples:
  8701. @example
  8702. # Use the default values
  8703. ocv=dilate
  8704. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8705. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8706. # Read the shape from the file diamond.shape, iterating two times.
  8707. # The file diamond.shape may contain a pattern of characters like this
  8708. # *
  8709. # ***
  8710. # *****
  8711. # ***
  8712. # *
  8713. # The specified columns and rows are ignored
  8714. # but the anchor point coordinates are not
  8715. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8716. @end example
  8717. @subsection erode
  8718. Erode an image by using a specific structuring element.
  8719. It corresponds to the libopencv function @code{cvErode}.
  8720. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8721. with the same syntax and semantics as the @ref{dilate} filter.
  8722. @subsection smooth
  8723. Smooth the input video.
  8724. The filter takes the following parameters:
  8725. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8726. @var{type} is the type of smooth filter to apply, and must be one of
  8727. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8728. or "bilateral". The default value is "gaussian".
  8729. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8730. depend on the smooth type. @var{param1} and
  8731. @var{param2} accept integer positive values or 0. @var{param3} and
  8732. @var{param4} accept floating point values.
  8733. The default value for @var{param1} is 3. The default value for the
  8734. other parameters is 0.
  8735. These parameters correspond to the parameters assigned to the
  8736. libopencv function @code{cvSmooth}.
  8737. @section oscilloscope
  8738. 2D Video Oscilloscope.
  8739. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8740. It accepts the following parameters:
  8741. @table @option
  8742. @item x
  8743. Set scope center x position.
  8744. @item y
  8745. Set scope center y position.
  8746. @item s
  8747. Set scope size, relative to frame diagonal.
  8748. @item t
  8749. Set scope tilt/rotation.
  8750. @item o
  8751. Set trace opacity.
  8752. @item tx
  8753. Set trace center x position.
  8754. @item ty
  8755. Set trace center y position.
  8756. @item tw
  8757. Set trace width, relative to width of frame.
  8758. @item th
  8759. Set trace height, relative to height of frame.
  8760. @item c
  8761. Set which components to trace. By default it traces first three components.
  8762. @item g
  8763. Draw trace grid. By default is enabled.
  8764. @item st
  8765. Draw some statistics. By default is enabled.
  8766. @item sc
  8767. Draw scope. By default is enabled.
  8768. @end table
  8769. @subsection Examples
  8770. @itemize
  8771. @item
  8772. Inspect full first row of video frame.
  8773. @example
  8774. oscilloscope=x=0.5:y=0:s=1
  8775. @end example
  8776. @item
  8777. Inspect full last row of video frame.
  8778. @example
  8779. oscilloscope=x=0.5:y=1:s=1
  8780. @end example
  8781. @item
  8782. Inspect full 5th line of video frame of height 1080.
  8783. @example
  8784. oscilloscope=x=0.5:y=5/1080:s=1
  8785. @end example
  8786. @item
  8787. Inspect full last column of video frame.
  8788. @example
  8789. oscilloscope=x=1:y=0.5:s=1:t=1
  8790. @end example
  8791. @end itemize
  8792. @anchor{overlay}
  8793. @section overlay
  8794. Overlay one video on top of another.
  8795. It takes two inputs and has one output. The first input is the "main"
  8796. video on which the second input is overlaid.
  8797. It accepts the following parameters:
  8798. A description of the accepted options follows.
  8799. @table @option
  8800. @item x
  8801. @item y
  8802. Set the expression for the x and y coordinates of the overlaid video
  8803. on the main video. Default value is "0" for both expressions. In case
  8804. the expression is invalid, it is set to a huge value (meaning that the
  8805. overlay will not be displayed within the output visible area).
  8806. @item eof_action
  8807. See @ref{framesync}.
  8808. @item eval
  8809. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8810. It accepts the following values:
  8811. @table @samp
  8812. @item init
  8813. only evaluate expressions once during the filter initialization or
  8814. when a command is processed
  8815. @item frame
  8816. evaluate expressions for each incoming frame
  8817. @end table
  8818. Default value is @samp{frame}.
  8819. @item shortest
  8820. See @ref{framesync}.
  8821. @item format
  8822. Set the format for the output video.
  8823. It accepts the following values:
  8824. @table @samp
  8825. @item yuv420
  8826. force YUV420 output
  8827. @item yuv422
  8828. force YUV422 output
  8829. @item yuv444
  8830. force YUV444 output
  8831. @item rgb
  8832. force packed RGB output
  8833. @item gbrp
  8834. force planar RGB output
  8835. @item auto
  8836. automatically pick format
  8837. @end table
  8838. Default value is @samp{yuv420}.
  8839. @item repeatlast
  8840. See @ref{framesync}.
  8841. @item alpha
  8842. Set format of alpha of the overlaid video, it can be @var{straight} or
  8843. @var{premultiplied}. Default is @var{straight}.
  8844. @end table
  8845. The @option{x}, and @option{y} expressions can contain the following
  8846. parameters.
  8847. @table @option
  8848. @item main_w, W
  8849. @item main_h, H
  8850. The main input width and height.
  8851. @item overlay_w, w
  8852. @item overlay_h, h
  8853. The overlay input width and height.
  8854. @item x
  8855. @item y
  8856. The computed values for @var{x} and @var{y}. They are evaluated for
  8857. each new frame.
  8858. @item hsub
  8859. @item vsub
  8860. horizontal and vertical chroma subsample values of the output
  8861. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8862. @var{vsub} is 1.
  8863. @item n
  8864. the number of input frame, starting from 0
  8865. @item pos
  8866. the position in the file of the input frame, NAN if unknown
  8867. @item t
  8868. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8869. @end table
  8870. This filter also supports the @ref{framesync} options.
  8871. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8872. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8873. when @option{eval} is set to @samp{init}.
  8874. Be aware that frames are taken from each input video in timestamp
  8875. order, hence, if their initial timestamps differ, it is a good idea
  8876. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8877. have them begin in the same zero timestamp, as the example for
  8878. the @var{movie} filter does.
  8879. You can chain together more overlays but you should test the
  8880. efficiency of such approach.
  8881. @subsection Commands
  8882. This filter supports the following commands:
  8883. @table @option
  8884. @item x
  8885. @item y
  8886. Modify the x and y of the overlay input.
  8887. The command accepts the same syntax of the corresponding option.
  8888. If the specified expression is not valid, it is kept at its current
  8889. value.
  8890. @end table
  8891. @subsection Examples
  8892. @itemize
  8893. @item
  8894. Draw the overlay at 10 pixels from the bottom right corner of the main
  8895. video:
  8896. @example
  8897. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8898. @end example
  8899. Using named options the example above becomes:
  8900. @example
  8901. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8902. @end example
  8903. @item
  8904. Insert a transparent PNG logo in the bottom left corner of the input,
  8905. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8906. @example
  8907. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8908. @end example
  8909. @item
  8910. Insert 2 different transparent PNG logos (second logo on bottom
  8911. right corner) using the @command{ffmpeg} tool:
  8912. @example
  8913. 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
  8914. @end example
  8915. @item
  8916. Add a transparent color layer on top of the main video; @code{WxH}
  8917. must specify the size of the main input to the overlay filter:
  8918. @example
  8919. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8920. @end example
  8921. @item
  8922. Play an original video and a filtered version (here with the deshake
  8923. filter) side by side using the @command{ffplay} tool:
  8924. @example
  8925. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8926. @end example
  8927. The above command is the same as:
  8928. @example
  8929. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8930. @end example
  8931. @item
  8932. Make a sliding overlay appearing from the left to the right top part of the
  8933. screen starting since time 2:
  8934. @example
  8935. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8936. @end example
  8937. @item
  8938. Compose output by putting two input videos side to side:
  8939. @example
  8940. ffmpeg -i left.avi -i right.avi -filter_complex "
  8941. nullsrc=size=200x100 [background];
  8942. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8943. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8944. [background][left] overlay=shortest=1 [background+left];
  8945. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8946. "
  8947. @end example
  8948. @item
  8949. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8950. @example
  8951. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8952. -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]'
  8953. masked.avi
  8954. @end example
  8955. @item
  8956. Chain several overlays in cascade:
  8957. @example
  8958. nullsrc=s=200x200 [bg];
  8959. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8960. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8961. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8962. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8963. [in3] null, [mid2] overlay=100:100 [out0]
  8964. @end example
  8965. @end itemize
  8966. @section owdenoise
  8967. Apply Overcomplete Wavelet denoiser.
  8968. The filter accepts the following options:
  8969. @table @option
  8970. @item depth
  8971. Set depth.
  8972. Larger depth values will denoise lower frequency components more, but
  8973. slow down filtering.
  8974. Must be an int in the range 8-16, default is @code{8}.
  8975. @item luma_strength, ls
  8976. Set luma strength.
  8977. Must be a double value in the range 0-1000, default is @code{1.0}.
  8978. @item chroma_strength, cs
  8979. Set chroma strength.
  8980. Must be a double value in the range 0-1000, default is @code{1.0}.
  8981. @end table
  8982. @anchor{pad}
  8983. @section pad
  8984. Add paddings to the input image, and place the original input at the
  8985. provided @var{x}, @var{y} coordinates.
  8986. It accepts the following parameters:
  8987. @table @option
  8988. @item width, w
  8989. @item height, h
  8990. Specify an expression for the size of the output image with the
  8991. paddings added. If the value for @var{width} or @var{height} is 0, the
  8992. corresponding input size is used for the output.
  8993. The @var{width} expression can reference the value set by the
  8994. @var{height} expression, and vice versa.
  8995. The default value of @var{width} and @var{height} is 0.
  8996. @item x
  8997. @item y
  8998. Specify the offsets to place the input image at within the padded area,
  8999. with respect to the top/left border of the output image.
  9000. The @var{x} expression can reference the value set by the @var{y}
  9001. expression, and vice versa.
  9002. The default value of @var{x} and @var{y} is 0.
  9003. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9004. so the input image is centered on the padded area.
  9005. @item color
  9006. Specify the color of the padded area. For the syntax of this option,
  9007. check the "Color" section in the ffmpeg-utils manual.
  9008. The default value of @var{color} is "black".
  9009. @item eval
  9010. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9011. It accepts the following values:
  9012. @table @samp
  9013. @item init
  9014. Only evaluate expressions once during the filter initialization or when
  9015. a command is processed.
  9016. @item frame
  9017. Evaluate expressions for each incoming frame.
  9018. @end table
  9019. Default value is @samp{init}.
  9020. @item aspect
  9021. Pad to aspect instead to a resolution.
  9022. @end table
  9023. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9024. options are expressions containing the following constants:
  9025. @table @option
  9026. @item in_w
  9027. @item in_h
  9028. The input video width and height.
  9029. @item iw
  9030. @item ih
  9031. These are the same as @var{in_w} and @var{in_h}.
  9032. @item out_w
  9033. @item out_h
  9034. The output width and height (the size of the padded area), as
  9035. specified by the @var{width} and @var{height} expressions.
  9036. @item ow
  9037. @item oh
  9038. These are the same as @var{out_w} and @var{out_h}.
  9039. @item x
  9040. @item y
  9041. The x and y offsets as specified by the @var{x} and @var{y}
  9042. expressions, or NAN if not yet specified.
  9043. @item a
  9044. same as @var{iw} / @var{ih}
  9045. @item sar
  9046. input sample aspect ratio
  9047. @item dar
  9048. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9049. @item hsub
  9050. @item vsub
  9051. The horizontal and vertical chroma subsample values. For example for the
  9052. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9053. @end table
  9054. @subsection Examples
  9055. @itemize
  9056. @item
  9057. Add paddings with the color "violet" to the input video. The output video
  9058. size is 640x480, and the top-left corner of the input video is placed at
  9059. column 0, row 40
  9060. @example
  9061. pad=640:480:0:40:violet
  9062. @end example
  9063. The example above is equivalent to the following command:
  9064. @example
  9065. pad=width=640:height=480:x=0:y=40:color=violet
  9066. @end example
  9067. @item
  9068. Pad the input to get an output with dimensions increased by 3/2,
  9069. and put the input video at the center of the padded area:
  9070. @example
  9071. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9072. @end example
  9073. @item
  9074. Pad the input to get a squared output with size equal to the maximum
  9075. value between the input width and height, and put the input video at
  9076. the center of the padded area:
  9077. @example
  9078. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9079. @end example
  9080. @item
  9081. Pad the input to get a final w/h ratio of 16:9:
  9082. @example
  9083. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9084. @end example
  9085. @item
  9086. In case of anamorphic video, in order to set the output display aspect
  9087. correctly, it is necessary to use @var{sar} in the expression,
  9088. according to the relation:
  9089. @example
  9090. (ih * X / ih) * sar = output_dar
  9091. X = output_dar / sar
  9092. @end example
  9093. Thus the previous example needs to be modified to:
  9094. @example
  9095. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9096. @end example
  9097. @item
  9098. Double the output size and put the input video in the bottom-right
  9099. corner of the output padded area:
  9100. @example
  9101. pad="2*iw:2*ih:ow-iw:oh-ih"
  9102. @end example
  9103. @end itemize
  9104. @anchor{palettegen}
  9105. @section palettegen
  9106. Generate one palette for a whole video stream.
  9107. It accepts the following options:
  9108. @table @option
  9109. @item max_colors
  9110. Set the maximum number of colors to quantize in the palette.
  9111. Note: the palette will still contain 256 colors; the unused palette entries
  9112. will be black.
  9113. @item reserve_transparent
  9114. Create a palette of 255 colors maximum and reserve the last one for
  9115. transparency. Reserving the transparency color is useful for GIF optimization.
  9116. If not set, the maximum of colors in the palette will be 256. You probably want
  9117. to disable this option for a standalone image.
  9118. Set by default.
  9119. @item transparency_color
  9120. Set the color that will be used as background for transparency.
  9121. @item stats_mode
  9122. Set statistics mode.
  9123. It accepts the following values:
  9124. @table @samp
  9125. @item full
  9126. Compute full frame histograms.
  9127. @item diff
  9128. Compute histograms only for the part that differs from previous frame. This
  9129. might be relevant to give more importance to the moving part of your input if
  9130. the background is static.
  9131. @item single
  9132. Compute new histogram for each frame.
  9133. @end table
  9134. Default value is @var{full}.
  9135. @end table
  9136. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9137. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9138. color quantization of the palette. This information is also visible at
  9139. @var{info} logging level.
  9140. @subsection Examples
  9141. @itemize
  9142. @item
  9143. Generate a representative palette of a given video using @command{ffmpeg}:
  9144. @example
  9145. ffmpeg -i input.mkv -vf palettegen palette.png
  9146. @end example
  9147. @end itemize
  9148. @section paletteuse
  9149. Use a palette to downsample an input video stream.
  9150. The filter takes two inputs: one video stream and a palette. The palette must
  9151. be a 256 pixels image.
  9152. It accepts the following options:
  9153. @table @option
  9154. @item dither
  9155. Select dithering mode. Available algorithms are:
  9156. @table @samp
  9157. @item bayer
  9158. Ordered 8x8 bayer dithering (deterministic)
  9159. @item heckbert
  9160. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9161. Note: this dithering is sometimes considered "wrong" and is included as a
  9162. reference.
  9163. @item floyd_steinberg
  9164. Floyd and Steingberg dithering (error diffusion)
  9165. @item sierra2
  9166. Frankie Sierra dithering v2 (error diffusion)
  9167. @item sierra2_4a
  9168. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9169. @end table
  9170. Default is @var{sierra2_4a}.
  9171. @item bayer_scale
  9172. When @var{bayer} dithering is selected, this option defines the scale of the
  9173. pattern (how much the crosshatch pattern is visible). A low value means more
  9174. visible pattern for less banding, and higher value means less visible pattern
  9175. at the cost of more banding.
  9176. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9177. @item diff_mode
  9178. If set, define the zone to process
  9179. @table @samp
  9180. @item rectangle
  9181. Only the changing rectangle will be reprocessed. This is similar to GIF
  9182. cropping/offsetting compression mechanism. This option can be useful for speed
  9183. if only a part of the image is changing, and has use cases such as limiting the
  9184. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9185. moving scene (it leads to more deterministic output if the scene doesn't change
  9186. much, and as a result less moving noise and better GIF compression).
  9187. @end table
  9188. Default is @var{none}.
  9189. @item new
  9190. Take new palette for each output frame.
  9191. @item alpha_threshold
  9192. Sets the alpha threshold for transparency. Alpha values above this threshold
  9193. will be treated as completely opaque, and values below this threshold will be
  9194. treated as completely transparent.
  9195. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9196. @end table
  9197. @subsection Examples
  9198. @itemize
  9199. @item
  9200. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9201. using @command{ffmpeg}:
  9202. @example
  9203. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9204. @end example
  9205. @end itemize
  9206. @section perspective
  9207. Correct perspective of video not recorded perpendicular to the screen.
  9208. A description of the accepted parameters follows.
  9209. @table @option
  9210. @item x0
  9211. @item y0
  9212. @item x1
  9213. @item y1
  9214. @item x2
  9215. @item y2
  9216. @item x3
  9217. @item y3
  9218. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9219. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9220. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9221. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9222. then the corners of the source will be sent to the specified coordinates.
  9223. The expressions can use the following variables:
  9224. @table @option
  9225. @item W
  9226. @item H
  9227. the width and height of video frame.
  9228. @item in
  9229. Input frame count.
  9230. @item on
  9231. Output frame count.
  9232. @end table
  9233. @item interpolation
  9234. Set interpolation for perspective correction.
  9235. It accepts the following values:
  9236. @table @samp
  9237. @item linear
  9238. @item cubic
  9239. @end table
  9240. Default value is @samp{linear}.
  9241. @item sense
  9242. Set interpretation of coordinate options.
  9243. It accepts the following values:
  9244. @table @samp
  9245. @item 0, source
  9246. Send point in the source specified by the given coordinates to
  9247. the corners of the destination.
  9248. @item 1, destination
  9249. Send the corners of the source to the point in the destination specified
  9250. by the given coordinates.
  9251. Default value is @samp{source}.
  9252. @end table
  9253. @item eval
  9254. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9255. It accepts the following values:
  9256. @table @samp
  9257. @item init
  9258. only evaluate expressions once during the filter initialization or
  9259. when a command is processed
  9260. @item frame
  9261. evaluate expressions for each incoming frame
  9262. @end table
  9263. Default value is @samp{init}.
  9264. @end table
  9265. @section phase
  9266. Delay interlaced video by one field time so that the field order changes.
  9267. The intended use is to fix PAL movies that have been captured with the
  9268. opposite field order to the film-to-video transfer.
  9269. A description of the accepted parameters follows.
  9270. @table @option
  9271. @item mode
  9272. Set phase mode.
  9273. It accepts the following values:
  9274. @table @samp
  9275. @item t
  9276. Capture field order top-first, transfer bottom-first.
  9277. Filter will delay the bottom field.
  9278. @item b
  9279. Capture field order bottom-first, transfer top-first.
  9280. Filter will delay the top field.
  9281. @item p
  9282. Capture and transfer with the same field order. This mode only exists
  9283. for the documentation of the other options to refer to, but if you
  9284. actually select it, the filter will faithfully do nothing.
  9285. @item a
  9286. Capture field order determined automatically by field flags, transfer
  9287. opposite.
  9288. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9289. basis using field flags. If no field information is available,
  9290. then this works just like @samp{u}.
  9291. @item u
  9292. Capture unknown or varying, transfer opposite.
  9293. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9294. analyzing the images and selecting the alternative that produces best
  9295. match between the fields.
  9296. @item T
  9297. Capture top-first, transfer unknown or varying.
  9298. Filter selects among @samp{t} and @samp{p} using image analysis.
  9299. @item B
  9300. Capture bottom-first, transfer unknown or varying.
  9301. Filter selects among @samp{b} and @samp{p} using image analysis.
  9302. @item A
  9303. Capture determined by field flags, transfer unknown or varying.
  9304. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9305. image analysis. If no field information is available, then this works just
  9306. like @samp{U}. This is the default mode.
  9307. @item U
  9308. Both capture and transfer unknown or varying.
  9309. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9310. @end table
  9311. @end table
  9312. @section pixdesctest
  9313. Pixel format descriptor test filter, mainly useful for internal
  9314. testing. The output video should be equal to the input video.
  9315. For example:
  9316. @example
  9317. format=monow, pixdesctest
  9318. @end example
  9319. can be used to test the monowhite pixel format descriptor definition.
  9320. @section pixscope
  9321. Display sample values of color channels. Mainly useful for checking color
  9322. and levels. Minimum supported resolution is 640x480.
  9323. The filters accept the following options:
  9324. @table @option
  9325. @item x
  9326. Set scope X position, relative offset on X axis.
  9327. @item y
  9328. Set scope Y position, relative offset on Y axis.
  9329. @item w
  9330. Set scope width.
  9331. @item h
  9332. Set scope height.
  9333. @item o
  9334. Set window opacity. This window also holds statistics about pixel area.
  9335. @item wx
  9336. Set window X position, relative offset on X axis.
  9337. @item wy
  9338. Set window Y position, relative offset on Y axis.
  9339. @end table
  9340. @section pp
  9341. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9342. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9343. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9344. Each subfilter and some options have a short and a long name that can be used
  9345. interchangeably, i.e. dr/dering are the same.
  9346. The filters accept the following options:
  9347. @table @option
  9348. @item subfilters
  9349. Set postprocessing subfilters string.
  9350. @end table
  9351. All subfilters share common options to determine their scope:
  9352. @table @option
  9353. @item a/autoq
  9354. Honor the quality commands for this subfilter.
  9355. @item c/chrom
  9356. Do chrominance filtering, too (default).
  9357. @item y/nochrom
  9358. Do luminance filtering only (no chrominance).
  9359. @item n/noluma
  9360. Do chrominance filtering only (no luminance).
  9361. @end table
  9362. These options can be appended after the subfilter name, separated by a '|'.
  9363. Available subfilters are:
  9364. @table @option
  9365. @item hb/hdeblock[|difference[|flatness]]
  9366. Horizontal deblocking filter
  9367. @table @option
  9368. @item difference
  9369. Difference factor where higher values mean more deblocking (default: @code{32}).
  9370. @item flatness
  9371. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9372. @end table
  9373. @item vb/vdeblock[|difference[|flatness]]
  9374. Vertical deblocking filter
  9375. @table @option
  9376. @item difference
  9377. Difference factor where higher values mean more deblocking (default: @code{32}).
  9378. @item flatness
  9379. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9380. @end table
  9381. @item ha/hadeblock[|difference[|flatness]]
  9382. Accurate horizontal deblocking filter
  9383. @table @option
  9384. @item difference
  9385. Difference factor where higher values mean more deblocking (default: @code{32}).
  9386. @item flatness
  9387. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9388. @end table
  9389. @item va/vadeblock[|difference[|flatness]]
  9390. Accurate vertical deblocking filter
  9391. @table @option
  9392. @item difference
  9393. Difference factor where higher values mean more deblocking (default: @code{32}).
  9394. @item flatness
  9395. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9396. @end table
  9397. @end table
  9398. The horizontal and vertical deblocking filters share the difference and
  9399. flatness values so you cannot set different horizontal and vertical
  9400. thresholds.
  9401. @table @option
  9402. @item h1/x1hdeblock
  9403. Experimental horizontal deblocking filter
  9404. @item v1/x1vdeblock
  9405. Experimental vertical deblocking filter
  9406. @item dr/dering
  9407. Deringing filter
  9408. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9409. @table @option
  9410. @item threshold1
  9411. larger -> stronger filtering
  9412. @item threshold2
  9413. larger -> stronger filtering
  9414. @item threshold3
  9415. larger -> stronger filtering
  9416. @end table
  9417. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9418. @table @option
  9419. @item f/fullyrange
  9420. Stretch luminance to @code{0-255}.
  9421. @end table
  9422. @item lb/linblenddeint
  9423. Linear blend deinterlacing filter that deinterlaces the given block by
  9424. filtering all lines with a @code{(1 2 1)} filter.
  9425. @item li/linipoldeint
  9426. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9427. linearly interpolating every second line.
  9428. @item ci/cubicipoldeint
  9429. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9430. cubically interpolating every second line.
  9431. @item md/mediandeint
  9432. Median deinterlacing filter that deinterlaces the given block by applying a
  9433. median filter to every second line.
  9434. @item fd/ffmpegdeint
  9435. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9436. second line with a @code{(-1 4 2 4 -1)} filter.
  9437. @item l5/lowpass5
  9438. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9439. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9440. @item fq/forceQuant[|quantizer]
  9441. Overrides the quantizer table from the input with the constant quantizer you
  9442. specify.
  9443. @table @option
  9444. @item quantizer
  9445. Quantizer to use
  9446. @end table
  9447. @item de/default
  9448. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9449. @item fa/fast
  9450. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9451. @item ac
  9452. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9453. @end table
  9454. @subsection Examples
  9455. @itemize
  9456. @item
  9457. Apply horizontal and vertical deblocking, deringing and automatic
  9458. brightness/contrast:
  9459. @example
  9460. pp=hb/vb/dr/al
  9461. @end example
  9462. @item
  9463. Apply default filters without brightness/contrast correction:
  9464. @example
  9465. pp=de/-al
  9466. @end example
  9467. @item
  9468. Apply default filters and temporal denoiser:
  9469. @example
  9470. pp=default/tmpnoise|1|2|3
  9471. @end example
  9472. @item
  9473. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9474. automatically depending on available CPU time:
  9475. @example
  9476. pp=hb|y/vb|a
  9477. @end example
  9478. @end itemize
  9479. @section pp7
  9480. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9481. similar to spp = 6 with 7 point DCT, where only the center sample is
  9482. used after IDCT.
  9483. The filter accepts the following options:
  9484. @table @option
  9485. @item qp
  9486. Force a constant quantization parameter. It accepts an integer in range
  9487. 0 to 63. If not set, the filter will use the QP from the video stream
  9488. (if available).
  9489. @item mode
  9490. Set thresholding mode. Available modes are:
  9491. @table @samp
  9492. @item hard
  9493. Set hard thresholding.
  9494. @item soft
  9495. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9496. @item medium
  9497. Set medium thresholding (good results, default).
  9498. @end table
  9499. @end table
  9500. @section premultiply
  9501. Apply alpha premultiply effect to input video stream using first plane
  9502. of second stream as alpha.
  9503. Both streams must have same dimensions and same pixel format.
  9504. The filter accepts the following option:
  9505. @table @option
  9506. @item planes
  9507. Set which planes will be processed, unprocessed planes will be copied.
  9508. By default value 0xf, all planes will be processed.
  9509. @item inplace
  9510. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9511. @end table
  9512. @section prewitt
  9513. Apply prewitt operator to input video stream.
  9514. The filter accepts the following option:
  9515. @table @option
  9516. @item planes
  9517. Set which planes will be processed, unprocessed planes will be copied.
  9518. By default value 0xf, all planes will be processed.
  9519. @item scale
  9520. Set value which will be multiplied with filtered result.
  9521. @item delta
  9522. Set value which will be added to filtered result.
  9523. @end table
  9524. @section pseudocolor
  9525. Alter frame colors in video with pseudocolors.
  9526. This filter accept the following options:
  9527. @table @option
  9528. @item c0
  9529. set pixel first component expression
  9530. @item c1
  9531. set pixel second component expression
  9532. @item c2
  9533. set pixel third component expression
  9534. @item c3
  9535. set pixel fourth component expression, corresponds to the alpha component
  9536. @item i
  9537. set component to use as base for altering colors
  9538. @end table
  9539. Each of them specifies the expression to use for computing the lookup table for
  9540. the corresponding pixel component values.
  9541. The expressions can contain the following constants and functions:
  9542. @table @option
  9543. @item w
  9544. @item h
  9545. The input width and height.
  9546. @item val
  9547. The input value for the pixel component.
  9548. @item ymin, umin, vmin, amin
  9549. The minimum allowed component value.
  9550. @item ymax, umax, vmax, amax
  9551. The maximum allowed component value.
  9552. @end table
  9553. All expressions default to "val".
  9554. @subsection Examples
  9555. @itemize
  9556. @item
  9557. Change too high luma values to gradient:
  9558. @example
  9559. 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'"
  9560. @end example
  9561. @end itemize
  9562. @section psnr
  9563. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9564. Ratio) between two input videos.
  9565. This filter takes in input two input videos, the first input is
  9566. considered the "main" source and is passed unchanged to the
  9567. output. The second input is used as a "reference" video for computing
  9568. the PSNR.
  9569. Both video inputs must have the same resolution and pixel format for
  9570. this filter to work correctly. Also it assumes that both inputs
  9571. have the same number of frames, which are compared one by one.
  9572. The obtained average PSNR is printed through the logging system.
  9573. The filter stores the accumulated MSE (mean squared error) of each
  9574. frame, and at the end of the processing it is averaged across all frames
  9575. equally, and the following formula is applied to obtain the PSNR:
  9576. @example
  9577. PSNR = 10*log10(MAX^2/MSE)
  9578. @end example
  9579. Where MAX is the average of the maximum values of each component of the
  9580. image.
  9581. The description of the accepted parameters follows.
  9582. @table @option
  9583. @item stats_file, f
  9584. If specified the filter will use the named file to save the PSNR of
  9585. each individual frame. When filename equals "-" the data is sent to
  9586. standard output.
  9587. @item stats_version
  9588. Specifies which version of the stats file format to use. Details of
  9589. each format are written below.
  9590. Default value is 1.
  9591. @item stats_add_max
  9592. Determines whether the max value is output to the stats log.
  9593. Default value is 0.
  9594. Requires stats_version >= 2. If this is set and stats_version < 2,
  9595. the filter will return an error.
  9596. @end table
  9597. This filter also supports the @ref{framesync} options.
  9598. The file printed if @var{stats_file} is selected, contains a sequence of
  9599. key/value pairs of the form @var{key}:@var{value} for each compared
  9600. couple of frames.
  9601. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9602. the list of per-frame-pair stats, with key value pairs following the frame
  9603. format with the following parameters:
  9604. @table @option
  9605. @item psnr_log_version
  9606. The version of the log file format. Will match @var{stats_version}.
  9607. @item fields
  9608. A comma separated list of the per-frame-pair parameters included in
  9609. the log.
  9610. @end table
  9611. A description of each shown per-frame-pair parameter follows:
  9612. @table @option
  9613. @item n
  9614. sequential number of the input frame, starting from 1
  9615. @item mse_avg
  9616. Mean Square Error pixel-by-pixel average difference of the compared
  9617. frames, averaged over all the image components.
  9618. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9619. Mean Square Error pixel-by-pixel average difference of the compared
  9620. frames for the component specified by the suffix.
  9621. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9622. Peak Signal to Noise ratio of the compared frames for the component
  9623. specified by the suffix.
  9624. @item max_avg, max_y, max_u, max_v
  9625. Maximum allowed value for each channel, and average over all
  9626. channels.
  9627. @end table
  9628. For example:
  9629. @example
  9630. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9631. [main][ref] psnr="stats_file=stats.log" [out]
  9632. @end example
  9633. On this example the input file being processed is compared with the
  9634. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9635. is stored in @file{stats.log}.
  9636. @anchor{pullup}
  9637. @section pullup
  9638. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9639. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9640. content.
  9641. The pullup filter is designed to take advantage of future context in making
  9642. its decisions. This filter is stateless in the sense that it does not lock
  9643. onto a pattern to follow, but it instead looks forward to the following
  9644. fields in order to identify matches and rebuild progressive frames.
  9645. To produce content with an even framerate, insert the fps filter after
  9646. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9647. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9648. The filter accepts the following options:
  9649. @table @option
  9650. @item jl
  9651. @item jr
  9652. @item jt
  9653. @item jb
  9654. These options set the amount of "junk" to ignore at the left, right, top, and
  9655. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9656. while top and bottom are in units of 2 lines.
  9657. The default is 8 pixels on each side.
  9658. @item sb
  9659. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9660. filter generating an occasional mismatched frame, but it may also cause an
  9661. excessive number of frames to be dropped during high motion sequences.
  9662. Conversely, setting it to -1 will make filter match fields more easily.
  9663. This may help processing of video where there is slight blurring between
  9664. the fields, but may also cause there to be interlaced frames in the output.
  9665. Default value is @code{0}.
  9666. @item mp
  9667. Set the metric plane to use. It accepts the following values:
  9668. @table @samp
  9669. @item l
  9670. Use luma plane.
  9671. @item u
  9672. Use chroma blue plane.
  9673. @item v
  9674. Use chroma red plane.
  9675. @end table
  9676. This option may be set to use chroma plane instead of the default luma plane
  9677. for doing filter's computations. This may improve accuracy on very clean
  9678. source material, but more likely will decrease accuracy, especially if there
  9679. is chroma noise (rainbow effect) or any grayscale video.
  9680. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9681. load and make pullup usable in realtime on slow machines.
  9682. @end table
  9683. For best results (without duplicated frames in the output file) it is
  9684. necessary to change the output frame rate. For example, to inverse
  9685. telecine NTSC input:
  9686. @example
  9687. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9688. @end example
  9689. @section qp
  9690. Change video quantization parameters (QP).
  9691. The filter accepts the following option:
  9692. @table @option
  9693. @item qp
  9694. Set expression for quantization parameter.
  9695. @end table
  9696. The expression is evaluated through the eval API and can contain, among others,
  9697. the following constants:
  9698. @table @var
  9699. @item known
  9700. 1 if index is not 129, 0 otherwise.
  9701. @item qp
  9702. Sequential index starting from -129 to 128.
  9703. @end table
  9704. @subsection Examples
  9705. @itemize
  9706. @item
  9707. Some equation like:
  9708. @example
  9709. qp=2+2*sin(PI*qp)
  9710. @end example
  9711. @end itemize
  9712. @section random
  9713. Flush video frames from internal cache of frames into a random order.
  9714. No frame is discarded.
  9715. Inspired by @ref{frei0r} nervous filter.
  9716. @table @option
  9717. @item frames
  9718. Set size in number of frames of internal cache, in range from @code{2} to
  9719. @code{512}. Default is @code{30}.
  9720. @item seed
  9721. Set seed for random number generator, must be an integer included between
  9722. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9723. less than @code{0}, the filter will try to use a good random seed on a
  9724. best effort basis.
  9725. @end table
  9726. @section readeia608
  9727. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9728. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9729. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9730. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9731. @table @option
  9732. @item lavfi.readeia608.X.cc
  9733. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9734. @item lavfi.readeia608.X.line
  9735. The number of the line on which the EIA-608 data was identified and read.
  9736. @end table
  9737. This filter accepts the following options:
  9738. @table @option
  9739. @item scan_min
  9740. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9741. @item scan_max
  9742. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9743. @item mac
  9744. Set minimal acceptable amplitude change for sync codes detection.
  9745. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9746. @item spw
  9747. Set the ratio of width reserved for sync code detection.
  9748. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9749. @item mhd
  9750. Set the max peaks height difference for sync code detection.
  9751. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9752. @item mpd
  9753. Set max peaks period difference for sync code detection.
  9754. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9755. @item msd
  9756. Set the first two max start code bits differences.
  9757. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9758. @item bhd
  9759. Set the minimum ratio of bits height compared to 3rd start code bit.
  9760. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9761. @item th_w
  9762. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9763. @item th_b
  9764. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9765. @item chp
  9766. Enable checking the parity bit. In the event of a parity error, the filter will output
  9767. @code{0x00} for that character. Default is false.
  9768. @end table
  9769. @subsection Examples
  9770. @itemize
  9771. @item
  9772. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9773. @example
  9774. 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
  9775. @end example
  9776. @end itemize
  9777. @section readvitc
  9778. Read vertical interval timecode (VITC) information from the top lines of a
  9779. video frame.
  9780. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9781. timecode value, if a valid timecode has been detected. Further metadata key
  9782. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9783. timecode data has been found or not.
  9784. This filter accepts the following options:
  9785. @table @option
  9786. @item scan_max
  9787. Set the maximum number of lines to scan for VITC data. If the value is set to
  9788. @code{-1} the full video frame is scanned. Default is @code{45}.
  9789. @item thr_b
  9790. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9791. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9792. @item thr_w
  9793. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9794. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9795. @end table
  9796. @subsection Examples
  9797. @itemize
  9798. @item
  9799. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9800. draw @code{--:--:--:--} as a placeholder:
  9801. @example
  9802. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9803. @end example
  9804. @end itemize
  9805. @section remap
  9806. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9807. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9808. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9809. value for pixel will be used for destination pixel.
  9810. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9811. will have Xmap/Ymap video stream dimensions.
  9812. Xmap and Ymap input video streams are 16bit depth, single channel.
  9813. @section removegrain
  9814. The removegrain filter is a spatial denoiser for progressive video.
  9815. @table @option
  9816. @item m0
  9817. Set mode for the first plane.
  9818. @item m1
  9819. Set mode for the second plane.
  9820. @item m2
  9821. Set mode for the third plane.
  9822. @item m3
  9823. Set mode for the fourth plane.
  9824. @end table
  9825. Range of mode is from 0 to 24. Description of each mode follows:
  9826. @table @var
  9827. @item 0
  9828. Leave input plane unchanged. Default.
  9829. @item 1
  9830. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9831. @item 2
  9832. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9833. @item 3
  9834. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9835. @item 4
  9836. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9837. This is equivalent to a median filter.
  9838. @item 5
  9839. Line-sensitive clipping giving the minimal change.
  9840. @item 6
  9841. Line-sensitive clipping, intermediate.
  9842. @item 7
  9843. Line-sensitive clipping, intermediate.
  9844. @item 8
  9845. Line-sensitive clipping, intermediate.
  9846. @item 9
  9847. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9848. @item 10
  9849. Replaces the target pixel with the closest neighbour.
  9850. @item 11
  9851. [1 2 1] horizontal and vertical kernel blur.
  9852. @item 12
  9853. Same as mode 11.
  9854. @item 13
  9855. Bob mode, interpolates top field from the line where the neighbours
  9856. pixels are the closest.
  9857. @item 14
  9858. Bob mode, interpolates bottom field from the line where the neighbours
  9859. pixels are the closest.
  9860. @item 15
  9861. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9862. interpolation formula.
  9863. @item 16
  9864. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9865. interpolation formula.
  9866. @item 17
  9867. Clips the pixel with the minimum and maximum of respectively the maximum and
  9868. minimum of each pair of opposite neighbour pixels.
  9869. @item 18
  9870. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9871. the current pixel is minimal.
  9872. @item 19
  9873. Replaces the pixel with the average of its 8 neighbours.
  9874. @item 20
  9875. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9876. @item 21
  9877. Clips pixels using the averages of opposite neighbour.
  9878. @item 22
  9879. Same as mode 21 but simpler and faster.
  9880. @item 23
  9881. Small edge and halo removal, but reputed useless.
  9882. @item 24
  9883. Similar as 23.
  9884. @end table
  9885. @section removelogo
  9886. Suppress a TV station logo, using an image file to determine which
  9887. pixels comprise the logo. It works by filling in the pixels that
  9888. comprise the logo with neighboring pixels.
  9889. The filter accepts the following options:
  9890. @table @option
  9891. @item filename, f
  9892. Set the filter bitmap file, which can be any image format supported by
  9893. libavformat. The width and height of the image file must match those of the
  9894. video stream being processed.
  9895. @end table
  9896. Pixels in the provided bitmap image with a value of zero are not
  9897. considered part of the logo, non-zero pixels are considered part of
  9898. the logo. If you use white (255) for the logo and black (0) for the
  9899. rest, you will be safe. For making the filter bitmap, it is
  9900. recommended to take a screen capture of a black frame with the logo
  9901. visible, and then using a threshold filter followed by the erode
  9902. filter once or twice.
  9903. If needed, little splotches can be fixed manually. Remember that if
  9904. logo pixels are not covered, the filter quality will be much
  9905. reduced. Marking too many pixels as part of the logo does not hurt as
  9906. much, but it will increase the amount of blurring needed to cover over
  9907. the image and will destroy more information than necessary, and extra
  9908. pixels will slow things down on a large logo.
  9909. @section repeatfields
  9910. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9911. fields based on its value.
  9912. @section reverse
  9913. Reverse a video clip.
  9914. Warning: This filter requires memory to buffer the entire clip, so trimming
  9915. is suggested.
  9916. @subsection Examples
  9917. @itemize
  9918. @item
  9919. Take the first 5 seconds of a clip, and reverse it.
  9920. @example
  9921. trim=end=5,reverse
  9922. @end example
  9923. @end itemize
  9924. @section roberts
  9925. Apply roberts cross operator to input video stream.
  9926. The filter accepts the following option:
  9927. @table @option
  9928. @item planes
  9929. Set which planes will be processed, unprocessed planes will be copied.
  9930. By default value 0xf, all planes will be processed.
  9931. @item scale
  9932. Set value which will be multiplied with filtered result.
  9933. @item delta
  9934. Set value which will be added to filtered result.
  9935. @end table
  9936. @section rotate
  9937. Rotate video by an arbitrary angle expressed in radians.
  9938. The filter accepts the following options:
  9939. A description of the optional parameters follows.
  9940. @table @option
  9941. @item angle, a
  9942. Set an expression for the angle by which to rotate the input video
  9943. clockwise, expressed as a number of radians. A negative value will
  9944. result in a counter-clockwise rotation. By default it is set to "0".
  9945. This expression is evaluated for each frame.
  9946. @item out_w, ow
  9947. Set the output width expression, default value is "iw".
  9948. This expression is evaluated just once during configuration.
  9949. @item out_h, oh
  9950. Set the output height expression, default value is "ih".
  9951. This expression is evaluated just once during configuration.
  9952. @item bilinear
  9953. Enable bilinear interpolation if set to 1, a value of 0 disables
  9954. it. Default value is 1.
  9955. @item fillcolor, c
  9956. Set the color used to fill the output area not covered by the rotated
  9957. image. For the general syntax of this option, check the "Color" section in the
  9958. ffmpeg-utils manual. If the special value "none" is selected then no
  9959. background is printed (useful for example if the background is never shown).
  9960. Default value is "black".
  9961. @end table
  9962. The expressions for the angle and the output size can contain the
  9963. following constants and functions:
  9964. @table @option
  9965. @item n
  9966. sequential number of the input frame, starting from 0. It is always NAN
  9967. before the first frame is filtered.
  9968. @item t
  9969. time in seconds of the input frame, it is set to 0 when the filter is
  9970. configured. It is always NAN before the first frame is filtered.
  9971. @item hsub
  9972. @item vsub
  9973. horizontal and vertical chroma subsample values. For example for the
  9974. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9975. @item in_w, iw
  9976. @item in_h, ih
  9977. the input video width and height
  9978. @item out_w, ow
  9979. @item out_h, oh
  9980. the output width and height, that is the size of the padded area as
  9981. specified by the @var{width} and @var{height} expressions
  9982. @item rotw(a)
  9983. @item roth(a)
  9984. the minimal width/height required for completely containing the input
  9985. video rotated by @var{a} radians.
  9986. These are only available when computing the @option{out_w} and
  9987. @option{out_h} expressions.
  9988. @end table
  9989. @subsection Examples
  9990. @itemize
  9991. @item
  9992. Rotate the input by PI/6 radians clockwise:
  9993. @example
  9994. rotate=PI/6
  9995. @end example
  9996. @item
  9997. Rotate the input by PI/6 radians counter-clockwise:
  9998. @example
  9999. rotate=-PI/6
  10000. @end example
  10001. @item
  10002. Rotate the input by 45 degrees clockwise:
  10003. @example
  10004. rotate=45*PI/180
  10005. @end example
  10006. @item
  10007. Apply a constant rotation with period T, starting from an angle of PI/3:
  10008. @example
  10009. rotate=PI/3+2*PI*t/T
  10010. @end example
  10011. @item
  10012. Make the input video rotation oscillating with a period of T
  10013. seconds and an amplitude of A radians:
  10014. @example
  10015. rotate=A*sin(2*PI/T*t)
  10016. @end example
  10017. @item
  10018. Rotate the video, output size is chosen so that the whole rotating
  10019. input video is always completely contained in the output:
  10020. @example
  10021. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10022. @end example
  10023. @item
  10024. Rotate the video, reduce the output size so that no background is ever
  10025. shown:
  10026. @example
  10027. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10028. @end example
  10029. @end itemize
  10030. @subsection Commands
  10031. The filter supports the following commands:
  10032. @table @option
  10033. @item a, angle
  10034. Set the angle expression.
  10035. The command accepts the same syntax of the corresponding option.
  10036. If the specified expression is not valid, it is kept at its current
  10037. value.
  10038. @end table
  10039. @section sab
  10040. Apply Shape Adaptive Blur.
  10041. The filter accepts the following options:
  10042. @table @option
  10043. @item luma_radius, lr
  10044. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10045. value is 1.0. A greater value will result in a more blurred image, and
  10046. in slower processing.
  10047. @item luma_pre_filter_radius, lpfr
  10048. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10049. value is 1.0.
  10050. @item luma_strength, ls
  10051. Set luma maximum difference between pixels to still be considered, must
  10052. be a value in the 0.1-100.0 range, default value is 1.0.
  10053. @item chroma_radius, cr
  10054. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10055. greater value will result in a more blurred image, and in slower
  10056. processing.
  10057. @item chroma_pre_filter_radius, cpfr
  10058. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10059. @item chroma_strength, cs
  10060. Set chroma maximum difference between pixels to still be considered,
  10061. must be a value in the -0.9-100.0 range.
  10062. @end table
  10063. Each chroma option value, if not explicitly specified, is set to the
  10064. corresponding luma option value.
  10065. @anchor{scale}
  10066. @section scale
  10067. Scale (resize) the input video, using the libswscale library.
  10068. The scale filter forces the output display aspect ratio to be the same
  10069. of the input, by changing the output sample aspect ratio.
  10070. If the input image format is different from the format requested by
  10071. the next filter, the scale filter will convert the input to the
  10072. requested format.
  10073. @subsection Options
  10074. The filter accepts the following options, or any of the options
  10075. supported by the libswscale scaler.
  10076. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10077. the complete list of scaler options.
  10078. @table @option
  10079. @item width, w
  10080. @item height, h
  10081. Set the output video dimension expression. Default value is the input
  10082. dimension.
  10083. If the @var{width} or @var{w} value is 0, the input width is used for
  10084. the output. If the @var{height} or @var{h} value is 0, the input height
  10085. is used for the output.
  10086. If one and only one of the values is -n with n >= 1, the scale filter
  10087. will use a value that maintains the aspect ratio of the input image,
  10088. calculated from the other specified dimension. After that it will,
  10089. however, make sure that the calculated dimension is divisible by n and
  10090. adjust the value if necessary.
  10091. If both values are -n with n >= 1, the behavior will be identical to
  10092. both values being set to 0 as previously detailed.
  10093. See below for the list of accepted constants for use in the dimension
  10094. expression.
  10095. @item eval
  10096. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10097. @table @samp
  10098. @item init
  10099. Only evaluate expressions once during the filter initialization or when a command is processed.
  10100. @item frame
  10101. Evaluate expressions for each incoming frame.
  10102. @end table
  10103. Default value is @samp{init}.
  10104. @item interl
  10105. Set the interlacing mode. It accepts the following values:
  10106. @table @samp
  10107. @item 1
  10108. Force interlaced aware scaling.
  10109. @item 0
  10110. Do not apply interlaced scaling.
  10111. @item -1
  10112. Select interlaced aware scaling depending on whether the source frames
  10113. are flagged as interlaced or not.
  10114. @end table
  10115. Default value is @samp{0}.
  10116. @item flags
  10117. Set libswscale scaling flags. See
  10118. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10119. complete list of values. If not explicitly specified the filter applies
  10120. the default flags.
  10121. @item param0, param1
  10122. Set libswscale input parameters for scaling algorithms that need them. See
  10123. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10124. complete documentation. If not explicitly specified the filter applies
  10125. empty parameters.
  10126. @item size, s
  10127. Set the video size. For the syntax of this option, check the
  10128. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10129. @item in_color_matrix
  10130. @item out_color_matrix
  10131. Set in/output YCbCr color space type.
  10132. This allows the autodetected value to be overridden as well as allows forcing
  10133. a specific value used for the output and encoder.
  10134. If not specified, the color space type depends on the pixel format.
  10135. Possible values:
  10136. @table @samp
  10137. @item auto
  10138. Choose automatically.
  10139. @item bt709
  10140. Format conforming to International Telecommunication Union (ITU)
  10141. Recommendation BT.709.
  10142. @item fcc
  10143. Set color space conforming to the United States Federal Communications
  10144. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10145. @item bt601
  10146. Set color space conforming to:
  10147. @itemize
  10148. @item
  10149. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10150. @item
  10151. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10152. @item
  10153. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10154. @end itemize
  10155. @item smpte240m
  10156. Set color space conforming to SMPTE ST 240:1999.
  10157. @end table
  10158. @item in_range
  10159. @item out_range
  10160. Set in/output YCbCr sample range.
  10161. This allows the autodetected value to be overridden as well as allows forcing
  10162. a specific value used for the output and encoder. If not specified, the
  10163. range depends on the pixel format. Possible values:
  10164. @table @samp
  10165. @item auto/unknown
  10166. Choose automatically.
  10167. @item jpeg/full/pc
  10168. Set full range (0-255 in case of 8-bit luma).
  10169. @item mpeg/limited/tv
  10170. Set "MPEG" range (16-235 in case of 8-bit luma).
  10171. @end table
  10172. @item force_original_aspect_ratio
  10173. Enable decreasing or increasing output video width or height if necessary to
  10174. keep the original aspect ratio. Possible values:
  10175. @table @samp
  10176. @item disable
  10177. Scale the video as specified and disable this feature.
  10178. @item decrease
  10179. The output video dimensions will automatically be decreased if needed.
  10180. @item increase
  10181. The output video dimensions will automatically be increased if needed.
  10182. @end table
  10183. One useful instance of this option is that when you know a specific device's
  10184. maximum allowed resolution, you can use this to limit the output video to
  10185. that, while retaining the aspect ratio. For example, device A allows
  10186. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10187. decrease) and specifying 1280x720 to the command line makes the output
  10188. 1280x533.
  10189. Please note that this is a different thing than specifying -1 for @option{w}
  10190. or @option{h}, you still need to specify the output resolution for this option
  10191. to work.
  10192. @end table
  10193. The values of the @option{w} and @option{h} options are expressions
  10194. containing the following constants:
  10195. @table @var
  10196. @item in_w
  10197. @item in_h
  10198. The input width and height
  10199. @item iw
  10200. @item ih
  10201. These are the same as @var{in_w} and @var{in_h}.
  10202. @item out_w
  10203. @item out_h
  10204. The output (scaled) width and height
  10205. @item ow
  10206. @item oh
  10207. These are the same as @var{out_w} and @var{out_h}
  10208. @item a
  10209. The same as @var{iw} / @var{ih}
  10210. @item sar
  10211. input sample aspect ratio
  10212. @item dar
  10213. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10214. @item hsub
  10215. @item vsub
  10216. horizontal and vertical input chroma subsample values. For example for the
  10217. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10218. @item ohsub
  10219. @item ovsub
  10220. horizontal and vertical output chroma subsample values. For example for the
  10221. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10222. @end table
  10223. @subsection Examples
  10224. @itemize
  10225. @item
  10226. Scale the input video to a size of 200x100
  10227. @example
  10228. scale=w=200:h=100
  10229. @end example
  10230. This is equivalent to:
  10231. @example
  10232. scale=200:100
  10233. @end example
  10234. or:
  10235. @example
  10236. scale=200x100
  10237. @end example
  10238. @item
  10239. Specify a size abbreviation for the output size:
  10240. @example
  10241. scale=qcif
  10242. @end example
  10243. which can also be written as:
  10244. @example
  10245. scale=size=qcif
  10246. @end example
  10247. @item
  10248. Scale the input to 2x:
  10249. @example
  10250. scale=w=2*iw:h=2*ih
  10251. @end example
  10252. @item
  10253. The above is the same as:
  10254. @example
  10255. scale=2*in_w:2*in_h
  10256. @end example
  10257. @item
  10258. Scale the input to 2x with forced interlaced scaling:
  10259. @example
  10260. scale=2*iw:2*ih:interl=1
  10261. @end example
  10262. @item
  10263. Scale the input to half size:
  10264. @example
  10265. scale=w=iw/2:h=ih/2
  10266. @end example
  10267. @item
  10268. Increase the width, and set the height to the same size:
  10269. @example
  10270. scale=3/2*iw:ow
  10271. @end example
  10272. @item
  10273. Seek Greek harmony:
  10274. @example
  10275. scale=iw:1/PHI*iw
  10276. scale=ih*PHI:ih
  10277. @end example
  10278. @item
  10279. Increase the height, and set the width to 3/2 of the height:
  10280. @example
  10281. scale=w=3/2*oh:h=3/5*ih
  10282. @end example
  10283. @item
  10284. Increase the size, making the size a multiple of the chroma
  10285. subsample values:
  10286. @example
  10287. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10288. @end example
  10289. @item
  10290. Increase the width to a maximum of 500 pixels,
  10291. keeping the same aspect ratio as the input:
  10292. @example
  10293. scale=w='min(500\, iw*3/2):h=-1'
  10294. @end example
  10295. @end itemize
  10296. @subsection Commands
  10297. This filter supports the following commands:
  10298. @table @option
  10299. @item width, w
  10300. @item height, h
  10301. Set the output video dimension expression.
  10302. The command accepts the same syntax of the corresponding option.
  10303. If the specified expression is not valid, it is kept at its current
  10304. value.
  10305. @end table
  10306. @section scale_npp
  10307. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10308. format conversion on CUDA video frames. Setting the output width and height
  10309. works in the same way as for the @var{scale} filter.
  10310. The following additional options are accepted:
  10311. @table @option
  10312. @item format
  10313. The pixel format of the output CUDA frames. If set to the string "same" (the
  10314. default), the input format will be kept. Note that automatic format negotiation
  10315. and conversion is not yet supported for hardware frames
  10316. @item interp_algo
  10317. The interpolation algorithm used for resizing. One of the following:
  10318. @table @option
  10319. @item nn
  10320. Nearest neighbour.
  10321. @item linear
  10322. @item cubic
  10323. @item cubic2p_bspline
  10324. 2-parameter cubic (B=1, C=0)
  10325. @item cubic2p_catmullrom
  10326. 2-parameter cubic (B=0, C=1/2)
  10327. @item cubic2p_b05c03
  10328. 2-parameter cubic (B=1/2, C=3/10)
  10329. @item super
  10330. Supersampling
  10331. @item lanczos
  10332. @end table
  10333. @end table
  10334. @section scale2ref
  10335. Scale (resize) the input video, based on a reference video.
  10336. See the scale filter for available options, scale2ref supports the same but
  10337. uses the reference video instead of the main input as basis. scale2ref also
  10338. supports the following additional constants for the @option{w} and
  10339. @option{h} options:
  10340. @table @var
  10341. @item main_w
  10342. @item main_h
  10343. The main input video's width and height
  10344. @item main_a
  10345. The same as @var{main_w} / @var{main_h}
  10346. @item main_sar
  10347. The main input video's sample aspect ratio
  10348. @item main_dar, mdar
  10349. The main input video's display aspect ratio. Calculated from
  10350. @code{(main_w / main_h) * main_sar}.
  10351. @item main_hsub
  10352. @item main_vsub
  10353. The main input video's horizontal and vertical chroma subsample values.
  10354. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10355. is 1.
  10356. @end table
  10357. @subsection Examples
  10358. @itemize
  10359. @item
  10360. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10361. @example
  10362. 'scale2ref[b][a];[a][b]overlay'
  10363. @end example
  10364. @end itemize
  10365. @anchor{selectivecolor}
  10366. @section selectivecolor
  10367. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10368. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10369. by the "purity" of the color (that is, how saturated it already is).
  10370. This filter is similar to the Adobe Photoshop Selective Color tool.
  10371. The filter accepts the following options:
  10372. @table @option
  10373. @item correction_method
  10374. Select color correction method.
  10375. Available values are:
  10376. @table @samp
  10377. @item absolute
  10378. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10379. component value).
  10380. @item relative
  10381. Specified adjustments are relative to the original component value.
  10382. @end table
  10383. Default is @code{absolute}.
  10384. @item reds
  10385. Adjustments for red pixels (pixels where the red component is the maximum)
  10386. @item yellows
  10387. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10388. @item greens
  10389. Adjustments for green pixels (pixels where the green component is the maximum)
  10390. @item cyans
  10391. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10392. @item blues
  10393. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10394. @item magentas
  10395. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10396. @item whites
  10397. Adjustments for white pixels (pixels where all components are greater than 128)
  10398. @item neutrals
  10399. Adjustments for all pixels except pure black and pure white
  10400. @item blacks
  10401. Adjustments for black pixels (pixels where all components are lesser than 128)
  10402. @item psfile
  10403. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10404. @end table
  10405. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10406. 4 space separated floating point adjustment values in the [-1,1] range,
  10407. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10408. pixels of its range.
  10409. @subsection Examples
  10410. @itemize
  10411. @item
  10412. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10413. increase magenta by 27% in blue areas:
  10414. @example
  10415. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10416. @end example
  10417. @item
  10418. Use a Photoshop selective color preset:
  10419. @example
  10420. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10421. @end example
  10422. @end itemize
  10423. @anchor{separatefields}
  10424. @section separatefields
  10425. The @code{separatefields} takes a frame-based video input and splits
  10426. each frame into its components fields, producing a new half height clip
  10427. with twice the frame rate and twice the frame count.
  10428. This filter use field-dominance information in frame to decide which
  10429. of each pair of fields to place first in the output.
  10430. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10431. @section setdar, setsar
  10432. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10433. output video.
  10434. This is done by changing the specified Sample (aka Pixel) Aspect
  10435. Ratio, according to the following equation:
  10436. @example
  10437. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10438. @end example
  10439. Keep in mind that the @code{setdar} filter does not modify the pixel
  10440. dimensions of the video frame. Also, the display aspect ratio set by
  10441. this filter may be changed by later filters in the filterchain,
  10442. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10443. applied.
  10444. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10445. the filter output video.
  10446. Note that as a consequence of the application of this filter, the
  10447. output display aspect ratio will change according to the equation
  10448. above.
  10449. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10450. filter may be changed by later filters in the filterchain, e.g. if
  10451. another "setsar" or a "setdar" filter is applied.
  10452. It accepts the following parameters:
  10453. @table @option
  10454. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10455. Set the aspect ratio used by the filter.
  10456. The parameter can be a floating point number string, an expression, or
  10457. a string of the form @var{num}:@var{den}, where @var{num} and
  10458. @var{den} are the numerator and denominator of the aspect ratio. If
  10459. the parameter is not specified, it is assumed the value "0".
  10460. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10461. should be escaped.
  10462. @item max
  10463. Set the maximum integer value to use for expressing numerator and
  10464. denominator when reducing the expressed aspect ratio to a rational.
  10465. Default value is @code{100}.
  10466. @end table
  10467. The parameter @var{sar} is an expression containing
  10468. the following constants:
  10469. @table @option
  10470. @item E, PI, PHI
  10471. These are approximated values for the mathematical constants e
  10472. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10473. @item w, h
  10474. The input width and height.
  10475. @item a
  10476. These are the same as @var{w} / @var{h}.
  10477. @item sar
  10478. The input sample aspect ratio.
  10479. @item dar
  10480. The input display aspect ratio. It is the same as
  10481. (@var{w} / @var{h}) * @var{sar}.
  10482. @item hsub, vsub
  10483. Horizontal and vertical chroma subsample values. For example, for the
  10484. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10485. @end table
  10486. @subsection Examples
  10487. @itemize
  10488. @item
  10489. To change the display aspect ratio to 16:9, specify one of the following:
  10490. @example
  10491. setdar=dar=1.77777
  10492. setdar=dar=16/9
  10493. @end example
  10494. @item
  10495. To change the sample aspect ratio to 10:11, specify:
  10496. @example
  10497. setsar=sar=10/11
  10498. @end example
  10499. @item
  10500. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10501. 1000 in the aspect ratio reduction, use the command:
  10502. @example
  10503. setdar=ratio=16/9:max=1000
  10504. @end example
  10505. @end itemize
  10506. @anchor{setfield}
  10507. @section setfield
  10508. Force field for the output video frame.
  10509. The @code{setfield} filter marks the interlace type field for the
  10510. output frames. It does not change the input frame, but only sets the
  10511. corresponding property, which affects how the frame is treated by
  10512. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10513. The filter accepts the following options:
  10514. @table @option
  10515. @item mode
  10516. Available values are:
  10517. @table @samp
  10518. @item auto
  10519. Keep the same field property.
  10520. @item bff
  10521. Mark the frame as bottom-field-first.
  10522. @item tff
  10523. Mark the frame as top-field-first.
  10524. @item prog
  10525. Mark the frame as progressive.
  10526. @end table
  10527. @end table
  10528. @section showinfo
  10529. Show a line containing various information for each input video frame.
  10530. The input video is not modified.
  10531. The shown line contains a sequence of key/value pairs of the form
  10532. @var{key}:@var{value}.
  10533. The following values are shown in the output:
  10534. @table @option
  10535. @item n
  10536. The (sequential) number of the input frame, starting from 0.
  10537. @item pts
  10538. The Presentation TimeStamp of the input frame, expressed as a number of
  10539. time base units. The time base unit depends on the filter input pad.
  10540. @item pts_time
  10541. The Presentation TimeStamp of the input frame, expressed as a number of
  10542. seconds.
  10543. @item pos
  10544. The position of the frame in the input stream, or -1 if this information is
  10545. unavailable and/or meaningless (for example in case of synthetic video).
  10546. @item fmt
  10547. The pixel format name.
  10548. @item sar
  10549. The sample aspect ratio of the input frame, expressed in the form
  10550. @var{num}/@var{den}.
  10551. @item s
  10552. The size of the input frame. For the syntax of this option, check the
  10553. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10554. @item i
  10555. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10556. for bottom field first).
  10557. @item iskey
  10558. This is 1 if the frame is a key frame, 0 otherwise.
  10559. @item type
  10560. The picture type of the input frame ("I" for an I-frame, "P" for a
  10561. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10562. Also refer to the documentation of the @code{AVPictureType} enum and of
  10563. the @code{av_get_picture_type_char} function defined in
  10564. @file{libavutil/avutil.h}.
  10565. @item checksum
  10566. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10567. @item plane_checksum
  10568. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10569. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10570. @end table
  10571. @section showpalette
  10572. Displays the 256 colors palette of each frame. This filter is only relevant for
  10573. @var{pal8} pixel format frames.
  10574. It accepts the following option:
  10575. @table @option
  10576. @item s
  10577. Set the size of the box used to represent one palette color entry. Default is
  10578. @code{30} (for a @code{30x30} pixel box).
  10579. @end table
  10580. @section shuffleframes
  10581. Reorder and/or duplicate and/or drop video frames.
  10582. It accepts the following parameters:
  10583. @table @option
  10584. @item mapping
  10585. Set the destination indexes of input frames.
  10586. This is space or '|' separated list of indexes that maps input frames to output
  10587. frames. Number of indexes also sets maximal value that each index may have.
  10588. '-1' index have special meaning and that is to drop frame.
  10589. @end table
  10590. The first frame has the index 0. The default is to keep the input unchanged.
  10591. @subsection Examples
  10592. @itemize
  10593. @item
  10594. Swap second and third frame of every three frames of the input:
  10595. @example
  10596. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10597. @end example
  10598. @item
  10599. Swap 10th and 1st frame of every ten frames of the input:
  10600. @example
  10601. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10602. @end example
  10603. @end itemize
  10604. @section shuffleplanes
  10605. Reorder and/or duplicate video planes.
  10606. It accepts the following parameters:
  10607. @table @option
  10608. @item map0
  10609. The index of the input plane to be used as the first output plane.
  10610. @item map1
  10611. The index of the input plane to be used as the second output plane.
  10612. @item map2
  10613. The index of the input plane to be used as the third output plane.
  10614. @item map3
  10615. The index of the input plane to be used as the fourth output plane.
  10616. @end table
  10617. The first plane has the index 0. The default is to keep the input unchanged.
  10618. @subsection Examples
  10619. @itemize
  10620. @item
  10621. Swap the second and third planes of the input:
  10622. @example
  10623. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10624. @end example
  10625. @end itemize
  10626. @anchor{signalstats}
  10627. @section signalstats
  10628. Evaluate various visual metrics that assist in determining issues associated
  10629. with the digitization of analog video media.
  10630. By default the filter will log these metadata values:
  10631. @table @option
  10632. @item YMIN
  10633. Display the minimal Y value contained within the input frame. Expressed in
  10634. range of [0-255].
  10635. @item YLOW
  10636. Display the Y value at the 10% percentile within the input frame. Expressed in
  10637. range of [0-255].
  10638. @item YAVG
  10639. Display the average Y value within the input frame. Expressed in range of
  10640. [0-255].
  10641. @item YHIGH
  10642. Display the Y value at the 90% percentile within the input frame. Expressed in
  10643. range of [0-255].
  10644. @item YMAX
  10645. Display the maximum Y value contained within the input frame. Expressed in
  10646. range of [0-255].
  10647. @item UMIN
  10648. Display the minimal U value contained within the input frame. Expressed in
  10649. range of [0-255].
  10650. @item ULOW
  10651. Display the U value at the 10% percentile within the input frame. Expressed in
  10652. range of [0-255].
  10653. @item UAVG
  10654. Display the average U value within the input frame. Expressed in range of
  10655. [0-255].
  10656. @item UHIGH
  10657. Display the U value at the 90% percentile within the input frame. Expressed in
  10658. range of [0-255].
  10659. @item UMAX
  10660. Display the maximum U value contained within the input frame. Expressed in
  10661. range of [0-255].
  10662. @item VMIN
  10663. Display the minimal V value contained within the input frame. Expressed in
  10664. range of [0-255].
  10665. @item VLOW
  10666. Display the V value at the 10% percentile within the input frame. Expressed in
  10667. range of [0-255].
  10668. @item VAVG
  10669. Display the average V value within the input frame. Expressed in range of
  10670. [0-255].
  10671. @item VHIGH
  10672. Display the V value at the 90% percentile within the input frame. Expressed in
  10673. range of [0-255].
  10674. @item VMAX
  10675. Display the maximum V value contained within the input frame. Expressed in
  10676. range of [0-255].
  10677. @item SATMIN
  10678. Display the minimal saturation value contained within the input frame.
  10679. Expressed in range of [0-~181.02].
  10680. @item SATLOW
  10681. Display the saturation value at the 10% percentile within the input frame.
  10682. Expressed in range of [0-~181.02].
  10683. @item SATAVG
  10684. Display the average saturation value within the input frame. Expressed in range
  10685. of [0-~181.02].
  10686. @item SATHIGH
  10687. Display the saturation value at the 90% percentile within the input frame.
  10688. Expressed in range of [0-~181.02].
  10689. @item SATMAX
  10690. Display the maximum saturation value contained within the input frame.
  10691. Expressed in range of [0-~181.02].
  10692. @item HUEMED
  10693. Display the median value for hue within the input frame. Expressed in range of
  10694. [0-360].
  10695. @item HUEAVG
  10696. Display the average value for hue within the input frame. Expressed in range of
  10697. [0-360].
  10698. @item YDIF
  10699. Display the average of sample value difference between all values of the Y
  10700. plane in the current frame and corresponding values of the previous input frame.
  10701. Expressed in range of [0-255].
  10702. @item UDIF
  10703. Display the average of sample value difference between all values of the U
  10704. plane in the current frame and corresponding values of the previous input frame.
  10705. Expressed in range of [0-255].
  10706. @item VDIF
  10707. Display the average of sample value difference between all values of the V
  10708. plane in the current frame and corresponding values of the previous input frame.
  10709. Expressed in range of [0-255].
  10710. @item YBITDEPTH
  10711. Display bit depth of Y plane in current frame.
  10712. Expressed in range of [0-16].
  10713. @item UBITDEPTH
  10714. Display bit depth of U plane in current frame.
  10715. Expressed in range of [0-16].
  10716. @item VBITDEPTH
  10717. Display bit depth of V plane in current frame.
  10718. Expressed in range of [0-16].
  10719. @end table
  10720. The filter accepts the following options:
  10721. @table @option
  10722. @item stat
  10723. @item out
  10724. @option{stat} specify an additional form of image analysis.
  10725. @option{out} output video with the specified type of pixel highlighted.
  10726. Both options accept the following values:
  10727. @table @samp
  10728. @item tout
  10729. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10730. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10731. include the results of video dropouts, head clogs, or tape tracking issues.
  10732. @item vrep
  10733. Identify @var{vertical line repetition}. Vertical line repetition includes
  10734. similar rows of pixels within a frame. In born-digital video vertical line
  10735. repetition is common, but this pattern is uncommon in video digitized from an
  10736. analog source. When it occurs in video that results from the digitization of an
  10737. analog source it can indicate concealment from a dropout compensator.
  10738. @item brng
  10739. Identify pixels that fall outside of legal broadcast range.
  10740. @end table
  10741. @item color, c
  10742. Set the highlight color for the @option{out} option. The default color is
  10743. yellow.
  10744. @end table
  10745. @subsection Examples
  10746. @itemize
  10747. @item
  10748. Output data of various video metrics:
  10749. @example
  10750. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10751. @end example
  10752. @item
  10753. Output specific data about the minimum and maximum values of the Y plane per frame:
  10754. @example
  10755. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10756. @end example
  10757. @item
  10758. Playback video while highlighting pixels that are outside of broadcast range in red.
  10759. @example
  10760. ffplay example.mov -vf signalstats="out=brng:color=red"
  10761. @end example
  10762. @item
  10763. Playback video with signalstats metadata drawn over the frame.
  10764. @example
  10765. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10766. @end example
  10767. The contents of signalstat_drawtext.txt used in the command are:
  10768. @example
  10769. time %@{pts:hms@}
  10770. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10771. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10772. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10773. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10774. @end example
  10775. @end itemize
  10776. @anchor{signature}
  10777. @section signature
  10778. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10779. input. In this case the matching between the inputs can be calculated additionally.
  10780. The filter always passes through the first input. The signature of each stream can
  10781. be written into a file.
  10782. It accepts the following options:
  10783. @table @option
  10784. @item detectmode
  10785. Enable or disable the matching process.
  10786. Available values are:
  10787. @table @samp
  10788. @item off
  10789. Disable the calculation of a matching (default).
  10790. @item full
  10791. Calculate the matching for the whole video and output whether the whole video
  10792. matches or only parts.
  10793. @item fast
  10794. Calculate only until a matching is found or the video ends. Should be faster in
  10795. some cases.
  10796. @end table
  10797. @item nb_inputs
  10798. Set the number of inputs. The option value must be a non negative integer.
  10799. Default value is 1.
  10800. @item filename
  10801. Set the path to which the output is written. If there is more than one input,
  10802. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10803. integer), that will be replaced with the input number. If no filename is
  10804. specified, no output will be written. This is the default.
  10805. @item format
  10806. Choose the output format.
  10807. Available values are:
  10808. @table @samp
  10809. @item binary
  10810. Use the specified binary representation (default).
  10811. @item xml
  10812. Use the specified xml representation.
  10813. @end table
  10814. @item th_d
  10815. Set threshold to detect one word as similar. The option value must be an integer
  10816. greater than zero. The default value is 9000.
  10817. @item th_dc
  10818. Set threshold to detect all words as similar. The option value must be an integer
  10819. greater than zero. The default value is 60000.
  10820. @item th_xh
  10821. Set threshold to detect frames as similar. The option value must be an integer
  10822. greater than zero. The default value is 116.
  10823. @item th_di
  10824. Set the minimum length of a sequence in frames to recognize it as matching
  10825. sequence. The option value must be a non negative integer value.
  10826. The default value is 0.
  10827. @item th_it
  10828. Set the minimum relation, that matching frames to all frames must have.
  10829. The option value must be a double value between 0 and 1. The default value is 0.5.
  10830. @end table
  10831. @subsection Examples
  10832. @itemize
  10833. @item
  10834. To calculate the signature of an input video and store it in signature.bin:
  10835. @example
  10836. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10837. @end example
  10838. @item
  10839. To detect whether two videos match and store the signatures in XML format in
  10840. signature0.xml and signature1.xml:
  10841. @example
  10842. 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 -
  10843. @end example
  10844. @end itemize
  10845. @anchor{smartblur}
  10846. @section smartblur
  10847. Blur the input video without impacting the outlines.
  10848. It accepts the following options:
  10849. @table @option
  10850. @item luma_radius, lr
  10851. Set the luma radius. The option value must be a float number in
  10852. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10853. used to blur the image (slower if larger). Default value is 1.0.
  10854. @item luma_strength, ls
  10855. Set the luma strength. The option value must be a float number
  10856. in the range [-1.0,1.0] that configures the blurring. A value included
  10857. in [0.0,1.0] will blur the image whereas a value included in
  10858. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10859. @item luma_threshold, lt
  10860. Set the luma threshold used as a coefficient to determine
  10861. whether a pixel should be blurred or not. The option value must be an
  10862. integer in the range [-30,30]. A value of 0 will filter all the image,
  10863. a value included in [0,30] will filter flat areas and a value included
  10864. in [-30,0] will filter edges. Default value is 0.
  10865. @item chroma_radius, cr
  10866. Set the chroma radius. The option value must be a float number in
  10867. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10868. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10869. @item chroma_strength, cs
  10870. Set the chroma strength. The option value must be a float number
  10871. in the range [-1.0,1.0] that configures the blurring. A value included
  10872. in [0.0,1.0] will blur the image whereas a value included in
  10873. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10874. @item chroma_threshold, ct
  10875. Set the chroma threshold used as a coefficient to determine
  10876. whether a pixel should be blurred or not. The option value must be an
  10877. integer in the range [-30,30]. A value of 0 will filter all the image,
  10878. a value included in [0,30] will filter flat areas and a value included
  10879. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10880. @end table
  10881. If a chroma option is not explicitly set, the corresponding luma value
  10882. is set.
  10883. @section ssim
  10884. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10885. This filter takes in input two input videos, the first input is
  10886. considered the "main" source and is passed unchanged to the
  10887. output. The second input is used as a "reference" video for computing
  10888. the SSIM.
  10889. Both video inputs must have the same resolution and pixel format for
  10890. this filter to work correctly. Also it assumes that both inputs
  10891. have the same number of frames, which are compared one by one.
  10892. The filter stores the calculated SSIM of each frame.
  10893. The description of the accepted parameters follows.
  10894. @table @option
  10895. @item stats_file, f
  10896. If specified the filter will use the named file to save the SSIM of
  10897. each individual frame. When filename equals "-" the data is sent to
  10898. standard output.
  10899. @end table
  10900. The file printed if @var{stats_file} is selected, contains a sequence of
  10901. key/value pairs of the form @var{key}:@var{value} for each compared
  10902. couple of frames.
  10903. A description of each shown parameter follows:
  10904. @table @option
  10905. @item n
  10906. sequential number of the input frame, starting from 1
  10907. @item Y, U, V, R, G, B
  10908. SSIM of the compared frames for the component specified by the suffix.
  10909. @item All
  10910. SSIM of the compared frames for the whole frame.
  10911. @item dB
  10912. Same as above but in dB representation.
  10913. @end table
  10914. This filter also supports the @ref{framesync} options.
  10915. For example:
  10916. @example
  10917. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10918. [main][ref] ssim="stats_file=stats.log" [out]
  10919. @end example
  10920. On this example the input file being processed is compared with the
  10921. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10922. is stored in @file{stats.log}.
  10923. Another example with both psnr and ssim at same time:
  10924. @example
  10925. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10926. @end example
  10927. @section stereo3d
  10928. Convert between different stereoscopic image formats.
  10929. The filters accept the following options:
  10930. @table @option
  10931. @item in
  10932. Set stereoscopic image format of input.
  10933. Available values for input image formats are:
  10934. @table @samp
  10935. @item sbsl
  10936. side by side parallel (left eye left, right eye right)
  10937. @item sbsr
  10938. side by side crosseye (right eye left, left eye right)
  10939. @item sbs2l
  10940. side by side parallel with half width resolution
  10941. (left eye left, right eye right)
  10942. @item sbs2r
  10943. side by side crosseye with half width resolution
  10944. (right eye left, left eye right)
  10945. @item abl
  10946. above-below (left eye above, right eye below)
  10947. @item abr
  10948. above-below (right eye above, left eye below)
  10949. @item ab2l
  10950. above-below with half height resolution
  10951. (left eye above, right eye below)
  10952. @item ab2r
  10953. above-below with half height resolution
  10954. (right eye above, left eye below)
  10955. @item al
  10956. alternating frames (left eye first, right eye second)
  10957. @item ar
  10958. alternating frames (right eye first, left eye second)
  10959. @item irl
  10960. interleaved rows (left eye has top row, right eye starts on next row)
  10961. @item irr
  10962. interleaved rows (right eye has top row, left eye starts on next row)
  10963. @item icl
  10964. interleaved columns, left eye first
  10965. @item icr
  10966. interleaved columns, right eye first
  10967. Default value is @samp{sbsl}.
  10968. @end table
  10969. @item out
  10970. Set stereoscopic image format of output.
  10971. @table @samp
  10972. @item sbsl
  10973. side by side parallel (left eye left, right eye right)
  10974. @item sbsr
  10975. side by side crosseye (right eye left, left eye right)
  10976. @item sbs2l
  10977. side by side parallel with half width resolution
  10978. (left eye left, right eye right)
  10979. @item sbs2r
  10980. side by side crosseye with half width resolution
  10981. (right eye left, left eye right)
  10982. @item abl
  10983. above-below (left eye above, right eye below)
  10984. @item abr
  10985. above-below (right eye above, left eye below)
  10986. @item ab2l
  10987. above-below with half height resolution
  10988. (left eye above, right eye below)
  10989. @item ab2r
  10990. above-below with half height resolution
  10991. (right eye above, left eye below)
  10992. @item al
  10993. alternating frames (left eye first, right eye second)
  10994. @item ar
  10995. alternating frames (right eye first, left eye second)
  10996. @item irl
  10997. interleaved rows (left eye has top row, right eye starts on next row)
  10998. @item irr
  10999. interleaved rows (right eye has top row, left eye starts on next row)
  11000. @item arbg
  11001. anaglyph red/blue gray
  11002. (red filter on left eye, blue filter on right eye)
  11003. @item argg
  11004. anaglyph red/green gray
  11005. (red filter on left eye, green filter on right eye)
  11006. @item arcg
  11007. anaglyph red/cyan gray
  11008. (red filter on left eye, cyan filter on right eye)
  11009. @item arch
  11010. anaglyph red/cyan half colored
  11011. (red filter on left eye, cyan filter on right eye)
  11012. @item arcc
  11013. anaglyph red/cyan color
  11014. (red filter on left eye, cyan filter on right eye)
  11015. @item arcd
  11016. anaglyph red/cyan color optimized with the least squares projection of dubois
  11017. (red filter on left eye, cyan filter on right eye)
  11018. @item agmg
  11019. anaglyph green/magenta gray
  11020. (green filter on left eye, magenta filter on right eye)
  11021. @item agmh
  11022. anaglyph green/magenta half colored
  11023. (green filter on left eye, magenta filter on right eye)
  11024. @item agmc
  11025. anaglyph green/magenta colored
  11026. (green filter on left eye, magenta filter on right eye)
  11027. @item agmd
  11028. anaglyph green/magenta color optimized with the least squares projection of dubois
  11029. (green filter on left eye, magenta filter on right eye)
  11030. @item aybg
  11031. anaglyph yellow/blue gray
  11032. (yellow filter on left eye, blue filter on right eye)
  11033. @item aybh
  11034. anaglyph yellow/blue half colored
  11035. (yellow filter on left eye, blue filter on right eye)
  11036. @item aybc
  11037. anaglyph yellow/blue colored
  11038. (yellow filter on left eye, blue filter on right eye)
  11039. @item aybd
  11040. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11041. (yellow filter on left eye, blue filter on right eye)
  11042. @item ml
  11043. mono output (left eye only)
  11044. @item mr
  11045. mono output (right eye only)
  11046. @item chl
  11047. checkerboard, left eye first
  11048. @item chr
  11049. checkerboard, right eye first
  11050. @item icl
  11051. interleaved columns, left eye first
  11052. @item icr
  11053. interleaved columns, right eye first
  11054. @item hdmi
  11055. HDMI frame pack
  11056. @end table
  11057. Default value is @samp{arcd}.
  11058. @end table
  11059. @subsection Examples
  11060. @itemize
  11061. @item
  11062. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11063. @example
  11064. stereo3d=sbsl:aybd
  11065. @end example
  11066. @item
  11067. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11068. @example
  11069. stereo3d=abl:sbsr
  11070. @end example
  11071. @end itemize
  11072. @section streamselect, astreamselect
  11073. Select video or audio streams.
  11074. The filter accepts the following options:
  11075. @table @option
  11076. @item inputs
  11077. Set number of inputs. Default is 2.
  11078. @item map
  11079. Set input indexes to remap to outputs.
  11080. @end table
  11081. @subsection Commands
  11082. The @code{streamselect} and @code{astreamselect} filter supports the following
  11083. commands:
  11084. @table @option
  11085. @item map
  11086. Set input indexes to remap to outputs.
  11087. @end table
  11088. @subsection Examples
  11089. @itemize
  11090. @item
  11091. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11092. @example
  11093. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11094. @end example
  11095. @item
  11096. Same as above, but for audio:
  11097. @example
  11098. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11099. @end example
  11100. @end itemize
  11101. @section sobel
  11102. Apply sobel operator to input video stream.
  11103. The filter accepts the following option:
  11104. @table @option
  11105. @item planes
  11106. Set which planes will be processed, unprocessed planes will be copied.
  11107. By default value 0xf, all planes will be processed.
  11108. @item scale
  11109. Set value which will be multiplied with filtered result.
  11110. @item delta
  11111. Set value which will be added to filtered result.
  11112. @end table
  11113. @anchor{spp}
  11114. @section spp
  11115. Apply a simple postprocessing filter that compresses and decompresses the image
  11116. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11117. and average the results.
  11118. The filter accepts the following options:
  11119. @table @option
  11120. @item quality
  11121. Set quality. This option defines the number of levels for averaging. It accepts
  11122. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11123. effect. A value of @code{6} means the higher quality. For each increment of
  11124. that value the speed drops by a factor of approximately 2. Default value is
  11125. @code{3}.
  11126. @item qp
  11127. Force a constant quantization parameter. If not set, the filter will use the QP
  11128. from the video stream (if available).
  11129. @item mode
  11130. Set thresholding mode. Available modes are:
  11131. @table @samp
  11132. @item hard
  11133. Set hard thresholding (default).
  11134. @item soft
  11135. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11136. @end table
  11137. @item use_bframe_qp
  11138. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11139. option may cause flicker since the B-Frames have often larger QP. Default is
  11140. @code{0} (not enabled).
  11141. @end table
  11142. @anchor{subtitles}
  11143. @section subtitles
  11144. Draw subtitles on top of input video using the libass library.
  11145. To enable compilation of this filter you need to configure FFmpeg with
  11146. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11147. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11148. Alpha) subtitles format.
  11149. The filter accepts the following options:
  11150. @table @option
  11151. @item filename, f
  11152. Set the filename of the subtitle file to read. It must be specified.
  11153. @item original_size
  11154. Specify the size of the original video, the video for which the ASS file
  11155. was composed. For the syntax of this option, check the
  11156. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11157. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11158. correctly scale the fonts if the aspect ratio has been changed.
  11159. @item fontsdir
  11160. Set a directory path containing fonts that can be used by the filter.
  11161. These fonts will be used in addition to whatever the font provider uses.
  11162. @item alpha
  11163. Process alpha channel, by default alpha channel is untouched.
  11164. @item charenc
  11165. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11166. useful if not UTF-8.
  11167. @item stream_index, si
  11168. Set subtitles stream index. @code{subtitles} filter only.
  11169. @item force_style
  11170. Override default style or script info parameters of the subtitles. It accepts a
  11171. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11172. @end table
  11173. If the first key is not specified, it is assumed that the first value
  11174. specifies the @option{filename}.
  11175. For example, to render the file @file{sub.srt} on top of the input
  11176. video, use the command:
  11177. @example
  11178. subtitles=sub.srt
  11179. @end example
  11180. which is equivalent to:
  11181. @example
  11182. subtitles=filename=sub.srt
  11183. @end example
  11184. To render the default subtitles stream from file @file{video.mkv}, use:
  11185. @example
  11186. subtitles=video.mkv
  11187. @end example
  11188. To render the second subtitles stream from that file, use:
  11189. @example
  11190. subtitles=video.mkv:si=1
  11191. @end example
  11192. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11193. @code{DejaVu Serif}, use:
  11194. @example
  11195. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11196. @end example
  11197. @section super2xsai
  11198. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11199. Interpolate) pixel art scaling algorithm.
  11200. Useful for enlarging pixel art images without reducing sharpness.
  11201. @section swaprect
  11202. Swap two rectangular objects in video.
  11203. This filter accepts the following options:
  11204. @table @option
  11205. @item w
  11206. Set object width.
  11207. @item h
  11208. Set object height.
  11209. @item x1
  11210. Set 1st rect x coordinate.
  11211. @item y1
  11212. Set 1st rect y coordinate.
  11213. @item x2
  11214. Set 2nd rect x coordinate.
  11215. @item y2
  11216. Set 2nd rect y coordinate.
  11217. All expressions are evaluated once for each frame.
  11218. @end table
  11219. The all options are expressions containing the following constants:
  11220. @table @option
  11221. @item w
  11222. @item h
  11223. The input width and height.
  11224. @item a
  11225. same as @var{w} / @var{h}
  11226. @item sar
  11227. input sample aspect ratio
  11228. @item dar
  11229. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11230. @item n
  11231. The number of the input frame, starting from 0.
  11232. @item t
  11233. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11234. @item pos
  11235. the position in the file of the input frame, NAN if unknown
  11236. @end table
  11237. @section swapuv
  11238. Swap U & V plane.
  11239. @section telecine
  11240. Apply telecine process to the video.
  11241. This filter accepts the following options:
  11242. @table @option
  11243. @item first_field
  11244. @table @samp
  11245. @item top, t
  11246. top field first
  11247. @item bottom, b
  11248. bottom field first
  11249. The default value is @code{top}.
  11250. @end table
  11251. @item pattern
  11252. A string of numbers representing the pulldown pattern you wish to apply.
  11253. The default value is @code{23}.
  11254. @end table
  11255. @example
  11256. Some typical patterns:
  11257. NTSC output (30i):
  11258. 27.5p: 32222
  11259. 24p: 23 (classic)
  11260. 24p: 2332 (preferred)
  11261. 20p: 33
  11262. 18p: 334
  11263. 16p: 3444
  11264. PAL output (25i):
  11265. 27.5p: 12222
  11266. 24p: 222222222223 ("Euro pulldown")
  11267. 16.67p: 33
  11268. 16p: 33333334
  11269. @end example
  11270. @section threshold
  11271. Apply threshold effect to video stream.
  11272. This filter needs four video streams to perform thresholding.
  11273. First stream is stream we are filtering.
  11274. Second stream is holding threshold values, third stream is holding min values,
  11275. and last, fourth stream is holding max values.
  11276. The filter accepts the following option:
  11277. @table @option
  11278. @item planes
  11279. Set which planes will be processed, unprocessed planes will be copied.
  11280. By default value 0xf, all planes will be processed.
  11281. @end table
  11282. For example if first stream pixel's component value is less then threshold value
  11283. of pixel component from 2nd threshold stream, third stream value will picked,
  11284. otherwise fourth stream pixel component value will be picked.
  11285. Using color source filter one can perform various types of thresholding:
  11286. @subsection Examples
  11287. @itemize
  11288. @item
  11289. Binary threshold, using gray color as threshold:
  11290. @example
  11291. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11292. @end example
  11293. @item
  11294. Inverted binary threshold, using gray color as threshold:
  11295. @example
  11296. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11297. @end example
  11298. @item
  11299. Truncate binary threshold, using gray color as threshold:
  11300. @example
  11301. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11302. @end example
  11303. @item
  11304. Threshold to zero, using gray color as threshold:
  11305. @example
  11306. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11307. @end example
  11308. @item
  11309. Inverted threshold to zero, using gray color as threshold:
  11310. @example
  11311. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11312. @end example
  11313. @end itemize
  11314. @section thumbnail
  11315. Select the most representative frame in a given sequence of consecutive frames.
  11316. The filter accepts the following options:
  11317. @table @option
  11318. @item n
  11319. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11320. will pick one of them, and then handle the next batch of @var{n} frames until
  11321. the end. Default is @code{100}.
  11322. @end table
  11323. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11324. value will result in a higher memory usage, so a high value is not recommended.
  11325. @subsection Examples
  11326. @itemize
  11327. @item
  11328. Extract one picture each 50 frames:
  11329. @example
  11330. thumbnail=50
  11331. @end example
  11332. @item
  11333. Complete example of a thumbnail creation with @command{ffmpeg}:
  11334. @example
  11335. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11336. @end example
  11337. @end itemize
  11338. @section tile
  11339. Tile several successive frames together.
  11340. The filter accepts the following options:
  11341. @table @option
  11342. @item layout
  11343. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11344. this option, check the
  11345. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11346. @item nb_frames
  11347. Set the maximum number of frames to render in the given area. It must be less
  11348. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11349. the area will be used.
  11350. @item margin
  11351. Set the outer border margin in pixels.
  11352. @item padding
  11353. Set the inner border thickness (i.e. the number of pixels between frames). For
  11354. more advanced padding options (such as having different values for the edges),
  11355. refer to the pad video filter.
  11356. @item color
  11357. Specify the color of the unused area. For the syntax of this option, check the
  11358. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11359. is "black".
  11360. @item overlap
  11361. Set the number of frames to overlap when tiling several successive frames together.
  11362. The value must be between @code{0} and @var{nb_frames - 1}.
  11363. @item init_padding
  11364. Set the number of frames to initially be empty before displaying first output frame.
  11365. This controls how soon will one get first output frame.
  11366. The value must be between @code{0} and @var{nb_frames - 1}.
  11367. @end table
  11368. @subsection Examples
  11369. @itemize
  11370. @item
  11371. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11372. @example
  11373. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11374. @end example
  11375. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11376. duplicating each output frame to accommodate the originally detected frame
  11377. rate.
  11378. @item
  11379. Display @code{5} pictures in an area of @code{3x2} frames,
  11380. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11381. mixed flat and named options:
  11382. @example
  11383. tile=3x2:nb_frames=5:padding=7:margin=2
  11384. @end example
  11385. @end itemize
  11386. @section tinterlace
  11387. Perform various types of temporal field interlacing.
  11388. Frames are counted starting from 1, so the first input frame is
  11389. considered odd.
  11390. The filter accepts the following options:
  11391. @table @option
  11392. @item mode
  11393. Specify the mode of the interlacing. This option can also be specified
  11394. as a value alone. See below for a list of values for this option.
  11395. Available values are:
  11396. @table @samp
  11397. @item merge, 0
  11398. Move odd frames into the upper field, even into the lower field,
  11399. generating a double height frame at half frame rate.
  11400. @example
  11401. ------> time
  11402. Input:
  11403. Frame 1 Frame 2 Frame 3 Frame 4
  11404. 11111 22222 33333 44444
  11405. 11111 22222 33333 44444
  11406. 11111 22222 33333 44444
  11407. 11111 22222 33333 44444
  11408. Output:
  11409. 11111 33333
  11410. 22222 44444
  11411. 11111 33333
  11412. 22222 44444
  11413. 11111 33333
  11414. 22222 44444
  11415. 11111 33333
  11416. 22222 44444
  11417. @end example
  11418. @item drop_even, 1
  11419. Only output odd frames, even frames are dropped, generating a frame with
  11420. unchanged height at half frame rate.
  11421. @example
  11422. ------> time
  11423. Input:
  11424. Frame 1 Frame 2 Frame 3 Frame 4
  11425. 11111 22222 33333 44444
  11426. 11111 22222 33333 44444
  11427. 11111 22222 33333 44444
  11428. 11111 22222 33333 44444
  11429. Output:
  11430. 11111 33333
  11431. 11111 33333
  11432. 11111 33333
  11433. 11111 33333
  11434. @end example
  11435. @item drop_odd, 2
  11436. Only output even frames, odd frames are dropped, generating a frame with
  11437. unchanged height at half frame rate.
  11438. @example
  11439. ------> time
  11440. Input:
  11441. Frame 1 Frame 2 Frame 3 Frame 4
  11442. 11111 22222 33333 44444
  11443. 11111 22222 33333 44444
  11444. 11111 22222 33333 44444
  11445. 11111 22222 33333 44444
  11446. Output:
  11447. 22222 44444
  11448. 22222 44444
  11449. 22222 44444
  11450. 22222 44444
  11451. @end example
  11452. @item pad, 3
  11453. Expand each frame to full height, but pad alternate lines with black,
  11454. generating a frame with double height at the same input frame rate.
  11455. @example
  11456. ------> time
  11457. Input:
  11458. Frame 1 Frame 2 Frame 3 Frame 4
  11459. 11111 22222 33333 44444
  11460. 11111 22222 33333 44444
  11461. 11111 22222 33333 44444
  11462. 11111 22222 33333 44444
  11463. Output:
  11464. 11111 ..... 33333 .....
  11465. ..... 22222 ..... 44444
  11466. 11111 ..... 33333 .....
  11467. ..... 22222 ..... 44444
  11468. 11111 ..... 33333 .....
  11469. ..... 22222 ..... 44444
  11470. 11111 ..... 33333 .....
  11471. ..... 22222 ..... 44444
  11472. @end example
  11473. @item interleave_top, 4
  11474. Interleave the upper field from odd frames with the lower field from
  11475. even frames, generating a frame with unchanged height at half frame rate.
  11476. @example
  11477. ------> time
  11478. Input:
  11479. Frame 1 Frame 2 Frame 3 Frame 4
  11480. 11111<- 22222 33333<- 44444
  11481. 11111 22222<- 33333 44444<-
  11482. 11111<- 22222 33333<- 44444
  11483. 11111 22222<- 33333 44444<-
  11484. Output:
  11485. 11111 33333
  11486. 22222 44444
  11487. 11111 33333
  11488. 22222 44444
  11489. @end example
  11490. @item interleave_bottom, 5
  11491. Interleave the lower field from odd frames with the upper field from
  11492. even frames, generating a frame with unchanged height at half frame rate.
  11493. @example
  11494. ------> time
  11495. Input:
  11496. Frame 1 Frame 2 Frame 3 Frame 4
  11497. 11111 22222<- 33333 44444<-
  11498. 11111<- 22222 33333<- 44444
  11499. 11111 22222<- 33333 44444<-
  11500. 11111<- 22222 33333<- 44444
  11501. Output:
  11502. 22222 44444
  11503. 11111 33333
  11504. 22222 44444
  11505. 11111 33333
  11506. @end example
  11507. @item interlacex2, 6
  11508. Double frame rate with unchanged height. Frames are inserted each
  11509. containing the second temporal field from the previous input frame and
  11510. the first temporal field from the next input frame. This mode relies on
  11511. the top_field_first flag. Useful for interlaced video displays with no
  11512. field synchronisation.
  11513. @example
  11514. ------> time
  11515. Input:
  11516. Frame 1 Frame 2 Frame 3 Frame 4
  11517. 11111 22222 33333 44444
  11518. 11111 22222 33333 44444
  11519. 11111 22222 33333 44444
  11520. 11111 22222 33333 44444
  11521. Output:
  11522. 11111 22222 22222 33333 33333 44444 44444
  11523. 11111 11111 22222 22222 33333 33333 44444
  11524. 11111 22222 22222 33333 33333 44444 44444
  11525. 11111 11111 22222 22222 33333 33333 44444
  11526. @end example
  11527. @item mergex2, 7
  11528. Move odd frames into the upper field, even into the lower field,
  11529. generating a double height frame at same frame rate.
  11530. @example
  11531. ------> time
  11532. Input:
  11533. Frame 1 Frame 2 Frame 3 Frame 4
  11534. 11111 22222 33333 44444
  11535. 11111 22222 33333 44444
  11536. 11111 22222 33333 44444
  11537. 11111 22222 33333 44444
  11538. Output:
  11539. 11111 33333 33333 55555
  11540. 22222 22222 44444 44444
  11541. 11111 33333 33333 55555
  11542. 22222 22222 44444 44444
  11543. 11111 33333 33333 55555
  11544. 22222 22222 44444 44444
  11545. 11111 33333 33333 55555
  11546. 22222 22222 44444 44444
  11547. @end example
  11548. @end table
  11549. Numeric values are deprecated but are accepted for backward
  11550. compatibility reasons.
  11551. Default mode is @code{merge}.
  11552. @item flags
  11553. Specify flags influencing the filter process.
  11554. Available value for @var{flags} is:
  11555. @table @option
  11556. @item low_pass_filter, vlfp
  11557. Enable linear vertical low-pass filtering in the filter.
  11558. Vertical low-pass filtering is required when creating an interlaced
  11559. destination from a progressive source which contains high-frequency
  11560. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11561. patterning.
  11562. @item complex_filter, cvlfp
  11563. Enable complex vertical low-pass filtering.
  11564. This will slightly less reduce interlace 'twitter' and Moire
  11565. patterning but better retain detail and subjective sharpness impression.
  11566. @end table
  11567. Vertical low-pass filtering can only be enabled for @option{mode}
  11568. @var{interleave_top} and @var{interleave_bottom}.
  11569. @end table
  11570. @section tonemap
  11571. Tone map colors from different dynamic ranges.
  11572. This filter expects data in single precision floating point, as it needs to
  11573. operate on (and can output) out-of-range values. Another filter, such as
  11574. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11575. The tonemapping algorithms implemented only work on linear light, so input
  11576. data should be linearized beforehand (and possibly correctly tagged).
  11577. @example
  11578. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11579. @end example
  11580. @subsection Options
  11581. The filter accepts the following options.
  11582. @table @option
  11583. @item tonemap
  11584. Set the tone map algorithm to use.
  11585. Possible values are:
  11586. @table @var
  11587. @item none
  11588. Do not apply any tone map, only desaturate overbright pixels.
  11589. @item clip
  11590. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11591. in-range values, while distorting out-of-range values.
  11592. @item linear
  11593. Stretch the entire reference gamut to a linear multiple of the display.
  11594. @item gamma
  11595. Fit a logarithmic transfer between the tone curves.
  11596. @item reinhard
  11597. Preserve overall image brightness with a simple curve, using nonlinear
  11598. contrast, which results in flattening details and degrading color accuracy.
  11599. @item hable
  11600. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11601. of slightly darkening everything. Use it when detail preservation is more
  11602. important than color and brightness accuracy.
  11603. @item mobius
  11604. Smoothly map out-of-range values, while retaining contrast and colors for
  11605. in-range material as much as possible. Use it when color accuracy is more
  11606. important than detail preservation.
  11607. @end table
  11608. Default is none.
  11609. @item param
  11610. Tune the tone mapping algorithm.
  11611. This affects the following algorithms:
  11612. @table @var
  11613. @item none
  11614. Ignored.
  11615. @item linear
  11616. Specifies the scale factor to use while stretching.
  11617. Default to 1.0.
  11618. @item gamma
  11619. Specifies the exponent of the function.
  11620. Default to 1.8.
  11621. @item clip
  11622. Specify an extra linear coefficient to multiply into the signal before clipping.
  11623. Default to 1.0.
  11624. @item reinhard
  11625. Specify the local contrast coefficient at the display peak.
  11626. Default to 0.5, which means that in-gamut values will be about half as bright
  11627. as when clipping.
  11628. @item hable
  11629. Ignored.
  11630. @item mobius
  11631. Specify the transition point from linear to mobius transform. Every value
  11632. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11633. more accurate the result will be, at the cost of losing bright details.
  11634. Default to 0.3, which due to the steep initial slope still preserves in-range
  11635. colors fairly accurately.
  11636. @end table
  11637. @item desat
  11638. Apply desaturation for highlights that exceed this level of brightness. The
  11639. higher the parameter, the more color information will be preserved. This
  11640. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11641. (smoothly) turning into white instead. This makes images feel more natural,
  11642. at the cost of reducing information about out-of-range colors.
  11643. The default of 2.0 is somewhat conservative and will mostly just apply to
  11644. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11645. This option works only if the input frame has a supported color tag.
  11646. @item peak
  11647. Override signal/nominal/reference peak with this value. Useful when the
  11648. embedded peak information in display metadata is not reliable or when tone
  11649. mapping from a lower range to a higher range.
  11650. @end table
  11651. @section transpose
  11652. Transpose rows with columns in the input video and optionally flip it.
  11653. It accepts the following parameters:
  11654. @table @option
  11655. @item dir
  11656. Specify the transposition direction.
  11657. Can assume the following values:
  11658. @table @samp
  11659. @item 0, 4, cclock_flip
  11660. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11661. @example
  11662. L.R L.l
  11663. . . -> . .
  11664. l.r R.r
  11665. @end example
  11666. @item 1, 5, clock
  11667. Rotate by 90 degrees clockwise, that is:
  11668. @example
  11669. L.R l.L
  11670. . . -> . .
  11671. l.r r.R
  11672. @end example
  11673. @item 2, 6, cclock
  11674. Rotate by 90 degrees counterclockwise, that is:
  11675. @example
  11676. L.R R.r
  11677. . . -> . .
  11678. l.r L.l
  11679. @end example
  11680. @item 3, 7, clock_flip
  11681. Rotate by 90 degrees clockwise and vertically flip, that is:
  11682. @example
  11683. L.R r.R
  11684. . . -> . .
  11685. l.r l.L
  11686. @end example
  11687. @end table
  11688. For values between 4-7, the transposition is only done if the input
  11689. video geometry is portrait and not landscape. These values are
  11690. deprecated, the @code{passthrough} option should be used instead.
  11691. Numerical values are deprecated, and should be dropped in favor of
  11692. symbolic constants.
  11693. @item passthrough
  11694. Do not apply the transposition if the input geometry matches the one
  11695. specified by the specified value. It accepts the following values:
  11696. @table @samp
  11697. @item none
  11698. Always apply transposition.
  11699. @item portrait
  11700. Preserve portrait geometry (when @var{height} >= @var{width}).
  11701. @item landscape
  11702. Preserve landscape geometry (when @var{width} >= @var{height}).
  11703. @end table
  11704. Default value is @code{none}.
  11705. @end table
  11706. For example to rotate by 90 degrees clockwise and preserve portrait
  11707. layout:
  11708. @example
  11709. transpose=dir=1:passthrough=portrait
  11710. @end example
  11711. The command above can also be specified as:
  11712. @example
  11713. transpose=1:portrait
  11714. @end example
  11715. @section trim
  11716. Trim the input so that the output contains one continuous subpart of the input.
  11717. It accepts the following parameters:
  11718. @table @option
  11719. @item start
  11720. Specify the time of the start of the kept section, i.e. the frame with the
  11721. timestamp @var{start} will be the first frame in the output.
  11722. @item end
  11723. Specify the time of the first frame that will be dropped, i.e. the frame
  11724. immediately preceding the one with the timestamp @var{end} will be the last
  11725. frame in the output.
  11726. @item start_pts
  11727. This is the same as @var{start}, except this option sets the start timestamp
  11728. in timebase units instead of seconds.
  11729. @item end_pts
  11730. This is the same as @var{end}, except this option sets the end timestamp
  11731. in timebase units instead of seconds.
  11732. @item duration
  11733. The maximum duration of the output in seconds.
  11734. @item start_frame
  11735. The number of the first frame that should be passed to the output.
  11736. @item end_frame
  11737. The number of the first frame that should be dropped.
  11738. @end table
  11739. @option{start}, @option{end}, and @option{duration} are expressed as time
  11740. duration specifications; see
  11741. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11742. for the accepted syntax.
  11743. Note that the first two sets of the start/end options and the @option{duration}
  11744. option look at the frame timestamp, while the _frame variants simply count the
  11745. frames that pass through the filter. Also note that this filter does not modify
  11746. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11747. setpts filter after the trim filter.
  11748. If multiple start or end options are set, this filter tries to be greedy and
  11749. keep all the frames that match at least one of the specified constraints. To keep
  11750. only the part that matches all the constraints at once, chain multiple trim
  11751. filters.
  11752. The defaults are such that all the input is kept. So it is possible to set e.g.
  11753. just the end values to keep everything before the specified time.
  11754. Examples:
  11755. @itemize
  11756. @item
  11757. Drop everything except the second minute of input:
  11758. @example
  11759. ffmpeg -i INPUT -vf trim=60:120
  11760. @end example
  11761. @item
  11762. Keep only the first second:
  11763. @example
  11764. ffmpeg -i INPUT -vf trim=duration=1
  11765. @end example
  11766. @end itemize
  11767. @section unpremultiply
  11768. Apply alpha unpremultiply effect to input video stream using first plane
  11769. of second stream as alpha.
  11770. Both streams must have same dimensions and same pixel format.
  11771. The filter accepts the following option:
  11772. @table @option
  11773. @item planes
  11774. Set which planes will be processed, unprocessed planes will be copied.
  11775. By default value 0xf, all planes will be processed.
  11776. If the format has 1 or 2 components, then luma is bit 0.
  11777. If the format has 3 or 4 components:
  11778. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11779. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11780. If present, the alpha channel is always the last bit.
  11781. @item inplace
  11782. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11783. @end table
  11784. @anchor{unsharp}
  11785. @section unsharp
  11786. Sharpen or blur the input video.
  11787. It accepts the following parameters:
  11788. @table @option
  11789. @item luma_msize_x, lx
  11790. Set the luma matrix horizontal size. It must be an odd integer between
  11791. 3 and 23. The default value is 5.
  11792. @item luma_msize_y, ly
  11793. Set the luma matrix vertical size. It must be an odd integer between 3
  11794. and 23. The default value is 5.
  11795. @item luma_amount, la
  11796. Set the luma effect strength. It must be a floating point number, reasonable
  11797. values lay between -1.5 and 1.5.
  11798. Negative values will blur the input video, while positive values will
  11799. sharpen it, a value of zero will disable the effect.
  11800. Default value is 1.0.
  11801. @item chroma_msize_x, cx
  11802. Set the chroma matrix horizontal size. It must be an odd integer
  11803. between 3 and 23. The default value is 5.
  11804. @item chroma_msize_y, cy
  11805. Set the chroma matrix vertical size. It must be an odd integer
  11806. between 3 and 23. The default value is 5.
  11807. @item chroma_amount, ca
  11808. Set the chroma effect strength. It must be a floating point number, reasonable
  11809. values lay between -1.5 and 1.5.
  11810. Negative values will blur the input video, while positive values will
  11811. sharpen it, a value of zero will disable the effect.
  11812. Default value is 0.0.
  11813. @end table
  11814. All parameters are optional and default to the equivalent of the
  11815. string '5:5:1.0:5:5:0.0'.
  11816. @subsection Examples
  11817. @itemize
  11818. @item
  11819. Apply strong luma sharpen effect:
  11820. @example
  11821. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11822. @end example
  11823. @item
  11824. Apply a strong blur of both luma and chroma parameters:
  11825. @example
  11826. unsharp=7:7:-2:7:7:-2
  11827. @end example
  11828. @end itemize
  11829. @section uspp
  11830. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11831. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11832. shifts and average the results.
  11833. The way this differs from the behavior of spp is that uspp actually encodes &
  11834. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11835. DCT similar to MJPEG.
  11836. The filter accepts the following options:
  11837. @table @option
  11838. @item quality
  11839. Set quality. This option defines the number of levels for averaging. It accepts
  11840. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11841. effect. A value of @code{8} means the higher quality. For each increment of
  11842. that value the speed drops by a factor of approximately 2. Default value is
  11843. @code{3}.
  11844. @item qp
  11845. Force a constant quantization parameter. If not set, the filter will use the QP
  11846. from the video stream (if available).
  11847. @end table
  11848. @section vaguedenoiser
  11849. Apply a wavelet based denoiser.
  11850. It transforms each frame from the video input into the wavelet domain,
  11851. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11852. the obtained coefficients. It does an inverse wavelet transform after.
  11853. Due to wavelet properties, it should give a nice smoothed result, and
  11854. reduced noise, without blurring picture features.
  11855. This filter accepts the following options:
  11856. @table @option
  11857. @item threshold
  11858. The filtering strength. The higher, the more filtered the video will be.
  11859. Hard thresholding can use a higher threshold than soft thresholding
  11860. before the video looks overfiltered. Default value is 2.
  11861. @item method
  11862. The filtering method the filter will use.
  11863. It accepts the following values:
  11864. @table @samp
  11865. @item hard
  11866. All values under the threshold will be zeroed.
  11867. @item soft
  11868. All values under the threshold will be zeroed. All values above will be
  11869. reduced by the threshold.
  11870. @item garrote
  11871. Scales or nullifies coefficients - intermediary between (more) soft and
  11872. (less) hard thresholding.
  11873. @end table
  11874. Default is garrote.
  11875. @item nsteps
  11876. Number of times, the wavelet will decompose the picture. Picture can't
  11877. be decomposed beyond a particular point (typically, 8 for a 640x480
  11878. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11879. @item percent
  11880. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11881. @item planes
  11882. A list of the planes to process. By default all planes are processed.
  11883. @end table
  11884. @section vectorscope
  11885. Display 2 color component values in the two dimensional graph (which is called
  11886. a vectorscope).
  11887. This filter accepts the following options:
  11888. @table @option
  11889. @item mode, m
  11890. Set vectorscope mode.
  11891. It accepts the following values:
  11892. @table @samp
  11893. @item gray
  11894. Gray values are displayed on graph, higher brightness means more pixels have
  11895. same component color value on location in graph. This is the default mode.
  11896. @item color
  11897. Gray values are displayed on graph. Surrounding pixels values which are not
  11898. present in video frame are drawn in gradient of 2 color components which are
  11899. set by option @code{x} and @code{y}. The 3rd color component is static.
  11900. @item color2
  11901. Actual color components values present in video frame are displayed on graph.
  11902. @item color3
  11903. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11904. on graph increases value of another color component, which is luminance by
  11905. default values of @code{x} and @code{y}.
  11906. @item color4
  11907. Actual colors present in video frame are displayed on graph. If two different
  11908. colors map to same position on graph then color with higher value of component
  11909. not present in graph is picked.
  11910. @item color5
  11911. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11912. component picked from radial gradient.
  11913. @end table
  11914. @item x
  11915. Set which color component will be represented on X-axis. Default is @code{1}.
  11916. @item y
  11917. Set which color component will be represented on Y-axis. Default is @code{2}.
  11918. @item intensity, i
  11919. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11920. of color component which represents frequency of (X, Y) location in graph.
  11921. @item envelope, e
  11922. @table @samp
  11923. @item none
  11924. No envelope, this is default.
  11925. @item instant
  11926. Instant envelope, even darkest single pixel will be clearly highlighted.
  11927. @item peak
  11928. Hold maximum and minimum values presented in graph over time. This way you
  11929. can still spot out of range values without constantly looking at vectorscope.
  11930. @item peak+instant
  11931. Peak and instant envelope combined together.
  11932. @end table
  11933. @item graticule, g
  11934. Set what kind of graticule to draw.
  11935. @table @samp
  11936. @item none
  11937. @item green
  11938. @item color
  11939. @end table
  11940. @item opacity, o
  11941. Set graticule opacity.
  11942. @item flags, f
  11943. Set graticule flags.
  11944. @table @samp
  11945. @item white
  11946. Draw graticule for white point.
  11947. @item black
  11948. Draw graticule for black point.
  11949. @item name
  11950. Draw color points short names.
  11951. @end table
  11952. @item bgopacity, b
  11953. Set background opacity.
  11954. @item lthreshold, l
  11955. Set low threshold for color component not represented on X or Y axis.
  11956. Values lower than this value will be ignored. Default is 0.
  11957. Note this value is multiplied with actual max possible value one pixel component
  11958. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11959. is 0.1 * 255 = 25.
  11960. @item hthreshold, h
  11961. Set high threshold for color component not represented on X or Y axis.
  11962. Values higher than this value will be ignored. Default is 1.
  11963. Note this value is multiplied with actual max possible value one pixel component
  11964. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11965. is 0.9 * 255 = 230.
  11966. @item colorspace, c
  11967. Set what kind of colorspace to use when drawing graticule.
  11968. @table @samp
  11969. @item auto
  11970. @item 601
  11971. @item 709
  11972. @end table
  11973. Default is auto.
  11974. @end table
  11975. @anchor{vidstabdetect}
  11976. @section vidstabdetect
  11977. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11978. @ref{vidstabtransform} for pass 2.
  11979. This filter generates a file with relative translation and rotation
  11980. transform information about subsequent frames, which is then used by
  11981. the @ref{vidstabtransform} filter.
  11982. To enable compilation of this filter you need to configure FFmpeg with
  11983. @code{--enable-libvidstab}.
  11984. This filter accepts the following options:
  11985. @table @option
  11986. @item result
  11987. Set the path to the file used to write the transforms information.
  11988. Default value is @file{transforms.trf}.
  11989. @item shakiness
  11990. Set how shaky the video is and how quick the camera is. It accepts an
  11991. integer in the range 1-10, a value of 1 means little shakiness, a
  11992. value of 10 means strong shakiness. Default value is 5.
  11993. @item accuracy
  11994. Set the accuracy of the detection process. It must be a value in the
  11995. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11996. accuracy. Default value is 15.
  11997. @item stepsize
  11998. Set stepsize of the search process. The region around minimum is
  11999. scanned with 1 pixel resolution. Default value is 6.
  12000. @item mincontrast
  12001. Set minimum contrast. Below this value a local measurement field is
  12002. discarded. Must be a floating point value in the range 0-1. Default
  12003. value is 0.3.
  12004. @item tripod
  12005. Set reference frame number for tripod mode.
  12006. If enabled, the motion of the frames is compared to a reference frame
  12007. in the filtered stream, identified by the specified number. The idea
  12008. is to compensate all movements in a more-or-less static scene and keep
  12009. the camera view absolutely still.
  12010. If set to 0, it is disabled. The frames are counted starting from 1.
  12011. @item show
  12012. Show fields and transforms in the resulting frames. It accepts an
  12013. integer in the range 0-2. Default value is 0, which disables any
  12014. visualization.
  12015. @end table
  12016. @subsection Examples
  12017. @itemize
  12018. @item
  12019. Use default values:
  12020. @example
  12021. vidstabdetect
  12022. @end example
  12023. @item
  12024. Analyze strongly shaky movie and put the results in file
  12025. @file{mytransforms.trf}:
  12026. @example
  12027. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12028. @end example
  12029. @item
  12030. Visualize the result of internal transformations in the resulting
  12031. video:
  12032. @example
  12033. vidstabdetect=show=1
  12034. @end example
  12035. @item
  12036. Analyze a video with medium shakiness using @command{ffmpeg}:
  12037. @example
  12038. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12039. @end example
  12040. @end itemize
  12041. @anchor{vidstabtransform}
  12042. @section vidstabtransform
  12043. Video stabilization/deshaking: pass 2 of 2,
  12044. see @ref{vidstabdetect} for pass 1.
  12045. Read a file with transform information for each frame and
  12046. apply/compensate them. Together with the @ref{vidstabdetect}
  12047. filter this can be used to deshake videos. See also
  12048. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12049. the @ref{unsharp} filter, see below.
  12050. To enable compilation of this filter you need to configure FFmpeg with
  12051. @code{--enable-libvidstab}.
  12052. @subsection Options
  12053. @table @option
  12054. @item input
  12055. Set path to the file used to read the transforms. Default value is
  12056. @file{transforms.trf}.
  12057. @item smoothing
  12058. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12059. camera movements. Default value is 10.
  12060. For example a number of 10 means that 21 frames are used (10 in the
  12061. past and 10 in the future) to smoothen the motion in the video. A
  12062. larger value leads to a smoother video, but limits the acceleration of
  12063. the camera (pan/tilt movements). 0 is a special case where a static
  12064. camera is simulated.
  12065. @item optalgo
  12066. Set the camera path optimization algorithm.
  12067. Accepted values are:
  12068. @table @samp
  12069. @item gauss
  12070. gaussian kernel low-pass filter on camera motion (default)
  12071. @item avg
  12072. averaging on transformations
  12073. @end table
  12074. @item maxshift
  12075. Set maximal number of pixels to translate frames. Default value is -1,
  12076. meaning no limit.
  12077. @item maxangle
  12078. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12079. value is -1, meaning no limit.
  12080. @item crop
  12081. Specify how to deal with borders that may be visible due to movement
  12082. compensation.
  12083. Available values are:
  12084. @table @samp
  12085. @item keep
  12086. keep image information from previous frame (default)
  12087. @item black
  12088. fill the border black
  12089. @end table
  12090. @item invert
  12091. Invert transforms if set to 1. Default value is 0.
  12092. @item relative
  12093. Consider transforms as relative to previous frame if set to 1,
  12094. absolute if set to 0. Default value is 0.
  12095. @item zoom
  12096. Set percentage to zoom. A positive value will result in a zoom-in
  12097. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12098. zoom).
  12099. @item optzoom
  12100. Set optimal zooming to avoid borders.
  12101. Accepted values are:
  12102. @table @samp
  12103. @item 0
  12104. disabled
  12105. @item 1
  12106. optimal static zoom value is determined (only very strong movements
  12107. will lead to visible borders) (default)
  12108. @item 2
  12109. optimal adaptive zoom value is determined (no borders will be
  12110. visible), see @option{zoomspeed}
  12111. @end table
  12112. Note that the value given at zoom is added to the one calculated here.
  12113. @item zoomspeed
  12114. Set percent to zoom maximally each frame (enabled when
  12115. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12116. 0.25.
  12117. @item interpol
  12118. Specify type of interpolation.
  12119. Available values are:
  12120. @table @samp
  12121. @item no
  12122. no interpolation
  12123. @item linear
  12124. linear only horizontal
  12125. @item bilinear
  12126. linear in both directions (default)
  12127. @item bicubic
  12128. cubic in both directions (slow)
  12129. @end table
  12130. @item tripod
  12131. Enable virtual tripod mode if set to 1, which is equivalent to
  12132. @code{relative=0:smoothing=0}. Default value is 0.
  12133. Use also @code{tripod} option of @ref{vidstabdetect}.
  12134. @item debug
  12135. Increase log verbosity if set to 1. Also the detected global motions
  12136. are written to the temporary file @file{global_motions.trf}. Default
  12137. value is 0.
  12138. @end table
  12139. @subsection Examples
  12140. @itemize
  12141. @item
  12142. Use @command{ffmpeg} for a typical stabilization with default values:
  12143. @example
  12144. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12145. @end example
  12146. Note the use of the @ref{unsharp} filter which is always recommended.
  12147. @item
  12148. Zoom in a bit more and load transform data from a given file:
  12149. @example
  12150. vidstabtransform=zoom=5:input="mytransforms.trf"
  12151. @end example
  12152. @item
  12153. Smoothen the video even more:
  12154. @example
  12155. vidstabtransform=smoothing=30
  12156. @end example
  12157. @end itemize
  12158. @section vflip
  12159. Flip the input video vertically.
  12160. For example, to vertically flip a video with @command{ffmpeg}:
  12161. @example
  12162. ffmpeg -i in.avi -vf "vflip" out.avi
  12163. @end example
  12164. @anchor{vignette}
  12165. @section vignette
  12166. Make or reverse a natural vignetting effect.
  12167. The filter accepts the following options:
  12168. @table @option
  12169. @item angle, a
  12170. Set lens angle expression as a number of radians.
  12171. The value is clipped in the @code{[0,PI/2]} range.
  12172. Default value: @code{"PI/5"}
  12173. @item x0
  12174. @item y0
  12175. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12176. by default.
  12177. @item mode
  12178. Set forward/backward mode.
  12179. Available modes are:
  12180. @table @samp
  12181. @item forward
  12182. The larger the distance from the central point, the darker the image becomes.
  12183. @item backward
  12184. The larger the distance from the central point, the brighter the image becomes.
  12185. This can be used to reverse a vignette effect, though there is no automatic
  12186. detection to extract the lens @option{angle} and other settings (yet). It can
  12187. also be used to create a burning effect.
  12188. @end table
  12189. Default value is @samp{forward}.
  12190. @item eval
  12191. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12192. It accepts the following values:
  12193. @table @samp
  12194. @item init
  12195. Evaluate expressions only once during the filter initialization.
  12196. @item frame
  12197. Evaluate expressions for each incoming frame. This is way slower than the
  12198. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12199. allows advanced dynamic expressions.
  12200. @end table
  12201. Default value is @samp{init}.
  12202. @item dither
  12203. Set dithering to reduce the circular banding effects. Default is @code{1}
  12204. (enabled).
  12205. @item aspect
  12206. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12207. Setting this value to the SAR of the input will make a rectangular vignetting
  12208. following the dimensions of the video.
  12209. Default is @code{1/1}.
  12210. @end table
  12211. @subsection Expressions
  12212. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12213. following parameters.
  12214. @table @option
  12215. @item w
  12216. @item h
  12217. input width and height
  12218. @item n
  12219. the number of input frame, starting from 0
  12220. @item pts
  12221. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12222. @var{TB} units, NAN if undefined
  12223. @item r
  12224. frame rate of the input video, NAN if the input frame rate is unknown
  12225. @item t
  12226. the PTS (Presentation TimeStamp) of the filtered video frame,
  12227. expressed in seconds, NAN if undefined
  12228. @item tb
  12229. time base of the input video
  12230. @end table
  12231. @subsection Examples
  12232. @itemize
  12233. @item
  12234. Apply simple strong vignetting effect:
  12235. @example
  12236. vignette=PI/4
  12237. @end example
  12238. @item
  12239. Make a flickering vignetting:
  12240. @example
  12241. vignette='PI/4+random(1)*PI/50':eval=frame
  12242. @end example
  12243. @end itemize
  12244. @section vmafmotion
  12245. Obtain the average vmaf motion score of a video.
  12246. It is one of the component filters of VMAF.
  12247. The obtained average motion score is printed through the logging system.
  12248. In the below example the input file @file{ref.mpg} is being processed and score
  12249. is computed.
  12250. @example
  12251. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12252. @end example
  12253. @section vstack
  12254. Stack input videos vertically.
  12255. All streams must be of same pixel format and of same width.
  12256. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12257. to create same output.
  12258. The filter accept the following option:
  12259. @table @option
  12260. @item inputs
  12261. Set number of input streams. Default is 2.
  12262. @item shortest
  12263. If set to 1, force the output to terminate when the shortest input
  12264. terminates. Default value is 0.
  12265. @end table
  12266. @section w3fdif
  12267. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12268. Deinterlacing Filter").
  12269. Based on the process described by Martin Weston for BBC R&D, and
  12270. implemented based on the de-interlace algorithm written by Jim
  12271. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12272. uses filter coefficients calculated by BBC R&D.
  12273. There are two sets of filter coefficients, so called "simple":
  12274. and "complex". Which set of filter coefficients is used can
  12275. be set by passing an optional parameter:
  12276. @table @option
  12277. @item filter
  12278. Set the interlacing filter coefficients. Accepts one of the following values:
  12279. @table @samp
  12280. @item simple
  12281. Simple filter coefficient set.
  12282. @item complex
  12283. More-complex filter coefficient set.
  12284. @end table
  12285. Default value is @samp{complex}.
  12286. @item deint
  12287. Specify which frames to deinterlace. Accept one of the following values:
  12288. @table @samp
  12289. @item all
  12290. Deinterlace all frames,
  12291. @item interlaced
  12292. Only deinterlace frames marked as interlaced.
  12293. @end table
  12294. Default value is @samp{all}.
  12295. @end table
  12296. @section waveform
  12297. Video waveform monitor.
  12298. The waveform monitor plots color component intensity. By default luminance
  12299. only. Each column of the waveform corresponds to a column of pixels in the
  12300. source video.
  12301. It accepts the following options:
  12302. @table @option
  12303. @item mode, m
  12304. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12305. In row mode, the graph on the left side represents color component value 0 and
  12306. the right side represents value = 255. In column mode, the top side represents
  12307. color component value = 0 and bottom side represents value = 255.
  12308. @item intensity, i
  12309. Set intensity. Smaller values are useful to find out how many values of the same
  12310. luminance are distributed across input rows/columns.
  12311. Default value is @code{0.04}. Allowed range is [0, 1].
  12312. @item mirror, r
  12313. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12314. In mirrored mode, higher values will be represented on the left
  12315. side for @code{row} mode and at the top for @code{column} mode. Default is
  12316. @code{1} (mirrored).
  12317. @item display, d
  12318. Set display mode.
  12319. It accepts the following values:
  12320. @table @samp
  12321. @item overlay
  12322. Presents information identical to that in the @code{parade}, except
  12323. that the graphs representing color components are superimposed directly
  12324. over one another.
  12325. This display mode makes it easier to spot relative differences or similarities
  12326. in overlapping areas of the color components that are supposed to be identical,
  12327. such as neutral whites, grays, or blacks.
  12328. @item stack
  12329. Display separate graph for the color components side by side in
  12330. @code{row} mode or one below the other in @code{column} mode.
  12331. @item parade
  12332. Display separate graph for the color components side by side in
  12333. @code{column} mode or one below the other in @code{row} mode.
  12334. Using this display mode makes it easy to spot color casts in the highlights
  12335. and shadows of an image, by comparing the contours of the top and the bottom
  12336. graphs of each waveform. Since whites, grays, and blacks are characterized
  12337. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12338. should display three waveforms of roughly equal width/height. If not, the
  12339. correction is easy to perform by making level adjustments the three waveforms.
  12340. @end table
  12341. Default is @code{stack}.
  12342. @item components, c
  12343. Set which color components to display. Default is 1, which means only luminance
  12344. or red color component if input is in RGB colorspace. If is set for example to
  12345. 7 it will display all 3 (if) available color components.
  12346. @item envelope, e
  12347. @table @samp
  12348. @item none
  12349. No envelope, this is default.
  12350. @item instant
  12351. Instant envelope, minimum and maximum values presented in graph will be easily
  12352. visible even with small @code{step} value.
  12353. @item peak
  12354. Hold minimum and maximum values presented in graph across time. This way you
  12355. can still spot out of range values without constantly looking at waveforms.
  12356. @item peak+instant
  12357. Peak and instant envelope combined together.
  12358. @end table
  12359. @item filter, f
  12360. @table @samp
  12361. @item lowpass
  12362. No filtering, this is default.
  12363. @item flat
  12364. Luma and chroma combined together.
  12365. @item aflat
  12366. Similar as above, but shows difference between blue and red chroma.
  12367. @item chroma
  12368. Displays only chroma.
  12369. @item color
  12370. Displays actual color value on waveform.
  12371. @item acolor
  12372. Similar as above, but with luma showing frequency of chroma values.
  12373. @end table
  12374. @item graticule, g
  12375. Set which graticule to display.
  12376. @table @samp
  12377. @item none
  12378. Do not display graticule.
  12379. @item green
  12380. Display green graticule showing legal broadcast ranges.
  12381. @end table
  12382. @item opacity, o
  12383. Set graticule opacity.
  12384. @item flags, fl
  12385. Set graticule flags.
  12386. @table @samp
  12387. @item numbers
  12388. Draw numbers above lines. By default enabled.
  12389. @item dots
  12390. Draw dots instead of lines.
  12391. @end table
  12392. @item scale, s
  12393. Set scale used for displaying graticule.
  12394. @table @samp
  12395. @item digital
  12396. @item millivolts
  12397. @item ire
  12398. @end table
  12399. Default is digital.
  12400. @item bgopacity, b
  12401. Set background opacity.
  12402. @end table
  12403. @section weave, doubleweave
  12404. The @code{weave} takes a field-based video input and join
  12405. each two sequential fields into single frame, producing a new double
  12406. height clip with half the frame rate and half the frame count.
  12407. The @code{doubleweave} works same as @code{weave} but without
  12408. halving frame rate and frame count.
  12409. It accepts the following option:
  12410. @table @option
  12411. @item first_field
  12412. Set first field. Available values are:
  12413. @table @samp
  12414. @item top, t
  12415. Set the frame as top-field-first.
  12416. @item bottom, b
  12417. Set the frame as bottom-field-first.
  12418. @end table
  12419. @end table
  12420. @subsection Examples
  12421. @itemize
  12422. @item
  12423. Interlace video using @ref{select} and @ref{separatefields} filter:
  12424. @example
  12425. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12426. @end example
  12427. @end itemize
  12428. @section xbr
  12429. Apply the xBR high-quality magnification filter which is designed for pixel
  12430. art. It follows a set of edge-detection rules, see
  12431. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12432. It accepts the following option:
  12433. @table @option
  12434. @item n
  12435. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12436. @code{3xBR} and @code{4} for @code{4xBR}.
  12437. Default is @code{3}.
  12438. @end table
  12439. @anchor{yadif}
  12440. @section yadif
  12441. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12442. filter").
  12443. It accepts the following parameters:
  12444. @table @option
  12445. @item mode
  12446. The interlacing mode to adopt. It accepts one of the following values:
  12447. @table @option
  12448. @item 0, send_frame
  12449. Output one frame for each frame.
  12450. @item 1, send_field
  12451. Output one frame for each field.
  12452. @item 2, send_frame_nospatial
  12453. Like @code{send_frame}, but it skips the spatial interlacing check.
  12454. @item 3, send_field_nospatial
  12455. Like @code{send_field}, but it skips the spatial interlacing check.
  12456. @end table
  12457. The default value is @code{send_frame}.
  12458. @item parity
  12459. The picture field parity assumed for the input interlaced video. It accepts one
  12460. of the following values:
  12461. @table @option
  12462. @item 0, tff
  12463. Assume the top field is first.
  12464. @item 1, bff
  12465. Assume the bottom field is first.
  12466. @item -1, auto
  12467. Enable automatic detection of field parity.
  12468. @end table
  12469. The default value is @code{auto}.
  12470. If the interlacing is unknown or the decoder does not export this information,
  12471. top field first will be assumed.
  12472. @item deint
  12473. Specify which frames to deinterlace. Accept one of the following
  12474. values:
  12475. @table @option
  12476. @item 0, all
  12477. Deinterlace all frames.
  12478. @item 1, interlaced
  12479. Only deinterlace frames marked as interlaced.
  12480. @end table
  12481. The default value is @code{all}.
  12482. @end table
  12483. @section zoompan
  12484. Apply Zoom & Pan effect.
  12485. This filter accepts the following options:
  12486. @table @option
  12487. @item zoom, z
  12488. Set the zoom expression. Default is 1.
  12489. @item x
  12490. @item y
  12491. Set the x and y expression. Default is 0.
  12492. @item d
  12493. Set the duration expression in number of frames.
  12494. This sets for how many number of frames effect will last for
  12495. single input image.
  12496. @item s
  12497. Set the output image size, default is 'hd720'.
  12498. @item fps
  12499. Set the output frame rate, default is '25'.
  12500. @end table
  12501. Each expression can contain the following constants:
  12502. @table @option
  12503. @item in_w, iw
  12504. Input width.
  12505. @item in_h, ih
  12506. Input height.
  12507. @item out_w, ow
  12508. Output width.
  12509. @item out_h, oh
  12510. Output height.
  12511. @item in
  12512. Input frame count.
  12513. @item on
  12514. Output frame count.
  12515. @item x
  12516. @item y
  12517. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12518. for current input frame.
  12519. @item px
  12520. @item py
  12521. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12522. not yet such frame (first input frame).
  12523. @item zoom
  12524. Last calculated zoom from 'z' expression for current input frame.
  12525. @item pzoom
  12526. Last calculated zoom of last output frame of previous input frame.
  12527. @item duration
  12528. Number of output frames for current input frame. Calculated from 'd' expression
  12529. for each input frame.
  12530. @item pduration
  12531. number of output frames created for previous input frame
  12532. @item a
  12533. Rational number: input width / input height
  12534. @item sar
  12535. sample aspect ratio
  12536. @item dar
  12537. display aspect ratio
  12538. @end table
  12539. @subsection Examples
  12540. @itemize
  12541. @item
  12542. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12543. @example
  12544. 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
  12545. @end example
  12546. @item
  12547. Zoom-in up to 1.5 and pan always at center of picture:
  12548. @example
  12549. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12550. @end example
  12551. @item
  12552. Same as above but without pausing:
  12553. @example
  12554. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12555. @end example
  12556. @end itemize
  12557. @anchor{zscale}
  12558. @section zscale
  12559. Scale (resize) the input video, using the z.lib library:
  12560. https://github.com/sekrit-twc/zimg.
  12561. The zscale filter forces the output display aspect ratio to be the same
  12562. as the input, by changing the output sample aspect ratio.
  12563. If the input image format is different from the format requested by
  12564. the next filter, the zscale filter will convert the input to the
  12565. requested format.
  12566. @subsection Options
  12567. The filter accepts the following options.
  12568. @table @option
  12569. @item width, w
  12570. @item height, h
  12571. Set the output video dimension expression. Default value is the input
  12572. dimension.
  12573. If the @var{width} or @var{w} value is 0, the input width is used for
  12574. the output. If the @var{height} or @var{h} value is 0, the input height
  12575. is used for the output.
  12576. If one and only one of the values is -n with n >= 1, the zscale filter
  12577. will use a value that maintains the aspect ratio of the input image,
  12578. calculated from the other specified dimension. After that it will,
  12579. however, make sure that the calculated dimension is divisible by n and
  12580. adjust the value if necessary.
  12581. If both values are -n with n >= 1, the behavior will be identical to
  12582. both values being set to 0 as previously detailed.
  12583. See below for the list of accepted constants for use in the dimension
  12584. expression.
  12585. @item size, s
  12586. Set the video size. For the syntax of this option, check the
  12587. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12588. @item dither, d
  12589. Set the dither type.
  12590. Possible values are:
  12591. @table @var
  12592. @item none
  12593. @item ordered
  12594. @item random
  12595. @item error_diffusion
  12596. @end table
  12597. Default is none.
  12598. @item filter, f
  12599. Set the resize filter type.
  12600. Possible values are:
  12601. @table @var
  12602. @item point
  12603. @item bilinear
  12604. @item bicubic
  12605. @item spline16
  12606. @item spline36
  12607. @item lanczos
  12608. @end table
  12609. Default is bilinear.
  12610. @item range, r
  12611. Set the color range.
  12612. Possible values are:
  12613. @table @var
  12614. @item input
  12615. @item limited
  12616. @item full
  12617. @end table
  12618. Default is same as input.
  12619. @item primaries, p
  12620. Set the color primaries.
  12621. Possible values are:
  12622. @table @var
  12623. @item input
  12624. @item 709
  12625. @item unspecified
  12626. @item 170m
  12627. @item 240m
  12628. @item 2020
  12629. @end table
  12630. Default is same as input.
  12631. @item transfer, t
  12632. Set the transfer characteristics.
  12633. Possible values are:
  12634. @table @var
  12635. @item input
  12636. @item 709
  12637. @item unspecified
  12638. @item 601
  12639. @item linear
  12640. @item 2020_10
  12641. @item 2020_12
  12642. @item smpte2084
  12643. @item iec61966-2-1
  12644. @item arib-std-b67
  12645. @end table
  12646. Default is same as input.
  12647. @item matrix, m
  12648. Set the colorspace matrix.
  12649. Possible value are:
  12650. @table @var
  12651. @item input
  12652. @item 709
  12653. @item unspecified
  12654. @item 470bg
  12655. @item 170m
  12656. @item 2020_ncl
  12657. @item 2020_cl
  12658. @end table
  12659. Default is same as input.
  12660. @item rangein, rin
  12661. Set the input color range.
  12662. Possible values are:
  12663. @table @var
  12664. @item input
  12665. @item limited
  12666. @item full
  12667. @end table
  12668. Default is same as input.
  12669. @item primariesin, pin
  12670. Set the input color primaries.
  12671. Possible values are:
  12672. @table @var
  12673. @item input
  12674. @item 709
  12675. @item unspecified
  12676. @item 170m
  12677. @item 240m
  12678. @item 2020
  12679. @end table
  12680. Default is same as input.
  12681. @item transferin, tin
  12682. Set the input transfer characteristics.
  12683. Possible values are:
  12684. @table @var
  12685. @item input
  12686. @item 709
  12687. @item unspecified
  12688. @item 601
  12689. @item linear
  12690. @item 2020_10
  12691. @item 2020_12
  12692. @end table
  12693. Default is same as input.
  12694. @item matrixin, min
  12695. Set the input colorspace matrix.
  12696. Possible value are:
  12697. @table @var
  12698. @item input
  12699. @item 709
  12700. @item unspecified
  12701. @item 470bg
  12702. @item 170m
  12703. @item 2020_ncl
  12704. @item 2020_cl
  12705. @end table
  12706. @item chromal, c
  12707. Set the output chroma location.
  12708. Possible values are:
  12709. @table @var
  12710. @item input
  12711. @item left
  12712. @item center
  12713. @item topleft
  12714. @item top
  12715. @item bottomleft
  12716. @item bottom
  12717. @end table
  12718. @item chromalin, cin
  12719. Set the input chroma location.
  12720. Possible values are:
  12721. @table @var
  12722. @item input
  12723. @item left
  12724. @item center
  12725. @item topleft
  12726. @item top
  12727. @item bottomleft
  12728. @item bottom
  12729. @end table
  12730. @item npl
  12731. Set the nominal peak luminance.
  12732. @end table
  12733. The values of the @option{w} and @option{h} options are expressions
  12734. containing the following constants:
  12735. @table @var
  12736. @item in_w
  12737. @item in_h
  12738. The input width and height
  12739. @item iw
  12740. @item ih
  12741. These are the same as @var{in_w} and @var{in_h}.
  12742. @item out_w
  12743. @item out_h
  12744. The output (scaled) width and height
  12745. @item ow
  12746. @item oh
  12747. These are the same as @var{out_w} and @var{out_h}
  12748. @item a
  12749. The same as @var{iw} / @var{ih}
  12750. @item sar
  12751. input sample aspect ratio
  12752. @item dar
  12753. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12754. @item hsub
  12755. @item vsub
  12756. horizontal and vertical input chroma subsample values. For example for the
  12757. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12758. @item ohsub
  12759. @item ovsub
  12760. horizontal and vertical output chroma subsample values. For example for the
  12761. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12762. @end table
  12763. @table @option
  12764. @end table
  12765. @c man end VIDEO FILTERS
  12766. @chapter Video Sources
  12767. @c man begin VIDEO SOURCES
  12768. Below is a description of the currently available video sources.
  12769. @section buffer
  12770. Buffer video frames, and make them available to the filter chain.
  12771. This source is mainly intended for a programmatic use, in particular
  12772. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12773. It accepts the following parameters:
  12774. @table @option
  12775. @item video_size
  12776. Specify the size (width and height) of the buffered video frames. For the
  12777. syntax of this option, check the
  12778. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12779. @item width
  12780. The input video width.
  12781. @item height
  12782. The input video height.
  12783. @item pix_fmt
  12784. A string representing the pixel format of the buffered video frames.
  12785. It may be a number corresponding to a pixel format, or a pixel format
  12786. name.
  12787. @item time_base
  12788. Specify the timebase assumed by the timestamps of the buffered frames.
  12789. @item frame_rate
  12790. Specify the frame rate expected for the video stream.
  12791. @item pixel_aspect, sar
  12792. The sample (pixel) aspect ratio of the input video.
  12793. @item sws_param
  12794. Specify the optional parameters to be used for the scale filter which
  12795. is automatically inserted when an input change is detected in the
  12796. input size or format.
  12797. @item hw_frames_ctx
  12798. When using a hardware pixel format, this should be a reference to an
  12799. AVHWFramesContext describing input frames.
  12800. @end table
  12801. For example:
  12802. @example
  12803. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12804. @end example
  12805. will instruct the source to accept video frames with size 320x240 and
  12806. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12807. square pixels (1:1 sample aspect ratio).
  12808. Since the pixel format with name "yuv410p" corresponds to the number 6
  12809. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12810. this example corresponds to:
  12811. @example
  12812. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12813. @end example
  12814. Alternatively, the options can be specified as a flat string, but this
  12815. syntax is deprecated:
  12816. @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}]
  12817. @section cellauto
  12818. Create a pattern generated by an elementary cellular automaton.
  12819. The initial state of the cellular automaton can be defined through the
  12820. @option{filename} and @option{pattern} options. If such options are
  12821. not specified an initial state is created randomly.
  12822. At each new frame a new row in the video is filled with the result of
  12823. the cellular automaton next generation. The behavior when the whole
  12824. frame is filled is defined by the @option{scroll} option.
  12825. This source accepts the following options:
  12826. @table @option
  12827. @item filename, f
  12828. Read the initial cellular automaton state, i.e. the starting row, from
  12829. the specified file.
  12830. In the file, each non-whitespace character is considered an alive
  12831. cell, a newline will terminate the row, and further characters in the
  12832. file will be ignored.
  12833. @item pattern, p
  12834. Read the initial cellular automaton state, i.e. the starting row, from
  12835. the specified string.
  12836. Each non-whitespace character in the string is considered an alive
  12837. cell, a newline will terminate the row, and further characters in the
  12838. string will be ignored.
  12839. @item rate, r
  12840. Set the video rate, that is the number of frames generated per second.
  12841. Default is 25.
  12842. @item random_fill_ratio, ratio
  12843. Set the random fill ratio for the initial cellular automaton row. It
  12844. is a floating point number value ranging from 0 to 1, defaults to
  12845. 1/PHI.
  12846. This option is ignored when a file or a pattern is specified.
  12847. @item random_seed, seed
  12848. Set the seed for filling randomly the initial row, must be an integer
  12849. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12850. set to -1, the filter will try to use a good random seed on a best
  12851. effort basis.
  12852. @item rule
  12853. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12854. Default value is 110.
  12855. @item size, s
  12856. Set the size of the output video. For the syntax of this option, check the
  12857. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12858. If @option{filename} or @option{pattern} is specified, the size is set
  12859. by default to the width of the specified initial state row, and the
  12860. height is set to @var{width} * PHI.
  12861. If @option{size} is set, it must contain the width of the specified
  12862. pattern string, and the specified pattern will be centered in the
  12863. larger row.
  12864. If a filename or a pattern string is not specified, the size value
  12865. defaults to "320x518" (used for a randomly generated initial state).
  12866. @item scroll
  12867. If set to 1, scroll the output upward when all the rows in the output
  12868. have been already filled. If set to 0, the new generated row will be
  12869. written over the top row just after the bottom row is filled.
  12870. Defaults to 1.
  12871. @item start_full, full
  12872. If set to 1, completely fill the output with generated rows before
  12873. outputting the first frame.
  12874. This is the default behavior, for disabling set the value to 0.
  12875. @item stitch
  12876. If set to 1, stitch the left and right row edges together.
  12877. This is the default behavior, for disabling set the value to 0.
  12878. @end table
  12879. @subsection Examples
  12880. @itemize
  12881. @item
  12882. Read the initial state from @file{pattern}, and specify an output of
  12883. size 200x400.
  12884. @example
  12885. cellauto=f=pattern:s=200x400
  12886. @end example
  12887. @item
  12888. Generate a random initial row with a width of 200 cells, with a fill
  12889. ratio of 2/3:
  12890. @example
  12891. cellauto=ratio=2/3:s=200x200
  12892. @end example
  12893. @item
  12894. Create a pattern generated by rule 18 starting by a single alive cell
  12895. centered on an initial row with width 100:
  12896. @example
  12897. cellauto=p=@@:s=100x400:full=0:rule=18
  12898. @end example
  12899. @item
  12900. Specify a more elaborated initial pattern:
  12901. @example
  12902. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12903. @end example
  12904. @end itemize
  12905. @anchor{coreimagesrc}
  12906. @section coreimagesrc
  12907. Video source generated on GPU using Apple's CoreImage API on OSX.
  12908. This video source is a specialized version of the @ref{coreimage} video filter.
  12909. Use a core image generator at the beginning of the applied filterchain to
  12910. generate the content.
  12911. The coreimagesrc video source accepts the following options:
  12912. @table @option
  12913. @item list_generators
  12914. List all available generators along with all their respective options as well as
  12915. possible minimum and maximum values along with the default values.
  12916. @example
  12917. list_generators=true
  12918. @end example
  12919. @item size, s
  12920. Specify the size of the sourced video. For the syntax of this option, check the
  12921. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12922. The default value is @code{320x240}.
  12923. @item rate, r
  12924. Specify the frame rate of the sourced video, as the number of frames
  12925. generated per second. It has to be a string in the format
  12926. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12927. number or a valid video frame rate abbreviation. The default value is
  12928. "25".
  12929. @item sar
  12930. Set the sample aspect ratio of the sourced video.
  12931. @item duration, d
  12932. Set the duration of the sourced video. See
  12933. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12934. for the accepted syntax.
  12935. If not specified, or the expressed duration is negative, the video is
  12936. supposed to be generated forever.
  12937. @end table
  12938. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12939. A complete filterchain can be used for further processing of the
  12940. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12941. and examples for details.
  12942. @subsection Examples
  12943. @itemize
  12944. @item
  12945. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12946. given as complete and escaped command-line for Apple's standard bash shell:
  12947. @example
  12948. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12949. @end example
  12950. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12951. need for a nullsrc video source.
  12952. @end itemize
  12953. @section mandelbrot
  12954. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12955. point specified with @var{start_x} and @var{start_y}.
  12956. This source accepts the following options:
  12957. @table @option
  12958. @item end_pts
  12959. Set the terminal pts value. Default value is 400.
  12960. @item end_scale
  12961. Set the terminal scale value.
  12962. Must be a floating point value. Default value is 0.3.
  12963. @item inner
  12964. Set the inner coloring mode, that is the algorithm used to draw the
  12965. Mandelbrot fractal internal region.
  12966. It shall assume one of the following values:
  12967. @table @option
  12968. @item black
  12969. Set black mode.
  12970. @item convergence
  12971. Show time until convergence.
  12972. @item mincol
  12973. Set color based on point closest to the origin of the iterations.
  12974. @item period
  12975. Set period mode.
  12976. @end table
  12977. Default value is @var{mincol}.
  12978. @item bailout
  12979. Set the bailout value. Default value is 10.0.
  12980. @item maxiter
  12981. Set the maximum of iterations performed by the rendering
  12982. algorithm. Default value is 7189.
  12983. @item outer
  12984. Set outer coloring mode.
  12985. It shall assume one of following values:
  12986. @table @option
  12987. @item iteration_count
  12988. Set iteration cound mode.
  12989. @item normalized_iteration_count
  12990. set normalized iteration count mode.
  12991. @end table
  12992. Default value is @var{normalized_iteration_count}.
  12993. @item rate, r
  12994. Set frame rate, expressed as number of frames per second. Default
  12995. value is "25".
  12996. @item size, s
  12997. Set frame size. For the syntax of this option, check the "Video
  12998. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12999. @item start_scale
  13000. Set the initial scale value. Default value is 3.0.
  13001. @item start_x
  13002. Set the initial x position. Must be a floating point value between
  13003. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13004. @item start_y
  13005. Set the initial y position. Must be a floating point value between
  13006. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13007. @end table
  13008. @section mptestsrc
  13009. Generate various test patterns, as generated by the MPlayer test filter.
  13010. The size of the generated video is fixed, and is 256x256.
  13011. This source is useful in particular for testing encoding features.
  13012. This source accepts the following options:
  13013. @table @option
  13014. @item rate, r
  13015. Specify the frame rate of the sourced video, as the number of frames
  13016. generated per second. It has to be a string in the format
  13017. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13018. number or a valid video frame rate abbreviation. The default value is
  13019. "25".
  13020. @item duration, d
  13021. Set the duration of the sourced video. See
  13022. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13023. for the accepted syntax.
  13024. If not specified, or the expressed duration is negative, the video is
  13025. supposed to be generated forever.
  13026. @item test, t
  13027. Set the number or the name of the test to perform. Supported tests are:
  13028. @table @option
  13029. @item dc_luma
  13030. @item dc_chroma
  13031. @item freq_luma
  13032. @item freq_chroma
  13033. @item amp_luma
  13034. @item amp_chroma
  13035. @item cbp
  13036. @item mv
  13037. @item ring1
  13038. @item ring2
  13039. @item all
  13040. @end table
  13041. Default value is "all", which will cycle through the list of all tests.
  13042. @end table
  13043. Some examples:
  13044. @example
  13045. mptestsrc=t=dc_luma
  13046. @end example
  13047. will generate a "dc_luma" test pattern.
  13048. @section frei0r_src
  13049. Provide a frei0r source.
  13050. To enable compilation of this filter you need to install the frei0r
  13051. header and configure FFmpeg with @code{--enable-frei0r}.
  13052. This source accepts the following parameters:
  13053. @table @option
  13054. @item size
  13055. The size of the video to generate. For the syntax of this option, check the
  13056. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13057. @item framerate
  13058. The framerate of the generated video. It may be a string of the form
  13059. @var{num}/@var{den} or a frame rate abbreviation.
  13060. @item filter_name
  13061. The name to the frei0r source to load. For more information regarding frei0r and
  13062. how to set the parameters, read the @ref{frei0r} section in the video filters
  13063. documentation.
  13064. @item filter_params
  13065. A '|'-separated list of parameters to pass to the frei0r source.
  13066. @end table
  13067. For example, to generate a frei0r partik0l source with size 200x200
  13068. and frame rate 10 which is overlaid on the overlay filter main input:
  13069. @example
  13070. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13071. @end example
  13072. @section life
  13073. Generate a life pattern.
  13074. This source is based on a generalization of John Conway's life game.
  13075. The sourced input represents a life grid, each pixel represents a cell
  13076. which can be in one of two possible states, alive or dead. Every cell
  13077. interacts with its eight neighbours, which are the cells that are
  13078. horizontally, vertically, or diagonally adjacent.
  13079. At each interaction the grid evolves according to the adopted rule,
  13080. which specifies the number of neighbor alive cells which will make a
  13081. cell stay alive or born. The @option{rule} option allows one to specify
  13082. the rule to adopt.
  13083. This source accepts the following options:
  13084. @table @option
  13085. @item filename, f
  13086. Set the file from which to read the initial grid state. In the file,
  13087. each non-whitespace character is considered an alive cell, and newline
  13088. is used to delimit the end of each row.
  13089. If this option is not specified, the initial grid is generated
  13090. randomly.
  13091. @item rate, r
  13092. Set the video rate, that is the number of frames generated per second.
  13093. Default is 25.
  13094. @item random_fill_ratio, ratio
  13095. Set the random fill ratio for the initial random grid. It is a
  13096. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13097. It is ignored when a file is specified.
  13098. @item random_seed, seed
  13099. Set the seed for filling the initial random grid, must be an integer
  13100. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13101. set to -1, the filter will try to use a good random seed on a best
  13102. effort basis.
  13103. @item rule
  13104. Set the life rule.
  13105. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13106. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13107. @var{NS} specifies the number of alive neighbor cells which make a
  13108. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13109. which make a dead cell to become alive (i.e. to "born").
  13110. "s" and "b" can be used in place of "S" and "B", respectively.
  13111. Alternatively a rule can be specified by an 18-bits integer. The 9
  13112. high order bits are used to encode the next cell state if it is alive
  13113. for each number of neighbor alive cells, the low order bits specify
  13114. the rule for "borning" new cells. Higher order bits encode for an
  13115. higher number of neighbor cells.
  13116. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13117. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13118. Default value is "S23/B3", which is the original Conway's game of life
  13119. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13120. cells, and will born a new cell if there are three alive cells around
  13121. a dead cell.
  13122. @item size, s
  13123. Set the size of the output video. For the syntax of this option, check the
  13124. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13125. If @option{filename} is specified, the size is set by default to the
  13126. same size of the input file. If @option{size} is set, it must contain
  13127. the size specified in the input file, and the initial grid defined in
  13128. that file is centered in the larger resulting area.
  13129. If a filename is not specified, the size value defaults to "320x240"
  13130. (used for a randomly generated initial grid).
  13131. @item stitch
  13132. If set to 1, stitch the left and right grid edges together, and the
  13133. top and bottom edges also. Defaults to 1.
  13134. @item mold
  13135. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13136. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13137. value from 0 to 255.
  13138. @item life_color
  13139. Set the color of living (or new born) cells.
  13140. @item death_color
  13141. Set the color of dead cells. If @option{mold} is set, this is the first color
  13142. used to represent a dead cell.
  13143. @item mold_color
  13144. Set mold color, for definitely dead and moldy cells.
  13145. For the syntax of these 3 color options, check the "Color" section in the
  13146. ffmpeg-utils manual.
  13147. @end table
  13148. @subsection Examples
  13149. @itemize
  13150. @item
  13151. Read a grid from @file{pattern}, and center it on a grid of size
  13152. 300x300 pixels:
  13153. @example
  13154. life=f=pattern:s=300x300
  13155. @end example
  13156. @item
  13157. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13158. @example
  13159. life=ratio=2/3:s=200x200
  13160. @end example
  13161. @item
  13162. Specify a custom rule for evolving a randomly generated grid:
  13163. @example
  13164. life=rule=S14/B34
  13165. @end example
  13166. @item
  13167. Full example with slow death effect (mold) using @command{ffplay}:
  13168. @example
  13169. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13170. @end example
  13171. @end itemize
  13172. @anchor{allrgb}
  13173. @anchor{allyuv}
  13174. @anchor{color}
  13175. @anchor{haldclutsrc}
  13176. @anchor{nullsrc}
  13177. @anchor{rgbtestsrc}
  13178. @anchor{smptebars}
  13179. @anchor{smptehdbars}
  13180. @anchor{testsrc}
  13181. @anchor{testsrc2}
  13182. @anchor{yuvtestsrc}
  13183. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13184. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13185. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13186. The @code{color} source provides an uniformly colored input.
  13187. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13188. @ref{haldclut} filter.
  13189. The @code{nullsrc} source returns unprocessed video frames. It is
  13190. mainly useful to be employed in analysis / debugging tools, or as the
  13191. source for filters which ignore the input data.
  13192. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13193. detecting RGB vs BGR issues. You should see a red, green and blue
  13194. stripe from top to bottom.
  13195. The @code{smptebars} source generates a color bars pattern, based on
  13196. the SMPTE Engineering Guideline EG 1-1990.
  13197. The @code{smptehdbars} source generates a color bars pattern, based on
  13198. the SMPTE RP 219-2002.
  13199. The @code{testsrc} source generates a test video pattern, showing a
  13200. color pattern, a scrolling gradient and a timestamp. This is mainly
  13201. intended for testing purposes.
  13202. The @code{testsrc2} source is similar to testsrc, but supports more
  13203. pixel formats instead of just @code{rgb24}. This allows using it as an
  13204. input for other tests without requiring a format conversion.
  13205. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13206. see a y, cb and cr stripe from top to bottom.
  13207. The sources accept the following parameters:
  13208. @table @option
  13209. @item level
  13210. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13211. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13212. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13213. coded on a @code{1/(N*N)} scale.
  13214. @item color, c
  13215. Specify the color of the source, only available in the @code{color}
  13216. source. For the syntax of this option, check the "Color" section in the
  13217. ffmpeg-utils manual.
  13218. @item size, s
  13219. Specify the size of the sourced video. For the syntax of this option, check the
  13220. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13221. The default value is @code{320x240}.
  13222. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13223. @code{haldclutsrc} filters.
  13224. @item rate, r
  13225. Specify the frame rate of the sourced video, as the number of frames
  13226. generated per second. It has to be a string in the format
  13227. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13228. number or a valid video frame rate abbreviation. The default value is
  13229. "25".
  13230. @item duration, d
  13231. Set the duration of the sourced video. See
  13232. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13233. for the accepted syntax.
  13234. If not specified, or the expressed duration is negative, the video is
  13235. supposed to be generated forever.
  13236. @item sar
  13237. Set the sample aspect ratio of the sourced video.
  13238. @item alpha
  13239. Specify the alpha (opacity) of the background, only available in the
  13240. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13241. 255 (fully opaque, the default).
  13242. @item decimals, n
  13243. Set the number of decimals to show in the timestamp, only available in the
  13244. @code{testsrc} source.
  13245. The displayed timestamp value will correspond to the original
  13246. timestamp value multiplied by the power of 10 of the specified
  13247. value. Default value is 0.
  13248. @end table
  13249. @subsection Examples
  13250. @itemize
  13251. @item
  13252. Generate a video with a duration of 5.3 seconds, with size
  13253. 176x144 and a frame rate of 10 frames per second:
  13254. @example
  13255. testsrc=duration=5.3:size=qcif:rate=10
  13256. @end example
  13257. @item
  13258. The following graph description will generate a red source
  13259. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13260. frames per second:
  13261. @example
  13262. color=c=red@@0.2:s=qcif:r=10
  13263. @end example
  13264. @item
  13265. If the input content is to be ignored, @code{nullsrc} can be used. The
  13266. following command generates noise in the luminance plane by employing
  13267. the @code{geq} filter:
  13268. @example
  13269. nullsrc=s=256x256, geq=random(1)*255:128:128
  13270. @end example
  13271. @end itemize
  13272. @subsection Commands
  13273. The @code{color} source supports the following commands:
  13274. @table @option
  13275. @item c, color
  13276. Set the color of the created image. Accepts the same syntax of the
  13277. corresponding @option{color} option.
  13278. @end table
  13279. @c man end VIDEO SOURCES
  13280. @chapter Video Sinks
  13281. @c man begin VIDEO SINKS
  13282. Below is a description of the currently available video sinks.
  13283. @section buffersink
  13284. Buffer video frames, and make them available to the end of the filter
  13285. graph.
  13286. This sink is mainly intended for programmatic use, in particular
  13287. through the interface defined in @file{libavfilter/buffersink.h}
  13288. or the options system.
  13289. It accepts a pointer to an AVBufferSinkContext structure, which
  13290. defines the incoming buffers' formats, to be passed as the opaque
  13291. parameter to @code{avfilter_init_filter} for initialization.
  13292. @section nullsink
  13293. Null video sink: do absolutely nothing with the input video. It is
  13294. mainly useful as a template and for use in analysis / debugging
  13295. tools.
  13296. @c man end VIDEO SINKS
  13297. @chapter Multimedia Filters
  13298. @c man begin MULTIMEDIA FILTERS
  13299. Below is a description of the currently available multimedia filters.
  13300. @section abitscope
  13301. Convert input audio to a video output, displaying the audio bit scope.
  13302. The filter accepts the following options:
  13303. @table @option
  13304. @item rate, r
  13305. Set frame rate, expressed as number of frames per second. Default
  13306. value is "25".
  13307. @item size, s
  13308. Specify the video size for the output. For the syntax of this option, check the
  13309. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13310. Default value is @code{1024x256}.
  13311. @item colors
  13312. Specify list of colors separated by space or by '|' which will be used to
  13313. draw channels. Unrecognized or missing colors will be replaced
  13314. by white color.
  13315. @end table
  13316. @section ahistogram
  13317. Convert input audio to a video output, displaying the volume histogram.
  13318. The filter accepts the following options:
  13319. @table @option
  13320. @item dmode
  13321. Specify how histogram is calculated.
  13322. It accepts the following values:
  13323. @table @samp
  13324. @item single
  13325. Use single histogram for all channels.
  13326. @item separate
  13327. Use separate histogram for each channel.
  13328. @end table
  13329. Default is @code{single}.
  13330. @item rate, r
  13331. Set frame rate, expressed as number of frames per second. Default
  13332. value is "25".
  13333. @item size, s
  13334. Specify the video size for the output. For the syntax of this option, check the
  13335. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13336. Default value is @code{hd720}.
  13337. @item scale
  13338. Set display scale.
  13339. It accepts the following values:
  13340. @table @samp
  13341. @item log
  13342. logarithmic
  13343. @item sqrt
  13344. square root
  13345. @item cbrt
  13346. cubic root
  13347. @item lin
  13348. linear
  13349. @item rlog
  13350. reverse logarithmic
  13351. @end table
  13352. Default is @code{log}.
  13353. @item ascale
  13354. Set amplitude scale.
  13355. It accepts the following values:
  13356. @table @samp
  13357. @item log
  13358. logarithmic
  13359. @item lin
  13360. linear
  13361. @end table
  13362. Default is @code{log}.
  13363. @item acount
  13364. Set how much frames to accumulate in histogram.
  13365. Defauls is 1. Setting this to -1 accumulates all frames.
  13366. @item rheight
  13367. Set histogram ratio of window height.
  13368. @item slide
  13369. Set sonogram sliding.
  13370. It accepts the following values:
  13371. @table @samp
  13372. @item replace
  13373. replace old rows with new ones.
  13374. @item scroll
  13375. scroll from top to bottom.
  13376. @end table
  13377. Default is @code{replace}.
  13378. @end table
  13379. @section aphasemeter
  13380. Convert input audio to a video output, displaying the audio phase.
  13381. The filter accepts the following options:
  13382. @table @option
  13383. @item rate, r
  13384. Set the output frame rate. Default value is @code{25}.
  13385. @item size, s
  13386. Set the video size for the output. For the syntax of this option, check the
  13387. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13388. Default value is @code{800x400}.
  13389. @item rc
  13390. @item gc
  13391. @item bc
  13392. Specify the red, green, blue contrast. Default values are @code{2},
  13393. @code{7} and @code{1}.
  13394. Allowed range is @code{[0, 255]}.
  13395. @item mpc
  13396. Set color which will be used for drawing median phase. If color is
  13397. @code{none} which is default, no median phase value will be drawn.
  13398. @item video
  13399. Enable video output. Default is enabled.
  13400. @end table
  13401. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13402. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13403. The @code{-1} means left and right channels are completely out of phase and
  13404. @code{1} means channels are in phase.
  13405. @section avectorscope
  13406. Convert input audio to a video output, representing the audio vector
  13407. scope.
  13408. The filter is used to measure the difference between channels of stereo
  13409. audio stream. A monoaural signal, consisting of identical left and right
  13410. signal, results in straight vertical line. Any stereo separation is visible
  13411. as a deviation from this line, creating a Lissajous figure.
  13412. If the straight (or deviation from it) but horizontal line appears this
  13413. indicates that the left and right channels are out of phase.
  13414. The filter accepts the following options:
  13415. @table @option
  13416. @item mode, m
  13417. Set the vectorscope mode.
  13418. Available values are:
  13419. @table @samp
  13420. @item lissajous
  13421. Lissajous rotated by 45 degrees.
  13422. @item lissajous_xy
  13423. Same as above but not rotated.
  13424. @item polar
  13425. Shape resembling half of circle.
  13426. @end table
  13427. Default value is @samp{lissajous}.
  13428. @item size, s
  13429. Set the video size for the output. For the syntax of this option, check the
  13430. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13431. Default value is @code{400x400}.
  13432. @item rate, r
  13433. Set the output frame rate. Default value is @code{25}.
  13434. @item rc
  13435. @item gc
  13436. @item bc
  13437. @item ac
  13438. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13439. @code{160}, @code{80} and @code{255}.
  13440. Allowed range is @code{[0, 255]}.
  13441. @item rf
  13442. @item gf
  13443. @item bf
  13444. @item af
  13445. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13446. @code{10}, @code{5} and @code{5}.
  13447. Allowed range is @code{[0, 255]}.
  13448. @item zoom
  13449. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13450. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13451. @item draw
  13452. Set the vectorscope drawing mode.
  13453. Available values are:
  13454. @table @samp
  13455. @item dot
  13456. Draw dot for each sample.
  13457. @item line
  13458. Draw line between previous and current sample.
  13459. @end table
  13460. Default value is @samp{dot}.
  13461. @item scale
  13462. Specify amplitude scale of audio samples.
  13463. Available values are:
  13464. @table @samp
  13465. @item lin
  13466. Linear.
  13467. @item sqrt
  13468. Square root.
  13469. @item cbrt
  13470. Cubic root.
  13471. @item log
  13472. Logarithmic.
  13473. @end table
  13474. @item swap
  13475. Swap left channel axis with right channel axis.
  13476. @item mirror
  13477. Mirror axis.
  13478. @table @samp
  13479. @item none
  13480. No mirror.
  13481. @item x
  13482. Mirror only x axis.
  13483. @item y
  13484. Mirror only y axis.
  13485. @item xy
  13486. Mirror both axis.
  13487. @end table
  13488. @end table
  13489. @subsection Examples
  13490. @itemize
  13491. @item
  13492. Complete example using @command{ffplay}:
  13493. @example
  13494. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13495. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13496. @end example
  13497. @end itemize
  13498. @section bench, abench
  13499. Benchmark part of a filtergraph.
  13500. The filter accepts the following options:
  13501. @table @option
  13502. @item action
  13503. Start or stop a timer.
  13504. Available values are:
  13505. @table @samp
  13506. @item start
  13507. Get the current time, set it as frame metadata (using the key
  13508. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13509. @item stop
  13510. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13511. the input frame metadata to get the time difference. Time difference, average,
  13512. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13513. @code{min}) are then printed. The timestamps are expressed in seconds.
  13514. @end table
  13515. @end table
  13516. @subsection Examples
  13517. @itemize
  13518. @item
  13519. Benchmark @ref{selectivecolor} filter:
  13520. @example
  13521. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13522. @end example
  13523. @end itemize
  13524. @section concat
  13525. Concatenate audio and video streams, joining them together one after the
  13526. other.
  13527. The filter works on segments of synchronized video and audio streams. All
  13528. segments must have the same number of streams of each type, and that will
  13529. also be the number of streams at output.
  13530. The filter accepts the following options:
  13531. @table @option
  13532. @item n
  13533. Set the number of segments. Default is 2.
  13534. @item v
  13535. Set the number of output video streams, that is also the number of video
  13536. streams in each segment. Default is 1.
  13537. @item a
  13538. Set the number of output audio streams, that is also the number of audio
  13539. streams in each segment. Default is 0.
  13540. @item unsafe
  13541. Activate unsafe mode: do not fail if segments have a different format.
  13542. @end table
  13543. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13544. @var{a} audio outputs.
  13545. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13546. segment, in the same order as the outputs, then the inputs for the second
  13547. segment, etc.
  13548. Related streams do not always have exactly the same duration, for various
  13549. reasons including codec frame size or sloppy authoring. For that reason,
  13550. related synchronized streams (e.g. a video and its audio track) should be
  13551. concatenated at once. The concat filter will use the duration of the longest
  13552. stream in each segment (except the last one), and if necessary pad shorter
  13553. audio streams with silence.
  13554. For this filter to work correctly, all segments must start at timestamp 0.
  13555. All corresponding streams must have the same parameters in all segments; the
  13556. filtering system will automatically select a common pixel format for video
  13557. streams, and a common sample format, sample rate and channel layout for
  13558. audio streams, but other settings, such as resolution, must be converted
  13559. explicitly by the user.
  13560. Different frame rates are acceptable but will result in variable frame rate
  13561. at output; be sure to configure the output file to handle it.
  13562. @subsection Examples
  13563. @itemize
  13564. @item
  13565. Concatenate an opening, an episode and an ending, all in bilingual version
  13566. (video in stream 0, audio in streams 1 and 2):
  13567. @example
  13568. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13569. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13570. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13571. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13572. @end example
  13573. @item
  13574. Concatenate two parts, handling audio and video separately, using the
  13575. (a)movie sources, and adjusting the resolution:
  13576. @example
  13577. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13578. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13579. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13580. @end example
  13581. Note that a desync will happen at the stitch if the audio and video streams
  13582. do not have exactly the same duration in the first file.
  13583. @end itemize
  13584. @section drawgraph, adrawgraph
  13585. Draw a graph using input video or audio metadata.
  13586. It accepts the following parameters:
  13587. @table @option
  13588. @item m1
  13589. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13590. @item fg1
  13591. Set 1st foreground color expression.
  13592. @item m2
  13593. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13594. @item fg2
  13595. Set 2nd foreground color expression.
  13596. @item m3
  13597. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13598. @item fg3
  13599. Set 3rd foreground color expression.
  13600. @item m4
  13601. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13602. @item fg4
  13603. Set 4th foreground color expression.
  13604. @item min
  13605. Set minimal value of metadata value.
  13606. @item max
  13607. Set maximal value of metadata value.
  13608. @item bg
  13609. Set graph background color. Default is white.
  13610. @item mode
  13611. Set graph mode.
  13612. Available values for mode is:
  13613. @table @samp
  13614. @item bar
  13615. @item dot
  13616. @item line
  13617. @end table
  13618. Default is @code{line}.
  13619. @item slide
  13620. Set slide mode.
  13621. Available values for slide is:
  13622. @table @samp
  13623. @item frame
  13624. Draw new frame when right border is reached.
  13625. @item replace
  13626. Replace old columns with new ones.
  13627. @item scroll
  13628. Scroll from right to left.
  13629. @item rscroll
  13630. Scroll from left to right.
  13631. @item picture
  13632. Draw single picture.
  13633. @end table
  13634. Default is @code{frame}.
  13635. @item size
  13636. Set size of graph video. For the syntax of this option, check the
  13637. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13638. The default value is @code{900x256}.
  13639. The foreground color expressions can use the following variables:
  13640. @table @option
  13641. @item MIN
  13642. Minimal value of metadata value.
  13643. @item MAX
  13644. Maximal value of metadata value.
  13645. @item VAL
  13646. Current metadata key value.
  13647. @end table
  13648. The color is defined as 0xAABBGGRR.
  13649. @end table
  13650. Example using metadata from @ref{signalstats} filter:
  13651. @example
  13652. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13653. @end example
  13654. Example using metadata from @ref{ebur128} filter:
  13655. @example
  13656. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13657. @end example
  13658. @anchor{ebur128}
  13659. @section ebur128
  13660. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13661. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13662. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13663. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13664. The filter also has a video output (see the @var{video} option) with a real
  13665. time graph to observe the loudness evolution. The graphic contains the logged
  13666. message mentioned above, so it is not printed anymore when this option is set,
  13667. unless the verbose logging is set. The main graphing area contains the
  13668. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13669. the momentary loudness (400 milliseconds).
  13670. More information about the Loudness Recommendation EBU R128 on
  13671. @url{http://tech.ebu.ch/loudness}.
  13672. The filter accepts the following options:
  13673. @table @option
  13674. @item video
  13675. Activate the video output. The audio stream is passed unchanged whether this
  13676. option is set or no. The video stream will be the first output stream if
  13677. activated. Default is @code{0}.
  13678. @item size
  13679. Set the video size. This option is for video only. For the syntax of this
  13680. option, check the
  13681. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13682. Default and minimum resolution is @code{640x480}.
  13683. @item meter
  13684. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13685. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13686. other integer value between this range is allowed.
  13687. @item metadata
  13688. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13689. into 100ms output frames, each of them containing various loudness information
  13690. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13691. Default is @code{0}.
  13692. @item framelog
  13693. Force the frame logging level.
  13694. Available values are:
  13695. @table @samp
  13696. @item info
  13697. information logging level
  13698. @item verbose
  13699. verbose logging level
  13700. @end table
  13701. By default, the logging level is set to @var{info}. If the @option{video} or
  13702. the @option{metadata} options are set, it switches to @var{verbose}.
  13703. @item peak
  13704. Set peak mode(s).
  13705. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13706. values are:
  13707. @table @samp
  13708. @item none
  13709. Disable any peak mode (default).
  13710. @item sample
  13711. Enable sample-peak mode.
  13712. Simple peak mode looking for the higher sample value. It logs a message
  13713. for sample-peak (identified by @code{SPK}).
  13714. @item true
  13715. Enable true-peak mode.
  13716. If enabled, the peak lookup is done on an over-sampled version of the input
  13717. stream for better peak accuracy. It logs a message for true-peak.
  13718. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13719. This mode requires a build with @code{libswresample}.
  13720. @end table
  13721. @item dualmono
  13722. Treat mono input files as "dual mono". If a mono file is intended for playback
  13723. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13724. If set to @code{true}, this option will compensate for this effect.
  13725. Multi-channel input files are not affected by this option.
  13726. @item panlaw
  13727. Set a specific pan law to be used for the measurement of dual mono files.
  13728. This parameter is optional, and has a default value of -3.01dB.
  13729. @end table
  13730. @subsection Examples
  13731. @itemize
  13732. @item
  13733. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13734. @example
  13735. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13736. @end example
  13737. @item
  13738. Run an analysis with @command{ffmpeg}:
  13739. @example
  13740. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13741. @end example
  13742. @end itemize
  13743. @section interleave, ainterleave
  13744. Temporally interleave frames from several inputs.
  13745. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13746. These filters read frames from several inputs and send the oldest
  13747. queued frame to the output.
  13748. Input streams must have well defined, monotonically increasing frame
  13749. timestamp values.
  13750. In order to submit one frame to output, these filters need to enqueue
  13751. at least one frame for each input, so they cannot work in case one
  13752. input is not yet terminated and will not receive incoming frames.
  13753. For example consider the case when one input is a @code{select} filter
  13754. which always drops input frames. The @code{interleave} filter will keep
  13755. reading from that input, but it will never be able to send new frames
  13756. to output until the input sends an end-of-stream signal.
  13757. Also, depending on inputs synchronization, the filters will drop
  13758. frames in case one input receives more frames than the other ones, and
  13759. the queue is already filled.
  13760. These filters accept the following options:
  13761. @table @option
  13762. @item nb_inputs, n
  13763. Set the number of different inputs, it is 2 by default.
  13764. @end table
  13765. @subsection Examples
  13766. @itemize
  13767. @item
  13768. Interleave frames belonging to different streams using @command{ffmpeg}:
  13769. @example
  13770. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13771. @end example
  13772. @item
  13773. Add flickering blur effect:
  13774. @example
  13775. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13776. @end example
  13777. @end itemize
  13778. @section metadata, ametadata
  13779. Manipulate frame metadata.
  13780. This filter accepts the following options:
  13781. @table @option
  13782. @item mode
  13783. Set mode of operation of the filter.
  13784. Can be one of the following:
  13785. @table @samp
  13786. @item select
  13787. If both @code{value} and @code{key} is set, select frames
  13788. which have such metadata. If only @code{key} is set, select
  13789. every frame that has such key in metadata.
  13790. @item add
  13791. Add new metadata @code{key} and @code{value}. If key is already available
  13792. do nothing.
  13793. @item modify
  13794. Modify value of already present key.
  13795. @item delete
  13796. If @code{value} is set, delete only keys that have such value.
  13797. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13798. the frame.
  13799. @item print
  13800. Print key and its value if metadata was found. If @code{key} is not set print all
  13801. metadata values available in frame.
  13802. @end table
  13803. @item key
  13804. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13805. @item value
  13806. Set metadata value which will be used. This option is mandatory for
  13807. @code{modify} and @code{add} mode.
  13808. @item function
  13809. Which function to use when comparing metadata value and @code{value}.
  13810. Can be one of following:
  13811. @table @samp
  13812. @item same_str
  13813. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13814. @item starts_with
  13815. Values are interpreted as strings, returns true if metadata value starts with
  13816. the @code{value} option string.
  13817. @item less
  13818. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13819. @item equal
  13820. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13821. @item greater
  13822. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13823. @item expr
  13824. Values are interpreted as floats, returns true if expression from option @code{expr}
  13825. evaluates to true.
  13826. @end table
  13827. @item expr
  13828. Set expression which is used when @code{function} is set to @code{expr}.
  13829. The expression is evaluated through the eval API and can contain the following
  13830. constants:
  13831. @table @option
  13832. @item VALUE1
  13833. Float representation of @code{value} from metadata key.
  13834. @item VALUE2
  13835. Float representation of @code{value} as supplied by user in @code{value} option.
  13836. @end table
  13837. @item file
  13838. If specified in @code{print} mode, output is written to the named file. Instead of
  13839. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13840. for standard output. If @code{file} option is not set, output is written to the log
  13841. with AV_LOG_INFO loglevel.
  13842. @end table
  13843. @subsection Examples
  13844. @itemize
  13845. @item
  13846. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13847. between 0 and 1.
  13848. @example
  13849. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13850. @end example
  13851. @item
  13852. Print silencedetect output to file @file{metadata.txt}.
  13853. @example
  13854. silencedetect,ametadata=mode=print:file=metadata.txt
  13855. @end example
  13856. @item
  13857. Direct all metadata to a pipe with file descriptor 4.
  13858. @example
  13859. metadata=mode=print:file='pipe\:4'
  13860. @end example
  13861. @end itemize
  13862. @section perms, aperms
  13863. Set read/write permissions for the output frames.
  13864. These filters are mainly aimed at developers to test direct path in the
  13865. following filter in the filtergraph.
  13866. The filters accept the following options:
  13867. @table @option
  13868. @item mode
  13869. Select the permissions mode.
  13870. It accepts the following values:
  13871. @table @samp
  13872. @item none
  13873. Do nothing. This is the default.
  13874. @item ro
  13875. Set all the output frames read-only.
  13876. @item rw
  13877. Set all the output frames directly writable.
  13878. @item toggle
  13879. Make the frame read-only if writable, and writable if read-only.
  13880. @item random
  13881. Set each output frame read-only or writable randomly.
  13882. @end table
  13883. @item seed
  13884. Set the seed for the @var{random} mode, must be an integer included between
  13885. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13886. @code{-1}, the filter will try to use a good random seed on a best effort
  13887. basis.
  13888. @end table
  13889. Note: in case of auto-inserted filter between the permission filter and the
  13890. following one, the permission might not be received as expected in that
  13891. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13892. perms/aperms filter can avoid this problem.
  13893. @section realtime, arealtime
  13894. Slow down filtering to match real time approximately.
  13895. These filters will pause the filtering for a variable amount of time to
  13896. match the output rate with the input timestamps.
  13897. They are similar to the @option{re} option to @code{ffmpeg}.
  13898. They accept the following options:
  13899. @table @option
  13900. @item limit
  13901. Time limit for the pauses. Any pause longer than that will be considered
  13902. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13903. @end table
  13904. @anchor{select}
  13905. @section select, aselect
  13906. Select frames to pass in output.
  13907. This filter accepts the following options:
  13908. @table @option
  13909. @item expr, e
  13910. Set expression, which is evaluated for each input frame.
  13911. If the expression is evaluated to zero, the frame is discarded.
  13912. If the evaluation result is negative or NaN, the frame is sent to the
  13913. first output; otherwise it is sent to the output with index
  13914. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13915. For example a value of @code{1.2} corresponds to the output with index
  13916. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13917. @item outputs, n
  13918. Set the number of outputs. The output to which to send the selected
  13919. frame is based on the result of the evaluation. Default value is 1.
  13920. @end table
  13921. The expression can contain the following constants:
  13922. @table @option
  13923. @item n
  13924. The (sequential) number of the filtered frame, starting from 0.
  13925. @item selected_n
  13926. The (sequential) number of the selected frame, starting from 0.
  13927. @item prev_selected_n
  13928. The sequential number of the last selected frame. It's NAN if undefined.
  13929. @item TB
  13930. The timebase of the input timestamps.
  13931. @item pts
  13932. The PTS (Presentation TimeStamp) of the filtered video frame,
  13933. expressed in @var{TB} units. It's NAN if undefined.
  13934. @item t
  13935. The PTS of the filtered video frame,
  13936. expressed in seconds. It's NAN if undefined.
  13937. @item prev_pts
  13938. The PTS of the previously filtered video frame. It's NAN if undefined.
  13939. @item prev_selected_pts
  13940. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13941. @item prev_selected_t
  13942. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13943. @item start_pts
  13944. The PTS of the first video frame in the video. It's NAN if undefined.
  13945. @item start_t
  13946. The time of the first video frame in the video. It's NAN if undefined.
  13947. @item pict_type @emph{(video only)}
  13948. The type of the filtered frame. It can assume one of the following
  13949. values:
  13950. @table @option
  13951. @item I
  13952. @item P
  13953. @item B
  13954. @item S
  13955. @item SI
  13956. @item SP
  13957. @item BI
  13958. @end table
  13959. @item interlace_type @emph{(video only)}
  13960. The frame interlace type. It can assume one of the following values:
  13961. @table @option
  13962. @item PROGRESSIVE
  13963. The frame is progressive (not interlaced).
  13964. @item TOPFIRST
  13965. The frame is top-field-first.
  13966. @item BOTTOMFIRST
  13967. The frame is bottom-field-first.
  13968. @end table
  13969. @item consumed_sample_n @emph{(audio only)}
  13970. the number of selected samples before the current frame
  13971. @item samples_n @emph{(audio only)}
  13972. the number of samples in the current frame
  13973. @item sample_rate @emph{(audio only)}
  13974. the input sample rate
  13975. @item key
  13976. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13977. @item pos
  13978. the position in the file of the filtered frame, -1 if the information
  13979. is not available (e.g. for synthetic video)
  13980. @item scene @emph{(video only)}
  13981. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13982. probability for the current frame to introduce a new scene, while a higher
  13983. value means the current frame is more likely to be one (see the example below)
  13984. @item concatdec_select
  13985. The concat demuxer can select only part of a concat input file by setting an
  13986. inpoint and an outpoint, but the output packets may not be entirely contained
  13987. in the selected interval. By using this variable, it is possible to skip frames
  13988. generated by the concat demuxer which are not exactly contained in the selected
  13989. interval.
  13990. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13991. and the @var{lavf.concat.duration} packet metadata values which are also
  13992. present in the decoded frames.
  13993. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13994. start_time and either the duration metadata is missing or the frame pts is less
  13995. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13996. missing.
  13997. That basically means that an input frame is selected if its pts is within the
  13998. interval set by the concat demuxer.
  13999. @end table
  14000. The default value of the select expression is "1".
  14001. @subsection Examples
  14002. @itemize
  14003. @item
  14004. Select all frames in input:
  14005. @example
  14006. select
  14007. @end example
  14008. The example above is the same as:
  14009. @example
  14010. select=1
  14011. @end example
  14012. @item
  14013. Skip all frames:
  14014. @example
  14015. select=0
  14016. @end example
  14017. @item
  14018. Select only I-frames:
  14019. @example
  14020. select='eq(pict_type\,I)'
  14021. @end example
  14022. @item
  14023. Select one frame every 100:
  14024. @example
  14025. select='not(mod(n\,100))'
  14026. @end example
  14027. @item
  14028. Select only frames contained in the 10-20 time interval:
  14029. @example
  14030. select=between(t\,10\,20)
  14031. @end example
  14032. @item
  14033. Select only I-frames contained in the 10-20 time interval:
  14034. @example
  14035. select=between(t\,10\,20)*eq(pict_type\,I)
  14036. @end example
  14037. @item
  14038. Select frames with a minimum distance of 10 seconds:
  14039. @example
  14040. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14041. @end example
  14042. @item
  14043. Use aselect to select only audio frames with samples number > 100:
  14044. @example
  14045. aselect='gt(samples_n\,100)'
  14046. @end example
  14047. @item
  14048. Create a mosaic of the first scenes:
  14049. @example
  14050. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14051. @end example
  14052. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14053. choice.
  14054. @item
  14055. Send even and odd frames to separate outputs, and compose them:
  14056. @example
  14057. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14058. @end example
  14059. @item
  14060. Select useful frames from an ffconcat file which is using inpoints and
  14061. outpoints but where the source files are not intra frame only.
  14062. @example
  14063. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14064. @end example
  14065. @end itemize
  14066. @section sendcmd, asendcmd
  14067. Send commands to filters in the filtergraph.
  14068. These filters read commands to be sent to other filters in the
  14069. filtergraph.
  14070. @code{sendcmd} must be inserted between two video filters,
  14071. @code{asendcmd} must be inserted between two audio filters, but apart
  14072. from that they act the same way.
  14073. The specification of commands can be provided in the filter arguments
  14074. with the @var{commands} option, or in a file specified by the
  14075. @var{filename} option.
  14076. These filters accept the following options:
  14077. @table @option
  14078. @item commands, c
  14079. Set the commands to be read and sent to the other filters.
  14080. @item filename, f
  14081. Set the filename of the commands to be read and sent to the other
  14082. filters.
  14083. @end table
  14084. @subsection Commands syntax
  14085. A commands description consists of a sequence of interval
  14086. specifications, comprising a list of commands to be executed when a
  14087. particular event related to that interval occurs. The occurring event
  14088. is typically the current frame time entering or leaving a given time
  14089. interval.
  14090. An interval is specified by the following syntax:
  14091. @example
  14092. @var{START}[-@var{END}] @var{COMMANDS};
  14093. @end example
  14094. The time interval is specified by the @var{START} and @var{END} times.
  14095. @var{END} is optional and defaults to the maximum time.
  14096. The current frame time is considered within the specified interval if
  14097. it is included in the interval [@var{START}, @var{END}), that is when
  14098. the time is greater or equal to @var{START} and is lesser than
  14099. @var{END}.
  14100. @var{COMMANDS} consists of a sequence of one or more command
  14101. specifications, separated by ",", relating to that interval. The
  14102. syntax of a command specification is given by:
  14103. @example
  14104. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14105. @end example
  14106. @var{FLAGS} is optional and specifies the type of events relating to
  14107. the time interval which enable sending the specified command, and must
  14108. be a non-null sequence of identifier flags separated by "+" or "|" and
  14109. enclosed between "[" and "]".
  14110. The following flags are recognized:
  14111. @table @option
  14112. @item enter
  14113. The command is sent when the current frame timestamp enters the
  14114. specified interval. In other words, the command is sent when the
  14115. previous frame timestamp was not in the given interval, and the
  14116. current is.
  14117. @item leave
  14118. The command is sent when the current frame timestamp leaves the
  14119. specified interval. In other words, the command is sent when the
  14120. previous frame timestamp was in the given interval, and the
  14121. current is not.
  14122. @end table
  14123. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14124. assumed.
  14125. @var{TARGET} specifies the target of the command, usually the name of
  14126. the filter class or a specific filter instance name.
  14127. @var{COMMAND} specifies the name of the command for the target filter.
  14128. @var{ARG} is optional and specifies the optional list of argument for
  14129. the given @var{COMMAND}.
  14130. Between one interval specification and another, whitespaces, or
  14131. sequences of characters starting with @code{#} until the end of line,
  14132. are ignored and can be used to annotate comments.
  14133. A simplified BNF description of the commands specification syntax
  14134. follows:
  14135. @example
  14136. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14137. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14138. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14139. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14140. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14141. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14142. @end example
  14143. @subsection Examples
  14144. @itemize
  14145. @item
  14146. Specify audio tempo change at second 4:
  14147. @example
  14148. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14149. @end example
  14150. @item
  14151. Target a specific filter instance:
  14152. @example
  14153. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14154. @end example
  14155. @item
  14156. Specify a list of drawtext and hue commands in a file.
  14157. @example
  14158. # show text in the interval 5-10
  14159. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14160. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14161. # desaturate the image in the interval 15-20
  14162. 15.0-20.0 [enter] hue s 0,
  14163. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14164. [leave] hue s 1,
  14165. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14166. # apply an exponential saturation fade-out effect, starting from time 25
  14167. 25 [enter] hue s exp(25-t)
  14168. @end example
  14169. A filtergraph allowing to read and process the above command list
  14170. stored in a file @file{test.cmd}, can be specified with:
  14171. @example
  14172. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14173. @end example
  14174. @end itemize
  14175. @anchor{setpts}
  14176. @section setpts, asetpts
  14177. Change the PTS (presentation timestamp) of the input frames.
  14178. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14179. This filter accepts the following options:
  14180. @table @option
  14181. @item expr
  14182. The expression which is evaluated for each frame to construct its timestamp.
  14183. @end table
  14184. The expression is evaluated through the eval API and can contain the following
  14185. constants:
  14186. @table @option
  14187. @item FRAME_RATE
  14188. frame rate, only defined for constant frame-rate video
  14189. @item PTS
  14190. The presentation timestamp in input
  14191. @item N
  14192. The count of the input frame for video or the number of consumed samples,
  14193. not including the current frame for audio, starting from 0.
  14194. @item NB_CONSUMED_SAMPLES
  14195. The number of consumed samples, not including the current frame (only
  14196. audio)
  14197. @item NB_SAMPLES, S
  14198. The number of samples in the current frame (only audio)
  14199. @item SAMPLE_RATE, SR
  14200. The audio sample rate.
  14201. @item STARTPTS
  14202. The PTS of the first frame.
  14203. @item STARTT
  14204. the time in seconds of the first frame
  14205. @item INTERLACED
  14206. State whether the current frame is interlaced.
  14207. @item T
  14208. the time in seconds of the current frame
  14209. @item POS
  14210. original position in the file of the frame, or undefined if undefined
  14211. for the current frame
  14212. @item PREV_INPTS
  14213. The previous input PTS.
  14214. @item PREV_INT
  14215. previous input time in seconds
  14216. @item PREV_OUTPTS
  14217. The previous output PTS.
  14218. @item PREV_OUTT
  14219. previous output time in seconds
  14220. @item RTCTIME
  14221. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14222. instead.
  14223. @item RTCSTART
  14224. The wallclock (RTC) time at the start of the movie in microseconds.
  14225. @item TB
  14226. The timebase of the input timestamps.
  14227. @end table
  14228. @subsection Examples
  14229. @itemize
  14230. @item
  14231. Start counting PTS from zero
  14232. @example
  14233. setpts=PTS-STARTPTS
  14234. @end example
  14235. @item
  14236. Apply fast motion effect:
  14237. @example
  14238. setpts=0.5*PTS
  14239. @end example
  14240. @item
  14241. Apply slow motion effect:
  14242. @example
  14243. setpts=2.0*PTS
  14244. @end example
  14245. @item
  14246. Set fixed rate of 25 frames per second:
  14247. @example
  14248. setpts=N/(25*TB)
  14249. @end example
  14250. @item
  14251. Set fixed rate 25 fps with some jitter:
  14252. @example
  14253. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14254. @end example
  14255. @item
  14256. Apply an offset of 10 seconds to the input PTS:
  14257. @example
  14258. setpts=PTS+10/TB
  14259. @end example
  14260. @item
  14261. Generate timestamps from a "live source" and rebase onto the current timebase:
  14262. @example
  14263. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14264. @end example
  14265. @item
  14266. Generate timestamps by counting samples:
  14267. @example
  14268. asetpts=N/SR/TB
  14269. @end example
  14270. @end itemize
  14271. @section setrange
  14272. Force color range for the output video frame.
  14273. The @code{setrange} filter marks the color range property for the
  14274. output frames. It does not change the input frame, but only sets the
  14275. corresponding property, which affects how the frame is treated by
  14276. following filters.
  14277. The filter accepts the following options:
  14278. @table @option
  14279. @item range
  14280. Available values are:
  14281. @table @samp
  14282. @item auto
  14283. Keep the same color range property.
  14284. @item unspecified, unknown
  14285. Set the color range as unspecified.
  14286. @item limited, tv, mpeg
  14287. Set the color range as limited.
  14288. @item full, pc, jpeg
  14289. Set the color range as full.
  14290. @end table
  14291. @end table
  14292. @section settb, asettb
  14293. Set the timebase to use for the output frames timestamps.
  14294. It is mainly useful for testing timebase configuration.
  14295. It accepts the following parameters:
  14296. @table @option
  14297. @item expr, tb
  14298. The expression which is evaluated into the output timebase.
  14299. @end table
  14300. The value for @option{tb} is an arithmetic expression representing a
  14301. rational. The expression can contain the constants "AVTB" (the default
  14302. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14303. audio only). Default value is "intb".
  14304. @subsection Examples
  14305. @itemize
  14306. @item
  14307. Set the timebase to 1/25:
  14308. @example
  14309. settb=expr=1/25
  14310. @end example
  14311. @item
  14312. Set the timebase to 1/10:
  14313. @example
  14314. settb=expr=0.1
  14315. @end example
  14316. @item
  14317. Set the timebase to 1001/1000:
  14318. @example
  14319. settb=1+0.001
  14320. @end example
  14321. @item
  14322. Set the timebase to 2*intb:
  14323. @example
  14324. settb=2*intb
  14325. @end example
  14326. @item
  14327. Set the default timebase value:
  14328. @example
  14329. settb=AVTB
  14330. @end example
  14331. @end itemize
  14332. @section showcqt
  14333. Convert input audio to a video output representing frequency spectrum
  14334. logarithmically using Brown-Puckette constant Q transform algorithm with
  14335. direct frequency domain coefficient calculation (but the transform itself
  14336. is not really constant Q, instead the Q factor is actually variable/clamped),
  14337. with musical tone scale, from E0 to D#10.
  14338. The filter accepts the following options:
  14339. @table @option
  14340. @item size, s
  14341. Specify the video size for the output. It must be even. For the syntax of this option,
  14342. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14343. Default value is @code{1920x1080}.
  14344. @item fps, rate, r
  14345. Set the output frame rate. Default value is @code{25}.
  14346. @item bar_h
  14347. Set the bargraph height. It must be even. Default value is @code{-1} which
  14348. computes the bargraph height automatically.
  14349. @item axis_h
  14350. Set the axis height. It must be even. Default value is @code{-1} which computes
  14351. the axis height automatically.
  14352. @item sono_h
  14353. Set the sonogram height. It must be even. Default value is @code{-1} which
  14354. computes the sonogram height automatically.
  14355. @item fullhd
  14356. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14357. instead. Default value is @code{1}.
  14358. @item sono_v, volume
  14359. Specify the sonogram volume expression. It can contain variables:
  14360. @table @option
  14361. @item bar_v
  14362. the @var{bar_v} evaluated expression
  14363. @item frequency, freq, f
  14364. the frequency where it is evaluated
  14365. @item timeclamp, tc
  14366. the value of @var{timeclamp} option
  14367. @end table
  14368. and functions:
  14369. @table @option
  14370. @item a_weighting(f)
  14371. A-weighting of equal loudness
  14372. @item b_weighting(f)
  14373. B-weighting of equal loudness
  14374. @item c_weighting(f)
  14375. C-weighting of equal loudness.
  14376. @end table
  14377. Default value is @code{16}.
  14378. @item bar_v, volume2
  14379. Specify the bargraph volume expression. It can contain variables:
  14380. @table @option
  14381. @item sono_v
  14382. the @var{sono_v} evaluated expression
  14383. @item frequency, freq, f
  14384. the frequency where it is evaluated
  14385. @item timeclamp, tc
  14386. the value of @var{timeclamp} option
  14387. @end table
  14388. and functions:
  14389. @table @option
  14390. @item a_weighting(f)
  14391. A-weighting of equal loudness
  14392. @item b_weighting(f)
  14393. B-weighting of equal loudness
  14394. @item c_weighting(f)
  14395. C-weighting of equal loudness.
  14396. @end table
  14397. Default value is @code{sono_v}.
  14398. @item sono_g, gamma
  14399. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14400. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14401. Acceptable range is @code{[1, 7]}.
  14402. @item bar_g, gamma2
  14403. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14404. @code{[1, 7]}.
  14405. @item bar_t
  14406. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14407. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14408. @item timeclamp, tc
  14409. Specify the transform timeclamp. At low frequency, there is trade-off between
  14410. accuracy in time domain and frequency domain. If timeclamp is lower,
  14411. event in time domain is represented more accurately (such as fast bass drum),
  14412. otherwise event in frequency domain is represented more accurately
  14413. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14414. @item attack
  14415. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14416. limits future samples by applying asymmetric windowing in time domain, useful
  14417. when low latency is required. Accepted range is @code{[0, 1]}.
  14418. @item basefreq
  14419. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14420. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14421. @item endfreq
  14422. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14423. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14424. @item coeffclamp
  14425. This option is deprecated and ignored.
  14426. @item tlength
  14427. Specify the transform length in time domain. Use this option to control accuracy
  14428. trade-off between time domain and frequency domain at every frequency sample.
  14429. It can contain variables:
  14430. @table @option
  14431. @item frequency, freq, f
  14432. the frequency where it is evaluated
  14433. @item timeclamp, tc
  14434. the value of @var{timeclamp} option.
  14435. @end table
  14436. Default value is @code{384*tc/(384+tc*f)}.
  14437. @item count
  14438. Specify the transform count for every video frame. Default value is @code{6}.
  14439. Acceptable range is @code{[1, 30]}.
  14440. @item fcount
  14441. Specify the transform count for every single pixel. Default value is @code{0},
  14442. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14443. @item fontfile
  14444. Specify font file for use with freetype to draw the axis. If not specified,
  14445. use embedded font. Note that drawing with font file or embedded font is not
  14446. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14447. option instead.
  14448. @item font
  14449. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14450. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14451. @item fontcolor
  14452. Specify font color expression. This is arithmetic expression that should return
  14453. integer value 0xRRGGBB. It can contain variables:
  14454. @table @option
  14455. @item frequency, freq, f
  14456. the frequency where it is evaluated
  14457. @item timeclamp, tc
  14458. the value of @var{timeclamp} option
  14459. @end table
  14460. and functions:
  14461. @table @option
  14462. @item midi(f)
  14463. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14464. @item r(x), g(x), b(x)
  14465. red, green, and blue value of intensity x.
  14466. @end table
  14467. Default value is @code{st(0, (midi(f)-59.5)/12);
  14468. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14469. r(1-ld(1)) + b(ld(1))}.
  14470. @item axisfile
  14471. Specify image file to draw the axis. This option override @var{fontfile} and
  14472. @var{fontcolor} option.
  14473. @item axis, text
  14474. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14475. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14476. Default value is @code{1}.
  14477. @item csp
  14478. Set colorspace. The accepted values are:
  14479. @table @samp
  14480. @item unspecified
  14481. Unspecified (default)
  14482. @item bt709
  14483. BT.709
  14484. @item fcc
  14485. FCC
  14486. @item bt470bg
  14487. BT.470BG or BT.601-6 625
  14488. @item smpte170m
  14489. SMPTE-170M or BT.601-6 525
  14490. @item smpte240m
  14491. SMPTE-240M
  14492. @item bt2020ncl
  14493. BT.2020 with non-constant luminance
  14494. @end table
  14495. @item cscheme
  14496. Set spectrogram color scheme. This is list of floating point values with format
  14497. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14498. The default is @code{1|0.5|0|0|0.5|1}.
  14499. @end table
  14500. @subsection Examples
  14501. @itemize
  14502. @item
  14503. Playing audio while showing the spectrum:
  14504. @example
  14505. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14506. @end example
  14507. @item
  14508. Same as above, but with frame rate 30 fps:
  14509. @example
  14510. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14511. @end example
  14512. @item
  14513. Playing at 1280x720:
  14514. @example
  14515. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14516. @end example
  14517. @item
  14518. Disable sonogram display:
  14519. @example
  14520. sono_h=0
  14521. @end example
  14522. @item
  14523. A1 and its harmonics: A1, A2, (near)E3, A3:
  14524. @example
  14525. 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),
  14526. asplit[a][out1]; [a] showcqt [out0]'
  14527. @end example
  14528. @item
  14529. Same as above, but with more accuracy in frequency domain:
  14530. @example
  14531. 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),
  14532. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14533. @end example
  14534. @item
  14535. Custom volume:
  14536. @example
  14537. bar_v=10:sono_v=bar_v*a_weighting(f)
  14538. @end example
  14539. @item
  14540. Custom gamma, now spectrum is linear to the amplitude.
  14541. @example
  14542. bar_g=2:sono_g=2
  14543. @end example
  14544. @item
  14545. Custom tlength equation:
  14546. @example
  14547. 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)))'
  14548. @end example
  14549. @item
  14550. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14551. @example
  14552. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14553. @end example
  14554. @item
  14555. Custom font using fontconfig:
  14556. @example
  14557. font='Courier New,Monospace,mono|bold'
  14558. @end example
  14559. @item
  14560. Custom frequency range with custom axis using image file:
  14561. @example
  14562. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14563. @end example
  14564. @end itemize
  14565. @section showfreqs
  14566. Convert input audio to video output representing the audio power spectrum.
  14567. Audio amplitude is on Y-axis while frequency is on X-axis.
  14568. The filter accepts the following options:
  14569. @table @option
  14570. @item size, s
  14571. Specify size of video. For the syntax of this option, check the
  14572. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14573. Default is @code{1024x512}.
  14574. @item mode
  14575. Set display mode.
  14576. This set how each frequency bin will be represented.
  14577. It accepts the following values:
  14578. @table @samp
  14579. @item line
  14580. @item bar
  14581. @item dot
  14582. @end table
  14583. Default is @code{bar}.
  14584. @item ascale
  14585. Set amplitude scale.
  14586. It accepts the following values:
  14587. @table @samp
  14588. @item lin
  14589. Linear scale.
  14590. @item sqrt
  14591. Square root scale.
  14592. @item cbrt
  14593. Cubic root scale.
  14594. @item log
  14595. Logarithmic scale.
  14596. @end table
  14597. Default is @code{log}.
  14598. @item fscale
  14599. Set frequency scale.
  14600. It accepts the following values:
  14601. @table @samp
  14602. @item lin
  14603. Linear scale.
  14604. @item log
  14605. Logarithmic scale.
  14606. @item rlog
  14607. Reverse logarithmic scale.
  14608. @end table
  14609. Default is @code{lin}.
  14610. @item win_size
  14611. Set window size.
  14612. It accepts the following values:
  14613. @table @samp
  14614. @item w16
  14615. @item w32
  14616. @item w64
  14617. @item w128
  14618. @item w256
  14619. @item w512
  14620. @item w1024
  14621. @item w2048
  14622. @item w4096
  14623. @item w8192
  14624. @item w16384
  14625. @item w32768
  14626. @item w65536
  14627. @end table
  14628. Default is @code{w2048}
  14629. @item win_func
  14630. Set windowing function.
  14631. It accepts the following values:
  14632. @table @samp
  14633. @item rect
  14634. @item bartlett
  14635. @item hanning
  14636. @item hamming
  14637. @item blackman
  14638. @item welch
  14639. @item flattop
  14640. @item bharris
  14641. @item bnuttall
  14642. @item bhann
  14643. @item sine
  14644. @item nuttall
  14645. @item lanczos
  14646. @item gauss
  14647. @item tukey
  14648. @item dolph
  14649. @item cauchy
  14650. @item parzen
  14651. @item poisson
  14652. @end table
  14653. Default is @code{hanning}.
  14654. @item overlap
  14655. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14656. which means optimal overlap for selected window function will be picked.
  14657. @item averaging
  14658. Set time averaging. Setting this to 0 will display current maximal peaks.
  14659. Default is @code{1}, which means time averaging is disabled.
  14660. @item colors
  14661. Specify list of colors separated by space or by '|' which will be used to
  14662. draw channel frequencies. Unrecognized or missing colors will be replaced
  14663. by white color.
  14664. @item cmode
  14665. Set channel display mode.
  14666. It accepts the following values:
  14667. @table @samp
  14668. @item combined
  14669. @item separate
  14670. @end table
  14671. Default is @code{combined}.
  14672. @item minamp
  14673. Set minimum amplitude used in @code{log} amplitude scaler.
  14674. @end table
  14675. @anchor{showspectrum}
  14676. @section showspectrum
  14677. Convert input audio to a video output, representing the audio frequency
  14678. spectrum.
  14679. The filter accepts the following options:
  14680. @table @option
  14681. @item size, s
  14682. Specify the video size for the output. For the syntax of this option, check the
  14683. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14684. Default value is @code{640x512}.
  14685. @item slide
  14686. Specify how the spectrum should slide along the window.
  14687. It accepts the following values:
  14688. @table @samp
  14689. @item replace
  14690. the samples start again on the left when they reach the right
  14691. @item scroll
  14692. the samples scroll from right to left
  14693. @item fullframe
  14694. frames are only produced when the samples reach the right
  14695. @item rscroll
  14696. the samples scroll from left to right
  14697. @end table
  14698. Default value is @code{replace}.
  14699. @item mode
  14700. Specify display mode.
  14701. It accepts the following values:
  14702. @table @samp
  14703. @item combined
  14704. all channels are displayed in the same row
  14705. @item separate
  14706. all channels are displayed in separate rows
  14707. @end table
  14708. Default value is @samp{combined}.
  14709. @item color
  14710. Specify display color mode.
  14711. It accepts the following values:
  14712. @table @samp
  14713. @item channel
  14714. each channel is displayed in a separate color
  14715. @item intensity
  14716. each channel is displayed using the same color scheme
  14717. @item rainbow
  14718. each channel is displayed using the rainbow color scheme
  14719. @item moreland
  14720. each channel is displayed using the moreland color scheme
  14721. @item nebulae
  14722. each channel is displayed using the nebulae color scheme
  14723. @item fire
  14724. each channel is displayed using the fire color scheme
  14725. @item fiery
  14726. each channel is displayed using the fiery color scheme
  14727. @item fruit
  14728. each channel is displayed using the fruit color scheme
  14729. @item cool
  14730. each channel is displayed using the cool color scheme
  14731. @end table
  14732. Default value is @samp{channel}.
  14733. @item scale
  14734. Specify scale used for calculating intensity color values.
  14735. It accepts the following values:
  14736. @table @samp
  14737. @item lin
  14738. linear
  14739. @item sqrt
  14740. square root, default
  14741. @item cbrt
  14742. cubic root
  14743. @item log
  14744. logarithmic
  14745. @item 4thrt
  14746. 4th root
  14747. @item 5thrt
  14748. 5th root
  14749. @end table
  14750. Default value is @samp{sqrt}.
  14751. @item saturation
  14752. Set saturation modifier for displayed colors. Negative values provide
  14753. alternative color scheme. @code{0} is no saturation at all.
  14754. Saturation must be in [-10.0, 10.0] range.
  14755. Default value is @code{1}.
  14756. @item win_func
  14757. Set window function.
  14758. It accepts the following values:
  14759. @table @samp
  14760. @item rect
  14761. @item bartlett
  14762. @item hann
  14763. @item hanning
  14764. @item hamming
  14765. @item blackman
  14766. @item welch
  14767. @item flattop
  14768. @item bharris
  14769. @item bnuttall
  14770. @item bhann
  14771. @item sine
  14772. @item nuttall
  14773. @item lanczos
  14774. @item gauss
  14775. @item tukey
  14776. @item dolph
  14777. @item cauchy
  14778. @item parzen
  14779. @item poisson
  14780. @end table
  14781. Default value is @code{hann}.
  14782. @item orientation
  14783. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14784. @code{horizontal}. Default is @code{vertical}.
  14785. @item overlap
  14786. Set ratio of overlap window. Default value is @code{0}.
  14787. When value is @code{1} overlap is set to recommended size for specific
  14788. window function currently used.
  14789. @item gain
  14790. Set scale gain for calculating intensity color values.
  14791. Default value is @code{1}.
  14792. @item data
  14793. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14794. @item rotation
  14795. Set color rotation, must be in [-1.0, 1.0] range.
  14796. Default value is @code{0}.
  14797. @end table
  14798. The usage is very similar to the showwaves filter; see the examples in that
  14799. section.
  14800. @subsection Examples
  14801. @itemize
  14802. @item
  14803. Large window with logarithmic color scaling:
  14804. @example
  14805. showspectrum=s=1280x480:scale=log
  14806. @end example
  14807. @item
  14808. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14809. @example
  14810. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14811. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14812. @end example
  14813. @end itemize
  14814. @section showspectrumpic
  14815. Convert input audio to a single video frame, representing the audio frequency
  14816. spectrum.
  14817. The filter accepts the following options:
  14818. @table @option
  14819. @item size, s
  14820. Specify the video size for the output. For the syntax of this option, check the
  14821. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14822. Default value is @code{4096x2048}.
  14823. @item mode
  14824. Specify display mode.
  14825. It accepts the following values:
  14826. @table @samp
  14827. @item combined
  14828. all channels are displayed in the same row
  14829. @item separate
  14830. all channels are displayed in separate rows
  14831. @end table
  14832. Default value is @samp{combined}.
  14833. @item color
  14834. Specify display color mode.
  14835. It accepts the following values:
  14836. @table @samp
  14837. @item channel
  14838. each channel is displayed in a separate color
  14839. @item intensity
  14840. each channel is displayed using the same color scheme
  14841. @item rainbow
  14842. each channel is displayed using the rainbow color scheme
  14843. @item moreland
  14844. each channel is displayed using the moreland color scheme
  14845. @item nebulae
  14846. each channel is displayed using the nebulae color scheme
  14847. @item fire
  14848. each channel is displayed using the fire color scheme
  14849. @item fiery
  14850. each channel is displayed using the fiery color scheme
  14851. @item fruit
  14852. each channel is displayed using the fruit color scheme
  14853. @item cool
  14854. each channel is displayed using the cool color scheme
  14855. @end table
  14856. Default value is @samp{intensity}.
  14857. @item scale
  14858. Specify scale used for calculating intensity color values.
  14859. It accepts the following values:
  14860. @table @samp
  14861. @item lin
  14862. linear
  14863. @item sqrt
  14864. square root, default
  14865. @item cbrt
  14866. cubic root
  14867. @item log
  14868. logarithmic
  14869. @item 4thrt
  14870. 4th root
  14871. @item 5thrt
  14872. 5th root
  14873. @end table
  14874. Default value is @samp{log}.
  14875. @item saturation
  14876. Set saturation modifier for displayed colors. Negative values provide
  14877. alternative color scheme. @code{0} is no saturation at all.
  14878. Saturation must be in [-10.0, 10.0] range.
  14879. Default value is @code{1}.
  14880. @item win_func
  14881. Set window function.
  14882. It accepts the following values:
  14883. @table @samp
  14884. @item rect
  14885. @item bartlett
  14886. @item hann
  14887. @item hanning
  14888. @item hamming
  14889. @item blackman
  14890. @item welch
  14891. @item flattop
  14892. @item bharris
  14893. @item bnuttall
  14894. @item bhann
  14895. @item sine
  14896. @item nuttall
  14897. @item lanczos
  14898. @item gauss
  14899. @item tukey
  14900. @item dolph
  14901. @item cauchy
  14902. @item parzen
  14903. @item poisson
  14904. @end table
  14905. Default value is @code{hann}.
  14906. @item orientation
  14907. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14908. @code{horizontal}. Default is @code{vertical}.
  14909. @item gain
  14910. Set scale gain for calculating intensity color values.
  14911. Default value is @code{1}.
  14912. @item legend
  14913. Draw time and frequency axes and legends. Default is enabled.
  14914. @item rotation
  14915. Set color rotation, must be in [-1.0, 1.0] range.
  14916. Default value is @code{0}.
  14917. @end table
  14918. @subsection Examples
  14919. @itemize
  14920. @item
  14921. Extract an audio spectrogram of a whole audio track
  14922. in a 1024x1024 picture using @command{ffmpeg}:
  14923. @example
  14924. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14925. @end example
  14926. @end itemize
  14927. @section showvolume
  14928. Convert input audio volume to a video output.
  14929. The filter accepts the following options:
  14930. @table @option
  14931. @item rate, r
  14932. Set video rate.
  14933. @item b
  14934. Set border width, allowed range is [0, 5]. Default is 1.
  14935. @item w
  14936. Set channel width, allowed range is [80, 8192]. Default is 400.
  14937. @item h
  14938. Set channel height, allowed range is [1, 900]. Default is 20.
  14939. @item f
  14940. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14941. @item c
  14942. Set volume color expression.
  14943. The expression can use the following variables:
  14944. @table @option
  14945. @item VOLUME
  14946. Current max volume of channel in dB.
  14947. @item PEAK
  14948. Current peak.
  14949. @item CHANNEL
  14950. Current channel number, starting from 0.
  14951. @end table
  14952. @item t
  14953. If set, displays channel names. Default is enabled.
  14954. @item v
  14955. If set, displays volume values. Default is enabled.
  14956. @item o
  14957. Set orientation, can be @code{horizontal} or @code{vertical},
  14958. default is @code{horizontal}.
  14959. @item s
  14960. Set step size, allowed range s [0, 5]. Default is 0, which means
  14961. step is disabled.
  14962. @end table
  14963. @section showwaves
  14964. Convert input audio to a video output, representing the samples waves.
  14965. The filter accepts the following options:
  14966. @table @option
  14967. @item size, s
  14968. Specify the video size for the output. For the syntax of this option, check the
  14969. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14970. Default value is @code{600x240}.
  14971. @item mode
  14972. Set display mode.
  14973. Available values are:
  14974. @table @samp
  14975. @item point
  14976. Draw a point for each sample.
  14977. @item line
  14978. Draw a vertical line for each sample.
  14979. @item p2p
  14980. Draw a point for each sample and a line between them.
  14981. @item cline
  14982. Draw a centered vertical line for each sample.
  14983. @end table
  14984. Default value is @code{point}.
  14985. @item n
  14986. Set the number of samples which are printed on the same column. A
  14987. larger value will decrease the frame rate. Must be a positive
  14988. integer. This option can be set only if the value for @var{rate}
  14989. is not explicitly specified.
  14990. @item rate, r
  14991. Set the (approximate) output frame rate. This is done by setting the
  14992. option @var{n}. Default value is "25".
  14993. @item split_channels
  14994. Set if channels should be drawn separately or overlap. Default value is 0.
  14995. @item colors
  14996. Set colors separated by '|' which are going to be used for drawing of each channel.
  14997. @item scale
  14998. Set amplitude scale.
  14999. Available values are:
  15000. @table @samp
  15001. @item lin
  15002. Linear.
  15003. @item log
  15004. Logarithmic.
  15005. @item sqrt
  15006. Square root.
  15007. @item cbrt
  15008. Cubic root.
  15009. @end table
  15010. Default is linear.
  15011. @end table
  15012. @subsection Examples
  15013. @itemize
  15014. @item
  15015. Output the input file audio and the corresponding video representation
  15016. at the same time:
  15017. @example
  15018. amovie=a.mp3,asplit[out0],showwaves[out1]
  15019. @end example
  15020. @item
  15021. Create a synthetic signal and show it with showwaves, forcing a
  15022. frame rate of 30 frames per second:
  15023. @example
  15024. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15025. @end example
  15026. @end itemize
  15027. @section showwavespic
  15028. Convert input audio to a single video frame, representing the samples waves.
  15029. The filter accepts the following options:
  15030. @table @option
  15031. @item size, s
  15032. Specify the video size for the output. For the syntax of this option, check the
  15033. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15034. Default value is @code{600x240}.
  15035. @item split_channels
  15036. Set if channels should be drawn separately or overlap. Default value is 0.
  15037. @item colors
  15038. Set colors separated by '|' which are going to be used for drawing of each channel.
  15039. @item scale
  15040. Set amplitude scale.
  15041. Available values are:
  15042. @table @samp
  15043. @item lin
  15044. Linear.
  15045. @item log
  15046. Logarithmic.
  15047. @item sqrt
  15048. Square root.
  15049. @item cbrt
  15050. Cubic root.
  15051. @end table
  15052. Default is linear.
  15053. @end table
  15054. @subsection Examples
  15055. @itemize
  15056. @item
  15057. Extract a channel split representation of the wave form of a whole audio track
  15058. in a 1024x800 picture using @command{ffmpeg}:
  15059. @example
  15060. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15061. @end example
  15062. @end itemize
  15063. @section sidedata, asidedata
  15064. Delete frame side data, or select frames based on it.
  15065. This filter accepts the following options:
  15066. @table @option
  15067. @item mode
  15068. Set mode of operation of the filter.
  15069. Can be one of the following:
  15070. @table @samp
  15071. @item select
  15072. Select every frame with side data of @code{type}.
  15073. @item delete
  15074. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15075. data in the frame.
  15076. @end table
  15077. @item type
  15078. Set side data type used with all modes. Must be set for @code{select} mode. For
  15079. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15080. in @file{libavutil/frame.h}. For example, to choose
  15081. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15082. @end table
  15083. @section spectrumsynth
  15084. Sythesize audio from 2 input video spectrums, first input stream represents
  15085. magnitude across time and second represents phase across time.
  15086. The filter will transform from frequency domain as displayed in videos back
  15087. to time domain as presented in audio output.
  15088. This filter is primarily created for reversing processed @ref{showspectrum}
  15089. filter outputs, but can synthesize sound from other spectrograms too.
  15090. But in such case results are going to be poor if the phase data is not
  15091. available, because in such cases phase data need to be recreated, usually
  15092. its just recreated from random noise.
  15093. For best results use gray only output (@code{channel} color mode in
  15094. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15095. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15096. @code{data} option. Inputs videos should generally use @code{fullframe}
  15097. slide mode as that saves resources needed for decoding video.
  15098. The filter accepts the following options:
  15099. @table @option
  15100. @item sample_rate
  15101. Specify sample rate of output audio, the sample rate of audio from which
  15102. spectrum was generated may differ.
  15103. @item channels
  15104. Set number of channels represented in input video spectrums.
  15105. @item scale
  15106. Set scale which was used when generating magnitude input spectrum.
  15107. Can be @code{lin} or @code{log}. Default is @code{log}.
  15108. @item slide
  15109. Set slide which was used when generating inputs spectrums.
  15110. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15111. Default is @code{fullframe}.
  15112. @item win_func
  15113. Set window function used for resynthesis.
  15114. @item overlap
  15115. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15116. which means optimal overlap for selected window function will be picked.
  15117. @item orientation
  15118. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15119. Default is @code{vertical}.
  15120. @end table
  15121. @subsection Examples
  15122. @itemize
  15123. @item
  15124. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15125. then resynthesize videos back to audio with spectrumsynth:
  15126. @example
  15127. 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
  15128. 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
  15129. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15130. @end example
  15131. @end itemize
  15132. @section split, asplit
  15133. Split input into several identical outputs.
  15134. @code{asplit} works with audio input, @code{split} with video.
  15135. The filter accepts a single parameter which specifies the number of outputs. If
  15136. unspecified, it defaults to 2.
  15137. @subsection Examples
  15138. @itemize
  15139. @item
  15140. Create two separate outputs from the same input:
  15141. @example
  15142. [in] split [out0][out1]
  15143. @end example
  15144. @item
  15145. To create 3 or more outputs, you need to specify the number of
  15146. outputs, like in:
  15147. @example
  15148. [in] asplit=3 [out0][out1][out2]
  15149. @end example
  15150. @item
  15151. Create two separate outputs from the same input, one cropped and
  15152. one padded:
  15153. @example
  15154. [in] split [splitout1][splitout2];
  15155. [splitout1] crop=100:100:0:0 [cropout];
  15156. [splitout2] pad=200:200:100:100 [padout];
  15157. @end example
  15158. @item
  15159. Create 5 copies of the input audio with @command{ffmpeg}:
  15160. @example
  15161. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15162. @end example
  15163. @end itemize
  15164. @section zmq, azmq
  15165. Receive commands sent through a libzmq client, and forward them to
  15166. filters in the filtergraph.
  15167. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15168. must be inserted between two video filters, @code{azmq} between two
  15169. audio filters.
  15170. To enable these filters you need to install the libzmq library and
  15171. headers and configure FFmpeg with @code{--enable-libzmq}.
  15172. For more information about libzmq see:
  15173. @url{http://www.zeromq.org/}
  15174. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15175. receives messages sent through a network interface defined by the
  15176. @option{bind_address} option.
  15177. The received message must be in the form:
  15178. @example
  15179. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15180. @end example
  15181. @var{TARGET} specifies the target of the command, usually the name of
  15182. the filter class or a specific filter instance name.
  15183. @var{COMMAND} specifies the name of the command for the target filter.
  15184. @var{ARG} is optional and specifies the optional argument list for the
  15185. given @var{COMMAND}.
  15186. Upon reception, the message is processed and the corresponding command
  15187. is injected into the filtergraph. Depending on the result, the filter
  15188. will send a reply to the client, adopting the format:
  15189. @example
  15190. @var{ERROR_CODE} @var{ERROR_REASON}
  15191. @var{MESSAGE}
  15192. @end example
  15193. @var{MESSAGE} is optional.
  15194. @subsection Examples
  15195. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15196. be used to send commands processed by these filters.
  15197. Consider the following filtergraph generated by @command{ffplay}
  15198. @example
  15199. ffplay -dumpgraph 1 -f lavfi "
  15200. color=s=100x100:c=red [l];
  15201. color=s=100x100:c=blue [r];
  15202. nullsrc=s=200x100, zmq [bg];
  15203. [bg][l] overlay [bg+l];
  15204. [bg+l][r] overlay=x=100 "
  15205. @end example
  15206. To change the color of the left side of the video, the following
  15207. command can be used:
  15208. @example
  15209. echo Parsed_color_0 c yellow | tools/zmqsend
  15210. @end example
  15211. To change the right side:
  15212. @example
  15213. echo Parsed_color_1 c pink | tools/zmqsend
  15214. @end example
  15215. @c man end MULTIMEDIA FILTERS
  15216. @chapter Multimedia Sources
  15217. @c man begin MULTIMEDIA SOURCES
  15218. Below is a description of the currently available multimedia sources.
  15219. @section amovie
  15220. This is the same as @ref{movie} source, except it selects an audio
  15221. stream by default.
  15222. @anchor{movie}
  15223. @section movie
  15224. Read audio and/or video stream(s) from a movie container.
  15225. It accepts the following parameters:
  15226. @table @option
  15227. @item filename
  15228. The name of the resource to read (not necessarily a file; it can also be a
  15229. device or a stream accessed through some protocol).
  15230. @item format_name, f
  15231. Specifies the format assumed for the movie to read, and can be either
  15232. the name of a container or an input device. If not specified, the
  15233. format is guessed from @var{movie_name} or by probing.
  15234. @item seek_point, sp
  15235. Specifies the seek point in seconds. The frames will be output
  15236. starting from this seek point. The parameter is evaluated with
  15237. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15238. postfix. The default value is "0".
  15239. @item streams, s
  15240. Specifies the streams to read. Several streams can be specified,
  15241. separated by "+". The source will then have as many outputs, in the
  15242. same order. The syntax is explained in the ``Stream specifiers''
  15243. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  15244. respectively the default (best suited) video and audio stream. Default
  15245. is "dv", or "da" if the filter is called as "amovie".
  15246. @item stream_index, si
  15247. Specifies the index of the video stream to read. If the value is -1,
  15248. the most suitable video stream will be automatically selected. The default
  15249. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15250. audio instead of video.
  15251. @item loop
  15252. Specifies how many times to read the stream in sequence.
  15253. If the value is 0, the stream will be looped infinitely.
  15254. Default value is "1".
  15255. Note that when the movie is looped the source timestamps are not
  15256. changed, so it will generate non monotonically increasing timestamps.
  15257. @item discontinuity
  15258. Specifies the time difference between frames above which the point is
  15259. considered a timestamp discontinuity which is removed by adjusting the later
  15260. timestamps.
  15261. @end table
  15262. It allows overlaying a second video on top of the main input of
  15263. a filtergraph, as shown in this graph:
  15264. @example
  15265. input -----------> deltapts0 --> overlay --> output
  15266. ^
  15267. |
  15268. movie --> scale--> deltapts1 -------+
  15269. @end example
  15270. @subsection Examples
  15271. @itemize
  15272. @item
  15273. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15274. on top of the input labelled "in":
  15275. @example
  15276. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15277. [in] setpts=PTS-STARTPTS [main];
  15278. [main][over] overlay=16:16 [out]
  15279. @end example
  15280. @item
  15281. Read from a video4linux2 device, and overlay it on top of the input
  15282. labelled "in":
  15283. @example
  15284. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15285. [in] setpts=PTS-STARTPTS [main];
  15286. [main][over] overlay=16:16 [out]
  15287. @end example
  15288. @item
  15289. Read the first video stream and the audio stream with id 0x81 from
  15290. dvd.vob; the video is connected to the pad named "video" and the audio is
  15291. connected to the pad named "audio":
  15292. @example
  15293. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15294. @end example
  15295. @end itemize
  15296. @subsection Commands
  15297. Both movie and amovie support the following commands:
  15298. @table @option
  15299. @item seek
  15300. Perform seek using "av_seek_frame".
  15301. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15302. @itemize
  15303. @item
  15304. @var{stream_index}: If stream_index is -1, a default
  15305. stream is selected, and @var{timestamp} is automatically converted
  15306. from AV_TIME_BASE units to the stream specific time_base.
  15307. @item
  15308. @var{timestamp}: Timestamp in AVStream.time_base units
  15309. or, if no stream is specified, in AV_TIME_BASE units.
  15310. @item
  15311. @var{flags}: Flags which select direction and seeking mode.
  15312. @end itemize
  15313. @item get_duration
  15314. Get movie duration in AV_TIME_BASE units.
  15315. @end table
  15316. @c man end MULTIMEDIA SOURCES