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.

19818 lines
526KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @section afir
  735. Apply an arbitrary Frequency Impulse Response filter.
  736. This filter is designed for applying long FIR filters,
  737. up to 30 seconds long.
  738. It can be used as component for digital crossover filters,
  739. room equalization, cross talk cancellation, wavefield synthesis,
  740. auralization, ambiophonics and ambisonics.
  741. This filter uses second stream as FIR coefficients.
  742. If second stream holds single channel, it will be used
  743. for all input channels in first stream, otherwise
  744. number of channels in second stream must be same as
  745. number of channels in first stream.
  746. It accepts the following parameters:
  747. @table @option
  748. @item dry
  749. Set dry gain. This sets input gain.
  750. @item wet
  751. Set wet gain. This sets final output gain.
  752. @item length
  753. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  754. @item again
  755. Enable applying gain measured from power of IR.
  756. @end table
  757. @subsection Examples
  758. @itemize
  759. @item
  760. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  761. @example
  762. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  763. @end example
  764. @end itemize
  765. @anchor{aformat}
  766. @section aformat
  767. Set output format constraints for the input audio. The framework will
  768. negotiate the most appropriate format to minimize conversions.
  769. It accepts the following parameters:
  770. @table @option
  771. @item sample_fmts
  772. A '|'-separated list of requested sample formats.
  773. @item sample_rates
  774. A '|'-separated list of requested sample rates.
  775. @item channel_layouts
  776. A '|'-separated list of requested channel layouts.
  777. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  778. for the required syntax.
  779. @end table
  780. If a parameter is omitted, all values are allowed.
  781. Force the output to either unsigned 8-bit or signed 16-bit stereo
  782. @example
  783. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  784. @end example
  785. @section agate
  786. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  787. processing reduces disturbing noise between useful signals.
  788. Gating is done by detecting the volume below a chosen level @var{threshold}
  789. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  790. floor is set via @var{range}. Because an exact manipulation of the signal
  791. would cause distortion of the waveform the reduction can be levelled over
  792. time. This is done by setting @var{attack} and @var{release}.
  793. @var{attack} determines how long the signal has to fall below the threshold
  794. before any reduction will occur and @var{release} sets the time the signal
  795. has to rise above the threshold to reduce the reduction again.
  796. Shorter signals than the chosen attack time will be left untouched.
  797. @table @option
  798. @item level_in
  799. Set input level before filtering.
  800. Default is 1. Allowed range is from 0.015625 to 64.
  801. @item range
  802. Set the level of gain reduction when the signal is below the threshold.
  803. Default is 0.06125. Allowed range is from 0 to 1.
  804. @item threshold
  805. If a signal rises above this level the gain reduction is released.
  806. Default is 0.125. Allowed range is from 0 to 1.
  807. @item ratio
  808. Set a ratio by which the signal is reduced.
  809. Default is 2. Allowed range is from 1 to 9000.
  810. @item attack
  811. Amount of milliseconds the signal has to rise above the threshold before gain
  812. reduction stops.
  813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  814. @item release
  815. Amount of milliseconds the signal has to fall below the threshold before the
  816. reduction is increased again. Default is 250 milliseconds.
  817. Allowed range is from 0.01 to 9000.
  818. @item makeup
  819. Set amount of amplification of signal after processing.
  820. Default is 1. Allowed range is from 1 to 64.
  821. @item knee
  822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  823. Default is 2.828427125. Allowed range is from 1 to 8.
  824. @item detection
  825. Choose if exact signal should be taken for detection or an RMS like one.
  826. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  827. @item link
  828. Choose if the average level between all channels or the louder channel affects
  829. the reduction.
  830. Default is @code{average}. Can be @code{average} or @code{maximum}.
  831. @end table
  832. @section alimiter
  833. The limiter prevents an input signal from rising over a desired threshold.
  834. This limiter uses lookahead technology to prevent your signal from distorting.
  835. It means that there is a small delay after the signal is processed. Keep in mind
  836. that the delay it produces is the attack time you set.
  837. The filter accepts the following options:
  838. @table @option
  839. @item level_in
  840. Set input gain. Default is 1.
  841. @item level_out
  842. Set output gain. Default is 1.
  843. @item limit
  844. Don't let signals above this level pass the limiter. Default is 1.
  845. @item attack
  846. The limiter will reach its attenuation level in this amount of time in
  847. milliseconds. Default is 5 milliseconds.
  848. @item release
  849. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  850. Default is 50 milliseconds.
  851. @item asc
  852. When gain reduction is always needed ASC takes care of releasing to an
  853. average reduction level rather than reaching a reduction of 0 in the release
  854. time.
  855. @item asc_level
  856. Select how much the release time is affected by ASC, 0 means nearly no changes
  857. in release time while 1 produces higher release times.
  858. @item level
  859. Auto level output signal. Default is enabled.
  860. This normalizes audio back to 0dB if enabled.
  861. @end table
  862. Depending on picked setting it is recommended to upsample input 2x or 4x times
  863. with @ref{aresample} before applying this filter.
  864. @section allpass
  865. Apply a two-pole all-pass filter with central frequency (in Hz)
  866. @var{frequency}, and filter-width @var{width}.
  867. An all-pass filter changes the audio's frequency to phase relationship
  868. without changing its frequency to amplitude relationship.
  869. The filter accepts the following options:
  870. @table @option
  871. @item frequency, f
  872. Set frequency in Hz.
  873. @item width_type, t
  874. Set method to specify band-width of filter.
  875. @table @option
  876. @item h
  877. Hz
  878. @item q
  879. Q-Factor
  880. @item o
  881. octave
  882. @item s
  883. slope
  884. @end table
  885. @item width, w
  886. Specify the band-width of a filter in width_type units.
  887. @item channels, c
  888. Specify which channels to filter, by default all available are filtered.
  889. @end table
  890. @section aloop
  891. Loop audio samples.
  892. The filter accepts the following options:
  893. @table @option
  894. @item loop
  895. Set the number of loops. Setting this value to -1 will result in infinite loops.
  896. Default is 0.
  897. @item size
  898. Set maximal number of samples. Default is 0.
  899. @item start
  900. Set first sample of loop. Default is 0.
  901. @end table
  902. @anchor{amerge}
  903. @section amerge
  904. Merge two or more audio streams into a single multi-channel stream.
  905. The filter accepts the following options:
  906. @table @option
  907. @item inputs
  908. Set the number of inputs. Default is 2.
  909. @end table
  910. If the channel layouts of the inputs are disjoint, and therefore compatible,
  911. the channel layout of the output will be set accordingly and the channels
  912. will be reordered as necessary. If the channel layouts of the inputs are not
  913. disjoint, the output will have all the channels of the first input then all
  914. the channels of the second input, in that order, and the channel layout of
  915. the output will be the default value corresponding to the total number of
  916. channels.
  917. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  918. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  919. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  920. first input, b1 is the first channel of the second input).
  921. On the other hand, if both input are in stereo, the output channels will be
  922. in the default order: a1, a2, b1, b2, and the channel layout will be
  923. arbitrarily set to 4.0, which may or may not be the expected value.
  924. All inputs must have the same sample rate, and format.
  925. If inputs do not have the same duration, the output will stop with the
  926. shortest.
  927. @subsection Examples
  928. @itemize
  929. @item
  930. Merge two mono files into a stereo stream:
  931. @example
  932. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  933. @end example
  934. @item
  935. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  936. @example
  937. 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
  938. @end example
  939. @end itemize
  940. @section amix
  941. Mixes multiple audio inputs into a single output.
  942. Note that this filter only supports float samples (the @var{amerge}
  943. and @var{pan} audio filters support many formats). If the @var{amix}
  944. input has integer samples then @ref{aresample} will be automatically
  945. inserted to perform the conversion to float samples.
  946. For example
  947. @example
  948. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  949. @end example
  950. will mix 3 input audio streams to a single output with the same duration as the
  951. first input and a dropout transition time of 3 seconds.
  952. It accepts the following parameters:
  953. @table @option
  954. @item inputs
  955. The number of inputs. If unspecified, it defaults to 2.
  956. @item duration
  957. How to determine the end-of-stream.
  958. @table @option
  959. @item longest
  960. The duration of the longest input. (default)
  961. @item shortest
  962. The duration of the shortest input.
  963. @item first
  964. The duration of the first input.
  965. @end table
  966. @item dropout_transition
  967. The transition time, in seconds, for volume renormalization when an input
  968. stream ends. The default value is 2 seconds.
  969. @end table
  970. @section anequalizer
  971. High-order parametric multiband equalizer for each channel.
  972. It accepts the following parameters:
  973. @table @option
  974. @item params
  975. This option string is in format:
  976. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  977. Each equalizer band is separated by '|'.
  978. @table @option
  979. @item chn
  980. Set channel number to which equalization will be applied.
  981. If input doesn't have that channel the entry is ignored.
  982. @item f
  983. Set central frequency for band.
  984. If input doesn't have that frequency the entry is ignored.
  985. @item w
  986. Set band width in hertz.
  987. @item g
  988. Set band gain in dB.
  989. @item t
  990. Set filter type for band, optional, can be:
  991. @table @samp
  992. @item 0
  993. Butterworth, this is default.
  994. @item 1
  995. Chebyshev type 1.
  996. @item 2
  997. Chebyshev type 2.
  998. @end table
  999. @end table
  1000. @item curves
  1001. With this option activated frequency response of anequalizer is displayed
  1002. in video stream.
  1003. @item size
  1004. Set video stream size. Only useful if curves option is activated.
  1005. @item mgain
  1006. Set max gain that will be displayed. Only useful if curves option is activated.
  1007. Setting this to a reasonable value makes it possible to display gain which is derived from
  1008. neighbour bands which are too close to each other and thus produce higher gain
  1009. when both are activated.
  1010. @item fscale
  1011. Set frequency scale used to draw frequency response in video output.
  1012. Can be linear or logarithmic. Default is logarithmic.
  1013. @item colors
  1014. Set color for each channel curve which is going to be displayed in video stream.
  1015. This is list of color names separated by space or by '|'.
  1016. Unrecognised or missing colors will be replaced by white color.
  1017. @end table
  1018. @subsection Examples
  1019. @itemize
  1020. @item
  1021. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1022. for first 2 channels using Chebyshev type 1 filter:
  1023. @example
  1024. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1025. @end example
  1026. @end itemize
  1027. @subsection Commands
  1028. This filter supports the following commands:
  1029. @table @option
  1030. @item change
  1031. Alter existing filter parameters.
  1032. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1033. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1034. error is returned.
  1035. @var{freq} set new frequency parameter.
  1036. @var{width} set new width parameter in herz.
  1037. @var{gain} set new gain parameter in dB.
  1038. Full filter invocation with asendcmd may look like this:
  1039. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1040. @end table
  1041. @section anull
  1042. Pass the audio source unchanged to the output.
  1043. @section apad
  1044. Pad the end of an audio stream with silence.
  1045. This can be used together with @command{ffmpeg} @option{-shortest} to
  1046. extend audio streams to the same length as the video stream.
  1047. A description of the accepted options follows.
  1048. @table @option
  1049. @item packet_size
  1050. Set silence packet size. Default value is 4096.
  1051. @item pad_len
  1052. Set the number of samples of silence to add to the end. After the
  1053. value is reached, the stream is terminated. This option is mutually
  1054. exclusive with @option{whole_len}.
  1055. @item whole_len
  1056. Set the minimum total number of samples in the output audio stream. If
  1057. the value is longer than the input audio length, silence is added to
  1058. the end, until the value is reached. This option is mutually exclusive
  1059. with @option{pad_len}.
  1060. @end table
  1061. If neither the @option{pad_len} nor the @option{whole_len} option is
  1062. set, the filter will add silence to the end of the input stream
  1063. indefinitely.
  1064. @subsection Examples
  1065. @itemize
  1066. @item
  1067. Add 1024 samples of silence to the end of the input:
  1068. @example
  1069. apad=pad_len=1024
  1070. @end example
  1071. @item
  1072. Make sure the audio output will contain at least 10000 samples, pad
  1073. the input with silence if required:
  1074. @example
  1075. apad=whole_len=10000
  1076. @end example
  1077. @item
  1078. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1079. video stream will always result the shortest and will be converted
  1080. until the end in the output file when using the @option{shortest}
  1081. option:
  1082. @example
  1083. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1084. @end example
  1085. @end itemize
  1086. @section aphaser
  1087. Add a phasing effect to the input audio.
  1088. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1089. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1090. A description of the accepted parameters follows.
  1091. @table @option
  1092. @item in_gain
  1093. Set input gain. Default is 0.4.
  1094. @item out_gain
  1095. Set output gain. Default is 0.74
  1096. @item delay
  1097. Set delay in milliseconds. Default is 3.0.
  1098. @item decay
  1099. Set decay. Default is 0.4.
  1100. @item speed
  1101. Set modulation speed in Hz. Default is 0.5.
  1102. @item type
  1103. Set modulation type. Default is triangular.
  1104. It accepts the following values:
  1105. @table @samp
  1106. @item triangular, t
  1107. @item sinusoidal, s
  1108. @end table
  1109. @end table
  1110. @section apulsator
  1111. Audio pulsator is something between an autopanner and a tremolo.
  1112. But it can produce funny stereo effects as well. Pulsator changes the volume
  1113. of the left and right channel based on a LFO (low frequency oscillator) with
  1114. different waveforms and shifted phases.
  1115. This filter have the ability to define an offset between left and right
  1116. channel. An offset of 0 means that both LFO shapes match each other.
  1117. The left and right channel are altered equally - a conventional tremolo.
  1118. An offset of 50% means that the shape of the right channel is exactly shifted
  1119. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1120. an autopanner. At 1 both curves match again. Every setting in between moves the
  1121. phase shift gapless between all stages and produces some "bypassing" sounds with
  1122. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1123. the 0.5) the faster the signal passes from the left to the right speaker.
  1124. The filter accepts the following options:
  1125. @table @option
  1126. @item level_in
  1127. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1128. @item level_out
  1129. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1130. @item mode
  1131. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1132. sawup or sawdown. Default is sine.
  1133. @item amount
  1134. Set modulation. Define how much of original signal is affected by the LFO.
  1135. @item offset_l
  1136. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1137. @item offset_r
  1138. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1139. @item width
  1140. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1141. @item timing
  1142. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1143. @item bpm
  1144. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1145. is set to bpm.
  1146. @item ms
  1147. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1148. is set to ms.
  1149. @item hz
  1150. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1151. if timing is set to hz.
  1152. @end table
  1153. @anchor{aresample}
  1154. @section aresample
  1155. Resample the input audio to the specified parameters, using the
  1156. libswresample library. If none are specified then the filter will
  1157. automatically convert between its input and output.
  1158. This filter is also able to stretch/squeeze the audio data to make it match
  1159. the timestamps or to inject silence / cut out audio to make it match the
  1160. timestamps, do a combination of both or do neither.
  1161. The filter accepts the syntax
  1162. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1163. expresses a sample rate and @var{resampler_options} is a list of
  1164. @var{key}=@var{value} pairs, separated by ":". See the
  1165. @ref{Resampler Options,,the "Resampler Options" section in the
  1166. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1167. for the complete list of supported options.
  1168. @subsection Examples
  1169. @itemize
  1170. @item
  1171. Resample the input audio to 44100Hz:
  1172. @example
  1173. aresample=44100
  1174. @end example
  1175. @item
  1176. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1177. samples per second compensation:
  1178. @example
  1179. aresample=async=1000
  1180. @end example
  1181. @end itemize
  1182. @section areverse
  1183. Reverse an audio clip.
  1184. Warning: This filter requires memory to buffer the entire clip, so trimming
  1185. is suggested.
  1186. @subsection Examples
  1187. @itemize
  1188. @item
  1189. Take the first 5 seconds of a clip, and reverse it.
  1190. @example
  1191. atrim=end=5,areverse
  1192. @end example
  1193. @end itemize
  1194. @section asetnsamples
  1195. Set the number of samples per each output audio frame.
  1196. The last output packet may contain a different number of samples, as
  1197. the filter will flush all the remaining samples when the input audio
  1198. signals its end.
  1199. The filter accepts the following options:
  1200. @table @option
  1201. @item nb_out_samples, n
  1202. Set the number of frames per each output audio frame. The number is
  1203. intended as the number of samples @emph{per each channel}.
  1204. Default value is 1024.
  1205. @item pad, p
  1206. If set to 1, the filter will pad the last audio frame with zeroes, so
  1207. that the last frame will contain the same number of samples as the
  1208. previous ones. Default value is 1.
  1209. @end table
  1210. For example, to set the number of per-frame samples to 1234 and
  1211. disable padding for the last frame, use:
  1212. @example
  1213. asetnsamples=n=1234:p=0
  1214. @end example
  1215. @section asetrate
  1216. Set the sample rate without altering the PCM data.
  1217. This will result in a change of speed and pitch.
  1218. The filter accepts the following options:
  1219. @table @option
  1220. @item sample_rate, r
  1221. Set the output sample rate. Default is 44100 Hz.
  1222. @end table
  1223. @section ashowinfo
  1224. Show a line containing various information for each input audio frame.
  1225. The input audio is not modified.
  1226. The shown line contains a sequence of key/value pairs of the form
  1227. @var{key}:@var{value}.
  1228. The following values are shown in the output:
  1229. @table @option
  1230. @item n
  1231. The (sequential) number of the input frame, starting from 0.
  1232. @item pts
  1233. The presentation timestamp of the input frame, in time base units; the time base
  1234. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1235. @item pts_time
  1236. The presentation timestamp of the input frame in seconds.
  1237. @item pos
  1238. position of the frame in the input stream, -1 if this information in
  1239. unavailable and/or meaningless (for example in case of synthetic audio)
  1240. @item fmt
  1241. The sample format.
  1242. @item chlayout
  1243. The channel layout.
  1244. @item rate
  1245. The sample rate for the audio frame.
  1246. @item nb_samples
  1247. The number of samples (per channel) in the frame.
  1248. @item checksum
  1249. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1250. audio, the data is treated as if all the planes were concatenated.
  1251. @item plane_checksums
  1252. A list of Adler-32 checksums for each data plane.
  1253. @end table
  1254. @anchor{astats}
  1255. @section astats
  1256. Display time domain statistical information about the audio channels.
  1257. Statistics are calculated and displayed for each audio channel and,
  1258. where applicable, an overall figure is also given.
  1259. It accepts the following option:
  1260. @table @option
  1261. @item length
  1262. Short window length in seconds, used for peak and trough RMS measurement.
  1263. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1264. @item metadata
  1265. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1266. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1267. disabled.
  1268. Available keys for each channel are:
  1269. DC_offset
  1270. Min_level
  1271. Max_level
  1272. Min_difference
  1273. Max_difference
  1274. Mean_difference
  1275. RMS_difference
  1276. Peak_level
  1277. RMS_peak
  1278. RMS_trough
  1279. Crest_factor
  1280. Flat_factor
  1281. Peak_count
  1282. Bit_depth
  1283. Dynamic_range
  1284. and for Overall:
  1285. DC_offset
  1286. Min_level
  1287. Max_level
  1288. Min_difference
  1289. Max_difference
  1290. Mean_difference
  1291. RMS_difference
  1292. Peak_level
  1293. RMS_level
  1294. RMS_peak
  1295. RMS_trough
  1296. Flat_factor
  1297. Peak_count
  1298. Bit_depth
  1299. Number_of_samples
  1300. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1301. this @code{lavfi.astats.Overall.Peak_count}.
  1302. For description what each key means read below.
  1303. @item reset
  1304. Set number of frame after which stats are going to be recalculated.
  1305. Default is disabled.
  1306. @end table
  1307. A description of each shown parameter follows:
  1308. @table @option
  1309. @item DC offset
  1310. Mean amplitude displacement from zero.
  1311. @item Min level
  1312. Minimal sample level.
  1313. @item Max level
  1314. Maximal sample level.
  1315. @item Min difference
  1316. Minimal difference between two consecutive samples.
  1317. @item Max difference
  1318. Maximal difference between two consecutive samples.
  1319. @item Mean difference
  1320. Mean difference between two consecutive samples.
  1321. The average of each difference between two consecutive samples.
  1322. @item RMS difference
  1323. Root Mean Square difference between two consecutive samples.
  1324. @item Peak level dB
  1325. @item RMS level dB
  1326. Standard peak and RMS level measured in dBFS.
  1327. @item RMS peak dB
  1328. @item RMS trough dB
  1329. Peak and trough values for RMS level measured over a short window.
  1330. @item Crest factor
  1331. Standard ratio of peak to RMS level (note: not in dB).
  1332. @item Flat factor
  1333. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1334. (i.e. either @var{Min level} or @var{Max level}).
  1335. @item Peak count
  1336. Number of occasions (not the number of samples) that the signal attained either
  1337. @var{Min level} or @var{Max level}.
  1338. @item Bit depth
  1339. Overall bit depth of audio. Number of bits used for each sample.
  1340. @item Dynamic range
  1341. Measured dynamic range of audio in dB.
  1342. @end table
  1343. @section atempo
  1344. Adjust audio tempo.
  1345. The filter accepts exactly one parameter, the audio tempo. If not
  1346. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1347. be in the [0.5, 2.0] range.
  1348. @subsection Examples
  1349. @itemize
  1350. @item
  1351. Slow down audio to 80% tempo:
  1352. @example
  1353. atempo=0.8
  1354. @end example
  1355. @item
  1356. To speed up audio to 125% tempo:
  1357. @example
  1358. atempo=1.25
  1359. @end example
  1360. @end itemize
  1361. @section atrim
  1362. Trim the input so that the output contains one continuous subpart of the input.
  1363. It accepts the following parameters:
  1364. @table @option
  1365. @item start
  1366. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1367. sample with the timestamp @var{start} will be the first sample in the output.
  1368. @item end
  1369. Specify time of the first audio sample that will be dropped, i.e. the
  1370. audio sample immediately preceding the one with the timestamp @var{end} will be
  1371. the last sample in the output.
  1372. @item start_pts
  1373. Same as @var{start}, except this option sets the start timestamp in samples
  1374. instead of seconds.
  1375. @item end_pts
  1376. Same as @var{end}, except this option sets the end timestamp in samples instead
  1377. of seconds.
  1378. @item duration
  1379. The maximum duration of the output in seconds.
  1380. @item start_sample
  1381. The number of the first sample that should be output.
  1382. @item end_sample
  1383. The number of the first sample that should be dropped.
  1384. @end table
  1385. @option{start}, @option{end}, and @option{duration} are expressed as time
  1386. duration specifications; see
  1387. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1388. Note that the first two sets of the start/end options and the @option{duration}
  1389. option look at the frame timestamp, while the _sample options simply count the
  1390. samples that pass through the filter. So start/end_pts and start/end_sample will
  1391. give different results when the timestamps are wrong, inexact or do not start at
  1392. zero. Also note that this filter does not modify the timestamps. If you wish
  1393. to have the output timestamps start at zero, insert the asetpts filter after the
  1394. atrim filter.
  1395. If multiple start or end options are set, this filter tries to be greedy and
  1396. keep all samples that match at least one of the specified constraints. To keep
  1397. only the part that matches all the constraints at once, chain multiple atrim
  1398. filters.
  1399. The defaults are such that all the input is kept. So it is possible to set e.g.
  1400. just the end values to keep everything before the specified time.
  1401. Examples:
  1402. @itemize
  1403. @item
  1404. Drop everything except the second minute of input:
  1405. @example
  1406. ffmpeg -i INPUT -af atrim=60:120
  1407. @end example
  1408. @item
  1409. Keep only the first 1000 samples:
  1410. @example
  1411. ffmpeg -i INPUT -af atrim=end_sample=1000
  1412. @end example
  1413. @end itemize
  1414. @section bandpass
  1415. Apply a two-pole Butterworth band-pass filter with central
  1416. frequency @var{frequency}, and (3dB-point) band-width width.
  1417. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1418. instead of the default: constant 0dB peak gain.
  1419. The filter roll off at 6dB per octave (20dB per decade).
  1420. The filter accepts the following options:
  1421. @table @option
  1422. @item frequency, f
  1423. Set the filter's central frequency. Default is @code{3000}.
  1424. @item csg
  1425. Constant skirt gain if set to 1. Defaults to 0.
  1426. @item width_type, t
  1427. Set method to specify band-width of filter.
  1428. @table @option
  1429. @item h
  1430. Hz
  1431. @item q
  1432. Q-Factor
  1433. @item o
  1434. octave
  1435. @item s
  1436. slope
  1437. @end table
  1438. @item width, w
  1439. Specify the band-width of a filter in width_type units.
  1440. @item channels, c
  1441. Specify which channels to filter, by default all available are filtered.
  1442. @end table
  1443. @section bandreject
  1444. Apply a two-pole Butterworth band-reject filter with central
  1445. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1446. The filter roll off at 6dB per octave (20dB per decade).
  1447. The filter accepts the following options:
  1448. @table @option
  1449. @item frequency, f
  1450. Set the filter's central frequency. Default is @code{3000}.
  1451. @item width_type, t
  1452. Set method to specify band-width of filter.
  1453. @table @option
  1454. @item h
  1455. Hz
  1456. @item q
  1457. Q-Factor
  1458. @item o
  1459. octave
  1460. @item s
  1461. slope
  1462. @end table
  1463. @item width, w
  1464. Specify the band-width of a filter in width_type units.
  1465. @item channels, c
  1466. Specify which channels to filter, by default all available are filtered.
  1467. @end table
  1468. @section bass
  1469. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1470. shelving filter with a response similar to that of a standard
  1471. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1472. The filter accepts the following options:
  1473. @table @option
  1474. @item gain, g
  1475. Give the gain at 0 Hz. Its useful range is about -20
  1476. (for a large cut) to +20 (for a large boost).
  1477. Beware of clipping when using a positive gain.
  1478. @item frequency, f
  1479. Set the filter's central frequency and so can be used
  1480. to extend or reduce the frequency range to be boosted or cut.
  1481. The default value is @code{100} Hz.
  1482. @item width_type, t
  1483. Set method to specify band-width of filter.
  1484. @table @option
  1485. @item h
  1486. Hz
  1487. @item q
  1488. Q-Factor
  1489. @item o
  1490. octave
  1491. @item s
  1492. slope
  1493. @end table
  1494. @item width, w
  1495. Determine how steep is the filter's shelf transition.
  1496. @item channels, c
  1497. Specify which channels to filter, by default all available are filtered.
  1498. @end table
  1499. @section biquad
  1500. Apply a biquad IIR filter with the given coefficients.
  1501. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1502. are the numerator and denominator coefficients respectively.
  1503. and @var{channels}, @var{c} specify which channels to filter, by default all
  1504. available are filtered.
  1505. @section bs2b
  1506. Bauer stereo to binaural transformation, which improves headphone listening of
  1507. stereo audio records.
  1508. To enable compilation of this filter you need to configure FFmpeg with
  1509. @code{--enable-libbs2b}.
  1510. It accepts the following parameters:
  1511. @table @option
  1512. @item profile
  1513. Pre-defined crossfeed level.
  1514. @table @option
  1515. @item default
  1516. Default level (fcut=700, feed=50).
  1517. @item cmoy
  1518. Chu Moy circuit (fcut=700, feed=60).
  1519. @item jmeier
  1520. Jan Meier circuit (fcut=650, feed=95).
  1521. @end table
  1522. @item fcut
  1523. Cut frequency (in Hz).
  1524. @item feed
  1525. Feed level (in Hz).
  1526. @end table
  1527. @section channelmap
  1528. Remap input channels to new locations.
  1529. It accepts the following parameters:
  1530. @table @option
  1531. @item map
  1532. Map channels from input to output. The argument is a '|'-separated list of
  1533. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1534. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1535. channel (e.g. FL for front left) or its index in the input channel layout.
  1536. @var{out_channel} is the name of the output channel or its index in the output
  1537. channel layout. If @var{out_channel} is not given then it is implicitly an
  1538. index, starting with zero and increasing by one for each mapping.
  1539. @item channel_layout
  1540. The channel layout of the output stream.
  1541. @end table
  1542. If no mapping is present, the filter will implicitly map input channels to
  1543. output channels, preserving indices.
  1544. For example, assuming a 5.1+downmix input MOV file,
  1545. @example
  1546. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1547. @end example
  1548. will create an output WAV file tagged as stereo from the downmix channels of
  1549. the input.
  1550. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1551. @example
  1552. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1553. @end example
  1554. @section channelsplit
  1555. Split each channel from an input audio stream into a separate output stream.
  1556. It accepts the following parameters:
  1557. @table @option
  1558. @item channel_layout
  1559. The channel layout of the input stream. The default is "stereo".
  1560. @end table
  1561. For example, assuming a stereo input MP3 file,
  1562. @example
  1563. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1564. @end example
  1565. will create an output Matroska file with two audio streams, one containing only
  1566. the left channel and the other the right channel.
  1567. Split a 5.1 WAV file into per-channel files:
  1568. @example
  1569. ffmpeg -i in.wav -filter_complex
  1570. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1571. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1572. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1573. side_right.wav
  1574. @end example
  1575. @section chorus
  1576. Add a chorus effect to the audio.
  1577. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1578. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1579. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1580. The modulation depth defines the range the modulated delay is played before or after
  1581. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1582. sound tuned around the original one, like in a chorus where some vocals are slightly
  1583. off key.
  1584. It accepts the following parameters:
  1585. @table @option
  1586. @item in_gain
  1587. Set input gain. Default is 0.4.
  1588. @item out_gain
  1589. Set output gain. Default is 0.4.
  1590. @item delays
  1591. Set delays. A typical delay is around 40ms to 60ms.
  1592. @item decays
  1593. Set decays.
  1594. @item speeds
  1595. Set speeds.
  1596. @item depths
  1597. Set depths.
  1598. @end table
  1599. @subsection Examples
  1600. @itemize
  1601. @item
  1602. A single delay:
  1603. @example
  1604. chorus=0.7:0.9:55:0.4:0.25:2
  1605. @end example
  1606. @item
  1607. Two delays:
  1608. @example
  1609. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1610. @end example
  1611. @item
  1612. Fuller sounding chorus with three delays:
  1613. @example
  1614. 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
  1615. @end example
  1616. @end itemize
  1617. @section compand
  1618. Compress or expand the audio's dynamic range.
  1619. It accepts the following parameters:
  1620. @table @option
  1621. @item attacks
  1622. @item decays
  1623. A list of times in seconds for each channel over which the instantaneous level
  1624. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1625. increase of volume and @var{decays} refers to decrease of volume. For most
  1626. situations, the attack time (response to the audio getting louder) should be
  1627. shorter than the decay time, because the human ear is more sensitive to sudden
  1628. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1629. a typical value for decay is 0.8 seconds.
  1630. If specified number of attacks & decays is lower than number of channels, the last
  1631. set attack/decay will be used for all remaining channels.
  1632. @item points
  1633. A list of points for the transfer function, specified in dB relative to the
  1634. maximum possible signal amplitude. Each key points list must be defined using
  1635. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1636. @code{x0/y0 x1/y1 x2/y2 ....}
  1637. The input values must be in strictly increasing order but the transfer function
  1638. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1639. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1640. function are @code{-70/-70|-60/-20|1/0}.
  1641. @item soft-knee
  1642. Set the curve radius in dB for all joints. It defaults to 0.01.
  1643. @item gain
  1644. Set the additional gain in dB to be applied at all points on the transfer
  1645. function. This allows for easy adjustment of the overall gain.
  1646. It defaults to 0.
  1647. @item volume
  1648. Set an initial volume, in dB, to be assumed for each channel when filtering
  1649. starts. This permits the user to supply a nominal level initially, so that, for
  1650. example, a very large gain is not applied to initial signal levels before the
  1651. companding has begun to operate. A typical value for audio which is initially
  1652. quiet is -90 dB. It defaults to 0.
  1653. @item delay
  1654. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1655. delayed before being fed to the volume adjuster. Specifying a delay
  1656. approximately equal to the attack/decay times allows the filter to effectively
  1657. operate in predictive rather than reactive mode. It defaults to 0.
  1658. @end table
  1659. @subsection Examples
  1660. @itemize
  1661. @item
  1662. Make music with both quiet and loud passages suitable for listening to in a
  1663. noisy environment:
  1664. @example
  1665. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1666. @end example
  1667. Another example for audio with whisper and explosion parts:
  1668. @example
  1669. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1670. @end example
  1671. @item
  1672. A noise gate for when the noise is at a lower level than the signal:
  1673. @example
  1674. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1675. @end example
  1676. @item
  1677. Here is another noise gate, this time for when the noise is at a higher level
  1678. than the signal (making it, in some ways, similar to squelch):
  1679. @example
  1680. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1681. @end example
  1682. @item
  1683. 2:1 compression starting at -6dB:
  1684. @example
  1685. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1686. @end example
  1687. @item
  1688. 2:1 compression starting at -9dB:
  1689. @example
  1690. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1691. @end example
  1692. @item
  1693. 2:1 compression starting at -12dB:
  1694. @example
  1695. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1696. @end example
  1697. @item
  1698. 2:1 compression starting at -18dB:
  1699. @example
  1700. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1701. @end example
  1702. @item
  1703. 3:1 compression starting at -15dB:
  1704. @example
  1705. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1706. @end example
  1707. @item
  1708. Compressor/Gate:
  1709. @example
  1710. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1711. @end example
  1712. @item
  1713. Expander:
  1714. @example
  1715. 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
  1716. @end example
  1717. @item
  1718. Hard limiter at -6dB:
  1719. @example
  1720. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1721. @end example
  1722. @item
  1723. Hard limiter at -12dB:
  1724. @example
  1725. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1726. @end example
  1727. @item
  1728. Hard noise gate at -35 dB:
  1729. @example
  1730. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1731. @end example
  1732. @item
  1733. Soft limiter:
  1734. @example
  1735. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1736. @end example
  1737. @end itemize
  1738. @section compensationdelay
  1739. Compensation Delay Line is a metric based delay to compensate differing
  1740. positions of microphones or speakers.
  1741. For example, you have recorded guitar with two microphones placed in
  1742. different location. Because the front of sound wave has fixed speed in
  1743. normal conditions, the phasing of microphones can vary and depends on
  1744. their location and interposition. The best sound mix can be achieved when
  1745. these microphones are in phase (synchronized). Note that distance of
  1746. ~30 cm between microphones makes one microphone to capture signal in
  1747. antiphase to another microphone. That makes the final mix sounding moody.
  1748. This filter helps to solve phasing problems by adding different delays
  1749. to each microphone track and make them synchronized.
  1750. The best result can be reached when you take one track as base and
  1751. synchronize other tracks one by one with it.
  1752. Remember that synchronization/delay tolerance depends on sample rate, too.
  1753. Higher sample rates will give more tolerance.
  1754. It accepts the following parameters:
  1755. @table @option
  1756. @item mm
  1757. Set millimeters distance. This is compensation distance for fine tuning.
  1758. Default is 0.
  1759. @item cm
  1760. Set cm distance. This is compensation distance for tightening distance setup.
  1761. Default is 0.
  1762. @item m
  1763. Set meters distance. This is compensation distance for hard distance setup.
  1764. Default is 0.
  1765. @item dry
  1766. Set dry amount. Amount of unprocessed (dry) signal.
  1767. Default is 0.
  1768. @item wet
  1769. Set wet amount. Amount of processed (wet) signal.
  1770. Default is 1.
  1771. @item temp
  1772. Set temperature degree in Celsius. This is the temperature of the environment.
  1773. Default is 20.
  1774. @end table
  1775. @section crossfeed
  1776. Apply headphone crossfeed filter.
  1777. Crossfeed is the process of blending the left and right channels of stereo
  1778. audio recording.
  1779. It is mainly used to reduce extreme stereo separation of low frequencies.
  1780. The intent is to produce more speaker like sound to the listener.
  1781. The filter accepts the following options:
  1782. @table @option
  1783. @item strength
  1784. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1785. This sets gain of low shelf filter for side part of stereo image.
  1786. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1787. @item range
  1788. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1789. This sets cut off frequency of low shelf filter. Default is cut off near
  1790. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1791. @item level_in
  1792. Set input gain. Default is 0.9.
  1793. @item level_out
  1794. Set output gain. Default is 1.
  1795. @end table
  1796. @section crystalizer
  1797. Simple algorithm to expand audio dynamic range.
  1798. The filter accepts the following options:
  1799. @table @option
  1800. @item i
  1801. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1802. (unchanged sound) to 10.0 (maximum effect).
  1803. @item c
  1804. Enable clipping. By default is enabled.
  1805. @end table
  1806. @section dcshift
  1807. Apply a DC shift to the audio.
  1808. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1809. in the recording chain) from the audio. The effect of a DC offset is reduced
  1810. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1811. a signal has a DC offset.
  1812. @table @option
  1813. @item shift
  1814. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1815. the audio.
  1816. @item limitergain
  1817. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1818. used to prevent clipping.
  1819. @end table
  1820. @section dynaudnorm
  1821. Dynamic Audio Normalizer.
  1822. This filter applies a certain amount of gain to the input audio in order
  1823. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1824. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1825. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1826. This allows for applying extra gain to the "quiet" sections of the audio
  1827. while avoiding distortions or clipping the "loud" sections. In other words:
  1828. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1829. sections, in the sense that the volume of each section is brought to the
  1830. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1831. this goal *without* applying "dynamic range compressing". It will retain 100%
  1832. of the dynamic range *within* each section of the audio file.
  1833. @table @option
  1834. @item f
  1835. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1836. Default is 500 milliseconds.
  1837. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1838. referred to as frames. This is required, because a peak magnitude has no
  1839. meaning for just a single sample value. Instead, we need to determine the
  1840. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1841. normalizer would simply use the peak magnitude of the complete file, the
  1842. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1843. frame. The length of a frame is specified in milliseconds. By default, the
  1844. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1845. been found to give good results with most files.
  1846. Note that the exact frame length, in number of samples, will be determined
  1847. automatically, based on the sampling rate of the individual input audio file.
  1848. @item g
  1849. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1850. number. Default is 31.
  1851. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1852. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1853. is specified in frames, centered around the current frame. For the sake of
  1854. simplicity, this must be an odd number. Consequently, the default value of 31
  1855. takes into account the current frame, as well as the 15 preceding frames and
  1856. the 15 subsequent frames. Using a larger window results in a stronger
  1857. smoothing effect and thus in less gain variation, i.e. slower gain
  1858. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1859. effect and thus in more gain variation, i.e. faster gain adaptation.
  1860. In other words, the more you increase this value, the more the Dynamic Audio
  1861. Normalizer will behave like a "traditional" normalization filter. On the
  1862. contrary, the more you decrease this value, the more the Dynamic Audio
  1863. Normalizer will behave like a dynamic range compressor.
  1864. @item p
  1865. Set the target peak value. This specifies the highest permissible magnitude
  1866. level for the normalized audio input. This filter will try to approach the
  1867. target peak magnitude as closely as possible, but at the same time it also
  1868. makes sure that the normalized signal will never exceed the peak magnitude.
  1869. A frame's maximum local gain factor is imposed directly by the target peak
  1870. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1871. It is not recommended to go above this value.
  1872. @item m
  1873. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1874. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1875. factor for each input frame, i.e. the maximum gain factor that does not
  1876. result in clipping or distortion. The maximum gain factor is determined by
  1877. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1878. additionally bounds the frame's maximum gain factor by a predetermined
  1879. (global) maximum gain factor. This is done in order to avoid excessive gain
  1880. factors in "silent" or almost silent frames. By default, the maximum gain
  1881. factor is 10.0, For most inputs the default value should be sufficient and
  1882. it usually is not recommended to increase this value. Though, for input
  1883. with an extremely low overall volume level, it may be necessary to allow even
  1884. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1885. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1886. Instead, a "sigmoid" threshold function will be applied. This way, the
  1887. gain factors will smoothly approach the threshold value, but never exceed that
  1888. value.
  1889. @item r
  1890. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1891. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1892. This means that the maximum local gain factor for each frame is defined
  1893. (only) by the frame's highest magnitude sample. This way, the samples can
  1894. be amplified as much as possible without exceeding the maximum signal
  1895. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1896. Normalizer can also take into account the frame's root mean square,
  1897. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1898. determine the power of a time-varying signal. It is therefore considered
  1899. that the RMS is a better approximation of the "perceived loudness" than
  1900. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1901. frames to a constant RMS value, a uniform "perceived loudness" can be
  1902. established. If a target RMS value has been specified, a frame's local gain
  1903. factor is defined as the factor that would result in exactly that RMS value.
  1904. Note, however, that the maximum local gain factor is still restricted by the
  1905. frame's highest magnitude sample, in order to prevent clipping.
  1906. @item n
  1907. Enable channels coupling. By default is enabled.
  1908. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1909. amount. This means the same gain factor will be applied to all channels, i.e.
  1910. the maximum possible gain factor is determined by the "loudest" channel.
  1911. However, in some recordings, it may happen that the volume of the different
  1912. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1913. In this case, this option can be used to disable the channel coupling. This way,
  1914. the gain factor will be determined independently for each channel, depending
  1915. only on the individual channel's highest magnitude sample. This allows for
  1916. harmonizing the volume of the different channels.
  1917. @item c
  1918. Enable DC bias correction. By default is disabled.
  1919. An audio signal (in the time domain) is a sequence of sample values.
  1920. In the Dynamic Audio Normalizer these sample values are represented in the
  1921. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1922. audio signal, or "waveform", should be centered around the zero point.
  1923. That means if we calculate the mean value of all samples in a file, or in a
  1924. single frame, then the result should be 0.0 or at least very close to that
  1925. value. If, however, there is a significant deviation of the mean value from
  1926. 0.0, in either positive or negative direction, this is referred to as a
  1927. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1928. Audio Normalizer provides optional DC bias correction.
  1929. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1930. the mean value, or "DC correction" offset, of each input frame and subtract
  1931. that value from all of the frame's sample values which ensures those samples
  1932. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1933. boundaries, the DC correction offset values will be interpolated smoothly
  1934. between neighbouring frames.
  1935. @item b
  1936. Enable alternative boundary mode. By default is disabled.
  1937. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1938. around each frame. This includes the preceding frames as well as the
  1939. subsequent frames. However, for the "boundary" frames, located at the very
  1940. beginning and at the very end of the audio file, not all neighbouring
  1941. frames are available. In particular, for the first few frames in the audio
  1942. file, the preceding frames are not known. And, similarly, for the last few
  1943. frames in the audio file, the subsequent frames are not known. Thus, the
  1944. question arises which gain factors should be assumed for the missing frames
  1945. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1946. to deal with this situation. The default boundary mode assumes a gain factor
  1947. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1948. "fade out" at the beginning and at the end of the input, respectively.
  1949. @item s
  1950. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1951. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1952. compression. This means that signal peaks will not be pruned and thus the
  1953. full dynamic range will be retained within each local neighbourhood. However,
  1954. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1955. normalization algorithm with a more "traditional" compression.
  1956. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1957. (thresholding) function. If (and only if) the compression feature is enabled,
  1958. all input frames will be processed by a soft knee thresholding function prior
  1959. to the actual normalization process. Put simply, the thresholding function is
  1960. going to prune all samples whose magnitude exceeds a certain threshold value.
  1961. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1962. value. Instead, the threshold value will be adjusted for each individual
  1963. frame.
  1964. In general, smaller parameters result in stronger compression, and vice versa.
  1965. Values below 3.0 are not recommended, because audible distortion may appear.
  1966. @end table
  1967. @section earwax
  1968. Make audio easier to listen to on headphones.
  1969. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1970. so that when listened to on headphones the stereo image is moved from
  1971. inside your head (standard for headphones) to outside and in front of
  1972. the listener (standard for speakers).
  1973. Ported from SoX.
  1974. @section equalizer
  1975. Apply a two-pole peaking equalisation (EQ) filter. With this
  1976. filter, the signal-level at and around a selected frequency can
  1977. be increased or decreased, whilst (unlike bandpass and bandreject
  1978. filters) that at all other frequencies is unchanged.
  1979. In order to produce complex equalisation curves, this filter can
  1980. be given several times, each with a different central frequency.
  1981. The filter accepts the following options:
  1982. @table @option
  1983. @item frequency, f
  1984. Set the filter's central frequency in Hz.
  1985. @item width_type, t
  1986. Set method to specify band-width of filter.
  1987. @table @option
  1988. @item h
  1989. Hz
  1990. @item q
  1991. Q-Factor
  1992. @item o
  1993. octave
  1994. @item s
  1995. slope
  1996. @end table
  1997. @item width, w
  1998. Specify the band-width of a filter in width_type units.
  1999. @item gain, g
  2000. Set the required gain or attenuation in dB.
  2001. Beware of clipping when using a positive gain.
  2002. @item channels, c
  2003. Specify which channels to filter, by default all available are filtered.
  2004. @end table
  2005. @subsection Examples
  2006. @itemize
  2007. @item
  2008. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2009. @example
  2010. equalizer=f=1000:t=h:width=200:g=-10
  2011. @end example
  2012. @item
  2013. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2014. @example
  2015. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2016. @end example
  2017. @end itemize
  2018. @section extrastereo
  2019. Linearly increases the difference between left and right channels which
  2020. adds some sort of "live" effect to playback.
  2021. The filter accepts the following options:
  2022. @table @option
  2023. @item m
  2024. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2025. (average of both channels), with 1.0 sound will be unchanged, with
  2026. -1.0 left and right channels will be swapped.
  2027. @item c
  2028. Enable clipping. By default is enabled.
  2029. @end table
  2030. @section firequalizer
  2031. Apply FIR Equalization using arbitrary frequency response.
  2032. The filter accepts the following option:
  2033. @table @option
  2034. @item gain
  2035. Set gain curve equation (in dB). The expression can contain variables:
  2036. @table @option
  2037. @item f
  2038. the evaluated frequency
  2039. @item sr
  2040. sample rate
  2041. @item ch
  2042. channel number, set to 0 when multichannels evaluation is disabled
  2043. @item chid
  2044. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2045. multichannels evaluation is disabled
  2046. @item chs
  2047. number of channels
  2048. @item chlayout
  2049. channel_layout, see libavutil/channel_layout.h
  2050. @end table
  2051. and functions:
  2052. @table @option
  2053. @item gain_interpolate(f)
  2054. interpolate gain on frequency f based on gain_entry
  2055. @item cubic_interpolate(f)
  2056. same as gain_interpolate, but smoother
  2057. @end table
  2058. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2059. @item gain_entry
  2060. Set gain entry for gain_interpolate function. The expression can
  2061. contain functions:
  2062. @table @option
  2063. @item entry(f, g)
  2064. store gain entry at frequency f with value g
  2065. @end table
  2066. This option is also available as command.
  2067. @item delay
  2068. Set filter delay in seconds. Higher value means more accurate.
  2069. Default is @code{0.01}.
  2070. @item accuracy
  2071. Set filter accuracy in Hz. Lower value means more accurate.
  2072. Default is @code{5}.
  2073. @item wfunc
  2074. Set window function. Acceptable values are:
  2075. @table @option
  2076. @item rectangular
  2077. rectangular window, useful when gain curve is already smooth
  2078. @item hann
  2079. hann window (default)
  2080. @item hamming
  2081. hamming window
  2082. @item blackman
  2083. blackman window
  2084. @item nuttall3
  2085. 3-terms continuous 1st derivative nuttall window
  2086. @item mnuttall3
  2087. minimum 3-terms discontinuous nuttall window
  2088. @item nuttall
  2089. 4-terms continuous 1st derivative nuttall window
  2090. @item bnuttall
  2091. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2092. @item bharris
  2093. blackman-harris window
  2094. @item tukey
  2095. tukey window
  2096. @end table
  2097. @item fixed
  2098. If enabled, use fixed number of audio samples. This improves speed when
  2099. filtering with large delay. Default is disabled.
  2100. @item multi
  2101. Enable multichannels evaluation on gain. Default is disabled.
  2102. @item zero_phase
  2103. Enable zero phase mode by subtracting timestamp to compensate delay.
  2104. Default is disabled.
  2105. @item scale
  2106. Set scale used by gain. Acceptable values are:
  2107. @table @option
  2108. @item linlin
  2109. linear frequency, linear gain
  2110. @item linlog
  2111. linear frequency, logarithmic (in dB) gain (default)
  2112. @item loglin
  2113. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2114. @item loglog
  2115. logarithmic frequency, logarithmic gain
  2116. @end table
  2117. @item dumpfile
  2118. Set file for dumping, suitable for gnuplot.
  2119. @item dumpscale
  2120. Set scale for dumpfile. Acceptable values are same with scale option.
  2121. Default is linlog.
  2122. @item fft2
  2123. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2124. Default is disabled.
  2125. @item min_phase
  2126. Enable minimum phase impulse response. Default is disabled.
  2127. @end table
  2128. @subsection Examples
  2129. @itemize
  2130. @item
  2131. lowpass at 1000 Hz:
  2132. @example
  2133. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2134. @end example
  2135. @item
  2136. lowpass at 1000 Hz with gain_entry:
  2137. @example
  2138. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2139. @end example
  2140. @item
  2141. custom equalization:
  2142. @example
  2143. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2144. @end example
  2145. @item
  2146. higher delay with zero phase to compensate delay:
  2147. @example
  2148. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2149. @end example
  2150. @item
  2151. lowpass on left channel, highpass on right channel:
  2152. @example
  2153. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2154. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2155. @end example
  2156. @end itemize
  2157. @section flanger
  2158. Apply a flanging effect to the audio.
  2159. The filter accepts the following options:
  2160. @table @option
  2161. @item delay
  2162. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2163. @item depth
  2164. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2165. @item regen
  2166. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2167. Default value is 0.
  2168. @item width
  2169. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2170. Default value is 71.
  2171. @item speed
  2172. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2173. @item shape
  2174. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2175. Default value is @var{sinusoidal}.
  2176. @item phase
  2177. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2178. Default value is 25.
  2179. @item interp
  2180. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2181. Default is @var{linear}.
  2182. @end table
  2183. @section haas
  2184. Apply Haas effect to audio.
  2185. Note that this makes most sense to apply on mono signals.
  2186. With this filter applied to mono signals it give some directionality and
  2187. stretches its stereo image.
  2188. The filter accepts the following options:
  2189. @table @option
  2190. @item level_in
  2191. Set input level. By default is @var{1}, or 0dB
  2192. @item level_out
  2193. Set output level. By default is @var{1}, or 0dB.
  2194. @item side_gain
  2195. Set gain applied to side part of signal. By default is @var{1}.
  2196. @item middle_source
  2197. Set kind of middle source. Can be one of the following:
  2198. @table @samp
  2199. @item left
  2200. Pick left channel.
  2201. @item right
  2202. Pick right channel.
  2203. @item mid
  2204. Pick middle part signal of stereo image.
  2205. @item side
  2206. Pick side part signal of stereo image.
  2207. @end table
  2208. @item middle_phase
  2209. Change middle phase. By default is disabled.
  2210. @item left_delay
  2211. Set left channel delay. By default is @var{2.05} milliseconds.
  2212. @item left_balance
  2213. Set left channel balance. By default is @var{-1}.
  2214. @item left_gain
  2215. Set left channel gain. By default is @var{1}.
  2216. @item left_phase
  2217. Change left phase. By default is disabled.
  2218. @item right_delay
  2219. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2220. @item right_balance
  2221. Set right channel balance. By default is @var{1}.
  2222. @item right_gain
  2223. Set right channel gain. By default is @var{1}.
  2224. @item right_phase
  2225. Change right phase. By default is enabled.
  2226. @end table
  2227. @section hdcd
  2228. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2229. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2230. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2231. of HDCD, and detects the Transient Filter flag.
  2232. @example
  2233. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2234. @end example
  2235. When using the filter with wav, note the default encoding for wav is 16-bit,
  2236. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2237. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2238. @example
  2239. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2240. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2241. @end example
  2242. The filter accepts the following options:
  2243. @table @option
  2244. @item disable_autoconvert
  2245. Disable any automatic format conversion or resampling in the filter graph.
  2246. @item process_stereo
  2247. Process the stereo channels together. If target_gain does not match between
  2248. channels, consider it invalid and use the last valid target_gain.
  2249. @item cdt_ms
  2250. Set the code detect timer period in ms.
  2251. @item force_pe
  2252. Always extend peaks above -3dBFS even if PE isn't signaled.
  2253. @item analyze_mode
  2254. Replace audio with a solid tone and adjust the amplitude to signal some
  2255. specific aspect of the decoding process. The output file can be loaded in
  2256. an audio editor alongside the original to aid analysis.
  2257. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2258. Modes are:
  2259. @table @samp
  2260. @item 0, off
  2261. Disabled
  2262. @item 1, lle
  2263. Gain adjustment level at each sample
  2264. @item 2, pe
  2265. Samples where peak extend occurs
  2266. @item 3, cdt
  2267. Samples where the code detect timer is active
  2268. @item 4, tgm
  2269. Samples where the target gain does not match between channels
  2270. @end table
  2271. @end table
  2272. @section headphone
  2273. Apply head-related transfer functions (HRTFs) to create virtual
  2274. loudspeakers around the user for binaural listening via headphones.
  2275. The HRIRs are provided via additional streams, for each channel
  2276. one stereo input stream is needed.
  2277. The filter accepts the following options:
  2278. @table @option
  2279. @item map
  2280. Set mapping of input streams for convolution.
  2281. The argument is a '|'-separated list of channel names in order as they
  2282. are given as additional stream inputs for filter.
  2283. This also specify number of input streams. Number of input streams
  2284. must be not less than number of channels in first stream plus one.
  2285. @item gain
  2286. Set gain applied to audio. Value is in dB. Default is 0.
  2287. @item type
  2288. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2289. processing audio in time domain which is slow.
  2290. @var{freq} is processing audio in frequency domain which is fast.
  2291. Default is @var{freq}.
  2292. @item lfe
  2293. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2294. @end table
  2295. @subsection Examples
  2296. @itemize
  2297. @item
  2298. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2299. each amovie filter use stereo file with IR coefficients as input.
  2300. The files give coefficients for each position of virtual loudspeaker:
  2301. @example
  2302. 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"
  2303. output.wav
  2304. @end example
  2305. @end itemize
  2306. @section highpass
  2307. Apply a high-pass filter with 3dB point frequency.
  2308. The filter can be either single-pole, or double-pole (the default).
  2309. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2310. The filter accepts the following options:
  2311. @table @option
  2312. @item frequency, f
  2313. Set frequency in Hz. Default is 3000.
  2314. @item poles, p
  2315. Set number of poles. Default is 2.
  2316. @item width_type, t
  2317. Set method to specify band-width of filter.
  2318. @table @option
  2319. @item h
  2320. Hz
  2321. @item q
  2322. Q-Factor
  2323. @item o
  2324. octave
  2325. @item s
  2326. slope
  2327. @end table
  2328. @item width, w
  2329. Specify the band-width of a filter in width_type units.
  2330. Applies only to double-pole filter.
  2331. The default is 0.707q and gives a Butterworth response.
  2332. @item channels, c
  2333. Specify which channels to filter, by default all available are filtered.
  2334. @end table
  2335. @section join
  2336. Join multiple input streams into one multi-channel stream.
  2337. It accepts the following parameters:
  2338. @table @option
  2339. @item inputs
  2340. The number of input streams. It defaults to 2.
  2341. @item channel_layout
  2342. The desired output channel layout. It defaults to stereo.
  2343. @item map
  2344. Map channels from inputs to output. The argument is a '|'-separated list of
  2345. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2346. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2347. can be either the name of the input channel (e.g. FL for front left) or its
  2348. index in the specified input stream. @var{out_channel} is the name of the output
  2349. channel.
  2350. @end table
  2351. The filter will attempt to guess the mappings when they are not specified
  2352. explicitly. It does so by first trying to find an unused matching input channel
  2353. and if that fails it picks the first unused input channel.
  2354. Join 3 inputs (with properly set channel layouts):
  2355. @example
  2356. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2357. @end example
  2358. Build a 5.1 output from 6 single-channel streams:
  2359. @example
  2360. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2361. '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'
  2362. out
  2363. @end example
  2364. @section ladspa
  2365. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2366. To enable compilation of this filter you need to configure FFmpeg with
  2367. @code{--enable-ladspa}.
  2368. @table @option
  2369. @item file, f
  2370. Specifies the name of LADSPA plugin library to load. If the environment
  2371. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2372. each one of the directories specified by the colon separated list in
  2373. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2374. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2375. @file{/usr/lib/ladspa/}.
  2376. @item plugin, p
  2377. Specifies the plugin within the library. Some libraries contain only
  2378. one plugin, but others contain many of them. If this is not set filter
  2379. will list all available plugins within the specified library.
  2380. @item controls, c
  2381. Set the '|' separated list of controls which are zero or more floating point
  2382. values that determine the behavior of the loaded plugin (for example delay,
  2383. threshold or gain).
  2384. Controls need to be defined using the following syntax:
  2385. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2386. @var{valuei} is the value set on the @var{i}-th control.
  2387. Alternatively they can be also defined using the following syntax:
  2388. @var{value0}|@var{value1}|@var{value2}|..., where
  2389. @var{valuei} is the value set on the @var{i}-th control.
  2390. If @option{controls} is set to @code{help}, all available controls and
  2391. their valid ranges are printed.
  2392. @item sample_rate, s
  2393. Specify the sample rate, default to 44100. Only used if plugin have
  2394. zero inputs.
  2395. @item nb_samples, n
  2396. Set the number of samples per channel per each output frame, default
  2397. is 1024. Only used if plugin have zero inputs.
  2398. @item duration, d
  2399. Set the minimum duration of the sourced audio. See
  2400. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2401. for the accepted syntax.
  2402. Note that the resulting duration may be greater than the specified duration,
  2403. as the generated audio is always cut at the end of a complete frame.
  2404. If not specified, or the expressed duration is negative, the audio is
  2405. supposed to be generated forever.
  2406. Only used if plugin have zero inputs.
  2407. @end table
  2408. @subsection Examples
  2409. @itemize
  2410. @item
  2411. List all available plugins within amp (LADSPA example plugin) library:
  2412. @example
  2413. ladspa=file=amp
  2414. @end example
  2415. @item
  2416. List all available controls and their valid ranges for @code{vcf_notch}
  2417. plugin from @code{VCF} library:
  2418. @example
  2419. ladspa=f=vcf:p=vcf_notch:c=help
  2420. @end example
  2421. @item
  2422. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2423. plugin library:
  2424. @example
  2425. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2426. @end example
  2427. @item
  2428. Add reverberation to the audio using TAP-plugins
  2429. (Tom's Audio Processing plugins):
  2430. @example
  2431. ladspa=file=tap_reverb:tap_reverb
  2432. @end example
  2433. @item
  2434. Generate white noise, with 0.2 amplitude:
  2435. @example
  2436. ladspa=file=cmt:noise_source_white:c=c0=.2
  2437. @end example
  2438. @item
  2439. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2440. @code{C* Audio Plugin Suite} (CAPS) library:
  2441. @example
  2442. ladspa=file=caps:Click:c=c1=20'
  2443. @end example
  2444. @item
  2445. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2446. @example
  2447. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2448. @end example
  2449. @item
  2450. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2451. @code{SWH Plugins} collection:
  2452. @example
  2453. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2454. @end example
  2455. @item
  2456. Attenuate low frequencies using Multiband EQ from Steve Harris
  2457. @code{SWH Plugins} collection:
  2458. @example
  2459. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2460. @end example
  2461. @item
  2462. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2463. (CAPS) library:
  2464. @example
  2465. ladspa=caps:Narrower
  2466. @end example
  2467. @item
  2468. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2469. @example
  2470. ladspa=caps:White:.2
  2471. @end example
  2472. @item
  2473. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2474. @example
  2475. ladspa=caps:Fractal:c=c1=1
  2476. @end example
  2477. @item
  2478. Dynamic volume normalization using @code{VLevel} plugin:
  2479. @example
  2480. ladspa=vlevel-ladspa:vlevel_mono
  2481. @end example
  2482. @end itemize
  2483. @subsection Commands
  2484. This filter supports the following commands:
  2485. @table @option
  2486. @item cN
  2487. Modify the @var{N}-th control value.
  2488. If the specified value is not valid, it is ignored and prior one is kept.
  2489. @end table
  2490. @section loudnorm
  2491. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2492. Support for both single pass (livestreams, files) and double pass (files) modes.
  2493. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2494. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2495. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2496. The filter accepts the following options:
  2497. @table @option
  2498. @item I, i
  2499. Set integrated loudness target.
  2500. Range is -70.0 - -5.0. Default value is -24.0.
  2501. @item LRA, lra
  2502. Set loudness range target.
  2503. Range is 1.0 - 20.0. Default value is 7.0.
  2504. @item TP, tp
  2505. Set maximum true peak.
  2506. Range is -9.0 - +0.0. Default value is -2.0.
  2507. @item measured_I, measured_i
  2508. Measured IL of input file.
  2509. Range is -99.0 - +0.0.
  2510. @item measured_LRA, measured_lra
  2511. Measured LRA of input file.
  2512. Range is 0.0 - 99.0.
  2513. @item measured_TP, measured_tp
  2514. Measured true peak of input file.
  2515. Range is -99.0 - +99.0.
  2516. @item measured_thresh
  2517. Measured threshold of input file.
  2518. Range is -99.0 - +0.0.
  2519. @item offset
  2520. Set offset gain. Gain is applied before the true-peak limiter.
  2521. Range is -99.0 - +99.0. Default is +0.0.
  2522. @item linear
  2523. Normalize linearly if possible.
  2524. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2525. to be specified in order to use this mode.
  2526. Options are true or false. Default is true.
  2527. @item dual_mono
  2528. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2529. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2530. If set to @code{true}, this option will compensate for this effect.
  2531. Multi-channel input files are not affected by this option.
  2532. Options are true or false. Default is false.
  2533. @item print_format
  2534. Set print format for stats. Options are summary, json, or none.
  2535. Default value is none.
  2536. @end table
  2537. @section lowpass
  2538. Apply a low-pass filter with 3dB point frequency.
  2539. The filter can be either single-pole or double-pole (the default).
  2540. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2541. The filter accepts the following options:
  2542. @table @option
  2543. @item frequency, f
  2544. Set frequency in Hz. Default is 500.
  2545. @item poles, p
  2546. Set number of poles. Default is 2.
  2547. @item width_type, t
  2548. Set method to specify band-width of filter.
  2549. @table @option
  2550. @item h
  2551. Hz
  2552. @item q
  2553. Q-Factor
  2554. @item o
  2555. octave
  2556. @item s
  2557. slope
  2558. @end table
  2559. @item width, w
  2560. Specify the band-width of a filter in width_type units.
  2561. Applies only to double-pole filter.
  2562. The default is 0.707q and gives a Butterworth response.
  2563. @item channels, c
  2564. Specify which channels to filter, by default all available are filtered.
  2565. @end table
  2566. @subsection Examples
  2567. @itemize
  2568. @item
  2569. Lowpass only LFE channel, it LFE is not present it does nothing:
  2570. @example
  2571. lowpass=c=LFE
  2572. @end example
  2573. @end itemize
  2574. @section lv2
  2575. Load a LV2 (LADSPA Version 2) plugin.
  2576. To enable compilation of this filter you need to configure FFmpeg with
  2577. @code{--enable-lv2}.
  2578. @table @option
  2579. @item plugin, p
  2580. Specifies the plugin URI. You may need to escape ':'.
  2581. @item controls, c
  2582. Set the '|' separated list of controls which are zero or more floating point
  2583. values that determine the behavior of the loaded plugin (for example delay,
  2584. threshold or gain).
  2585. If @option{controls} is set to @code{help}, all available controls and
  2586. their valid ranges are printed.
  2587. @item sample_rate, s
  2588. Specify the sample rate, default to 44100. Only used if plugin have
  2589. zero inputs.
  2590. @item nb_samples, n
  2591. Set the number of samples per channel per each output frame, default
  2592. is 1024. Only used if plugin have zero inputs.
  2593. @item duration, d
  2594. Set the minimum duration of the sourced audio. See
  2595. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2596. for the accepted syntax.
  2597. Note that the resulting duration may be greater than the specified duration,
  2598. as the generated audio is always cut at the end of a complete frame.
  2599. If not specified, or the expressed duration is negative, the audio is
  2600. supposed to be generated forever.
  2601. Only used if plugin have zero inputs.
  2602. @end table
  2603. @subsection Examples
  2604. @itemize
  2605. @item
  2606. Apply bass enhancer plugin from Calf:
  2607. @example
  2608. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2609. @end example
  2610. @item
  2611. Apply bass vinyl plugin from Calf:
  2612. @example
  2613. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2614. @end example
  2615. @item
  2616. Apply bit crusher plugin from ArtyFX:
  2617. @example
  2618. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2619. @end example
  2620. @end itemize
  2621. @section mcompand
  2622. Multiband Compress or expand the audio's dynamic range.
  2623. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2624. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2625. response when absent compander action.
  2626. It accepts the following parameters:
  2627. @table @option
  2628. @item args
  2629. This option syntax is:
  2630. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2631. For explanation of each item refer to compand filter documentation.
  2632. @end table
  2633. @anchor{pan}
  2634. @section pan
  2635. Mix channels with specific gain levels. The filter accepts the output
  2636. channel layout followed by a set of channels definitions.
  2637. This filter is also designed to efficiently remap the channels of an audio
  2638. stream.
  2639. The filter accepts parameters of the form:
  2640. "@var{l}|@var{outdef}|@var{outdef}|..."
  2641. @table @option
  2642. @item l
  2643. output channel layout or number of channels
  2644. @item outdef
  2645. output channel specification, of the form:
  2646. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2647. @item out_name
  2648. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2649. number (c0, c1, etc.)
  2650. @item gain
  2651. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2652. @item in_name
  2653. input channel to use, see out_name for details; it is not possible to mix
  2654. named and numbered input channels
  2655. @end table
  2656. If the `=' in a channel specification is replaced by `<', then the gains for
  2657. that specification will be renormalized so that the total is 1, thus
  2658. avoiding clipping noise.
  2659. @subsection Mixing examples
  2660. For example, if you want to down-mix from stereo to mono, but with a bigger
  2661. factor for the left channel:
  2662. @example
  2663. pan=1c|c0=0.9*c0+0.1*c1
  2664. @end example
  2665. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2666. 7-channels surround:
  2667. @example
  2668. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2669. @end example
  2670. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2671. that should be preferred (see "-ac" option) unless you have very specific
  2672. needs.
  2673. @subsection Remapping examples
  2674. The channel remapping will be effective if, and only if:
  2675. @itemize
  2676. @item gain coefficients are zeroes or ones,
  2677. @item only one input per channel output,
  2678. @end itemize
  2679. If all these conditions are satisfied, the filter will notify the user ("Pure
  2680. channel mapping detected"), and use an optimized and lossless method to do the
  2681. remapping.
  2682. For example, if you have a 5.1 source and want a stereo audio stream by
  2683. dropping the extra channels:
  2684. @example
  2685. pan="stereo| c0=FL | c1=FR"
  2686. @end example
  2687. Given the same source, you can also switch front left and front right channels
  2688. and keep the input channel layout:
  2689. @example
  2690. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2691. @end example
  2692. If the input is a stereo audio stream, you can mute the front left channel (and
  2693. still keep the stereo channel layout) with:
  2694. @example
  2695. pan="stereo|c1=c1"
  2696. @end example
  2697. Still with a stereo audio stream input, you can copy the right channel in both
  2698. front left and right:
  2699. @example
  2700. pan="stereo| c0=FR | c1=FR"
  2701. @end example
  2702. @section replaygain
  2703. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2704. outputs it unchanged.
  2705. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2706. @section resample
  2707. Convert the audio sample format, sample rate and channel layout. It is
  2708. not meant to be used directly.
  2709. @section rubberband
  2710. Apply time-stretching and pitch-shifting with librubberband.
  2711. The filter accepts the following options:
  2712. @table @option
  2713. @item tempo
  2714. Set tempo scale factor.
  2715. @item pitch
  2716. Set pitch scale factor.
  2717. @item transients
  2718. Set transients detector.
  2719. Possible values are:
  2720. @table @var
  2721. @item crisp
  2722. @item mixed
  2723. @item smooth
  2724. @end table
  2725. @item detector
  2726. Set detector.
  2727. Possible values are:
  2728. @table @var
  2729. @item compound
  2730. @item percussive
  2731. @item soft
  2732. @end table
  2733. @item phase
  2734. Set phase.
  2735. Possible values are:
  2736. @table @var
  2737. @item laminar
  2738. @item independent
  2739. @end table
  2740. @item window
  2741. Set processing window size.
  2742. Possible values are:
  2743. @table @var
  2744. @item standard
  2745. @item short
  2746. @item long
  2747. @end table
  2748. @item smoothing
  2749. Set smoothing.
  2750. Possible values are:
  2751. @table @var
  2752. @item off
  2753. @item on
  2754. @end table
  2755. @item formant
  2756. Enable formant preservation when shift pitching.
  2757. Possible values are:
  2758. @table @var
  2759. @item shifted
  2760. @item preserved
  2761. @end table
  2762. @item pitchq
  2763. Set pitch quality.
  2764. Possible values are:
  2765. @table @var
  2766. @item quality
  2767. @item speed
  2768. @item consistency
  2769. @end table
  2770. @item channels
  2771. Set channels.
  2772. Possible values are:
  2773. @table @var
  2774. @item apart
  2775. @item together
  2776. @end table
  2777. @end table
  2778. @section sidechaincompress
  2779. This filter acts like normal compressor but has the ability to compress
  2780. detected signal using second input signal.
  2781. It needs two input streams and returns one output stream.
  2782. First input stream will be processed depending on second stream signal.
  2783. The filtered signal then can be filtered with other filters in later stages of
  2784. processing. See @ref{pan} and @ref{amerge} filter.
  2785. The filter accepts the following options:
  2786. @table @option
  2787. @item level_in
  2788. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2789. @item threshold
  2790. If a signal of second stream raises above this level it will affect the gain
  2791. reduction of first stream.
  2792. By default is 0.125. Range is between 0.00097563 and 1.
  2793. @item ratio
  2794. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2795. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2796. Default is 2. Range is between 1 and 20.
  2797. @item attack
  2798. Amount of milliseconds the signal has to rise above the threshold before gain
  2799. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2800. @item release
  2801. Amount of milliseconds the signal has to fall below the threshold before
  2802. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2803. @item makeup
  2804. Set the amount by how much signal will be amplified after processing.
  2805. Default is 1. Range is from 1 to 64.
  2806. @item knee
  2807. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2808. Default is 2.82843. Range is between 1 and 8.
  2809. @item link
  2810. Choose if the @code{average} level between all channels of side-chain stream
  2811. or the louder(@code{maximum}) channel of side-chain stream affects the
  2812. reduction. Default is @code{average}.
  2813. @item detection
  2814. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2815. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2816. @item level_sc
  2817. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2818. @item mix
  2819. How much to use compressed signal in output. Default is 1.
  2820. Range is between 0 and 1.
  2821. @end table
  2822. @subsection Examples
  2823. @itemize
  2824. @item
  2825. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2826. depending on the signal of 2nd input and later compressed signal to be
  2827. merged with 2nd input:
  2828. @example
  2829. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2830. @end example
  2831. @end itemize
  2832. @section sidechaingate
  2833. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2834. filter the detected signal before sending it to the gain reduction stage.
  2835. Normally a gate uses the full range signal to detect a level above the
  2836. threshold.
  2837. For example: If you cut all lower frequencies from your sidechain signal
  2838. the gate will decrease the volume of your track only if not enough highs
  2839. appear. With this technique you are able to reduce the resonation of a
  2840. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2841. guitar.
  2842. It needs two input streams and returns one output stream.
  2843. First input stream will be processed depending on second stream signal.
  2844. The filter accepts the following options:
  2845. @table @option
  2846. @item level_in
  2847. Set input level before filtering.
  2848. Default is 1. Allowed range is from 0.015625 to 64.
  2849. @item range
  2850. Set the level of gain reduction when the signal is below the threshold.
  2851. Default is 0.06125. Allowed range is from 0 to 1.
  2852. @item threshold
  2853. If a signal rises above this level the gain reduction is released.
  2854. Default is 0.125. Allowed range is from 0 to 1.
  2855. @item ratio
  2856. Set a ratio about which the signal is reduced.
  2857. Default is 2. Allowed range is from 1 to 9000.
  2858. @item attack
  2859. Amount of milliseconds the signal has to rise above the threshold before gain
  2860. reduction stops.
  2861. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2862. @item release
  2863. Amount of milliseconds the signal has to fall below the threshold before the
  2864. reduction is increased again. Default is 250 milliseconds.
  2865. Allowed range is from 0.01 to 9000.
  2866. @item makeup
  2867. Set amount of amplification of signal after processing.
  2868. Default is 1. Allowed range is from 1 to 64.
  2869. @item knee
  2870. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2871. Default is 2.828427125. Allowed range is from 1 to 8.
  2872. @item detection
  2873. Choose if exact signal should be taken for detection or an RMS like one.
  2874. Default is rms. Can be peak or rms.
  2875. @item link
  2876. Choose if the average level between all channels or the louder channel affects
  2877. the reduction.
  2878. Default is average. Can be average or maximum.
  2879. @item level_sc
  2880. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2881. @end table
  2882. @section silencedetect
  2883. Detect silence in an audio stream.
  2884. This filter logs a message when it detects that the input audio volume is less
  2885. or equal to a noise tolerance value for a duration greater or equal to the
  2886. minimum detected noise duration.
  2887. The printed times and duration are expressed in seconds.
  2888. The filter accepts the following options:
  2889. @table @option
  2890. @item duration, d
  2891. Set silence duration until notification (default is 2 seconds).
  2892. @item noise, n
  2893. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2894. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2895. @end table
  2896. @subsection Examples
  2897. @itemize
  2898. @item
  2899. Detect 5 seconds of silence with -50dB noise tolerance:
  2900. @example
  2901. silencedetect=n=-50dB:d=5
  2902. @end example
  2903. @item
  2904. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2905. tolerance in @file{silence.mp3}:
  2906. @example
  2907. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2908. @end example
  2909. @end itemize
  2910. @section silenceremove
  2911. Remove silence from the beginning, middle or end of the audio.
  2912. The filter accepts the following options:
  2913. @table @option
  2914. @item start_periods
  2915. This value is used to indicate if audio should be trimmed at beginning of
  2916. the audio. A value of zero indicates no silence should be trimmed from the
  2917. beginning. When specifying a non-zero value, it trims audio up until it
  2918. finds non-silence. Normally, when trimming silence from beginning of audio
  2919. the @var{start_periods} will be @code{1} but it can be increased to higher
  2920. values to trim all audio up to specific count of non-silence periods.
  2921. Default value is @code{0}.
  2922. @item start_duration
  2923. Specify the amount of time that non-silence must be detected before it stops
  2924. trimming audio. By increasing the duration, bursts of noises can be treated
  2925. as silence and trimmed off. Default value is @code{0}.
  2926. @item start_threshold
  2927. This indicates what sample value should be treated as silence. For digital
  2928. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2929. you may wish to increase the value to account for background noise.
  2930. Can be specified in dB (in case "dB" is appended to the specified value)
  2931. or amplitude ratio. Default value is @code{0}.
  2932. @item stop_periods
  2933. Set the count for trimming silence from the end of audio.
  2934. To remove silence from the middle of a file, specify a @var{stop_periods}
  2935. that is negative. This value is then treated as a positive value and is
  2936. used to indicate the effect should restart processing as specified by
  2937. @var{start_periods}, making it suitable for removing periods of silence
  2938. in the middle of the audio.
  2939. Default value is @code{0}.
  2940. @item stop_duration
  2941. Specify a duration of silence that must exist before audio is not copied any
  2942. more. By specifying a higher duration, silence that is wanted can be left in
  2943. the audio.
  2944. Default value is @code{0}.
  2945. @item stop_threshold
  2946. This is the same as @option{start_threshold} but for trimming silence from
  2947. the end of audio.
  2948. Can be specified in dB (in case "dB" is appended to the specified value)
  2949. or amplitude ratio. Default value is @code{0}.
  2950. @item leave_silence
  2951. This indicates that @var{stop_duration} length of audio should be left intact
  2952. at the beginning of each period of silence.
  2953. For example, if you want to remove long pauses between words but do not want
  2954. to remove the pauses completely. Default value is @code{0}.
  2955. @item detection
  2956. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2957. and works better with digital silence which is exactly 0.
  2958. Default value is @code{rms}.
  2959. @item window
  2960. Set ratio used to calculate size of window for detecting silence.
  2961. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2962. @end table
  2963. @subsection Examples
  2964. @itemize
  2965. @item
  2966. The following example shows how this filter can be used to start a recording
  2967. that does not contain the delay at the start which usually occurs between
  2968. pressing the record button and the start of the performance:
  2969. @example
  2970. silenceremove=1:5:0.02
  2971. @end example
  2972. @item
  2973. Trim all silence encountered from beginning to end where there is more than 1
  2974. second of silence in audio:
  2975. @example
  2976. silenceremove=0:0:0:-1:1:-90dB
  2977. @end example
  2978. @end itemize
  2979. @section sofalizer
  2980. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2981. loudspeakers around the user for binaural listening via headphones (audio
  2982. formats up to 9 channels supported).
  2983. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2984. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2985. Austrian Academy of Sciences.
  2986. To enable compilation of this filter you need to configure FFmpeg with
  2987. @code{--enable-libmysofa}.
  2988. The filter accepts the following options:
  2989. @table @option
  2990. @item sofa
  2991. Set the SOFA file used for rendering.
  2992. @item gain
  2993. Set gain applied to audio. Value is in dB. Default is 0.
  2994. @item rotation
  2995. Set rotation of virtual loudspeakers in deg. Default is 0.
  2996. @item elevation
  2997. Set elevation of virtual speakers in deg. Default is 0.
  2998. @item radius
  2999. Set distance in meters between loudspeakers and the listener with near-field
  3000. HRTFs. Default is 1.
  3001. @item type
  3002. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3003. processing audio in time domain which is slow.
  3004. @var{freq} is processing audio in frequency domain which is fast.
  3005. Default is @var{freq}.
  3006. @item speakers
  3007. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3008. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3009. Each virtual loudspeaker is described with short channel name following with
  3010. azimuth and elevation in degrees.
  3011. Each virtual loudspeaker description is separated by '|'.
  3012. For example to override front left and front right channel positions use:
  3013. 'speakers=FL 45 15|FR 345 15'.
  3014. Descriptions with unrecognised channel names are ignored.
  3015. @item lfegain
  3016. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3017. @end table
  3018. @subsection Examples
  3019. @itemize
  3020. @item
  3021. Using ClubFritz6 sofa file:
  3022. @example
  3023. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3024. @end example
  3025. @item
  3026. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3027. @example
  3028. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3029. @end example
  3030. @item
  3031. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3032. and also with custom gain:
  3033. @example
  3034. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3035. @end example
  3036. @end itemize
  3037. @section stereotools
  3038. This filter has some handy utilities to manage stereo signals, for converting
  3039. M/S stereo recordings to L/R signal while having control over the parameters
  3040. or spreading the stereo image of master track.
  3041. The filter accepts the following options:
  3042. @table @option
  3043. @item level_in
  3044. Set input level before filtering for both channels. Defaults is 1.
  3045. Allowed range is from 0.015625 to 64.
  3046. @item level_out
  3047. Set output level after filtering for both channels. Defaults is 1.
  3048. Allowed range is from 0.015625 to 64.
  3049. @item balance_in
  3050. Set input balance between both channels. Default is 0.
  3051. Allowed range is from -1 to 1.
  3052. @item balance_out
  3053. Set output balance between both channels. Default is 0.
  3054. Allowed range is from -1 to 1.
  3055. @item softclip
  3056. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3057. clipping. Disabled by default.
  3058. @item mutel
  3059. Mute the left channel. Disabled by default.
  3060. @item muter
  3061. Mute the right channel. Disabled by default.
  3062. @item phasel
  3063. Change the phase of the left channel. Disabled by default.
  3064. @item phaser
  3065. Change the phase of the right channel. Disabled by default.
  3066. @item mode
  3067. Set stereo mode. Available values are:
  3068. @table @samp
  3069. @item lr>lr
  3070. Left/Right to Left/Right, this is default.
  3071. @item lr>ms
  3072. Left/Right to Mid/Side.
  3073. @item ms>lr
  3074. Mid/Side to Left/Right.
  3075. @item lr>ll
  3076. Left/Right to Left/Left.
  3077. @item lr>rr
  3078. Left/Right to Right/Right.
  3079. @item lr>l+r
  3080. Left/Right to Left + Right.
  3081. @item lr>rl
  3082. Left/Right to Right/Left.
  3083. @item ms>ll
  3084. Mid/Side to Left/Left.
  3085. @item ms>rr
  3086. Mid/Side to Right/Right.
  3087. @end table
  3088. @item slev
  3089. Set level of side signal. Default is 1.
  3090. Allowed range is from 0.015625 to 64.
  3091. @item sbal
  3092. Set balance of side signal. Default is 0.
  3093. Allowed range is from -1 to 1.
  3094. @item mlev
  3095. Set level of the middle signal. Default is 1.
  3096. Allowed range is from 0.015625 to 64.
  3097. @item mpan
  3098. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3099. @item base
  3100. Set stereo base between mono and inversed channels. Default is 0.
  3101. Allowed range is from -1 to 1.
  3102. @item delay
  3103. Set delay in milliseconds how much to delay left from right channel and
  3104. vice versa. Default is 0. Allowed range is from -20 to 20.
  3105. @item sclevel
  3106. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3107. @item phase
  3108. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3109. @item bmode_in, bmode_out
  3110. Set balance mode for balance_in/balance_out option.
  3111. Can be one of the following:
  3112. @table @samp
  3113. @item balance
  3114. Classic balance mode. Attenuate one channel at time.
  3115. Gain is raised up to 1.
  3116. @item amplitude
  3117. Similar as classic mode above but gain is raised up to 2.
  3118. @item power
  3119. Equal power distribution, from -6dB to +6dB range.
  3120. @end table
  3121. @end table
  3122. @subsection Examples
  3123. @itemize
  3124. @item
  3125. Apply karaoke like effect:
  3126. @example
  3127. stereotools=mlev=0.015625
  3128. @end example
  3129. @item
  3130. Convert M/S signal to L/R:
  3131. @example
  3132. "stereotools=mode=ms>lr"
  3133. @end example
  3134. @end itemize
  3135. @section stereowiden
  3136. This filter enhance the stereo effect by suppressing signal common to both
  3137. channels and by delaying the signal of left into right and vice versa,
  3138. thereby widening the stereo effect.
  3139. The filter accepts the following options:
  3140. @table @option
  3141. @item delay
  3142. Time in milliseconds of the delay of left signal into right and vice versa.
  3143. Default is 20 milliseconds.
  3144. @item feedback
  3145. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3146. effect of left signal in right output and vice versa which gives widening
  3147. effect. Default is 0.3.
  3148. @item crossfeed
  3149. Cross feed of left into right with inverted phase. This helps in suppressing
  3150. the mono. If the value is 1 it will cancel all the signal common to both
  3151. channels. Default is 0.3.
  3152. @item drymix
  3153. Set level of input signal of original channel. Default is 0.8.
  3154. @end table
  3155. @section superequalizer
  3156. Apply 18 band equalizer.
  3157. The filter accepts the following options:
  3158. @table @option
  3159. @item 1b
  3160. Set 65Hz band gain.
  3161. @item 2b
  3162. Set 92Hz band gain.
  3163. @item 3b
  3164. Set 131Hz band gain.
  3165. @item 4b
  3166. Set 185Hz band gain.
  3167. @item 5b
  3168. Set 262Hz band gain.
  3169. @item 6b
  3170. Set 370Hz band gain.
  3171. @item 7b
  3172. Set 523Hz band gain.
  3173. @item 8b
  3174. Set 740Hz band gain.
  3175. @item 9b
  3176. Set 1047Hz band gain.
  3177. @item 10b
  3178. Set 1480Hz band gain.
  3179. @item 11b
  3180. Set 2093Hz band gain.
  3181. @item 12b
  3182. Set 2960Hz band gain.
  3183. @item 13b
  3184. Set 4186Hz band gain.
  3185. @item 14b
  3186. Set 5920Hz band gain.
  3187. @item 15b
  3188. Set 8372Hz band gain.
  3189. @item 16b
  3190. Set 11840Hz band gain.
  3191. @item 17b
  3192. Set 16744Hz band gain.
  3193. @item 18b
  3194. Set 20000Hz band gain.
  3195. @end table
  3196. @section surround
  3197. Apply audio surround upmix filter.
  3198. This filter allows to produce multichannel output from audio stream.
  3199. The filter accepts the following options:
  3200. @table @option
  3201. @item chl_out
  3202. Set output channel layout. By default, this is @var{5.1}.
  3203. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3204. for the required syntax.
  3205. @item chl_in
  3206. Set input channel layout. By default, this is @var{stereo}.
  3207. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3208. for the required syntax.
  3209. @item level_in
  3210. Set input volume level. By default, this is @var{1}.
  3211. @item level_out
  3212. Set output volume level. By default, this is @var{1}.
  3213. @item lfe
  3214. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3215. @item lfe_low
  3216. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3217. @item lfe_high
  3218. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3219. @item fc_in
  3220. Set front center input volume. By default, this is @var{1}.
  3221. @item fc_out
  3222. Set front center output volume. By default, this is @var{1}.
  3223. @item lfe_in
  3224. Set LFE input volume. By default, this is @var{1}.
  3225. @item lfe_out
  3226. Set LFE output volume. By default, this is @var{1}.
  3227. @end table
  3228. @section treble
  3229. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3230. shelving filter with a response similar to that of a standard
  3231. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3232. The filter accepts the following options:
  3233. @table @option
  3234. @item gain, g
  3235. Give the gain at whichever is the lower of ~22 kHz and the
  3236. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3237. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3238. @item frequency, f
  3239. Set the filter's central frequency and so can be used
  3240. to extend or reduce the frequency range to be boosted or cut.
  3241. The default value is @code{3000} Hz.
  3242. @item width_type, t
  3243. Set method to specify band-width of filter.
  3244. @table @option
  3245. @item h
  3246. Hz
  3247. @item q
  3248. Q-Factor
  3249. @item o
  3250. octave
  3251. @item s
  3252. slope
  3253. @end table
  3254. @item width, w
  3255. Determine how steep is the filter's shelf transition.
  3256. @item channels, c
  3257. Specify which channels to filter, by default all available are filtered.
  3258. @end table
  3259. @section tremolo
  3260. Sinusoidal amplitude modulation.
  3261. The filter accepts the following options:
  3262. @table @option
  3263. @item f
  3264. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3265. (20 Hz or lower) will result in a tremolo effect.
  3266. This filter may also be used as a ring modulator by specifying
  3267. a modulation frequency higher than 20 Hz.
  3268. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3269. @item d
  3270. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3271. Default value is 0.5.
  3272. @end table
  3273. @section vibrato
  3274. Sinusoidal phase modulation.
  3275. The filter accepts the following options:
  3276. @table @option
  3277. @item f
  3278. Modulation frequency in Hertz.
  3279. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3280. @item d
  3281. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3282. Default value is 0.5.
  3283. @end table
  3284. @section volume
  3285. Adjust the input audio volume.
  3286. It accepts the following parameters:
  3287. @table @option
  3288. @item volume
  3289. Set audio volume expression.
  3290. Output values are clipped to the maximum value.
  3291. The output audio volume is given by the relation:
  3292. @example
  3293. @var{output_volume} = @var{volume} * @var{input_volume}
  3294. @end example
  3295. The default value for @var{volume} is "1.0".
  3296. @item precision
  3297. This parameter represents the mathematical precision.
  3298. It determines which input sample formats will be allowed, which affects the
  3299. precision of the volume scaling.
  3300. @table @option
  3301. @item fixed
  3302. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3303. @item float
  3304. 32-bit floating-point; this limits input sample format to FLT. (default)
  3305. @item double
  3306. 64-bit floating-point; this limits input sample format to DBL.
  3307. @end table
  3308. @item replaygain
  3309. Choose the behaviour on encountering ReplayGain side data in input frames.
  3310. @table @option
  3311. @item drop
  3312. Remove ReplayGain side data, ignoring its contents (the default).
  3313. @item ignore
  3314. Ignore ReplayGain side data, but leave it in the frame.
  3315. @item track
  3316. Prefer the track gain, if present.
  3317. @item album
  3318. Prefer the album gain, if present.
  3319. @end table
  3320. @item replaygain_preamp
  3321. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3322. Default value for @var{replaygain_preamp} is 0.0.
  3323. @item eval
  3324. Set when the volume expression is evaluated.
  3325. It accepts the following values:
  3326. @table @samp
  3327. @item once
  3328. only evaluate expression once during the filter initialization, or
  3329. when the @samp{volume} command is sent
  3330. @item frame
  3331. evaluate expression for each incoming frame
  3332. @end table
  3333. Default value is @samp{once}.
  3334. @end table
  3335. The volume expression can contain the following parameters.
  3336. @table @option
  3337. @item n
  3338. frame number (starting at zero)
  3339. @item nb_channels
  3340. number of channels
  3341. @item nb_consumed_samples
  3342. number of samples consumed by the filter
  3343. @item nb_samples
  3344. number of samples in the current frame
  3345. @item pos
  3346. original frame position in the file
  3347. @item pts
  3348. frame PTS
  3349. @item sample_rate
  3350. sample rate
  3351. @item startpts
  3352. PTS at start of stream
  3353. @item startt
  3354. time at start of stream
  3355. @item t
  3356. frame time
  3357. @item tb
  3358. timestamp timebase
  3359. @item volume
  3360. last set volume value
  3361. @end table
  3362. Note that when @option{eval} is set to @samp{once} only the
  3363. @var{sample_rate} and @var{tb} variables are available, all other
  3364. variables will evaluate to NAN.
  3365. @subsection Commands
  3366. This filter supports the following commands:
  3367. @table @option
  3368. @item volume
  3369. Modify the volume expression.
  3370. The command accepts the same syntax of the corresponding option.
  3371. If the specified expression is not valid, it is kept at its current
  3372. value.
  3373. @item replaygain_noclip
  3374. Prevent clipping by limiting the gain applied.
  3375. Default value for @var{replaygain_noclip} is 1.
  3376. @end table
  3377. @subsection Examples
  3378. @itemize
  3379. @item
  3380. Halve the input audio volume:
  3381. @example
  3382. volume=volume=0.5
  3383. volume=volume=1/2
  3384. volume=volume=-6.0206dB
  3385. @end example
  3386. In all the above example the named key for @option{volume} can be
  3387. omitted, for example like in:
  3388. @example
  3389. volume=0.5
  3390. @end example
  3391. @item
  3392. Increase input audio power by 6 decibels using fixed-point precision:
  3393. @example
  3394. volume=volume=6dB:precision=fixed
  3395. @end example
  3396. @item
  3397. Fade volume after time 10 with an annihilation period of 5 seconds:
  3398. @example
  3399. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3400. @end example
  3401. @end itemize
  3402. @section volumedetect
  3403. Detect the volume of the input video.
  3404. The filter has no parameters. The input is not modified. Statistics about
  3405. the volume will be printed in the log when the input stream end is reached.
  3406. In particular it will show the mean volume (root mean square), maximum
  3407. volume (on a per-sample basis), and the beginning of a histogram of the
  3408. registered volume values (from the maximum value to a cumulated 1/1000 of
  3409. the samples).
  3410. All volumes are in decibels relative to the maximum PCM value.
  3411. @subsection Examples
  3412. Here is an excerpt of the output:
  3413. @example
  3414. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3415. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3416. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3417. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3418. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3419. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3420. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3421. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3422. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3423. @end example
  3424. It means that:
  3425. @itemize
  3426. @item
  3427. The mean square energy is approximately -27 dB, or 10^-2.7.
  3428. @item
  3429. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3430. @item
  3431. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3432. @end itemize
  3433. In other words, raising the volume by +4 dB does not cause any clipping,
  3434. raising it by +5 dB causes clipping for 6 samples, etc.
  3435. @c man end AUDIO FILTERS
  3436. @chapter Audio Sources
  3437. @c man begin AUDIO SOURCES
  3438. Below is a description of the currently available audio sources.
  3439. @section abuffer
  3440. Buffer audio frames, and make them available to the filter chain.
  3441. This source is mainly intended for a programmatic use, in particular
  3442. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3443. It accepts the following parameters:
  3444. @table @option
  3445. @item time_base
  3446. The timebase which will be used for timestamps of submitted frames. It must be
  3447. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3448. @item sample_rate
  3449. The sample rate of the incoming audio buffers.
  3450. @item sample_fmt
  3451. The sample format of the incoming audio buffers.
  3452. Either a sample format name or its corresponding integer representation from
  3453. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3454. @item channel_layout
  3455. The channel layout of the incoming audio buffers.
  3456. Either a channel layout name from channel_layout_map in
  3457. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3458. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3459. @item channels
  3460. The number of channels of the incoming audio buffers.
  3461. If both @var{channels} and @var{channel_layout} are specified, then they
  3462. must be consistent.
  3463. @end table
  3464. @subsection Examples
  3465. @example
  3466. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3467. @end example
  3468. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3469. Since the sample format with name "s16p" corresponds to the number
  3470. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3471. equivalent to:
  3472. @example
  3473. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3474. @end example
  3475. @section aevalsrc
  3476. Generate an audio signal specified by an expression.
  3477. This source accepts in input one or more expressions (one for each
  3478. channel), which are evaluated and used to generate a corresponding
  3479. audio signal.
  3480. This source accepts the following options:
  3481. @table @option
  3482. @item exprs
  3483. Set the '|'-separated expressions list for each separate channel. In case the
  3484. @option{channel_layout} option is not specified, the selected channel layout
  3485. depends on the number of provided expressions. Otherwise the last
  3486. specified expression is applied to the remaining output channels.
  3487. @item channel_layout, c
  3488. Set the channel layout. The number of channels in the specified layout
  3489. must be equal to the number of specified expressions.
  3490. @item duration, d
  3491. Set the minimum duration of the sourced audio. See
  3492. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3493. for the accepted syntax.
  3494. Note that the resulting duration may be greater than the specified
  3495. duration, as the generated audio is always cut at the end of a
  3496. complete frame.
  3497. If not specified, or the expressed duration is negative, the audio is
  3498. supposed to be generated forever.
  3499. @item nb_samples, n
  3500. Set the number of samples per channel per each output frame,
  3501. default to 1024.
  3502. @item sample_rate, s
  3503. Specify the sample rate, default to 44100.
  3504. @end table
  3505. Each expression in @var{exprs} can contain the following constants:
  3506. @table @option
  3507. @item n
  3508. number of the evaluated sample, starting from 0
  3509. @item t
  3510. time of the evaluated sample expressed in seconds, starting from 0
  3511. @item s
  3512. sample rate
  3513. @end table
  3514. @subsection Examples
  3515. @itemize
  3516. @item
  3517. Generate silence:
  3518. @example
  3519. aevalsrc=0
  3520. @end example
  3521. @item
  3522. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3523. 8000 Hz:
  3524. @example
  3525. aevalsrc="sin(440*2*PI*t):s=8000"
  3526. @end example
  3527. @item
  3528. Generate a two channels signal, specify the channel layout (Front
  3529. Center + Back Center) explicitly:
  3530. @example
  3531. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3532. @end example
  3533. @item
  3534. Generate white noise:
  3535. @example
  3536. aevalsrc="-2+random(0)"
  3537. @end example
  3538. @item
  3539. Generate an amplitude modulated signal:
  3540. @example
  3541. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3542. @end example
  3543. @item
  3544. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3545. @example
  3546. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3547. @end example
  3548. @end itemize
  3549. @section anullsrc
  3550. The null audio source, return unprocessed audio frames. It is mainly useful
  3551. as a template and to be employed in analysis / debugging tools, or as
  3552. the source for filters which ignore the input data (for example the sox
  3553. synth filter).
  3554. This source accepts the following options:
  3555. @table @option
  3556. @item channel_layout, cl
  3557. Specifies the channel layout, and can be either an integer or a string
  3558. representing a channel layout. The default value of @var{channel_layout}
  3559. is "stereo".
  3560. Check the channel_layout_map definition in
  3561. @file{libavutil/channel_layout.c} for the mapping between strings and
  3562. channel layout values.
  3563. @item sample_rate, r
  3564. Specifies the sample rate, and defaults to 44100.
  3565. @item nb_samples, n
  3566. Set the number of samples per requested frames.
  3567. @end table
  3568. @subsection Examples
  3569. @itemize
  3570. @item
  3571. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3572. @example
  3573. anullsrc=r=48000:cl=4
  3574. @end example
  3575. @item
  3576. Do the same operation with a more obvious syntax:
  3577. @example
  3578. anullsrc=r=48000:cl=mono
  3579. @end example
  3580. @end itemize
  3581. All the parameters need to be explicitly defined.
  3582. @section flite
  3583. Synthesize a voice utterance using the libflite library.
  3584. To enable compilation of this filter you need to configure FFmpeg with
  3585. @code{--enable-libflite}.
  3586. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3587. The filter accepts the following options:
  3588. @table @option
  3589. @item list_voices
  3590. If set to 1, list the names of the available voices and exit
  3591. immediately. Default value is 0.
  3592. @item nb_samples, n
  3593. Set the maximum number of samples per frame. Default value is 512.
  3594. @item textfile
  3595. Set the filename containing the text to speak.
  3596. @item text
  3597. Set the text to speak.
  3598. @item voice, v
  3599. Set the voice to use for the speech synthesis. Default value is
  3600. @code{kal}. See also the @var{list_voices} option.
  3601. @end table
  3602. @subsection Examples
  3603. @itemize
  3604. @item
  3605. Read from file @file{speech.txt}, and synthesize the text using the
  3606. standard flite voice:
  3607. @example
  3608. flite=textfile=speech.txt
  3609. @end example
  3610. @item
  3611. Read the specified text selecting the @code{slt} voice:
  3612. @example
  3613. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3614. @end example
  3615. @item
  3616. Input text to ffmpeg:
  3617. @example
  3618. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3619. @end example
  3620. @item
  3621. Make @file{ffplay} speak the specified text, using @code{flite} and
  3622. the @code{lavfi} device:
  3623. @example
  3624. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3625. @end example
  3626. @end itemize
  3627. For more information about libflite, check:
  3628. @url{http://www.festvox.org/flite/}
  3629. @section anoisesrc
  3630. Generate a noise audio signal.
  3631. The filter accepts the following options:
  3632. @table @option
  3633. @item sample_rate, r
  3634. Specify the sample rate. Default value is 48000 Hz.
  3635. @item amplitude, a
  3636. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3637. is 1.0.
  3638. @item duration, d
  3639. Specify the duration of the generated audio stream. Not specifying this option
  3640. results in noise with an infinite length.
  3641. @item color, colour, c
  3642. Specify the color of noise. Available noise colors are white, pink, brown,
  3643. blue and violet. Default color is white.
  3644. @item seed, s
  3645. Specify a value used to seed the PRNG.
  3646. @item nb_samples, n
  3647. Set the number of samples per each output frame, default is 1024.
  3648. @end table
  3649. @subsection Examples
  3650. @itemize
  3651. @item
  3652. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3653. @example
  3654. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3655. @end example
  3656. @end itemize
  3657. @section sine
  3658. Generate an audio signal made of a sine wave with amplitude 1/8.
  3659. The audio signal is bit-exact.
  3660. The filter accepts the following options:
  3661. @table @option
  3662. @item frequency, f
  3663. Set the carrier frequency. Default is 440 Hz.
  3664. @item beep_factor, b
  3665. Enable a periodic beep every second with frequency @var{beep_factor} times
  3666. the carrier frequency. Default is 0, meaning the beep is disabled.
  3667. @item sample_rate, r
  3668. Specify the sample rate, default is 44100.
  3669. @item duration, d
  3670. Specify the duration of the generated audio stream.
  3671. @item samples_per_frame
  3672. Set the number of samples per output frame.
  3673. The expression can contain the following constants:
  3674. @table @option
  3675. @item n
  3676. The (sequential) number of the output audio frame, starting from 0.
  3677. @item pts
  3678. The PTS (Presentation TimeStamp) of the output audio frame,
  3679. expressed in @var{TB} units.
  3680. @item t
  3681. The PTS of the output audio frame, expressed in seconds.
  3682. @item TB
  3683. The timebase of the output audio frames.
  3684. @end table
  3685. Default is @code{1024}.
  3686. @end table
  3687. @subsection Examples
  3688. @itemize
  3689. @item
  3690. Generate a simple 440 Hz sine wave:
  3691. @example
  3692. sine
  3693. @end example
  3694. @item
  3695. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3696. @example
  3697. sine=220:4:d=5
  3698. sine=f=220:b=4:d=5
  3699. sine=frequency=220:beep_factor=4:duration=5
  3700. @end example
  3701. @item
  3702. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3703. pattern:
  3704. @example
  3705. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3706. @end example
  3707. @end itemize
  3708. @c man end AUDIO SOURCES
  3709. @chapter Audio Sinks
  3710. @c man begin AUDIO SINKS
  3711. Below is a description of the currently available audio sinks.
  3712. @section abuffersink
  3713. Buffer audio frames, and make them available to the end of filter chain.
  3714. This sink is mainly intended for programmatic use, in particular
  3715. through the interface defined in @file{libavfilter/buffersink.h}
  3716. or the options system.
  3717. It accepts a pointer to an AVABufferSinkContext structure, which
  3718. defines the incoming buffers' formats, to be passed as the opaque
  3719. parameter to @code{avfilter_init_filter} for initialization.
  3720. @section anullsink
  3721. Null audio sink; do absolutely nothing with the input audio. It is
  3722. mainly useful as a template and for use in analysis / debugging
  3723. tools.
  3724. @c man end AUDIO SINKS
  3725. @chapter Video Filters
  3726. @c man begin VIDEO FILTERS
  3727. When you configure your FFmpeg build, you can disable any of the
  3728. existing filters using @code{--disable-filters}.
  3729. The configure output will show the video filters included in your
  3730. build.
  3731. Below is a description of the currently available video filters.
  3732. @section alphaextract
  3733. Extract the alpha component from the input as a grayscale video. This
  3734. is especially useful with the @var{alphamerge} filter.
  3735. @section alphamerge
  3736. Add or replace the alpha component of the primary input with the
  3737. grayscale value of a second input. This is intended for use with
  3738. @var{alphaextract} to allow the transmission or storage of frame
  3739. sequences that have alpha in a format that doesn't support an alpha
  3740. channel.
  3741. For example, to reconstruct full frames from a normal YUV-encoded video
  3742. and a separate video created with @var{alphaextract}, you might use:
  3743. @example
  3744. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3745. @end example
  3746. Since this filter is designed for reconstruction, it operates on frame
  3747. sequences without considering timestamps, and terminates when either
  3748. input reaches end of stream. This will cause problems if your encoding
  3749. pipeline drops frames. If you're trying to apply an image as an
  3750. overlay to a video stream, consider the @var{overlay} filter instead.
  3751. @section ass
  3752. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3753. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3754. Substation Alpha) subtitles files.
  3755. This filter accepts the following option in addition to the common options from
  3756. the @ref{subtitles} filter:
  3757. @table @option
  3758. @item shaping
  3759. Set the shaping engine
  3760. Available values are:
  3761. @table @samp
  3762. @item auto
  3763. The default libass shaping engine, which is the best available.
  3764. @item simple
  3765. Fast, font-agnostic shaper that can do only substitutions
  3766. @item complex
  3767. Slower shaper using OpenType for substitutions and positioning
  3768. @end table
  3769. The default is @code{auto}.
  3770. @end table
  3771. @section atadenoise
  3772. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3773. The filter accepts the following options:
  3774. @table @option
  3775. @item 0a
  3776. Set threshold A for 1st plane. Default is 0.02.
  3777. Valid range is 0 to 0.3.
  3778. @item 0b
  3779. Set threshold B for 1st plane. Default is 0.04.
  3780. Valid range is 0 to 5.
  3781. @item 1a
  3782. Set threshold A for 2nd plane. Default is 0.02.
  3783. Valid range is 0 to 0.3.
  3784. @item 1b
  3785. Set threshold B for 2nd plane. Default is 0.04.
  3786. Valid range is 0 to 5.
  3787. @item 2a
  3788. Set threshold A for 3rd plane. Default is 0.02.
  3789. Valid range is 0 to 0.3.
  3790. @item 2b
  3791. Set threshold B for 3rd plane. Default is 0.04.
  3792. Valid range is 0 to 5.
  3793. Threshold A is designed to react on abrupt changes in the input signal and
  3794. threshold B is designed to react on continuous changes in the input signal.
  3795. @item s
  3796. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3797. number in range [5, 129].
  3798. @item p
  3799. Set what planes of frame filter will use for averaging. Default is all.
  3800. @end table
  3801. @section avgblur
  3802. Apply average blur filter.
  3803. The filter accepts the following options:
  3804. @table @option
  3805. @item sizeX
  3806. Set horizontal kernel size.
  3807. @item planes
  3808. Set which planes to filter. By default all planes are filtered.
  3809. @item sizeY
  3810. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3811. Default is @code{0}.
  3812. @end table
  3813. @section bbox
  3814. Compute the bounding box for the non-black pixels in the input frame
  3815. luminance plane.
  3816. This filter computes the bounding box containing all the pixels with a
  3817. luminance value greater than the minimum allowed value.
  3818. The parameters describing the bounding box are printed on the filter
  3819. log.
  3820. The filter accepts the following option:
  3821. @table @option
  3822. @item min_val
  3823. Set the minimal luminance value. Default is @code{16}.
  3824. @end table
  3825. @section bitplanenoise
  3826. Show and measure bit plane noise.
  3827. The filter accepts the following options:
  3828. @table @option
  3829. @item bitplane
  3830. Set which plane to analyze. Default is @code{1}.
  3831. @item filter
  3832. Filter out noisy pixels from @code{bitplane} set above.
  3833. Default is disabled.
  3834. @end table
  3835. @section blackdetect
  3836. Detect video intervals that are (almost) completely black. Can be
  3837. useful to detect chapter transitions, commercials, or invalid
  3838. recordings. Output lines contains the time for the start, end and
  3839. duration of the detected black interval expressed in seconds.
  3840. In order to display the output lines, you need to set the loglevel at
  3841. least to the AV_LOG_INFO value.
  3842. The filter accepts the following options:
  3843. @table @option
  3844. @item black_min_duration, d
  3845. Set the minimum detected black duration expressed in seconds. It must
  3846. be a non-negative floating point number.
  3847. Default value is 2.0.
  3848. @item picture_black_ratio_th, pic_th
  3849. Set the threshold for considering a picture "black".
  3850. Express the minimum value for the ratio:
  3851. @example
  3852. @var{nb_black_pixels} / @var{nb_pixels}
  3853. @end example
  3854. for which a picture is considered black.
  3855. Default value is 0.98.
  3856. @item pixel_black_th, pix_th
  3857. Set the threshold for considering a pixel "black".
  3858. The threshold expresses the maximum pixel luminance value for which a
  3859. pixel is considered "black". The provided value is scaled according to
  3860. the following equation:
  3861. @example
  3862. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3863. @end example
  3864. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3865. the input video format, the range is [0-255] for YUV full-range
  3866. formats and [16-235] for YUV non full-range formats.
  3867. Default value is 0.10.
  3868. @end table
  3869. The following example sets the maximum pixel threshold to the minimum
  3870. value, and detects only black intervals of 2 or more seconds:
  3871. @example
  3872. blackdetect=d=2:pix_th=0.00
  3873. @end example
  3874. @section blackframe
  3875. Detect frames that are (almost) completely black. Can be useful to
  3876. detect chapter transitions or commercials. Output lines consist of
  3877. the frame number of the detected frame, the percentage of blackness,
  3878. the position in the file if known or -1 and the timestamp in seconds.
  3879. In order to display the output lines, you need to set the loglevel at
  3880. least to the AV_LOG_INFO value.
  3881. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3882. The value represents the percentage of pixels in the picture that
  3883. are below the threshold value.
  3884. It accepts the following parameters:
  3885. @table @option
  3886. @item amount
  3887. The percentage of the pixels that have to be below the threshold; it defaults to
  3888. @code{98}.
  3889. @item threshold, thresh
  3890. The threshold below which a pixel value is considered black; it defaults to
  3891. @code{32}.
  3892. @end table
  3893. @section blend, tblend
  3894. Blend two video frames into each other.
  3895. The @code{blend} filter takes two input streams and outputs one
  3896. stream, the first input is the "top" layer and second input is
  3897. "bottom" layer. By default, the output terminates when the longest input terminates.
  3898. The @code{tblend} (time blend) filter takes two consecutive frames
  3899. from one single stream, and outputs the result obtained by blending
  3900. the new frame on top of the old frame.
  3901. A description of the accepted options follows.
  3902. @table @option
  3903. @item c0_mode
  3904. @item c1_mode
  3905. @item c2_mode
  3906. @item c3_mode
  3907. @item all_mode
  3908. Set blend mode for specific pixel component or all pixel components in case
  3909. of @var{all_mode}. Default value is @code{normal}.
  3910. Available values for component modes are:
  3911. @table @samp
  3912. @item addition
  3913. @item grainmerge
  3914. @item and
  3915. @item average
  3916. @item burn
  3917. @item darken
  3918. @item difference
  3919. @item grainextract
  3920. @item divide
  3921. @item dodge
  3922. @item freeze
  3923. @item exclusion
  3924. @item extremity
  3925. @item glow
  3926. @item hardlight
  3927. @item hardmix
  3928. @item heat
  3929. @item lighten
  3930. @item linearlight
  3931. @item multiply
  3932. @item multiply128
  3933. @item negation
  3934. @item normal
  3935. @item or
  3936. @item overlay
  3937. @item phoenix
  3938. @item pinlight
  3939. @item reflect
  3940. @item screen
  3941. @item softlight
  3942. @item subtract
  3943. @item vividlight
  3944. @item xor
  3945. @end table
  3946. @item c0_opacity
  3947. @item c1_opacity
  3948. @item c2_opacity
  3949. @item c3_opacity
  3950. @item all_opacity
  3951. Set blend opacity for specific pixel component or all pixel components in case
  3952. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3953. @item c0_expr
  3954. @item c1_expr
  3955. @item c2_expr
  3956. @item c3_expr
  3957. @item all_expr
  3958. Set blend expression for specific pixel component or all pixel components in case
  3959. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3960. The expressions can use the following variables:
  3961. @table @option
  3962. @item N
  3963. The sequential number of the filtered frame, starting from @code{0}.
  3964. @item X
  3965. @item Y
  3966. the coordinates of the current sample
  3967. @item W
  3968. @item H
  3969. the width and height of currently filtered plane
  3970. @item SW
  3971. @item SH
  3972. Width and height scale depending on the currently filtered plane. It is the
  3973. ratio between the corresponding luma plane number of pixels and the current
  3974. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3975. @code{0.5,0.5} for chroma planes.
  3976. @item T
  3977. Time of the current frame, expressed in seconds.
  3978. @item TOP, A
  3979. Value of pixel component at current location for first video frame (top layer).
  3980. @item BOTTOM, B
  3981. Value of pixel component at current location for second video frame (bottom layer).
  3982. @end table
  3983. @end table
  3984. The @code{blend} filter also supports the @ref{framesync} options.
  3985. @subsection Examples
  3986. @itemize
  3987. @item
  3988. Apply transition from bottom layer to top layer in first 10 seconds:
  3989. @example
  3990. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3991. @end example
  3992. @item
  3993. Apply linear horizontal transition from top layer to bottom layer:
  3994. @example
  3995. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3996. @end example
  3997. @item
  3998. Apply 1x1 checkerboard effect:
  3999. @example
  4000. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4001. @end example
  4002. @item
  4003. Apply uncover left effect:
  4004. @example
  4005. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4006. @end example
  4007. @item
  4008. Apply uncover down effect:
  4009. @example
  4010. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4011. @end example
  4012. @item
  4013. Apply uncover up-left effect:
  4014. @example
  4015. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4016. @end example
  4017. @item
  4018. Split diagonally video and shows top and bottom layer on each side:
  4019. @example
  4020. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4021. @end example
  4022. @item
  4023. Display differences between the current and the previous frame:
  4024. @example
  4025. tblend=all_mode=grainextract
  4026. @end example
  4027. @end itemize
  4028. @section boxblur
  4029. Apply a boxblur algorithm to the input video.
  4030. It accepts the following parameters:
  4031. @table @option
  4032. @item luma_radius, lr
  4033. @item luma_power, lp
  4034. @item chroma_radius, cr
  4035. @item chroma_power, cp
  4036. @item alpha_radius, ar
  4037. @item alpha_power, ap
  4038. @end table
  4039. A description of the accepted options follows.
  4040. @table @option
  4041. @item luma_radius, lr
  4042. @item chroma_radius, cr
  4043. @item alpha_radius, ar
  4044. Set an expression for the box radius in pixels used for blurring the
  4045. corresponding input plane.
  4046. The radius value must be a non-negative number, and must not be
  4047. greater than the value of the expression @code{min(w,h)/2} for the
  4048. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4049. planes.
  4050. Default value for @option{luma_radius} is "2". If not specified,
  4051. @option{chroma_radius} and @option{alpha_radius} default to the
  4052. corresponding value set for @option{luma_radius}.
  4053. The expressions can contain the following constants:
  4054. @table @option
  4055. @item w
  4056. @item h
  4057. The input width and height in pixels.
  4058. @item cw
  4059. @item ch
  4060. The input chroma image width and height in pixels.
  4061. @item hsub
  4062. @item vsub
  4063. The horizontal and vertical chroma subsample values. For example, for the
  4064. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4065. @end table
  4066. @item luma_power, lp
  4067. @item chroma_power, cp
  4068. @item alpha_power, ap
  4069. Specify how many times the boxblur filter is applied to the
  4070. corresponding plane.
  4071. Default value for @option{luma_power} is 2. If not specified,
  4072. @option{chroma_power} and @option{alpha_power} default to the
  4073. corresponding value set for @option{luma_power}.
  4074. A value of 0 will disable the effect.
  4075. @end table
  4076. @subsection Examples
  4077. @itemize
  4078. @item
  4079. Apply a boxblur filter with the luma, chroma, and alpha radii
  4080. set to 2:
  4081. @example
  4082. boxblur=luma_radius=2:luma_power=1
  4083. boxblur=2:1
  4084. @end example
  4085. @item
  4086. Set the luma radius to 2, and alpha and chroma radius to 0:
  4087. @example
  4088. boxblur=2:1:cr=0:ar=0
  4089. @end example
  4090. @item
  4091. Set the luma and chroma radii to a fraction of the video dimension:
  4092. @example
  4093. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4094. @end example
  4095. @end itemize
  4096. @section bwdif
  4097. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4098. Deinterlacing Filter").
  4099. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4100. interpolation algorithms.
  4101. It accepts the following parameters:
  4102. @table @option
  4103. @item mode
  4104. The interlacing mode to adopt. It accepts one of the following values:
  4105. @table @option
  4106. @item 0, send_frame
  4107. Output one frame for each frame.
  4108. @item 1, send_field
  4109. Output one frame for each field.
  4110. @end table
  4111. The default value is @code{send_field}.
  4112. @item parity
  4113. The picture field parity assumed for the input interlaced video. It accepts one
  4114. of the following values:
  4115. @table @option
  4116. @item 0, tff
  4117. Assume the top field is first.
  4118. @item 1, bff
  4119. Assume the bottom field is first.
  4120. @item -1, auto
  4121. Enable automatic detection of field parity.
  4122. @end table
  4123. The default value is @code{auto}.
  4124. If the interlacing is unknown or the decoder does not export this information,
  4125. top field first will be assumed.
  4126. @item deint
  4127. Specify which frames to deinterlace. Accept one of the following
  4128. values:
  4129. @table @option
  4130. @item 0, all
  4131. Deinterlace all frames.
  4132. @item 1, interlaced
  4133. Only deinterlace frames marked as interlaced.
  4134. @end table
  4135. The default value is @code{all}.
  4136. @end table
  4137. @section chromakey
  4138. YUV colorspace color/chroma keying.
  4139. The filter accepts the following options:
  4140. @table @option
  4141. @item color
  4142. The color which will be replaced with transparency.
  4143. @item similarity
  4144. Similarity percentage with the key color.
  4145. 0.01 matches only the exact key color, while 1.0 matches everything.
  4146. @item blend
  4147. Blend percentage.
  4148. 0.0 makes pixels either fully transparent, or not transparent at all.
  4149. Higher values result in semi-transparent pixels, with a higher transparency
  4150. the more similar the pixels color is to the key color.
  4151. @item yuv
  4152. Signals that the color passed is already in YUV instead of RGB.
  4153. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4154. This can be used to pass exact YUV values as hexadecimal numbers.
  4155. @end table
  4156. @subsection Examples
  4157. @itemize
  4158. @item
  4159. Make every green pixel in the input image transparent:
  4160. @example
  4161. ffmpeg -i input.png -vf chromakey=green out.png
  4162. @end example
  4163. @item
  4164. Overlay a greenscreen-video on top of a static black background.
  4165. @example
  4166. 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
  4167. @end example
  4168. @end itemize
  4169. @section ciescope
  4170. Display CIE color diagram with pixels overlaid onto it.
  4171. The filter accepts the following options:
  4172. @table @option
  4173. @item system
  4174. Set color system.
  4175. @table @samp
  4176. @item ntsc, 470m
  4177. @item ebu, 470bg
  4178. @item smpte
  4179. @item 240m
  4180. @item apple
  4181. @item widergb
  4182. @item cie1931
  4183. @item rec709, hdtv
  4184. @item uhdtv, rec2020
  4185. @end table
  4186. @item cie
  4187. Set CIE system.
  4188. @table @samp
  4189. @item xyy
  4190. @item ucs
  4191. @item luv
  4192. @end table
  4193. @item gamuts
  4194. Set what gamuts to draw.
  4195. See @code{system} option for available values.
  4196. @item size, s
  4197. Set ciescope size, by default set to 512.
  4198. @item intensity, i
  4199. Set intensity used to map input pixel values to CIE diagram.
  4200. @item contrast
  4201. Set contrast used to draw tongue colors that are out of active color system gamut.
  4202. @item corrgamma
  4203. Correct gamma displayed on scope, by default enabled.
  4204. @item showwhite
  4205. Show white point on CIE diagram, by default disabled.
  4206. @item gamma
  4207. Set input gamma. Used only with XYZ input color space.
  4208. @end table
  4209. @section codecview
  4210. Visualize information exported by some codecs.
  4211. Some codecs can export information through frames using side-data or other
  4212. means. For example, some MPEG based codecs export motion vectors through the
  4213. @var{export_mvs} flag in the codec @option{flags2} option.
  4214. The filter accepts the following option:
  4215. @table @option
  4216. @item mv
  4217. Set motion vectors to visualize.
  4218. Available flags for @var{mv} are:
  4219. @table @samp
  4220. @item pf
  4221. forward predicted MVs of P-frames
  4222. @item bf
  4223. forward predicted MVs of B-frames
  4224. @item bb
  4225. backward predicted MVs of B-frames
  4226. @end table
  4227. @item qp
  4228. Display quantization parameters using the chroma planes.
  4229. @item mv_type, mvt
  4230. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4231. Available flags for @var{mv_type} are:
  4232. @table @samp
  4233. @item fp
  4234. forward predicted MVs
  4235. @item bp
  4236. backward predicted MVs
  4237. @end table
  4238. @item frame_type, ft
  4239. Set frame type to visualize motion vectors of.
  4240. Available flags for @var{frame_type} are:
  4241. @table @samp
  4242. @item if
  4243. intra-coded frames (I-frames)
  4244. @item pf
  4245. predicted frames (P-frames)
  4246. @item bf
  4247. bi-directionally predicted frames (B-frames)
  4248. @end table
  4249. @end table
  4250. @subsection Examples
  4251. @itemize
  4252. @item
  4253. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4254. @example
  4255. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4256. @end example
  4257. @item
  4258. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4259. @example
  4260. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4261. @end example
  4262. @end itemize
  4263. @section colorbalance
  4264. Modify intensity of primary colors (red, green and blue) of input frames.
  4265. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4266. regions for the red-cyan, green-magenta or blue-yellow balance.
  4267. A positive adjustment value shifts the balance towards the primary color, a negative
  4268. value towards the complementary color.
  4269. The filter accepts the following options:
  4270. @table @option
  4271. @item rs
  4272. @item gs
  4273. @item bs
  4274. Adjust red, green and blue shadows (darkest pixels).
  4275. @item rm
  4276. @item gm
  4277. @item bm
  4278. Adjust red, green and blue midtones (medium pixels).
  4279. @item rh
  4280. @item gh
  4281. @item bh
  4282. Adjust red, green and blue highlights (brightest pixels).
  4283. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4284. @end table
  4285. @subsection Examples
  4286. @itemize
  4287. @item
  4288. Add red color cast to shadows:
  4289. @example
  4290. colorbalance=rs=.3
  4291. @end example
  4292. @end itemize
  4293. @section colorkey
  4294. RGB colorspace color keying.
  4295. The filter accepts the following options:
  4296. @table @option
  4297. @item color
  4298. The color which will be replaced with transparency.
  4299. @item similarity
  4300. Similarity percentage with the key color.
  4301. 0.01 matches only the exact key color, while 1.0 matches everything.
  4302. @item blend
  4303. Blend percentage.
  4304. 0.0 makes pixels either fully transparent, or not transparent at all.
  4305. Higher values result in semi-transparent pixels, with a higher transparency
  4306. the more similar the pixels color is to the key color.
  4307. @end table
  4308. @subsection Examples
  4309. @itemize
  4310. @item
  4311. Make every green pixel in the input image transparent:
  4312. @example
  4313. ffmpeg -i input.png -vf colorkey=green out.png
  4314. @end example
  4315. @item
  4316. Overlay a greenscreen-video on top of a static background image.
  4317. @example
  4318. 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
  4319. @end example
  4320. @end itemize
  4321. @section colorlevels
  4322. Adjust video input frames using levels.
  4323. The filter accepts the following options:
  4324. @table @option
  4325. @item rimin
  4326. @item gimin
  4327. @item bimin
  4328. @item aimin
  4329. Adjust red, green, blue and alpha input black point.
  4330. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4331. @item rimax
  4332. @item gimax
  4333. @item bimax
  4334. @item aimax
  4335. Adjust red, green, blue and alpha input white point.
  4336. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4337. Input levels are used to lighten highlights (bright tones), darken shadows
  4338. (dark tones), change the balance of bright and dark tones.
  4339. @item romin
  4340. @item gomin
  4341. @item bomin
  4342. @item aomin
  4343. Adjust red, green, blue and alpha output black point.
  4344. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4345. @item romax
  4346. @item gomax
  4347. @item bomax
  4348. @item aomax
  4349. Adjust red, green, blue and alpha output white point.
  4350. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4351. Output levels allows manual selection of a constrained output level range.
  4352. @end table
  4353. @subsection Examples
  4354. @itemize
  4355. @item
  4356. Make video output darker:
  4357. @example
  4358. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4359. @end example
  4360. @item
  4361. Increase contrast:
  4362. @example
  4363. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4364. @end example
  4365. @item
  4366. Make video output lighter:
  4367. @example
  4368. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4369. @end example
  4370. @item
  4371. Increase brightness:
  4372. @example
  4373. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4374. @end example
  4375. @end itemize
  4376. @section colorchannelmixer
  4377. Adjust video input frames by re-mixing color channels.
  4378. This filter modifies a color channel by adding the values associated to
  4379. the other channels of the same pixels. For example if the value to
  4380. modify is red, the output value will be:
  4381. @example
  4382. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4383. @end example
  4384. The filter accepts the following options:
  4385. @table @option
  4386. @item rr
  4387. @item rg
  4388. @item rb
  4389. @item ra
  4390. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4391. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4392. @item gr
  4393. @item gg
  4394. @item gb
  4395. @item ga
  4396. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4397. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4398. @item br
  4399. @item bg
  4400. @item bb
  4401. @item ba
  4402. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4403. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4404. @item ar
  4405. @item ag
  4406. @item ab
  4407. @item aa
  4408. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4409. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4410. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4411. @end table
  4412. @subsection Examples
  4413. @itemize
  4414. @item
  4415. Convert source to grayscale:
  4416. @example
  4417. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4418. @end example
  4419. @item
  4420. Simulate sepia tones:
  4421. @example
  4422. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4423. @end example
  4424. @end itemize
  4425. @section colormatrix
  4426. Convert color matrix.
  4427. The filter accepts the following options:
  4428. @table @option
  4429. @item src
  4430. @item dst
  4431. Specify the source and destination color matrix. Both values must be
  4432. specified.
  4433. The accepted values are:
  4434. @table @samp
  4435. @item bt709
  4436. BT.709
  4437. @item fcc
  4438. FCC
  4439. @item bt601
  4440. BT.601
  4441. @item bt470
  4442. BT.470
  4443. @item bt470bg
  4444. BT.470BG
  4445. @item smpte170m
  4446. SMPTE-170M
  4447. @item smpte240m
  4448. SMPTE-240M
  4449. @item bt2020
  4450. BT.2020
  4451. @end table
  4452. @end table
  4453. For example to convert from BT.601 to SMPTE-240M, use the command:
  4454. @example
  4455. colormatrix=bt601:smpte240m
  4456. @end example
  4457. @section colorspace
  4458. Convert colorspace, transfer characteristics or color primaries.
  4459. Input video needs to have an even size.
  4460. The filter accepts the following options:
  4461. @table @option
  4462. @anchor{all}
  4463. @item all
  4464. Specify all color properties at once.
  4465. The accepted values are:
  4466. @table @samp
  4467. @item bt470m
  4468. BT.470M
  4469. @item bt470bg
  4470. BT.470BG
  4471. @item bt601-6-525
  4472. BT.601-6 525
  4473. @item bt601-6-625
  4474. BT.601-6 625
  4475. @item bt709
  4476. BT.709
  4477. @item smpte170m
  4478. SMPTE-170M
  4479. @item smpte240m
  4480. SMPTE-240M
  4481. @item bt2020
  4482. BT.2020
  4483. @end table
  4484. @anchor{space}
  4485. @item space
  4486. Specify output colorspace.
  4487. The accepted values are:
  4488. @table @samp
  4489. @item bt709
  4490. BT.709
  4491. @item fcc
  4492. FCC
  4493. @item bt470bg
  4494. BT.470BG or BT.601-6 625
  4495. @item smpte170m
  4496. SMPTE-170M or BT.601-6 525
  4497. @item smpte240m
  4498. SMPTE-240M
  4499. @item ycgco
  4500. YCgCo
  4501. @item bt2020ncl
  4502. BT.2020 with non-constant luminance
  4503. @end table
  4504. @anchor{trc}
  4505. @item trc
  4506. Specify output transfer characteristics.
  4507. The accepted values are:
  4508. @table @samp
  4509. @item bt709
  4510. BT.709
  4511. @item bt470m
  4512. BT.470M
  4513. @item bt470bg
  4514. BT.470BG
  4515. @item gamma22
  4516. Constant gamma of 2.2
  4517. @item gamma28
  4518. Constant gamma of 2.8
  4519. @item smpte170m
  4520. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4521. @item smpte240m
  4522. SMPTE-240M
  4523. @item srgb
  4524. SRGB
  4525. @item iec61966-2-1
  4526. iec61966-2-1
  4527. @item iec61966-2-4
  4528. iec61966-2-4
  4529. @item xvycc
  4530. xvycc
  4531. @item bt2020-10
  4532. BT.2020 for 10-bits content
  4533. @item bt2020-12
  4534. BT.2020 for 12-bits content
  4535. @end table
  4536. @anchor{primaries}
  4537. @item primaries
  4538. Specify output color primaries.
  4539. The accepted values are:
  4540. @table @samp
  4541. @item bt709
  4542. BT.709
  4543. @item bt470m
  4544. BT.470M
  4545. @item bt470bg
  4546. BT.470BG or BT.601-6 625
  4547. @item smpte170m
  4548. SMPTE-170M or BT.601-6 525
  4549. @item smpte240m
  4550. SMPTE-240M
  4551. @item film
  4552. film
  4553. @item smpte431
  4554. SMPTE-431
  4555. @item smpte432
  4556. SMPTE-432
  4557. @item bt2020
  4558. BT.2020
  4559. @item jedec-p22
  4560. JEDEC P22 phosphors
  4561. @end table
  4562. @anchor{range}
  4563. @item range
  4564. Specify output color range.
  4565. The accepted values are:
  4566. @table @samp
  4567. @item tv
  4568. TV (restricted) range
  4569. @item mpeg
  4570. MPEG (restricted) range
  4571. @item pc
  4572. PC (full) range
  4573. @item jpeg
  4574. JPEG (full) range
  4575. @end table
  4576. @item format
  4577. Specify output color format.
  4578. The accepted values are:
  4579. @table @samp
  4580. @item yuv420p
  4581. YUV 4:2:0 planar 8-bits
  4582. @item yuv420p10
  4583. YUV 4:2:0 planar 10-bits
  4584. @item yuv420p12
  4585. YUV 4:2:0 planar 12-bits
  4586. @item yuv422p
  4587. YUV 4:2:2 planar 8-bits
  4588. @item yuv422p10
  4589. YUV 4:2:2 planar 10-bits
  4590. @item yuv422p12
  4591. YUV 4:2:2 planar 12-bits
  4592. @item yuv444p
  4593. YUV 4:4:4 planar 8-bits
  4594. @item yuv444p10
  4595. YUV 4:4:4 planar 10-bits
  4596. @item yuv444p12
  4597. YUV 4:4:4 planar 12-bits
  4598. @end table
  4599. @item fast
  4600. Do a fast conversion, which skips gamma/primary correction. This will take
  4601. significantly less CPU, but will be mathematically incorrect. To get output
  4602. compatible with that produced by the colormatrix filter, use fast=1.
  4603. @item dither
  4604. Specify dithering mode.
  4605. The accepted values are:
  4606. @table @samp
  4607. @item none
  4608. No dithering
  4609. @item fsb
  4610. Floyd-Steinberg dithering
  4611. @end table
  4612. @item wpadapt
  4613. Whitepoint adaptation mode.
  4614. The accepted values are:
  4615. @table @samp
  4616. @item bradford
  4617. Bradford whitepoint adaptation
  4618. @item vonkries
  4619. von Kries whitepoint adaptation
  4620. @item identity
  4621. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4622. @end table
  4623. @item iall
  4624. Override all input properties at once. Same accepted values as @ref{all}.
  4625. @item ispace
  4626. Override input colorspace. Same accepted values as @ref{space}.
  4627. @item iprimaries
  4628. Override input color primaries. Same accepted values as @ref{primaries}.
  4629. @item itrc
  4630. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4631. @item irange
  4632. Override input color range. Same accepted values as @ref{range}.
  4633. @end table
  4634. The filter converts the transfer characteristics, color space and color
  4635. primaries to the specified user values. The output value, if not specified,
  4636. is set to a default value based on the "all" property. If that property is
  4637. also not specified, the filter will log an error. The output color range and
  4638. format default to the same value as the input color range and format. The
  4639. input transfer characteristics, color space, color primaries and color range
  4640. should be set on the input data. If any of these are missing, the filter will
  4641. log an error and no conversion will take place.
  4642. For example to convert the input to SMPTE-240M, use the command:
  4643. @example
  4644. colorspace=smpte240m
  4645. @end example
  4646. @section convolution
  4647. Apply convolution 3x3, 5x5 or 7x7 filter.
  4648. The filter accepts the following options:
  4649. @table @option
  4650. @item 0m
  4651. @item 1m
  4652. @item 2m
  4653. @item 3m
  4654. Set matrix for each plane.
  4655. Matrix is sequence of 9, 25 or 49 signed integers.
  4656. @item 0rdiv
  4657. @item 1rdiv
  4658. @item 2rdiv
  4659. @item 3rdiv
  4660. Set multiplier for calculated value for each plane.
  4661. @item 0bias
  4662. @item 1bias
  4663. @item 2bias
  4664. @item 3bias
  4665. Set bias for each plane. This value is added to the result of the multiplication.
  4666. Useful for making the overall image brighter or darker. Default is 0.0.
  4667. @end table
  4668. @subsection Examples
  4669. @itemize
  4670. @item
  4671. Apply sharpen:
  4672. @example
  4673. 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"
  4674. @end example
  4675. @item
  4676. Apply blur:
  4677. @example
  4678. 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"
  4679. @end example
  4680. @item
  4681. Apply edge enhance:
  4682. @example
  4683. 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"
  4684. @end example
  4685. @item
  4686. Apply edge detect:
  4687. @example
  4688. 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"
  4689. @end example
  4690. @item
  4691. Apply laplacian edge detector which includes diagonals:
  4692. @example
  4693. 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"
  4694. @end example
  4695. @item
  4696. Apply emboss:
  4697. @example
  4698. 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"
  4699. @end example
  4700. @end itemize
  4701. @section convolve
  4702. Apply 2D convolution of video stream in frequency domain using second stream
  4703. as impulse.
  4704. The filter accepts the following options:
  4705. @table @option
  4706. @item planes
  4707. Set which planes to process.
  4708. @item impulse
  4709. Set which impulse video frames will be processed, can be @var{first}
  4710. or @var{all}. Default is @var{all}.
  4711. @end table
  4712. The @code{convolve} filter also supports the @ref{framesync} options.
  4713. @section copy
  4714. Copy the input video source unchanged to the output. This is mainly useful for
  4715. testing purposes.
  4716. @anchor{coreimage}
  4717. @section coreimage
  4718. Video filtering on GPU using Apple's CoreImage API on OSX.
  4719. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4720. processed by video hardware. However, software-based OpenGL implementations
  4721. exist which means there is no guarantee for hardware processing. It depends on
  4722. the respective OSX.
  4723. There are many filters and image generators provided by Apple that come with a
  4724. large variety of options. The filter has to be referenced by its name along
  4725. with its options.
  4726. The coreimage filter accepts the following options:
  4727. @table @option
  4728. @item list_filters
  4729. List all available filters and generators along with all their respective
  4730. options as well as possible minimum and maximum values along with the default
  4731. values.
  4732. @example
  4733. list_filters=true
  4734. @end example
  4735. @item filter
  4736. Specify all filters by their respective name and options.
  4737. Use @var{list_filters} to determine all valid filter names and options.
  4738. Numerical options are specified by a float value and are automatically clamped
  4739. to their respective value range. Vector and color options have to be specified
  4740. by a list of space separated float values. Character escaping has to be done.
  4741. A special option name @code{default} is available to use default options for a
  4742. filter.
  4743. It is required to specify either @code{default} or at least one of the filter options.
  4744. All omitted options are used with their default values.
  4745. The syntax of the filter string is as follows:
  4746. @example
  4747. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4748. @end example
  4749. @item output_rect
  4750. Specify a rectangle where the output of the filter chain is copied into the
  4751. input image. It is given by a list of space separated float values:
  4752. @example
  4753. output_rect=x\ y\ width\ height
  4754. @end example
  4755. If not given, the output rectangle equals the dimensions of the input image.
  4756. The output rectangle is automatically cropped at the borders of the input
  4757. image. Negative values are valid for each component.
  4758. @example
  4759. output_rect=25\ 25\ 100\ 100
  4760. @end example
  4761. @end table
  4762. Several filters can be chained for successive processing without GPU-HOST
  4763. transfers allowing for fast processing of complex filter chains.
  4764. Currently, only filters with zero (generators) or exactly one (filters) input
  4765. image and one output image are supported. Also, transition filters are not yet
  4766. usable as intended.
  4767. Some filters generate output images with additional padding depending on the
  4768. respective filter kernel. The padding is automatically removed to ensure the
  4769. filter output has the same size as the input image.
  4770. For image generators, the size of the output image is determined by the
  4771. previous output image of the filter chain or the input image of the whole
  4772. filterchain, respectively. The generators do not use the pixel information of
  4773. this image to generate their output. However, the generated output is
  4774. blended onto this image, resulting in partial or complete coverage of the
  4775. output image.
  4776. The @ref{coreimagesrc} video source can be used for generating input images
  4777. which are directly fed into the filter chain. By using it, providing input
  4778. images by another video source or an input video is not required.
  4779. @subsection Examples
  4780. @itemize
  4781. @item
  4782. List all filters available:
  4783. @example
  4784. coreimage=list_filters=true
  4785. @end example
  4786. @item
  4787. Use the CIBoxBlur filter with default options to blur an image:
  4788. @example
  4789. coreimage=filter=CIBoxBlur@@default
  4790. @end example
  4791. @item
  4792. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4793. its center at 100x100 and a radius of 50 pixels:
  4794. @example
  4795. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4796. @end example
  4797. @item
  4798. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4799. given as complete and escaped command-line for Apple's standard bash shell:
  4800. @example
  4801. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4802. @end example
  4803. @end itemize
  4804. @section crop
  4805. Crop the input video to given dimensions.
  4806. It accepts the following parameters:
  4807. @table @option
  4808. @item w, out_w
  4809. The width of the output video. It defaults to @code{iw}.
  4810. This expression is evaluated only once during the filter
  4811. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4812. @item h, out_h
  4813. The height of the output video. It defaults to @code{ih}.
  4814. This expression is evaluated only once during the filter
  4815. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4816. @item x
  4817. The horizontal position, in the input video, of the left edge of the output
  4818. video. It defaults to @code{(in_w-out_w)/2}.
  4819. This expression is evaluated per-frame.
  4820. @item y
  4821. The vertical position, in the input video, of the top edge of the output video.
  4822. It defaults to @code{(in_h-out_h)/2}.
  4823. This expression is evaluated per-frame.
  4824. @item keep_aspect
  4825. If set to 1 will force the output display aspect ratio
  4826. to be the same of the input, by changing the output sample aspect
  4827. ratio. It defaults to 0.
  4828. @item exact
  4829. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4830. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4831. It defaults to 0.
  4832. @end table
  4833. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4834. expressions containing the following constants:
  4835. @table @option
  4836. @item x
  4837. @item y
  4838. The computed values for @var{x} and @var{y}. They are evaluated for
  4839. each new frame.
  4840. @item in_w
  4841. @item in_h
  4842. The input width and height.
  4843. @item iw
  4844. @item ih
  4845. These are the same as @var{in_w} and @var{in_h}.
  4846. @item out_w
  4847. @item out_h
  4848. The output (cropped) width and height.
  4849. @item ow
  4850. @item oh
  4851. These are the same as @var{out_w} and @var{out_h}.
  4852. @item a
  4853. same as @var{iw} / @var{ih}
  4854. @item sar
  4855. input sample aspect ratio
  4856. @item dar
  4857. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4858. @item hsub
  4859. @item vsub
  4860. horizontal and vertical chroma subsample values. For example for the
  4861. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4862. @item n
  4863. The number of the input frame, starting from 0.
  4864. @item pos
  4865. the position in the file of the input frame, NAN if unknown
  4866. @item t
  4867. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4868. @end table
  4869. The expression for @var{out_w} may depend on the value of @var{out_h},
  4870. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4871. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4872. evaluated after @var{out_w} and @var{out_h}.
  4873. The @var{x} and @var{y} parameters specify the expressions for the
  4874. position of the top-left corner of the output (non-cropped) area. They
  4875. are evaluated for each frame. If the evaluated value is not valid, it
  4876. is approximated to the nearest valid value.
  4877. The expression for @var{x} may depend on @var{y}, and the expression
  4878. for @var{y} may depend on @var{x}.
  4879. @subsection Examples
  4880. @itemize
  4881. @item
  4882. Crop area with size 100x100 at position (12,34).
  4883. @example
  4884. crop=100:100:12:34
  4885. @end example
  4886. Using named options, the example above becomes:
  4887. @example
  4888. crop=w=100:h=100:x=12:y=34
  4889. @end example
  4890. @item
  4891. Crop the central input area with size 100x100:
  4892. @example
  4893. crop=100:100
  4894. @end example
  4895. @item
  4896. Crop the central input area with size 2/3 of the input video:
  4897. @example
  4898. crop=2/3*in_w:2/3*in_h
  4899. @end example
  4900. @item
  4901. Crop the input video central square:
  4902. @example
  4903. crop=out_w=in_h
  4904. crop=in_h
  4905. @end example
  4906. @item
  4907. Delimit the rectangle with the top-left corner placed at position
  4908. 100:100 and the right-bottom corner corresponding to the right-bottom
  4909. corner of the input image.
  4910. @example
  4911. crop=in_w-100:in_h-100:100:100
  4912. @end example
  4913. @item
  4914. Crop 10 pixels from the left and right borders, and 20 pixels from
  4915. the top and bottom borders
  4916. @example
  4917. crop=in_w-2*10:in_h-2*20
  4918. @end example
  4919. @item
  4920. Keep only the bottom right quarter of the input image:
  4921. @example
  4922. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4923. @end example
  4924. @item
  4925. Crop height for getting Greek harmony:
  4926. @example
  4927. crop=in_w:1/PHI*in_w
  4928. @end example
  4929. @item
  4930. Apply trembling effect:
  4931. @example
  4932. 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)
  4933. @end example
  4934. @item
  4935. Apply erratic camera effect depending on timestamp:
  4936. @example
  4937. 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)"
  4938. @end example
  4939. @item
  4940. Set x depending on the value of y:
  4941. @example
  4942. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4943. @end example
  4944. @end itemize
  4945. @subsection Commands
  4946. This filter supports the following commands:
  4947. @table @option
  4948. @item w, out_w
  4949. @item h, out_h
  4950. @item x
  4951. @item y
  4952. Set width/height of the output video and the horizontal/vertical position
  4953. in the input video.
  4954. The command accepts the same syntax of the corresponding option.
  4955. If the specified expression is not valid, it is kept at its current
  4956. value.
  4957. @end table
  4958. @section cropdetect
  4959. Auto-detect the crop size.
  4960. It calculates the necessary cropping parameters and prints the
  4961. recommended parameters via the logging system. The detected dimensions
  4962. correspond to the non-black area of the input video.
  4963. It accepts the following parameters:
  4964. @table @option
  4965. @item limit
  4966. Set higher black value threshold, which can be optionally specified
  4967. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4968. value greater to the set value is considered non-black. It defaults to 24.
  4969. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4970. on the bitdepth of the pixel format.
  4971. @item round
  4972. The value which the width/height should be divisible by. It defaults to
  4973. 16. The offset is automatically adjusted to center the video. Use 2 to
  4974. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4975. encoding to most video codecs.
  4976. @item reset_count, reset
  4977. Set the counter that determines after how many frames cropdetect will
  4978. reset the previously detected largest video area and start over to
  4979. detect the current optimal crop area. Default value is 0.
  4980. This can be useful when channel logos distort the video area. 0
  4981. indicates 'never reset', and returns the largest area encountered during
  4982. playback.
  4983. @end table
  4984. @anchor{curves}
  4985. @section curves
  4986. Apply color adjustments using curves.
  4987. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4988. component (red, green and blue) has its values defined by @var{N} key points
  4989. tied from each other using a smooth curve. The x-axis represents the pixel
  4990. values from the input frame, and the y-axis the new pixel values to be set for
  4991. the output frame.
  4992. By default, a component curve is defined by the two points @var{(0;0)} and
  4993. @var{(1;1)}. This creates a straight line where each original pixel value is
  4994. "adjusted" to its own value, which means no change to the image.
  4995. The filter allows you to redefine these two points and add some more. A new
  4996. curve (using a natural cubic spline interpolation) will be define to pass
  4997. smoothly through all these new coordinates. The new defined points needs to be
  4998. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4999. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5000. the vector spaces, the values will be clipped accordingly.
  5001. The filter accepts the following options:
  5002. @table @option
  5003. @item preset
  5004. Select one of the available color presets. This option can be used in addition
  5005. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5006. options takes priority on the preset values.
  5007. Available presets are:
  5008. @table @samp
  5009. @item none
  5010. @item color_negative
  5011. @item cross_process
  5012. @item darker
  5013. @item increase_contrast
  5014. @item lighter
  5015. @item linear_contrast
  5016. @item medium_contrast
  5017. @item negative
  5018. @item strong_contrast
  5019. @item vintage
  5020. @end table
  5021. Default is @code{none}.
  5022. @item master, m
  5023. Set the master key points. These points will define a second pass mapping. It
  5024. is sometimes called a "luminance" or "value" mapping. It can be used with
  5025. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5026. post-processing LUT.
  5027. @item red, r
  5028. Set the key points for the red component.
  5029. @item green, g
  5030. Set the key points for the green component.
  5031. @item blue, b
  5032. Set the key points for the blue component.
  5033. @item all
  5034. Set the key points for all components (not including master).
  5035. Can be used in addition to the other key points component
  5036. options. In this case, the unset component(s) will fallback on this
  5037. @option{all} setting.
  5038. @item psfile
  5039. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5040. @item plot
  5041. Save Gnuplot script of the curves in specified file.
  5042. @end table
  5043. To avoid some filtergraph syntax conflicts, each key points list need to be
  5044. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5045. @subsection Examples
  5046. @itemize
  5047. @item
  5048. Increase slightly the middle level of blue:
  5049. @example
  5050. curves=blue='0/0 0.5/0.58 1/1'
  5051. @end example
  5052. @item
  5053. Vintage effect:
  5054. @example
  5055. 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'
  5056. @end example
  5057. Here we obtain the following coordinates for each components:
  5058. @table @var
  5059. @item red
  5060. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5061. @item green
  5062. @code{(0;0) (0.50;0.48) (1;1)}
  5063. @item blue
  5064. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5065. @end table
  5066. @item
  5067. The previous example can also be achieved with the associated built-in preset:
  5068. @example
  5069. curves=preset=vintage
  5070. @end example
  5071. @item
  5072. Or simply:
  5073. @example
  5074. curves=vintage
  5075. @end example
  5076. @item
  5077. Use a Photoshop preset and redefine the points of the green component:
  5078. @example
  5079. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5080. @end example
  5081. @item
  5082. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5083. and @command{gnuplot}:
  5084. @example
  5085. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5086. gnuplot -p /tmp/curves.plt
  5087. @end example
  5088. @end itemize
  5089. @section datascope
  5090. Video data analysis filter.
  5091. This filter shows hexadecimal pixel values of part of video.
  5092. The filter accepts the following options:
  5093. @table @option
  5094. @item size, s
  5095. Set output video size.
  5096. @item x
  5097. Set x offset from where to pick pixels.
  5098. @item y
  5099. Set y offset from where to pick pixels.
  5100. @item mode
  5101. Set scope mode, can be one of the following:
  5102. @table @samp
  5103. @item mono
  5104. Draw hexadecimal pixel values with white color on black background.
  5105. @item color
  5106. Draw hexadecimal pixel values with input video pixel color on black
  5107. background.
  5108. @item color2
  5109. Draw hexadecimal pixel values on color background picked from input video,
  5110. the text color is picked in such way so its always visible.
  5111. @end table
  5112. @item axis
  5113. Draw rows and columns numbers on left and top of video.
  5114. @item opacity
  5115. Set background opacity.
  5116. @end table
  5117. @section dctdnoiz
  5118. Denoise frames using 2D DCT (frequency domain filtering).
  5119. This filter is not designed for real time.
  5120. The filter accepts the following options:
  5121. @table @option
  5122. @item sigma, s
  5123. Set the noise sigma constant.
  5124. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5125. coefficient (absolute value) below this threshold with be dropped.
  5126. If you need a more advanced filtering, see @option{expr}.
  5127. Default is @code{0}.
  5128. @item overlap
  5129. Set number overlapping pixels for each block. Since the filter can be slow, you
  5130. may want to reduce this value, at the cost of a less effective filter and the
  5131. risk of various artefacts.
  5132. If the overlapping value doesn't permit processing the whole input width or
  5133. height, a warning will be displayed and according borders won't be denoised.
  5134. Default value is @var{blocksize}-1, which is the best possible setting.
  5135. @item expr, e
  5136. Set the coefficient factor expression.
  5137. For each coefficient of a DCT block, this expression will be evaluated as a
  5138. multiplier value for the coefficient.
  5139. If this is option is set, the @option{sigma} option will be ignored.
  5140. The absolute value of the coefficient can be accessed through the @var{c}
  5141. variable.
  5142. @item n
  5143. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5144. @var{blocksize}, which is the width and height of the processed blocks.
  5145. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5146. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5147. on the speed processing. Also, a larger block size does not necessarily means a
  5148. better de-noising.
  5149. @end table
  5150. @subsection Examples
  5151. Apply a denoise with a @option{sigma} of @code{4.5}:
  5152. @example
  5153. dctdnoiz=4.5
  5154. @end example
  5155. The same operation can be achieved using the expression system:
  5156. @example
  5157. dctdnoiz=e='gte(c, 4.5*3)'
  5158. @end example
  5159. Violent denoise using a block size of @code{16x16}:
  5160. @example
  5161. dctdnoiz=15:n=4
  5162. @end example
  5163. @section deband
  5164. Remove banding artifacts from input video.
  5165. It works by replacing banded pixels with average value of referenced pixels.
  5166. The filter accepts the following options:
  5167. @table @option
  5168. @item 1thr
  5169. @item 2thr
  5170. @item 3thr
  5171. @item 4thr
  5172. Set banding detection threshold for each plane. Default is 0.02.
  5173. Valid range is 0.00003 to 0.5.
  5174. If difference between current pixel and reference pixel is less than threshold,
  5175. it will be considered as banded.
  5176. @item range, r
  5177. Banding detection range in pixels. Default is 16. If positive, random number
  5178. in range 0 to set value will be used. If negative, exact absolute value
  5179. will be used.
  5180. The range defines square of four pixels around current pixel.
  5181. @item direction, d
  5182. Set direction in radians from which four pixel will be compared. If positive,
  5183. random direction from 0 to set direction will be picked. If negative, exact of
  5184. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5185. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5186. column.
  5187. @item blur, b
  5188. If enabled, current pixel is compared with average value of all four
  5189. surrounding pixels. The default is enabled. If disabled current pixel is
  5190. compared with all four surrounding pixels. The pixel is considered banded
  5191. if only all four differences with surrounding pixels are less than threshold.
  5192. @item coupling, c
  5193. If enabled, current pixel is changed if and only if all pixel components are banded,
  5194. e.g. banding detection threshold is triggered for all color components.
  5195. The default is disabled.
  5196. @end table
  5197. @anchor{decimate}
  5198. @section decimate
  5199. Drop duplicated frames at regular intervals.
  5200. The filter accepts the following options:
  5201. @table @option
  5202. @item cycle
  5203. Set the number of frames from which one will be dropped. Setting this to
  5204. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5205. Default is @code{5}.
  5206. @item dupthresh
  5207. Set the threshold for duplicate detection. If the difference metric for a frame
  5208. is less than or equal to this value, then it is declared as duplicate. Default
  5209. is @code{1.1}
  5210. @item scthresh
  5211. Set scene change threshold. Default is @code{15}.
  5212. @item blockx
  5213. @item blocky
  5214. Set the size of the x and y-axis blocks used during metric calculations.
  5215. Larger blocks give better noise suppression, but also give worse detection of
  5216. small movements. Must be a power of two. Default is @code{32}.
  5217. @item ppsrc
  5218. Mark main input as a pre-processed input and activate clean source input
  5219. stream. This allows the input to be pre-processed with various filters to help
  5220. the metrics calculation while keeping the frame selection lossless. When set to
  5221. @code{1}, the first stream is for the pre-processed input, and the second
  5222. stream is the clean source from where the kept frames are chosen. Default is
  5223. @code{0}.
  5224. @item chroma
  5225. Set whether or not chroma is considered in the metric calculations. Default is
  5226. @code{1}.
  5227. @end table
  5228. @section deflate
  5229. Apply deflate effect to the video.
  5230. This filter replaces the pixel by the local(3x3) average by taking into account
  5231. only values lower than the pixel.
  5232. It accepts the following options:
  5233. @table @option
  5234. @item threshold0
  5235. @item threshold1
  5236. @item threshold2
  5237. @item threshold3
  5238. Limit the maximum change for each plane, default is 65535.
  5239. If 0, plane will remain unchanged.
  5240. @end table
  5241. @section deflicker
  5242. Remove temporal frame luminance variations.
  5243. It accepts the following options:
  5244. @table @option
  5245. @item size, s
  5246. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5247. @item mode, m
  5248. Set averaging mode to smooth temporal luminance variations.
  5249. Available values are:
  5250. @table @samp
  5251. @item am
  5252. Arithmetic mean
  5253. @item gm
  5254. Geometric mean
  5255. @item hm
  5256. Harmonic mean
  5257. @item qm
  5258. Quadratic mean
  5259. @item cm
  5260. Cubic mean
  5261. @item pm
  5262. Power mean
  5263. @item median
  5264. Median
  5265. @end table
  5266. @item bypass
  5267. Do not actually modify frame. Useful when one only wants metadata.
  5268. @end table
  5269. @section dejudder
  5270. Remove judder produced by partially interlaced telecined content.
  5271. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5272. source was partially telecined content then the output of @code{pullup,dejudder}
  5273. will have a variable frame rate. May change the recorded frame rate of the
  5274. container. Aside from that change, this filter will not affect constant frame
  5275. rate video.
  5276. The option available in this filter is:
  5277. @table @option
  5278. @item cycle
  5279. Specify the length of the window over which the judder repeats.
  5280. Accepts any integer greater than 1. Useful values are:
  5281. @table @samp
  5282. @item 4
  5283. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5284. @item 5
  5285. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5286. @item 20
  5287. If a mixture of the two.
  5288. @end table
  5289. The default is @samp{4}.
  5290. @end table
  5291. @section delogo
  5292. Suppress a TV station logo by a simple interpolation of the surrounding
  5293. pixels. Just set a rectangle covering the logo and watch it disappear
  5294. (and sometimes something even uglier appear - your mileage may vary).
  5295. It accepts the following parameters:
  5296. @table @option
  5297. @item x
  5298. @item y
  5299. Specify the top left corner coordinates of the logo. They must be
  5300. specified.
  5301. @item w
  5302. @item h
  5303. Specify the width and height of the logo to clear. They must be
  5304. specified.
  5305. @item band, t
  5306. Specify the thickness of the fuzzy edge of the rectangle (added to
  5307. @var{w} and @var{h}). The default value is 1. This option is
  5308. deprecated, setting higher values should no longer be necessary and
  5309. is not recommended.
  5310. @item show
  5311. When set to 1, a green rectangle is drawn on the screen to simplify
  5312. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5313. The default value is 0.
  5314. The rectangle is drawn on the outermost pixels which will be (partly)
  5315. replaced with interpolated values. The values of the next pixels
  5316. immediately outside this rectangle in each direction will be used to
  5317. compute the interpolated pixel values inside the rectangle.
  5318. @end table
  5319. @subsection Examples
  5320. @itemize
  5321. @item
  5322. Set a rectangle covering the area with top left corner coordinates 0,0
  5323. and size 100x77, and a band of size 10:
  5324. @example
  5325. delogo=x=0:y=0:w=100:h=77:band=10
  5326. @end example
  5327. @end itemize
  5328. @section deshake
  5329. Attempt to fix small changes in horizontal and/or vertical shift. This
  5330. filter helps remove camera shake from hand-holding a camera, bumping a
  5331. tripod, moving on a vehicle, etc.
  5332. The filter accepts the following options:
  5333. @table @option
  5334. @item x
  5335. @item y
  5336. @item w
  5337. @item h
  5338. Specify a rectangular area where to limit the search for motion
  5339. vectors.
  5340. If desired the search for motion vectors can be limited to a
  5341. rectangular area of the frame defined by its top left corner, width
  5342. and height. These parameters have the same meaning as the drawbox
  5343. filter which can be used to visualise the position of the bounding
  5344. box.
  5345. This is useful when simultaneous movement of subjects within the frame
  5346. might be confused for camera motion by the motion vector search.
  5347. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5348. then the full frame is used. This allows later options to be set
  5349. without specifying the bounding box for the motion vector search.
  5350. Default - search the whole frame.
  5351. @item rx
  5352. @item ry
  5353. Specify the maximum extent of movement in x and y directions in the
  5354. range 0-64 pixels. Default 16.
  5355. @item edge
  5356. Specify how to generate pixels to fill blanks at the edge of the
  5357. frame. Available values are:
  5358. @table @samp
  5359. @item blank, 0
  5360. Fill zeroes at blank locations
  5361. @item original, 1
  5362. Original image at blank locations
  5363. @item clamp, 2
  5364. Extruded edge value at blank locations
  5365. @item mirror, 3
  5366. Mirrored edge at blank locations
  5367. @end table
  5368. Default value is @samp{mirror}.
  5369. @item blocksize
  5370. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5371. default 8.
  5372. @item contrast
  5373. Specify the contrast threshold for blocks. Only blocks with more than
  5374. the specified contrast (difference between darkest and lightest
  5375. pixels) will be considered. Range 1-255, default 125.
  5376. @item search
  5377. Specify the search strategy. Available values are:
  5378. @table @samp
  5379. @item exhaustive, 0
  5380. Set exhaustive search
  5381. @item less, 1
  5382. Set less exhaustive search.
  5383. @end table
  5384. Default value is @samp{exhaustive}.
  5385. @item filename
  5386. If set then a detailed log of the motion search is written to the
  5387. specified file.
  5388. @end table
  5389. @section despill
  5390. Remove unwanted contamination of foreground colors, caused by reflected color of
  5391. greenscreen or bluescreen.
  5392. This filter accepts the following options:
  5393. @table @option
  5394. @item type
  5395. Set what type of despill to use.
  5396. @item mix
  5397. Set how spillmap will be generated.
  5398. @item expand
  5399. Set how much to get rid of still remaining spill.
  5400. @item red
  5401. Controls amount of red in spill area.
  5402. @item green
  5403. Controls amount of green in spill area.
  5404. Should be -1 for greenscreen.
  5405. @item blue
  5406. Controls amount of blue in spill area.
  5407. Should be -1 for bluescreen.
  5408. @item brightness
  5409. Controls brightness of spill area, preserving colors.
  5410. @item alpha
  5411. Modify alpha from generated spillmap.
  5412. @end table
  5413. @section detelecine
  5414. Apply an exact inverse of the telecine operation. It requires a predefined
  5415. pattern specified using the pattern option which must be the same as that passed
  5416. to the telecine filter.
  5417. This filter accepts the following options:
  5418. @table @option
  5419. @item first_field
  5420. @table @samp
  5421. @item top, t
  5422. top field first
  5423. @item bottom, b
  5424. bottom field first
  5425. The default value is @code{top}.
  5426. @end table
  5427. @item pattern
  5428. A string of numbers representing the pulldown pattern you wish to apply.
  5429. The default value is @code{23}.
  5430. @item start_frame
  5431. A number representing position of the first frame with respect to the telecine
  5432. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5433. @end table
  5434. @section dilation
  5435. Apply dilation effect to the video.
  5436. This filter replaces the pixel by the local(3x3) maximum.
  5437. It accepts the following options:
  5438. @table @option
  5439. @item threshold0
  5440. @item threshold1
  5441. @item threshold2
  5442. @item threshold3
  5443. Limit the maximum change for each plane, default is 65535.
  5444. If 0, plane will remain unchanged.
  5445. @item coordinates
  5446. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5447. pixels are used.
  5448. Flags to local 3x3 coordinates maps like this:
  5449. 1 2 3
  5450. 4 5
  5451. 6 7 8
  5452. @end table
  5453. @section displace
  5454. Displace pixels as indicated by second and third input stream.
  5455. It takes three input streams and outputs one stream, the first input is the
  5456. source, and second and third input are displacement maps.
  5457. The second input specifies how much to displace pixels along the
  5458. x-axis, while the third input specifies how much to displace pixels
  5459. along the y-axis.
  5460. If one of displacement map streams terminates, last frame from that
  5461. displacement map will be used.
  5462. Note that once generated, displacements maps can be reused over and over again.
  5463. A description of the accepted options follows.
  5464. @table @option
  5465. @item edge
  5466. Set displace behavior for pixels that are out of range.
  5467. Available values are:
  5468. @table @samp
  5469. @item blank
  5470. Missing pixels are replaced by black pixels.
  5471. @item smear
  5472. Adjacent pixels will spread out to replace missing pixels.
  5473. @item wrap
  5474. Out of range pixels are wrapped so they point to pixels of other side.
  5475. @item mirror
  5476. Out of range pixels will be replaced with mirrored pixels.
  5477. @end table
  5478. Default is @samp{smear}.
  5479. @end table
  5480. @subsection Examples
  5481. @itemize
  5482. @item
  5483. Add ripple effect to rgb input of video size hd720:
  5484. @example
  5485. 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
  5486. @end example
  5487. @item
  5488. Add wave effect to rgb input of video size hd720:
  5489. @example
  5490. 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
  5491. @end example
  5492. @end itemize
  5493. @section drawbox
  5494. Draw a colored box on the input image.
  5495. It accepts the following parameters:
  5496. @table @option
  5497. @item x
  5498. @item y
  5499. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5500. @item width, w
  5501. @item height, h
  5502. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5503. the input width and height. It defaults to 0.
  5504. @item color, c
  5505. Specify the color of the box to write. For the general syntax of this option,
  5506. check the "Color" section in the ffmpeg-utils manual. If the special
  5507. value @code{invert} is used, the box edge color is the same as the
  5508. video with inverted luma.
  5509. @item thickness, t
  5510. The expression which sets the thickness of the box edge.
  5511. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5512. See below for the list of accepted constants.
  5513. @end table
  5514. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5515. following constants:
  5516. @table @option
  5517. @item dar
  5518. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5519. @item hsub
  5520. @item vsub
  5521. horizontal and vertical chroma subsample values. For example for the
  5522. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5523. @item in_h, ih
  5524. @item in_w, iw
  5525. The input width and height.
  5526. @item sar
  5527. The input sample aspect ratio.
  5528. @item x
  5529. @item y
  5530. The x and y offset coordinates where the box is drawn.
  5531. @item w
  5532. @item h
  5533. The width and height of the drawn box.
  5534. @item t
  5535. The thickness of the drawn box.
  5536. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5537. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5538. @end table
  5539. @subsection Examples
  5540. @itemize
  5541. @item
  5542. Draw a black box around the edge of the input image:
  5543. @example
  5544. drawbox
  5545. @end example
  5546. @item
  5547. Draw a box with color red and an opacity of 50%:
  5548. @example
  5549. drawbox=10:20:200:60:red@@0.5
  5550. @end example
  5551. The previous example can be specified as:
  5552. @example
  5553. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5554. @end example
  5555. @item
  5556. Fill the box with pink color:
  5557. @example
  5558. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5559. @end example
  5560. @item
  5561. Draw a 2-pixel red 2.40:1 mask:
  5562. @example
  5563. 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
  5564. @end example
  5565. @end itemize
  5566. @section drawgrid
  5567. Draw a grid on the input image.
  5568. It accepts the following parameters:
  5569. @table @option
  5570. @item x
  5571. @item y
  5572. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5573. @item width, w
  5574. @item height, h
  5575. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5576. input width and height, respectively, minus @code{thickness}, so image gets
  5577. framed. Default to 0.
  5578. @item color, c
  5579. Specify the color of the grid. For the general syntax of this option,
  5580. check the "Color" section in the ffmpeg-utils manual. If the special
  5581. value @code{invert} is used, the grid color is the same as the
  5582. video with inverted luma.
  5583. @item thickness, t
  5584. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5585. See below for the list of accepted constants.
  5586. @end table
  5587. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5588. following constants:
  5589. @table @option
  5590. @item dar
  5591. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5592. @item hsub
  5593. @item vsub
  5594. horizontal and vertical chroma subsample values. For example for the
  5595. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5596. @item in_h, ih
  5597. @item in_w, iw
  5598. The input grid cell width and height.
  5599. @item sar
  5600. The input sample aspect ratio.
  5601. @item x
  5602. @item y
  5603. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5604. @item w
  5605. @item h
  5606. The width and height of the drawn cell.
  5607. @item t
  5608. The thickness of the drawn cell.
  5609. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5610. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5611. @end table
  5612. @subsection Examples
  5613. @itemize
  5614. @item
  5615. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5616. @example
  5617. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5618. @end example
  5619. @item
  5620. Draw a white 3x3 grid with an opacity of 50%:
  5621. @example
  5622. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5623. @end example
  5624. @end itemize
  5625. @anchor{drawtext}
  5626. @section drawtext
  5627. Draw a text string or text from a specified file on top of a video, using the
  5628. libfreetype library.
  5629. To enable compilation of this filter, you need to configure FFmpeg with
  5630. @code{--enable-libfreetype}.
  5631. To enable default font fallback and the @var{font} option you need to
  5632. configure FFmpeg with @code{--enable-libfontconfig}.
  5633. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5634. @code{--enable-libfribidi}.
  5635. @subsection Syntax
  5636. It accepts the following parameters:
  5637. @table @option
  5638. @item box
  5639. Used to draw a box around text using the background color.
  5640. The value must be either 1 (enable) or 0 (disable).
  5641. The default value of @var{box} is 0.
  5642. @item boxborderw
  5643. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5644. The default value of @var{boxborderw} is 0.
  5645. @item boxcolor
  5646. The color to be used for drawing box around text. For the syntax of this
  5647. option, check the "Color" section in the ffmpeg-utils manual.
  5648. The default value of @var{boxcolor} is "white".
  5649. @item line_spacing
  5650. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5651. The default value of @var{line_spacing} is 0.
  5652. @item borderw
  5653. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5654. The default value of @var{borderw} is 0.
  5655. @item bordercolor
  5656. Set the color to be used for drawing border around text. For the syntax of this
  5657. option, check the "Color" section in the ffmpeg-utils manual.
  5658. The default value of @var{bordercolor} is "black".
  5659. @item expansion
  5660. Select how the @var{text} is expanded. Can be either @code{none},
  5661. @code{strftime} (deprecated) or
  5662. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5663. below for details.
  5664. @item basetime
  5665. Set a start time for the count. Value is in microseconds. Only applied
  5666. in the deprecated strftime expansion mode. To emulate in normal expansion
  5667. mode use the @code{pts} function, supplying the start time (in seconds)
  5668. as the second argument.
  5669. @item fix_bounds
  5670. If true, check and fix text coords to avoid clipping.
  5671. @item fontcolor
  5672. The color to be used for drawing fonts. For the syntax of this option, check
  5673. the "Color" section in the ffmpeg-utils manual.
  5674. The default value of @var{fontcolor} is "black".
  5675. @item fontcolor_expr
  5676. String which is expanded the same way as @var{text} to obtain dynamic
  5677. @var{fontcolor} value. By default this option has empty value and is not
  5678. processed. When this option is set, it overrides @var{fontcolor} option.
  5679. @item font
  5680. The font family to be used for drawing text. By default Sans.
  5681. @item fontfile
  5682. The font file to be used for drawing text. The path must be included.
  5683. This parameter is mandatory if the fontconfig support is disabled.
  5684. @item alpha
  5685. Draw the text applying alpha blending. The value can
  5686. be a number between 0.0 and 1.0.
  5687. The expression accepts the same variables @var{x, y} as well.
  5688. The default value is 1.
  5689. Please see @var{fontcolor_expr}.
  5690. @item fontsize
  5691. The font size to be used for drawing text.
  5692. The default value of @var{fontsize} is 16.
  5693. @item text_shaping
  5694. If set to 1, attempt to shape the text (for example, reverse the order of
  5695. right-to-left text and join Arabic characters) before drawing it.
  5696. Otherwise, just draw the text exactly as given.
  5697. By default 1 (if supported).
  5698. @item ft_load_flags
  5699. The flags to be used for loading the fonts.
  5700. The flags map the corresponding flags supported by libfreetype, and are
  5701. a combination of the following values:
  5702. @table @var
  5703. @item default
  5704. @item no_scale
  5705. @item no_hinting
  5706. @item render
  5707. @item no_bitmap
  5708. @item vertical_layout
  5709. @item force_autohint
  5710. @item crop_bitmap
  5711. @item pedantic
  5712. @item ignore_global_advance_width
  5713. @item no_recurse
  5714. @item ignore_transform
  5715. @item monochrome
  5716. @item linear_design
  5717. @item no_autohint
  5718. @end table
  5719. Default value is "default".
  5720. For more information consult the documentation for the FT_LOAD_*
  5721. libfreetype flags.
  5722. @item shadowcolor
  5723. The color to be used for drawing a shadow behind the drawn text. For the
  5724. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5725. The default value of @var{shadowcolor} is "black".
  5726. @item shadowx
  5727. @item shadowy
  5728. The x and y offsets for the text shadow position with respect to the
  5729. position of the text. They can be either positive or negative
  5730. values. The default value for both is "0".
  5731. @item start_number
  5732. The starting frame number for the n/frame_num variable. The default value
  5733. is "0".
  5734. @item tabsize
  5735. The size in number of spaces to use for rendering the tab.
  5736. Default value is 4.
  5737. @item timecode
  5738. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5739. format. It can be used with or without text parameter. @var{timecode_rate}
  5740. option must be specified.
  5741. @item timecode_rate, rate, r
  5742. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5743. integer. Minimum value is "1".
  5744. Drop-frame timecode is supported for frame rates 30 & 60.
  5745. @item tc24hmax
  5746. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5747. Default is 0 (disabled).
  5748. @item text
  5749. The text string to be drawn. The text must be a sequence of UTF-8
  5750. encoded characters.
  5751. This parameter is mandatory if no file is specified with the parameter
  5752. @var{textfile}.
  5753. @item textfile
  5754. A text file containing text to be drawn. The text must be a sequence
  5755. of UTF-8 encoded characters.
  5756. This parameter is mandatory if no text string is specified with the
  5757. parameter @var{text}.
  5758. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5759. @item reload
  5760. If set to 1, the @var{textfile} will be reloaded before each frame.
  5761. Be sure to update it atomically, or it may be read partially, or even fail.
  5762. @item x
  5763. @item y
  5764. The expressions which specify the offsets where text will be drawn
  5765. within the video frame. They are relative to the top/left border of the
  5766. output image.
  5767. The default value of @var{x} and @var{y} is "0".
  5768. See below for the list of accepted constants and functions.
  5769. @end table
  5770. The parameters for @var{x} and @var{y} are expressions containing the
  5771. following constants and functions:
  5772. @table @option
  5773. @item dar
  5774. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5775. @item hsub
  5776. @item vsub
  5777. horizontal and vertical chroma subsample values. For example for the
  5778. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5779. @item line_h, lh
  5780. the height of each text line
  5781. @item main_h, h, H
  5782. the input height
  5783. @item main_w, w, W
  5784. the input width
  5785. @item max_glyph_a, ascent
  5786. the maximum distance from the baseline to the highest/upper grid
  5787. coordinate used to place a glyph outline point, for all the rendered
  5788. glyphs.
  5789. It is a positive value, due to the grid's orientation with the Y axis
  5790. upwards.
  5791. @item max_glyph_d, descent
  5792. the maximum distance from the baseline to the lowest grid coordinate
  5793. used to place a glyph outline point, for all the rendered glyphs.
  5794. This is a negative value, due to the grid's orientation, with the Y axis
  5795. upwards.
  5796. @item max_glyph_h
  5797. maximum glyph height, that is the maximum height for all the glyphs
  5798. contained in the rendered text, it is equivalent to @var{ascent} -
  5799. @var{descent}.
  5800. @item max_glyph_w
  5801. maximum glyph width, that is the maximum width for all the glyphs
  5802. contained in the rendered text
  5803. @item n
  5804. the number of input frame, starting from 0
  5805. @item rand(min, max)
  5806. return a random number included between @var{min} and @var{max}
  5807. @item sar
  5808. The input sample aspect ratio.
  5809. @item t
  5810. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5811. @item text_h, th
  5812. the height of the rendered text
  5813. @item text_w, tw
  5814. the width of the rendered text
  5815. @item x
  5816. @item y
  5817. the x and y offset coordinates where the text is drawn.
  5818. These parameters allow the @var{x} and @var{y} expressions to refer
  5819. each other, so you can for example specify @code{y=x/dar}.
  5820. @end table
  5821. @anchor{drawtext_expansion}
  5822. @subsection Text expansion
  5823. If @option{expansion} is set to @code{strftime},
  5824. the filter recognizes strftime() sequences in the provided text and
  5825. expands them accordingly. Check the documentation of strftime(). This
  5826. feature is deprecated.
  5827. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5828. If @option{expansion} is set to @code{normal} (which is the default),
  5829. the following expansion mechanism is used.
  5830. The backslash character @samp{\}, followed by any character, always expands to
  5831. the second character.
  5832. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5833. braces is a function name, possibly followed by arguments separated by ':'.
  5834. If the arguments contain special characters or delimiters (':' or '@}'),
  5835. they should be escaped.
  5836. Note that they probably must also be escaped as the value for the
  5837. @option{text} option in the filter argument string and as the filter
  5838. argument in the filtergraph description, and possibly also for the shell,
  5839. that makes up to four levels of escaping; using a text file avoids these
  5840. problems.
  5841. The following functions are available:
  5842. @table @command
  5843. @item expr, e
  5844. The expression evaluation result.
  5845. It must take one argument specifying the expression to be evaluated,
  5846. which accepts the same constants and functions as the @var{x} and
  5847. @var{y} values. Note that not all constants should be used, for
  5848. example the text size is not known when evaluating the expression, so
  5849. the constants @var{text_w} and @var{text_h} will have an undefined
  5850. value.
  5851. @item expr_int_format, eif
  5852. Evaluate the expression's value and output as formatted integer.
  5853. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5854. The second argument specifies the output format. Allowed values are @samp{x},
  5855. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5856. @code{printf} function.
  5857. The third parameter is optional and sets the number of positions taken by the output.
  5858. It can be used to add padding with zeros from the left.
  5859. @item gmtime
  5860. The time at which the filter is running, expressed in UTC.
  5861. It can accept an argument: a strftime() format string.
  5862. @item localtime
  5863. The time at which the filter is running, expressed in the local time zone.
  5864. It can accept an argument: a strftime() format string.
  5865. @item metadata
  5866. Frame metadata. Takes one or two arguments.
  5867. The first argument is mandatory and specifies the metadata key.
  5868. The second argument is optional and specifies a default value, used when the
  5869. metadata key is not found or empty.
  5870. @item n, frame_num
  5871. The frame number, starting from 0.
  5872. @item pict_type
  5873. A 1 character description of the current picture type.
  5874. @item pts
  5875. The timestamp of the current frame.
  5876. It can take up to three arguments.
  5877. The first argument is the format of the timestamp; it defaults to @code{flt}
  5878. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5879. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5880. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5881. @code{localtime} stands for the timestamp of the frame formatted as
  5882. local time zone time.
  5883. The second argument is an offset added to the timestamp.
  5884. If the format is set to @code{localtime} or @code{gmtime},
  5885. a third argument may be supplied: a strftime() format string.
  5886. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5887. @end table
  5888. @subsection Examples
  5889. @itemize
  5890. @item
  5891. Draw "Test Text" with font FreeSerif, using the default values for the
  5892. optional parameters.
  5893. @example
  5894. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5895. @end example
  5896. @item
  5897. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5898. and y=50 (counting from the top-left corner of the screen), text is
  5899. yellow with a red box around it. Both the text and the box have an
  5900. opacity of 20%.
  5901. @example
  5902. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5903. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5904. @end example
  5905. Note that the double quotes are not necessary if spaces are not used
  5906. within the parameter list.
  5907. @item
  5908. Show the text at the center of the video frame:
  5909. @example
  5910. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5911. @end example
  5912. @item
  5913. Show the text at a random position, switching to a new position every 30 seconds:
  5914. @example
  5915. 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)"
  5916. @end example
  5917. @item
  5918. Show a text line sliding from right to left in the last row of the video
  5919. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5920. with no newlines.
  5921. @example
  5922. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5923. @end example
  5924. @item
  5925. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5926. @example
  5927. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5928. @end example
  5929. @item
  5930. Draw a single green letter "g", at the center of the input video.
  5931. The glyph baseline is placed at half screen height.
  5932. @example
  5933. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5934. @end example
  5935. @item
  5936. Show text for 1 second every 3 seconds:
  5937. @example
  5938. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5939. @end example
  5940. @item
  5941. Use fontconfig to set the font. Note that the colons need to be escaped.
  5942. @example
  5943. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5944. @end example
  5945. @item
  5946. Print the date of a real-time encoding (see strftime(3)):
  5947. @example
  5948. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5949. @end example
  5950. @item
  5951. Show text fading in and out (appearing/disappearing):
  5952. @example
  5953. #!/bin/sh
  5954. DS=1.0 # display start
  5955. DE=10.0 # display end
  5956. FID=1.5 # fade in duration
  5957. FOD=5 # fade out duration
  5958. 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 @}"
  5959. @end example
  5960. @item
  5961. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5962. and the @option{fontsize} value are included in the @option{y} offset.
  5963. @example
  5964. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5965. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5966. @end example
  5967. @end itemize
  5968. For more information about libfreetype, check:
  5969. @url{http://www.freetype.org/}.
  5970. For more information about fontconfig, check:
  5971. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5972. For more information about libfribidi, check:
  5973. @url{http://fribidi.org/}.
  5974. @section edgedetect
  5975. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5976. The filter accepts the following options:
  5977. @table @option
  5978. @item low
  5979. @item high
  5980. Set low and high threshold values used by the Canny thresholding
  5981. algorithm.
  5982. The high threshold selects the "strong" edge pixels, which are then
  5983. connected through 8-connectivity with the "weak" edge pixels selected
  5984. by the low threshold.
  5985. @var{low} and @var{high} threshold values must be chosen in the range
  5986. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5987. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5988. is @code{50/255}.
  5989. @item mode
  5990. Define the drawing mode.
  5991. @table @samp
  5992. @item wires
  5993. Draw white/gray wires on black background.
  5994. @item colormix
  5995. Mix the colors to create a paint/cartoon effect.
  5996. @end table
  5997. Default value is @var{wires}.
  5998. @end table
  5999. @subsection Examples
  6000. @itemize
  6001. @item
  6002. Standard edge detection with custom values for the hysteresis thresholding:
  6003. @example
  6004. edgedetect=low=0.1:high=0.4
  6005. @end example
  6006. @item
  6007. Painting effect without thresholding:
  6008. @example
  6009. edgedetect=mode=colormix:high=0
  6010. @end example
  6011. @end itemize
  6012. @section eq
  6013. Set brightness, contrast, saturation and approximate gamma adjustment.
  6014. The filter accepts the following options:
  6015. @table @option
  6016. @item contrast
  6017. Set the contrast expression. The value must be a float value in range
  6018. @code{-2.0} to @code{2.0}. The default value is "1".
  6019. @item brightness
  6020. Set the brightness expression. The value must be a float value in
  6021. range @code{-1.0} to @code{1.0}. The default value is "0".
  6022. @item saturation
  6023. Set the saturation expression. The value must be a float in
  6024. range @code{0.0} to @code{3.0}. The default value is "1".
  6025. @item gamma
  6026. Set the gamma expression. The value must be a float in range
  6027. @code{0.1} to @code{10.0}. The default value is "1".
  6028. @item gamma_r
  6029. Set the gamma expression for red. The value must be a float in
  6030. range @code{0.1} to @code{10.0}. The default value is "1".
  6031. @item gamma_g
  6032. Set the gamma expression for green. The value must be a float in range
  6033. @code{0.1} to @code{10.0}. The default value is "1".
  6034. @item gamma_b
  6035. Set the gamma expression for blue. The value must be a float in range
  6036. @code{0.1} to @code{10.0}. The default value is "1".
  6037. @item gamma_weight
  6038. Set the gamma weight expression. It can be used to reduce the effect
  6039. of a high gamma value on bright image areas, e.g. keep them from
  6040. getting overamplified and just plain white. The value must be a float
  6041. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6042. gamma correction all the way down while @code{1.0} leaves it at its
  6043. full strength. Default is "1".
  6044. @item eval
  6045. Set when the expressions for brightness, contrast, saturation and
  6046. gamma expressions are evaluated.
  6047. It accepts the following values:
  6048. @table @samp
  6049. @item init
  6050. only evaluate expressions once during the filter initialization or
  6051. when a command is processed
  6052. @item frame
  6053. evaluate expressions for each incoming frame
  6054. @end table
  6055. Default value is @samp{init}.
  6056. @end table
  6057. The expressions accept the following parameters:
  6058. @table @option
  6059. @item n
  6060. frame count of the input frame starting from 0
  6061. @item pos
  6062. byte position of the corresponding packet in the input file, NAN if
  6063. unspecified
  6064. @item r
  6065. frame rate of the input video, NAN if the input frame rate is unknown
  6066. @item t
  6067. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6068. @end table
  6069. @subsection Commands
  6070. The filter supports the following commands:
  6071. @table @option
  6072. @item contrast
  6073. Set the contrast expression.
  6074. @item brightness
  6075. Set the brightness expression.
  6076. @item saturation
  6077. Set the saturation expression.
  6078. @item gamma
  6079. Set the gamma expression.
  6080. @item gamma_r
  6081. Set the gamma_r expression.
  6082. @item gamma_g
  6083. Set gamma_g expression.
  6084. @item gamma_b
  6085. Set gamma_b expression.
  6086. @item gamma_weight
  6087. Set gamma_weight expression.
  6088. The command accepts the same syntax of the corresponding option.
  6089. If the specified expression is not valid, it is kept at its current
  6090. value.
  6091. @end table
  6092. @section erosion
  6093. Apply erosion effect to the video.
  6094. This filter replaces the pixel by the local(3x3) minimum.
  6095. It accepts the following options:
  6096. @table @option
  6097. @item threshold0
  6098. @item threshold1
  6099. @item threshold2
  6100. @item threshold3
  6101. Limit the maximum change for each plane, default is 65535.
  6102. If 0, plane will remain unchanged.
  6103. @item coordinates
  6104. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6105. pixels are used.
  6106. Flags to local 3x3 coordinates maps like this:
  6107. 1 2 3
  6108. 4 5
  6109. 6 7 8
  6110. @end table
  6111. @section extractplanes
  6112. Extract color channel components from input video stream into
  6113. separate grayscale video streams.
  6114. The filter accepts the following option:
  6115. @table @option
  6116. @item planes
  6117. Set plane(s) to extract.
  6118. Available values for planes are:
  6119. @table @samp
  6120. @item y
  6121. @item u
  6122. @item v
  6123. @item a
  6124. @item r
  6125. @item g
  6126. @item b
  6127. @end table
  6128. Choosing planes not available in the input will result in an error.
  6129. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6130. with @code{y}, @code{u}, @code{v} planes at same time.
  6131. @end table
  6132. @subsection Examples
  6133. @itemize
  6134. @item
  6135. Extract luma, u and v color channel component from input video frame
  6136. into 3 grayscale outputs:
  6137. @example
  6138. 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
  6139. @end example
  6140. @end itemize
  6141. @section elbg
  6142. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6143. For each input image, the filter will compute the optimal mapping from
  6144. the input to the output given the codebook length, that is the number
  6145. of distinct output colors.
  6146. This filter accepts the following options.
  6147. @table @option
  6148. @item codebook_length, l
  6149. Set codebook length. The value must be a positive integer, and
  6150. represents the number of distinct output colors. Default value is 256.
  6151. @item nb_steps, n
  6152. Set the maximum number of iterations to apply for computing the optimal
  6153. mapping. The higher the value the better the result and the higher the
  6154. computation time. Default value is 1.
  6155. @item seed, s
  6156. Set a random seed, must be an integer included between 0 and
  6157. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6158. will try to use a good random seed on a best effort basis.
  6159. @item pal8
  6160. Set pal8 output pixel format. This option does not work with codebook
  6161. length greater than 256.
  6162. @end table
  6163. @section fade
  6164. Apply a fade-in/out effect to the input video.
  6165. It accepts the following parameters:
  6166. @table @option
  6167. @item type, t
  6168. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6169. effect.
  6170. Default is @code{in}.
  6171. @item start_frame, s
  6172. Specify the number of the frame to start applying the fade
  6173. effect at. Default is 0.
  6174. @item nb_frames, n
  6175. The number of frames that the fade effect lasts. At the end of the
  6176. fade-in effect, the output video will have the same intensity as the input video.
  6177. At the end of the fade-out transition, the output video will be filled with the
  6178. selected @option{color}.
  6179. Default is 25.
  6180. @item alpha
  6181. If set to 1, fade only alpha channel, if one exists on the input.
  6182. Default value is 0.
  6183. @item start_time, st
  6184. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6185. effect. If both start_frame and start_time are specified, the fade will start at
  6186. whichever comes last. Default is 0.
  6187. @item duration, d
  6188. The number of seconds for which the fade effect has to last. At the end of the
  6189. fade-in effect the output video will have the same intensity as the input video,
  6190. at the end of the fade-out transition the output video will be filled with the
  6191. selected @option{color}.
  6192. If both duration and nb_frames are specified, duration is used. Default is 0
  6193. (nb_frames is used by default).
  6194. @item color, c
  6195. Specify the color of the fade. Default is "black".
  6196. @end table
  6197. @subsection Examples
  6198. @itemize
  6199. @item
  6200. Fade in the first 30 frames of video:
  6201. @example
  6202. fade=in:0:30
  6203. @end example
  6204. The command above is equivalent to:
  6205. @example
  6206. fade=t=in:s=0:n=30
  6207. @end example
  6208. @item
  6209. Fade out the last 45 frames of a 200-frame video:
  6210. @example
  6211. fade=out:155:45
  6212. fade=type=out:start_frame=155:nb_frames=45
  6213. @end example
  6214. @item
  6215. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6216. @example
  6217. fade=in:0:25, fade=out:975:25
  6218. @end example
  6219. @item
  6220. Make the first 5 frames yellow, then fade in from frame 5-24:
  6221. @example
  6222. fade=in:5:20:color=yellow
  6223. @end example
  6224. @item
  6225. Fade in alpha over first 25 frames of video:
  6226. @example
  6227. fade=in:0:25:alpha=1
  6228. @end example
  6229. @item
  6230. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6231. @example
  6232. fade=t=in:st=5.5:d=0.5
  6233. @end example
  6234. @end itemize
  6235. @section fftfilt
  6236. Apply arbitrary expressions to samples in frequency domain
  6237. @table @option
  6238. @item dc_Y
  6239. Adjust the dc value (gain) of the luma plane of the image. The filter
  6240. accepts an integer value in range @code{0} to @code{1000}. The default
  6241. value is set to @code{0}.
  6242. @item dc_U
  6243. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6244. filter accepts an integer value in range @code{0} to @code{1000}. The
  6245. default value is set to @code{0}.
  6246. @item dc_V
  6247. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6248. filter accepts an integer value in range @code{0} to @code{1000}. The
  6249. default value is set to @code{0}.
  6250. @item weight_Y
  6251. Set the frequency domain weight expression for the luma plane.
  6252. @item weight_U
  6253. Set the frequency domain weight expression for the 1st chroma plane.
  6254. @item weight_V
  6255. Set the frequency domain weight expression for the 2nd chroma plane.
  6256. @item eval
  6257. Set when the expressions are evaluated.
  6258. It accepts the following values:
  6259. @table @samp
  6260. @item init
  6261. Only evaluate expressions once during the filter initialization.
  6262. @item frame
  6263. Evaluate expressions for each incoming frame.
  6264. @end table
  6265. Default value is @samp{init}.
  6266. The filter accepts the following variables:
  6267. @item X
  6268. @item Y
  6269. The coordinates of the current sample.
  6270. @item W
  6271. @item H
  6272. The width and height of the image.
  6273. @item N
  6274. The number of input frame, starting from 0.
  6275. @end table
  6276. @subsection Examples
  6277. @itemize
  6278. @item
  6279. High-pass:
  6280. @example
  6281. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6282. @end example
  6283. @item
  6284. Low-pass:
  6285. @example
  6286. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6287. @end example
  6288. @item
  6289. Sharpen:
  6290. @example
  6291. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6292. @end example
  6293. @item
  6294. Blur:
  6295. @example
  6296. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6297. @end example
  6298. @end itemize
  6299. @section field
  6300. Extract a single field from an interlaced image using stride
  6301. arithmetic to avoid wasting CPU time. The output frames are marked as
  6302. non-interlaced.
  6303. The filter accepts the following options:
  6304. @table @option
  6305. @item type
  6306. Specify whether to extract the top (if the value is @code{0} or
  6307. @code{top}) or the bottom field (if the value is @code{1} or
  6308. @code{bottom}).
  6309. @end table
  6310. @section fieldhint
  6311. Create new frames by copying the top and bottom fields from surrounding frames
  6312. supplied as numbers by the hint file.
  6313. @table @option
  6314. @item hint
  6315. Set file containing hints: absolute/relative frame numbers.
  6316. There must be one line for each frame in a clip. Each line must contain two
  6317. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6318. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6319. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6320. for @code{relative} mode. First number tells from which frame to pick up top
  6321. field and second number tells from which frame to pick up bottom field.
  6322. If optionally followed by @code{+} output frame will be marked as interlaced,
  6323. else if followed by @code{-} output frame will be marked as progressive, else
  6324. it will be marked same as input frame.
  6325. If line starts with @code{#} or @code{;} that line is skipped.
  6326. @item mode
  6327. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6328. @end table
  6329. Example of first several lines of @code{hint} file for @code{relative} mode:
  6330. @example
  6331. 0,0 - # first frame
  6332. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6333. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6334. 1,0 -
  6335. 0,0 -
  6336. 0,0 -
  6337. 1,0 -
  6338. 1,0 -
  6339. 1,0 -
  6340. 0,0 -
  6341. 0,0 -
  6342. 1,0 -
  6343. 1,0 -
  6344. 1,0 -
  6345. 0,0 -
  6346. @end example
  6347. @section fieldmatch
  6348. Field matching filter for inverse telecine. It is meant to reconstruct the
  6349. progressive frames from a telecined stream. The filter does not drop duplicated
  6350. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6351. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6352. The separation of the field matching and the decimation is notably motivated by
  6353. the possibility of inserting a de-interlacing filter fallback between the two.
  6354. If the source has mixed telecined and real interlaced content,
  6355. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6356. But these remaining combed frames will be marked as interlaced, and thus can be
  6357. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6358. In addition to the various configuration options, @code{fieldmatch} can take an
  6359. optional second stream, activated through the @option{ppsrc} option. If
  6360. enabled, the frames reconstruction will be based on the fields and frames from
  6361. this second stream. This allows the first input to be pre-processed in order to
  6362. help the various algorithms of the filter, while keeping the output lossless
  6363. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6364. or brightness/contrast adjustments can help.
  6365. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6366. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6367. which @code{fieldmatch} is based on. While the semantic and usage are very
  6368. close, some behaviour and options names can differ.
  6369. The @ref{decimate} filter currently only works for constant frame rate input.
  6370. If your input has mixed telecined (30fps) and progressive content with a lower
  6371. framerate like 24fps use the following filterchain to produce the necessary cfr
  6372. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6373. The filter accepts the following options:
  6374. @table @option
  6375. @item order
  6376. Specify the assumed field order of the input stream. Available values are:
  6377. @table @samp
  6378. @item auto
  6379. Auto detect parity (use FFmpeg's internal parity value).
  6380. @item bff
  6381. Assume bottom field first.
  6382. @item tff
  6383. Assume top field first.
  6384. @end table
  6385. Note that it is sometimes recommended not to trust the parity announced by the
  6386. stream.
  6387. Default value is @var{auto}.
  6388. @item mode
  6389. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6390. sense that it won't risk creating jerkiness due to duplicate frames when
  6391. possible, but if there are bad edits or blended fields it will end up
  6392. outputting combed frames when a good match might actually exist. On the other
  6393. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6394. but will almost always find a good frame if there is one. The other values are
  6395. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6396. jerkiness and creating duplicate frames versus finding good matches in sections
  6397. with bad edits, orphaned fields, blended fields, etc.
  6398. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6399. Available values are:
  6400. @table @samp
  6401. @item pc
  6402. 2-way matching (p/c)
  6403. @item pc_n
  6404. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6405. @item pc_u
  6406. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6407. @item pc_n_ub
  6408. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6409. still combed (p/c + n + u/b)
  6410. @item pcn
  6411. 3-way matching (p/c/n)
  6412. @item pcn_ub
  6413. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6414. detected as combed (p/c/n + u/b)
  6415. @end table
  6416. The parenthesis at the end indicate the matches that would be used for that
  6417. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6418. @var{top}).
  6419. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6420. the slowest.
  6421. Default value is @var{pc_n}.
  6422. @item ppsrc
  6423. Mark the main input stream as a pre-processed input, and enable the secondary
  6424. input stream as the clean source to pick the fields from. See the filter
  6425. introduction for more details. It is similar to the @option{clip2} feature from
  6426. VFM/TFM.
  6427. Default value is @code{0} (disabled).
  6428. @item field
  6429. Set the field to match from. It is recommended to set this to the same value as
  6430. @option{order} unless you experience matching failures with that setting. In
  6431. certain circumstances changing the field that is used to match from can have a
  6432. large impact on matching performance. Available values are:
  6433. @table @samp
  6434. @item auto
  6435. Automatic (same value as @option{order}).
  6436. @item bottom
  6437. Match from the bottom field.
  6438. @item top
  6439. Match from the top field.
  6440. @end table
  6441. Default value is @var{auto}.
  6442. @item mchroma
  6443. Set whether or not chroma is included during the match comparisons. In most
  6444. cases it is recommended to leave this enabled. You should set this to @code{0}
  6445. only if your clip has bad chroma problems such as heavy rainbowing or other
  6446. artifacts. Setting this to @code{0} could also be used to speed things up at
  6447. the cost of some accuracy.
  6448. Default value is @code{1}.
  6449. @item y0
  6450. @item y1
  6451. These define an exclusion band which excludes the lines between @option{y0} and
  6452. @option{y1} from being included in the field matching decision. An exclusion
  6453. band can be used to ignore subtitles, a logo, or other things that may
  6454. interfere with the matching. @option{y0} sets the starting scan line and
  6455. @option{y1} sets the ending line; all lines in between @option{y0} and
  6456. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6457. @option{y0} and @option{y1} to the same value will disable the feature.
  6458. @option{y0} and @option{y1} defaults to @code{0}.
  6459. @item scthresh
  6460. Set the scene change detection threshold as a percentage of maximum change on
  6461. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6462. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6463. @option{scthresh} is @code{[0.0, 100.0]}.
  6464. Default value is @code{12.0}.
  6465. @item combmatch
  6466. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6467. account the combed scores of matches when deciding what match to use as the
  6468. final match. Available values are:
  6469. @table @samp
  6470. @item none
  6471. No final matching based on combed scores.
  6472. @item sc
  6473. Combed scores are only used when a scene change is detected.
  6474. @item full
  6475. Use combed scores all the time.
  6476. @end table
  6477. Default is @var{sc}.
  6478. @item combdbg
  6479. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6480. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6481. Available values are:
  6482. @table @samp
  6483. @item none
  6484. No forced calculation.
  6485. @item pcn
  6486. Force p/c/n calculations.
  6487. @item pcnub
  6488. Force p/c/n/u/b calculations.
  6489. @end table
  6490. Default value is @var{none}.
  6491. @item cthresh
  6492. This is the area combing threshold used for combed frame detection. This
  6493. essentially controls how "strong" or "visible" combing must be to be detected.
  6494. Larger values mean combing must be more visible and smaller values mean combing
  6495. can be less visible or strong and still be detected. Valid settings are from
  6496. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6497. be detected as combed). This is basically a pixel difference value. A good
  6498. range is @code{[8, 12]}.
  6499. Default value is @code{9}.
  6500. @item chroma
  6501. Sets whether or not chroma is considered in the combed frame decision. Only
  6502. disable this if your source has chroma problems (rainbowing, etc.) that are
  6503. causing problems for the combed frame detection with chroma enabled. Actually,
  6504. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6505. where there is chroma only combing in the source.
  6506. Default value is @code{0}.
  6507. @item blockx
  6508. @item blocky
  6509. Respectively set the x-axis and y-axis size of the window used during combed
  6510. frame detection. This has to do with the size of the area in which
  6511. @option{combpel} pixels are required to be detected as combed for a frame to be
  6512. declared combed. See the @option{combpel} parameter description for more info.
  6513. Possible values are any number that is a power of 2 starting at 4 and going up
  6514. to 512.
  6515. Default value is @code{16}.
  6516. @item combpel
  6517. The number of combed pixels inside any of the @option{blocky} by
  6518. @option{blockx} size blocks on the frame for the frame to be detected as
  6519. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6520. setting controls "how much" combing there must be in any localized area (a
  6521. window defined by the @option{blockx} and @option{blocky} settings) on the
  6522. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6523. which point no frames will ever be detected as combed). This setting is known
  6524. as @option{MI} in TFM/VFM vocabulary.
  6525. Default value is @code{80}.
  6526. @end table
  6527. @anchor{p/c/n/u/b meaning}
  6528. @subsection p/c/n/u/b meaning
  6529. @subsubsection p/c/n
  6530. We assume the following telecined stream:
  6531. @example
  6532. Top fields: 1 2 2 3 4
  6533. Bottom fields: 1 2 3 4 4
  6534. @end example
  6535. The numbers correspond to the progressive frame the fields relate to. Here, the
  6536. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6537. When @code{fieldmatch} is configured to run a matching from bottom
  6538. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6539. @example
  6540. Input stream:
  6541. T 1 2 2 3 4
  6542. B 1 2 3 4 4 <-- matching reference
  6543. Matches: c c n n c
  6544. Output stream:
  6545. T 1 2 3 4 4
  6546. B 1 2 3 4 4
  6547. @end example
  6548. As a result of the field matching, we can see that some frames get duplicated.
  6549. To perform a complete inverse telecine, you need to rely on a decimation filter
  6550. after this operation. See for instance the @ref{decimate} filter.
  6551. The same operation now matching from top fields (@option{field}=@var{top})
  6552. looks like this:
  6553. @example
  6554. Input stream:
  6555. T 1 2 2 3 4 <-- matching reference
  6556. B 1 2 3 4 4
  6557. Matches: c c p p c
  6558. Output stream:
  6559. T 1 2 2 3 4
  6560. B 1 2 2 3 4
  6561. @end example
  6562. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6563. basically, they refer to the frame and field of the opposite parity:
  6564. @itemize
  6565. @item @var{p} matches the field of the opposite parity in the previous frame
  6566. @item @var{c} matches the field of the opposite parity in the current frame
  6567. @item @var{n} matches the field of the opposite parity in the next frame
  6568. @end itemize
  6569. @subsubsection u/b
  6570. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6571. from the opposite parity flag. In the following examples, we assume that we are
  6572. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6573. 'x' is placed above and below each matched fields.
  6574. With bottom matching (@option{field}=@var{bottom}):
  6575. @example
  6576. Match: c p n b u
  6577. x x x x x
  6578. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6579. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6580. x x x x x
  6581. Output frames:
  6582. 2 1 2 2 2
  6583. 2 2 2 1 3
  6584. @end example
  6585. With top matching (@option{field}=@var{top}):
  6586. @example
  6587. Match: c p n b u
  6588. x x x x x
  6589. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6590. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6591. x x x x x
  6592. Output frames:
  6593. 2 2 2 1 2
  6594. 2 1 3 2 2
  6595. @end example
  6596. @subsection Examples
  6597. Simple IVTC of a top field first telecined stream:
  6598. @example
  6599. fieldmatch=order=tff:combmatch=none, decimate
  6600. @end example
  6601. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6602. @example
  6603. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6604. @end example
  6605. @section fieldorder
  6606. Transform the field order of the input video.
  6607. It accepts the following parameters:
  6608. @table @option
  6609. @item order
  6610. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6611. for bottom field first.
  6612. @end table
  6613. The default value is @samp{tff}.
  6614. The transformation is done by shifting the picture content up or down
  6615. by one line, and filling the remaining line with appropriate picture content.
  6616. This method is consistent with most broadcast field order converters.
  6617. If the input video is not flagged as being interlaced, or it is already
  6618. flagged as being of the required output field order, then this filter does
  6619. not alter the incoming video.
  6620. It is very useful when converting to or from PAL DV material,
  6621. which is bottom field first.
  6622. For example:
  6623. @example
  6624. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6625. @end example
  6626. @section fifo, afifo
  6627. Buffer input images and send them when they are requested.
  6628. It is mainly useful when auto-inserted by the libavfilter
  6629. framework.
  6630. It does not take parameters.
  6631. @section fillborders
  6632. Fill borders of the input video, without changing video stream dimensions.
  6633. Sometimes video can have garbage at the four edges and you may not want to
  6634. crop video input to keep size multiple of some number.
  6635. This filter accepts the following options:
  6636. @table @option
  6637. @item left
  6638. Number of pixels to fill from left border.
  6639. @item right
  6640. Number of pixels to fill from right border.
  6641. @item top
  6642. Number of pixels to fill from top border.
  6643. @item bottom
  6644. Number of pixels to fill from bottom border.
  6645. @item mode
  6646. Set fill mode.
  6647. It accepts the following values:
  6648. @table @samp
  6649. @item smear
  6650. fill pixels using outermost pixels
  6651. @item mirror
  6652. fill pixels using mirroring
  6653. @item fixed
  6654. fill pixels with constant value
  6655. @end table
  6656. Default is @var{smear}.
  6657. @item color
  6658. Set color for pixels in fixed mode. Default is @var{black}.
  6659. @end table
  6660. @section find_rect
  6661. Find a rectangular object
  6662. It accepts the following options:
  6663. @table @option
  6664. @item object
  6665. Filepath of the object image, needs to be in gray8.
  6666. @item threshold
  6667. Detection threshold, default is 0.5.
  6668. @item mipmaps
  6669. Number of mipmaps, default is 3.
  6670. @item xmin, ymin, xmax, ymax
  6671. Specifies the rectangle in which to search.
  6672. @end table
  6673. @subsection Examples
  6674. @itemize
  6675. @item
  6676. Generate a representative palette of a given video using @command{ffmpeg}:
  6677. @example
  6678. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6679. @end example
  6680. @end itemize
  6681. @section cover_rect
  6682. Cover a rectangular object
  6683. It accepts the following options:
  6684. @table @option
  6685. @item cover
  6686. Filepath of the optional cover image, needs to be in yuv420.
  6687. @item mode
  6688. Set covering mode.
  6689. It accepts the following values:
  6690. @table @samp
  6691. @item cover
  6692. cover it by the supplied image
  6693. @item blur
  6694. cover it by interpolating the surrounding pixels
  6695. @end table
  6696. Default value is @var{blur}.
  6697. @end table
  6698. @subsection Examples
  6699. @itemize
  6700. @item
  6701. Generate a representative palette of a given video using @command{ffmpeg}:
  6702. @example
  6703. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6704. @end example
  6705. @end itemize
  6706. @section floodfill
  6707. Flood area with values of same pixel components with another values.
  6708. It accepts the following options:
  6709. @table @option
  6710. @item x
  6711. Set pixel x coordinate.
  6712. @item y
  6713. Set pixel y coordinate.
  6714. @item s0
  6715. Set source #0 component value.
  6716. @item s1
  6717. Set source #1 component value.
  6718. @item s2
  6719. Set source #2 component value.
  6720. @item s3
  6721. Set source #3 component value.
  6722. @item d0
  6723. Set destination #0 component value.
  6724. @item d1
  6725. Set destination #1 component value.
  6726. @item d2
  6727. Set destination #2 component value.
  6728. @item d3
  6729. Set destination #3 component value.
  6730. @end table
  6731. @anchor{format}
  6732. @section format
  6733. Convert the input video to one of the specified pixel formats.
  6734. Libavfilter will try to pick one that is suitable as input to
  6735. the next filter.
  6736. It accepts the following parameters:
  6737. @table @option
  6738. @item pix_fmts
  6739. A '|'-separated list of pixel format names, such as
  6740. "pix_fmts=yuv420p|monow|rgb24".
  6741. @end table
  6742. @subsection Examples
  6743. @itemize
  6744. @item
  6745. Convert the input video to the @var{yuv420p} format
  6746. @example
  6747. format=pix_fmts=yuv420p
  6748. @end example
  6749. Convert the input video to any of the formats in the list
  6750. @example
  6751. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6752. @end example
  6753. @end itemize
  6754. @anchor{fps}
  6755. @section fps
  6756. Convert the video to specified constant frame rate by duplicating or dropping
  6757. frames as necessary.
  6758. It accepts the following parameters:
  6759. @table @option
  6760. @item fps
  6761. The desired output frame rate. The default is @code{25}.
  6762. @item start_time
  6763. Assume the first PTS should be the given value, in seconds. This allows for
  6764. padding/trimming at the start of stream. By default, no assumption is made
  6765. about the first frame's expected PTS, so no padding or trimming is done.
  6766. For example, this could be set to 0 to pad the beginning with duplicates of
  6767. the first frame if a video stream starts after the audio stream or to trim any
  6768. frames with a negative PTS.
  6769. @item round
  6770. Timestamp (PTS) rounding method.
  6771. Possible values are:
  6772. @table @option
  6773. @item zero
  6774. round towards 0
  6775. @item inf
  6776. round away from 0
  6777. @item down
  6778. round towards -infinity
  6779. @item up
  6780. round towards +infinity
  6781. @item near
  6782. round to nearest
  6783. @end table
  6784. The default is @code{near}.
  6785. @item eof_action
  6786. Action performed when reading the last frame.
  6787. Possible values are:
  6788. @table @option
  6789. @item round
  6790. Use same timestamp rounding method as used for other frames.
  6791. @item pass
  6792. Pass through last frame if input duration has not been reached yet.
  6793. @end table
  6794. The default is @code{round}.
  6795. @end table
  6796. Alternatively, the options can be specified as a flat string:
  6797. @var{fps}[:@var{start_time}[:@var{round}]].
  6798. See also the @ref{setpts} filter.
  6799. @subsection Examples
  6800. @itemize
  6801. @item
  6802. A typical usage in order to set the fps to 25:
  6803. @example
  6804. fps=fps=25
  6805. @end example
  6806. @item
  6807. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6808. @example
  6809. fps=fps=film:round=near
  6810. @end example
  6811. @end itemize
  6812. @section framepack
  6813. Pack two different video streams into a stereoscopic video, setting proper
  6814. metadata on supported codecs. The two views should have the same size and
  6815. framerate and processing will stop when the shorter video ends. Please note
  6816. that you may conveniently adjust view properties with the @ref{scale} and
  6817. @ref{fps} filters.
  6818. It accepts the following parameters:
  6819. @table @option
  6820. @item format
  6821. The desired packing format. Supported values are:
  6822. @table @option
  6823. @item sbs
  6824. The views are next to each other (default).
  6825. @item tab
  6826. The views are on top of each other.
  6827. @item lines
  6828. The views are packed by line.
  6829. @item columns
  6830. The views are packed by column.
  6831. @item frameseq
  6832. The views are temporally interleaved.
  6833. @end table
  6834. @end table
  6835. Some examples:
  6836. @example
  6837. # Convert left and right views into a frame-sequential video
  6838. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6839. # Convert views into a side-by-side video with the same output resolution as the input
  6840. 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
  6841. @end example
  6842. @section framerate
  6843. Change the frame rate by interpolating new video output frames from the source
  6844. frames.
  6845. This filter is not designed to function correctly with interlaced media. If
  6846. you wish to change the frame rate of interlaced media then you are required
  6847. to deinterlace before this filter and re-interlace after this filter.
  6848. A description of the accepted options follows.
  6849. @table @option
  6850. @item fps
  6851. Specify the output frames per second. This option can also be specified
  6852. as a value alone. The default is @code{50}.
  6853. @item interp_start
  6854. Specify the start of a range where the output frame will be created as a
  6855. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6856. the default is @code{15}.
  6857. @item interp_end
  6858. Specify the end of a range where the output frame will be created as a
  6859. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6860. the default is @code{240}.
  6861. @item scene
  6862. Specify the level at which a scene change is detected as a value between
  6863. 0 and 100 to indicate a new scene; a low value reflects a low
  6864. probability for the current frame to introduce a new scene, while a higher
  6865. value means the current frame is more likely to be one.
  6866. The default is @code{7}.
  6867. @item flags
  6868. Specify flags influencing the filter process.
  6869. Available value for @var{flags} is:
  6870. @table @option
  6871. @item scene_change_detect, scd
  6872. Enable scene change detection using the value of the option @var{scene}.
  6873. This flag is enabled by default.
  6874. @end table
  6875. @end table
  6876. @section framestep
  6877. Select one frame every N-th frame.
  6878. This filter accepts the following option:
  6879. @table @option
  6880. @item step
  6881. Select frame after every @code{step} frames.
  6882. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6883. @end table
  6884. @anchor{frei0r}
  6885. @section frei0r
  6886. Apply a frei0r effect to the input video.
  6887. To enable the compilation of this filter, you need to install the frei0r
  6888. header and configure FFmpeg with @code{--enable-frei0r}.
  6889. It accepts the following parameters:
  6890. @table @option
  6891. @item filter_name
  6892. The name of the frei0r effect to load. If the environment variable
  6893. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6894. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6895. Otherwise, the standard frei0r paths are searched, in this order:
  6896. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6897. @file{/usr/lib/frei0r-1/}.
  6898. @item filter_params
  6899. A '|'-separated list of parameters to pass to the frei0r effect.
  6900. @end table
  6901. A frei0r effect parameter can be a boolean (its value is either
  6902. "y" or "n"), a double, a color (specified as
  6903. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6904. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6905. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6906. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6907. The number and types of parameters depend on the loaded effect. If an
  6908. effect parameter is not specified, the default value is set.
  6909. @subsection Examples
  6910. @itemize
  6911. @item
  6912. Apply the distort0r effect, setting the first two double parameters:
  6913. @example
  6914. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6915. @end example
  6916. @item
  6917. Apply the colordistance effect, taking a color as the first parameter:
  6918. @example
  6919. frei0r=colordistance:0.2/0.3/0.4
  6920. frei0r=colordistance:violet
  6921. frei0r=colordistance:0x112233
  6922. @end example
  6923. @item
  6924. Apply the perspective effect, specifying the top left and top right image
  6925. positions:
  6926. @example
  6927. frei0r=perspective:0.2/0.2|0.8/0.2
  6928. @end example
  6929. @end itemize
  6930. For more information, see
  6931. @url{http://frei0r.dyne.org}
  6932. @section fspp
  6933. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6934. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6935. processing filter, one of them is performed once per block, not per pixel.
  6936. This allows for much higher speed.
  6937. The filter accepts the following options:
  6938. @table @option
  6939. @item quality
  6940. Set quality. This option defines the number of levels for averaging. It accepts
  6941. an integer in the range 4-5. Default value is @code{4}.
  6942. @item qp
  6943. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6944. If not set, the filter will use the QP from the video stream (if available).
  6945. @item strength
  6946. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6947. more details but also more artifacts, while higher values make the image smoother
  6948. but also blurrier. Default value is @code{0} − PSNR optimal.
  6949. @item use_bframe_qp
  6950. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6951. option may cause flicker since the B-Frames have often larger QP. Default is
  6952. @code{0} (not enabled).
  6953. @end table
  6954. @section gblur
  6955. Apply Gaussian blur filter.
  6956. The filter accepts the following options:
  6957. @table @option
  6958. @item sigma
  6959. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6960. @item steps
  6961. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6962. @item planes
  6963. Set which planes to filter. By default all planes are filtered.
  6964. @item sigmaV
  6965. Set vertical sigma, if negative it will be same as @code{sigma}.
  6966. Default is @code{-1}.
  6967. @end table
  6968. @section geq
  6969. The filter accepts the following options:
  6970. @table @option
  6971. @item lum_expr, lum
  6972. Set the luminance expression.
  6973. @item cb_expr, cb
  6974. Set the chrominance blue expression.
  6975. @item cr_expr, cr
  6976. Set the chrominance red expression.
  6977. @item alpha_expr, a
  6978. Set the alpha expression.
  6979. @item red_expr, r
  6980. Set the red expression.
  6981. @item green_expr, g
  6982. Set the green expression.
  6983. @item blue_expr, b
  6984. Set the blue expression.
  6985. @end table
  6986. The colorspace is selected according to the specified options. If one
  6987. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6988. options is specified, the filter will automatically select a YCbCr
  6989. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6990. @option{blue_expr} options is specified, it will select an RGB
  6991. colorspace.
  6992. If one of the chrominance expression is not defined, it falls back on the other
  6993. one. If no alpha expression is specified it will evaluate to opaque value.
  6994. If none of chrominance expressions are specified, they will evaluate
  6995. to the luminance expression.
  6996. The expressions can use the following variables and functions:
  6997. @table @option
  6998. @item N
  6999. The sequential number of the filtered frame, starting from @code{0}.
  7000. @item X
  7001. @item Y
  7002. The coordinates of the current sample.
  7003. @item W
  7004. @item H
  7005. The width and height of the image.
  7006. @item SW
  7007. @item SH
  7008. Width and height scale depending on the currently filtered plane. It is the
  7009. ratio between the corresponding luma plane number of pixels and the current
  7010. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7011. @code{0.5,0.5} for chroma planes.
  7012. @item T
  7013. Time of the current frame, expressed in seconds.
  7014. @item p(x, y)
  7015. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7016. plane.
  7017. @item lum(x, y)
  7018. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7019. plane.
  7020. @item cb(x, y)
  7021. Return the value of the pixel at location (@var{x},@var{y}) of the
  7022. blue-difference chroma plane. Return 0 if there is no such plane.
  7023. @item cr(x, y)
  7024. Return the value of the pixel at location (@var{x},@var{y}) of the
  7025. red-difference chroma plane. Return 0 if there is no such plane.
  7026. @item r(x, y)
  7027. @item g(x, y)
  7028. @item b(x, y)
  7029. Return the value of the pixel at location (@var{x},@var{y}) of the
  7030. red/green/blue component. Return 0 if there is no such component.
  7031. @item alpha(x, y)
  7032. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7033. plane. Return 0 if there is no such plane.
  7034. @end table
  7035. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7036. automatically clipped to the closer edge.
  7037. @subsection Examples
  7038. @itemize
  7039. @item
  7040. Flip the image horizontally:
  7041. @example
  7042. geq=p(W-X\,Y)
  7043. @end example
  7044. @item
  7045. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7046. wavelength of 100 pixels:
  7047. @example
  7048. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7049. @end example
  7050. @item
  7051. Generate a fancy enigmatic moving light:
  7052. @example
  7053. 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
  7054. @end example
  7055. @item
  7056. Generate a quick emboss effect:
  7057. @example
  7058. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7059. @end example
  7060. @item
  7061. Modify RGB components depending on pixel position:
  7062. @example
  7063. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7064. @end example
  7065. @item
  7066. Create a radial gradient that is the same size as the input (also see
  7067. the @ref{vignette} filter):
  7068. @example
  7069. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7070. @end example
  7071. @end itemize
  7072. @section gradfun
  7073. Fix the banding artifacts that are sometimes introduced into nearly flat
  7074. regions by truncation to 8-bit color depth.
  7075. Interpolate the gradients that should go where the bands are, and
  7076. dither them.
  7077. It is designed for playback only. Do not use it prior to
  7078. lossy compression, because compression tends to lose the dither and
  7079. bring back the bands.
  7080. It accepts the following parameters:
  7081. @table @option
  7082. @item strength
  7083. The maximum amount by which the filter will change any one pixel. This is also
  7084. the threshold for detecting nearly flat regions. Acceptable values range from
  7085. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7086. valid range.
  7087. @item radius
  7088. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7089. gradients, but also prevents the filter from modifying the pixels near detailed
  7090. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7091. values will be clipped to the valid range.
  7092. @end table
  7093. Alternatively, the options can be specified as a flat string:
  7094. @var{strength}[:@var{radius}]
  7095. @subsection Examples
  7096. @itemize
  7097. @item
  7098. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7099. @example
  7100. gradfun=3.5:8
  7101. @end example
  7102. @item
  7103. Specify radius, omitting the strength (which will fall-back to the default
  7104. value):
  7105. @example
  7106. gradfun=radius=8
  7107. @end example
  7108. @end itemize
  7109. @anchor{haldclut}
  7110. @section haldclut
  7111. Apply a Hald CLUT to a video stream.
  7112. First input is the video stream to process, and second one is the Hald CLUT.
  7113. The Hald CLUT input can be a simple picture or a complete video stream.
  7114. The filter accepts the following options:
  7115. @table @option
  7116. @item shortest
  7117. Force termination when the shortest input terminates. Default is @code{0}.
  7118. @item repeatlast
  7119. Continue applying the last CLUT after the end of the stream. A value of
  7120. @code{0} disable the filter after the last frame of the CLUT is reached.
  7121. Default is @code{1}.
  7122. @end table
  7123. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7124. filters share the same internals).
  7125. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7126. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7127. @subsection Workflow examples
  7128. @subsubsection Hald CLUT video stream
  7129. Generate an identity Hald CLUT stream altered with various effects:
  7130. @example
  7131. 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
  7132. @end example
  7133. Note: make sure you use a lossless codec.
  7134. Then use it with @code{haldclut} to apply it on some random stream:
  7135. @example
  7136. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7137. @end example
  7138. The Hald CLUT will be applied to the 10 first seconds (duration of
  7139. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7140. to the remaining frames of the @code{mandelbrot} stream.
  7141. @subsubsection Hald CLUT with preview
  7142. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7143. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7144. biggest possible square starting at the top left of the picture. The remaining
  7145. padding pixels (bottom or right) will be ignored. This area can be used to add
  7146. a preview of the Hald CLUT.
  7147. Typically, the following generated Hald CLUT will be supported by the
  7148. @code{haldclut} filter:
  7149. @example
  7150. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7151. pad=iw+320 [padded_clut];
  7152. smptebars=s=320x256, split [a][b];
  7153. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7154. [main][b] overlay=W-320" -frames:v 1 clut.png
  7155. @end example
  7156. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7157. bars are displayed on the right-top, and below the same color bars processed by
  7158. the color changes.
  7159. Then, the effect of this Hald CLUT can be visualized with:
  7160. @example
  7161. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7162. @end example
  7163. @section hflip
  7164. Flip the input video horizontally.
  7165. For example, to horizontally flip the input video with @command{ffmpeg}:
  7166. @example
  7167. ffmpeg -i in.avi -vf "hflip" out.avi
  7168. @end example
  7169. @section histeq
  7170. This filter applies a global color histogram equalization on a
  7171. per-frame basis.
  7172. It can be used to correct video that has a compressed range of pixel
  7173. intensities. The filter redistributes the pixel intensities to
  7174. equalize their distribution across the intensity range. It may be
  7175. viewed as an "automatically adjusting contrast filter". This filter is
  7176. useful only for correcting degraded or poorly captured source
  7177. video.
  7178. The filter accepts the following options:
  7179. @table @option
  7180. @item strength
  7181. Determine the amount of equalization to be applied. As the strength
  7182. is reduced, the distribution of pixel intensities more-and-more
  7183. approaches that of the input frame. The value must be a float number
  7184. in the range [0,1] and defaults to 0.200.
  7185. @item intensity
  7186. Set the maximum intensity that can generated and scale the output
  7187. values appropriately. The strength should be set as desired and then
  7188. the intensity can be limited if needed to avoid washing-out. The value
  7189. must be a float number in the range [0,1] and defaults to 0.210.
  7190. @item antibanding
  7191. Set the antibanding level. If enabled the filter will randomly vary
  7192. the luminance of output pixels by a small amount to avoid banding of
  7193. the histogram. Possible values are @code{none}, @code{weak} or
  7194. @code{strong}. It defaults to @code{none}.
  7195. @end table
  7196. @section histogram
  7197. Compute and draw a color distribution histogram for the input video.
  7198. The computed histogram is a representation of the color component
  7199. distribution in an image.
  7200. Standard histogram displays the color components distribution in an image.
  7201. Displays color graph for each color component. Shows distribution of
  7202. the Y, U, V, A or R, G, B components, depending on input format, in the
  7203. current frame. Below each graph a color component scale meter is shown.
  7204. The filter accepts the following options:
  7205. @table @option
  7206. @item level_height
  7207. Set height of level. Default value is @code{200}.
  7208. Allowed range is [50, 2048].
  7209. @item scale_height
  7210. Set height of color scale. Default value is @code{12}.
  7211. Allowed range is [0, 40].
  7212. @item display_mode
  7213. Set display mode.
  7214. It accepts the following values:
  7215. @table @samp
  7216. @item stack
  7217. Per color component graphs are placed below each other.
  7218. @item parade
  7219. Per color component graphs are placed side by side.
  7220. @item overlay
  7221. Presents information identical to that in the @code{parade}, except
  7222. that the graphs representing color components are superimposed directly
  7223. over one another.
  7224. @end table
  7225. Default is @code{stack}.
  7226. @item levels_mode
  7227. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7228. Default is @code{linear}.
  7229. @item components
  7230. Set what color components to display.
  7231. Default is @code{7}.
  7232. @item fgopacity
  7233. Set foreground opacity. Default is @code{0.7}.
  7234. @item bgopacity
  7235. Set background opacity. Default is @code{0.5}.
  7236. @end table
  7237. @subsection Examples
  7238. @itemize
  7239. @item
  7240. Calculate and draw histogram:
  7241. @example
  7242. ffplay -i input -vf histogram
  7243. @end example
  7244. @end itemize
  7245. @anchor{hqdn3d}
  7246. @section hqdn3d
  7247. This is a high precision/quality 3d denoise filter. It aims to reduce
  7248. image noise, producing smooth images and making still images really
  7249. still. It should enhance compressibility.
  7250. It accepts the following optional parameters:
  7251. @table @option
  7252. @item luma_spatial
  7253. A non-negative floating point number which specifies spatial luma strength.
  7254. It defaults to 4.0.
  7255. @item chroma_spatial
  7256. A non-negative floating point number which specifies spatial chroma strength.
  7257. It defaults to 3.0*@var{luma_spatial}/4.0.
  7258. @item luma_tmp
  7259. A floating point number which specifies luma temporal strength. It defaults to
  7260. 6.0*@var{luma_spatial}/4.0.
  7261. @item chroma_tmp
  7262. A floating point number which specifies chroma temporal strength. It defaults to
  7263. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7264. @end table
  7265. @section hwdownload
  7266. Download hardware frames to system memory.
  7267. The input must be in hardware frames, and the output a non-hardware format.
  7268. Not all formats will be supported on the output - it may be necessary to insert
  7269. an additional @option{format} filter immediately following in the graph to get
  7270. the output in a supported format.
  7271. @section hwmap
  7272. Map hardware frames to system memory or to another device.
  7273. This filter has several different modes of operation; which one is used depends
  7274. on the input and output formats:
  7275. @itemize
  7276. @item
  7277. Hardware frame input, normal frame output
  7278. Map the input frames to system memory and pass them to the output. If the
  7279. original hardware frame is later required (for example, after overlaying
  7280. something else on part of it), the @option{hwmap} filter can be used again
  7281. in the next mode to retrieve it.
  7282. @item
  7283. Normal frame input, hardware frame output
  7284. If the input is actually a software-mapped hardware frame, then unmap it -
  7285. that is, return the original hardware frame.
  7286. Otherwise, a device must be provided. Create new hardware surfaces on that
  7287. device for the output, then map them back to the software format at the input
  7288. and give those frames to the preceding filter. This will then act like the
  7289. @option{hwupload} filter, but may be able to avoid an additional copy when
  7290. the input is already in a compatible format.
  7291. @item
  7292. Hardware frame input and output
  7293. A device must be supplied for the output, either directly or with the
  7294. @option{derive_device} option. The input and output devices must be of
  7295. different types and compatible - the exact meaning of this is
  7296. system-dependent, but typically it means that they must refer to the same
  7297. underlying hardware context (for example, refer to the same graphics card).
  7298. If the input frames were originally created on the output device, then unmap
  7299. to retrieve the original frames.
  7300. Otherwise, map the frames to the output device - create new hardware frames
  7301. on the output corresponding to the frames on the input.
  7302. @end itemize
  7303. The following additional parameters are accepted:
  7304. @table @option
  7305. @item mode
  7306. Set the frame mapping mode. Some combination of:
  7307. @table @var
  7308. @item read
  7309. The mapped frame should be readable.
  7310. @item write
  7311. The mapped frame should be writeable.
  7312. @item overwrite
  7313. The mapping will always overwrite the entire frame.
  7314. This may improve performance in some cases, as the original contents of the
  7315. frame need not be loaded.
  7316. @item direct
  7317. The mapping must not involve any copying.
  7318. Indirect mappings to copies of frames are created in some cases where either
  7319. direct mapping is not possible or it would have unexpected properties.
  7320. Setting this flag ensures that the mapping is direct and will fail if that is
  7321. not possible.
  7322. @end table
  7323. Defaults to @var{read+write} if not specified.
  7324. @item derive_device @var{type}
  7325. Rather than using the device supplied at initialisation, instead derive a new
  7326. device of type @var{type} from the device the input frames exist on.
  7327. @item reverse
  7328. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7329. and map them back to the source. This may be necessary in some cases where
  7330. a mapping in one direction is required but only the opposite direction is
  7331. supported by the devices being used.
  7332. This option is dangerous - it may break the preceding filter in undefined
  7333. ways if there are any additional constraints on that filter's output.
  7334. Do not use it without fully understanding the implications of its use.
  7335. @end table
  7336. @section hwupload
  7337. Upload system memory frames to hardware surfaces.
  7338. The device to upload to must be supplied when the filter is initialised. If
  7339. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7340. option.
  7341. @anchor{hwupload_cuda}
  7342. @section hwupload_cuda
  7343. Upload system memory frames to a CUDA device.
  7344. It accepts the following optional parameters:
  7345. @table @option
  7346. @item device
  7347. The number of the CUDA device to use
  7348. @end table
  7349. @section hqx
  7350. Apply a high-quality magnification filter designed for pixel art. This filter
  7351. was originally created by Maxim Stepin.
  7352. It accepts the following option:
  7353. @table @option
  7354. @item n
  7355. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7356. @code{hq3x} and @code{4} for @code{hq4x}.
  7357. Default is @code{3}.
  7358. @end table
  7359. @section hstack
  7360. Stack input videos horizontally.
  7361. All streams must be of same pixel format and of same height.
  7362. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7363. to create same output.
  7364. The filter accept the following option:
  7365. @table @option
  7366. @item inputs
  7367. Set number of input streams. Default is 2.
  7368. @item shortest
  7369. If set to 1, force the output to terminate when the shortest input
  7370. terminates. Default value is 0.
  7371. @end table
  7372. @section hue
  7373. Modify the hue and/or the saturation of the input.
  7374. It accepts the following parameters:
  7375. @table @option
  7376. @item h
  7377. Specify the hue angle as a number of degrees. It accepts an expression,
  7378. and defaults to "0".
  7379. @item s
  7380. Specify the saturation in the [-10,10] range. It accepts an expression and
  7381. defaults to "1".
  7382. @item H
  7383. Specify the hue angle as a number of radians. It accepts an
  7384. expression, and defaults to "0".
  7385. @item b
  7386. Specify the brightness in the [-10,10] range. It accepts an expression and
  7387. defaults to "0".
  7388. @end table
  7389. @option{h} and @option{H} are mutually exclusive, and can't be
  7390. specified at the same time.
  7391. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7392. expressions containing the following constants:
  7393. @table @option
  7394. @item n
  7395. frame count of the input frame starting from 0
  7396. @item pts
  7397. presentation timestamp of the input frame expressed in time base units
  7398. @item r
  7399. frame rate of the input video, NAN if the input frame rate is unknown
  7400. @item t
  7401. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7402. @item tb
  7403. time base of the input video
  7404. @end table
  7405. @subsection Examples
  7406. @itemize
  7407. @item
  7408. Set the hue to 90 degrees and the saturation to 1.0:
  7409. @example
  7410. hue=h=90:s=1
  7411. @end example
  7412. @item
  7413. Same command but expressing the hue in radians:
  7414. @example
  7415. hue=H=PI/2:s=1
  7416. @end example
  7417. @item
  7418. Rotate hue and make the saturation swing between 0
  7419. and 2 over a period of 1 second:
  7420. @example
  7421. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7422. @end example
  7423. @item
  7424. Apply a 3 seconds saturation fade-in effect starting at 0:
  7425. @example
  7426. hue="s=min(t/3\,1)"
  7427. @end example
  7428. The general fade-in expression can be written as:
  7429. @example
  7430. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7431. @end example
  7432. @item
  7433. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7434. @example
  7435. hue="s=max(0\, min(1\, (8-t)/3))"
  7436. @end example
  7437. The general fade-out expression can be written as:
  7438. @example
  7439. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7440. @end example
  7441. @end itemize
  7442. @subsection Commands
  7443. This filter supports the following commands:
  7444. @table @option
  7445. @item b
  7446. @item s
  7447. @item h
  7448. @item H
  7449. Modify the hue and/or the saturation and/or brightness of the input video.
  7450. The command accepts the same syntax of the corresponding option.
  7451. If the specified expression is not valid, it is kept at its current
  7452. value.
  7453. @end table
  7454. @section hysteresis
  7455. Grow first stream into second stream by connecting components.
  7456. This makes it possible to build more robust edge masks.
  7457. This filter accepts the following options:
  7458. @table @option
  7459. @item planes
  7460. Set which planes will be processed as bitmap, unprocessed planes will be
  7461. copied from first stream.
  7462. By default value 0xf, all planes will be processed.
  7463. @item threshold
  7464. Set threshold which is used in filtering. If pixel component value is higher than
  7465. this value filter algorithm for connecting components is activated.
  7466. By default value is 0.
  7467. @end table
  7468. @section idet
  7469. Detect video interlacing type.
  7470. This filter tries to detect if the input frames are interlaced, progressive,
  7471. top or bottom field first. It will also try to detect fields that are
  7472. repeated between adjacent frames (a sign of telecine).
  7473. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7474. Multiple frame detection incorporates the classification history of previous frames.
  7475. The filter will log these metadata values:
  7476. @table @option
  7477. @item single.current_frame
  7478. Detected type of current frame using single-frame detection. One of:
  7479. ``tff'' (top field first), ``bff'' (bottom field first),
  7480. ``progressive'', or ``undetermined''
  7481. @item single.tff
  7482. Cumulative number of frames detected as top field first using single-frame detection.
  7483. @item multiple.tff
  7484. Cumulative number of frames detected as top field first using multiple-frame detection.
  7485. @item single.bff
  7486. Cumulative number of frames detected as bottom field first using single-frame detection.
  7487. @item multiple.current_frame
  7488. Detected type of current frame using multiple-frame detection. One of:
  7489. ``tff'' (top field first), ``bff'' (bottom field first),
  7490. ``progressive'', or ``undetermined''
  7491. @item multiple.bff
  7492. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7493. @item single.progressive
  7494. Cumulative number of frames detected as progressive using single-frame detection.
  7495. @item multiple.progressive
  7496. Cumulative number of frames detected as progressive using multiple-frame detection.
  7497. @item single.undetermined
  7498. Cumulative number of frames that could not be classified using single-frame detection.
  7499. @item multiple.undetermined
  7500. Cumulative number of frames that could not be classified using multiple-frame detection.
  7501. @item repeated.current_frame
  7502. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7503. @item repeated.neither
  7504. Cumulative number of frames with no repeated field.
  7505. @item repeated.top
  7506. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7507. @item repeated.bottom
  7508. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7509. @end table
  7510. The filter accepts the following options:
  7511. @table @option
  7512. @item intl_thres
  7513. Set interlacing threshold.
  7514. @item prog_thres
  7515. Set progressive threshold.
  7516. @item rep_thres
  7517. Threshold for repeated field detection.
  7518. @item half_life
  7519. Number of frames after which a given frame's contribution to the
  7520. statistics is halved (i.e., it contributes only 0.5 to its
  7521. classification). The default of 0 means that all frames seen are given
  7522. full weight of 1.0 forever.
  7523. @item analyze_interlaced_flag
  7524. When this is not 0 then idet will use the specified number of frames to determine
  7525. if the interlaced flag is accurate, it will not count undetermined frames.
  7526. If the flag is found to be accurate it will be used without any further
  7527. computations, if it is found to be inaccurate it will be cleared without any
  7528. further computations. This allows inserting the idet filter as a low computational
  7529. method to clean up the interlaced flag
  7530. @end table
  7531. @section il
  7532. Deinterleave or interleave fields.
  7533. This filter allows one to process interlaced images fields without
  7534. deinterlacing them. Deinterleaving splits the input frame into 2
  7535. fields (so called half pictures). Odd lines are moved to the top
  7536. half of the output image, even lines to the bottom half.
  7537. You can process (filter) them independently and then re-interleave them.
  7538. The filter accepts the following options:
  7539. @table @option
  7540. @item luma_mode, l
  7541. @item chroma_mode, c
  7542. @item alpha_mode, a
  7543. Available values for @var{luma_mode}, @var{chroma_mode} and
  7544. @var{alpha_mode} are:
  7545. @table @samp
  7546. @item none
  7547. Do nothing.
  7548. @item deinterleave, d
  7549. Deinterleave fields, placing one above the other.
  7550. @item interleave, i
  7551. Interleave fields. Reverse the effect of deinterleaving.
  7552. @end table
  7553. Default value is @code{none}.
  7554. @item luma_swap, ls
  7555. @item chroma_swap, cs
  7556. @item alpha_swap, as
  7557. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7558. @end table
  7559. @section inflate
  7560. Apply inflate effect to the video.
  7561. This filter replaces the pixel by the local(3x3) average by taking into account
  7562. only values higher than the pixel.
  7563. It accepts the following options:
  7564. @table @option
  7565. @item threshold0
  7566. @item threshold1
  7567. @item threshold2
  7568. @item threshold3
  7569. Limit the maximum change for each plane, default is 65535.
  7570. If 0, plane will remain unchanged.
  7571. @end table
  7572. @section interlace
  7573. Simple interlacing filter from progressive contents. This interleaves upper (or
  7574. lower) lines from odd frames with lower (or upper) lines from even frames,
  7575. halving the frame rate and preserving image height.
  7576. @example
  7577. Original Original New Frame
  7578. Frame 'j' Frame 'j+1' (tff)
  7579. ========== =========== ==================
  7580. Line 0 --------------------> Frame 'j' Line 0
  7581. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7582. Line 2 ---------------------> Frame 'j' Line 2
  7583. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7584. ... ... ...
  7585. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7586. @end example
  7587. It accepts the following optional parameters:
  7588. @table @option
  7589. @item scan
  7590. This determines whether the interlaced frame is taken from the even
  7591. (tff - default) or odd (bff) lines of the progressive frame.
  7592. @item lowpass
  7593. Vertical lowpass filter to avoid twitter interlacing and
  7594. reduce moire patterns.
  7595. @table @samp
  7596. @item 0, off
  7597. Disable vertical lowpass filter
  7598. @item 1, linear
  7599. Enable linear filter (default)
  7600. @item 2, complex
  7601. Enable complex filter. This will slightly less reduce twitter and moire
  7602. but better retain detail and subjective sharpness impression.
  7603. @end table
  7604. @end table
  7605. @section kerndeint
  7606. Deinterlace input video by applying Donald Graft's adaptive kernel
  7607. deinterling. Work on interlaced parts of a video to produce
  7608. progressive frames.
  7609. The description of the accepted parameters follows.
  7610. @table @option
  7611. @item thresh
  7612. Set the threshold which affects the filter's tolerance when
  7613. determining if a pixel line must be processed. It must be an integer
  7614. in the range [0,255] and defaults to 10. A value of 0 will result in
  7615. applying the process on every pixels.
  7616. @item map
  7617. Paint pixels exceeding the threshold value to white if set to 1.
  7618. Default is 0.
  7619. @item order
  7620. Set the fields order. Swap fields if set to 1, leave fields alone if
  7621. 0. Default is 0.
  7622. @item sharp
  7623. Enable additional sharpening if set to 1. Default is 0.
  7624. @item twoway
  7625. Enable twoway sharpening if set to 1. Default is 0.
  7626. @end table
  7627. @subsection Examples
  7628. @itemize
  7629. @item
  7630. Apply default values:
  7631. @example
  7632. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7633. @end example
  7634. @item
  7635. Enable additional sharpening:
  7636. @example
  7637. kerndeint=sharp=1
  7638. @end example
  7639. @item
  7640. Paint processed pixels in white:
  7641. @example
  7642. kerndeint=map=1
  7643. @end example
  7644. @end itemize
  7645. @section lenscorrection
  7646. Correct radial lens distortion
  7647. This filter can be used to correct for radial distortion as can result from the use
  7648. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7649. one can use tools available for example as part of opencv or simply trial-and-error.
  7650. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7651. and extract the k1 and k2 coefficients from the resulting matrix.
  7652. Note that effectively the same filter is available in the open-source tools Krita and
  7653. Digikam from the KDE project.
  7654. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7655. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7656. brightness distribution, so you may want to use both filters together in certain
  7657. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7658. be applied before or after lens correction.
  7659. @subsection Options
  7660. The filter accepts the following options:
  7661. @table @option
  7662. @item cx
  7663. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7664. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7665. width.
  7666. @item cy
  7667. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7668. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7669. height.
  7670. @item k1
  7671. Coefficient of the quadratic correction term. 0.5 means no correction.
  7672. @item k2
  7673. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7674. @end table
  7675. The formula that generates the correction is:
  7676. @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)
  7677. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7678. distances from the focal point in the source and target images, respectively.
  7679. @section libvmaf
  7680. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7681. score between two input videos.
  7682. The obtained VMAF score is printed through the logging system.
  7683. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7684. After installing the library it can be enabled using:
  7685. @code{./configure --enable-libvmaf}.
  7686. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7687. The filter has following options:
  7688. @table @option
  7689. @item model_path
  7690. Set the model path which is to be used for SVM.
  7691. Default value: @code{"vmaf_v0.6.1.pkl"}
  7692. @item log_path
  7693. Set the file path to be used to store logs.
  7694. @item log_fmt
  7695. Set the format of the log file (xml or json).
  7696. @item enable_transform
  7697. Enables transform for computing vmaf.
  7698. @item phone_model
  7699. Invokes the phone model which will generate VMAF scores higher than in the
  7700. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7701. @item psnr
  7702. Enables computing psnr along with vmaf.
  7703. @item ssim
  7704. Enables computing ssim along with vmaf.
  7705. @item ms_ssim
  7706. Enables computing ms_ssim along with vmaf.
  7707. @item pool
  7708. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7709. @end table
  7710. This filter also supports the @ref{framesync} options.
  7711. On the below examples the input file @file{main.mpg} being processed is
  7712. compared with the reference file @file{ref.mpg}.
  7713. @example
  7714. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7715. @end example
  7716. Example with options:
  7717. @example
  7718. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7719. @end example
  7720. @section limiter
  7721. Limits the pixel components values to the specified range [min, max].
  7722. The filter accepts the following options:
  7723. @table @option
  7724. @item min
  7725. Lower bound. Defaults to the lowest allowed value for the input.
  7726. @item max
  7727. Upper bound. Defaults to the highest allowed value for the input.
  7728. @item planes
  7729. Specify which planes will be processed. Defaults to all available.
  7730. @end table
  7731. @section loop
  7732. Loop video frames.
  7733. The filter accepts the following options:
  7734. @table @option
  7735. @item loop
  7736. Set the number of loops. Setting this value to -1 will result in infinite loops.
  7737. Default is 0.
  7738. @item size
  7739. Set maximal size in number of frames. Default is 0.
  7740. @item start
  7741. Set first frame of loop. Default is 0.
  7742. @end table
  7743. @anchor{lut3d}
  7744. @section lut3d
  7745. Apply a 3D LUT to an input video.
  7746. The filter accepts the following options:
  7747. @table @option
  7748. @item file
  7749. Set the 3D LUT file name.
  7750. Currently supported formats:
  7751. @table @samp
  7752. @item 3dl
  7753. AfterEffects
  7754. @item cube
  7755. Iridas
  7756. @item dat
  7757. DaVinci
  7758. @item m3d
  7759. Pandora
  7760. @end table
  7761. @item interp
  7762. Select interpolation mode.
  7763. Available values are:
  7764. @table @samp
  7765. @item nearest
  7766. Use values from the nearest defined point.
  7767. @item trilinear
  7768. Interpolate values using the 8 points defining a cube.
  7769. @item tetrahedral
  7770. Interpolate values using a tetrahedron.
  7771. @end table
  7772. @end table
  7773. This filter also supports the @ref{framesync} options.
  7774. @section lumakey
  7775. Turn certain luma values into transparency.
  7776. The filter accepts the following options:
  7777. @table @option
  7778. @item threshold
  7779. Set the luma which will be used as base for transparency.
  7780. Default value is @code{0}.
  7781. @item tolerance
  7782. Set the range of luma values to be keyed out.
  7783. Default value is @code{0}.
  7784. @item softness
  7785. Set the range of softness. Default value is @code{0}.
  7786. Use this to control gradual transition from zero to full transparency.
  7787. @end table
  7788. @section lut, lutrgb, lutyuv
  7789. Compute a look-up table for binding each pixel component input value
  7790. to an output value, and apply it to the input video.
  7791. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7792. to an RGB input video.
  7793. These filters accept the following parameters:
  7794. @table @option
  7795. @item c0
  7796. set first pixel component expression
  7797. @item c1
  7798. set second pixel component expression
  7799. @item c2
  7800. set third pixel component expression
  7801. @item c3
  7802. set fourth pixel component expression, corresponds to the alpha component
  7803. @item r
  7804. set red component expression
  7805. @item g
  7806. set green component expression
  7807. @item b
  7808. set blue component expression
  7809. @item a
  7810. alpha component expression
  7811. @item y
  7812. set Y/luminance component expression
  7813. @item u
  7814. set U/Cb component expression
  7815. @item v
  7816. set V/Cr component expression
  7817. @end table
  7818. Each of them specifies the expression to use for computing the lookup table for
  7819. the corresponding pixel component values.
  7820. The exact component associated to each of the @var{c*} options depends on the
  7821. format in input.
  7822. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7823. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7824. The expressions can contain the following constants and functions:
  7825. @table @option
  7826. @item w
  7827. @item h
  7828. The input width and height.
  7829. @item val
  7830. The input value for the pixel component.
  7831. @item clipval
  7832. The input value, clipped to the @var{minval}-@var{maxval} range.
  7833. @item maxval
  7834. The maximum value for the pixel component.
  7835. @item minval
  7836. The minimum value for the pixel component.
  7837. @item negval
  7838. The negated value for the pixel component value, clipped to the
  7839. @var{minval}-@var{maxval} range; it corresponds to the expression
  7840. "maxval-clipval+minval".
  7841. @item clip(val)
  7842. The computed value in @var{val}, clipped to the
  7843. @var{minval}-@var{maxval} range.
  7844. @item gammaval(gamma)
  7845. The computed gamma correction value of the pixel component value,
  7846. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7847. expression
  7848. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7849. @end table
  7850. All expressions default to "val".
  7851. @subsection Examples
  7852. @itemize
  7853. @item
  7854. Negate input video:
  7855. @example
  7856. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7857. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7858. @end example
  7859. The above is the same as:
  7860. @example
  7861. lutrgb="r=negval:g=negval:b=negval"
  7862. lutyuv="y=negval:u=negval:v=negval"
  7863. @end example
  7864. @item
  7865. Negate luminance:
  7866. @example
  7867. lutyuv=y=negval
  7868. @end example
  7869. @item
  7870. Remove chroma components, turning the video into a graytone image:
  7871. @example
  7872. lutyuv="u=128:v=128"
  7873. @end example
  7874. @item
  7875. Apply a luma burning effect:
  7876. @example
  7877. lutyuv="y=2*val"
  7878. @end example
  7879. @item
  7880. Remove green and blue components:
  7881. @example
  7882. lutrgb="g=0:b=0"
  7883. @end example
  7884. @item
  7885. Set a constant alpha channel value on input:
  7886. @example
  7887. format=rgba,lutrgb=a="maxval-minval/2"
  7888. @end example
  7889. @item
  7890. Correct luminance gamma by a factor of 0.5:
  7891. @example
  7892. lutyuv=y=gammaval(0.5)
  7893. @end example
  7894. @item
  7895. Discard least significant bits of luma:
  7896. @example
  7897. lutyuv=y='bitand(val, 128+64+32)'
  7898. @end example
  7899. @item
  7900. Technicolor like effect:
  7901. @example
  7902. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7903. @end example
  7904. @end itemize
  7905. @section lut2, tlut2
  7906. The @code{lut2} filter takes two input streams and outputs one
  7907. stream.
  7908. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7909. from one single stream.
  7910. This filter accepts the following parameters:
  7911. @table @option
  7912. @item c0
  7913. set first pixel component expression
  7914. @item c1
  7915. set second pixel component expression
  7916. @item c2
  7917. set third pixel component expression
  7918. @item c3
  7919. set fourth pixel component expression, corresponds to the alpha component
  7920. @end table
  7921. Each of them specifies the expression to use for computing the lookup table for
  7922. the corresponding pixel component values.
  7923. The exact component associated to each of the @var{c*} options depends on the
  7924. format in inputs.
  7925. The expressions can contain the following constants:
  7926. @table @option
  7927. @item w
  7928. @item h
  7929. The input width and height.
  7930. @item x
  7931. The first input value for the pixel component.
  7932. @item y
  7933. The second input value for the pixel component.
  7934. @item bdx
  7935. The first input video bit depth.
  7936. @item bdy
  7937. The second input video bit depth.
  7938. @end table
  7939. All expressions default to "x".
  7940. @subsection Examples
  7941. @itemize
  7942. @item
  7943. Highlight differences between two RGB video streams:
  7944. @example
  7945. 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)'
  7946. @end example
  7947. @item
  7948. Highlight differences between two YUV video streams:
  7949. @example
  7950. 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)'
  7951. @end example
  7952. @item
  7953. Show max difference between two video streams:
  7954. @example
  7955. 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)))'
  7956. @end example
  7957. @end itemize
  7958. @section maskedclamp
  7959. Clamp the first input stream with the second input and third input stream.
  7960. Returns the value of first stream to be between second input
  7961. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7962. This filter accepts the following options:
  7963. @table @option
  7964. @item undershoot
  7965. Default value is @code{0}.
  7966. @item overshoot
  7967. Default value is @code{0}.
  7968. @item planes
  7969. Set which planes will be processed as bitmap, unprocessed planes will be
  7970. copied from first stream.
  7971. By default value 0xf, all planes will be processed.
  7972. @end table
  7973. @section maskedmerge
  7974. Merge the first input stream with the second input stream using per pixel
  7975. weights in the third input stream.
  7976. A value of 0 in the third stream pixel component means that pixel component
  7977. from first stream is returned unchanged, while maximum value (eg. 255 for
  7978. 8-bit videos) means that pixel component from second stream is returned
  7979. unchanged. Intermediate values define the amount of merging between both
  7980. input stream's pixel components.
  7981. This filter accepts the following options:
  7982. @table @option
  7983. @item planes
  7984. Set which planes will be processed as bitmap, unprocessed planes will be
  7985. copied from first stream.
  7986. By default value 0xf, all planes will be processed.
  7987. @end table
  7988. @section mcdeint
  7989. Apply motion-compensation deinterlacing.
  7990. It needs one field per frame as input and must thus be used together
  7991. with yadif=1/3 or equivalent.
  7992. This filter accepts the following options:
  7993. @table @option
  7994. @item mode
  7995. Set the deinterlacing mode.
  7996. It accepts one of the following values:
  7997. @table @samp
  7998. @item fast
  7999. @item medium
  8000. @item slow
  8001. use iterative motion estimation
  8002. @item extra_slow
  8003. like @samp{slow}, but use multiple reference frames.
  8004. @end table
  8005. Default value is @samp{fast}.
  8006. @item parity
  8007. Set the picture field parity assumed for the input video. It must be
  8008. one of the following values:
  8009. @table @samp
  8010. @item 0, tff
  8011. assume top field first
  8012. @item 1, bff
  8013. assume bottom field first
  8014. @end table
  8015. Default value is @samp{bff}.
  8016. @item qp
  8017. Set per-block quantization parameter (QP) used by the internal
  8018. encoder.
  8019. Higher values should result in a smoother motion vector field but less
  8020. optimal individual vectors. Default value is 1.
  8021. @end table
  8022. @section mergeplanes
  8023. Merge color channel components from several video streams.
  8024. The filter accepts up to 4 input streams, and merge selected input
  8025. planes to the output video.
  8026. This filter accepts the following options:
  8027. @table @option
  8028. @item mapping
  8029. Set input to output plane mapping. Default is @code{0}.
  8030. The mappings is specified as a bitmap. It should be specified as a
  8031. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8032. mapping for the first plane of the output stream. 'A' sets the number of
  8033. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8034. corresponding input to use (from 0 to 3). The rest of the mappings is
  8035. similar, 'Bb' describes the mapping for the output stream second
  8036. plane, 'Cc' describes the mapping for the output stream third plane and
  8037. 'Dd' describes the mapping for the output stream fourth plane.
  8038. @item format
  8039. Set output pixel format. Default is @code{yuva444p}.
  8040. @end table
  8041. @subsection Examples
  8042. @itemize
  8043. @item
  8044. Merge three gray video streams of same width and height into single video stream:
  8045. @example
  8046. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8047. @end example
  8048. @item
  8049. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8050. @example
  8051. [a0][a1]mergeplanes=0x00010210:yuva444p
  8052. @end example
  8053. @item
  8054. Swap Y and A plane in yuva444p stream:
  8055. @example
  8056. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8057. @end example
  8058. @item
  8059. Swap U and V plane in yuv420p stream:
  8060. @example
  8061. format=yuv420p,mergeplanes=0x000201:yuv420p
  8062. @end example
  8063. @item
  8064. Cast a rgb24 clip to yuv444p:
  8065. @example
  8066. format=rgb24,mergeplanes=0x000102:yuv444p
  8067. @end example
  8068. @end itemize
  8069. @section mestimate
  8070. Estimate and export motion vectors using block matching algorithms.
  8071. Motion vectors are stored in frame side data to be used by other filters.
  8072. This filter accepts the following options:
  8073. @table @option
  8074. @item method
  8075. Specify the motion estimation method. Accepts one of the following values:
  8076. @table @samp
  8077. @item esa
  8078. Exhaustive search algorithm.
  8079. @item tss
  8080. Three step search algorithm.
  8081. @item tdls
  8082. Two dimensional logarithmic search algorithm.
  8083. @item ntss
  8084. New three step search algorithm.
  8085. @item fss
  8086. Four step search algorithm.
  8087. @item ds
  8088. Diamond search algorithm.
  8089. @item hexbs
  8090. Hexagon-based search algorithm.
  8091. @item epzs
  8092. Enhanced predictive zonal search algorithm.
  8093. @item umh
  8094. Uneven multi-hexagon search algorithm.
  8095. @end table
  8096. Default value is @samp{esa}.
  8097. @item mb_size
  8098. Macroblock size. Default @code{16}.
  8099. @item search_param
  8100. Search parameter. Default @code{7}.
  8101. @end table
  8102. @section midequalizer
  8103. Apply Midway Image Equalization effect using two video streams.
  8104. Midway Image Equalization adjusts a pair of images to have the same
  8105. histogram, while maintaining their dynamics as much as possible. It's
  8106. useful for e.g. matching exposures from a pair of stereo cameras.
  8107. This filter has two inputs and one output, which must be of same pixel format, but
  8108. may be of different sizes. The output of filter is first input adjusted with
  8109. midway histogram of both inputs.
  8110. This filter accepts the following option:
  8111. @table @option
  8112. @item planes
  8113. Set which planes to process. Default is @code{15}, which is all available planes.
  8114. @end table
  8115. @section minterpolate
  8116. Convert the video to specified frame rate using motion interpolation.
  8117. This filter accepts the following options:
  8118. @table @option
  8119. @item fps
  8120. 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}.
  8121. @item mi_mode
  8122. Motion interpolation mode. Following values are accepted:
  8123. @table @samp
  8124. @item dup
  8125. Duplicate previous or next frame for interpolating new ones.
  8126. @item blend
  8127. Blend source frames. Interpolated frame is mean of previous and next frames.
  8128. @item mci
  8129. Motion compensated interpolation. Following options are effective when this mode is selected:
  8130. @table @samp
  8131. @item mc_mode
  8132. Motion compensation mode. Following values are accepted:
  8133. @table @samp
  8134. @item obmc
  8135. Overlapped block motion compensation.
  8136. @item aobmc
  8137. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8138. @end table
  8139. Default mode is @samp{obmc}.
  8140. @item me_mode
  8141. Motion estimation mode. Following values are accepted:
  8142. @table @samp
  8143. @item bidir
  8144. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8145. @item bilat
  8146. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8147. @end table
  8148. Default mode is @samp{bilat}.
  8149. @item me
  8150. The algorithm to be used for motion estimation. Following values are accepted:
  8151. @table @samp
  8152. @item esa
  8153. Exhaustive search algorithm.
  8154. @item tss
  8155. Three step search algorithm.
  8156. @item tdls
  8157. Two dimensional logarithmic search algorithm.
  8158. @item ntss
  8159. New three step search algorithm.
  8160. @item fss
  8161. Four step search algorithm.
  8162. @item ds
  8163. Diamond search algorithm.
  8164. @item hexbs
  8165. Hexagon-based search algorithm.
  8166. @item epzs
  8167. Enhanced predictive zonal search algorithm.
  8168. @item umh
  8169. Uneven multi-hexagon search algorithm.
  8170. @end table
  8171. Default algorithm is @samp{epzs}.
  8172. @item mb_size
  8173. Macroblock size. Default @code{16}.
  8174. @item search_param
  8175. Motion estimation search parameter. Default @code{32}.
  8176. @item vsbmc
  8177. 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).
  8178. @end table
  8179. @end table
  8180. @item scd
  8181. 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:
  8182. @table @samp
  8183. @item none
  8184. Disable scene change detection.
  8185. @item fdiff
  8186. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8187. @end table
  8188. Default method is @samp{fdiff}.
  8189. @item scd_threshold
  8190. Scene change detection threshold. Default is @code{5.0}.
  8191. @end table
  8192. @section mix
  8193. Mix several video input streams into one video stream.
  8194. A description of the accepted options follows.
  8195. @table @option
  8196. @item nb_inputs
  8197. The number of inputs. If unspecified, it defaults to 2.
  8198. @item weights
  8199. Specify weight of each input video stream as sequence.
  8200. Each weight is separated by space.
  8201. @item duration
  8202. Specify how end of stream is determined.
  8203. @table @samp
  8204. @item longest
  8205. The duration of the longest input. (default)
  8206. @item shortest
  8207. The duration of the shortest input.
  8208. @item first
  8209. The duration of the first input.
  8210. @end table
  8211. @end table
  8212. @section mpdecimate
  8213. Drop frames that do not differ greatly from the previous frame in
  8214. order to reduce frame rate.
  8215. The main use of this filter is for very-low-bitrate encoding
  8216. (e.g. streaming over dialup modem), but it could in theory be used for
  8217. fixing movies that were inverse-telecined incorrectly.
  8218. A description of the accepted options follows.
  8219. @table @option
  8220. @item max
  8221. Set the maximum number of consecutive frames which can be dropped (if
  8222. positive), or the minimum interval between dropped frames (if
  8223. negative). If the value is 0, the frame is dropped disregarding the
  8224. number of previous sequentially dropped frames.
  8225. Default value is 0.
  8226. @item hi
  8227. @item lo
  8228. @item frac
  8229. Set the dropping threshold values.
  8230. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8231. represent actual pixel value differences, so a threshold of 64
  8232. corresponds to 1 unit of difference for each pixel, or the same spread
  8233. out differently over the block.
  8234. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8235. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8236. meaning the whole image) differ by more than a threshold of @option{lo}.
  8237. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8238. 64*5, and default value for @option{frac} is 0.33.
  8239. @end table
  8240. @section negate
  8241. Negate input video.
  8242. It accepts an integer in input; if non-zero it negates the
  8243. alpha component (if available). The default value in input is 0.
  8244. @section nlmeans
  8245. Denoise frames using Non-Local Means algorithm.
  8246. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8247. context similarity is defined by comparing their surrounding patches of size
  8248. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8249. around the pixel.
  8250. Note that the research area defines centers for patches, which means some
  8251. patches will be made of pixels outside that research area.
  8252. The filter accepts the following options.
  8253. @table @option
  8254. @item s
  8255. Set denoising strength.
  8256. @item p
  8257. Set patch size.
  8258. @item pc
  8259. Same as @option{p} but for chroma planes.
  8260. The default value is @var{0} and means automatic.
  8261. @item r
  8262. Set research size.
  8263. @item rc
  8264. Same as @option{r} but for chroma planes.
  8265. The default value is @var{0} and means automatic.
  8266. @end table
  8267. @section nnedi
  8268. Deinterlace video using neural network edge directed interpolation.
  8269. This filter accepts the following options:
  8270. @table @option
  8271. @item weights
  8272. Mandatory option, without binary file filter can not work.
  8273. Currently file can be found here:
  8274. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8275. @item deint
  8276. Set which frames to deinterlace, by default it is @code{all}.
  8277. Can be @code{all} or @code{interlaced}.
  8278. @item field
  8279. Set mode of operation.
  8280. Can be one of the following:
  8281. @table @samp
  8282. @item af
  8283. Use frame flags, both fields.
  8284. @item a
  8285. Use frame flags, single field.
  8286. @item t
  8287. Use top field only.
  8288. @item b
  8289. Use bottom field only.
  8290. @item tf
  8291. Use both fields, top first.
  8292. @item bf
  8293. Use both fields, bottom first.
  8294. @end table
  8295. @item planes
  8296. Set which planes to process, by default filter process all frames.
  8297. @item nsize
  8298. Set size of local neighborhood around each pixel, used by the predictor neural
  8299. network.
  8300. Can be one of the following:
  8301. @table @samp
  8302. @item s8x6
  8303. @item s16x6
  8304. @item s32x6
  8305. @item s48x6
  8306. @item s8x4
  8307. @item s16x4
  8308. @item s32x4
  8309. @end table
  8310. @item nns
  8311. Set the number of neurons in predictor neural network.
  8312. Can be one of the following:
  8313. @table @samp
  8314. @item n16
  8315. @item n32
  8316. @item n64
  8317. @item n128
  8318. @item n256
  8319. @end table
  8320. @item qual
  8321. Controls the number of different neural network predictions that are blended
  8322. together to compute the final output value. Can be @code{fast}, default or
  8323. @code{slow}.
  8324. @item etype
  8325. Set which set of weights to use in the predictor.
  8326. Can be one of the following:
  8327. @table @samp
  8328. @item a
  8329. weights trained to minimize absolute error
  8330. @item s
  8331. weights trained to minimize squared error
  8332. @end table
  8333. @item pscrn
  8334. Controls whether or not the prescreener neural network is used to decide
  8335. which pixels should be processed by the predictor neural network and which
  8336. can be handled by simple cubic interpolation.
  8337. The prescreener is trained to know whether cubic interpolation will be
  8338. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8339. The computational complexity of the prescreener nn is much less than that of
  8340. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8341. using the prescreener generally results in much faster processing.
  8342. The prescreener is pretty accurate, so the difference between using it and not
  8343. using it is almost always unnoticeable.
  8344. Can be one of the following:
  8345. @table @samp
  8346. @item none
  8347. @item original
  8348. @item new
  8349. @end table
  8350. Default is @code{new}.
  8351. @item fapprox
  8352. Set various debugging flags.
  8353. @end table
  8354. @section noformat
  8355. Force libavfilter not to use any of the specified pixel formats for the
  8356. input to the next filter.
  8357. It accepts the following parameters:
  8358. @table @option
  8359. @item pix_fmts
  8360. A '|'-separated list of pixel format names, such as
  8361. pix_fmts=yuv420p|monow|rgb24".
  8362. @end table
  8363. @subsection Examples
  8364. @itemize
  8365. @item
  8366. Force libavfilter to use a format different from @var{yuv420p} for the
  8367. input to the vflip filter:
  8368. @example
  8369. noformat=pix_fmts=yuv420p,vflip
  8370. @end example
  8371. @item
  8372. Convert the input video to any of the formats not contained in the list:
  8373. @example
  8374. noformat=yuv420p|yuv444p|yuv410p
  8375. @end example
  8376. @end itemize
  8377. @section noise
  8378. Add noise on video input frame.
  8379. The filter accepts the following options:
  8380. @table @option
  8381. @item all_seed
  8382. @item c0_seed
  8383. @item c1_seed
  8384. @item c2_seed
  8385. @item c3_seed
  8386. Set noise seed for specific pixel component or all pixel components in case
  8387. of @var{all_seed}. Default value is @code{123457}.
  8388. @item all_strength, alls
  8389. @item c0_strength, c0s
  8390. @item c1_strength, c1s
  8391. @item c2_strength, c2s
  8392. @item c3_strength, c3s
  8393. Set noise strength for specific pixel component or all pixel components in case
  8394. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8395. @item all_flags, allf
  8396. @item c0_flags, c0f
  8397. @item c1_flags, c1f
  8398. @item c2_flags, c2f
  8399. @item c3_flags, c3f
  8400. Set pixel component flags or set flags for all components if @var{all_flags}.
  8401. Available values for component flags are:
  8402. @table @samp
  8403. @item a
  8404. averaged temporal noise (smoother)
  8405. @item p
  8406. mix random noise with a (semi)regular pattern
  8407. @item t
  8408. temporal noise (noise pattern changes between frames)
  8409. @item u
  8410. uniform noise (gaussian otherwise)
  8411. @end table
  8412. @end table
  8413. @subsection Examples
  8414. Add temporal and uniform noise to input video:
  8415. @example
  8416. noise=alls=20:allf=t+u
  8417. @end example
  8418. @section normalize
  8419. Normalize RGB video (aka histogram stretching, contrast stretching).
  8420. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8421. For each channel of each frame, the filter computes the input range and maps
  8422. it linearly to the user-specified output range. The output range defaults
  8423. to the full dynamic range from pure black to pure white.
  8424. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8425. changes in brightness) caused when small dark or bright objects enter or leave
  8426. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8427. video camera, and, like a video camera, it may cause a period of over- or
  8428. under-exposure of the video.
  8429. The R,G,B channels can be normalized independently, which may cause some
  8430. color shifting, or linked together as a single channel, which prevents
  8431. color shifting. Linked normalization preserves hue. Independent normalization
  8432. does not, so it can be used to remove some color casts. Independent and linked
  8433. normalization can be combined in any ratio.
  8434. The normalize filter accepts the following options:
  8435. @table @option
  8436. @item blackpt
  8437. @item whitept
  8438. Colors which define the output range. The minimum input value is mapped to
  8439. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8440. The defaults are black and white respectively. Specifying white for
  8441. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8442. normalized video. Shades of grey can be used to reduce the dynamic range
  8443. (contrast). Specifying saturated colors here can create some interesting
  8444. effects.
  8445. @item smoothing
  8446. The number of previous frames to use for temporal smoothing. The input range
  8447. of each channel is smoothed using a rolling average over the current frame
  8448. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8449. smoothing).
  8450. @item independence
  8451. Controls the ratio of independent (color shifting) channel normalization to
  8452. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8453. independent. Defaults to 1.0 (fully independent).
  8454. @item strength
  8455. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8456. expensive no-op. Defaults to 1.0 (full strength).
  8457. @end table
  8458. @subsection Examples
  8459. Stretch video contrast to use the full dynamic range, with no temporal
  8460. smoothing; may flicker depending on the source content:
  8461. @example
  8462. normalize=blackpt=black:whitept=white:smoothing=0
  8463. @end example
  8464. As above, but with 50 frames of temporal smoothing; flicker should be
  8465. reduced, depending on the source content:
  8466. @example
  8467. normalize=blackpt=black:whitept=white:smoothing=50
  8468. @end example
  8469. As above, but with hue-preserving linked channel normalization:
  8470. @example
  8471. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8472. @end example
  8473. As above, but with half strength:
  8474. @example
  8475. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8476. @end example
  8477. Map the darkest input color to red, the brightest input color to cyan:
  8478. @example
  8479. normalize=blackpt=red:whitept=cyan
  8480. @end example
  8481. @section null
  8482. Pass the video source unchanged to the output.
  8483. @section ocr
  8484. Optical Character Recognition
  8485. This filter uses Tesseract for optical character recognition.
  8486. It accepts the following options:
  8487. @table @option
  8488. @item datapath
  8489. Set datapath to tesseract data. Default is to use whatever was
  8490. set at installation.
  8491. @item language
  8492. Set language, default is "eng".
  8493. @item whitelist
  8494. Set character whitelist.
  8495. @item blacklist
  8496. Set character blacklist.
  8497. @end table
  8498. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8499. @section ocv
  8500. Apply a video transform using libopencv.
  8501. To enable this filter, install the libopencv library and headers and
  8502. configure FFmpeg with @code{--enable-libopencv}.
  8503. It accepts the following parameters:
  8504. @table @option
  8505. @item filter_name
  8506. The name of the libopencv filter to apply.
  8507. @item filter_params
  8508. The parameters to pass to the libopencv filter. If not specified, the default
  8509. values are assumed.
  8510. @end table
  8511. Refer to the official libopencv documentation for more precise
  8512. information:
  8513. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8514. Several libopencv filters are supported; see the following subsections.
  8515. @anchor{dilate}
  8516. @subsection dilate
  8517. Dilate an image by using a specific structuring element.
  8518. It corresponds to the libopencv function @code{cvDilate}.
  8519. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8520. @var{struct_el} represents a structuring element, and has the syntax:
  8521. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8522. @var{cols} and @var{rows} represent the number of columns and rows of
  8523. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8524. point, and @var{shape} the shape for the structuring element. @var{shape}
  8525. must be "rect", "cross", "ellipse", or "custom".
  8526. If the value for @var{shape} is "custom", it must be followed by a
  8527. string of the form "=@var{filename}". The file with name
  8528. @var{filename} is assumed to represent a binary image, with each
  8529. printable character corresponding to a bright pixel. When a custom
  8530. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8531. or columns and rows of the read file are assumed instead.
  8532. The default value for @var{struct_el} is "3x3+0x0/rect".
  8533. @var{nb_iterations} specifies the number of times the transform is
  8534. applied to the image, and defaults to 1.
  8535. Some examples:
  8536. @example
  8537. # Use the default values
  8538. ocv=dilate
  8539. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8540. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8541. # Read the shape from the file diamond.shape, iterating two times.
  8542. # The file diamond.shape may contain a pattern of characters like this
  8543. # *
  8544. # ***
  8545. # *****
  8546. # ***
  8547. # *
  8548. # The specified columns and rows are ignored
  8549. # but the anchor point coordinates are not
  8550. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8551. @end example
  8552. @subsection erode
  8553. Erode an image by using a specific structuring element.
  8554. It corresponds to the libopencv function @code{cvErode}.
  8555. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8556. with the same syntax and semantics as the @ref{dilate} filter.
  8557. @subsection smooth
  8558. Smooth the input video.
  8559. The filter takes the following parameters:
  8560. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8561. @var{type} is the type of smooth filter to apply, and must be one of
  8562. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8563. or "bilateral". The default value is "gaussian".
  8564. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8565. depend on the smooth type. @var{param1} and
  8566. @var{param2} accept integer positive values or 0. @var{param3} and
  8567. @var{param4} accept floating point values.
  8568. The default value for @var{param1} is 3. The default value for the
  8569. other parameters is 0.
  8570. These parameters correspond to the parameters assigned to the
  8571. libopencv function @code{cvSmooth}.
  8572. @section oscilloscope
  8573. 2D Video Oscilloscope.
  8574. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8575. It accepts the following parameters:
  8576. @table @option
  8577. @item x
  8578. Set scope center x position.
  8579. @item y
  8580. Set scope center y position.
  8581. @item s
  8582. Set scope size, relative to frame diagonal.
  8583. @item t
  8584. Set scope tilt/rotation.
  8585. @item o
  8586. Set trace opacity.
  8587. @item tx
  8588. Set trace center x position.
  8589. @item ty
  8590. Set trace center y position.
  8591. @item tw
  8592. Set trace width, relative to width of frame.
  8593. @item th
  8594. Set trace height, relative to height of frame.
  8595. @item c
  8596. Set which components to trace. By default it traces first three components.
  8597. @item g
  8598. Draw trace grid. By default is enabled.
  8599. @item st
  8600. Draw some statistics. By default is enabled.
  8601. @item sc
  8602. Draw scope. By default is enabled.
  8603. @end table
  8604. @subsection Examples
  8605. @itemize
  8606. @item
  8607. Inspect full first row of video frame.
  8608. @example
  8609. oscilloscope=x=0.5:y=0:s=1
  8610. @end example
  8611. @item
  8612. Inspect full last row of video frame.
  8613. @example
  8614. oscilloscope=x=0.5:y=1:s=1
  8615. @end example
  8616. @item
  8617. Inspect full 5th line of video frame of height 1080.
  8618. @example
  8619. oscilloscope=x=0.5:y=5/1080:s=1
  8620. @end example
  8621. @item
  8622. Inspect full last column of video frame.
  8623. @example
  8624. oscilloscope=x=1:y=0.5:s=1:t=1
  8625. @end example
  8626. @end itemize
  8627. @anchor{overlay}
  8628. @section overlay
  8629. Overlay one video on top of another.
  8630. It takes two inputs and has one output. The first input is the "main"
  8631. video on which the second input is overlaid.
  8632. It accepts the following parameters:
  8633. A description of the accepted options follows.
  8634. @table @option
  8635. @item x
  8636. @item y
  8637. Set the expression for the x and y coordinates of the overlaid video
  8638. on the main video. Default value is "0" for both expressions. In case
  8639. the expression is invalid, it is set to a huge value (meaning that the
  8640. overlay will not be displayed within the output visible area).
  8641. @item eof_action
  8642. See @ref{framesync}.
  8643. @item eval
  8644. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8645. It accepts the following values:
  8646. @table @samp
  8647. @item init
  8648. only evaluate expressions once during the filter initialization or
  8649. when a command is processed
  8650. @item frame
  8651. evaluate expressions for each incoming frame
  8652. @end table
  8653. Default value is @samp{frame}.
  8654. @item shortest
  8655. See @ref{framesync}.
  8656. @item format
  8657. Set the format for the output video.
  8658. It accepts the following values:
  8659. @table @samp
  8660. @item yuv420
  8661. force YUV420 output
  8662. @item yuv422
  8663. force YUV422 output
  8664. @item yuv444
  8665. force YUV444 output
  8666. @item rgb
  8667. force packed RGB output
  8668. @item gbrp
  8669. force planar RGB output
  8670. @item auto
  8671. automatically pick format
  8672. @end table
  8673. Default value is @samp{yuv420}.
  8674. @item repeatlast
  8675. See @ref{framesync}.
  8676. @end table
  8677. The @option{x}, and @option{y} expressions can contain the following
  8678. parameters.
  8679. @table @option
  8680. @item main_w, W
  8681. @item main_h, H
  8682. The main input width and height.
  8683. @item overlay_w, w
  8684. @item overlay_h, h
  8685. The overlay input width and height.
  8686. @item x
  8687. @item y
  8688. The computed values for @var{x} and @var{y}. They are evaluated for
  8689. each new frame.
  8690. @item hsub
  8691. @item vsub
  8692. horizontal and vertical chroma subsample values of the output
  8693. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8694. @var{vsub} is 1.
  8695. @item n
  8696. the number of input frame, starting from 0
  8697. @item pos
  8698. the position in the file of the input frame, NAN if unknown
  8699. @item t
  8700. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8701. @end table
  8702. This filter also supports the @ref{framesync} options.
  8703. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8704. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8705. when @option{eval} is set to @samp{init}.
  8706. Be aware that frames are taken from each input video in timestamp
  8707. order, hence, if their initial timestamps differ, it is a good idea
  8708. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8709. have them begin in the same zero timestamp, as the example for
  8710. the @var{movie} filter does.
  8711. You can chain together more overlays but you should test the
  8712. efficiency of such approach.
  8713. @subsection Commands
  8714. This filter supports the following commands:
  8715. @table @option
  8716. @item x
  8717. @item y
  8718. Modify the x and y of the overlay input.
  8719. The command accepts the same syntax of the corresponding option.
  8720. If the specified expression is not valid, it is kept at its current
  8721. value.
  8722. @end table
  8723. @subsection Examples
  8724. @itemize
  8725. @item
  8726. Draw the overlay at 10 pixels from the bottom right corner of the main
  8727. video:
  8728. @example
  8729. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8730. @end example
  8731. Using named options the example above becomes:
  8732. @example
  8733. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8734. @end example
  8735. @item
  8736. Insert a transparent PNG logo in the bottom left corner of the input,
  8737. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8738. @example
  8739. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8740. @end example
  8741. @item
  8742. Insert 2 different transparent PNG logos (second logo on bottom
  8743. right corner) using the @command{ffmpeg} tool:
  8744. @example
  8745. 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
  8746. @end example
  8747. @item
  8748. Add a transparent color layer on top of the main video; @code{WxH}
  8749. must specify the size of the main input to the overlay filter:
  8750. @example
  8751. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8752. @end example
  8753. @item
  8754. Play an original video and a filtered version (here with the deshake
  8755. filter) side by side using the @command{ffplay} tool:
  8756. @example
  8757. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8758. @end example
  8759. The above command is the same as:
  8760. @example
  8761. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8762. @end example
  8763. @item
  8764. Make a sliding overlay appearing from the left to the right top part of the
  8765. screen starting since time 2:
  8766. @example
  8767. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8768. @end example
  8769. @item
  8770. Compose output by putting two input videos side to side:
  8771. @example
  8772. ffmpeg -i left.avi -i right.avi -filter_complex "
  8773. nullsrc=size=200x100 [background];
  8774. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8775. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8776. [background][left] overlay=shortest=1 [background+left];
  8777. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8778. "
  8779. @end example
  8780. @item
  8781. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8782. @example
  8783. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8784. -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]'
  8785. masked.avi
  8786. @end example
  8787. @item
  8788. Chain several overlays in cascade:
  8789. @example
  8790. nullsrc=s=200x200 [bg];
  8791. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8792. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8793. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8794. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8795. [in3] null, [mid2] overlay=100:100 [out0]
  8796. @end example
  8797. @end itemize
  8798. @section owdenoise
  8799. Apply Overcomplete Wavelet denoiser.
  8800. The filter accepts the following options:
  8801. @table @option
  8802. @item depth
  8803. Set depth.
  8804. Larger depth values will denoise lower frequency components more, but
  8805. slow down filtering.
  8806. Must be an int in the range 8-16, default is @code{8}.
  8807. @item luma_strength, ls
  8808. Set luma strength.
  8809. Must be a double value in the range 0-1000, default is @code{1.0}.
  8810. @item chroma_strength, cs
  8811. Set chroma strength.
  8812. Must be a double value in the range 0-1000, default is @code{1.0}.
  8813. @end table
  8814. @anchor{pad}
  8815. @section pad
  8816. Add paddings to the input image, and place the original input at the
  8817. provided @var{x}, @var{y} coordinates.
  8818. It accepts the following parameters:
  8819. @table @option
  8820. @item width, w
  8821. @item height, h
  8822. Specify an expression for the size of the output image with the
  8823. paddings added. If the value for @var{width} or @var{height} is 0, the
  8824. corresponding input size is used for the output.
  8825. The @var{width} expression can reference the value set by the
  8826. @var{height} expression, and vice versa.
  8827. The default value of @var{width} and @var{height} is 0.
  8828. @item x
  8829. @item y
  8830. Specify the offsets to place the input image at within the padded area,
  8831. with respect to the top/left border of the output image.
  8832. The @var{x} expression can reference the value set by the @var{y}
  8833. expression, and vice versa.
  8834. The default value of @var{x} and @var{y} is 0.
  8835. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8836. so the input image is centered on the padded area.
  8837. @item color
  8838. Specify the color of the padded area. For the syntax of this option,
  8839. check the "Color" section in the ffmpeg-utils manual.
  8840. The default value of @var{color} is "black".
  8841. @item eval
  8842. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8843. It accepts the following values:
  8844. @table @samp
  8845. @item init
  8846. Only evaluate expressions once during the filter initialization or when
  8847. a command is processed.
  8848. @item frame
  8849. Evaluate expressions for each incoming frame.
  8850. @end table
  8851. Default value is @samp{init}.
  8852. @item aspect
  8853. Pad to aspect instead to a resolution.
  8854. @end table
  8855. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8856. options are expressions containing the following constants:
  8857. @table @option
  8858. @item in_w
  8859. @item in_h
  8860. The input video width and height.
  8861. @item iw
  8862. @item ih
  8863. These are the same as @var{in_w} and @var{in_h}.
  8864. @item out_w
  8865. @item out_h
  8866. The output width and height (the size of the padded area), as
  8867. specified by the @var{width} and @var{height} expressions.
  8868. @item ow
  8869. @item oh
  8870. These are the same as @var{out_w} and @var{out_h}.
  8871. @item x
  8872. @item y
  8873. The x and y offsets as specified by the @var{x} and @var{y}
  8874. expressions, or NAN if not yet specified.
  8875. @item a
  8876. same as @var{iw} / @var{ih}
  8877. @item sar
  8878. input sample aspect ratio
  8879. @item dar
  8880. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8881. @item hsub
  8882. @item vsub
  8883. The horizontal and vertical chroma subsample values. For example for the
  8884. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8885. @end table
  8886. @subsection Examples
  8887. @itemize
  8888. @item
  8889. Add paddings with the color "violet" to the input video. The output video
  8890. size is 640x480, and the top-left corner of the input video is placed at
  8891. column 0, row 40
  8892. @example
  8893. pad=640:480:0:40:violet
  8894. @end example
  8895. The example above is equivalent to the following command:
  8896. @example
  8897. pad=width=640:height=480:x=0:y=40:color=violet
  8898. @end example
  8899. @item
  8900. Pad the input to get an output with dimensions increased by 3/2,
  8901. and put the input video at the center of the padded area:
  8902. @example
  8903. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8904. @end example
  8905. @item
  8906. Pad the input to get a squared output with size equal to the maximum
  8907. value between the input width and height, and put the input video at
  8908. the center of the padded area:
  8909. @example
  8910. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8911. @end example
  8912. @item
  8913. Pad the input to get a final w/h ratio of 16:9:
  8914. @example
  8915. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8916. @end example
  8917. @item
  8918. In case of anamorphic video, in order to set the output display aspect
  8919. correctly, it is necessary to use @var{sar} in the expression,
  8920. according to the relation:
  8921. @example
  8922. (ih * X / ih) * sar = output_dar
  8923. X = output_dar / sar
  8924. @end example
  8925. Thus the previous example needs to be modified to:
  8926. @example
  8927. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8928. @end example
  8929. @item
  8930. Double the output size and put the input video in the bottom-right
  8931. corner of the output padded area:
  8932. @example
  8933. pad="2*iw:2*ih:ow-iw:oh-ih"
  8934. @end example
  8935. @end itemize
  8936. @anchor{palettegen}
  8937. @section palettegen
  8938. Generate one palette for a whole video stream.
  8939. It accepts the following options:
  8940. @table @option
  8941. @item max_colors
  8942. Set the maximum number of colors to quantize in the palette.
  8943. Note: the palette will still contain 256 colors; the unused palette entries
  8944. will be black.
  8945. @item reserve_transparent
  8946. Create a palette of 255 colors maximum and reserve the last one for
  8947. transparency. Reserving the transparency color is useful for GIF optimization.
  8948. If not set, the maximum of colors in the palette will be 256. You probably want
  8949. to disable this option for a standalone image.
  8950. Set by default.
  8951. @item transparency_color
  8952. Set the color that will be used as background for transparency.
  8953. @item stats_mode
  8954. Set statistics mode.
  8955. It accepts the following values:
  8956. @table @samp
  8957. @item full
  8958. Compute full frame histograms.
  8959. @item diff
  8960. Compute histograms only for the part that differs from previous frame. This
  8961. might be relevant to give more importance to the moving part of your input if
  8962. the background is static.
  8963. @item single
  8964. Compute new histogram for each frame.
  8965. @end table
  8966. Default value is @var{full}.
  8967. @end table
  8968. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8969. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8970. color quantization of the palette. This information is also visible at
  8971. @var{info} logging level.
  8972. @subsection Examples
  8973. @itemize
  8974. @item
  8975. Generate a representative palette of a given video using @command{ffmpeg}:
  8976. @example
  8977. ffmpeg -i input.mkv -vf palettegen palette.png
  8978. @end example
  8979. @end itemize
  8980. @section paletteuse
  8981. Use a palette to downsample an input video stream.
  8982. The filter takes two inputs: one video stream and a palette. The palette must
  8983. be a 256 pixels image.
  8984. It accepts the following options:
  8985. @table @option
  8986. @item dither
  8987. Select dithering mode. Available algorithms are:
  8988. @table @samp
  8989. @item bayer
  8990. Ordered 8x8 bayer dithering (deterministic)
  8991. @item heckbert
  8992. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8993. Note: this dithering is sometimes considered "wrong" and is included as a
  8994. reference.
  8995. @item floyd_steinberg
  8996. Floyd and Steingberg dithering (error diffusion)
  8997. @item sierra2
  8998. Frankie Sierra dithering v2 (error diffusion)
  8999. @item sierra2_4a
  9000. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9001. @end table
  9002. Default is @var{sierra2_4a}.
  9003. @item bayer_scale
  9004. When @var{bayer} dithering is selected, this option defines the scale of the
  9005. pattern (how much the crosshatch pattern is visible). A low value means more
  9006. visible pattern for less banding, and higher value means less visible pattern
  9007. at the cost of more banding.
  9008. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9009. @item diff_mode
  9010. If set, define the zone to process
  9011. @table @samp
  9012. @item rectangle
  9013. Only the changing rectangle will be reprocessed. This is similar to GIF
  9014. cropping/offsetting compression mechanism. This option can be useful for speed
  9015. if only a part of the image is changing, and has use cases such as limiting the
  9016. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9017. moving scene (it leads to more deterministic output if the scene doesn't change
  9018. much, and as a result less moving noise and better GIF compression).
  9019. @end table
  9020. Default is @var{none}.
  9021. @item new
  9022. Take new palette for each output frame.
  9023. @item alpha_threshold
  9024. Sets the alpha threshold for transparency. Alpha values above this threshold
  9025. will be treated as completely opaque, and values below this threshold will be
  9026. treated as completely transparent.
  9027. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9028. @end table
  9029. @subsection Examples
  9030. @itemize
  9031. @item
  9032. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9033. using @command{ffmpeg}:
  9034. @example
  9035. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9036. @end example
  9037. @end itemize
  9038. @section perspective
  9039. Correct perspective of video not recorded perpendicular to the screen.
  9040. A description of the accepted parameters follows.
  9041. @table @option
  9042. @item x0
  9043. @item y0
  9044. @item x1
  9045. @item y1
  9046. @item x2
  9047. @item y2
  9048. @item x3
  9049. @item y3
  9050. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9051. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9052. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9053. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9054. then the corners of the source will be sent to the specified coordinates.
  9055. The expressions can use the following variables:
  9056. @table @option
  9057. @item W
  9058. @item H
  9059. the width and height of video frame.
  9060. @item in
  9061. Input frame count.
  9062. @item on
  9063. Output frame count.
  9064. @end table
  9065. @item interpolation
  9066. Set interpolation for perspective correction.
  9067. It accepts the following values:
  9068. @table @samp
  9069. @item linear
  9070. @item cubic
  9071. @end table
  9072. Default value is @samp{linear}.
  9073. @item sense
  9074. Set interpretation of coordinate options.
  9075. It accepts the following values:
  9076. @table @samp
  9077. @item 0, source
  9078. Send point in the source specified by the given coordinates to
  9079. the corners of the destination.
  9080. @item 1, destination
  9081. Send the corners of the source to the point in the destination specified
  9082. by the given coordinates.
  9083. Default value is @samp{source}.
  9084. @end table
  9085. @item eval
  9086. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9087. It accepts the following values:
  9088. @table @samp
  9089. @item init
  9090. only evaluate expressions once during the filter initialization or
  9091. when a command is processed
  9092. @item frame
  9093. evaluate expressions for each incoming frame
  9094. @end table
  9095. Default value is @samp{init}.
  9096. @end table
  9097. @section phase
  9098. Delay interlaced video by one field time so that the field order changes.
  9099. The intended use is to fix PAL movies that have been captured with the
  9100. opposite field order to the film-to-video transfer.
  9101. A description of the accepted parameters follows.
  9102. @table @option
  9103. @item mode
  9104. Set phase mode.
  9105. It accepts the following values:
  9106. @table @samp
  9107. @item t
  9108. Capture field order top-first, transfer bottom-first.
  9109. Filter will delay the bottom field.
  9110. @item b
  9111. Capture field order bottom-first, transfer top-first.
  9112. Filter will delay the top field.
  9113. @item p
  9114. Capture and transfer with the same field order. This mode only exists
  9115. for the documentation of the other options to refer to, but if you
  9116. actually select it, the filter will faithfully do nothing.
  9117. @item a
  9118. Capture field order determined automatically by field flags, transfer
  9119. opposite.
  9120. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9121. basis using field flags. If no field information is available,
  9122. then this works just like @samp{u}.
  9123. @item u
  9124. Capture unknown or varying, transfer opposite.
  9125. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9126. analyzing the images and selecting the alternative that produces best
  9127. match between the fields.
  9128. @item T
  9129. Capture top-first, transfer unknown or varying.
  9130. Filter selects among @samp{t} and @samp{p} using image analysis.
  9131. @item B
  9132. Capture bottom-first, transfer unknown or varying.
  9133. Filter selects among @samp{b} and @samp{p} using image analysis.
  9134. @item A
  9135. Capture determined by field flags, transfer unknown or varying.
  9136. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9137. image analysis. If no field information is available, then this works just
  9138. like @samp{U}. This is the default mode.
  9139. @item U
  9140. Both capture and transfer unknown or varying.
  9141. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9142. @end table
  9143. @end table
  9144. @section pixdesctest
  9145. Pixel format descriptor test filter, mainly useful for internal
  9146. testing. The output video should be equal to the input video.
  9147. For example:
  9148. @example
  9149. format=monow, pixdesctest
  9150. @end example
  9151. can be used to test the monowhite pixel format descriptor definition.
  9152. @section pixscope
  9153. Display sample values of color channels. Mainly useful for checking color
  9154. and levels. Minimum supported resolution is 640x480.
  9155. The filters accept the following options:
  9156. @table @option
  9157. @item x
  9158. Set scope X position, relative offset on X axis.
  9159. @item y
  9160. Set scope Y position, relative offset on Y axis.
  9161. @item w
  9162. Set scope width.
  9163. @item h
  9164. Set scope height.
  9165. @item o
  9166. Set window opacity. This window also holds statistics about pixel area.
  9167. @item wx
  9168. Set window X position, relative offset on X axis.
  9169. @item wy
  9170. Set window Y position, relative offset on Y axis.
  9171. @end table
  9172. @section pp
  9173. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9174. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9175. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9176. Each subfilter and some options have a short and a long name that can be used
  9177. interchangeably, i.e. dr/dering are the same.
  9178. The filters accept the following options:
  9179. @table @option
  9180. @item subfilters
  9181. Set postprocessing subfilters string.
  9182. @end table
  9183. All subfilters share common options to determine their scope:
  9184. @table @option
  9185. @item a/autoq
  9186. Honor the quality commands for this subfilter.
  9187. @item c/chrom
  9188. Do chrominance filtering, too (default).
  9189. @item y/nochrom
  9190. Do luminance filtering only (no chrominance).
  9191. @item n/noluma
  9192. Do chrominance filtering only (no luminance).
  9193. @end table
  9194. These options can be appended after the subfilter name, separated by a '|'.
  9195. Available subfilters are:
  9196. @table @option
  9197. @item hb/hdeblock[|difference[|flatness]]
  9198. Horizontal deblocking filter
  9199. @table @option
  9200. @item difference
  9201. Difference factor where higher values mean more deblocking (default: @code{32}).
  9202. @item flatness
  9203. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9204. @end table
  9205. @item vb/vdeblock[|difference[|flatness]]
  9206. Vertical deblocking filter
  9207. @table @option
  9208. @item difference
  9209. Difference factor where higher values mean more deblocking (default: @code{32}).
  9210. @item flatness
  9211. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9212. @end table
  9213. @item ha/hadeblock[|difference[|flatness]]
  9214. Accurate horizontal deblocking filter
  9215. @table @option
  9216. @item difference
  9217. Difference factor where higher values mean more deblocking (default: @code{32}).
  9218. @item flatness
  9219. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9220. @end table
  9221. @item va/vadeblock[|difference[|flatness]]
  9222. Accurate vertical deblocking filter
  9223. @table @option
  9224. @item difference
  9225. Difference factor where higher values mean more deblocking (default: @code{32}).
  9226. @item flatness
  9227. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9228. @end table
  9229. @end table
  9230. The horizontal and vertical deblocking filters share the difference and
  9231. flatness values so you cannot set different horizontal and vertical
  9232. thresholds.
  9233. @table @option
  9234. @item h1/x1hdeblock
  9235. Experimental horizontal deblocking filter
  9236. @item v1/x1vdeblock
  9237. Experimental vertical deblocking filter
  9238. @item dr/dering
  9239. Deringing filter
  9240. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9241. @table @option
  9242. @item threshold1
  9243. larger -> stronger filtering
  9244. @item threshold2
  9245. larger -> stronger filtering
  9246. @item threshold3
  9247. larger -> stronger filtering
  9248. @end table
  9249. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9250. @table @option
  9251. @item f/fullyrange
  9252. Stretch luminance to @code{0-255}.
  9253. @end table
  9254. @item lb/linblenddeint
  9255. Linear blend deinterlacing filter that deinterlaces the given block by
  9256. filtering all lines with a @code{(1 2 1)} filter.
  9257. @item li/linipoldeint
  9258. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9259. linearly interpolating every second line.
  9260. @item ci/cubicipoldeint
  9261. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9262. cubically interpolating every second line.
  9263. @item md/mediandeint
  9264. Median deinterlacing filter that deinterlaces the given block by applying a
  9265. median filter to every second line.
  9266. @item fd/ffmpegdeint
  9267. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9268. second line with a @code{(-1 4 2 4 -1)} filter.
  9269. @item l5/lowpass5
  9270. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9271. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9272. @item fq/forceQuant[|quantizer]
  9273. Overrides the quantizer table from the input with the constant quantizer you
  9274. specify.
  9275. @table @option
  9276. @item quantizer
  9277. Quantizer to use
  9278. @end table
  9279. @item de/default
  9280. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9281. @item fa/fast
  9282. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9283. @item ac
  9284. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9285. @end table
  9286. @subsection Examples
  9287. @itemize
  9288. @item
  9289. Apply horizontal and vertical deblocking, deringing and automatic
  9290. brightness/contrast:
  9291. @example
  9292. pp=hb/vb/dr/al
  9293. @end example
  9294. @item
  9295. Apply default filters without brightness/contrast correction:
  9296. @example
  9297. pp=de/-al
  9298. @end example
  9299. @item
  9300. Apply default filters and temporal denoiser:
  9301. @example
  9302. pp=default/tmpnoise|1|2|3
  9303. @end example
  9304. @item
  9305. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9306. automatically depending on available CPU time:
  9307. @example
  9308. pp=hb|y/vb|a
  9309. @end example
  9310. @end itemize
  9311. @section pp7
  9312. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9313. similar to spp = 6 with 7 point DCT, where only the center sample is
  9314. used after IDCT.
  9315. The filter accepts the following options:
  9316. @table @option
  9317. @item qp
  9318. Force a constant quantization parameter. It accepts an integer in range
  9319. 0 to 63. If not set, the filter will use the QP from the video stream
  9320. (if available).
  9321. @item mode
  9322. Set thresholding mode. Available modes are:
  9323. @table @samp
  9324. @item hard
  9325. Set hard thresholding.
  9326. @item soft
  9327. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9328. @item medium
  9329. Set medium thresholding (good results, default).
  9330. @end table
  9331. @end table
  9332. @section premultiply
  9333. Apply alpha premultiply effect to input video stream using first plane
  9334. of second stream as alpha.
  9335. Both streams must have same dimensions and same pixel format.
  9336. The filter accepts the following option:
  9337. @table @option
  9338. @item planes
  9339. Set which planes will be processed, unprocessed planes will be copied.
  9340. By default value 0xf, all planes will be processed.
  9341. @item inplace
  9342. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9343. @end table
  9344. @section prewitt
  9345. Apply prewitt operator to input video stream.
  9346. The filter accepts the following option:
  9347. @table @option
  9348. @item planes
  9349. Set which planes will be processed, unprocessed planes will be copied.
  9350. By default value 0xf, all planes will be processed.
  9351. @item scale
  9352. Set value which will be multiplied with filtered result.
  9353. @item delta
  9354. Set value which will be added to filtered result.
  9355. @end table
  9356. @section pseudocolor
  9357. Alter frame colors in video with pseudocolors.
  9358. This filter accept the following options:
  9359. @table @option
  9360. @item c0
  9361. set pixel first component expression
  9362. @item c1
  9363. set pixel second component expression
  9364. @item c2
  9365. set pixel third component expression
  9366. @item c3
  9367. set pixel fourth component expression, corresponds to the alpha component
  9368. @item i
  9369. set component to use as base for altering colors
  9370. @end table
  9371. Each of them specifies the expression to use for computing the lookup table for
  9372. the corresponding pixel component values.
  9373. The expressions can contain the following constants and functions:
  9374. @table @option
  9375. @item w
  9376. @item h
  9377. The input width and height.
  9378. @item val
  9379. The input value for the pixel component.
  9380. @item ymin, umin, vmin, amin
  9381. The minimum allowed component value.
  9382. @item ymax, umax, vmax, amax
  9383. The maximum allowed component value.
  9384. @end table
  9385. All expressions default to "val".
  9386. @subsection Examples
  9387. @itemize
  9388. @item
  9389. Change too high luma values to gradient:
  9390. @example
  9391. 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'"
  9392. @end example
  9393. @end itemize
  9394. @section psnr
  9395. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9396. Ratio) between two input videos.
  9397. This filter takes in input two input videos, the first input is
  9398. considered the "main" source and is passed unchanged to the
  9399. output. The second input is used as a "reference" video for computing
  9400. the PSNR.
  9401. Both video inputs must have the same resolution and pixel format for
  9402. this filter to work correctly. Also it assumes that both inputs
  9403. have the same number of frames, which are compared one by one.
  9404. The obtained average PSNR is printed through the logging system.
  9405. The filter stores the accumulated MSE (mean squared error) of each
  9406. frame, and at the end of the processing it is averaged across all frames
  9407. equally, and the following formula is applied to obtain the PSNR:
  9408. @example
  9409. PSNR = 10*log10(MAX^2/MSE)
  9410. @end example
  9411. Where MAX is the average of the maximum values of each component of the
  9412. image.
  9413. The description of the accepted parameters follows.
  9414. @table @option
  9415. @item stats_file, f
  9416. If specified the filter will use the named file to save the PSNR of
  9417. each individual frame. When filename equals "-" the data is sent to
  9418. standard output.
  9419. @item stats_version
  9420. Specifies which version of the stats file format to use. Details of
  9421. each format are written below.
  9422. Default value is 1.
  9423. @item stats_add_max
  9424. Determines whether the max value is output to the stats log.
  9425. Default value is 0.
  9426. Requires stats_version >= 2. If this is set and stats_version < 2,
  9427. the filter will return an error.
  9428. @end table
  9429. This filter also supports the @ref{framesync} options.
  9430. The file printed if @var{stats_file} is selected, contains a sequence of
  9431. key/value pairs of the form @var{key}:@var{value} for each compared
  9432. couple of frames.
  9433. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9434. the list of per-frame-pair stats, with key value pairs following the frame
  9435. format with the following parameters:
  9436. @table @option
  9437. @item psnr_log_version
  9438. The version of the log file format. Will match @var{stats_version}.
  9439. @item fields
  9440. A comma separated list of the per-frame-pair parameters included in
  9441. the log.
  9442. @end table
  9443. A description of each shown per-frame-pair parameter follows:
  9444. @table @option
  9445. @item n
  9446. sequential number of the input frame, starting from 1
  9447. @item mse_avg
  9448. Mean Square Error pixel-by-pixel average difference of the compared
  9449. frames, averaged over all the image components.
  9450. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9451. Mean Square Error pixel-by-pixel average difference of the compared
  9452. frames for the component specified by the suffix.
  9453. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9454. Peak Signal to Noise ratio of the compared frames for the component
  9455. specified by the suffix.
  9456. @item max_avg, max_y, max_u, max_v
  9457. Maximum allowed value for each channel, and average over all
  9458. channels.
  9459. @end table
  9460. For example:
  9461. @example
  9462. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9463. [main][ref] psnr="stats_file=stats.log" [out]
  9464. @end example
  9465. On this example the input file being processed is compared with the
  9466. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9467. is stored in @file{stats.log}.
  9468. @anchor{pullup}
  9469. @section pullup
  9470. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9471. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9472. content.
  9473. The pullup filter is designed to take advantage of future context in making
  9474. its decisions. This filter is stateless in the sense that it does not lock
  9475. onto a pattern to follow, but it instead looks forward to the following
  9476. fields in order to identify matches and rebuild progressive frames.
  9477. To produce content with an even framerate, insert the fps filter after
  9478. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9479. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9480. The filter accepts the following options:
  9481. @table @option
  9482. @item jl
  9483. @item jr
  9484. @item jt
  9485. @item jb
  9486. These options set the amount of "junk" to ignore at the left, right, top, and
  9487. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9488. while top and bottom are in units of 2 lines.
  9489. The default is 8 pixels on each side.
  9490. @item sb
  9491. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9492. filter generating an occasional mismatched frame, but it may also cause an
  9493. excessive number of frames to be dropped during high motion sequences.
  9494. Conversely, setting it to -1 will make filter match fields more easily.
  9495. This may help processing of video where there is slight blurring between
  9496. the fields, but may also cause there to be interlaced frames in the output.
  9497. Default value is @code{0}.
  9498. @item mp
  9499. Set the metric plane to use. It accepts the following values:
  9500. @table @samp
  9501. @item l
  9502. Use luma plane.
  9503. @item u
  9504. Use chroma blue plane.
  9505. @item v
  9506. Use chroma red plane.
  9507. @end table
  9508. This option may be set to use chroma plane instead of the default luma plane
  9509. for doing filter's computations. This may improve accuracy on very clean
  9510. source material, but more likely will decrease accuracy, especially if there
  9511. is chroma noise (rainbow effect) or any grayscale video.
  9512. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9513. load and make pullup usable in realtime on slow machines.
  9514. @end table
  9515. For best results (without duplicated frames in the output file) it is
  9516. necessary to change the output frame rate. For example, to inverse
  9517. telecine NTSC input:
  9518. @example
  9519. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9520. @end example
  9521. @section qp
  9522. Change video quantization parameters (QP).
  9523. The filter accepts the following option:
  9524. @table @option
  9525. @item qp
  9526. Set expression for quantization parameter.
  9527. @end table
  9528. The expression is evaluated through the eval API and can contain, among others,
  9529. the following constants:
  9530. @table @var
  9531. @item known
  9532. 1 if index is not 129, 0 otherwise.
  9533. @item qp
  9534. Sequential index starting from -129 to 128.
  9535. @end table
  9536. @subsection Examples
  9537. @itemize
  9538. @item
  9539. Some equation like:
  9540. @example
  9541. qp=2+2*sin(PI*qp)
  9542. @end example
  9543. @end itemize
  9544. @section random
  9545. Flush video frames from internal cache of frames into a random order.
  9546. No frame is discarded.
  9547. Inspired by @ref{frei0r} nervous filter.
  9548. @table @option
  9549. @item frames
  9550. Set size in number of frames of internal cache, in range from @code{2} to
  9551. @code{512}. Default is @code{30}.
  9552. @item seed
  9553. Set seed for random number generator, must be an integer included between
  9554. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9555. less than @code{0}, the filter will try to use a good random seed on a
  9556. best effort basis.
  9557. @end table
  9558. @section readeia608
  9559. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9560. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9561. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9562. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9563. @table @option
  9564. @item lavfi.readeia608.X.cc
  9565. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9566. @item lavfi.readeia608.X.line
  9567. The number of the line on which the EIA-608 data was identified and read.
  9568. @end table
  9569. This filter accepts the following options:
  9570. @table @option
  9571. @item scan_min
  9572. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9573. @item scan_max
  9574. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9575. @item mac
  9576. Set minimal acceptable amplitude change for sync codes detection.
  9577. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9578. @item spw
  9579. Set the ratio of width reserved for sync code detection.
  9580. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9581. @item mhd
  9582. Set the max peaks height difference for sync code detection.
  9583. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9584. @item mpd
  9585. Set max peaks period difference for sync code detection.
  9586. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9587. @item msd
  9588. Set the first two max start code bits differences.
  9589. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9590. @item bhd
  9591. Set the minimum ratio of bits height compared to 3rd start code bit.
  9592. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9593. @item th_w
  9594. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9595. @item th_b
  9596. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9597. @item chp
  9598. Enable checking the parity bit. In the event of a parity error, the filter will output
  9599. @code{0x00} for that character. Default is false.
  9600. @end table
  9601. @subsection Examples
  9602. @itemize
  9603. @item
  9604. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9605. @example
  9606. 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
  9607. @end example
  9608. @end itemize
  9609. @section readvitc
  9610. Read vertical interval timecode (VITC) information from the top lines of a
  9611. video frame.
  9612. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9613. timecode value, if a valid timecode has been detected. Further metadata key
  9614. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9615. timecode data has been found or not.
  9616. This filter accepts the following options:
  9617. @table @option
  9618. @item scan_max
  9619. Set the maximum number of lines to scan for VITC data. If the value is set to
  9620. @code{-1} the full video frame is scanned. Default is @code{45}.
  9621. @item thr_b
  9622. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9623. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9624. @item thr_w
  9625. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9626. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9627. @end table
  9628. @subsection Examples
  9629. @itemize
  9630. @item
  9631. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9632. draw @code{--:--:--:--} as a placeholder:
  9633. @example
  9634. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9635. @end example
  9636. @end itemize
  9637. @section remap
  9638. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9639. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9640. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9641. value for pixel will be used for destination pixel.
  9642. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9643. will have Xmap/Ymap video stream dimensions.
  9644. Xmap and Ymap input video streams are 16bit depth, single channel.
  9645. @section removegrain
  9646. The removegrain filter is a spatial denoiser for progressive video.
  9647. @table @option
  9648. @item m0
  9649. Set mode for the first plane.
  9650. @item m1
  9651. Set mode for the second plane.
  9652. @item m2
  9653. Set mode for the third plane.
  9654. @item m3
  9655. Set mode for the fourth plane.
  9656. @end table
  9657. Range of mode is from 0 to 24. Description of each mode follows:
  9658. @table @var
  9659. @item 0
  9660. Leave input plane unchanged. Default.
  9661. @item 1
  9662. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9663. @item 2
  9664. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9665. @item 3
  9666. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9667. @item 4
  9668. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9669. This is equivalent to a median filter.
  9670. @item 5
  9671. Line-sensitive clipping giving the minimal change.
  9672. @item 6
  9673. Line-sensitive clipping, intermediate.
  9674. @item 7
  9675. Line-sensitive clipping, intermediate.
  9676. @item 8
  9677. Line-sensitive clipping, intermediate.
  9678. @item 9
  9679. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9680. @item 10
  9681. Replaces the target pixel with the closest neighbour.
  9682. @item 11
  9683. [1 2 1] horizontal and vertical kernel blur.
  9684. @item 12
  9685. Same as mode 11.
  9686. @item 13
  9687. Bob mode, interpolates top field from the line where the neighbours
  9688. pixels are the closest.
  9689. @item 14
  9690. Bob mode, interpolates bottom field from the line where the neighbours
  9691. pixels are the closest.
  9692. @item 15
  9693. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9694. interpolation formula.
  9695. @item 16
  9696. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9697. interpolation formula.
  9698. @item 17
  9699. Clips the pixel with the minimum and maximum of respectively the maximum and
  9700. minimum of each pair of opposite neighbour pixels.
  9701. @item 18
  9702. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9703. the current pixel is minimal.
  9704. @item 19
  9705. Replaces the pixel with the average of its 8 neighbours.
  9706. @item 20
  9707. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9708. @item 21
  9709. Clips pixels using the averages of opposite neighbour.
  9710. @item 22
  9711. Same as mode 21 but simpler and faster.
  9712. @item 23
  9713. Small edge and halo removal, but reputed useless.
  9714. @item 24
  9715. Similar as 23.
  9716. @end table
  9717. @section removelogo
  9718. Suppress a TV station logo, using an image file to determine which
  9719. pixels comprise the logo. It works by filling in the pixels that
  9720. comprise the logo with neighboring pixels.
  9721. The filter accepts the following options:
  9722. @table @option
  9723. @item filename, f
  9724. Set the filter bitmap file, which can be any image format supported by
  9725. libavformat. The width and height of the image file must match those of the
  9726. video stream being processed.
  9727. @end table
  9728. Pixels in the provided bitmap image with a value of zero are not
  9729. considered part of the logo, non-zero pixels are considered part of
  9730. the logo. If you use white (255) for the logo and black (0) for the
  9731. rest, you will be safe. For making the filter bitmap, it is
  9732. recommended to take a screen capture of a black frame with the logo
  9733. visible, and then using a threshold filter followed by the erode
  9734. filter once or twice.
  9735. If needed, little splotches can be fixed manually. Remember that if
  9736. logo pixels are not covered, the filter quality will be much
  9737. reduced. Marking too many pixels as part of the logo does not hurt as
  9738. much, but it will increase the amount of blurring needed to cover over
  9739. the image and will destroy more information than necessary, and extra
  9740. pixels will slow things down on a large logo.
  9741. @section repeatfields
  9742. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9743. fields based on its value.
  9744. @section reverse
  9745. Reverse a video clip.
  9746. Warning: This filter requires memory to buffer the entire clip, so trimming
  9747. is suggested.
  9748. @subsection Examples
  9749. @itemize
  9750. @item
  9751. Take the first 5 seconds of a clip, and reverse it.
  9752. @example
  9753. trim=end=5,reverse
  9754. @end example
  9755. @end itemize
  9756. @section roberts
  9757. Apply roberts cross operator to input video stream.
  9758. The filter accepts the following option:
  9759. @table @option
  9760. @item planes
  9761. Set which planes will be processed, unprocessed planes will be copied.
  9762. By default value 0xf, all planes will be processed.
  9763. @item scale
  9764. Set value which will be multiplied with filtered result.
  9765. @item delta
  9766. Set value which will be added to filtered result.
  9767. @end table
  9768. @section rotate
  9769. Rotate video by an arbitrary angle expressed in radians.
  9770. The filter accepts the following options:
  9771. A description of the optional parameters follows.
  9772. @table @option
  9773. @item angle, a
  9774. Set an expression for the angle by which to rotate the input video
  9775. clockwise, expressed as a number of radians. A negative value will
  9776. result in a counter-clockwise rotation. By default it is set to "0".
  9777. This expression is evaluated for each frame.
  9778. @item out_w, ow
  9779. Set the output width expression, default value is "iw".
  9780. This expression is evaluated just once during configuration.
  9781. @item out_h, oh
  9782. Set the output height expression, default value is "ih".
  9783. This expression is evaluated just once during configuration.
  9784. @item bilinear
  9785. Enable bilinear interpolation if set to 1, a value of 0 disables
  9786. it. Default value is 1.
  9787. @item fillcolor, c
  9788. Set the color used to fill the output area not covered by the rotated
  9789. image. For the general syntax of this option, check the "Color" section in the
  9790. ffmpeg-utils manual. If the special value "none" is selected then no
  9791. background is printed (useful for example if the background is never shown).
  9792. Default value is "black".
  9793. @end table
  9794. The expressions for the angle and the output size can contain the
  9795. following constants and functions:
  9796. @table @option
  9797. @item n
  9798. sequential number of the input frame, starting from 0. It is always NAN
  9799. before the first frame is filtered.
  9800. @item t
  9801. time in seconds of the input frame, it is set to 0 when the filter is
  9802. configured. It is always NAN before the first frame is filtered.
  9803. @item hsub
  9804. @item vsub
  9805. horizontal and vertical chroma subsample values. For example for the
  9806. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9807. @item in_w, iw
  9808. @item in_h, ih
  9809. the input video width and height
  9810. @item out_w, ow
  9811. @item out_h, oh
  9812. the output width and height, that is the size of the padded area as
  9813. specified by the @var{width} and @var{height} expressions
  9814. @item rotw(a)
  9815. @item roth(a)
  9816. the minimal width/height required for completely containing the input
  9817. video rotated by @var{a} radians.
  9818. These are only available when computing the @option{out_w} and
  9819. @option{out_h} expressions.
  9820. @end table
  9821. @subsection Examples
  9822. @itemize
  9823. @item
  9824. Rotate the input by PI/6 radians clockwise:
  9825. @example
  9826. rotate=PI/6
  9827. @end example
  9828. @item
  9829. Rotate the input by PI/6 radians counter-clockwise:
  9830. @example
  9831. rotate=-PI/6
  9832. @end example
  9833. @item
  9834. Rotate the input by 45 degrees clockwise:
  9835. @example
  9836. rotate=45*PI/180
  9837. @end example
  9838. @item
  9839. Apply a constant rotation with period T, starting from an angle of PI/3:
  9840. @example
  9841. rotate=PI/3+2*PI*t/T
  9842. @end example
  9843. @item
  9844. Make the input video rotation oscillating with a period of T
  9845. seconds and an amplitude of A radians:
  9846. @example
  9847. rotate=A*sin(2*PI/T*t)
  9848. @end example
  9849. @item
  9850. Rotate the video, output size is chosen so that the whole rotating
  9851. input video is always completely contained in the output:
  9852. @example
  9853. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9854. @end example
  9855. @item
  9856. Rotate the video, reduce the output size so that no background is ever
  9857. shown:
  9858. @example
  9859. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9860. @end example
  9861. @end itemize
  9862. @subsection Commands
  9863. The filter supports the following commands:
  9864. @table @option
  9865. @item a, angle
  9866. Set the angle expression.
  9867. The command accepts the same syntax of the corresponding option.
  9868. If the specified expression is not valid, it is kept at its current
  9869. value.
  9870. @end table
  9871. @section sab
  9872. Apply Shape Adaptive Blur.
  9873. The filter accepts the following options:
  9874. @table @option
  9875. @item luma_radius, lr
  9876. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9877. value is 1.0. A greater value will result in a more blurred image, and
  9878. in slower processing.
  9879. @item luma_pre_filter_radius, lpfr
  9880. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9881. value is 1.0.
  9882. @item luma_strength, ls
  9883. Set luma maximum difference between pixels to still be considered, must
  9884. be a value in the 0.1-100.0 range, default value is 1.0.
  9885. @item chroma_radius, cr
  9886. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9887. greater value will result in a more blurred image, and in slower
  9888. processing.
  9889. @item chroma_pre_filter_radius, cpfr
  9890. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9891. @item chroma_strength, cs
  9892. Set chroma maximum difference between pixels to still be considered,
  9893. must be a value in the -0.9-100.0 range.
  9894. @end table
  9895. Each chroma option value, if not explicitly specified, is set to the
  9896. corresponding luma option value.
  9897. @anchor{scale}
  9898. @section scale
  9899. Scale (resize) the input video, using the libswscale library.
  9900. The scale filter forces the output display aspect ratio to be the same
  9901. of the input, by changing the output sample aspect ratio.
  9902. If the input image format is different from the format requested by
  9903. the next filter, the scale filter will convert the input to the
  9904. requested format.
  9905. @subsection Options
  9906. The filter accepts the following options, or any of the options
  9907. supported by the libswscale scaler.
  9908. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9909. the complete list of scaler options.
  9910. @table @option
  9911. @item width, w
  9912. @item height, h
  9913. Set the output video dimension expression. Default value is the input
  9914. dimension.
  9915. If the @var{width} or @var{w} value is 0, the input width is used for
  9916. the output. If the @var{height} or @var{h} value is 0, the input height
  9917. is used for the output.
  9918. If one and only one of the values is -n with n >= 1, the scale filter
  9919. will use a value that maintains the aspect ratio of the input image,
  9920. calculated from the other specified dimension. After that it will,
  9921. however, make sure that the calculated dimension is divisible by n and
  9922. adjust the value if necessary.
  9923. If both values are -n with n >= 1, the behavior will be identical to
  9924. both values being set to 0 as previously detailed.
  9925. See below for the list of accepted constants for use in the dimension
  9926. expression.
  9927. @item eval
  9928. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9929. @table @samp
  9930. @item init
  9931. Only evaluate expressions once during the filter initialization or when a command is processed.
  9932. @item frame
  9933. Evaluate expressions for each incoming frame.
  9934. @end table
  9935. Default value is @samp{init}.
  9936. @item interl
  9937. Set the interlacing mode. It accepts the following values:
  9938. @table @samp
  9939. @item 1
  9940. Force interlaced aware scaling.
  9941. @item 0
  9942. Do not apply interlaced scaling.
  9943. @item -1
  9944. Select interlaced aware scaling depending on whether the source frames
  9945. are flagged as interlaced or not.
  9946. @end table
  9947. Default value is @samp{0}.
  9948. @item flags
  9949. Set libswscale scaling flags. See
  9950. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9951. complete list of values. If not explicitly specified the filter applies
  9952. the default flags.
  9953. @item param0, param1
  9954. Set libswscale input parameters for scaling algorithms that need them. See
  9955. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9956. complete documentation. If not explicitly specified the filter applies
  9957. empty parameters.
  9958. @item size, s
  9959. Set the video size. For the syntax of this option, check the
  9960. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9961. @item in_color_matrix
  9962. @item out_color_matrix
  9963. Set in/output YCbCr color space type.
  9964. This allows the autodetected value to be overridden as well as allows forcing
  9965. a specific value used for the output and encoder.
  9966. If not specified, the color space type depends on the pixel format.
  9967. Possible values:
  9968. @table @samp
  9969. @item auto
  9970. Choose automatically.
  9971. @item bt709
  9972. Format conforming to International Telecommunication Union (ITU)
  9973. Recommendation BT.709.
  9974. @item fcc
  9975. Set color space conforming to the United States Federal Communications
  9976. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9977. @item bt601
  9978. Set color space conforming to:
  9979. @itemize
  9980. @item
  9981. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9982. @item
  9983. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9984. @item
  9985. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9986. @end itemize
  9987. @item smpte240m
  9988. Set color space conforming to SMPTE ST 240:1999.
  9989. @end table
  9990. @item in_range
  9991. @item out_range
  9992. Set in/output YCbCr sample range.
  9993. This allows the autodetected value to be overridden as well as allows forcing
  9994. a specific value used for the output and encoder. If not specified, the
  9995. range depends on the pixel format. Possible values:
  9996. @table @samp
  9997. @item auto/unknown
  9998. Choose automatically.
  9999. @item jpeg/full/pc
  10000. Set full range (0-255 in case of 8-bit luma).
  10001. @item mpeg/limited/tv
  10002. Set "MPEG" range (16-235 in case of 8-bit luma).
  10003. @end table
  10004. @item force_original_aspect_ratio
  10005. Enable decreasing or increasing output video width or height if necessary to
  10006. keep the original aspect ratio. Possible values:
  10007. @table @samp
  10008. @item disable
  10009. Scale the video as specified and disable this feature.
  10010. @item decrease
  10011. The output video dimensions will automatically be decreased if needed.
  10012. @item increase
  10013. The output video dimensions will automatically be increased if needed.
  10014. @end table
  10015. One useful instance of this option is that when you know a specific device's
  10016. maximum allowed resolution, you can use this to limit the output video to
  10017. that, while retaining the aspect ratio. For example, device A allows
  10018. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10019. decrease) and specifying 1280x720 to the command line makes the output
  10020. 1280x533.
  10021. Please note that this is a different thing than specifying -1 for @option{w}
  10022. or @option{h}, you still need to specify the output resolution for this option
  10023. to work.
  10024. @end table
  10025. The values of the @option{w} and @option{h} options are expressions
  10026. containing the following constants:
  10027. @table @var
  10028. @item in_w
  10029. @item in_h
  10030. The input width and height
  10031. @item iw
  10032. @item ih
  10033. These are the same as @var{in_w} and @var{in_h}.
  10034. @item out_w
  10035. @item out_h
  10036. The output (scaled) width and height
  10037. @item ow
  10038. @item oh
  10039. These are the same as @var{out_w} and @var{out_h}
  10040. @item a
  10041. The same as @var{iw} / @var{ih}
  10042. @item sar
  10043. input sample aspect ratio
  10044. @item dar
  10045. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10046. @item hsub
  10047. @item vsub
  10048. horizontal and vertical input chroma subsample values. For example for the
  10049. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10050. @item ohsub
  10051. @item ovsub
  10052. horizontal and vertical output chroma subsample values. For example for the
  10053. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10054. @end table
  10055. @subsection Examples
  10056. @itemize
  10057. @item
  10058. Scale the input video to a size of 200x100
  10059. @example
  10060. scale=w=200:h=100
  10061. @end example
  10062. This is equivalent to:
  10063. @example
  10064. scale=200:100
  10065. @end example
  10066. or:
  10067. @example
  10068. scale=200x100
  10069. @end example
  10070. @item
  10071. Specify a size abbreviation for the output size:
  10072. @example
  10073. scale=qcif
  10074. @end example
  10075. which can also be written as:
  10076. @example
  10077. scale=size=qcif
  10078. @end example
  10079. @item
  10080. Scale the input to 2x:
  10081. @example
  10082. scale=w=2*iw:h=2*ih
  10083. @end example
  10084. @item
  10085. The above is the same as:
  10086. @example
  10087. scale=2*in_w:2*in_h
  10088. @end example
  10089. @item
  10090. Scale the input to 2x with forced interlaced scaling:
  10091. @example
  10092. scale=2*iw:2*ih:interl=1
  10093. @end example
  10094. @item
  10095. Scale the input to half size:
  10096. @example
  10097. scale=w=iw/2:h=ih/2
  10098. @end example
  10099. @item
  10100. Increase the width, and set the height to the same size:
  10101. @example
  10102. scale=3/2*iw:ow
  10103. @end example
  10104. @item
  10105. Seek Greek harmony:
  10106. @example
  10107. scale=iw:1/PHI*iw
  10108. scale=ih*PHI:ih
  10109. @end example
  10110. @item
  10111. Increase the height, and set the width to 3/2 of the height:
  10112. @example
  10113. scale=w=3/2*oh:h=3/5*ih
  10114. @end example
  10115. @item
  10116. Increase the size, making the size a multiple of the chroma
  10117. subsample values:
  10118. @example
  10119. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10120. @end example
  10121. @item
  10122. Increase the width to a maximum of 500 pixels,
  10123. keeping the same aspect ratio as the input:
  10124. @example
  10125. scale=w='min(500\, iw*3/2):h=-1'
  10126. @end example
  10127. @end itemize
  10128. @subsection Commands
  10129. This filter supports the following commands:
  10130. @table @option
  10131. @item width, w
  10132. @item height, h
  10133. Set the output video dimension expression.
  10134. The command accepts the same syntax of the corresponding option.
  10135. If the specified expression is not valid, it is kept at its current
  10136. value.
  10137. @end table
  10138. @section scale_npp
  10139. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10140. format conversion on CUDA video frames. Setting the output width and height
  10141. works in the same way as for the @var{scale} filter.
  10142. The following additional options are accepted:
  10143. @table @option
  10144. @item format
  10145. The pixel format of the output CUDA frames. If set to the string "same" (the
  10146. default), the input format will be kept. Note that automatic format negotiation
  10147. and conversion is not yet supported for hardware frames
  10148. @item interp_algo
  10149. The interpolation algorithm used for resizing. One of the following:
  10150. @table @option
  10151. @item nn
  10152. Nearest neighbour.
  10153. @item linear
  10154. @item cubic
  10155. @item cubic2p_bspline
  10156. 2-parameter cubic (B=1, C=0)
  10157. @item cubic2p_catmullrom
  10158. 2-parameter cubic (B=0, C=1/2)
  10159. @item cubic2p_b05c03
  10160. 2-parameter cubic (B=1/2, C=3/10)
  10161. @item super
  10162. Supersampling
  10163. @item lanczos
  10164. @end table
  10165. @end table
  10166. @section scale2ref
  10167. Scale (resize) the input video, based on a reference video.
  10168. See the scale filter for available options, scale2ref supports the same but
  10169. uses the reference video instead of the main input as basis. scale2ref also
  10170. supports the following additional constants for the @option{w} and
  10171. @option{h} options:
  10172. @table @var
  10173. @item main_w
  10174. @item main_h
  10175. The main input video's width and height
  10176. @item main_a
  10177. The same as @var{main_w} / @var{main_h}
  10178. @item main_sar
  10179. The main input video's sample aspect ratio
  10180. @item main_dar, mdar
  10181. The main input video's display aspect ratio. Calculated from
  10182. @code{(main_w / main_h) * main_sar}.
  10183. @item main_hsub
  10184. @item main_vsub
  10185. The main input video's horizontal and vertical chroma subsample values.
  10186. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10187. is 1.
  10188. @end table
  10189. @subsection Examples
  10190. @itemize
  10191. @item
  10192. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10193. @example
  10194. 'scale2ref[b][a];[a][b]overlay'
  10195. @end example
  10196. @end itemize
  10197. @anchor{selectivecolor}
  10198. @section selectivecolor
  10199. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10200. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10201. by the "purity" of the color (that is, how saturated it already is).
  10202. This filter is similar to the Adobe Photoshop Selective Color tool.
  10203. The filter accepts the following options:
  10204. @table @option
  10205. @item correction_method
  10206. Select color correction method.
  10207. Available values are:
  10208. @table @samp
  10209. @item absolute
  10210. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10211. component value).
  10212. @item relative
  10213. Specified adjustments are relative to the original component value.
  10214. @end table
  10215. Default is @code{absolute}.
  10216. @item reds
  10217. Adjustments for red pixels (pixels where the red component is the maximum)
  10218. @item yellows
  10219. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10220. @item greens
  10221. Adjustments for green pixels (pixels where the green component is the maximum)
  10222. @item cyans
  10223. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10224. @item blues
  10225. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10226. @item magentas
  10227. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10228. @item whites
  10229. Adjustments for white pixels (pixels where all components are greater than 128)
  10230. @item neutrals
  10231. Adjustments for all pixels except pure black and pure white
  10232. @item blacks
  10233. Adjustments for black pixels (pixels where all components are lesser than 128)
  10234. @item psfile
  10235. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10236. @end table
  10237. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10238. 4 space separated floating point adjustment values in the [-1,1] range,
  10239. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10240. pixels of its range.
  10241. @subsection Examples
  10242. @itemize
  10243. @item
  10244. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10245. increase magenta by 27% in blue areas:
  10246. @example
  10247. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10248. @end example
  10249. @item
  10250. Use a Photoshop selective color preset:
  10251. @example
  10252. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10253. @end example
  10254. @end itemize
  10255. @anchor{separatefields}
  10256. @section separatefields
  10257. The @code{separatefields} takes a frame-based video input and splits
  10258. each frame into its components fields, producing a new half height clip
  10259. with twice the frame rate and twice the frame count.
  10260. This filter use field-dominance information in frame to decide which
  10261. of each pair of fields to place first in the output.
  10262. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10263. @section setdar, setsar
  10264. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10265. output video.
  10266. This is done by changing the specified Sample (aka Pixel) Aspect
  10267. Ratio, according to the following equation:
  10268. @example
  10269. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10270. @end example
  10271. Keep in mind that the @code{setdar} filter does not modify the pixel
  10272. dimensions of the video frame. Also, the display aspect ratio set by
  10273. this filter may be changed by later filters in the filterchain,
  10274. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10275. applied.
  10276. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10277. the filter output video.
  10278. Note that as a consequence of the application of this filter, the
  10279. output display aspect ratio will change according to the equation
  10280. above.
  10281. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10282. filter may be changed by later filters in the filterchain, e.g. if
  10283. another "setsar" or a "setdar" filter is applied.
  10284. It accepts the following parameters:
  10285. @table @option
  10286. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10287. Set the aspect ratio used by the filter.
  10288. The parameter can be a floating point number string, an expression, or
  10289. a string of the form @var{num}:@var{den}, where @var{num} and
  10290. @var{den} are the numerator and denominator of the aspect ratio. If
  10291. the parameter is not specified, it is assumed the value "0".
  10292. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10293. should be escaped.
  10294. @item max
  10295. Set the maximum integer value to use for expressing numerator and
  10296. denominator when reducing the expressed aspect ratio to a rational.
  10297. Default value is @code{100}.
  10298. @end table
  10299. The parameter @var{sar} is an expression containing
  10300. the following constants:
  10301. @table @option
  10302. @item E, PI, PHI
  10303. These are approximated values for the mathematical constants e
  10304. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10305. @item w, h
  10306. The input width and height.
  10307. @item a
  10308. These are the same as @var{w} / @var{h}.
  10309. @item sar
  10310. The input sample aspect ratio.
  10311. @item dar
  10312. The input display aspect ratio. It is the same as
  10313. (@var{w} / @var{h}) * @var{sar}.
  10314. @item hsub, vsub
  10315. Horizontal and vertical chroma subsample values. For example, for the
  10316. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10317. @end table
  10318. @subsection Examples
  10319. @itemize
  10320. @item
  10321. To change the display aspect ratio to 16:9, specify one of the following:
  10322. @example
  10323. setdar=dar=1.77777
  10324. setdar=dar=16/9
  10325. @end example
  10326. @item
  10327. To change the sample aspect ratio to 10:11, specify:
  10328. @example
  10329. setsar=sar=10/11
  10330. @end example
  10331. @item
  10332. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10333. 1000 in the aspect ratio reduction, use the command:
  10334. @example
  10335. setdar=ratio=16/9:max=1000
  10336. @end example
  10337. @end itemize
  10338. @anchor{setfield}
  10339. @section setfield
  10340. Force field for the output video frame.
  10341. The @code{setfield} filter marks the interlace type field for the
  10342. output frames. It does not change the input frame, but only sets the
  10343. corresponding property, which affects how the frame is treated by
  10344. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10345. The filter accepts the following options:
  10346. @table @option
  10347. @item mode
  10348. Available values are:
  10349. @table @samp
  10350. @item auto
  10351. Keep the same field property.
  10352. @item bff
  10353. Mark the frame as bottom-field-first.
  10354. @item tff
  10355. Mark the frame as top-field-first.
  10356. @item prog
  10357. Mark the frame as progressive.
  10358. @end table
  10359. @end table
  10360. @section showinfo
  10361. Show a line containing various information for each input video frame.
  10362. The input video is not modified.
  10363. The shown line contains a sequence of key/value pairs of the form
  10364. @var{key}:@var{value}.
  10365. The following values are shown in the output:
  10366. @table @option
  10367. @item n
  10368. The (sequential) number of the input frame, starting from 0.
  10369. @item pts
  10370. The Presentation TimeStamp of the input frame, expressed as a number of
  10371. time base units. The time base unit depends on the filter input pad.
  10372. @item pts_time
  10373. The Presentation TimeStamp of the input frame, expressed as a number of
  10374. seconds.
  10375. @item pos
  10376. The position of the frame in the input stream, or -1 if this information is
  10377. unavailable and/or meaningless (for example in case of synthetic video).
  10378. @item fmt
  10379. The pixel format name.
  10380. @item sar
  10381. The sample aspect ratio of the input frame, expressed in the form
  10382. @var{num}/@var{den}.
  10383. @item s
  10384. The size of the input frame. For the syntax of this option, check the
  10385. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10386. @item i
  10387. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10388. for bottom field first).
  10389. @item iskey
  10390. This is 1 if the frame is a key frame, 0 otherwise.
  10391. @item type
  10392. The picture type of the input frame ("I" for an I-frame, "P" for a
  10393. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10394. Also refer to the documentation of the @code{AVPictureType} enum and of
  10395. the @code{av_get_picture_type_char} function defined in
  10396. @file{libavutil/avutil.h}.
  10397. @item checksum
  10398. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10399. @item plane_checksum
  10400. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10401. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10402. @end table
  10403. @section showpalette
  10404. Displays the 256 colors palette of each frame. This filter is only relevant for
  10405. @var{pal8} pixel format frames.
  10406. It accepts the following option:
  10407. @table @option
  10408. @item s
  10409. Set the size of the box used to represent one palette color entry. Default is
  10410. @code{30} (for a @code{30x30} pixel box).
  10411. @end table
  10412. @section shuffleframes
  10413. Reorder and/or duplicate and/or drop video frames.
  10414. It accepts the following parameters:
  10415. @table @option
  10416. @item mapping
  10417. Set the destination indexes of input frames.
  10418. This is space or '|' separated list of indexes that maps input frames to output
  10419. frames. Number of indexes also sets maximal value that each index may have.
  10420. '-1' index have special meaning and that is to drop frame.
  10421. @end table
  10422. The first frame has the index 0. The default is to keep the input unchanged.
  10423. @subsection Examples
  10424. @itemize
  10425. @item
  10426. Swap second and third frame of every three frames of the input:
  10427. @example
  10428. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10429. @end example
  10430. @item
  10431. Swap 10th and 1st frame of every ten frames of the input:
  10432. @example
  10433. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10434. @end example
  10435. @end itemize
  10436. @section shuffleplanes
  10437. Reorder and/or duplicate video planes.
  10438. It accepts the following parameters:
  10439. @table @option
  10440. @item map0
  10441. The index of the input plane to be used as the first output plane.
  10442. @item map1
  10443. The index of the input plane to be used as the second output plane.
  10444. @item map2
  10445. The index of the input plane to be used as the third output plane.
  10446. @item map3
  10447. The index of the input plane to be used as the fourth output plane.
  10448. @end table
  10449. The first plane has the index 0. The default is to keep the input unchanged.
  10450. @subsection Examples
  10451. @itemize
  10452. @item
  10453. Swap the second and third planes of the input:
  10454. @example
  10455. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10456. @end example
  10457. @end itemize
  10458. @anchor{signalstats}
  10459. @section signalstats
  10460. Evaluate various visual metrics that assist in determining issues associated
  10461. with the digitization of analog video media.
  10462. By default the filter will log these metadata values:
  10463. @table @option
  10464. @item YMIN
  10465. Display the minimal Y value contained within the input frame. Expressed in
  10466. range of [0-255].
  10467. @item YLOW
  10468. Display the Y value at the 10% percentile within the input frame. Expressed in
  10469. range of [0-255].
  10470. @item YAVG
  10471. Display the average Y value within the input frame. Expressed in range of
  10472. [0-255].
  10473. @item YHIGH
  10474. Display the Y value at the 90% percentile within the input frame. Expressed in
  10475. range of [0-255].
  10476. @item YMAX
  10477. Display the maximum Y value contained within the input frame. Expressed in
  10478. range of [0-255].
  10479. @item UMIN
  10480. Display the minimal U value contained within the input frame. Expressed in
  10481. range of [0-255].
  10482. @item ULOW
  10483. Display the U value at the 10% percentile within the input frame. Expressed in
  10484. range of [0-255].
  10485. @item UAVG
  10486. Display the average U value within the input frame. Expressed in range of
  10487. [0-255].
  10488. @item UHIGH
  10489. Display the U value at the 90% percentile within the input frame. Expressed in
  10490. range of [0-255].
  10491. @item UMAX
  10492. Display the maximum U value contained within the input frame. Expressed in
  10493. range of [0-255].
  10494. @item VMIN
  10495. Display the minimal V value contained within the input frame. Expressed in
  10496. range of [0-255].
  10497. @item VLOW
  10498. Display the V value at the 10% percentile within the input frame. Expressed in
  10499. range of [0-255].
  10500. @item VAVG
  10501. Display the average V value within the input frame. Expressed in range of
  10502. [0-255].
  10503. @item VHIGH
  10504. Display the V value at the 90% percentile within the input frame. Expressed in
  10505. range of [0-255].
  10506. @item VMAX
  10507. Display the maximum V value contained within the input frame. Expressed in
  10508. range of [0-255].
  10509. @item SATMIN
  10510. Display the minimal saturation value contained within the input frame.
  10511. Expressed in range of [0-~181.02].
  10512. @item SATLOW
  10513. Display the saturation value at the 10% percentile within the input frame.
  10514. Expressed in range of [0-~181.02].
  10515. @item SATAVG
  10516. Display the average saturation value within the input frame. Expressed in range
  10517. of [0-~181.02].
  10518. @item SATHIGH
  10519. Display the saturation value at the 90% percentile within the input frame.
  10520. Expressed in range of [0-~181.02].
  10521. @item SATMAX
  10522. Display the maximum saturation value contained within the input frame.
  10523. Expressed in range of [0-~181.02].
  10524. @item HUEMED
  10525. Display the median value for hue within the input frame. Expressed in range of
  10526. [0-360].
  10527. @item HUEAVG
  10528. Display the average value for hue within the input frame. Expressed in range of
  10529. [0-360].
  10530. @item YDIF
  10531. Display the average of sample value difference between all values of the Y
  10532. plane in the current frame and corresponding values of the previous input frame.
  10533. Expressed in range of [0-255].
  10534. @item UDIF
  10535. Display the average of sample value difference between all values of the U
  10536. plane in the current frame and corresponding values of the previous input frame.
  10537. Expressed in range of [0-255].
  10538. @item VDIF
  10539. Display the average of sample value difference between all values of the V
  10540. plane in the current frame and corresponding values of the previous input frame.
  10541. Expressed in range of [0-255].
  10542. @item YBITDEPTH
  10543. Display bit depth of Y plane in current frame.
  10544. Expressed in range of [0-16].
  10545. @item UBITDEPTH
  10546. Display bit depth of U plane in current frame.
  10547. Expressed in range of [0-16].
  10548. @item VBITDEPTH
  10549. Display bit depth of V plane in current frame.
  10550. Expressed in range of [0-16].
  10551. @end table
  10552. The filter accepts the following options:
  10553. @table @option
  10554. @item stat
  10555. @item out
  10556. @option{stat} specify an additional form of image analysis.
  10557. @option{out} output video with the specified type of pixel highlighted.
  10558. Both options accept the following values:
  10559. @table @samp
  10560. @item tout
  10561. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10562. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10563. include the results of video dropouts, head clogs, or tape tracking issues.
  10564. @item vrep
  10565. Identify @var{vertical line repetition}. Vertical line repetition includes
  10566. similar rows of pixels within a frame. In born-digital video vertical line
  10567. repetition is common, but this pattern is uncommon in video digitized from an
  10568. analog source. When it occurs in video that results from the digitization of an
  10569. analog source it can indicate concealment from a dropout compensator.
  10570. @item brng
  10571. Identify pixels that fall outside of legal broadcast range.
  10572. @end table
  10573. @item color, c
  10574. Set the highlight color for the @option{out} option. The default color is
  10575. yellow.
  10576. @end table
  10577. @subsection Examples
  10578. @itemize
  10579. @item
  10580. Output data of various video metrics:
  10581. @example
  10582. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10583. @end example
  10584. @item
  10585. Output specific data about the minimum and maximum values of the Y plane per frame:
  10586. @example
  10587. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10588. @end example
  10589. @item
  10590. Playback video while highlighting pixels that are outside of broadcast range in red.
  10591. @example
  10592. ffplay example.mov -vf signalstats="out=brng:color=red"
  10593. @end example
  10594. @item
  10595. Playback video with signalstats metadata drawn over the frame.
  10596. @example
  10597. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10598. @end example
  10599. The contents of signalstat_drawtext.txt used in the command are:
  10600. @example
  10601. time %@{pts:hms@}
  10602. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10603. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10604. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10605. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10606. @end example
  10607. @end itemize
  10608. @anchor{signature}
  10609. @section signature
  10610. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10611. input. In this case the matching between the inputs can be calculated additionally.
  10612. The filter always passes through the first input. The signature of each stream can
  10613. be written into a file.
  10614. It accepts the following options:
  10615. @table @option
  10616. @item detectmode
  10617. Enable or disable the matching process.
  10618. Available values are:
  10619. @table @samp
  10620. @item off
  10621. Disable the calculation of a matching (default).
  10622. @item full
  10623. Calculate the matching for the whole video and output whether the whole video
  10624. matches or only parts.
  10625. @item fast
  10626. Calculate only until a matching is found or the video ends. Should be faster in
  10627. some cases.
  10628. @end table
  10629. @item nb_inputs
  10630. Set the number of inputs. The option value must be a non negative integer.
  10631. Default value is 1.
  10632. @item filename
  10633. Set the path to which the output is written. If there is more than one input,
  10634. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10635. integer), that will be replaced with the input number. If no filename is
  10636. specified, no output will be written. This is the default.
  10637. @item format
  10638. Choose the output format.
  10639. Available values are:
  10640. @table @samp
  10641. @item binary
  10642. Use the specified binary representation (default).
  10643. @item xml
  10644. Use the specified xml representation.
  10645. @end table
  10646. @item th_d
  10647. Set threshold to detect one word as similar. The option value must be an integer
  10648. greater than zero. The default value is 9000.
  10649. @item th_dc
  10650. Set threshold to detect all words as similar. The option value must be an integer
  10651. greater than zero. The default value is 60000.
  10652. @item th_xh
  10653. Set threshold to detect frames as similar. The option value must be an integer
  10654. greater than zero. The default value is 116.
  10655. @item th_di
  10656. Set the minimum length of a sequence in frames to recognize it as matching
  10657. sequence. The option value must be a non negative integer value.
  10658. The default value is 0.
  10659. @item th_it
  10660. Set the minimum relation, that matching frames to all frames must have.
  10661. The option value must be a double value between 0 and 1. The default value is 0.5.
  10662. @end table
  10663. @subsection Examples
  10664. @itemize
  10665. @item
  10666. To calculate the signature of an input video and store it in signature.bin:
  10667. @example
  10668. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10669. @end example
  10670. @item
  10671. To detect whether two videos match and store the signatures in XML format in
  10672. signature0.xml and signature1.xml:
  10673. @example
  10674. 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 -
  10675. @end example
  10676. @end itemize
  10677. @anchor{smartblur}
  10678. @section smartblur
  10679. Blur the input video without impacting the outlines.
  10680. It accepts the following options:
  10681. @table @option
  10682. @item luma_radius, lr
  10683. Set the luma radius. The option value must be a float number in
  10684. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10685. used to blur the image (slower if larger). Default value is 1.0.
  10686. @item luma_strength, ls
  10687. Set the luma strength. The option value must be a float number
  10688. in the range [-1.0,1.0] that configures the blurring. A value included
  10689. in [0.0,1.0] will blur the image whereas a value included in
  10690. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10691. @item luma_threshold, lt
  10692. Set the luma threshold used as a coefficient to determine
  10693. whether a pixel should be blurred or not. The option value must be an
  10694. integer in the range [-30,30]. A value of 0 will filter all the image,
  10695. a value included in [0,30] will filter flat areas and a value included
  10696. in [-30,0] will filter edges. Default value is 0.
  10697. @item chroma_radius, cr
  10698. Set the chroma radius. The option value must be a float number in
  10699. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10700. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10701. @item chroma_strength, cs
  10702. Set the chroma strength. The option value must be a float number
  10703. in the range [-1.0,1.0] that configures the blurring. A value included
  10704. in [0.0,1.0] will blur the image whereas a value included in
  10705. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10706. @item chroma_threshold, ct
  10707. Set the chroma threshold used as a coefficient to determine
  10708. whether a pixel should be blurred or not. The option value must be an
  10709. integer in the range [-30,30]. A value of 0 will filter all the image,
  10710. a value included in [0,30] will filter flat areas and a value included
  10711. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10712. @end table
  10713. If a chroma option is not explicitly set, the corresponding luma value
  10714. is set.
  10715. @section ssim
  10716. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10717. This filter takes in input two input videos, the first input is
  10718. considered the "main" source and is passed unchanged to the
  10719. output. The second input is used as a "reference" video for computing
  10720. the SSIM.
  10721. Both video inputs must have the same resolution and pixel format for
  10722. this filter to work correctly. Also it assumes that both inputs
  10723. have the same number of frames, which are compared one by one.
  10724. The filter stores the calculated SSIM of each frame.
  10725. The description of the accepted parameters follows.
  10726. @table @option
  10727. @item stats_file, f
  10728. If specified the filter will use the named file to save the SSIM of
  10729. each individual frame. When filename equals "-" the data is sent to
  10730. standard output.
  10731. @end table
  10732. The file printed if @var{stats_file} is selected, contains a sequence of
  10733. key/value pairs of the form @var{key}:@var{value} for each compared
  10734. couple of frames.
  10735. A description of each shown parameter follows:
  10736. @table @option
  10737. @item n
  10738. sequential number of the input frame, starting from 1
  10739. @item Y, U, V, R, G, B
  10740. SSIM of the compared frames for the component specified by the suffix.
  10741. @item All
  10742. SSIM of the compared frames for the whole frame.
  10743. @item dB
  10744. Same as above but in dB representation.
  10745. @end table
  10746. This filter also supports the @ref{framesync} options.
  10747. For example:
  10748. @example
  10749. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10750. [main][ref] ssim="stats_file=stats.log" [out]
  10751. @end example
  10752. On this example the input file being processed is compared with the
  10753. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10754. is stored in @file{stats.log}.
  10755. Another example with both psnr and ssim at same time:
  10756. @example
  10757. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10758. @end example
  10759. @section stereo3d
  10760. Convert between different stereoscopic image formats.
  10761. The filters accept the following options:
  10762. @table @option
  10763. @item in
  10764. Set stereoscopic image format of input.
  10765. Available values for input image formats are:
  10766. @table @samp
  10767. @item sbsl
  10768. side by side parallel (left eye left, right eye right)
  10769. @item sbsr
  10770. side by side crosseye (right eye left, left eye right)
  10771. @item sbs2l
  10772. side by side parallel with half width resolution
  10773. (left eye left, right eye right)
  10774. @item sbs2r
  10775. side by side crosseye with half width resolution
  10776. (right eye left, left eye right)
  10777. @item abl
  10778. above-below (left eye above, right eye below)
  10779. @item abr
  10780. above-below (right eye above, left eye below)
  10781. @item ab2l
  10782. above-below with half height resolution
  10783. (left eye above, right eye below)
  10784. @item ab2r
  10785. above-below with half height resolution
  10786. (right eye above, left eye below)
  10787. @item al
  10788. alternating frames (left eye first, right eye second)
  10789. @item ar
  10790. alternating frames (right eye first, left eye second)
  10791. @item irl
  10792. interleaved rows (left eye has top row, right eye starts on next row)
  10793. @item irr
  10794. interleaved rows (right eye has top row, left eye starts on next row)
  10795. @item icl
  10796. interleaved columns, left eye first
  10797. @item icr
  10798. interleaved columns, right eye first
  10799. Default value is @samp{sbsl}.
  10800. @end table
  10801. @item out
  10802. Set stereoscopic image format of output.
  10803. @table @samp
  10804. @item sbsl
  10805. side by side parallel (left eye left, right eye right)
  10806. @item sbsr
  10807. side by side crosseye (right eye left, left eye right)
  10808. @item sbs2l
  10809. side by side parallel with half width resolution
  10810. (left eye left, right eye right)
  10811. @item sbs2r
  10812. side by side crosseye with half width resolution
  10813. (right eye left, left eye right)
  10814. @item abl
  10815. above-below (left eye above, right eye below)
  10816. @item abr
  10817. above-below (right eye above, left eye below)
  10818. @item ab2l
  10819. above-below with half height resolution
  10820. (left eye above, right eye below)
  10821. @item ab2r
  10822. above-below with half height resolution
  10823. (right eye above, left eye below)
  10824. @item al
  10825. alternating frames (left eye first, right eye second)
  10826. @item ar
  10827. alternating frames (right eye first, left eye second)
  10828. @item irl
  10829. interleaved rows (left eye has top row, right eye starts on next row)
  10830. @item irr
  10831. interleaved rows (right eye has top row, left eye starts on next row)
  10832. @item arbg
  10833. anaglyph red/blue gray
  10834. (red filter on left eye, blue filter on right eye)
  10835. @item argg
  10836. anaglyph red/green gray
  10837. (red filter on left eye, green filter on right eye)
  10838. @item arcg
  10839. anaglyph red/cyan gray
  10840. (red filter on left eye, cyan filter on right eye)
  10841. @item arch
  10842. anaglyph red/cyan half colored
  10843. (red filter on left eye, cyan filter on right eye)
  10844. @item arcc
  10845. anaglyph red/cyan color
  10846. (red filter on left eye, cyan filter on right eye)
  10847. @item arcd
  10848. anaglyph red/cyan color optimized with the least squares projection of dubois
  10849. (red filter on left eye, cyan filter on right eye)
  10850. @item agmg
  10851. anaglyph green/magenta gray
  10852. (green filter on left eye, magenta filter on right eye)
  10853. @item agmh
  10854. anaglyph green/magenta half colored
  10855. (green filter on left eye, magenta filter on right eye)
  10856. @item agmc
  10857. anaglyph green/magenta colored
  10858. (green filter on left eye, magenta filter on right eye)
  10859. @item agmd
  10860. anaglyph green/magenta color optimized with the least squares projection of dubois
  10861. (green filter on left eye, magenta filter on right eye)
  10862. @item aybg
  10863. anaglyph yellow/blue gray
  10864. (yellow filter on left eye, blue filter on right eye)
  10865. @item aybh
  10866. anaglyph yellow/blue half colored
  10867. (yellow filter on left eye, blue filter on right eye)
  10868. @item aybc
  10869. anaglyph yellow/blue colored
  10870. (yellow filter on left eye, blue filter on right eye)
  10871. @item aybd
  10872. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10873. (yellow filter on left eye, blue filter on right eye)
  10874. @item ml
  10875. mono output (left eye only)
  10876. @item mr
  10877. mono output (right eye only)
  10878. @item chl
  10879. checkerboard, left eye first
  10880. @item chr
  10881. checkerboard, right eye first
  10882. @item icl
  10883. interleaved columns, left eye first
  10884. @item icr
  10885. interleaved columns, right eye first
  10886. @item hdmi
  10887. HDMI frame pack
  10888. @end table
  10889. Default value is @samp{arcd}.
  10890. @end table
  10891. @subsection Examples
  10892. @itemize
  10893. @item
  10894. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10895. @example
  10896. stereo3d=sbsl:aybd
  10897. @end example
  10898. @item
  10899. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10900. @example
  10901. stereo3d=abl:sbsr
  10902. @end example
  10903. @end itemize
  10904. @section streamselect, astreamselect
  10905. Select video or audio streams.
  10906. The filter accepts the following options:
  10907. @table @option
  10908. @item inputs
  10909. Set number of inputs. Default is 2.
  10910. @item map
  10911. Set input indexes to remap to outputs.
  10912. @end table
  10913. @subsection Commands
  10914. The @code{streamselect} and @code{astreamselect} filter supports the following
  10915. commands:
  10916. @table @option
  10917. @item map
  10918. Set input indexes to remap to outputs.
  10919. @end table
  10920. @subsection Examples
  10921. @itemize
  10922. @item
  10923. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10924. @example
  10925. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10926. @end example
  10927. @item
  10928. Same as above, but for audio:
  10929. @example
  10930. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10931. @end example
  10932. @end itemize
  10933. @section sobel
  10934. Apply sobel operator to input video stream.
  10935. The filter accepts the following option:
  10936. @table @option
  10937. @item planes
  10938. Set which planes will be processed, unprocessed planes will be copied.
  10939. By default value 0xf, all planes will be processed.
  10940. @item scale
  10941. Set value which will be multiplied with filtered result.
  10942. @item delta
  10943. Set value which will be added to filtered result.
  10944. @end table
  10945. @anchor{spp}
  10946. @section spp
  10947. Apply a simple postprocessing filter that compresses and decompresses the image
  10948. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10949. and average the results.
  10950. The filter accepts the following options:
  10951. @table @option
  10952. @item quality
  10953. Set quality. This option defines the number of levels for averaging. It accepts
  10954. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10955. effect. A value of @code{6} means the higher quality. For each increment of
  10956. that value the speed drops by a factor of approximately 2. Default value is
  10957. @code{3}.
  10958. @item qp
  10959. Force a constant quantization parameter. If not set, the filter will use the QP
  10960. from the video stream (if available).
  10961. @item mode
  10962. Set thresholding mode. Available modes are:
  10963. @table @samp
  10964. @item hard
  10965. Set hard thresholding (default).
  10966. @item soft
  10967. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10968. @end table
  10969. @item use_bframe_qp
  10970. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10971. option may cause flicker since the B-Frames have often larger QP. Default is
  10972. @code{0} (not enabled).
  10973. @end table
  10974. @anchor{subtitles}
  10975. @section subtitles
  10976. Draw subtitles on top of input video using the libass library.
  10977. To enable compilation of this filter you need to configure FFmpeg with
  10978. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10979. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10980. Alpha) subtitles format.
  10981. The filter accepts the following options:
  10982. @table @option
  10983. @item filename, f
  10984. Set the filename of the subtitle file to read. It must be specified.
  10985. @item original_size
  10986. Specify the size of the original video, the video for which the ASS file
  10987. was composed. For the syntax of this option, check the
  10988. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10989. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10990. correctly scale the fonts if the aspect ratio has been changed.
  10991. @item fontsdir
  10992. Set a directory path containing fonts that can be used by the filter.
  10993. These fonts will be used in addition to whatever the font provider uses.
  10994. @item alpha
  10995. Process alpha channel, by default alpha channel is untouched.
  10996. @item charenc
  10997. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10998. useful if not UTF-8.
  10999. @item stream_index, si
  11000. Set subtitles stream index. @code{subtitles} filter only.
  11001. @item force_style
  11002. Override default style or script info parameters of the subtitles. It accepts a
  11003. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11004. @end table
  11005. If the first key is not specified, it is assumed that the first value
  11006. specifies the @option{filename}.
  11007. For example, to render the file @file{sub.srt} on top of the input
  11008. video, use the command:
  11009. @example
  11010. subtitles=sub.srt
  11011. @end example
  11012. which is equivalent to:
  11013. @example
  11014. subtitles=filename=sub.srt
  11015. @end example
  11016. To render the default subtitles stream from file @file{video.mkv}, use:
  11017. @example
  11018. subtitles=video.mkv
  11019. @end example
  11020. To render the second subtitles stream from that file, use:
  11021. @example
  11022. subtitles=video.mkv:si=1
  11023. @end example
  11024. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11025. @code{DejaVu Serif}, use:
  11026. @example
  11027. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11028. @end example
  11029. @section super2xsai
  11030. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11031. Interpolate) pixel art scaling algorithm.
  11032. Useful for enlarging pixel art images without reducing sharpness.
  11033. @section swaprect
  11034. Swap two rectangular objects in video.
  11035. This filter accepts the following options:
  11036. @table @option
  11037. @item w
  11038. Set object width.
  11039. @item h
  11040. Set object height.
  11041. @item x1
  11042. Set 1st rect x coordinate.
  11043. @item y1
  11044. Set 1st rect y coordinate.
  11045. @item x2
  11046. Set 2nd rect x coordinate.
  11047. @item y2
  11048. Set 2nd rect y coordinate.
  11049. All expressions are evaluated once for each frame.
  11050. @end table
  11051. The all options are expressions containing the following constants:
  11052. @table @option
  11053. @item w
  11054. @item h
  11055. The input width and height.
  11056. @item a
  11057. same as @var{w} / @var{h}
  11058. @item sar
  11059. input sample aspect ratio
  11060. @item dar
  11061. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11062. @item n
  11063. The number of the input frame, starting from 0.
  11064. @item t
  11065. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11066. @item pos
  11067. the position in the file of the input frame, NAN if unknown
  11068. @end table
  11069. @section swapuv
  11070. Swap U & V plane.
  11071. @section telecine
  11072. Apply telecine process to the video.
  11073. This filter accepts the following options:
  11074. @table @option
  11075. @item first_field
  11076. @table @samp
  11077. @item top, t
  11078. top field first
  11079. @item bottom, b
  11080. bottom field first
  11081. The default value is @code{top}.
  11082. @end table
  11083. @item pattern
  11084. A string of numbers representing the pulldown pattern you wish to apply.
  11085. The default value is @code{23}.
  11086. @end table
  11087. @example
  11088. Some typical patterns:
  11089. NTSC output (30i):
  11090. 27.5p: 32222
  11091. 24p: 23 (classic)
  11092. 24p: 2332 (preferred)
  11093. 20p: 33
  11094. 18p: 334
  11095. 16p: 3444
  11096. PAL output (25i):
  11097. 27.5p: 12222
  11098. 24p: 222222222223 ("Euro pulldown")
  11099. 16.67p: 33
  11100. 16p: 33333334
  11101. @end example
  11102. @section threshold
  11103. Apply threshold effect to video stream.
  11104. This filter needs four video streams to perform thresholding.
  11105. First stream is stream we are filtering.
  11106. Second stream is holding threshold values, third stream is holding min values,
  11107. and last, fourth stream is holding max values.
  11108. The filter accepts the following option:
  11109. @table @option
  11110. @item planes
  11111. Set which planes will be processed, unprocessed planes will be copied.
  11112. By default value 0xf, all planes will be processed.
  11113. @end table
  11114. For example if first stream pixel's component value is less then threshold value
  11115. of pixel component from 2nd threshold stream, third stream value will picked,
  11116. otherwise fourth stream pixel component value will be picked.
  11117. Using color source filter one can perform various types of thresholding:
  11118. @subsection Examples
  11119. @itemize
  11120. @item
  11121. Binary threshold, using gray color as threshold:
  11122. @example
  11123. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11124. @end example
  11125. @item
  11126. Inverted binary threshold, using gray color as threshold:
  11127. @example
  11128. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11129. @end example
  11130. @item
  11131. Truncate binary threshold, using gray color as threshold:
  11132. @example
  11133. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11134. @end example
  11135. @item
  11136. Threshold to zero, using gray color as threshold:
  11137. @example
  11138. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11139. @end example
  11140. @item
  11141. Inverted threshold to zero, using gray color as threshold:
  11142. @example
  11143. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11144. @end example
  11145. @end itemize
  11146. @section thumbnail
  11147. Select the most representative frame in a given sequence of consecutive frames.
  11148. The filter accepts the following options:
  11149. @table @option
  11150. @item n
  11151. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11152. will pick one of them, and then handle the next batch of @var{n} frames until
  11153. the end. Default is @code{100}.
  11154. @end table
  11155. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11156. value will result in a higher memory usage, so a high value is not recommended.
  11157. @subsection Examples
  11158. @itemize
  11159. @item
  11160. Extract one picture each 50 frames:
  11161. @example
  11162. thumbnail=50
  11163. @end example
  11164. @item
  11165. Complete example of a thumbnail creation with @command{ffmpeg}:
  11166. @example
  11167. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11168. @end example
  11169. @end itemize
  11170. @section tile
  11171. Tile several successive frames together.
  11172. The filter accepts the following options:
  11173. @table @option
  11174. @item layout
  11175. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11176. this option, check the
  11177. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11178. @item nb_frames
  11179. Set the maximum number of frames to render in the given area. It must be less
  11180. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11181. the area will be used.
  11182. @item margin
  11183. Set the outer border margin in pixels.
  11184. @item padding
  11185. Set the inner border thickness (i.e. the number of pixels between frames). For
  11186. more advanced padding options (such as having different values for the edges),
  11187. refer to the pad video filter.
  11188. @item color
  11189. Specify the color of the unused area. For the syntax of this option, check the
  11190. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11191. is "black".
  11192. @item overlap
  11193. Set the number of frames to overlap when tiling several successive frames together.
  11194. The value must be between @code{0} and @var{nb_frames - 1}.
  11195. @item init_padding
  11196. Set the number of frames to initially be empty before displaying first output frame.
  11197. This controls how soon will one get first output frame.
  11198. The value must be between @code{0} and @var{nb_frames - 1}.
  11199. @end table
  11200. @subsection Examples
  11201. @itemize
  11202. @item
  11203. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11204. @example
  11205. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11206. @end example
  11207. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11208. duplicating each output frame to accommodate the originally detected frame
  11209. rate.
  11210. @item
  11211. Display @code{5} pictures in an area of @code{3x2} frames,
  11212. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11213. mixed flat and named options:
  11214. @example
  11215. tile=3x2:nb_frames=5:padding=7:margin=2
  11216. @end example
  11217. @end itemize
  11218. @section tinterlace
  11219. Perform various types of temporal field interlacing.
  11220. Frames are counted starting from 1, so the first input frame is
  11221. considered odd.
  11222. The filter accepts the following options:
  11223. @table @option
  11224. @item mode
  11225. Specify the mode of the interlacing. This option can also be specified
  11226. as a value alone. See below for a list of values for this option.
  11227. Available values are:
  11228. @table @samp
  11229. @item merge, 0
  11230. Move odd frames into the upper field, even into the lower field,
  11231. generating a double height frame at half frame rate.
  11232. @example
  11233. ------> time
  11234. Input:
  11235. Frame 1 Frame 2 Frame 3 Frame 4
  11236. 11111 22222 33333 44444
  11237. 11111 22222 33333 44444
  11238. 11111 22222 33333 44444
  11239. 11111 22222 33333 44444
  11240. Output:
  11241. 11111 33333
  11242. 22222 44444
  11243. 11111 33333
  11244. 22222 44444
  11245. 11111 33333
  11246. 22222 44444
  11247. 11111 33333
  11248. 22222 44444
  11249. @end example
  11250. @item drop_even, 1
  11251. Only output odd frames, even frames are dropped, generating a frame with
  11252. unchanged height at half frame rate.
  11253. @example
  11254. ------> time
  11255. Input:
  11256. Frame 1 Frame 2 Frame 3 Frame 4
  11257. 11111 22222 33333 44444
  11258. 11111 22222 33333 44444
  11259. 11111 22222 33333 44444
  11260. 11111 22222 33333 44444
  11261. Output:
  11262. 11111 33333
  11263. 11111 33333
  11264. 11111 33333
  11265. 11111 33333
  11266. @end example
  11267. @item drop_odd, 2
  11268. Only output even frames, odd frames are dropped, generating a frame with
  11269. unchanged height at half frame rate.
  11270. @example
  11271. ------> time
  11272. Input:
  11273. Frame 1 Frame 2 Frame 3 Frame 4
  11274. 11111 22222 33333 44444
  11275. 11111 22222 33333 44444
  11276. 11111 22222 33333 44444
  11277. 11111 22222 33333 44444
  11278. Output:
  11279. 22222 44444
  11280. 22222 44444
  11281. 22222 44444
  11282. 22222 44444
  11283. @end example
  11284. @item pad, 3
  11285. Expand each frame to full height, but pad alternate lines with black,
  11286. generating a frame with double height at the same input frame rate.
  11287. @example
  11288. ------> time
  11289. Input:
  11290. Frame 1 Frame 2 Frame 3 Frame 4
  11291. 11111 22222 33333 44444
  11292. 11111 22222 33333 44444
  11293. 11111 22222 33333 44444
  11294. 11111 22222 33333 44444
  11295. Output:
  11296. 11111 ..... 33333 .....
  11297. ..... 22222 ..... 44444
  11298. 11111 ..... 33333 .....
  11299. ..... 22222 ..... 44444
  11300. 11111 ..... 33333 .....
  11301. ..... 22222 ..... 44444
  11302. 11111 ..... 33333 .....
  11303. ..... 22222 ..... 44444
  11304. @end example
  11305. @item interleave_top, 4
  11306. Interleave the upper field from odd frames with the lower field from
  11307. even frames, generating a frame with unchanged height at half frame rate.
  11308. @example
  11309. ------> time
  11310. Input:
  11311. Frame 1 Frame 2 Frame 3 Frame 4
  11312. 11111<- 22222 33333<- 44444
  11313. 11111 22222<- 33333 44444<-
  11314. 11111<- 22222 33333<- 44444
  11315. 11111 22222<- 33333 44444<-
  11316. Output:
  11317. 11111 33333
  11318. 22222 44444
  11319. 11111 33333
  11320. 22222 44444
  11321. @end example
  11322. @item interleave_bottom, 5
  11323. Interleave the lower field from odd frames with the upper field from
  11324. even frames, generating a frame with unchanged height at half frame rate.
  11325. @example
  11326. ------> time
  11327. Input:
  11328. Frame 1 Frame 2 Frame 3 Frame 4
  11329. 11111 22222<- 33333 44444<-
  11330. 11111<- 22222 33333<- 44444
  11331. 11111 22222<- 33333 44444<-
  11332. 11111<- 22222 33333<- 44444
  11333. Output:
  11334. 22222 44444
  11335. 11111 33333
  11336. 22222 44444
  11337. 11111 33333
  11338. @end example
  11339. @item interlacex2, 6
  11340. Double frame rate with unchanged height. Frames are inserted each
  11341. containing the second temporal field from the previous input frame and
  11342. the first temporal field from the next input frame. This mode relies on
  11343. the top_field_first flag. Useful for interlaced video displays with no
  11344. field synchronisation.
  11345. @example
  11346. ------> time
  11347. Input:
  11348. Frame 1 Frame 2 Frame 3 Frame 4
  11349. 11111 22222 33333 44444
  11350. 11111 22222 33333 44444
  11351. 11111 22222 33333 44444
  11352. 11111 22222 33333 44444
  11353. Output:
  11354. 11111 22222 22222 33333 33333 44444 44444
  11355. 11111 11111 22222 22222 33333 33333 44444
  11356. 11111 22222 22222 33333 33333 44444 44444
  11357. 11111 11111 22222 22222 33333 33333 44444
  11358. @end example
  11359. @item mergex2, 7
  11360. Move odd frames into the upper field, even into the lower field,
  11361. generating a double height frame at same frame rate.
  11362. @example
  11363. ------> time
  11364. Input:
  11365. Frame 1 Frame 2 Frame 3 Frame 4
  11366. 11111 22222 33333 44444
  11367. 11111 22222 33333 44444
  11368. 11111 22222 33333 44444
  11369. 11111 22222 33333 44444
  11370. Output:
  11371. 11111 33333 33333 55555
  11372. 22222 22222 44444 44444
  11373. 11111 33333 33333 55555
  11374. 22222 22222 44444 44444
  11375. 11111 33333 33333 55555
  11376. 22222 22222 44444 44444
  11377. 11111 33333 33333 55555
  11378. 22222 22222 44444 44444
  11379. @end example
  11380. @end table
  11381. Numeric values are deprecated but are accepted for backward
  11382. compatibility reasons.
  11383. Default mode is @code{merge}.
  11384. @item flags
  11385. Specify flags influencing the filter process.
  11386. Available value for @var{flags} is:
  11387. @table @option
  11388. @item low_pass_filter, vlfp
  11389. Enable linear vertical low-pass filtering in the filter.
  11390. Vertical low-pass filtering is required when creating an interlaced
  11391. destination from a progressive source which contains high-frequency
  11392. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11393. patterning.
  11394. @item complex_filter, cvlfp
  11395. Enable complex vertical low-pass filtering.
  11396. This will slightly less reduce interlace 'twitter' and Moire
  11397. patterning but better retain detail and subjective sharpness impression.
  11398. @end table
  11399. Vertical low-pass filtering can only be enabled for @option{mode}
  11400. @var{interleave_top} and @var{interleave_bottom}.
  11401. @end table
  11402. @section tonemap
  11403. Tone map colors from different dynamic ranges.
  11404. This filter expects data in single precision floating point, as it needs to
  11405. operate on (and can output) out-of-range values. Another filter, such as
  11406. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11407. The tonemapping algorithms implemented only work on linear light, so input
  11408. data should be linearized beforehand (and possibly correctly tagged).
  11409. @example
  11410. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11411. @end example
  11412. @subsection Options
  11413. The filter accepts the following options.
  11414. @table @option
  11415. @item tonemap
  11416. Set the tone map algorithm to use.
  11417. Possible values are:
  11418. @table @var
  11419. @item none
  11420. Do not apply any tone map, only desaturate overbright pixels.
  11421. @item clip
  11422. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11423. in-range values, while distorting out-of-range values.
  11424. @item linear
  11425. Stretch the entire reference gamut to a linear multiple of the display.
  11426. @item gamma
  11427. Fit a logarithmic transfer between the tone curves.
  11428. @item reinhard
  11429. Preserve overall image brightness with a simple curve, using nonlinear
  11430. contrast, which results in flattening details and degrading color accuracy.
  11431. @item hable
  11432. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11433. of slightly darkening everything. Use it when detail preservation is more
  11434. important than color and brightness accuracy.
  11435. @item mobius
  11436. Smoothly map out-of-range values, while retaining contrast and colors for
  11437. in-range material as much as possible. Use it when color accuracy is more
  11438. important than detail preservation.
  11439. @end table
  11440. Default is none.
  11441. @item param
  11442. Tune the tone mapping algorithm.
  11443. This affects the following algorithms:
  11444. @table @var
  11445. @item none
  11446. Ignored.
  11447. @item linear
  11448. Specifies the scale factor to use while stretching.
  11449. Default to 1.0.
  11450. @item gamma
  11451. Specifies the exponent of the function.
  11452. Default to 1.8.
  11453. @item clip
  11454. Specify an extra linear coefficient to multiply into the signal before clipping.
  11455. Default to 1.0.
  11456. @item reinhard
  11457. Specify the local contrast coefficient at the display peak.
  11458. Default to 0.5, which means that in-gamut values will be about half as bright
  11459. as when clipping.
  11460. @item hable
  11461. Ignored.
  11462. @item mobius
  11463. Specify the transition point from linear to mobius transform. Every value
  11464. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11465. more accurate the result will be, at the cost of losing bright details.
  11466. Default to 0.3, which due to the steep initial slope still preserves in-range
  11467. colors fairly accurately.
  11468. @end table
  11469. @item desat
  11470. Apply desaturation for highlights that exceed this level of brightness. The
  11471. higher the parameter, the more color information will be preserved. This
  11472. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11473. (smoothly) turning into white instead. This makes images feel more natural,
  11474. at the cost of reducing information about out-of-range colors.
  11475. The default of 2.0 is somewhat conservative and will mostly just apply to
  11476. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11477. This option works only if the input frame has a supported color tag.
  11478. @item peak
  11479. Override signal/nominal/reference peak with this value. Useful when the
  11480. embedded peak information in display metadata is not reliable or when tone
  11481. mapping from a lower range to a higher range.
  11482. @end table
  11483. @section transpose
  11484. Transpose rows with columns in the input video and optionally flip it.
  11485. It accepts the following parameters:
  11486. @table @option
  11487. @item dir
  11488. Specify the transposition direction.
  11489. Can assume the following values:
  11490. @table @samp
  11491. @item 0, 4, cclock_flip
  11492. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11493. @example
  11494. L.R L.l
  11495. . . -> . .
  11496. l.r R.r
  11497. @end example
  11498. @item 1, 5, clock
  11499. Rotate by 90 degrees clockwise, that is:
  11500. @example
  11501. L.R l.L
  11502. . . -> . .
  11503. l.r r.R
  11504. @end example
  11505. @item 2, 6, cclock
  11506. Rotate by 90 degrees counterclockwise, that is:
  11507. @example
  11508. L.R R.r
  11509. . . -> . .
  11510. l.r L.l
  11511. @end example
  11512. @item 3, 7, clock_flip
  11513. Rotate by 90 degrees clockwise and vertically flip, that is:
  11514. @example
  11515. L.R r.R
  11516. . . -> . .
  11517. l.r l.L
  11518. @end example
  11519. @end table
  11520. For values between 4-7, the transposition is only done if the input
  11521. video geometry is portrait and not landscape. These values are
  11522. deprecated, the @code{passthrough} option should be used instead.
  11523. Numerical values are deprecated, and should be dropped in favor of
  11524. symbolic constants.
  11525. @item passthrough
  11526. Do not apply the transposition if the input geometry matches the one
  11527. specified by the specified value. It accepts the following values:
  11528. @table @samp
  11529. @item none
  11530. Always apply transposition.
  11531. @item portrait
  11532. Preserve portrait geometry (when @var{height} >= @var{width}).
  11533. @item landscape
  11534. Preserve landscape geometry (when @var{width} >= @var{height}).
  11535. @end table
  11536. Default value is @code{none}.
  11537. @end table
  11538. For example to rotate by 90 degrees clockwise and preserve portrait
  11539. layout:
  11540. @example
  11541. transpose=dir=1:passthrough=portrait
  11542. @end example
  11543. The command above can also be specified as:
  11544. @example
  11545. transpose=1:portrait
  11546. @end example
  11547. @section trim
  11548. Trim the input so that the output contains one continuous subpart of the input.
  11549. It accepts the following parameters:
  11550. @table @option
  11551. @item start
  11552. Specify the time of the start of the kept section, i.e. the frame with the
  11553. timestamp @var{start} will be the first frame in the output.
  11554. @item end
  11555. Specify the time of the first frame that will be dropped, i.e. the frame
  11556. immediately preceding the one with the timestamp @var{end} will be the last
  11557. frame in the output.
  11558. @item start_pts
  11559. This is the same as @var{start}, except this option sets the start timestamp
  11560. in timebase units instead of seconds.
  11561. @item end_pts
  11562. This is the same as @var{end}, except this option sets the end timestamp
  11563. in timebase units instead of seconds.
  11564. @item duration
  11565. The maximum duration of the output in seconds.
  11566. @item start_frame
  11567. The number of the first frame that should be passed to the output.
  11568. @item end_frame
  11569. The number of the first frame that should be dropped.
  11570. @end table
  11571. @option{start}, @option{end}, and @option{duration} are expressed as time
  11572. duration specifications; see
  11573. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11574. for the accepted syntax.
  11575. Note that the first two sets of the start/end options and the @option{duration}
  11576. option look at the frame timestamp, while the _frame variants simply count the
  11577. frames that pass through the filter. Also note that this filter does not modify
  11578. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11579. setpts filter after the trim filter.
  11580. If multiple start or end options are set, this filter tries to be greedy and
  11581. keep all the frames that match at least one of the specified constraints. To keep
  11582. only the part that matches all the constraints at once, chain multiple trim
  11583. filters.
  11584. The defaults are such that all the input is kept. So it is possible to set e.g.
  11585. just the end values to keep everything before the specified time.
  11586. Examples:
  11587. @itemize
  11588. @item
  11589. Drop everything except the second minute of input:
  11590. @example
  11591. ffmpeg -i INPUT -vf trim=60:120
  11592. @end example
  11593. @item
  11594. Keep only the first second:
  11595. @example
  11596. ffmpeg -i INPUT -vf trim=duration=1
  11597. @end example
  11598. @end itemize
  11599. @section unpremultiply
  11600. Apply alpha unpremultiply effect to input video stream using first plane
  11601. of second stream as alpha.
  11602. Both streams must have same dimensions and same pixel format.
  11603. The filter accepts the following option:
  11604. @table @option
  11605. @item planes
  11606. Set which planes will be processed, unprocessed planes will be copied.
  11607. By default value 0xf, all planes will be processed.
  11608. If the format has 1 or 2 components, then luma is bit 0.
  11609. If the format has 3 or 4 components:
  11610. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11611. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11612. If present, the alpha channel is always the last bit.
  11613. @item inplace
  11614. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11615. @end table
  11616. @anchor{unsharp}
  11617. @section unsharp
  11618. Sharpen or blur the input video.
  11619. It accepts the following parameters:
  11620. @table @option
  11621. @item luma_msize_x, lx
  11622. Set the luma matrix horizontal size. It must be an odd integer between
  11623. 3 and 23. The default value is 5.
  11624. @item luma_msize_y, ly
  11625. Set the luma matrix vertical size. It must be an odd integer between 3
  11626. and 23. The default value is 5.
  11627. @item luma_amount, la
  11628. Set the luma effect strength. It must be a floating point number, reasonable
  11629. values lay between -1.5 and 1.5.
  11630. Negative values will blur the input video, while positive values will
  11631. sharpen it, a value of zero will disable the effect.
  11632. Default value is 1.0.
  11633. @item chroma_msize_x, cx
  11634. Set the chroma matrix horizontal size. It must be an odd integer
  11635. between 3 and 23. The default value is 5.
  11636. @item chroma_msize_y, cy
  11637. Set the chroma matrix vertical size. It must be an odd integer
  11638. between 3 and 23. The default value is 5.
  11639. @item chroma_amount, ca
  11640. Set the chroma effect strength. It must be a floating point number, reasonable
  11641. values lay between -1.5 and 1.5.
  11642. Negative values will blur the input video, while positive values will
  11643. sharpen it, a value of zero will disable the effect.
  11644. Default value is 0.0.
  11645. @end table
  11646. All parameters are optional and default to the equivalent of the
  11647. string '5:5:1.0:5:5:0.0'.
  11648. @subsection Examples
  11649. @itemize
  11650. @item
  11651. Apply strong luma sharpen effect:
  11652. @example
  11653. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11654. @end example
  11655. @item
  11656. Apply a strong blur of both luma and chroma parameters:
  11657. @example
  11658. unsharp=7:7:-2:7:7:-2
  11659. @end example
  11660. @end itemize
  11661. @section uspp
  11662. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11663. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11664. shifts and average the results.
  11665. The way this differs from the behavior of spp is that uspp actually encodes &
  11666. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11667. DCT similar to MJPEG.
  11668. The filter accepts the following options:
  11669. @table @option
  11670. @item quality
  11671. Set quality. This option defines the number of levels for averaging. It accepts
  11672. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11673. effect. A value of @code{8} means the higher quality. For each increment of
  11674. that value the speed drops by a factor of approximately 2. Default value is
  11675. @code{3}.
  11676. @item qp
  11677. Force a constant quantization parameter. If not set, the filter will use the QP
  11678. from the video stream (if available).
  11679. @end table
  11680. @section vaguedenoiser
  11681. Apply a wavelet based denoiser.
  11682. It transforms each frame from the video input into the wavelet domain,
  11683. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11684. the obtained coefficients. It does an inverse wavelet transform after.
  11685. Due to wavelet properties, it should give a nice smoothed result, and
  11686. reduced noise, without blurring picture features.
  11687. This filter accepts the following options:
  11688. @table @option
  11689. @item threshold
  11690. The filtering strength. The higher, the more filtered the video will be.
  11691. Hard thresholding can use a higher threshold than soft thresholding
  11692. before the video looks overfiltered. Default value is 2.
  11693. @item method
  11694. The filtering method the filter will use.
  11695. It accepts the following values:
  11696. @table @samp
  11697. @item hard
  11698. All values under the threshold will be zeroed.
  11699. @item soft
  11700. All values under the threshold will be zeroed. All values above will be
  11701. reduced by the threshold.
  11702. @item garrote
  11703. Scales or nullifies coefficients - intermediary between (more) soft and
  11704. (less) hard thresholding.
  11705. @end table
  11706. Default is garrote.
  11707. @item nsteps
  11708. Number of times, the wavelet will decompose the picture. Picture can't
  11709. be decomposed beyond a particular point (typically, 8 for a 640x480
  11710. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11711. @item percent
  11712. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11713. @item planes
  11714. A list of the planes to process. By default all planes are processed.
  11715. @end table
  11716. @section vectorscope
  11717. Display 2 color component values in the two dimensional graph (which is called
  11718. a vectorscope).
  11719. This filter accepts the following options:
  11720. @table @option
  11721. @item mode, m
  11722. Set vectorscope mode.
  11723. It accepts the following values:
  11724. @table @samp
  11725. @item gray
  11726. Gray values are displayed on graph, higher brightness means more pixels have
  11727. same component color value on location in graph. This is the default mode.
  11728. @item color
  11729. Gray values are displayed on graph. Surrounding pixels values which are not
  11730. present in video frame are drawn in gradient of 2 color components which are
  11731. set by option @code{x} and @code{y}. The 3rd color component is static.
  11732. @item color2
  11733. Actual color components values present in video frame are displayed on graph.
  11734. @item color3
  11735. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11736. on graph increases value of another color component, which is luminance by
  11737. default values of @code{x} and @code{y}.
  11738. @item color4
  11739. Actual colors present in video frame are displayed on graph. If two different
  11740. colors map to same position on graph then color with higher value of component
  11741. not present in graph is picked.
  11742. @item color5
  11743. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11744. component picked from radial gradient.
  11745. @end table
  11746. @item x
  11747. Set which color component will be represented on X-axis. Default is @code{1}.
  11748. @item y
  11749. Set which color component will be represented on Y-axis. Default is @code{2}.
  11750. @item intensity, i
  11751. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11752. of color component which represents frequency of (X, Y) location in graph.
  11753. @item envelope, e
  11754. @table @samp
  11755. @item none
  11756. No envelope, this is default.
  11757. @item instant
  11758. Instant envelope, even darkest single pixel will be clearly highlighted.
  11759. @item peak
  11760. Hold maximum and minimum values presented in graph over time. This way you
  11761. can still spot out of range values without constantly looking at vectorscope.
  11762. @item peak+instant
  11763. Peak and instant envelope combined together.
  11764. @end table
  11765. @item graticule, g
  11766. Set what kind of graticule to draw.
  11767. @table @samp
  11768. @item none
  11769. @item green
  11770. @item color
  11771. @end table
  11772. @item opacity, o
  11773. Set graticule opacity.
  11774. @item flags, f
  11775. Set graticule flags.
  11776. @table @samp
  11777. @item white
  11778. Draw graticule for white point.
  11779. @item black
  11780. Draw graticule for black point.
  11781. @item name
  11782. Draw color points short names.
  11783. @end table
  11784. @item bgopacity, b
  11785. Set background opacity.
  11786. @item lthreshold, l
  11787. Set low threshold for color component not represented on X or Y axis.
  11788. Values lower than this value will be ignored. Default is 0.
  11789. Note this value is multiplied with actual max possible value one pixel component
  11790. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11791. is 0.1 * 255 = 25.
  11792. @item hthreshold, h
  11793. Set high threshold for color component not represented on X or Y axis.
  11794. Values higher than this value will be ignored. Default is 1.
  11795. Note this value is multiplied with actual max possible value one pixel component
  11796. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11797. is 0.9 * 255 = 230.
  11798. @item colorspace, c
  11799. Set what kind of colorspace to use when drawing graticule.
  11800. @table @samp
  11801. @item auto
  11802. @item 601
  11803. @item 709
  11804. @end table
  11805. Default is auto.
  11806. @end table
  11807. @anchor{vidstabdetect}
  11808. @section vidstabdetect
  11809. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11810. @ref{vidstabtransform} for pass 2.
  11811. This filter generates a file with relative translation and rotation
  11812. transform information about subsequent frames, which is then used by
  11813. the @ref{vidstabtransform} filter.
  11814. To enable compilation of this filter you need to configure FFmpeg with
  11815. @code{--enable-libvidstab}.
  11816. This filter accepts the following options:
  11817. @table @option
  11818. @item result
  11819. Set the path to the file used to write the transforms information.
  11820. Default value is @file{transforms.trf}.
  11821. @item shakiness
  11822. Set how shaky the video is and how quick the camera is. It accepts an
  11823. integer in the range 1-10, a value of 1 means little shakiness, a
  11824. value of 10 means strong shakiness. Default value is 5.
  11825. @item accuracy
  11826. Set the accuracy of the detection process. It must be a value in the
  11827. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11828. accuracy. Default value is 15.
  11829. @item stepsize
  11830. Set stepsize of the search process. The region around minimum is
  11831. scanned with 1 pixel resolution. Default value is 6.
  11832. @item mincontrast
  11833. Set minimum contrast. Below this value a local measurement field is
  11834. discarded. Must be a floating point value in the range 0-1. Default
  11835. value is 0.3.
  11836. @item tripod
  11837. Set reference frame number for tripod mode.
  11838. If enabled, the motion of the frames is compared to a reference frame
  11839. in the filtered stream, identified by the specified number. The idea
  11840. is to compensate all movements in a more-or-less static scene and keep
  11841. the camera view absolutely still.
  11842. If set to 0, it is disabled. The frames are counted starting from 1.
  11843. @item show
  11844. Show fields and transforms in the resulting frames. It accepts an
  11845. integer in the range 0-2. Default value is 0, which disables any
  11846. visualization.
  11847. @end table
  11848. @subsection Examples
  11849. @itemize
  11850. @item
  11851. Use default values:
  11852. @example
  11853. vidstabdetect
  11854. @end example
  11855. @item
  11856. Analyze strongly shaky movie and put the results in file
  11857. @file{mytransforms.trf}:
  11858. @example
  11859. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11860. @end example
  11861. @item
  11862. Visualize the result of internal transformations in the resulting
  11863. video:
  11864. @example
  11865. vidstabdetect=show=1
  11866. @end example
  11867. @item
  11868. Analyze a video with medium shakiness using @command{ffmpeg}:
  11869. @example
  11870. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11871. @end example
  11872. @end itemize
  11873. @anchor{vidstabtransform}
  11874. @section vidstabtransform
  11875. Video stabilization/deshaking: pass 2 of 2,
  11876. see @ref{vidstabdetect} for pass 1.
  11877. Read a file with transform information for each frame and
  11878. apply/compensate them. Together with the @ref{vidstabdetect}
  11879. filter this can be used to deshake videos. See also
  11880. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11881. the @ref{unsharp} filter, see below.
  11882. To enable compilation of this filter you need to configure FFmpeg with
  11883. @code{--enable-libvidstab}.
  11884. @subsection Options
  11885. @table @option
  11886. @item input
  11887. Set path to the file used to read the transforms. Default value is
  11888. @file{transforms.trf}.
  11889. @item smoothing
  11890. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11891. camera movements. Default value is 10.
  11892. For example a number of 10 means that 21 frames are used (10 in the
  11893. past and 10 in the future) to smoothen the motion in the video. A
  11894. larger value leads to a smoother video, but limits the acceleration of
  11895. the camera (pan/tilt movements). 0 is a special case where a static
  11896. camera is simulated.
  11897. @item optalgo
  11898. Set the camera path optimization algorithm.
  11899. Accepted values are:
  11900. @table @samp
  11901. @item gauss
  11902. gaussian kernel low-pass filter on camera motion (default)
  11903. @item avg
  11904. averaging on transformations
  11905. @end table
  11906. @item maxshift
  11907. Set maximal number of pixels to translate frames. Default value is -1,
  11908. meaning no limit.
  11909. @item maxangle
  11910. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11911. value is -1, meaning no limit.
  11912. @item crop
  11913. Specify how to deal with borders that may be visible due to movement
  11914. compensation.
  11915. Available values are:
  11916. @table @samp
  11917. @item keep
  11918. keep image information from previous frame (default)
  11919. @item black
  11920. fill the border black
  11921. @end table
  11922. @item invert
  11923. Invert transforms if set to 1. Default value is 0.
  11924. @item relative
  11925. Consider transforms as relative to previous frame if set to 1,
  11926. absolute if set to 0. Default value is 0.
  11927. @item zoom
  11928. Set percentage to zoom. A positive value will result in a zoom-in
  11929. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11930. zoom).
  11931. @item optzoom
  11932. Set optimal zooming to avoid borders.
  11933. Accepted values are:
  11934. @table @samp
  11935. @item 0
  11936. disabled
  11937. @item 1
  11938. optimal static zoom value is determined (only very strong movements
  11939. will lead to visible borders) (default)
  11940. @item 2
  11941. optimal adaptive zoom value is determined (no borders will be
  11942. visible), see @option{zoomspeed}
  11943. @end table
  11944. Note that the value given at zoom is added to the one calculated here.
  11945. @item zoomspeed
  11946. Set percent to zoom maximally each frame (enabled when
  11947. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11948. 0.25.
  11949. @item interpol
  11950. Specify type of interpolation.
  11951. Available values are:
  11952. @table @samp
  11953. @item no
  11954. no interpolation
  11955. @item linear
  11956. linear only horizontal
  11957. @item bilinear
  11958. linear in both directions (default)
  11959. @item bicubic
  11960. cubic in both directions (slow)
  11961. @end table
  11962. @item tripod
  11963. Enable virtual tripod mode if set to 1, which is equivalent to
  11964. @code{relative=0:smoothing=0}. Default value is 0.
  11965. Use also @code{tripod} option of @ref{vidstabdetect}.
  11966. @item debug
  11967. Increase log verbosity if set to 1. Also the detected global motions
  11968. are written to the temporary file @file{global_motions.trf}. Default
  11969. value is 0.
  11970. @end table
  11971. @subsection Examples
  11972. @itemize
  11973. @item
  11974. Use @command{ffmpeg} for a typical stabilization with default values:
  11975. @example
  11976. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11977. @end example
  11978. Note the use of the @ref{unsharp} filter which is always recommended.
  11979. @item
  11980. Zoom in a bit more and load transform data from a given file:
  11981. @example
  11982. vidstabtransform=zoom=5:input="mytransforms.trf"
  11983. @end example
  11984. @item
  11985. Smoothen the video even more:
  11986. @example
  11987. vidstabtransform=smoothing=30
  11988. @end example
  11989. @end itemize
  11990. @section vflip
  11991. Flip the input video vertically.
  11992. For example, to vertically flip a video with @command{ffmpeg}:
  11993. @example
  11994. ffmpeg -i in.avi -vf "vflip" out.avi
  11995. @end example
  11996. @anchor{vignette}
  11997. @section vignette
  11998. Make or reverse a natural vignetting effect.
  11999. The filter accepts the following options:
  12000. @table @option
  12001. @item angle, a
  12002. Set lens angle expression as a number of radians.
  12003. The value is clipped in the @code{[0,PI/2]} range.
  12004. Default value: @code{"PI/5"}
  12005. @item x0
  12006. @item y0
  12007. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12008. by default.
  12009. @item mode
  12010. Set forward/backward mode.
  12011. Available modes are:
  12012. @table @samp
  12013. @item forward
  12014. The larger the distance from the central point, the darker the image becomes.
  12015. @item backward
  12016. The larger the distance from the central point, the brighter the image becomes.
  12017. This can be used to reverse a vignette effect, though there is no automatic
  12018. detection to extract the lens @option{angle} and other settings (yet). It can
  12019. also be used to create a burning effect.
  12020. @end table
  12021. Default value is @samp{forward}.
  12022. @item eval
  12023. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12024. It accepts the following values:
  12025. @table @samp
  12026. @item init
  12027. Evaluate expressions only once during the filter initialization.
  12028. @item frame
  12029. Evaluate expressions for each incoming frame. This is way slower than the
  12030. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12031. allows advanced dynamic expressions.
  12032. @end table
  12033. Default value is @samp{init}.
  12034. @item dither
  12035. Set dithering to reduce the circular banding effects. Default is @code{1}
  12036. (enabled).
  12037. @item aspect
  12038. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12039. Setting this value to the SAR of the input will make a rectangular vignetting
  12040. following the dimensions of the video.
  12041. Default is @code{1/1}.
  12042. @end table
  12043. @subsection Expressions
  12044. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12045. following parameters.
  12046. @table @option
  12047. @item w
  12048. @item h
  12049. input width and height
  12050. @item n
  12051. the number of input frame, starting from 0
  12052. @item pts
  12053. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12054. @var{TB} units, NAN if undefined
  12055. @item r
  12056. frame rate of the input video, NAN if the input frame rate is unknown
  12057. @item t
  12058. the PTS (Presentation TimeStamp) of the filtered video frame,
  12059. expressed in seconds, NAN if undefined
  12060. @item tb
  12061. time base of the input video
  12062. @end table
  12063. @subsection Examples
  12064. @itemize
  12065. @item
  12066. Apply simple strong vignetting effect:
  12067. @example
  12068. vignette=PI/4
  12069. @end example
  12070. @item
  12071. Make a flickering vignetting:
  12072. @example
  12073. vignette='PI/4+random(1)*PI/50':eval=frame
  12074. @end example
  12075. @end itemize
  12076. @section vmafmotion
  12077. Obtain the average vmaf motion score of a video.
  12078. It is one of the component filters of VMAF.
  12079. The obtained average motion score is printed through the logging system.
  12080. In the below example the input file @file{ref.mpg} is being processed and score
  12081. is computed.
  12082. @example
  12083. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12084. @end example
  12085. @section vstack
  12086. Stack input videos vertically.
  12087. All streams must be of same pixel format and of same width.
  12088. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12089. to create same output.
  12090. The filter accept the following option:
  12091. @table @option
  12092. @item inputs
  12093. Set number of input streams. Default is 2.
  12094. @item shortest
  12095. If set to 1, force the output to terminate when the shortest input
  12096. terminates. Default value is 0.
  12097. @end table
  12098. @section w3fdif
  12099. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12100. Deinterlacing Filter").
  12101. Based on the process described by Martin Weston for BBC R&D, and
  12102. implemented based on the de-interlace algorithm written by Jim
  12103. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12104. uses filter coefficients calculated by BBC R&D.
  12105. There are two sets of filter coefficients, so called "simple":
  12106. and "complex". Which set of filter coefficients is used can
  12107. be set by passing an optional parameter:
  12108. @table @option
  12109. @item filter
  12110. Set the interlacing filter coefficients. Accepts one of the following values:
  12111. @table @samp
  12112. @item simple
  12113. Simple filter coefficient set.
  12114. @item complex
  12115. More-complex filter coefficient set.
  12116. @end table
  12117. Default value is @samp{complex}.
  12118. @item deint
  12119. Specify which frames to deinterlace. Accept one of the following values:
  12120. @table @samp
  12121. @item all
  12122. Deinterlace all frames,
  12123. @item interlaced
  12124. Only deinterlace frames marked as interlaced.
  12125. @end table
  12126. Default value is @samp{all}.
  12127. @end table
  12128. @section waveform
  12129. Video waveform monitor.
  12130. The waveform monitor plots color component intensity. By default luminance
  12131. only. Each column of the waveform corresponds to a column of pixels in the
  12132. source video.
  12133. It accepts the following options:
  12134. @table @option
  12135. @item mode, m
  12136. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12137. In row mode, the graph on the left side represents color component value 0 and
  12138. the right side represents value = 255. In column mode, the top side represents
  12139. color component value = 0 and bottom side represents value = 255.
  12140. @item intensity, i
  12141. Set intensity. Smaller values are useful to find out how many values of the same
  12142. luminance are distributed across input rows/columns.
  12143. Default value is @code{0.04}. Allowed range is [0, 1].
  12144. @item mirror, r
  12145. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12146. In mirrored mode, higher values will be represented on the left
  12147. side for @code{row} mode and at the top for @code{column} mode. Default is
  12148. @code{1} (mirrored).
  12149. @item display, d
  12150. Set display mode.
  12151. It accepts the following values:
  12152. @table @samp
  12153. @item overlay
  12154. Presents information identical to that in the @code{parade}, except
  12155. that the graphs representing color components are superimposed directly
  12156. over one another.
  12157. This display mode makes it easier to spot relative differences or similarities
  12158. in overlapping areas of the color components that are supposed to be identical,
  12159. such as neutral whites, grays, or blacks.
  12160. @item stack
  12161. Display separate graph for the color components side by side in
  12162. @code{row} mode or one below the other in @code{column} mode.
  12163. @item parade
  12164. Display separate graph for the color components side by side in
  12165. @code{column} mode or one below the other in @code{row} mode.
  12166. Using this display mode makes it easy to spot color casts in the highlights
  12167. and shadows of an image, by comparing the contours of the top and the bottom
  12168. graphs of each waveform. Since whites, grays, and blacks are characterized
  12169. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12170. should display three waveforms of roughly equal width/height. If not, the
  12171. correction is easy to perform by making level adjustments the three waveforms.
  12172. @end table
  12173. Default is @code{stack}.
  12174. @item components, c
  12175. Set which color components to display. Default is 1, which means only luminance
  12176. or red color component if input is in RGB colorspace. If is set for example to
  12177. 7 it will display all 3 (if) available color components.
  12178. @item envelope, e
  12179. @table @samp
  12180. @item none
  12181. No envelope, this is default.
  12182. @item instant
  12183. Instant envelope, minimum and maximum values presented in graph will be easily
  12184. visible even with small @code{step} value.
  12185. @item peak
  12186. Hold minimum and maximum values presented in graph across time. This way you
  12187. can still spot out of range values without constantly looking at waveforms.
  12188. @item peak+instant
  12189. Peak and instant envelope combined together.
  12190. @end table
  12191. @item filter, f
  12192. @table @samp
  12193. @item lowpass
  12194. No filtering, this is default.
  12195. @item flat
  12196. Luma and chroma combined together.
  12197. @item aflat
  12198. Similar as above, but shows difference between blue and red chroma.
  12199. @item chroma
  12200. Displays only chroma.
  12201. @item color
  12202. Displays actual color value on waveform.
  12203. @item acolor
  12204. Similar as above, but with luma showing frequency of chroma values.
  12205. @end table
  12206. @item graticule, g
  12207. Set which graticule to display.
  12208. @table @samp
  12209. @item none
  12210. Do not display graticule.
  12211. @item green
  12212. Display green graticule showing legal broadcast ranges.
  12213. @end table
  12214. @item opacity, o
  12215. Set graticule opacity.
  12216. @item flags, fl
  12217. Set graticule flags.
  12218. @table @samp
  12219. @item numbers
  12220. Draw numbers above lines. By default enabled.
  12221. @item dots
  12222. Draw dots instead of lines.
  12223. @end table
  12224. @item scale, s
  12225. Set scale used for displaying graticule.
  12226. @table @samp
  12227. @item digital
  12228. @item millivolts
  12229. @item ire
  12230. @end table
  12231. Default is digital.
  12232. @item bgopacity, b
  12233. Set background opacity.
  12234. @end table
  12235. @section weave, doubleweave
  12236. The @code{weave} takes a field-based video input and join
  12237. each two sequential fields into single frame, producing a new double
  12238. height clip with half the frame rate and half the frame count.
  12239. The @code{doubleweave} works same as @code{weave} but without
  12240. halving frame rate and frame count.
  12241. It accepts the following option:
  12242. @table @option
  12243. @item first_field
  12244. Set first field. Available values are:
  12245. @table @samp
  12246. @item top, t
  12247. Set the frame as top-field-first.
  12248. @item bottom, b
  12249. Set the frame as bottom-field-first.
  12250. @end table
  12251. @end table
  12252. @subsection Examples
  12253. @itemize
  12254. @item
  12255. Interlace video using @ref{select} and @ref{separatefields} filter:
  12256. @example
  12257. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12258. @end example
  12259. @end itemize
  12260. @section xbr
  12261. Apply the xBR high-quality magnification filter which is designed for pixel
  12262. art. It follows a set of edge-detection rules, see
  12263. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12264. It accepts the following option:
  12265. @table @option
  12266. @item n
  12267. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12268. @code{3xBR} and @code{4} for @code{4xBR}.
  12269. Default is @code{3}.
  12270. @end table
  12271. @anchor{yadif}
  12272. @section yadif
  12273. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12274. filter").
  12275. It accepts the following parameters:
  12276. @table @option
  12277. @item mode
  12278. The interlacing mode to adopt. It accepts one of the following values:
  12279. @table @option
  12280. @item 0, send_frame
  12281. Output one frame for each frame.
  12282. @item 1, send_field
  12283. Output one frame for each field.
  12284. @item 2, send_frame_nospatial
  12285. Like @code{send_frame}, but it skips the spatial interlacing check.
  12286. @item 3, send_field_nospatial
  12287. Like @code{send_field}, but it skips the spatial interlacing check.
  12288. @end table
  12289. The default value is @code{send_frame}.
  12290. @item parity
  12291. The picture field parity assumed for the input interlaced video. It accepts one
  12292. of the following values:
  12293. @table @option
  12294. @item 0, tff
  12295. Assume the top field is first.
  12296. @item 1, bff
  12297. Assume the bottom field is first.
  12298. @item -1, auto
  12299. Enable automatic detection of field parity.
  12300. @end table
  12301. The default value is @code{auto}.
  12302. If the interlacing is unknown or the decoder does not export this information,
  12303. top field first will be assumed.
  12304. @item deint
  12305. Specify which frames to deinterlace. Accept one of the following
  12306. values:
  12307. @table @option
  12308. @item 0, all
  12309. Deinterlace all frames.
  12310. @item 1, interlaced
  12311. Only deinterlace frames marked as interlaced.
  12312. @end table
  12313. The default value is @code{all}.
  12314. @end table
  12315. @section zoompan
  12316. Apply Zoom & Pan effect.
  12317. This filter accepts the following options:
  12318. @table @option
  12319. @item zoom, z
  12320. Set the zoom expression. Default is 1.
  12321. @item x
  12322. @item y
  12323. Set the x and y expression. Default is 0.
  12324. @item d
  12325. Set the duration expression in number of frames.
  12326. This sets for how many number of frames effect will last for
  12327. single input image.
  12328. @item s
  12329. Set the output image size, default is 'hd720'.
  12330. @item fps
  12331. Set the output frame rate, default is '25'.
  12332. @end table
  12333. Each expression can contain the following constants:
  12334. @table @option
  12335. @item in_w, iw
  12336. Input width.
  12337. @item in_h, ih
  12338. Input height.
  12339. @item out_w, ow
  12340. Output width.
  12341. @item out_h, oh
  12342. Output height.
  12343. @item in
  12344. Input frame count.
  12345. @item on
  12346. Output frame count.
  12347. @item x
  12348. @item y
  12349. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12350. for current input frame.
  12351. @item px
  12352. @item py
  12353. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12354. not yet such frame (first input frame).
  12355. @item zoom
  12356. Last calculated zoom from 'z' expression for current input frame.
  12357. @item pzoom
  12358. Last calculated zoom of last output frame of previous input frame.
  12359. @item duration
  12360. Number of output frames for current input frame. Calculated from 'd' expression
  12361. for each input frame.
  12362. @item pduration
  12363. number of output frames created for previous input frame
  12364. @item a
  12365. Rational number: input width / input height
  12366. @item sar
  12367. sample aspect ratio
  12368. @item dar
  12369. display aspect ratio
  12370. @end table
  12371. @subsection Examples
  12372. @itemize
  12373. @item
  12374. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12375. @example
  12376. 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
  12377. @end example
  12378. @item
  12379. Zoom-in up to 1.5 and pan always at center of picture:
  12380. @example
  12381. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12382. @end example
  12383. @item
  12384. Same as above but without pausing:
  12385. @example
  12386. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12387. @end example
  12388. @end itemize
  12389. @anchor{zscale}
  12390. @section zscale
  12391. Scale (resize) the input video, using the z.lib library:
  12392. https://github.com/sekrit-twc/zimg.
  12393. The zscale filter forces the output display aspect ratio to be the same
  12394. as the input, by changing the output sample aspect ratio.
  12395. If the input image format is different from the format requested by
  12396. the next filter, the zscale filter will convert the input to the
  12397. requested format.
  12398. @subsection Options
  12399. The filter accepts the following options.
  12400. @table @option
  12401. @item width, w
  12402. @item height, h
  12403. Set the output video dimension expression. Default value is the input
  12404. dimension.
  12405. If the @var{width} or @var{w} value is 0, the input width is used for
  12406. the output. If the @var{height} or @var{h} value is 0, the input height
  12407. is used for the output.
  12408. If one and only one of the values is -n with n >= 1, the zscale filter
  12409. will use a value that maintains the aspect ratio of the input image,
  12410. calculated from the other specified dimension. After that it will,
  12411. however, make sure that the calculated dimension is divisible by n and
  12412. adjust the value if necessary.
  12413. If both values are -n with n >= 1, the behavior will be identical to
  12414. both values being set to 0 as previously detailed.
  12415. See below for the list of accepted constants for use in the dimension
  12416. expression.
  12417. @item size, s
  12418. Set the video size. For the syntax of this option, check the
  12419. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12420. @item dither, d
  12421. Set the dither type.
  12422. Possible values are:
  12423. @table @var
  12424. @item none
  12425. @item ordered
  12426. @item random
  12427. @item error_diffusion
  12428. @end table
  12429. Default is none.
  12430. @item filter, f
  12431. Set the resize filter type.
  12432. Possible values are:
  12433. @table @var
  12434. @item point
  12435. @item bilinear
  12436. @item bicubic
  12437. @item spline16
  12438. @item spline36
  12439. @item lanczos
  12440. @end table
  12441. Default is bilinear.
  12442. @item range, r
  12443. Set the color range.
  12444. Possible values are:
  12445. @table @var
  12446. @item input
  12447. @item limited
  12448. @item full
  12449. @end table
  12450. Default is same as input.
  12451. @item primaries, p
  12452. Set the color primaries.
  12453. Possible values are:
  12454. @table @var
  12455. @item input
  12456. @item 709
  12457. @item unspecified
  12458. @item 170m
  12459. @item 240m
  12460. @item 2020
  12461. @end table
  12462. Default is same as input.
  12463. @item transfer, t
  12464. Set the transfer characteristics.
  12465. Possible values are:
  12466. @table @var
  12467. @item input
  12468. @item 709
  12469. @item unspecified
  12470. @item 601
  12471. @item linear
  12472. @item 2020_10
  12473. @item 2020_12
  12474. @item smpte2084
  12475. @item iec61966-2-1
  12476. @item arib-std-b67
  12477. @end table
  12478. Default is same as input.
  12479. @item matrix, m
  12480. Set the colorspace matrix.
  12481. Possible value are:
  12482. @table @var
  12483. @item input
  12484. @item 709
  12485. @item unspecified
  12486. @item 470bg
  12487. @item 170m
  12488. @item 2020_ncl
  12489. @item 2020_cl
  12490. @end table
  12491. Default is same as input.
  12492. @item rangein, rin
  12493. Set the input color range.
  12494. Possible values are:
  12495. @table @var
  12496. @item input
  12497. @item limited
  12498. @item full
  12499. @end table
  12500. Default is same as input.
  12501. @item primariesin, pin
  12502. Set the input color primaries.
  12503. Possible values are:
  12504. @table @var
  12505. @item input
  12506. @item 709
  12507. @item unspecified
  12508. @item 170m
  12509. @item 240m
  12510. @item 2020
  12511. @end table
  12512. Default is same as input.
  12513. @item transferin, tin
  12514. Set the input transfer characteristics.
  12515. Possible values are:
  12516. @table @var
  12517. @item input
  12518. @item 709
  12519. @item unspecified
  12520. @item 601
  12521. @item linear
  12522. @item 2020_10
  12523. @item 2020_12
  12524. @end table
  12525. Default is same as input.
  12526. @item matrixin, min
  12527. Set the input colorspace matrix.
  12528. Possible value are:
  12529. @table @var
  12530. @item input
  12531. @item 709
  12532. @item unspecified
  12533. @item 470bg
  12534. @item 170m
  12535. @item 2020_ncl
  12536. @item 2020_cl
  12537. @end table
  12538. @item chromal, c
  12539. Set the output chroma location.
  12540. Possible values are:
  12541. @table @var
  12542. @item input
  12543. @item left
  12544. @item center
  12545. @item topleft
  12546. @item top
  12547. @item bottomleft
  12548. @item bottom
  12549. @end table
  12550. @item chromalin, cin
  12551. Set the input chroma location.
  12552. Possible values are:
  12553. @table @var
  12554. @item input
  12555. @item left
  12556. @item center
  12557. @item topleft
  12558. @item top
  12559. @item bottomleft
  12560. @item bottom
  12561. @end table
  12562. @item npl
  12563. Set the nominal peak luminance.
  12564. @end table
  12565. The values of the @option{w} and @option{h} options are expressions
  12566. containing the following constants:
  12567. @table @var
  12568. @item in_w
  12569. @item in_h
  12570. The input width and height
  12571. @item iw
  12572. @item ih
  12573. These are the same as @var{in_w} and @var{in_h}.
  12574. @item out_w
  12575. @item out_h
  12576. The output (scaled) width and height
  12577. @item ow
  12578. @item oh
  12579. These are the same as @var{out_w} and @var{out_h}
  12580. @item a
  12581. The same as @var{iw} / @var{ih}
  12582. @item sar
  12583. input sample aspect ratio
  12584. @item dar
  12585. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12586. @item hsub
  12587. @item vsub
  12588. horizontal and vertical input chroma subsample values. For example for the
  12589. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12590. @item ohsub
  12591. @item ovsub
  12592. horizontal and vertical output chroma subsample values. For example for the
  12593. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12594. @end table
  12595. @table @option
  12596. @end table
  12597. @c man end VIDEO FILTERS
  12598. @chapter Video Sources
  12599. @c man begin VIDEO SOURCES
  12600. Below is a description of the currently available video sources.
  12601. @section buffer
  12602. Buffer video frames, and make them available to the filter chain.
  12603. This source is mainly intended for a programmatic use, in particular
  12604. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12605. It accepts the following parameters:
  12606. @table @option
  12607. @item video_size
  12608. Specify the size (width and height) of the buffered video frames. For the
  12609. syntax of this option, check the
  12610. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12611. @item width
  12612. The input video width.
  12613. @item height
  12614. The input video height.
  12615. @item pix_fmt
  12616. A string representing the pixel format of the buffered video frames.
  12617. It may be a number corresponding to a pixel format, or a pixel format
  12618. name.
  12619. @item time_base
  12620. Specify the timebase assumed by the timestamps of the buffered frames.
  12621. @item frame_rate
  12622. Specify the frame rate expected for the video stream.
  12623. @item pixel_aspect, sar
  12624. The sample (pixel) aspect ratio of the input video.
  12625. @item sws_param
  12626. Specify the optional parameters to be used for the scale filter which
  12627. is automatically inserted when an input change is detected in the
  12628. input size or format.
  12629. @item hw_frames_ctx
  12630. When using a hardware pixel format, this should be a reference to an
  12631. AVHWFramesContext describing input frames.
  12632. @end table
  12633. For example:
  12634. @example
  12635. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12636. @end example
  12637. will instruct the source to accept video frames with size 320x240 and
  12638. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12639. square pixels (1:1 sample aspect ratio).
  12640. Since the pixel format with name "yuv410p" corresponds to the number 6
  12641. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12642. this example corresponds to:
  12643. @example
  12644. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12645. @end example
  12646. Alternatively, the options can be specified as a flat string, but this
  12647. syntax is deprecated:
  12648. @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}]
  12649. @section cellauto
  12650. Create a pattern generated by an elementary cellular automaton.
  12651. The initial state of the cellular automaton can be defined through the
  12652. @option{filename} and @option{pattern} options. If such options are
  12653. not specified an initial state is created randomly.
  12654. At each new frame a new row in the video is filled with the result of
  12655. the cellular automaton next generation. The behavior when the whole
  12656. frame is filled is defined by the @option{scroll} option.
  12657. This source accepts the following options:
  12658. @table @option
  12659. @item filename, f
  12660. Read the initial cellular automaton state, i.e. the starting row, from
  12661. the specified file.
  12662. In the file, each non-whitespace character is considered an alive
  12663. cell, a newline will terminate the row, and further characters in the
  12664. file will be ignored.
  12665. @item pattern, p
  12666. Read the initial cellular automaton state, i.e. the starting row, from
  12667. the specified string.
  12668. Each non-whitespace character in the string is considered an alive
  12669. cell, a newline will terminate the row, and further characters in the
  12670. string will be ignored.
  12671. @item rate, r
  12672. Set the video rate, that is the number of frames generated per second.
  12673. Default is 25.
  12674. @item random_fill_ratio, ratio
  12675. Set the random fill ratio for the initial cellular automaton row. It
  12676. is a floating point number value ranging from 0 to 1, defaults to
  12677. 1/PHI.
  12678. This option is ignored when a file or a pattern is specified.
  12679. @item random_seed, seed
  12680. Set the seed for filling randomly the initial row, must be an integer
  12681. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12682. set to -1, the filter will try to use a good random seed on a best
  12683. effort basis.
  12684. @item rule
  12685. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12686. Default value is 110.
  12687. @item size, s
  12688. Set the size of the output video. For the syntax of this option, check the
  12689. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12690. If @option{filename} or @option{pattern} is specified, the size is set
  12691. by default to the width of the specified initial state row, and the
  12692. height is set to @var{width} * PHI.
  12693. If @option{size} is set, it must contain the width of the specified
  12694. pattern string, and the specified pattern will be centered in the
  12695. larger row.
  12696. If a filename or a pattern string is not specified, the size value
  12697. defaults to "320x518" (used for a randomly generated initial state).
  12698. @item scroll
  12699. If set to 1, scroll the output upward when all the rows in the output
  12700. have been already filled. If set to 0, the new generated row will be
  12701. written over the top row just after the bottom row is filled.
  12702. Defaults to 1.
  12703. @item start_full, full
  12704. If set to 1, completely fill the output with generated rows before
  12705. outputting the first frame.
  12706. This is the default behavior, for disabling set the value to 0.
  12707. @item stitch
  12708. If set to 1, stitch the left and right row edges together.
  12709. This is the default behavior, for disabling set the value to 0.
  12710. @end table
  12711. @subsection Examples
  12712. @itemize
  12713. @item
  12714. Read the initial state from @file{pattern}, and specify an output of
  12715. size 200x400.
  12716. @example
  12717. cellauto=f=pattern:s=200x400
  12718. @end example
  12719. @item
  12720. Generate a random initial row with a width of 200 cells, with a fill
  12721. ratio of 2/3:
  12722. @example
  12723. cellauto=ratio=2/3:s=200x200
  12724. @end example
  12725. @item
  12726. Create a pattern generated by rule 18 starting by a single alive cell
  12727. centered on an initial row with width 100:
  12728. @example
  12729. cellauto=p=@@:s=100x400:full=0:rule=18
  12730. @end example
  12731. @item
  12732. Specify a more elaborated initial pattern:
  12733. @example
  12734. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12735. @end example
  12736. @end itemize
  12737. @anchor{coreimagesrc}
  12738. @section coreimagesrc
  12739. Video source generated on GPU using Apple's CoreImage API on OSX.
  12740. This video source is a specialized version of the @ref{coreimage} video filter.
  12741. Use a core image generator at the beginning of the applied filterchain to
  12742. generate the content.
  12743. The coreimagesrc video source accepts the following options:
  12744. @table @option
  12745. @item list_generators
  12746. List all available generators along with all their respective options as well as
  12747. possible minimum and maximum values along with the default values.
  12748. @example
  12749. list_generators=true
  12750. @end example
  12751. @item size, s
  12752. Specify the size of the sourced video. For the syntax of this option, check the
  12753. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12754. The default value is @code{320x240}.
  12755. @item rate, r
  12756. Specify the frame rate of the sourced video, as the number of frames
  12757. generated per second. It has to be a string in the format
  12758. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12759. number or a valid video frame rate abbreviation. The default value is
  12760. "25".
  12761. @item sar
  12762. Set the sample aspect ratio of the sourced video.
  12763. @item duration, d
  12764. Set the duration of the sourced video. See
  12765. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12766. for the accepted syntax.
  12767. If not specified, or the expressed duration is negative, the video is
  12768. supposed to be generated forever.
  12769. @end table
  12770. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12771. A complete filterchain can be used for further processing of the
  12772. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12773. and examples for details.
  12774. @subsection Examples
  12775. @itemize
  12776. @item
  12777. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12778. given as complete and escaped command-line for Apple's standard bash shell:
  12779. @example
  12780. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12781. @end example
  12782. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12783. need for a nullsrc video source.
  12784. @end itemize
  12785. @section mandelbrot
  12786. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12787. point specified with @var{start_x} and @var{start_y}.
  12788. This source accepts the following options:
  12789. @table @option
  12790. @item end_pts
  12791. Set the terminal pts value. Default value is 400.
  12792. @item end_scale
  12793. Set the terminal scale value.
  12794. Must be a floating point value. Default value is 0.3.
  12795. @item inner
  12796. Set the inner coloring mode, that is the algorithm used to draw the
  12797. Mandelbrot fractal internal region.
  12798. It shall assume one of the following values:
  12799. @table @option
  12800. @item black
  12801. Set black mode.
  12802. @item convergence
  12803. Show time until convergence.
  12804. @item mincol
  12805. Set color based on point closest to the origin of the iterations.
  12806. @item period
  12807. Set period mode.
  12808. @end table
  12809. Default value is @var{mincol}.
  12810. @item bailout
  12811. Set the bailout value. Default value is 10.0.
  12812. @item maxiter
  12813. Set the maximum of iterations performed by the rendering
  12814. algorithm. Default value is 7189.
  12815. @item outer
  12816. Set outer coloring mode.
  12817. It shall assume one of following values:
  12818. @table @option
  12819. @item iteration_count
  12820. Set iteration cound mode.
  12821. @item normalized_iteration_count
  12822. set normalized iteration count mode.
  12823. @end table
  12824. Default value is @var{normalized_iteration_count}.
  12825. @item rate, r
  12826. Set frame rate, expressed as number of frames per second. Default
  12827. value is "25".
  12828. @item size, s
  12829. Set frame size. For the syntax of this option, check the "Video
  12830. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12831. @item start_scale
  12832. Set the initial scale value. Default value is 3.0.
  12833. @item start_x
  12834. Set the initial x position. Must be a floating point value between
  12835. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12836. @item start_y
  12837. Set the initial y position. Must be a floating point value between
  12838. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12839. @end table
  12840. @section mptestsrc
  12841. Generate various test patterns, as generated by the MPlayer test filter.
  12842. The size of the generated video is fixed, and is 256x256.
  12843. This source is useful in particular for testing encoding features.
  12844. This source accepts the following options:
  12845. @table @option
  12846. @item rate, r
  12847. Specify the frame rate of the sourced video, as the number of frames
  12848. generated per second. It has to be a string in the format
  12849. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12850. number or a valid video frame rate abbreviation. The default value is
  12851. "25".
  12852. @item duration, d
  12853. Set the duration of the sourced video. See
  12854. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12855. for the accepted syntax.
  12856. If not specified, or the expressed duration is negative, the video is
  12857. supposed to be generated forever.
  12858. @item test, t
  12859. Set the number or the name of the test to perform. Supported tests are:
  12860. @table @option
  12861. @item dc_luma
  12862. @item dc_chroma
  12863. @item freq_luma
  12864. @item freq_chroma
  12865. @item amp_luma
  12866. @item amp_chroma
  12867. @item cbp
  12868. @item mv
  12869. @item ring1
  12870. @item ring2
  12871. @item all
  12872. @end table
  12873. Default value is "all", which will cycle through the list of all tests.
  12874. @end table
  12875. Some examples:
  12876. @example
  12877. mptestsrc=t=dc_luma
  12878. @end example
  12879. will generate a "dc_luma" test pattern.
  12880. @section frei0r_src
  12881. Provide a frei0r source.
  12882. To enable compilation of this filter you need to install the frei0r
  12883. header and configure FFmpeg with @code{--enable-frei0r}.
  12884. This source accepts the following parameters:
  12885. @table @option
  12886. @item size
  12887. The size of the video to generate. For the syntax of this option, check the
  12888. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12889. @item framerate
  12890. The framerate of the generated video. It may be a string of the form
  12891. @var{num}/@var{den} or a frame rate abbreviation.
  12892. @item filter_name
  12893. The name to the frei0r source to load. For more information regarding frei0r and
  12894. how to set the parameters, read the @ref{frei0r} section in the video filters
  12895. documentation.
  12896. @item filter_params
  12897. A '|'-separated list of parameters to pass to the frei0r source.
  12898. @end table
  12899. For example, to generate a frei0r partik0l source with size 200x200
  12900. and frame rate 10 which is overlaid on the overlay filter main input:
  12901. @example
  12902. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12903. @end example
  12904. @section life
  12905. Generate a life pattern.
  12906. This source is based on a generalization of John Conway's life game.
  12907. The sourced input represents a life grid, each pixel represents a cell
  12908. which can be in one of two possible states, alive or dead. Every cell
  12909. interacts with its eight neighbours, which are the cells that are
  12910. horizontally, vertically, or diagonally adjacent.
  12911. At each interaction the grid evolves according to the adopted rule,
  12912. which specifies the number of neighbor alive cells which will make a
  12913. cell stay alive or born. The @option{rule} option allows one to specify
  12914. the rule to adopt.
  12915. This source accepts the following options:
  12916. @table @option
  12917. @item filename, f
  12918. Set the file from which to read the initial grid state. In the file,
  12919. each non-whitespace character is considered an alive cell, and newline
  12920. is used to delimit the end of each row.
  12921. If this option is not specified, the initial grid is generated
  12922. randomly.
  12923. @item rate, r
  12924. Set the video rate, that is the number of frames generated per second.
  12925. Default is 25.
  12926. @item random_fill_ratio, ratio
  12927. Set the random fill ratio for the initial random grid. It is a
  12928. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12929. It is ignored when a file is specified.
  12930. @item random_seed, seed
  12931. Set the seed for filling the initial random grid, must be an integer
  12932. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12933. set to -1, the filter will try to use a good random seed on a best
  12934. effort basis.
  12935. @item rule
  12936. Set the life rule.
  12937. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12938. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12939. @var{NS} specifies the number of alive neighbor cells which make a
  12940. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12941. which make a dead cell to become alive (i.e. to "born").
  12942. "s" and "b" can be used in place of "S" and "B", respectively.
  12943. Alternatively a rule can be specified by an 18-bits integer. The 9
  12944. high order bits are used to encode the next cell state if it is alive
  12945. for each number of neighbor alive cells, the low order bits specify
  12946. the rule for "borning" new cells. Higher order bits encode for an
  12947. higher number of neighbor cells.
  12948. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12949. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12950. Default value is "S23/B3", which is the original Conway's game of life
  12951. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12952. cells, and will born a new cell if there are three alive cells around
  12953. a dead cell.
  12954. @item size, s
  12955. Set the size of the output video. For the syntax of this option, check the
  12956. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12957. If @option{filename} is specified, the size is set by default to the
  12958. same size of the input file. If @option{size} is set, it must contain
  12959. the size specified in the input file, and the initial grid defined in
  12960. that file is centered in the larger resulting area.
  12961. If a filename is not specified, the size value defaults to "320x240"
  12962. (used for a randomly generated initial grid).
  12963. @item stitch
  12964. If set to 1, stitch the left and right grid edges together, and the
  12965. top and bottom edges also. Defaults to 1.
  12966. @item mold
  12967. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12968. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12969. value from 0 to 255.
  12970. @item life_color
  12971. Set the color of living (or new born) cells.
  12972. @item death_color
  12973. Set the color of dead cells. If @option{mold} is set, this is the first color
  12974. used to represent a dead cell.
  12975. @item mold_color
  12976. Set mold color, for definitely dead and moldy cells.
  12977. For the syntax of these 3 color options, check the "Color" section in the
  12978. ffmpeg-utils manual.
  12979. @end table
  12980. @subsection Examples
  12981. @itemize
  12982. @item
  12983. Read a grid from @file{pattern}, and center it on a grid of size
  12984. 300x300 pixels:
  12985. @example
  12986. life=f=pattern:s=300x300
  12987. @end example
  12988. @item
  12989. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12990. @example
  12991. life=ratio=2/3:s=200x200
  12992. @end example
  12993. @item
  12994. Specify a custom rule for evolving a randomly generated grid:
  12995. @example
  12996. life=rule=S14/B34
  12997. @end example
  12998. @item
  12999. Full example with slow death effect (mold) using @command{ffplay}:
  13000. @example
  13001. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13002. @end example
  13003. @end itemize
  13004. @anchor{allrgb}
  13005. @anchor{allyuv}
  13006. @anchor{color}
  13007. @anchor{haldclutsrc}
  13008. @anchor{nullsrc}
  13009. @anchor{rgbtestsrc}
  13010. @anchor{smptebars}
  13011. @anchor{smptehdbars}
  13012. @anchor{testsrc}
  13013. @anchor{testsrc2}
  13014. @anchor{yuvtestsrc}
  13015. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13016. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13017. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13018. The @code{color} source provides an uniformly colored input.
  13019. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13020. @ref{haldclut} filter.
  13021. The @code{nullsrc} source returns unprocessed video frames. It is
  13022. mainly useful to be employed in analysis / debugging tools, or as the
  13023. source for filters which ignore the input data.
  13024. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13025. detecting RGB vs BGR issues. You should see a red, green and blue
  13026. stripe from top to bottom.
  13027. The @code{smptebars} source generates a color bars pattern, based on
  13028. the SMPTE Engineering Guideline EG 1-1990.
  13029. The @code{smptehdbars} source generates a color bars pattern, based on
  13030. the SMPTE RP 219-2002.
  13031. The @code{testsrc} source generates a test video pattern, showing a
  13032. color pattern, a scrolling gradient and a timestamp. This is mainly
  13033. intended for testing purposes.
  13034. The @code{testsrc2} source is similar to testsrc, but supports more
  13035. pixel formats instead of just @code{rgb24}. This allows using it as an
  13036. input for other tests without requiring a format conversion.
  13037. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13038. see a y, cb and cr stripe from top to bottom.
  13039. The sources accept the following parameters:
  13040. @table @option
  13041. @item alpha
  13042. Specify the alpha (opacity) of the background, only available in the
  13043. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13044. 255 (fully opaque, the default).
  13045. @item color, c
  13046. Specify the color of the source, only available in the @code{color}
  13047. source. For the syntax of this option, check the "Color" section in the
  13048. ffmpeg-utils manual.
  13049. @item level
  13050. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13051. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13052. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13053. coded on a @code{1/(N*N)} scale.
  13054. @item size, s
  13055. Specify the size of the sourced video. For the syntax of this option, check the
  13056. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13057. The default value is @code{320x240}.
  13058. This option is not available with the @code{haldclutsrc} filter.
  13059. @item rate, r
  13060. Specify the frame rate of the sourced video, as the number of frames
  13061. generated per second. It has to be a string in the format
  13062. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13063. number or a valid video frame rate abbreviation. The default value is
  13064. "25".
  13065. @item sar
  13066. Set the sample aspect ratio of the sourced video.
  13067. @item duration, d
  13068. Set the duration of the sourced video. See
  13069. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13070. for the accepted syntax.
  13071. If not specified, or the expressed duration is negative, the video is
  13072. supposed to be generated forever.
  13073. @item decimals, n
  13074. Set the number of decimals to show in the timestamp, only available in the
  13075. @code{testsrc} source.
  13076. The displayed timestamp value will correspond to the original
  13077. timestamp value multiplied by the power of 10 of the specified
  13078. value. Default value is 0.
  13079. @end table
  13080. For example the following:
  13081. @example
  13082. testsrc=duration=5.3:size=qcif:rate=10
  13083. @end example
  13084. will generate a video with a duration of 5.3 seconds, with size
  13085. 176x144 and a frame rate of 10 frames per second.
  13086. The following graph description will generate a red source
  13087. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13088. frames per second.
  13089. @example
  13090. color=c=red@@0.2:s=qcif:r=10
  13091. @end example
  13092. If the input content is to be ignored, @code{nullsrc} can be used. The
  13093. following command generates noise in the luminance plane by employing
  13094. the @code{geq} filter:
  13095. @example
  13096. nullsrc=s=256x256, geq=random(1)*255:128:128
  13097. @end example
  13098. @subsection Commands
  13099. The @code{color} source supports the following commands:
  13100. @table @option
  13101. @item c, color
  13102. Set the color of the created image. Accepts the same syntax of the
  13103. corresponding @option{color} option.
  13104. @end table
  13105. @c man end VIDEO SOURCES
  13106. @chapter Video Sinks
  13107. @c man begin VIDEO SINKS
  13108. Below is a description of the currently available video sinks.
  13109. @section buffersink
  13110. Buffer video frames, and make them available to the end of the filter
  13111. graph.
  13112. This sink is mainly intended for programmatic use, in particular
  13113. through the interface defined in @file{libavfilter/buffersink.h}
  13114. or the options system.
  13115. It accepts a pointer to an AVBufferSinkContext structure, which
  13116. defines the incoming buffers' formats, to be passed as the opaque
  13117. parameter to @code{avfilter_init_filter} for initialization.
  13118. @section nullsink
  13119. Null video sink: do absolutely nothing with the input video. It is
  13120. mainly useful as a template and for use in analysis / debugging
  13121. tools.
  13122. @c man end VIDEO SINKS
  13123. @chapter Multimedia Filters
  13124. @c man begin MULTIMEDIA FILTERS
  13125. Below is a description of the currently available multimedia filters.
  13126. @section abitscope
  13127. Convert input audio to a video output, displaying the audio bit scope.
  13128. The filter accepts the following options:
  13129. @table @option
  13130. @item rate, r
  13131. Set frame rate, expressed as number of frames per second. Default
  13132. value is "25".
  13133. @item size, s
  13134. Specify the video size for the output. For the syntax of this option, check the
  13135. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13136. Default value is @code{1024x256}.
  13137. @item colors
  13138. Specify list of colors separated by space or by '|' which will be used to
  13139. draw channels. Unrecognized or missing colors will be replaced
  13140. by white color.
  13141. @end table
  13142. @section ahistogram
  13143. Convert input audio to a video output, displaying the volume histogram.
  13144. The filter accepts the following options:
  13145. @table @option
  13146. @item dmode
  13147. Specify how histogram is calculated.
  13148. It accepts the following values:
  13149. @table @samp
  13150. @item single
  13151. Use single histogram for all channels.
  13152. @item separate
  13153. Use separate histogram for each channel.
  13154. @end table
  13155. Default is @code{single}.
  13156. @item rate, r
  13157. Set frame rate, expressed as number of frames per second. Default
  13158. value is "25".
  13159. @item size, s
  13160. Specify the video size for the output. For the syntax of this option, check the
  13161. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13162. Default value is @code{hd720}.
  13163. @item scale
  13164. Set display scale.
  13165. It accepts the following values:
  13166. @table @samp
  13167. @item log
  13168. logarithmic
  13169. @item sqrt
  13170. square root
  13171. @item cbrt
  13172. cubic root
  13173. @item lin
  13174. linear
  13175. @item rlog
  13176. reverse logarithmic
  13177. @end table
  13178. Default is @code{log}.
  13179. @item ascale
  13180. Set amplitude scale.
  13181. It accepts the following values:
  13182. @table @samp
  13183. @item log
  13184. logarithmic
  13185. @item lin
  13186. linear
  13187. @end table
  13188. Default is @code{log}.
  13189. @item acount
  13190. Set how much frames to accumulate in histogram.
  13191. Defauls is 1. Setting this to -1 accumulates all frames.
  13192. @item rheight
  13193. Set histogram ratio of window height.
  13194. @item slide
  13195. Set sonogram sliding.
  13196. It accepts the following values:
  13197. @table @samp
  13198. @item replace
  13199. replace old rows with new ones.
  13200. @item scroll
  13201. scroll from top to bottom.
  13202. @end table
  13203. Default is @code{replace}.
  13204. @end table
  13205. @section aphasemeter
  13206. Convert input audio to a video output, displaying the audio phase.
  13207. The filter accepts the following options:
  13208. @table @option
  13209. @item rate, r
  13210. Set the output frame rate. Default value is @code{25}.
  13211. @item size, s
  13212. Set the video size for the output. For the syntax of this option, check the
  13213. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13214. Default value is @code{800x400}.
  13215. @item rc
  13216. @item gc
  13217. @item bc
  13218. Specify the red, green, blue contrast. Default values are @code{2},
  13219. @code{7} and @code{1}.
  13220. Allowed range is @code{[0, 255]}.
  13221. @item mpc
  13222. Set color which will be used for drawing median phase. If color is
  13223. @code{none} which is default, no median phase value will be drawn.
  13224. @item video
  13225. Enable video output. Default is enabled.
  13226. @end table
  13227. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13228. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13229. The @code{-1} means left and right channels are completely out of phase and
  13230. @code{1} means channels are in phase.
  13231. @section avectorscope
  13232. Convert input audio to a video output, representing the audio vector
  13233. scope.
  13234. The filter is used to measure the difference between channels of stereo
  13235. audio stream. A monoaural signal, consisting of identical left and right
  13236. signal, results in straight vertical line. Any stereo separation is visible
  13237. as a deviation from this line, creating a Lissajous figure.
  13238. If the straight (or deviation from it) but horizontal line appears this
  13239. indicates that the left and right channels are out of phase.
  13240. The filter accepts the following options:
  13241. @table @option
  13242. @item mode, m
  13243. Set the vectorscope mode.
  13244. Available values are:
  13245. @table @samp
  13246. @item lissajous
  13247. Lissajous rotated by 45 degrees.
  13248. @item lissajous_xy
  13249. Same as above but not rotated.
  13250. @item polar
  13251. Shape resembling half of circle.
  13252. @end table
  13253. Default value is @samp{lissajous}.
  13254. @item size, s
  13255. Set the video size for the output. For the syntax of this option, check the
  13256. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13257. Default value is @code{400x400}.
  13258. @item rate, r
  13259. Set the output frame rate. Default value is @code{25}.
  13260. @item rc
  13261. @item gc
  13262. @item bc
  13263. @item ac
  13264. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13265. @code{160}, @code{80} and @code{255}.
  13266. Allowed range is @code{[0, 255]}.
  13267. @item rf
  13268. @item gf
  13269. @item bf
  13270. @item af
  13271. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13272. @code{10}, @code{5} and @code{5}.
  13273. Allowed range is @code{[0, 255]}.
  13274. @item zoom
  13275. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13276. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13277. @item draw
  13278. Set the vectorscope drawing mode.
  13279. Available values are:
  13280. @table @samp
  13281. @item dot
  13282. Draw dot for each sample.
  13283. @item line
  13284. Draw line between previous and current sample.
  13285. @end table
  13286. Default value is @samp{dot}.
  13287. @item scale
  13288. Specify amplitude scale of audio samples.
  13289. Available values are:
  13290. @table @samp
  13291. @item lin
  13292. Linear.
  13293. @item sqrt
  13294. Square root.
  13295. @item cbrt
  13296. Cubic root.
  13297. @item log
  13298. Logarithmic.
  13299. @end table
  13300. @item swap
  13301. Swap left channel axis with right channel axis.
  13302. @item mirror
  13303. Mirror axis.
  13304. @table @samp
  13305. @item none
  13306. No mirror.
  13307. @item x
  13308. Mirror only x axis.
  13309. @item y
  13310. Mirror only y axis.
  13311. @item xy
  13312. Mirror both axis.
  13313. @end table
  13314. @end table
  13315. @subsection Examples
  13316. @itemize
  13317. @item
  13318. Complete example using @command{ffplay}:
  13319. @example
  13320. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13321. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13322. @end example
  13323. @end itemize
  13324. @section bench, abench
  13325. Benchmark part of a filtergraph.
  13326. The filter accepts the following options:
  13327. @table @option
  13328. @item action
  13329. Start or stop a timer.
  13330. Available values are:
  13331. @table @samp
  13332. @item start
  13333. Get the current time, set it as frame metadata (using the key
  13334. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13335. @item stop
  13336. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13337. the input frame metadata to get the time difference. Time difference, average,
  13338. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13339. @code{min}) are then printed. The timestamps are expressed in seconds.
  13340. @end table
  13341. @end table
  13342. @subsection Examples
  13343. @itemize
  13344. @item
  13345. Benchmark @ref{selectivecolor} filter:
  13346. @example
  13347. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13348. @end example
  13349. @end itemize
  13350. @section concat
  13351. Concatenate audio and video streams, joining them together one after the
  13352. other.
  13353. The filter works on segments of synchronized video and audio streams. All
  13354. segments must have the same number of streams of each type, and that will
  13355. also be the number of streams at output.
  13356. The filter accepts the following options:
  13357. @table @option
  13358. @item n
  13359. Set the number of segments. Default is 2.
  13360. @item v
  13361. Set the number of output video streams, that is also the number of video
  13362. streams in each segment. Default is 1.
  13363. @item a
  13364. Set the number of output audio streams, that is also the number of audio
  13365. streams in each segment. Default is 0.
  13366. @item unsafe
  13367. Activate unsafe mode: do not fail if segments have a different format.
  13368. @end table
  13369. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13370. @var{a} audio outputs.
  13371. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13372. segment, in the same order as the outputs, then the inputs for the second
  13373. segment, etc.
  13374. Related streams do not always have exactly the same duration, for various
  13375. reasons including codec frame size or sloppy authoring. For that reason,
  13376. related synchronized streams (e.g. a video and its audio track) should be
  13377. concatenated at once. The concat filter will use the duration of the longest
  13378. stream in each segment (except the last one), and if necessary pad shorter
  13379. audio streams with silence.
  13380. For this filter to work correctly, all segments must start at timestamp 0.
  13381. All corresponding streams must have the same parameters in all segments; the
  13382. filtering system will automatically select a common pixel format for video
  13383. streams, and a common sample format, sample rate and channel layout for
  13384. audio streams, but other settings, such as resolution, must be converted
  13385. explicitly by the user.
  13386. Different frame rates are acceptable but will result in variable frame rate
  13387. at output; be sure to configure the output file to handle it.
  13388. @subsection Examples
  13389. @itemize
  13390. @item
  13391. Concatenate an opening, an episode and an ending, all in bilingual version
  13392. (video in stream 0, audio in streams 1 and 2):
  13393. @example
  13394. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13395. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13396. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13397. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13398. @end example
  13399. @item
  13400. Concatenate two parts, handling audio and video separately, using the
  13401. (a)movie sources, and adjusting the resolution:
  13402. @example
  13403. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13404. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13405. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13406. @end example
  13407. Note that a desync will happen at the stitch if the audio and video streams
  13408. do not have exactly the same duration in the first file.
  13409. @end itemize
  13410. @section drawgraph, adrawgraph
  13411. Draw a graph using input video or audio metadata.
  13412. It accepts the following parameters:
  13413. @table @option
  13414. @item m1
  13415. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13416. @item fg1
  13417. Set 1st foreground color expression.
  13418. @item m2
  13419. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13420. @item fg2
  13421. Set 2nd foreground color expression.
  13422. @item m3
  13423. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13424. @item fg3
  13425. Set 3rd foreground color expression.
  13426. @item m4
  13427. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13428. @item fg4
  13429. Set 4th foreground color expression.
  13430. @item min
  13431. Set minimal value of metadata value.
  13432. @item max
  13433. Set maximal value of metadata value.
  13434. @item bg
  13435. Set graph background color. Default is white.
  13436. @item mode
  13437. Set graph mode.
  13438. Available values for mode is:
  13439. @table @samp
  13440. @item bar
  13441. @item dot
  13442. @item line
  13443. @end table
  13444. Default is @code{line}.
  13445. @item slide
  13446. Set slide mode.
  13447. Available values for slide is:
  13448. @table @samp
  13449. @item frame
  13450. Draw new frame when right border is reached.
  13451. @item replace
  13452. Replace old columns with new ones.
  13453. @item scroll
  13454. Scroll from right to left.
  13455. @item rscroll
  13456. Scroll from left to right.
  13457. @item picture
  13458. Draw single picture.
  13459. @end table
  13460. Default is @code{frame}.
  13461. @item size
  13462. Set size of graph video. For the syntax of this option, check the
  13463. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13464. The default value is @code{900x256}.
  13465. The foreground color expressions can use the following variables:
  13466. @table @option
  13467. @item MIN
  13468. Minimal value of metadata value.
  13469. @item MAX
  13470. Maximal value of metadata value.
  13471. @item VAL
  13472. Current metadata key value.
  13473. @end table
  13474. The color is defined as 0xAABBGGRR.
  13475. @end table
  13476. Example using metadata from @ref{signalstats} filter:
  13477. @example
  13478. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13479. @end example
  13480. Example using metadata from @ref{ebur128} filter:
  13481. @example
  13482. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13483. @end example
  13484. @anchor{ebur128}
  13485. @section ebur128
  13486. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13487. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13488. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13489. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13490. The filter also has a video output (see the @var{video} option) with a real
  13491. time graph to observe the loudness evolution. The graphic contains the logged
  13492. message mentioned above, so it is not printed anymore when this option is set,
  13493. unless the verbose logging is set. The main graphing area contains the
  13494. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13495. the momentary loudness (400 milliseconds).
  13496. More information about the Loudness Recommendation EBU R128 on
  13497. @url{http://tech.ebu.ch/loudness}.
  13498. The filter accepts the following options:
  13499. @table @option
  13500. @item video
  13501. Activate the video output. The audio stream is passed unchanged whether this
  13502. option is set or no. The video stream will be the first output stream if
  13503. activated. Default is @code{0}.
  13504. @item size
  13505. Set the video size. This option is for video only. For the syntax of this
  13506. option, check the
  13507. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13508. Default and minimum resolution is @code{640x480}.
  13509. @item meter
  13510. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13511. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13512. other integer value between this range is allowed.
  13513. @item metadata
  13514. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13515. into 100ms output frames, each of them containing various loudness information
  13516. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13517. Default is @code{0}.
  13518. @item framelog
  13519. Force the frame logging level.
  13520. Available values are:
  13521. @table @samp
  13522. @item info
  13523. information logging level
  13524. @item verbose
  13525. verbose logging level
  13526. @end table
  13527. By default, the logging level is set to @var{info}. If the @option{video} or
  13528. the @option{metadata} options are set, it switches to @var{verbose}.
  13529. @item peak
  13530. Set peak mode(s).
  13531. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13532. values are:
  13533. @table @samp
  13534. @item none
  13535. Disable any peak mode (default).
  13536. @item sample
  13537. Enable sample-peak mode.
  13538. Simple peak mode looking for the higher sample value. It logs a message
  13539. for sample-peak (identified by @code{SPK}).
  13540. @item true
  13541. Enable true-peak mode.
  13542. If enabled, the peak lookup is done on an over-sampled version of the input
  13543. stream for better peak accuracy. It logs a message for true-peak.
  13544. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13545. This mode requires a build with @code{libswresample}.
  13546. @end table
  13547. @item dualmono
  13548. Treat mono input files as "dual mono". If a mono file is intended for playback
  13549. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13550. If set to @code{true}, this option will compensate for this effect.
  13551. Multi-channel input files are not affected by this option.
  13552. @item panlaw
  13553. Set a specific pan law to be used for the measurement of dual mono files.
  13554. This parameter is optional, and has a default value of -3.01dB.
  13555. @end table
  13556. @subsection Examples
  13557. @itemize
  13558. @item
  13559. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13560. @example
  13561. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13562. @end example
  13563. @item
  13564. Run an analysis with @command{ffmpeg}:
  13565. @example
  13566. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13567. @end example
  13568. @end itemize
  13569. @section interleave, ainterleave
  13570. Temporally interleave frames from several inputs.
  13571. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13572. These filters read frames from several inputs and send the oldest
  13573. queued frame to the output.
  13574. Input streams must have well defined, monotonically increasing frame
  13575. timestamp values.
  13576. In order to submit one frame to output, these filters need to enqueue
  13577. at least one frame for each input, so they cannot work in case one
  13578. input is not yet terminated and will not receive incoming frames.
  13579. For example consider the case when one input is a @code{select} filter
  13580. which always drops input frames. The @code{interleave} filter will keep
  13581. reading from that input, but it will never be able to send new frames
  13582. to output until the input sends an end-of-stream signal.
  13583. Also, depending on inputs synchronization, the filters will drop
  13584. frames in case one input receives more frames than the other ones, and
  13585. the queue is already filled.
  13586. These filters accept the following options:
  13587. @table @option
  13588. @item nb_inputs, n
  13589. Set the number of different inputs, it is 2 by default.
  13590. @end table
  13591. @subsection Examples
  13592. @itemize
  13593. @item
  13594. Interleave frames belonging to different streams using @command{ffmpeg}:
  13595. @example
  13596. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13597. @end example
  13598. @item
  13599. Add flickering blur effect:
  13600. @example
  13601. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13602. @end example
  13603. @end itemize
  13604. @section metadata, ametadata
  13605. Manipulate frame metadata.
  13606. This filter accepts the following options:
  13607. @table @option
  13608. @item mode
  13609. Set mode of operation of the filter.
  13610. Can be one of the following:
  13611. @table @samp
  13612. @item select
  13613. If both @code{value} and @code{key} is set, select frames
  13614. which have such metadata. If only @code{key} is set, select
  13615. every frame that has such key in metadata.
  13616. @item add
  13617. Add new metadata @code{key} and @code{value}. If key is already available
  13618. do nothing.
  13619. @item modify
  13620. Modify value of already present key.
  13621. @item delete
  13622. If @code{value} is set, delete only keys that have such value.
  13623. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13624. the frame.
  13625. @item print
  13626. Print key and its value if metadata was found. If @code{key} is not set print all
  13627. metadata values available in frame.
  13628. @end table
  13629. @item key
  13630. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13631. @item value
  13632. Set metadata value which will be used. This option is mandatory for
  13633. @code{modify} and @code{add} mode.
  13634. @item function
  13635. Which function to use when comparing metadata value and @code{value}.
  13636. Can be one of following:
  13637. @table @samp
  13638. @item same_str
  13639. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13640. @item starts_with
  13641. Values are interpreted as strings, returns true if metadata value starts with
  13642. the @code{value} option string.
  13643. @item less
  13644. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13645. @item equal
  13646. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13647. @item greater
  13648. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13649. @item expr
  13650. Values are interpreted as floats, returns true if expression from option @code{expr}
  13651. evaluates to true.
  13652. @end table
  13653. @item expr
  13654. Set expression which is used when @code{function} is set to @code{expr}.
  13655. The expression is evaluated through the eval API and can contain the following
  13656. constants:
  13657. @table @option
  13658. @item VALUE1
  13659. Float representation of @code{value} from metadata key.
  13660. @item VALUE2
  13661. Float representation of @code{value} as supplied by user in @code{value} option.
  13662. @end table
  13663. @item file
  13664. If specified in @code{print} mode, output is written to the named file. Instead of
  13665. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13666. for standard output. If @code{file} option is not set, output is written to the log
  13667. with AV_LOG_INFO loglevel.
  13668. @end table
  13669. @subsection Examples
  13670. @itemize
  13671. @item
  13672. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13673. between 0 and 1.
  13674. @example
  13675. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13676. @end example
  13677. @item
  13678. Print silencedetect output to file @file{metadata.txt}.
  13679. @example
  13680. silencedetect,ametadata=mode=print:file=metadata.txt
  13681. @end example
  13682. @item
  13683. Direct all metadata to a pipe with file descriptor 4.
  13684. @example
  13685. metadata=mode=print:file='pipe\:4'
  13686. @end example
  13687. @end itemize
  13688. @section perms, aperms
  13689. Set read/write permissions for the output frames.
  13690. These filters are mainly aimed at developers to test direct path in the
  13691. following filter in the filtergraph.
  13692. The filters accept the following options:
  13693. @table @option
  13694. @item mode
  13695. Select the permissions mode.
  13696. It accepts the following values:
  13697. @table @samp
  13698. @item none
  13699. Do nothing. This is the default.
  13700. @item ro
  13701. Set all the output frames read-only.
  13702. @item rw
  13703. Set all the output frames directly writable.
  13704. @item toggle
  13705. Make the frame read-only if writable, and writable if read-only.
  13706. @item random
  13707. Set each output frame read-only or writable randomly.
  13708. @end table
  13709. @item seed
  13710. Set the seed for the @var{random} mode, must be an integer included between
  13711. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13712. @code{-1}, the filter will try to use a good random seed on a best effort
  13713. basis.
  13714. @end table
  13715. Note: in case of auto-inserted filter between the permission filter and the
  13716. following one, the permission might not be received as expected in that
  13717. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13718. perms/aperms filter can avoid this problem.
  13719. @section realtime, arealtime
  13720. Slow down filtering to match real time approximately.
  13721. These filters will pause the filtering for a variable amount of time to
  13722. match the output rate with the input timestamps.
  13723. They are similar to the @option{re} option to @code{ffmpeg}.
  13724. They accept the following options:
  13725. @table @option
  13726. @item limit
  13727. Time limit for the pauses. Any pause longer than that will be considered
  13728. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13729. @end table
  13730. @anchor{select}
  13731. @section select, aselect
  13732. Select frames to pass in output.
  13733. This filter accepts the following options:
  13734. @table @option
  13735. @item expr, e
  13736. Set expression, which is evaluated for each input frame.
  13737. If the expression is evaluated to zero, the frame is discarded.
  13738. If the evaluation result is negative or NaN, the frame is sent to the
  13739. first output; otherwise it is sent to the output with index
  13740. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13741. For example a value of @code{1.2} corresponds to the output with index
  13742. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13743. @item outputs, n
  13744. Set the number of outputs. The output to which to send the selected
  13745. frame is based on the result of the evaluation. Default value is 1.
  13746. @end table
  13747. The expression can contain the following constants:
  13748. @table @option
  13749. @item n
  13750. The (sequential) number of the filtered frame, starting from 0.
  13751. @item selected_n
  13752. The (sequential) number of the selected frame, starting from 0.
  13753. @item prev_selected_n
  13754. The sequential number of the last selected frame. It's NAN if undefined.
  13755. @item TB
  13756. The timebase of the input timestamps.
  13757. @item pts
  13758. The PTS (Presentation TimeStamp) of the filtered video frame,
  13759. expressed in @var{TB} units. It's NAN if undefined.
  13760. @item t
  13761. The PTS of the filtered video frame,
  13762. expressed in seconds. It's NAN if undefined.
  13763. @item prev_pts
  13764. The PTS of the previously filtered video frame. It's NAN if undefined.
  13765. @item prev_selected_pts
  13766. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13767. @item prev_selected_t
  13768. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13769. @item start_pts
  13770. The PTS of the first video frame in the video. It's NAN if undefined.
  13771. @item start_t
  13772. The time of the first video frame in the video. It's NAN if undefined.
  13773. @item pict_type @emph{(video only)}
  13774. The type of the filtered frame. It can assume one of the following
  13775. values:
  13776. @table @option
  13777. @item I
  13778. @item P
  13779. @item B
  13780. @item S
  13781. @item SI
  13782. @item SP
  13783. @item BI
  13784. @end table
  13785. @item interlace_type @emph{(video only)}
  13786. The frame interlace type. It can assume one of the following values:
  13787. @table @option
  13788. @item PROGRESSIVE
  13789. The frame is progressive (not interlaced).
  13790. @item TOPFIRST
  13791. The frame is top-field-first.
  13792. @item BOTTOMFIRST
  13793. The frame is bottom-field-first.
  13794. @end table
  13795. @item consumed_sample_n @emph{(audio only)}
  13796. the number of selected samples before the current frame
  13797. @item samples_n @emph{(audio only)}
  13798. the number of samples in the current frame
  13799. @item sample_rate @emph{(audio only)}
  13800. the input sample rate
  13801. @item key
  13802. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13803. @item pos
  13804. the position in the file of the filtered frame, -1 if the information
  13805. is not available (e.g. for synthetic video)
  13806. @item scene @emph{(video only)}
  13807. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13808. probability for the current frame to introduce a new scene, while a higher
  13809. value means the current frame is more likely to be one (see the example below)
  13810. @item concatdec_select
  13811. The concat demuxer can select only part of a concat input file by setting an
  13812. inpoint and an outpoint, but the output packets may not be entirely contained
  13813. in the selected interval. By using this variable, it is possible to skip frames
  13814. generated by the concat demuxer which are not exactly contained in the selected
  13815. interval.
  13816. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13817. and the @var{lavf.concat.duration} packet metadata values which are also
  13818. present in the decoded frames.
  13819. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13820. start_time and either the duration metadata is missing or the frame pts is less
  13821. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13822. missing.
  13823. That basically means that an input frame is selected if its pts is within the
  13824. interval set by the concat demuxer.
  13825. @end table
  13826. The default value of the select expression is "1".
  13827. @subsection Examples
  13828. @itemize
  13829. @item
  13830. Select all frames in input:
  13831. @example
  13832. select
  13833. @end example
  13834. The example above is the same as:
  13835. @example
  13836. select=1
  13837. @end example
  13838. @item
  13839. Skip all frames:
  13840. @example
  13841. select=0
  13842. @end example
  13843. @item
  13844. Select only I-frames:
  13845. @example
  13846. select='eq(pict_type\,I)'
  13847. @end example
  13848. @item
  13849. Select one frame every 100:
  13850. @example
  13851. select='not(mod(n\,100))'
  13852. @end example
  13853. @item
  13854. Select only frames contained in the 10-20 time interval:
  13855. @example
  13856. select=between(t\,10\,20)
  13857. @end example
  13858. @item
  13859. Select only I-frames contained in the 10-20 time interval:
  13860. @example
  13861. select=between(t\,10\,20)*eq(pict_type\,I)
  13862. @end example
  13863. @item
  13864. Select frames with a minimum distance of 10 seconds:
  13865. @example
  13866. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13867. @end example
  13868. @item
  13869. Use aselect to select only audio frames with samples number > 100:
  13870. @example
  13871. aselect='gt(samples_n\,100)'
  13872. @end example
  13873. @item
  13874. Create a mosaic of the first scenes:
  13875. @example
  13876. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13877. @end example
  13878. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13879. choice.
  13880. @item
  13881. Send even and odd frames to separate outputs, and compose them:
  13882. @example
  13883. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13884. @end example
  13885. @item
  13886. Select useful frames from an ffconcat file which is using inpoints and
  13887. outpoints but where the source files are not intra frame only.
  13888. @example
  13889. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13890. @end example
  13891. @end itemize
  13892. @section sendcmd, asendcmd
  13893. Send commands to filters in the filtergraph.
  13894. These filters read commands to be sent to other filters in the
  13895. filtergraph.
  13896. @code{sendcmd} must be inserted between two video filters,
  13897. @code{asendcmd} must be inserted between two audio filters, but apart
  13898. from that they act the same way.
  13899. The specification of commands can be provided in the filter arguments
  13900. with the @var{commands} option, or in a file specified by the
  13901. @var{filename} option.
  13902. These filters accept the following options:
  13903. @table @option
  13904. @item commands, c
  13905. Set the commands to be read and sent to the other filters.
  13906. @item filename, f
  13907. Set the filename of the commands to be read and sent to the other
  13908. filters.
  13909. @end table
  13910. @subsection Commands syntax
  13911. A commands description consists of a sequence of interval
  13912. specifications, comprising a list of commands to be executed when a
  13913. particular event related to that interval occurs. The occurring event
  13914. is typically the current frame time entering or leaving a given time
  13915. interval.
  13916. An interval is specified by the following syntax:
  13917. @example
  13918. @var{START}[-@var{END}] @var{COMMANDS};
  13919. @end example
  13920. The time interval is specified by the @var{START} and @var{END} times.
  13921. @var{END} is optional and defaults to the maximum time.
  13922. The current frame time is considered within the specified interval if
  13923. it is included in the interval [@var{START}, @var{END}), that is when
  13924. the time is greater or equal to @var{START} and is lesser than
  13925. @var{END}.
  13926. @var{COMMANDS} consists of a sequence of one or more command
  13927. specifications, separated by ",", relating to that interval. The
  13928. syntax of a command specification is given by:
  13929. @example
  13930. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13931. @end example
  13932. @var{FLAGS} is optional and specifies the type of events relating to
  13933. the time interval which enable sending the specified command, and must
  13934. be a non-null sequence of identifier flags separated by "+" or "|" and
  13935. enclosed between "[" and "]".
  13936. The following flags are recognized:
  13937. @table @option
  13938. @item enter
  13939. The command is sent when the current frame timestamp enters the
  13940. specified interval. In other words, the command is sent when the
  13941. previous frame timestamp was not in the given interval, and the
  13942. current is.
  13943. @item leave
  13944. The command is sent when the current frame timestamp leaves the
  13945. specified interval. In other words, the command is sent when the
  13946. previous frame timestamp was in the given interval, and the
  13947. current is not.
  13948. @end table
  13949. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13950. assumed.
  13951. @var{TARGET} specifies the target of the command, usually the name of
  13952. the filter class or a specific filter instance name.
  13953. @var{COMMAND} specifies the name of the command for the target filter.
  13954. @var{ARG} is optional and specifies the optional list of argument for
  13955. the given @var{COMMAND}.
  13956. Between one interval specification and another, whitespaces, or
  13957. sequences of characters starting with @code{#} until the end of line,
  13958. are ignored and can be used to annotate comments.
  13959. A simplified BNF description of the commands specification syntax
  13960. follows:
  13961. @example
  13962. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13963. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13964. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13965. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13966. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13967. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13968. @end example
  13969. @subsection Examples
  13970. @itemize
  13971. @item
  13972. Specify audio tempo change at second 4:
  13973. @example
  13974. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13975. @end example
  13976. @item
  13977. Target a specific filter instance:
  13978. @example
  13979. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13980. @end example
  13981. @item
  13982. Specify a list of drawtext and hue commands in a file.
  13983. @example
  13984. # show text in the interval 5-10
  13985. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13986. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13987. # desaturate the image in the interval 15-20
  13988. 15.0-20.0 [enter] hue s 0,
  13989. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13990. [leave] hue s 1,
  13991. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13992. # apply an exponential saturation fade-out effect, starting from time 25
  13993. 25 [enter] hue s exp(25-t)
  13994. @end example
  13995. A filtergraph allowing to read and process the above command list
  13996. stored in a file @file{test.cmd}, can be specified with:
  13997. @example
  13998. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13999. @end example
  14000. @end itemize
  14001. @anchor{setpts}
  14002. @section setpts, asetpts
  14003. Change the PTS (presentation timestamp) of the input frames.
  14004. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14005. This filter accepts the following options:
  14006. @table @option
  14007. @item expr
  14008. The expression which is evaluated for each frame to construct its timestamp.
  14009. @end table
  14010. The expression is evaluated through the eval API and can contain the following
  14011. constants:
  14012. @table @option
  14013. @item FRAME_RATE
  14014. frame rate, only defined for constant frame-rate video
  14015. @item PTS
  14016. The presentation timestamp in input
  14017. @item N
  14018. The count of the input frame for video or the number of consumed samples,
  14019. not including the current frame for audio, starting from 0.
  14020. @item NB_CONSUMED_SAMPLES
  14021. The number of consumed samples, not including the current frame (only
  14022. audio)
  14023. @item NB_SAMPLES, S
  14024. The number of samples in the current frame (only audio)
  14025. @item SAMPLE_RATE, SR
  14026. The audio sample rate.
  14027. @item STARTPTS
  14028. The PTS of the first frame.
  14029. @item STARTT
  14030. the time in seconds of the first frame
  14031. @item INTERLACED
  14032. State whether the current frame is interlaced.
  14033. @item T
  14034. the time in seconds of the current frame
  14035. @item POS
  14036. original position in the file of the frame, or undefined if undefined
  14037. for the current frame
  14038. @item PREV_INPTS
  14039. The previous input PTS.
  14040. @item PREV_INT
  14041. previous input time in seconds
  14042. @item PREV_OUTPTS
  14043. The previous output PTS.
  14044. @item PREV_OUTT
  14045. previous output time in seconds
  14046. @item RTCTIME
  14047. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14048. instead.
  14049. @item RTCSTART
  14050. The wallclock (RTC) time at the start of the movie in microseconds.
  14051. @item TB
  14052. The timebase of the input timestamps.
  14053. @end table
  14054. @subsection Examples
  14055. @itemize
  14056. @item
  14057. Start counting PTS from zero
  14058. @example
  14059. setpts=PTS-STARTPTS
  14060. @end example
  14061. @item
  14062. Apply fast motion effect:
  14063. @example
  14064. setpts=0.5*PTS
  14065. @end example
  14066. @item
  14067. Apply slow motion effect:
  14068. @example
  14069. setpts=2.0*PTS
  14070. @end example
  14071. @item
  14072. Set fixed rate of 25 frames per second:
  14073. @example
  14074. setpts=N/(25*TB)
  14075. @end example
  14076. @item
  14077. Set fixed rate 25 fps with some jitter:
  14078. @example
  14079. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14080. @end example
  14081. @item
  14082. Apply an offset of 10 seconds to the input PTS:
  14083. @example
  14084. setpts=PTS+10/TB
  14085. @end example
  14086. @item
  14087. Generate timestamps from a "live source" and rebase onto the current timebase:
  14088. @example
  14089. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14090. @end example
  14091. @item
  14092. Generate timestamps by counting samples:
  14093. @example
  14094. asetpts=N/SR/TB
  14095. @end example
  14096. @end itemize
  14097. @section setrange
  14098. Force color range for the output video frame.
  14099. The @code{setrange} filter marks the color range property for the
  14100. output frames. It does not change the input frame, but only sets the
  14101. corresponding property, which affects how the frame is treated by
  14102. following filters.
  14103. The filter accepts the following options:
  14104. @table @option
  14105. @item range
  14106. Available values are:
  14107. @table @samp
  14108. @item auto
  14109. Keep the same color range property.
  14110. @item unspecified, unknown
  14111. Set the color range as unspecified.
  14112. @item limited, tv, mpeg
  14113. Set the color range as limited.
  14114. @item full, pc, jpeg
  14115. Set the color range as full.
  14116. @end table
  14117. @end table
  14118. @section settb, asettb
  14119. Set the timebase to use for the output frames timestamps.
  14120. It is mainly useful for testing timebase configuration.
  14121. It accepts the following parameters:
  14122. @table @option
  14123. @item expr, tb
  14124. The expression which is evaluated into the output timebase.
  14125. @end table
  14126. The value for @option{tb} is an arithmetic expression representing a
  14127. rational. The expression can contain the constants "AVTB" (the default
  14128. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14129. audio only). Default value is "intb".
  14130. @subsection Examples
  14131. @itemize
  14132. @item
  14133. Set the timebase to 1/25:
  14134. @example
  14135. settb=expr=1/25
  14136. @end example
  14137. @item
  14138. Set the timebase to 1/10:
  14139. @example
  14140. settb=expr=0.1
  14141. @end example
  14142. @item
  14143. Set the timebase to 1001/1000:
  14144. @example
  14145. settb=1+0.001
  14146. @end example
  14147. @item
  14148. Set the timebase to 2*intb:
  14149. @example
  14150. settb=2*intb
  14151. @end example
  14152. @item
  14153. Set the default timebase value:
  14154. @example
  14155. settb=AVTB
  14156. @end example
  14157. @end itemize
  14158. @section showcqt
  14159. Convert input audio to a video output representing frequency spectrum
  14160. logarithmically using Brown-Puckette constant Q transform algorithm with
  14161. direct frequency domain coefficient calculation (but the transform itself
  14162. is not really constant Q, instead the Q factor is actually variable/clamped),
  14163. with musical tone scale, from E0 to D#10.
  14164. The filter accepts the following options:
  14165. @table @option
  14166. @item size, s
  14167. Specify the video size for the output. It must be even. For the syntax of this option,
  14168. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14169. Default value is @code{1920x1080}.
  14170. @item fps, rate, r
  14171. Set the output frame rate. Default value is @code{25}.
  14172. @item bar_h
  14173. Set the bargraph height. It must be even. Default value is @code{-1} which
  14174. computes the bargraph height automatically.
  14175. @item axis_h
  14176. Set the axis height. It must be even. Default value is @code{-1} which computes
  14177. the axis height automatically.
  14178. @item sono_h
  14179. Set the sonogram height. It must be even. Default value is @code{-1} which
  14180. computes the sonogram height automatically.
  14181. @item fullhd
  14182. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14183. instead. Default value is @code{1}.
  14184. @item sono_v, volume
  14185. Specify the sonogram volume expression. It can contain variables:
  14186. @table @option
  14187. @item bar_v
  14188. the @var{bar_v} evaluated expression
  14189. @item frequency, freq, f
  14190. the frequency where it is evaluated
  14191. @item timeclamp, tc
  14192. the value of @var{timeclamp} option
  14193. @end table
  14194. and functions:
  14195. @table @option
  14196. @item a_weighting(f)
  14197. A-weighting of equal loudness
  14198. @item b_weighting(f)
  14199. B-weighting of equal loudness
  14200. @item c_weighting(f)
  14201. C-weighting of equal loudness.
  14202. @end table
  14203. Default value is @code{16}.
  14204. @item bar_v, volume2
  14205. Specify the bargraph volume expression. It can contain variables:
  14206. @table @option
  14207. @item sono_v
  14208. the @var{sono_v} evaluated expression
  14209. @item frequency, freq, f
  14210. the frequency where it is evaluated
  14211. @item timeclamp, tc
  14212. the value of @var{timeclamp} option
  14213. @end table
  14214. and functions:
  14215. @table @option
  14216. @item a_weighting(f)
  14217. A-weighting of equal loudness
  14218. @item b_weighting(f)
  14219. B-weighting of equal loudness
  14220. @item c_weighting(f)
  14221. C-weighting of equal loudness.
  14222. @end table
  14223. Default value is @code{sono_v}.
  14224. @item sono_g, gamma
  14225. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14226. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14227. Acceptable range is @code{[1, 7]}.
  14228. @item bar_g, gamma2
  14229. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14230. @code{[1, 7]}.
  14231. @item bar_t
  14232. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14233. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14234. @item timeclamp, tc
  14235. Specify the transform timeclamp. At low frequency, there is trade-off between
  14236. accuracy in time domain and frequency domain. If timeclamp is lower,
  14237. event in time domain is represented more accurately (such as fast bass drum),
  14238. otherwise event in frequency domain is represented more accurately
  14239. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14240. @item attack
  14241. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14242. limits future samples by applying asymmetric windowing in time domain, useful
  14243. when low latency is required. Accepted range is @code{[0, 1]}.
  14244. @item basefreq
  14245. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14246. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14247. @item endfreq
  14248. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14249. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14250. @item coeffclamp
  14251. This option is deprecated and ignored.
  14252. @item tlength
  14253. Specify the transform length in time domain. Use this option to control accuracy
  14254. trade-off between time domain and frequency domain at every frequency sample.
  14255. It can contain variables:
  14256. @table @option
  14257. @item frequency, freq, f
  14258. the frequency where it is evaluated
  14259. @item timeclamp, tc
  14260. the value of @var{timeclamp} option.
  14261. @end table
  14262. Default value is @code{384*tc/(384+tc*f)}.
  14263. @item count
  14264. Specify the transform count for every video frame. Default value is @code{6}.
  14265. Acceptable range is @code{[1, 30]}.
  14266. @item fcount
  14267. Specify the transform count for every single pixel. Default value is @code{0},
  14268. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14269. @item fontfile
  14270. Specify font file for use with freetype to draw the axis. If not specified,
  14271. use embedded font. Note that drawing with font file or embedded font is not
  14272. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14273. option instead.
  14274. @item font
  14275. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14276. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14277. @item fontcolor
  14278. Specify font color expression. This is arithmetic expression that should return
  14279. integer value 0xRRGGBB. It can contain variables:
  14280. @table @option
  14281. @item frequency, freq, f
  14282. the frequency where it is evaluated
  14283. @item timeclamp, tc
  14284. the value of @var{timeclamp} option
  14285. @end table
  14286. and functions:
  14287. @table @option
  14288. @item midi(f)
  14289. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14290. @item r(x), g(x), b(x)
  14291. red, green, and blue value of intensity x.
  14292. @end table
  14293. Default value is @code{st(0, (midi(f)-59.5)/12);
  14294. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14295. r(1-ld(1)) + b(ld(1))}.
  14296. @item axisfile
  14297. Specify image file to draw the axis. This option override @var{fontfile} and
  14298. @var{fontcolor} option.
  14299. @item axis, text
  14300. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14301. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14302. Default value is @code{1}.
  14303. @item csp
  14304. Set colorspace. The accepted values are:
  14305. @table @samp
  14306. @item unspecified
  14307. Unspecified (default)
  14308. @item bt709
  14309. BT.709
  14310. @item fcc
  14311. FCC
  14312. @item bt470bg
  14313. BT.470BG or BT.601-6 625
  14314. @item smpte170m
  14315. SMPTE-170M or BT.601-6 525
  14316. @item smpte240m
  14317. SMPTE-240M
  14318. @item bt2020ncl
  14319. BT.2020 with non-constant luminance
  14320. @end table
  14321. @item cscheme
  14322. Set spectrogram color scheme. This is list of floating point values with format
  14323. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14324. The default is @code{1|0.5|0|0|0.5|1}.
  14325. @end table
  14326. @subsection Examples
  14327. @itemize
  14328. @item
  14329. Playing audio while showing the spectrum:
  14330. @example
  14331. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14332. @end example
  14333. @item
  14334. Same as above, but with frame rate 30 fps:
  14335. @example
  14336. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14337. @end example
  14338. @item
  14339. Playing at 1280x720:
  14340. @example
  14341. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14342. @end example
  14343. @item
  14344. Disable sonogram display:
  14345. @example
  14346. sono_h=0
  14347. @end example
  14348. @item
  14349. A1 and its harmonics: A1, A2, (near)E3, A3:
  14350. @example
  14351. 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),
  14352. asplit[a][out1]; [a] showcqt [out0]'
  14353. @end example
  14354. @item
  14355. Same as above, but with more accuracy in frequency domain:
  14356. @example
  14357. 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),
  14358. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14359. @end example
  14360. @item
  14361. Custom volume:
  14362. @example
  14363. bar_v=10:sono_v=bar_v*a_weighting(f)
  14364. @end example
  14365. @item
  14366. Custom gamma, now spectrum is linear to the amplitude.
  14367. @example
  14368. bar_g=2:sono_g=2
  14369. @end example
  14370. @item
  14371. Custom tlength equation:
  14372. @example
  14373. 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)))'
  14374. @end example
  14375. @item
  14376. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14377. @example
  14378. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14379. @end example
  14380. @item
  14381. Custom font using fontconfig:
  14382. @example
  14383. font='Courier New,Monospace,mono|bold'
  14384. @end example
  14385. @item
  14386. Custom frequency range with custom axis using image file:
  14387. @example
  14388. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14389. @end example
  14390. @end itemize
  14391. @section showfreqs
  14392. Convert input audio to video output representing the audio power spectrum.
  14393. Audio amplitude is on Y-axis while frequency is on X-axis.
  14394. The filter accepts the following options:
  14395. @table @option
  14396. @item size, s
  14397. Specify size of video. For the syntax of this option, check the
  14398. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14399. Default is @code{1024x512}.
  14400. @item mode
  14401. Set display mode.
  14402. This set how each frequency bin will be represented.
  14403. It accepts the following values:
  14404. @table @samp
  14405. @item line
  14406. @item bar
  14407. @item dot
  14408. @end table
  14409. Default is @code{bar}.
  14410. @item ascale
  14411. Set amplitude scale.
  14412. It accepts the following values:
  14413. @table @samp
  14414. @item lin
  14415. Linear scale.
  14416. @item sqrt
  14417. Square root scale.
  14418. @item cbrt
  14419. Cubic root scale.
  14420. @item log
  14421. Logarithmic scale.
  14422. @end table
  14423. Default is @code{log}.
  14424. @item fscale
  14425. Set frequency scale.
  14426. It accepts the following values:
  14427. @table @samp
  14428. @item lin
  14429. Linear scale.
  14430. @item log
  14431. Logarithmic scale.
  14432. @item rlog
  14433. Reverse logarithmic scale.
  14434. @end table
  14435. Default is @code{lin}.
  14436. @item win_size
  14437. Set window size.
  14438. It accepts the following values:
  14439. @table @samp
  14440. @item w16
  14441. @item w32
  14442. @item w64
  14443. @item w128
  14444. @item w256
  14445. @item w512
  14446. @item w1024
  14447. @item w2048
  14448. @item w4096
  14449. @item w8192
  14450. @item w16384
  14451. @item w32768
  14452. @item w65536
  14453. @end table
  14454. Default is @code{w2048}
  14455. @item win_func
  14456. Set windowing function.
  14457. It accepts the following values:
  14458. @table @samp
  14459. @item rect
  14460. @item bartlett
  14461. @item hanning
  14462. @item hamming
  14463. @item blackman
  14464. @item welch
  14465. @item flattop
  14466. @item bharris
  14467. @item bnuttall
  14468. @item bhann
  14469. @item sine
  14470. @item nuttall
  14471. @item lanczos
  14472. @item gauss
  14473. @item tukey
  14474. @item dolph
  14475. @item cauchy
  14476. @item parzen
  14477. @item poisson
  14478. @end table
  14479. Default is @code{hanning}.
  14480. @item overlap
  14481. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14482. which means optimal overlap for selected window function will be picked.
  14483. @item averaging
  14484. Set time averaging. Setting this to 0 will display current maximal peaks.
  14485. Default is @code{1}, which means time averaging is disabled.
  14486. @item colors
  14487. Specify list of colors separated by space or by '|' which will be used to
  14488. draw channel frequencies. Unrecognized or missing colors will be replaced
  14489. by white color.
  14490. @item cmode
  14491. Set channel display mode.
  14492. It accepts the following values:
  14493. @table @samp
  14494. @item combined
  14495. @item separate
  14496. @end table
  14497. Default is @code{combined}.
  14498. @item minamp
  14499. Set minimum amplitude used in @code{log} amplitude scaler.
  14500. @end table
  14501. @anchor{showspectrum}
  14502. @section showspectrum
  14503. Convert input audio to a video output, representing the audio frequency
  14504. spectrum.
  14505. The filter accepts the following options:
  14506. @table @option
  14507. @item size, s
  14508. Specify the video size for the output. For the syntax of this option, check the
  14509. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14510. Default value is @code{640x512}.
  14511. @item slide
  14512. Specify how the spectrum should slide along the window.
  14513. It accepts the following values:
  14514. @table @samp
  14515. @item replace
  14516. the samples start again on the left when they reach the right
  14517. @item scroll
  14518. the samples scroll from right to left
  14519. @item fullframe
  14520. frames are only produced when the samples reach the right
  14521. @item rscroll
  14522. the samples scroll from left to right
  14523. @end table
  14524. Default value is @code{replace}.
  14525. @item mode
  14526. Specify display mode.
  14527. It accepts the following values:
  14528. @table @samp
  14529. @item combined
  14530. all channels are displayed in the same row
  14531. @item separate
  14532. all channels are displayed in separate rows
  14533. @end table
  14534. Default value is @samp{combined}.
  14535. @item color
  14536. Specify display color mode.
  14537. It accepts the following values:
  14538. @table @samp
  14539. @item channel
  14540. each channel is displayed in a separate color
  14541. @item intensity
  14542. each channel is displayed using the same color scheme
  14543. @item rainbow
  14544. each channel is displayed using the rainbow color scheme
  14545. @item moreland
  14546. each channel is displayed using the moreland color scheme
  14547. @item nebulae
  14548. each channel is displayed using the nebulae color scheme
  14549. @item fire
  14550. each channel is displayed using the fire color scheme
  14551. @item fiery
  14552. each channel is displayed using the fiery color scheme
  14553. @item fruit
  14554. each channel is displayed using the fruit color scheme
  14555. @item cool
  14556. each channel is displayed using the cool color scheme
  14557. @end table
  14558. Default value is @samp{channel}.
  14559. @item scale
  14560. Specify scale used for calculating intensity color values.
  14561. It accepts the following values:
  14562. @table @samp
  14563. @item lin
  14564. linear
  14565. @item sqrt
  14566. square root, default
  14567. @item cbrt
  14568. cubic root
  14569. @item log
  14570. logarithmic
  14571. @item 4thrt
  14572. 4th root
  14573. @item 5thrt
  14574. 5th root
  14575. @end table
  14576. Default value is @samp{sqrt}.
  14577. @item saturation
  14578. Set saturation modifier for displayed colors. Negative values provide
  14579. alternative color scheme. @code{0} is no saturation at all.
  14580. Saturation must be in [-10.0, 10.0] range.
  14581. Default value is @code{1}.
  14582. @item win_func
  14583. Set window function.
  14584. It accepts the following values:
  14585. @table @samp
  14586. @item rect
  14587. @item bartlett
  14588. @item hann
  14589. @item hanning
  14590. @item hamming
  14591. @item blackman
  14592. @item welch
  14593. @item flattop
  14594. @item bharris
  14595. @item bnuttall
  14596. @item bhann
  14597. @item sine
  14598. @item nuttall
  14599. @item lanczos
  14600. @item gauss
  14601. @item tukey
  14602. @item dolph
  14603. @item cauchy
  14604. @item parzen
  14605. @item poisson
  14606. @end table
  14607. Default value is @code{hann}.
  14608. @item orientation
  14609. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14610. @code{horizontal}. Default is @code{vertical}.
  14611. @item overlap
  14612. Set ratio of overlap window. Default value is @code{0}.
  14613. When value is @code{1} overlap is set to recommended size for specific
  14614. window function currently used.
  14615. @item gain
  14616. Set scale gain for calculating intensity color values.
  14617. Default value is @code{1}.
  14618. @item data
  14619. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14620. @item rotation
  14621. Set color rotation, must be in [-1.0, 1.0] range.
  14622. Default value is @code{0}.
  14623. @end table
  14624. The usage is very similar to the showwaves filter; see the examples in that
  14625. section.
  14626. @subsection Examples
  14627. @itemize
  14628. @item
  14629. Large window with logarithmic color scaling:
  14630. @example
  14631. showspectrum=s=1280x480:scale=log
  14632. @end example
  14633. @item
  14634. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14635. @example
  14636. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14637. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14638. @end example
  14639. @end itemize
  14640. @section showspectrumpic
  14641. Convert input audio to a single video frame, representing the audio frequency
  14642. spectrum.
  14643. The filter accepts the following options:
  14644. @table @option
  14645. @item size, s
  14646. Specify the video size for the output. For the syntax of this option, check the
  14647. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14648. Default value is @code{4096x2048}.
  14649. @item mode
  14650. Specify display mode.
  14651. It accepts the following values:
  14652. @table @samp
  14653. @item combined
  14654. all channels are displayed in the same row
  14655. @item separate
  14656. all channels are displayed in separate rows
  14657. @end table
  14658. Default value is @samp{combined}.
  14659. @item color
  14660. Specify display color mode.
  14661. It accepts the following values:
  14662. @table @samp
  14663. @item channel
  14664. each channel is displayed in a separate color
  14665. @item intensity
  14666. each channel is displayed using the same color scheme
  14667. @item rainbow
  14668. each channel is displayed using the rainbow color scheme
  14669. @item moreland
  14670. each channel is displayed using the moreland color scheme
  14671. @item nebulae
  14672. each channel is displayed using the nebulae color scheme
  14673. @item fire
  14674. each channel is displayed using the fire color scheme
  14675. @item fiery
  14676. each channel is displayed using the fiery color scheme
  14677. @item fruit
  14678. each channel is displayed using the fruit color scheme
  14679. @item cool
  14680. each channel is displayed using the cool color scheme
  14681. @end table
  14682. Default value is @samp{intensity}.
  14683. @item scale
  14684. Specify scale used for calculating intensity color values.
  14685. It accepts the following values:
  14686. @table @samp
  14687. @item lin
  14688. linear
  14689. @item sqrt
  14690. square root, default
  14691. @item cbrt
  14692. cubic root
  14693. @item log
  14694. logarithmic
  14695. @item 4thrt
  14696. 4th root
  14697. @item 5thrt
  14698. 5th root
  14699. @end table
  14700. Default value is @samp{log}.
  14701. @item saturation
  14702. Set saturation modifier for displayed colors. Negative values provide
  14703. alternative color scheme. @code{0} is no saturation at all.
  14704. Saturation must be in [-10.0, 10.0] range.
  14705. Default value is @code{1}.
  14706. @item win_func
  14707. Set window function.
  14708. It accepts the following values:
  14709. @table @samp
  14710. @item rect
  14711. @item bartlett
  14712. @item hann
  14713. @item hanning
  14714. @item hamming
  14715. @item blackman
  14716. @item welch
  14717. @item flattop
  14718. @item bharris
  14719. @item bnuttall
  14720. @item bhann
  14721. @item sine
  14722. @item nuttall
  14723. @item lanczos
  14724. @item gauss
  14725. @item tukey
  14726. @item dolph
  14727. @item cauchy
  14728. @item parzen
  14729. @item poisson
  14730. @end table
  14731. Default value is @code{hann}.
  14732. @item orientation
  14733. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14734. @code{horizontal}. Default is @code{vertical}.
  14735. @item gain
  14736. Set scale gain for calculating intensity color values.
  14737. Default value is @code{1}.
  14738. @item legend
  14739. Draw time and frequency axes and legends. Default is enabled.
  14740. @item rotation
  14741. Set color rotation, must be in [-1.0, 1.0] range.
  14742. Default value is @code{0}.
  14743. @end table
  14744. @subsection Examples
  14745. @itemize
  14746. @item
  14747. Extract an audio spectrogram of a whole audio track
  14748. in a 1024x1024 picture using @command{ffmpeg}:
  14749. @example
  14750. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14751. @end example
  14752. @end itemize
  14753. @section showvolume
  14754. Convert input audio volume to a video output.
  14755. The filter accepts the following options:
  14756. @table @option
  14757. @item rate, r
  14758. Set video rate.
  14759. @item b
  14760. Set border width, allowed range is [0, 5]. Default is 1.
  14761. @item w
  14762. Set channel width, allowed range is [80, 8192]. Default is 400.
  14763. @item h
  14764. Set channel height, allowed range is [1, 900]. Default is 20.
  14765. @item f
  14766. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14767. @item c
  14768. Set volume color expression.
  14769. The expression can use the following variables:
  14770. @table @option
  14771. @item VOLUME
  14772. Current max volume of channel in dB.
  14773. @item PEAK
  14774. Current peak.
  14775. @item CHANNEL
  14776. Current channel number, starting from 0.
  14777. @end table
  14778. @item t
  14779. If set, displays channel names. Default is enabled.
  14780. @item v
  14781. If set, displays volume values. Default is enabled.
  14782. @item o
  14783. Set orientation, can be @code{horizontal} or @code{vertical},
  14784. default is @code{horizontal}.
  14785. @item s
  14786. Set step size, allowed range s [0, 5]. Default is 0, which means
  14787. step is disabled.
  14788. @end table
  14789. @section showwaves
  14790. Convert input audio to a video output, representing the samples waves.
  14791. The filter accepts the following options:
  14792. @table @option
  14793. @item size, s
  14794. Specify the video size for the output. For the syntax of this option, check the
  14795. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14796. Default value is @code{600x240}.
  14797. @item mode
  14798. Set display mode.
  14799. Available values are:
  14800. @table @samp
  14801. @item point
  14802. Draw a point for each sample.
  14803. @item line
  14804. Draw a vertical line for each sample.
  14805. @item p2p
  14806. Draw a point for each sample and a line between them.
  14807. @item cline
  14808. Draw a centered vertical line for each sample.
  14809. @end table
  14810. Default value is @code{point}.
  14811. @item n
  14812. Set the number of samples which are printed on the same column. A
  14813. larger value will decrease the frame rate. Must be a positive
  14814. integer. This option can be set only if the value for @var{rate}
  14815. is not explicitly specified.
  14816. @item rate, r
  14817. Set the (approximate) output frame rate. This is done by setting the
  14818. option @var{n}. Default value is "25".
  14819. @item split_channels
  14820. Set if channels should be drawn separately or overlap. Default value is 0.
  14821. @item colors
  14822. Set colors separated by '|' which are going to be used for drawing of each channel.
  14823. @item scale
  14824. Set amplitude scale.
  14825. Available values are:
  14826. @table @samp
  14827. @item lin
  14828. Linear.
  14829. @item log
  14830. Logarithmic.
  14831. @item sqrt
  14832. Square root.
  14833. @item cbrt
  14834. Cubic root.
  14835. @end table
  14836. Default is linear.
  14837. @end table
  14838. @subsection Examples
  14839. @itemize
  14840. @item
  14841. Output the input file audio and the corresponding video representation
  14842. at the same time:
  14843. @example
  14844. amovie=a.mp3,asplit[out0],showwaves[out1]
  14845. @end example
  14846. @item
  14847. Create a synthetic signal and show it with showwaves, forcing a
  14848. frame rate of 30 frames per second:
  14849. @example
  14850. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14851. @end example
  14852. @end itemize
  14853. @section showwavespic
  14854. Convert input audio to a single video frame, representing the samples waves.
  14855. The filter accepts the following options:
  14856. @table @option
  14857. @item size, s
  14858. Specify the video size for the output. For the syntax of this option, check the
  14859. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14860. Default value is @code{600x240}.
  14861. @item split_channels
  14862. Set if channels should be drawn separately or overlap. Default value is 0.
  14863. @item colors
  14864. Set colors separated by '|' which are going to be used for drawing of each channel.
  14865. @item scale
  14866. Set amplitude scale.
  14867. Available values are:
  14868. @table @samp
  14869. @item lin
  14870. Linear.
  14871. @item log
  14872. Logarithmic.
  14873. @item sqrt
  14874. Square root.
  14875. @item cbrt
  14876. Cubic root.
  14877. @end table
  14878. Default is linear.
  14879. @end table
  14880. @subsection Examples
  14881. @itemize
  14882. @item
  14883. Extract a channel split representation of the wave form of a whole audio track
  14884. in a 1024x800 picture using @command{ffmpeg}:
  14885. @example
  14886. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14887. @end example
  14888. @end itemize
  14889. @section sidedata, asidedata
  14890. Delete frame side data, or select frames based on it.
  14891. This filter accepts the following options:
  14892. @table @option
  14893. @item mode
  14894. Set mode of operation of the filter.
  14895. Can be one of the following:
  14896. @table @samp
  14897. @item select
  14898. Select every frame with side data of @code{type}.
  14899. @item delete
  14900. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14901. data in the frame.
  14902. @end table
  14903. @item type
  14904. Set side data type used with all modes. Must be set for @code{select} mode. For
  14905. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14906. in @file{libavutil/frame.h}. For example, to choose
  14907. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14908. @end table
  14909. @section spectrumsynth
  14910. Sythesize audio from 2 input video spectrums, first input stream represents
  14911. magnitude across time and second represents phase across time.
  14912. The filter will transform from frequency domain as displayed in videos back
  14913. to time domain as presented in audio output.
  14914. This filter is primarily created for reversing processed @ref{showspectrum}
  14915. filter outputs, but can synthesize sound from other spectrograms too.
  14916. But in such case results are going to be poor if the phase data is not
  14917. available, because in such cases phase data need to be recreated, usually
  14918. its just recreated from random noise.
  14919. For best results use gray only output (@code{channel} color mode in
  14920. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14921. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14922. @code{data} option. Inputs videos should generally use @code{fullframe}
  14923. slide mode as that saves resources needed for decoding video.
  14924. The filter accepts the following options:
  14925. @table @option
  14926. @item sample_rate
  14927. Specify sample rate of output audio, the sample rate of audio from which
  14928. spectrum was generated may differ.
  14929. @item channels
  14930. Set number of channels represented in input video spectrums.
  14931. @item scale
  14932. Set scale which was used when generating magnitude input spectrum.
  14933. Can be @code{lin} or @code{log}. Default is @code{log}.
  14934. @item slide
  14935. Set slide which was used when generating inputs spectrums.
  14936. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14937. Default is @code{fullframe}.
  14938. @item win_func
  14939. Set window function used for resynthesis.
  14940. @item overlap
  14941. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14942. which means optimal overlap for selected window function will be picked.
  14943. @item orientation
  14944. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14945. Default is @code{vertical}.
  14946. @end table
  14947. @subsection Examples
  14948. @itemize
  14949. @item
  14950. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14951. then resynthesize videos back to audio with spectrumsynth:
  14952. @example
  14953. 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
  14954. 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
  14955. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14956. @end example
  14957. @end itemize
  14958. @section split, asplit
  14959. Split input into several identical outputs.
  14960. @code{asplit} works with audio input, @code{split} with video.
  14961. The filter accepts a single parameter which specifies the number of outputs. If
  14962. unspecified, it defaults to 2.
  14963. @subsection Examples
  14964. @itemize
  14965. @item
  14966. Create two separate outputs from the same input:
  14967. @example
  14968. [in] split [out0][out1]
  14969. @end example
  14970. @item
  14971. To create 3 or more outputs, you need to specify the number of
  14972. outputs, like in:
  14973. @example
  14974. [in] asplit=3 [out0][out1][out2]
  14975. @end example
  14976. @item
  14977. Create two separate outputs from the same input, one cropped and
  14978. one padded:
  14979. @example
  14980. [in] split [splitout1][splitout2];
  14981. [splitout1] crop=100:100:0:0 [cropout];
  14982. [splitout2] pad=200:200:100:100 [padout];
  14983. @end example
  14984. @item
  14985. Create 5 copies of the input audio with @command{ffmpeg}:
  14986. @example
  14987. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14988. @end example
  14989. @end itemize
  14990. @section zmq, azmq
  14991. Receive commands sent through a libzmq client, and forward them to
  14992. filters in the filtergraph.
  14993. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14994. must be inserted between two video filters, @code{azmq} between two
  14995. audio filters.
  14996. To enable these filters you need to install the libzmq library and
  14997. headers and configure FFmpeg with @code{--enable-libzmq}.
  14998. For more information about libzmq see:
  14999. @url{http://www.zeromq.org/}
  15000. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15001. receives messages sent through a network interface defined by the
  15002. @option{bind_address} option.
  15003. The received message must be in the form:
  15004. @example
  15005. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15006. @end example
  15007. @var{TARGET} specifies the target of the command, usually the name of
  15008. the filter class or a specific filter instance name.
  15009. @var{COMMAND} specifies the name of the command for the target filter.
  15010. @var{ARG} is optional and specifies the optional argument list for the
  15011. given @var{COMMAND}.
  15012. Upon reception, the message is processed and the corresponding command
  15013. is injected into the filtergraph. Depending on the result, the filter
  15014. will send a reply to the client, adopting the format:
  15015. @example
  15016. @var{ERROR_CODE} @var{ERROR_REASON}
  15017. @var{MESSAGE}
  15018. @end example
  15019. @var{MESSAGE} is optional.
  15020. @subsection Examples
  15021. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15022. be used to send commands processed by these filters.
  15023. Consider the following filtergraph generated by @command{ffplay}
  15024. @example
  15025. ffplay -dumpgraph 1 -f lavfi "
  15026. color=s=100x100:c=red [l];
  15027. color=s=100x100:c=blue [r];
  15028. nullsrc=s=200x100, zmq [bg];
  15029. [bg][l] overlay [bg+l];
  15030. [bg+l][r] overlay=x=100 "
  15031. @end example
  15032. To change the color of the left side of the video, the following
  15033. command can be used:
  15034. @example
  15035. echo Parsed_color_0 c yellow | tools/zmqsend
  15036. @end example
  15037. To change the right side:
  15038. @example
  15039. echo Parsed_color_1 c pink | tools/zmqsend
  15040. @end example
  15041. @c man end MULTIMEDIA FILTERS
  15042. @chapter Multimedia Sources
  15043. @c man begin MULTIMEDIA SOURCES
  15044. Below is a description of the currently available multimedia sources.
  15045. @section amovie
  15046. This is the same as @ref{movie} source, except it selects an audio
  15047. stream by default.
  15048. @anchor{movie}
  15049. @section movie
  15050. Read audio and/or video stream(s) from a movie container.
  15051. It accepts the following parameters:
  15052. @table @option
  15053. @item filename
  15054. The name of the resource to read (not necessarily a file; it can also be a
  15055. device or a stream accessed through some protocol).
  15056. @item format_name, f
  15057. Specifies the format assumed for the movie to read, and can be either
  15058. the name of a container or an input device. If not specified, the
  15059. format is guessed from @var{movie_name} or by probing.
  15060. @item seek_point, sp
  15061. Specifies the seek point in seconds. The frames will be output
  15062. starting from this seek point. The parameter is evaluated with
  15063. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15064. postfix. The default value is "0".
  15065. @item streams, s
  15066. Specifies the streams to read. Several streams can be specified,
  15067. separated by "+". The source will then have as many outputs, in the
  15068. same order. The syntax is explained in the ``Stream specifiers''
  15069. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  15070. respectively the default (best suited) video and audio stream. Default
  15071. is "dv", or "da" if the filter is called as "amovie".
  15072. @item stream_index, si
  15073. Specifies the index of the video stream to read. If the value is -1,
  15074. the most suitable video stream will be automatically selected. The default
  15075. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15076. audio instead of video.
  15077. @item loop
  15078. Specifies how many times to read the stream in sequence.
  15079. If the value is 0, the stream will be looped infinitely.
  15080. Default value is "1".
  15081. Note that when the movie is looped the source timestamps are not
  15082. changed, so it will generate non monotonically increasing timestamps.
  15083. @item discontinuity
  15084. Specifies the time difference between frames above which the point is
  15085. considered a timestamp discontinuity which is removed by adjusting the later
  15086. timestamps.
  15087. @end table
  15088. It allows overlaying a second video on top of the main input of
  15089. a filtergraph, as shown in this graph:
  15090. @example
  15091. input -----------> deltapts0 --> overlay --> output
  15092. ^
  15093. |
  15094. movie --> scale--> deltapts1 -------+
  15095. @end example
  15096. @subsection Examples
  15097. @itemize
  15098. @item
  15099. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15100. on top of the input labelled "in":
  15101. @example
  15102. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15103. [in] setpts=PTS-STARTPTS [main];
  15104. [main][over] overlay=16:16 [out]
  15105. @end example
  15106. @item
  15107. Read from a video4linux2 device, and overlay it on top of the input
  15108. labelled "in":
  15109. @example
  15110. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15111. [in] setpts=PTS-STARTPTS [main];
  15112. [main][over] overlay=16:16 [out]
  15113. @end example
  15114. @item
  15115. Read the first video stream and the audio stream with id 0x81 from
  15116. dvd.vob; the video is connected to the pad named "video" and the audio is
  15117. connected to the pad named "audio":
  15118. @example
  15119. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15120. @end example
  15121. @end itemize
  15122. @subsection Commands
  15123. Both movie and amovie support the following commands:
  15124. @table @option
  15125. @item seek
  15126. Perform seek using "av_seek_frame".
  15127. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15128. @itemize
  15129. @item
  15130. @var{stream_index}: If stream_index is -1, a default
  15131. stream is selected, and @var{timestamp} is automatically converted
  15132. from AV_TIME_BASE units to the stream specific time_base.
  15133. @item
  15134. @var{timestamp}: Timestamp in AVStream.time_base units
  15135. or, if no stream is specified, in AV_TIME_BASE units.
  15136. @item
  15137. @var{flags}: Flags which select direction and seeking mode.
  15138. @end itemize
  15139. @item get_duration
  15140. Get movie duration in AV_TIME_BASE units.
  15141. @end table
  15142. @c man end MULTIMEDIA SOURCES