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.

7111 lines
194KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, it is possible for filters to have multiple inputs and
  5. multiple outputs.
  6. To illustrate the sorts of things that are possible, we can
  7. use a complex filter graph. For example, the following one:
  8. @example
  9. input --> split ---------------------> overlay --> output
  10. | ^
  11. | |
  12. +-----> crop --> vflip -------+
  13. @end example
  14. splits the stream in two streams, sends one stream through the crop filter
  15. and the vflip filter before merging it back with the other stream by
  16. overlaying it on top. You can use the following command to achieve this:
  17. @example
  18. ffmpeg -i input -vf "[in] split [T1], [T2] overlay=0:H/2 [out]; [T1] crop=iw:ih/2:0:ih/2, vflip [T2]" output
  19. @end example
  20. The result will be that in output the top half of the video is mirrored
  21. onto the bottom half.
  22. Filters are loaded using the @var{-vf} or @var{-af} option passed to
  23. @command{ffmpeg} or to @command{ffplay}. Filters in the same linear
  24. chain are separated by commas. In our example, @var{split,
  25. overlay} are in one linear chain, and @var{crop, vflip} are in
  26. another. The points where the linear chains join are labeled by names
  27. enclosed in square brackets. In our example, that is @var{[T1]} and
  28. @var{[T2]}. The special labels @var{[in]} and @var{[out]} are the points
  29. where video is input and output.
  30. Some filters take in input a list of parameters: they are specified
  31. after the filter name and an equal sign, and are separated from each other
  32. by a colon.
  33. There exist so-called @var{source filters} that do not have an
  34. audio/video input, and @var{sink filters} that will not have audio/video
  35. output.
  36. @c man end FILTERING INTRODUCTION
  37. @chapter graph2dot
  38. @c man begin GRAPH2DOT
  39. The @file{graph2dot} program included in the FFmpeg @file{tools}
  40. directory can be used to parse a filter graph description and issue a
  41. corresponding textual representation in the dot language.
  42. Invoke the command:
  43. @example
  44. graph2dot -h
  45. @end example
  46. to see how to use @file{graph2dot}.
  47. You can then pass the dot description to the @file{dot} program (from
  48. the graphviz suite of programs) and obtain a graphical representation
  49. of the filter graph.
  50. For example the sequence of commands:
  51. @example
  52. echo @var{GRAPH_DESCRIPTION} | \
  53. tools/graph2dot -o graph.tmp && \
  54. dot -Tpng graph.tmp -o graph.png && \
  55. display graph.png
  56. @end example
  57. can be used to create and display an image representing the graph
  58. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  59. a complete self-contained graph, with its inputs and outputs explicitly defined.
  60. For example if your command line is of the form:
  61. @example
  62. ffmpeg -i infile -vf scale=640:360 outfile
  63. @end example
  64. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  65. @example
  66. nullsrc,scale=640:360,nullsink
  67. @end example
  68. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  69. filter in order to simulate a specific input file.
  70. @c man end GRAPH2DOT
  71. @chapter Filtergraph description
  72. @c man begin FILTERGRAPH DESCRIPTION
  73. A filtergraph is a directed graph of connected filters. It can contain
  74. cycles, and there can be multiple links between a pair of
  75. filters. Each link has one input pad on one side connecting it to one
  76. filter from which it takes its input, and one output pad on the other
  77. side connecting it to the one filter accepting its output.
  78. Each filter in a filtergraph is an instance of a filter class
  79. registered in the application, which defines the features and the
  80. number of input and output pads of the filter.
  81. A filter with no input pads is called a "source", a filter with no
  82. output pads is called a "sink".
  83. @anchor{Filtergraph syntax}
  84. @section Filtergraph syntax
  85. A filtergraph can be represented using a textual representation, which is
  86. recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
  87. options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
  88. @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} function defined in
  89. @file{libavfilter/avfiltergraph.h}.
  90. A filterchain consists of a sequence of connected filters, each one
  91. connected to the previous one in the sequence. A filterchain is
  92. represented by a list of ","-separated filter descriptions.
  93. A filtergraph consists of a sequence of filterchains. A sequence of
  94. filterchains is represented by a list of ";"-separated filterchain
  95. descriptions.
  96. A filter is represented by a string of the form:
  97. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  98. @var{filter_name} is the name of the filter class of which the
  99. described filter is an instance of, and has to be the name of one of
  100. the filter classes registered in the program.
  101. The name of the filter class is optionally followed by a string
  102. "=@var{arguments}".
  103. @var{arguments} is a string which contains the parameters used to
  104. initialize the filter instance, and are described in the filter
  105. descriptions below.
  106. The list of arguments can be quoted using the character "'" as initial
  107. and ending mark, and the character '\' for escaping the characters
  108. within the quoted text; otherwise the argument string is considered
  109. terminated when the next special character (belonging to the set
  110. "[]=;,") is encountered.
  111. The name and arguments of the filter are optionally preceded and
  112. followed by a list of link labels.
  113. A link label allows to name a link and associate it to a filter output
  114. or input pad. The preceding labels @var{in_link_1}
  115. ... @var{in_link_N}, are associated to the filter input pads,
  116. the following labels @var{out_link_1} ... @var{out_link_M}, are
  117. associated to the output pads.
  118. When two link labels with the same name are found in the
  119. filtergraph, a link between the corresponding input and output pad is
  120. created.
  121. If an output pad is not labelled, it is linked by default to the first
  122. unlabelled input pad of the next filter in the filterchain.
  123. For example in the filterchain:
  124. @example
  125. nullsrc, split[L1], [L2]overlay, nullsink
  126. @end example
  127. the split filter instance has two output pads, and the overlay filter
  128. instance two input pads. The first output pad of split is labelled
  129. "L1", the first input pad of overlay is labelled "L2", and the second
  130. output pad of split is linked to the second input pad of overlay,
  131. which are both unlabelled.
  132. In a complete filterchain all the unlabelled filter input and output
  133. pads must be connected. A filtergraph is considered valid if all the
  134. filter input and output pads of all the filterchains are connected.
  135. Libavfilter will automatically insert scale filters where format
  136. conversion is required. It is possible to specify swscale flags
  137. for those automatically inserted scalers by prepending
  138. @code{sws_flags=@var{flags};}
  139. to the filtergraph description.
  140. Follows a BNF description for the filtergraph syntax:
  141. @example
  142. @var{NAME} ::= sequence of alphanumeric characters and '_'
  143. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  144. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  145. @var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
  146. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  147. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  148. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  149. @end example
  150. @section Notes on filtergraph escaping
  151. Some filter arguments require the use of special characters, typically
  152. @code{:} to separate key=value pairs in a named options list. In this
  153. case the user should perform a first level escaping when specifying
  154. the filter arguments. For example, consider the following literal
  155. string to be embedded in the @ref{drawtext} filter arguments:
  156. @example
  157. this is a 'string': may contain one, or more, special characters
  158. @end example
  159. Since @code{:} is special for the filter arguments syntax, it needs to
  160. be escaped, so you get:
  161. @example
  162. text=this is a \'string\'\: may contain one, or more, special characters
  163. @end example
  164. A second level of escaping is required when embedding the filter
  165. arguments in a filtergraph description, in order to escape all the
  166. filtergraph special characters. Thus the example above becomes:
  167. @example
  168. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  169. @end example
  170. Finally an additional level of escaping may be needed when writing the
  171. filtergraph description in a shell command, which depends on the
  172. escaping rules of the adopted shell. For example, assuming that
  173. @code{\} is special and needs to be escaped with another @code{\}, the
  174. previous string will finally result in:
  175. @example
  176. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  177. @end example
  178. Sometimes, it might be more convenient to employ quoting in place of
  179. escaping. For example the string:
  180. @example
  181. Caesar: tu quoque, Brute, fili mi
  182. @end example
  183. Can be quoted in the filter arguments as:
  184. @example
  185. text='Caesar: tu quoque, Brute, fili mi'
  186. @end example
  187. And finally inserted in a filtergraph like:
  188. @example
  189. drawtext=text=\'Caesar: tu quoque\, Brute\, fili mi\'
  190. @end example
  191. See the ``Quoting and escaping'' section in the ffmpeg-utils manual
  192. for more information about the escaping and quoting rules adopted by
  193. FFmpeg.
  194. @c man end FILTERGRAPH DESCRIPTION
  195. @chapter Audio Filters
  196. @c man begin AUDIO FILTERS
  197. When you configure your FFmpeg build, you can disable any of the
  198. existing filters using @code{--disable-filters}.
  199. The configure output will show the audio filters included in your
  200. build.
  201. Below is a description of the currently available audio filters.
  202. @section aconvert
  203. Convert the input audio format to the specified formats.
  204. The filter accepts a string of the form:
  205. "@var{sample_format}:@var{channel_layout}".
  206. @var{sample_format} specifies the sample format, and can be a string or the
  207. corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p'
  208. suffix for a planar sample format.
  209. @var{channel_layout} specifies the channel layout, and can be a string
  210. or the corresponding number value defined in @file{libavutil/channel_layout.h}.
  211. The special parameter "auto", signifies that the filter will
  212. automatically select the output format depending on the output filter.
  213. @subsection Examples
  214. @itemize
  215. @item
  216. Convert input to float, planar, stereo:
  217. @example
  218. aconvert=fltp:stereo
  219. @end example
  220. @item
  221. Convert input to unsigned 8-bit, automatically select out channel layout:
  222. @example
  223. aconvert=u8:auto
  224. @end example
  225. @end itemize
  226. @section allpass
  227. Apply a two-pole all-pass filter with central frequency (in Hz)
  228. @var{frequency}, and filter-width @var{width}.
  229. An all-pass filter changes the audio's frequency to phase relationship
  230. without changing its frequency to amplitude relationship.
  231. The filter accepts parameters as a list of @var{key}=@var{value}
  232. pairs, separated by ":".
  233. A description of the accepted parameters follows.
  234. @table @option
  235. @item frequency, f
  236. Set frequency in Hz.
  237. @item width_type
  238. Set method to specify band-width of filter.
  239. @table @option
  240. @item h
  241. Hz
  242. @item q
  243. Q-Factor
  244. @item o
  245. octave
  246. @item s
  247. slope
  248. @end table
  249. @item width, w
  250. Specify the band-width of a filter in width_type units.
  251. @end table
  252. @section highpass
  253. Apply a high-pass filter with 3dB point frequency.
  254. The filter can be either single-pole, or double-pole (the default).
  255. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  256. The filter accepts parameters as a list of @var{key}=@var{value}
  257. pairs, separated by ":".
  258. A description of the accepted parameters follows.
  259. @table @option
  260. @item frequency, f
  261. Set frequency in Hz. Default is 3000.
  262. @item poles, p
  263. Set number of poles. Default is 2.
  264. @item width_type
  265. Set method to specify band-width of filter.
  266. @table @option
  267. @item h
  268. Hz
  269. @item q
  270. Q-Factor
  271. @item o
  272. octave
  273. @item s
  274. slope
  275. @end table
  276. @item width, w
  277. Specify the band-width of a filter in width_type units.
  278. Applies only to double-pole filter.
  279. The default is 0.707q and gives a Butterworth response.
  280. @end table
  281. @section lowpass
  282. Apply a low-pass filter with 3dB point frequency.
  283. The filter can be either single-pole or double-pole (the default).
  284. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  285. The filter accepts parameters as a list of @var{key}=@var{value}
  286. pairs, separated by ":".
  287. A description of the accepted parameters follows.
  288. @table @option
  289. @item frequency, f
  290. Set frequency in Hz. Default is 500.
  291. @item poles, p
  292. Set number of poles. Default is 2.
  293. @item width_type
  294. Set method to specify band-width of filter.
  295. @table @option
  296. @item h
  297. Hz
  298. @item q
  299. Q-Factor
  300. @item o
  301. octave
  302. @item s
  303. slope
  304. @end table
  305. @item width, w
  306. Specify the band-width of a filter in width_type units.
  307. Applies only to double-pole filter.
  308. The default is 0.707q and gives a Butterworth response.
  309. @end table
  310. @section bass
  311. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  312. shelving filter with a response similar to that of a standard
  313. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  314. The filter accepts parameters as a list of @var{key}=@var{value}
  315. pairs, separated by ":".
  316. A description of the accepted parameters follows.
  317. @table @option
  318. @item gain, g
  319. Give the gain at 0 Hz. Its useful range is about -20
  320. (for a large cut) to +20 (for a large boost).
  321. Beware of clipping when using a positive gain.
  322. @item frequency, f
  323. Set the filter's central frequency and so can be used
  324. to extend or reduce the frequency range to be boosted or cut.
  325. The default value is @code{100} Hz.
  326. @item width_type
  327. Set method to specify band-width of filter.
  328. @table @option
  329. @item h
  330. Hz
  331. @item q
  332. Q-Factor
  333. @item o
  334. octave
  335. @item s
  336. slope
  337. @end table
  338. @item width, w
  339. Determine how steep is the filter's shelf transition.
  340. @end table
  341. @section treble
  342. Boost or cut treble (upper) frequencies of the audio using a two-pole
  343. shelving filter with a response similar to that of a standard
  344. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  345. The filter accepts parameters as a list of @var{key}=@var{value}
  346. pairs, separated by ":".
  347. A description of the accepted parameters follows.
  348. @table @option
  349. @item gain, g
  350. Give the gain at whichever is the lower of ~22 kHz and the
  351. Nyquist frequency. Its useful range is about -20 (for a large cut)
  352. to +20 (for a large boost). Beware of clipping when using a positive gain.
  353. @item frequency, f
  354. Set the filter's central frequency and so can be used
  355. to extend or reduce the frequency range to be boosted or cut.
  356. The default value is @code{3000} Hz.
  357. @item width_type
  358. Set method to specify band-width of filter.
  359. @table @option
  360. @item h
  361. Hz
  362. @item q
  363. Q-Factor
  364. @item o
  365. octave
  366. @item s
  367. slope
  368. @end table
  369. @item width, w
  370. Determine how steep is the filter's shelf transition.
  371. @end table
  372. @section bandpass
  373. Apply a two-pole Butterworth band-pass filter with central
  374. frequency @var{frequency}, and (3dB-point) band-width width.
  375. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  376. instead of the default: constant 0dB peak gain.
  377. The filter roll off at 6dB per octave (20dB per decade).
  378. The filter accepts parameters as a list of @var{key}=@var{value}
  379. pairs, separated by ":".
  380. A description of the accepted parameters follows.
  381. @table @option
  382. @item frequency, f
  383. Set the filter's central frequency. Default is @code{3000}.
  384. @item csg
  385. Constant skirt gain if set to 1. Defaults to 0.
  386. @item width_type
  387. Set method to specify band-width of filter.
  388. @table @option
  389. @item h
  390. Hz
  391. @item q
  392. Q-Factor
  393. @item o
  394. octave
  395. @item s
  396. slope
  397. @end table
  398. @item width, w
  399. Specify the band-width of a filter in width_type units.
  400. @end table
  401. @section bandreject
  402. Apply a two-pole Butterworth band-reject filter with central
  403. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  404. The filter roll off at 6dB per octave (20dB per decade).
  405. The filter accepts parameters as a list of @var{key}=@var{value}
  406. pairs, separated by ":".
  407. A description of the accepted parameters follows.
  408. @table @option
  409. @item frequency, f
  410. Set the filter's central frequency. Default is @code{3000}.
  411. @item width_type
  412. Set method to specify band-width of filter.
  413. @table @option
  414. @item h
  415. Hz
  416. @item q
  417. Q-Factor
  418. @item o
  419. octave
  420. @item s
  421. slope
  422. @end table
  423. @item width, w
  424. Specify the band-width of a filter in width_type units.
  425. @end table
  426. @section biquad
  427. Apply a biquad IIR filter with the given coefficients.
  428. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  429. are the numerator and denominator coefficients respectively.
  430. @section equalizer
  431. Apply a two-pole peaking equalisation (EQ) filter. With this
  432. filter, the signal-level at and around a selected frequency can
  433. be increased or decreased, whilst (unlike bandpass and bandreject
  434. filters) that at all other frequencies is unchanged.
  435. In order to produce complex equalisation curves, this filter can
  436. be given several times, each with a different central frequency.
  437. The filter accepts parameters as a list of @var{key}=@var{value}
  438. pairs, separated by ":".
  439. A description of the accepted parameters follows.
  440. @table @option
  441. @item frequency, f
  442. Set the filter's central frequency in Hz.
  443. @item width_type
  444. Set method to specify band-width of filter.
  445. @table @option
  446. @item h
  447. Hz
  448. @item q
  449. Q-Factor
  450. @item o
  451. octave
  452. @item s
  453. slope
  454. @end table
  455. @item width, w
  456. Specify the band-width of a filter in width_type units.
  457. @item gain, g
  458. Set the required gain or attenuation in dB.
  459. Beware of clipping when using a positive gain.
  460. @end table
  461. @section afade
  462. Apply fade-in/out effect to input audio.
  463. The filter accepts parameters as a list of @var{key}=@var{value}
  464. pairs, separated by ":".
  465. A description of the accepted parameters follows.
  466. @table @option
  467. @item type, t
  468. Specify the effect type, can be either @code{in} for fade-in, or
  469. @code{out} for a fade-out effect. Default is @code{in}.
  470. @item start_sample, ss
  471. Specify the number of the start sample for starting to apply the fade
  472. effect. Default is 0.
  473. @item nb_samples, ns
  474. Specify the number of samples for which the fade effect has to last. At
  475. the end of the fade-in effect the output audio will have the same
  476. volume as the input audio, at the end of the fade-out transition
  477. the output audio will be silence. Default is 44100.
  478. @item start_time, st
  479. Specify time in seconds for starting to apply the fade
  480. effect. Default is 0.
  481. If set this option is used instead of @var{start_sample} one.
  482. @item duration, d
  483. Specify the number of seconds for which the fade effect has to last. At
  484. the end of the fade-in effect the output audio will have the same
  485. volume as the input audio, at the end of the fade-out transition
  486. the output audio will be silence. Default is 0.
  487. If set this option is used instead of @var{nb_samples} one.
  488. @item curve
  489. Set curve for fade transition.
  490. It accepts the following values:
  491. @table @option
  492. @item tri
  493. select triangular, linear slope (default)
  494. @item qsin
  495. select quarter of sine wave
  496. @item hsin
  497. select half of sine wave
  498. @item esin
  499. select exponential sine wave
  500. @item log
  501. select logarithmic
  502. @item par
  503. select inverted parabola
  504. @item qua
  505. select quadratic
  506. @item cub
  507. select cubic
  508. @item squ
  509. select square root
  510. @item cbr
  511. select cubic root
  512. @end table
  513. @end table
  514. @subsection Examples
  515. @itemize
  516. @item
  517. Fade in first 15 seconds of audio:
  518. @example
  519. afade=t=in:ss=0:d=15
  520. @end example
  521. @item
  522. Fade out last 25 seconds of a 900 seconds audio:
  523. @example
  524. afade=t=out:ss=875:d=25
  525. @end example
  526. @end itemize
  527. @anchor{aformat}
  528. @section aformat
  529. Set output format constraints for the input audio. The framework will
  530. negotiate the most appropriate format to minimize conversions.
  531. The filter accepts the following named parameters:
  532. @table @option
  533. @item sample_fmts
  534. A comma-separated list of requested sample formats.
  535. @item sample_rates
  536. A comma-separated list of requested sample rates.
  537. @item channel_layouts
  538. A comma-separated list of requested channel layouts.
  539. @end table
  540. If a parameter is omitted, all values are allowed.
  541. For example to force the output to either unsigned 8-bit or signed 16-bit stereo:
  542. @example
  543. aformat='sample_fmts=u8,s16:channel_layouts=stereo'
  544. @end example
  545. @section amerge
  546. Merge two or more audio streams into a single multi-channel stream.
  547. The filter accepts the following named options:
  548. @table @option
  549. @item inputs
  550. Set the number of inputs. Default is 2.
  551. @end table
  552. If the channel layouts of the inputs are disjoint, and therefore compatible,
  553. the channel layout of the output will be set accordingly and the channels
  554. will be reordered as necessary. If the channel layouts of the inputs are not
  555. disjoint, the output will have all the channels of the first input then all
  556. the channels of the second input, in that order, and the channel layout of
  557. the output will be the default value corresponding to the total number of
  558. channels.
  559. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  560. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  561. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  562. first input, b1 is the first channel of the second input).
  563. On the other hand, if both input are in stereo, the output channels will be
  564. in the default order: a1, a2, b1, b2, and the channel layout will be
  565. arbitrarily set to 4.0, which may or may not be the expected value.
  566. All inputs must have the same sample rate, and format.
  567. If inputs do not have the same duration, the output will stop with the
  568. shortest.
  569. @subsection Examples
  570. @itemize
  571. @item
  572. Merge two mono files into a stereo stream:
  573. @example
  574. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  575. @end example
  576. @item
  577. Multiple merges:
  578. @example
  579. ffmpeg -f lavfi -i "
  580. amovie=input.mkv:si=0 [a0];
  581. amovie=input.mkv:si=1 [a1];
  582. amovie=input.mkv:si=2 [a2];
  583. amovie=input.mkv:si=3 [a3];
  584. amovie=input.mkv:si=4 [a4];
  585. amovie=input.mkv:si=5 [a5];
  586. [a0][a1][a2][a3][a4][a5] amerge=inputs=6" -c:a pcm_s16le output.mkv
  587. @end example
  588. @end itemize
  589. @section amix
  590. Mixes multiple audio inputs into a single output.
  591. For example
  592. @example
  593. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  594. @end example
  595. will mix 3 input audio streams to a single output with the same duration as the
  596. first input and a dropout transition time of 3 seconds.
  597. The filter accepts the following named parameters:
  598. @table @option
  599. @item inputs
  600. Number of inputs. If unspecified, it defaults to 2.
  601. @item duration
  602. How to determine the end-of-stream.
  603. @table @option
  604. @item longest
  605. Duration of longest input. (default)
  606. @item shortest
  607. Duration of shortest input.
  608. @item first
  609. Duration of first input.
  610. @end table
  611. @item dropout_transition
  612. Transition time, in seconds, for volume renormalization when an input
  613. stream ends. The default value is 2 seconds.
  614. @end table
  615. @section anull
  616. Pass the audio source unchanged to the output.
  617. @section apad
  618. Pad the end of a audio stream with silence, this can be used together with
  619. -shortest to extend audio streams to the same length as the video stream.
  620. @anchor{aresample}
  621. @section aresample
  622. Resample the input audio to the specified parameters, using the
  623. libswresample library. If none are specified then the filter will
  624. automatically convert between its input and output.
  625. This filter is also able to stretch/squeeze the audio data to make it match
  626. the timestamps or to inject silence / cut out audio to make it match the
  627. timestamps, do a combination of both or do neither.
  628. The filter accepts the syntax
  629. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  630. expresses a sample rate and @var{resampler_options} is a list of
  631. @var{key}=@var{value} pairs, separated by ":". See the
  632. ffmpeg-resampler manual for the complete list of supported options.
  633. @subsection Examples
  634. @itemize
  635. @item
  636. Resample the input audio to 44100Hz:
  637. @example
  638. aresample=44100
  639. @end example
  640. @item
  641. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  642. samples per second compensation:
  643. @example
  644. aresample=async=1000
  645. @end example
  646. @end itemize
  647. @section asetnsamples
  648. Set the number of samples per each output audio frame.
  649. The last output packet may contain a different number of samples, as
  650. the filter will flush all the remaining samples when the input audio
  651. signal its end.
  652. The filter accepts parameters as a list of @var{key}=@var{value} pairs,
  653. separated by ":".
  654. @table @option
  655. @item nb_out_samples, n
  656. Set the number of frames per each output audio frame. The number is
  657. intended as the number of samples @emph{per each channel}.
  658. Default value is 1024.
  659. @item pad, p
  660. If set to 1, the filter will pad the last audio frame with zeroes, so
  661. that the last frame will contain the same number of samples as the
  662. previous ones. Default value is 1.
  663. @end table
  664. For example, to set the number of per-frame samples to 1234 and
  665. disable padding for the last frame, use:
  666. @example
  667. asetnsamples=n=1234:p=0
  668. @end example
  669. @section ashowinfo
  670. Show a line containing various information for each input audio frame.
  671. The input audio is not modified.
  672. The shown line contains a sequence of key/value pairs of the form
  673. @var{key}:@var{value}.
  674. A description of each shown parameter follows:
  675. @table @option
  676. @item n
  677. sequential number of the input frame, starting from 0
  678. @item pts
  679. Presentation timestamp of the input frame, in time base units; the time base
  680. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  681. @item pts_time
  682. presentation timestamp of the input frame in seconds
  683. @item pos
  684. position of the frame in the input stream, -1 if this information in
  685. unavailable and/or meaningless (for example in case of synthetic audio)
  686. @item fmt
  687. sample format
  688. @item chlayout
  689. channel layout
  690. @item rate
  691. sample rate for the audio frame
  692. @item nb_samples
  693. number of samples (per channel) in the frame
  694. @item checksum
  695. Adler-32 checksum (printed in hexadecimal) of the audio data. For planar audio
  696. the data is treated as if all the planes were concatenated.
  697. @item plane_checksums
  698. A list of Adler-32 checksums for each data plane.
  699. @end table
  700. @section asplit
  701. Split input audio into several identical outputs.
  702. The filter accepts a single parameter which specifies the number of outputs. If
  703. unspecified, it defaults to 2.
  704. For example:
  705. @example
  706. [in] asplit [out0][out1]
  707. @end example
  708. will create two separate outputs from the same input.
  709. To create 3 or more outputs, you need to specify the number of
  710. outputs, like in:
  711. @example
  712. [in] asplit=3 [out0][out1][out2]
  713. @end example
  714. @example
  715. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  716. @end example
  717. will create 5 copies of the input audio.
  718. @section astreamsync
  719. Forward two audio streams and control the order the buffers are forwarded.
  720. The argument to the filter is an expression deciding which stream should be
  721. forwarded next: if the result is negative, the first stream is forwarded; if
  722. the result is positive or zero, the second stream is forwarded. It can use
  723. the following variables:
  724. @table @var
  725. @item b1 b2
  726. number of buffers forwarded so far on each stream
  727. @item s1 s2
  728. number of samples forwarded so far on each stream
  729. @item t1 t2
  730. current timestamp of each stream
  731. @end table
  732. The default value is @code{t1-t2}, which means to always forward the stream
  733. that has a smaller timestamp.
  734. Example: stress-test @code{amerge} by randomly sending buffers on the wrong
  735. input, while avoiding too much of a desynchronization:
  736. @example
  737. amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
  738. [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
  739. [a2] [b2] amerge
  740. @end example
  741. @section atempo
  742. Adjust audio tempo.
  743. The filter accepts exactly one parameter, the audio tempo. If not
  744. specified then the filter will assume nominal 1.0 tempo. Tempo must
  745. be in the [0.5, 2.0] range.
  746. @subsection Examples
  747. @itemize
  748. @item
  749. Slow down audio to 80% tempo:
  750. @example
  751. atempo=0.8
  752. @end example
  753. @item
  754. To speed up audio to 125% tempo:
  755. @example
  756. atempo=1.25
  757. @end example
  758. @end itemize
  759. @section earwax
  760. Make audio easier to listen to on headphones.
  761. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  762. so that when listened to on headphones the stereo image is moved from
  763. inside your head (standard for headphones) to outside and in front of
  764. the listener (standard for speakers).
  765. Ported from SoX.
  766. @section pan
  767. Mix channels with specific gain levels. The filter accepts the output
  768. channel layout followed by a set of channels definitions.
  769. This filter is also designed to remap efficiently the channels of an audio
  770. stream.
  771. The filter accepts parameters of the form:
  772. "@var{l}:@var{outdef}:@var{outdef}:..."
  773. @table @option
  774. @item l
  775. output channel layout or number of channels
  776. @item outdef
  777. output channel specification, of the form:
  778. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  779. @item out_name
  780. output channel to define, either a channel name (FL, FR, etc.) or a channel
  781. number (c0, c1, etc.)
  782. @item gain
  783. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  784. @item in_name
  785. input channel to use, see out_name for details; it is not possible to mix
  786. named and numbered input channels
  787. @end table
  788. If the `=' in a channel specification is replaced by `<', then the gains for
  789. that specification will be renormalized so that the total is 1, thus
  790. avoiding clipping noise.
  791. @subsection Mixing examples
  792. For example, if you want to down-mix from stereo to mono, but with a bigger
  793. factor for the left channel:
  794. @example
  795. pan=1:c0=0.9*c0+0.1*c1
  796. @end example
  797. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  798. 7-channels surround:
  799. @example
  800. pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  801. @end example
  802. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  803. that should be preferred (see "-ac" option) unless you have very specific
  804. needs.
  805. @subsection Remapping examples
  806. The channel remapping will be effective if, and only if:
  807. @itemize
  808. @item gain coefficients are zeroes or ones,
  809. @item only one input per channel output,
  810. @end itemize
  811. If all these conditions are satisfied, the filter will notify the user ("Pure
  812. channel mapping detected"), and use an optimized and lossless method to do the
  813. remapping.
  814. For example, if you have a 5.1 source and want a stereo audio stream by
  815. dropping the extra channels:
  816. @example
  817. pan="stereo: c0=FL : c1=FR"
  818. @end example
  819. Given the same source, you can also switch front left and front right channels
  820. and keep the input channel layout:
  821. @example
  822. pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
  823. @end example
  824. If the input is a stereo audio stream, you can mute the front left channel (and
  825. still keep the stereo channel layout) with:
  826. @example
  827. pan="stereo:c1=c1"
  828. @end example
  829. Still with a stereo audio stream input, you can copy the right channel in both
  830. front left and right:
  831. @example
  832. pan="stereo: c0=FR : c1=FR"
  833. @end example
  834. @section silencedetect
  835. Detect silence in an audio stream.
  836. This filter logs a message when it detects that the input audio volume is less
  837. or equal to a noise tolerance value for a duration greater or equal to the
  838. minimum detected noise duration.
  839. The printed times and duration are expressed in seconds.
  840. @table @option
  841. @item duration, d
  842. Set silence duration until notification (default is 2 seconds).
  843. @item noise, n
  844. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  845. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  846. @end table
  847. @subsection Examples
  848. @itemize
  849. @item
  850. Detect 5 seconds of silence with -50dB noise tolerance:
  851. @example
  852. silencedetect=n=-50dB:d=5
  853. @end example
  854. @item
  855. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  856. tolerance in @file{silence.mp3}:
  857. @example
  858. ffmpeg -f lavfi -i amovie=silence.mp3,silencedetect=noise=0.0001 -f null -
  859. @end example
  860. @end itemize
  861. @section asyncts
  862. Synchronize audio data with timestamps by squeezing/stretching it and/or
  863. dropping samples/adding silence when needed.
  864. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  865. The filter accepts the following named parameters:
  866. @table @option
  867. @item compensate
  868. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  869. by default. When disabled, time gaps are covered with silence.
  870. @item min_delta
  871. Minimum difference between timestamps and audio data (in seconds) to trigger
  872. adding/dropping samples. Default value is 0.1. If you get non-perfect sync with
  873. this filter, try setting this parameter to 0.
  874. @item max_comp
  875. Maximum compensation in samples per second. Relevant only with compensate=1.
  876. Default value 500.
  877. @item first_pts
  878. Assume the first pts should be this value. The time base is 1 / sample rate.
  879. This allows for padding/trimming at the start of stream. By default, no
  880. assumption is made about the first frame's expected pts, so no padding or
  881. trimming is done. For example, this could be set to 0 to pad the beginning with
  882. silence if an audio stream starts after the video stream or to trim any samples
  883. with a negative pts due to encoder delay.
  884. @end table
  885. @section channelsplit
  886. Split each channel in input audio stream into a separate output stream.
  887. This filter accepts the following named parameters:
  888. @table @option
  889. @item channel_layout
  890. Channel layout of the input stream. Default is "stereo".
  891. @end table
  892. For example, assuming a stereo input MP3 file
  893. @example
  894. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  895. @end example
  896. will create an output Matroska file with two audio streams, one containing only
  897. the left channel and the other the right channel.
  898. To split a 5.1 WAV file into per-channel files
  899. @example
  900. ffmpeg -i in.wav -filter_complex
  901. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  902. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  903. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  904. side_right.wav
  905. @end example
  906. @section channelmap
  907. Remap input channels to new locations.
  908. This filter accepts the following named parameters:
  909. @table @option
  910. @item channel_layout
  911. Channel layout of the output stream.
  912. @item map
  913. Map channels from input to output. The argument is a comma-separated list of
  914. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  915. @var{in_channel} form. @var{in_channel} can be either the name of the input
  916. channel (e.g. FL for front left) or its index in the input channel layout.
  917. @var{out_channel} is the name of the output channel or its index in the output
  918. channel layout. If @var{out_channel} is not given then it is implicitly an
  919. index, starting with zero and increasing by one for each mapping.
  920. @end table
  921. If no mapping is present, the filter will implicitly map input channels to
  922. output channels preserving index.
  923. For example, assuming a 5.1+downmix input MOV file
  924. @example
  925. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL\,DR-FR' out.wav
  926. @end example
  927. will create an output WAV file tagged as stereo from the downmix channels of
  928. the input.
  929. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  930. @example
  931. ffmpeg -i in.wav -filter 'channelmap=1\,2\,0\,5\,3\,4:channel_layout=5.1' out.wav
  932. @end example
  933. @section join
  934. Join multiple input streams into one multi-channel stream.
  935. The filter accepts the following named parameters:
  936. @table @option
  937. @item inputs
  938. Number of input streams. Defaults to 2.
  939. @item channel_layout
  940. Desired output channel layout. Defaults to stereo.
  941. @item map
  942. Map channels from inputs to output. The argument is a comma-separated list of
  943. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  944. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  945. can be either the name of the input channel (e.g. FL for front left) or its
  946. index in the specified input stream. @var{out_channel} is the name of the output
  947. channel.
  948. @end table
  949. The filter will attempt to guess the mappings when those are not specified
  950. explicitly. It does so by first trying to find an unused matching input channel
  951. and if that fails it picks the first unused input channel.
  952. E.g. to join 3 inputs (with properly set channel layouts)
  953. @example
  954. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  955. @end example
  956. To build a 5.1 output from 6 single-channel streams:
  957. @example
  958. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  959. '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'
  960. out
  961. @end example
  962. @section resample
  963. Convert the audio sample format, sample rate and channel layout. This filter is
  964. not meant to be used directly.
  965. @section volume
  966. Adjust the input audio volume.
  967. The filter accepts the following named parameters. If the key of the
  968. first options is omitted, the arguments are interpreted according to
  969. the following syntax:
  970. @example
  971. volume=@var{volume}:@var{precision}
  972. @end example
  973. @table @option
  974. @item volume
  975. Expresses how the audio volume will be increased or decreased.
  976. Output values are clipped to the maximum value.
  977. The output audio volume is given by the relation:
  978. @example
  979. @var{output_volume} = @var{volume} * @var{input_volume}
  980. @end example
  981. Default value for @var{volume} is 1.0.
  982. @item precision
  983. Set the mathematical precision.
  984. This determines which input sample formats will be allowed, which affects the
  985. precision of the volume scaling.
  986. @table @option
  987. @item fixed
  988. 8-bit fixed-point; limits input sample format to U8, S16, and S32.
  989. @item float
  990. 32-bit floating-point; limits input sample format to FLT. (default)
  991. @item double
  992. 64-bit floating-point; limits input sample format to DBL.
  993. @end table
  994. @end table
  995. @subsection Examples
  996. @itemize
  997. @item
  998. Halve the input audio volume:
  999. @example
  1000. volume=volume=0.5
  1001. volume=volume=1/2
  1002. volume=volume=-6.0206dB
  1003. @end example
  1004. In all the above example the named key for @option{volume} can be
  1005. omitted, for example like in:
  1006. @example
  1007. volume=0.5
  1008. @end example
  1009. @item
  1010. Increase input audio power by 6 decibels using fixed-point precision:
  1011. @example
  1012. volume=volume=6dB:precision=fixed
  1013. @end example
  1014. @end itemize
  1015. @section volumedetect
  1016. Detect the volume of the input video.
  1017. The filter has no parameters. The input is not modified. Statistics about
  1018. the volume will be printed in the log when the input stream end is reached.
  1019. In particular it will show the mean volume (root mean square), maximum
  1020. volume (on a per-sample basis), and the beginning of an histogram of the
  1021. registered volume values (from the maximum value to a cumulated 1/1000 of
  1022. the samples).
  1023. All volumes are in decibels relative to the maximum PCM value.
  1024. @subsection Examples
  1025. Here is an excerpt of the output:
  1026. @example
  1027. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  1028. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  1029. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  1030. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  1031. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  1032. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  1033. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  1034. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  1035. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  1036. @end example
  1037. It means that:
  1038. @itemize
  1039. @item
  1040. The mean square energy is approximately -27 dB, or 10^-2.7.
  1041. @item
  1042. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  1043. @item
  1044. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  1045. @end itemize
  1046. In other words, raising the volume by +4 dB does not cause any clipping,
  1047. raising it by +5 dB causes clipping for 6 samples, etc.
  1048. @c man end AUDIO FILTERS
  1049. @chapter Audio Sources
  1050. @c man begin AUDIO SOURCES
  1051. Below is a description of the currently available audio sources.
  1052. @section abuffer
  1053. Buffer audio frames, and make them available to the filter chain.
  1054. This source is mainly intended for a programmatic use, in particular
  1055. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  1056. It accepts the following mandatory parameters:
  1057. @var{sample_rate}:@var{sample_fmt}:@var{channel_layout}
  1058. @table @option
  1059. @item sample_rate
  1060. The sample rate of the incoming audio buffers.
  1061. @item sample_fmt
  1062. The sample format of the incoming audio buffers.
  1063. Either a sample format name or its corresponging integer representation from
  1064. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  1065. @item channel_layout
  1066. The channel layout of the incoming audio buffers.
  1067. Either a channel layout name from channel_layout_map in
  1068. @file{libavutil/channel_layout.c} or its corresponding integer representation
  1069. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  1070. @item channels
  1071. The number of channels of the incoming audio buffers.
  1072. If both @var{channels} and @var{channel_layout} are specified, then they
  1073. must be consistent.
  1074. @end table
  1075. @subsection Examples
  1076. @example
  1077. abuffer=44100:s16p:stereo
  1078. @end example
  1079. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  1080. Since the sample format with name "s16p" corresponds to the number
  1081. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  1082. equivalent to:
  1083. @example
  1084. abuffer=44100:6:0x3
  1085. @end example
  1086. @section aevalsrc
  1087. Generate an audio signal specified by an expression.
  1088. This source accepts in input one or more expressions (one for each
  1089. channel), which are evaluated and used to generate a corresponding
  1090. audio signal.
  1091. It accepts the syntax: @var{exprs}[::@var{options}].
  1092. @var{exprs} is a list of expressions separated by ":", one for each
  1093. separate channel. In case the @var{channel_layout} is not
  1094. specified, the selected channel layout depends on the number of
  1095. provided expressions.
  1096. @var{options} is an optional sequence of @var{key}=@var{value} pairs,
  1097. separated by ":".
  1098. The description of the accepted options follows.
  1099. @table @option
  1100. @item channel_layout, c
  1101. Set the channel layout. The number of channels in the specified layout
  1102. must be equal to the number of specified expressions.
  1103. @item duration, d
  1104. Set the minimum duration of the sourced audio. See the function
  1105. @code{av_parse_time()} for the accepted format.
  1106. Note that the resulting duration may be greater than the specified
  1107. duration, as the generated audio is always cut at the end of a
  1108. complete frame.
  1109. If not specified, or the expressed duration is negative, the audio is
  1110. supposed to be generated forever.
  1111. @item nb_samples, n
  1112. Set the number of samples per channel per each output frame,
  1113. default to 1024.
  1114. @item sample_rate, s
  1115. Specify the sample rate, default to 44100.
  1116. @end table
  1117. Each expression in @var{exprs} can contain the following constants:
  1118. @table @option
  1119. @item n
  1120. number of the evaluated sample, starting from 0
  1121. @item t
  1122. time of the evaluated sample expressed in seconds, starting from 0
  1123. @item s
  1124. sample rate
  1125. @end table
  1126. @subsection Examples
  1127. @itemize
  1128. @item
  1129. Generate silence:
  1130. @example
  1131. aevalsrc=0
  1132. @end example
  1133. @item
  1134. Generate a sin signal with frequency of 440 Hz, set sample rate to
  1135. 8000 Hz:
  1136. @example
  1137. aevalsrc="sin(440*2*PI*t)::s=8000"
  1138. @end example
  1139. @item
  1140. Generate a two channels signal, specify the channel layout (Front
  1141. Center + Back Center) explicitly:
  1142. @example
  1143. aevalsrc="sin(420*2*PI*t):cos(430*2*PI*t)::c=FC|BC"
  1144. @end example
  1145. @item
  1146. Generate white noise:
  1147. @example
  1148. aevalsrc="-2+random(0)"
  1149. @end example
  1150. @item
  1151. Generate an amplitude modulated signal:
  1152. @example
  1153. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  1154. @end example
  1155. @item
  1156. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  1157. @example
  1158. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) : 0.1*sin(2*PI*(360+2.5/2)*t)"
  1159. @end example
  1160. @end itemize
  1161. @section anullsrc
  1162. Null audio source, return unprocessed audio frames. It is mainly useful
  1163. as a template and to be employed in analysis / debugging tools, or as
  1164. the source for filters which ignore the input data (for example the sox
  1165. synth filter).
  1166. It accepts an optional sequence of @var{key}=@var{value} pairs,
  1167. separated by ":".
  1168. The description of the accepted options follows.
  1169. @table @option
  1170. @item sample_rate, s
  1171. Specify the sample rate, and defaults to 44100.
  1172. @item channel_layout, cl
  1173. Specify the channel layout, and can be either an integer or a string
  1174. representing a channel layout. The default value of @var{channel_layout}
  1175. is "stereo".
  1176. Check the channel_layout_map definition in
  1177. @file{libavutil/channel_layout.c} for the mapping between strings and
  1178. channel layout values.
  1179. @item nb_samples, n
  1180. Set the number of samples per requested frames.
  1181. @end table
  1182. @subsection Examples
  1183. @itemize
  1184. @item
  1185. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  1186. @example
  1187. anullsrc=r=48000:cl=4
  1188. @end example
  1189. @item
  1190. Do the same operation with a more obvious syntax:
  1191. @example
  1192. anullsrc=r=48000:cl=mono
  1193. @end example
  1194. @end itemize
  1195. @section abuffer
  1196. Buffer audio frames, and make them available to the filter chain.
  1197. This source is not intended to be part of user-supplied graph descriptions but
  1198. for insertion by calling programs through the interface defined in
  1199. @file{libavfilter/buffersrc.h}.
  1200. It accepts the following named parameters:
  1201. @table @option
  1202. @item time_base
  1203. Timebase which will be used for timestamps of submitted frames. It must be
  1204. either a floating-point number or in @var{numerator}/@var{denominator} form.
  1205. @item sample_rate
  1206. Audio sample rate.
  1207. @item sample_fmt
  1208. Name of the sample format, as returned by @code{av_get_sample_fmt_name()}.
  1209. @item channel_layout
  1210. Channel layout of the audio data, in the form that can be accepted by
  1211. @code{av_get_channel_layout()}.
  1212. @end table
  1213. All the parameters need to be explicitly defined.
  1214. @section flite
  1215. Synthesize a voice utterance using the libflite library.
  1216. To enable compilation of this filter you need to configure FFmpeg with
  1217. @code{--enable-libflite}.
  1218. Note that the flite library is not thread-safe.
  1219. The source accepts parameters as a list of @var{key}=@var{value} pairs,
  1220. separated by ":".
  1221. The description of the accepted parameters follows.
  1222. @table @option
  1223. @item list_voices
  1224. If set to 1, list the names of the available voices and exit
  1225. immediately. Default value is 0.
  1226. @item nb_samples, n
  1227. Set the maximum number of samples per frame. Default value is 512.
  1228. @item textfile
  1229. Set the filename containing the text to speak.
  1230. @item text
  1231. Set the text to speak.
  1232. @item voice, v
  1233. Set the voice to use for the speech synthesis. Default value is
  1234. @code{kal}. See also the @var{list_voices} option.
  1235. @end table
  1236. @subsection Examples
  1237. @itemize
  1238. @item
  1239. Read from file @file{speech.txt}, and synthetize the text using the
  1240. standard flite voice:
  1241. @example
  1242. flite=textfile=speech.txt
  1243. @end example
  1244. @item
  1245. Read the specified text selecting the @code{slt} voice:
  1246. @example
  1247. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1248. @end example
  1249. @item
  1250. Input text to ffmpeg:
  1251. @example
  1252. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1253. @end example
  1254. @item
  1255. Make @file{ffplay} speak the specified text, using @code{flite} and
  1256. the @code{lavfi} device:
  1257. @example
  1258. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  1259. @end example
  1260. @end itemize
  1261. For more information about libflite, check:
  1262. @url{http://www.speech.cs.cmu.edu/flite/}
  1263. @section sine
  1264. Generate an audio signal made of a sine wave with amplitude 1/8.
  1265. The audio signal is bit-exact.
  1266. It accepts a list of options in the form of @var{key}=@var{value} pairs
  1267. separated by ":". If the option name is omitted, the first option is the
  1268. frequency and the second option is the beep factor.
  1269. The supported options are:
  1270. @table @option
  1271. @item frequency, f
  1272. Set the carrier frequency. Default is 440 Hz.
  1273. @item beep_factor, b
  1274. Enable a periodic beep every second with frequency @var{beep_factor} times
  1275. the carrier frequency. Default is 0, meaning the beep is disabled.
  1276. @item sample_rate, s
  1277. Specify the sample rate, default is 44100.
  1278. @item duration, d
  1279. Specify the duration of the generated audio stream.
  1280. @item samples_per_frame
  1281. Set the number of samples per output frame, default is 1024.
  1282. @end table
  1283. @subsection Examples
  1284. @itemize
  1285. @item
  1286. Generate a simple 440 Hz sine wave:
  1287. @example
  1288. sine
  1289. @end example
  1290. @item
  1291. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  1292. @example
  1293. sine=220:4:d=5
  1294. sine=f=220:b=4:d=5
  1295. sine=frequency=220:beep_factor=4:duration=5
  1296. @end example
  1297. @end itemize
  1298. @c man end AUDIO SOURCES
  1299. @chapter Audio Sinks
  1300. @c man begin AUDIO SINKS
  1301. Below is a description of the currently available audio sinks.
  1302. @section abuffersink
  1303. Buffer audio frames, and make them available to the end of filter chain.
  1304. This sink is mainly intended for programmatic use, in particular
  1305. through the interface defined in @file{libavfilter/buffersink.h}.
  1306. It requires a pointer to an AVABufferSinkContext structure, which
  1307. defines the incoming buffers' formats, to be passed as the opaque
  1308. parameter to @code{avfilter_init_filter} for initialization.
  1309. @section anullsink
  1310. Null audio sink, do absolutely nothing with the input audio. It is
  1311. mainly useful as a template and to be employed in analysis / debugging
  1312. tools.
  1313. @section abuffersink
  1314. This sink is intended for programmatic use. Frames that arrive on this sink can
  1315. be retrieved by the calling program using the interface defined in
  1316. @file{libavfilter/buffersink.h}.
  1317. This filter accepts no parameters.
  1318. @c man end AUDIO SINKS
  1319. @chapter Video Filters
  1320. @c man begin VIDEO FILTERS
  1321. When you configure your FFmpeg build, you can disable any of the
  1322. existing filters using @code{--disable-filters}.
  1323. The configure output will show the video filters included in your
  1324. build.
  1325. Below is a description of the currently available video filters.
  1326. @section alphaextract
  1327. Extract the alpha component from the input as a grayscale video. This
  1328. is especially useful with the @var{alphamerge} filter.
  1329. @section alphamerge
  1330. Add or replace the alpha component of the primary input with the
  1331. grayscale value of a second input. This is intended for use with
  1332. @var{alphaextract} to allow the transmission or storage of frame
  1333. sequences that have alpha in a format that doesn't support an alpha
  1334. channel.
  1335. For example, to reconstruct full frames from a normal YUV-encoded video
  1336. and a separate video created with @var{alphaextract}, you might use:
  1337. @example
  1338. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  1339. @end example
  1340. Since this filter is designed for reconstruction, it operates on frame
  1341. sequences without considering timestamps, and terminates when either
  1342. input reaches end of stream. This will cause problems if your encoding
  1343. pipeline drops frames. If you're trying to apply an image as an
  1344. overlay to a video stream, consider the @var{overlay} filter instead.
  1345. @section ass
  1346. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  1347. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  1348. Substation Alpha) subtitles files.
  1349. @section bbox
  1350. Compute the bounding box for the non-black pixels in the input frame
  1351. luminance plane.
  1352. This filter computes the bounding box containing all the pixels with a
  1353. luminance value greater than the minimum allowed value.
  1354. The parameters describing the bounding box are printed on the filter
  1355. log.
  1356. @section blackdetect
  1357. Detect video intervals that are (almost) completely black. Can be
  1358. useful to detect chapter transitions, commercials, or invalid
  1359. recordings. Output lines contains the time for the start, end and
  1360. duration of the detected black interval expressed in seconds.
  1361. In order to display the output lines, you need to set the loglevel at
  1362. least to the AV_LOG_INFO value.
  1363. This filter accepts a list of options in the form of
  1364. @var{key}=@var{value} pairs separated by ":". A description of the
  1365. accepted options follows.
  1366. @table @option
  1367. @item black_min_duration, d
  1368. Set the minimum detected black duration expressed in seconds. It must
  1369. be a non-negative floating point number.
  1370. Default value is 2.0.
  1371. @item picture_black_ratio_th, pic_th
  1372. Set the threshold for considering a picture "black".
  1373. Express the minimum value for the ratio:
  1374. @example
  1375. @var{nb_black_pixels} / @var{nb_pixels}
  1376. @end example
  1377. for which a picture is considered black.
  1378. Default value is 0.98.
  1379. @item pixel_black_th, pix_th
  1380. Set the threshold for considering a pixel "black".
  1381. The threshold expresses the maximum pixel luminance value for which a
  1382. pixel is considered "black". The provided value is scaled according to
  1383. the following equation:
  1384. @example
  1385. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  1386. @end example
  1387. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  1388. the input video format, the range is [0-255] for YUV full-range
  1389. formats and [16-235] for YUV non full-range formats.
  1390. Default value is 0.10.
  1391. @end table
  1392. The following example sets the maximum pixel threshold to the minimum
  1393. value, and detects only black intervals of 2 or more seconds:
  1394. @example
  1395. blackdetect=d=2:pix_th=0.00
  1396. @end example
  1397. @section blackframe
  1398. Detect frames that are (almost) completely black. Can be useful to
  1399. detect chapter transitions or commercials. Output lines consist of
  1400. the frame number of the detected frame, the percentage of blackness,
  1401. the position in the file if known or -1 and the timestamp in seconds.
  1402. In order to display the output lines, you need to set the loglevel at
  1403. least to the AV_LOG_INFO value.
  1404. The filter accepts parameters as a list of @var{key}=@var{value}
  1405. pairs, separated by ":". If the key of the first options is omitted,
  1406. the arguments are interpreted according to the syntax
  1407. blackframe[=@var{amount}[:@var{threshold}]].
  1408. A description of the accepted options follows.
  1409. @table @option
  1410. @item amount
  1411. Set the percentage of pixels that have to be below the
  1412. threshold to enable black detection. Default value is 98.
  1413. @item threshold
  1414. Set the threshold below which a pixel value is considered
  1415. black. Default value is 32.
  1416. @end table
  1417. @section blend
  1418. Blend two video frames into each other.
  1419. It takes two input streams and outputs one stream, the first input is the
  1420. "top" layer and second input is "bottom" layer.
  1421. Output terminates when shortest input terminates.
  1422. This filter accepts a list of options in the form of @var{key}=@var{value}
  1423. pairs separated by ":". A description of the accepted options follows.
  1424. @table @option
  1425. @item c0_mode
  1426. @item c1_mode
  1427. @item c2_mode
  1428. @item c3_mode
  1429. @item all_mode
  1430. Set blend mode for specific pixel component or all pixel components in case
  1431. of @var{all_mode}. Default value is @code{normal}.
  1432. Available values for component modes are:
  1433. @table @samp
  1434. @item addition
  1435. @item and
  1436. @item average
  1437. @item burn
  1438. @item darken
  1439. @item difference
  1440. @item divide
  1441. @item dodge
  1442. @item exclusion
  1443. @item hardlight
  1444. @item lighten
  1445. @item multiply
  1446. @item negation
  1447. @item normal
  1448. @item or
  1449. @item overlay
  1450. @item phoenix
  1451. @item pinlight
  1452. @item reflect
  1453. @item screen
  1454. @item softlight
  1455. @item subtract
  1456. @item vividlight
  1457. @item xor
  1458. @end table
  1459. @item c0_opacity
  1460. @item c1_opacity
  1461. @item c2_opacity
  1462. @item c3_opacity
  1463. @item all_opacity
  1464. Set blend opacity for specific pixel component or all pixel components in case
  1465. of @var{all_expr}. Only used in combination with pixel component blend modes.
  1466. @item c0_expr
  1467. @item c1_expr
  1468. @item c2_expr
  1469. @item c3_expr
  1470. @item all_expr
  1471. Set blend expression for specific pixel component or all pixel components in case
  1472. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  1473. The expressions can use the following variables:
  1474. @table @option
  1475. @item X
  1476. @item Y
  1477. the coordinates of the current sample
  1478. @item W
  1479. @item H
  1480. the width and height of currently filtered plane
  1481. @item SW
  1482. @item SH
  1483. Width and height scale depending on the currently filtered plane. It is the
  1484. ratio between the corresponding luma plane number of pixels and the current
  1485. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  1486. @code{0.5,0.5} for chroma planes.
  1487. @item T
  1488. Time of the current frame, expressed in seconds.
  1489. @item TOP, A
  1490. Value of pixel component at current location for first video frame (top layer).
  1491. @item BOTTOM, B
  1492. Value of pixel component at current location for second video frame (bottom layer).
  1493. @end table
  1494. @end table
  1495. @subsection Examples
  1496. @itemize
  1497. @item
  1498. Apply transition from bottom layer to top layer in first 10 seconds:
  1499. @example
  1500. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  1501. @end example
  1502. @item
  1503. Apply 1x1 checkerboard effect:
  1504. @example
  1505. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  1506. @end example
  1507. @end itemize
  1508. @section boxblur
  1509. Apply boxblur algorithm to the input video.
  1510. The filter accepts parameters as a list of @var{key}=@var{value}
  1511. pairs, separated by ":". If the key of the first options is omitted,
  1512. the arguments are interpreted according to the syntax
  1513. @option{luma_radius}:@option{luma_power}:@option{chroma_radius}:@option{chroma_power}:@option{alpha_radius}:@option{alpha_power}.
  1514. A description of the accepted options follows.
  1515. @table @option
  1516. @item luma_radius, lr
  1517. @item chroma_radius, cr
  1518. @item alpha_radius, ar
  1519. Set an expression for the box radius in pixels used for blurring the
  1520. corresponding input plane.
  1521. The radius value must be a non-negative number, and must not be
  1522. greater than the value of the expression @code{min(w,h)/2} for the
  1523. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  1524. planes.
  1525. Default value for @option{luma_radius} is "2". If not specified,
  1526. @option{chroma_radius} and @option{alpha_radius} default to the
  1527. corresponding value set for @option{luma_radius}.
  1528. The expressions can contain the following constants:
  1529. @table @option
  1530. @item w, h
  1531. the input width and height in pixels
  1532. @item cw, ch
  1533. the input chroma image width and height in pixels
  1534. @item hsub, vsub
  1535. horizontal and vertical chroma subsample values. For example for the
  1536. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1537. @end table
  1538. @item luma_power, lp
  1539. @item chroma_power, cp
  1540. @item alpha_power, ap
  1541. Specify how many times the boxblur filter is applied to the
  1542. corresponding plane.
  1543. Default value for @option{luma_power} is 2. If not specified,
  1544. @option{chroma_power} and @option{alpha_power} default to the
  1545. corresponding value set for @option{luma_power}.
  1546. A value of 0 will disable the effect.
  1547. @end table
  1548. @subsection Examples
  1549. @itemize
  1550. @item
  1551. Apply a boxblur filter with luma, chroma, and alpha radius
  1552. set to 2:
  1553. @example
  1554. boxblur=2:1
  1555. @end example
  1556. @item
  1557. Set luma radius to 2, alpha and chroma radius to 0:
  1558. @example
  1559. boxblur=2:1:cr=0:ar=0
  1560. @end example
  1561. @item
  1562. Set luma and chroma radius to a fraction of the video dimension:
  1563. @example
  1564. boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
  1565. @end example
  1566. @end itemize
  1567. @section colormatrix
  1568. Convert color matrix.
  1569. The filter accepts parameters as a list of @var{key}=@var{value}
  1570. pairs, separated by ":". If the key of the first options is omitted,
  1571. the arguments are interpreted according to the syntax
  1572. @var{src}:@var{dst}.
  1573. A description of the accepted options follows:
  1574. @table @option
  1575. @item src
  1576. @item dst
  1577. Specify the source and destination color matrix. Both values must be
  1578. specified.
  1579. The accepted values are:
  1580. @table @samp
  1581. @item bt709
  1582. BT.709
  1583. @item bt601
  1584. BT.601
  1585. @item smpte240m
  1586. SMPTE-240M
  1587. @item fcc
  1588. FCC
  1589. @end table
  1590. @end table
  1591. For example to convert from BT.601 to SMPTE-240M, use the command:
  1592. @example
  1593. colormatrix=bt601:smpte240m
  1594. @end example
  1595. @section copy
  1596. Copy the input source unchanged to the output. Mainly useful for
  1597. testing purposes.
  1598. @section crop
  1599. Crop the input video.
  1600. This filter accepts a list of @var{key}=@var{value} pairs as argument,
  1601. separated by ':'. If the key of the first options is omitted, the
  1602. arguments are interpreted according to the syntax
  1603. @var{out_w}:@var{out_h}:@var{x}:@var{y}:@var{keep_aspect}.
  1604. A description of the accepted options follows:
  1605. @table @option
  1606. @item w, out_w
  1607. Set the crop area width. It defaults to @code{iw}.
  1608. This expression is evaluated only once during the filter
  1609. configuration.
  1610. @item h, out_h
  1611. Set the crop area width. It defaults to @code{ih}.
  1612. This expression is evaluated only once during the filter
  1613. configuration.
  1614. @item x
  1615. Set the expression for the x top-left coordinate of the cropped area.
  1616. It defaults to @code{(in_w-out_w)/2}.
  1617. This expression is evaluated per-frame.
  1618. @item y
  1619. Set the expression for the y top-left coordinate of the cropped area.
  1620. It defaults to @code{(in_h-out_h)/2}.
  1621. This expression is evaluated per-frame.
  1622. @item keep_aspect
  1623. If set to 1 will force the output display aspect ratio
  1624. to be the same of the input, by changing the output sample aspect
  1625. ratio. It defaults to 0.
  1626. @end table
  1627. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  1628. expressions containing the following constants:
  1629. @table @option
  1630. @item x, y
  1631. the computed values for @var{x} and @var{y}. They are evaluated for
  1632. each new frame.
  1633. @item in_w, in_h
  1634. the input width and height
  1635. @item iw, ih
  1636. same as @var{in_w} and @var{in_h}
  1637. @item out_w, out_h
  1638. the output (cropped) width and height
  1639. @item ow, oh
  1640. same as @var{out_w} and @var{out_h}
  1641. @item a
  1642. same as @var{iw} / @var{ih}
  1643. @item sar
  1644. input sample aspect ratio
  1645. @item dar
  1646. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  1647. @item hsub, vsub
  1648. horizontal and vertical chroma subsample values. For example for the
  1649. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1650. @item n
  1651. the number of input frame, starting from 0
  1652. @item t
  1653. timestamp expressed in seconds, NAN if the input timestamp is unknown
  1654. @end table
  1655. The expression for @var{out_w} may depend on the value of @var{out_h},
  1656. and the expression for @var{out_h} may depend on @var{out_w}, but they
  1657. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  1658. evaluated after @var{out_w} and @var{out_h}.
  1659. The @var{x} and @var{y} parameters specify the expressions for the
  1660. position of the top-left corner of the output (non-cropped) area. They
  1661. are evaluated for each frame. If the evaluated value is not valid, it
  1662. is approximated to the nearest valid value.
  1663. The expression for @var{x} may depend on @var{y}, and the expression
  1664. for @var{y} may depend on @var{x}.
  1665. @subsection Examples
  1666. @itemize
  1667. @item
  1668. Crop area with size 100x100 at position (12,34).
  1669. @example
  1670. crop=100:100:12:34
  1671. @end example
  1672. Using named options, the example above becomes:
  1673. @example
  1674. crop=w=100:h=100:x=12:y=34
  1675. @end example
  1676. @item
  1677. Crop the central input area with size 100x100:
  1678. @example
  1679. crop=100:100
  1680. @end example
  1681. @item
  1682. Crop the central input area with size 2/3 of the input video:
  1683. @example
  1684. crop=2/3*in_w:2/3*in_h
  1685. @end example
  1686. @item
  1687. Crop the input video central square:
  1688. @example
  1689. crop=in_h
  1690. @end example
  1691. @item
  1692. Delimit the rectangle with the top-left corner placed at position
  1693. 100:100 and the right-bottom corner corresponding to the right-bottom
  1694. corner of the input image:
  1695. @example
  1696. crop=in_w-100:in_h-100:100:100
  1697. @end example
  1698. @item
  1699. Crop 10 pixels from the left and right borders, and 20 pixels from
  1700. the top and bottom borders
  1701. @example
  1702. crop=in_w-2*10:in_h-2*20
  1703. @end example
  1704. @item
  1705. Keep only the bottom right quarter of the input image:
  1706. @example
  1707. crop=in_w/2:in_h/2:in_w/2:in_h/2
  1708. @end example
  1709. @item
  1710. Crop height for getting Greek harmony:
  1711. @example
  1712. crop=in_w:1/PHI*in_w
  1713. @end example
  1714. @item
  1715. Appply trembling effect:
  1716. @example
  1717. 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)
  1718. @end example
  1719. @item
  1720. Apply erratic camera effect depending on timestamp:
  1721. @example
  1722. 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)"
  1723. @end example
  1724. @item
  1725. Set x depending on the value of y:
  1726. @example
  1727. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  1728. @end example
  1729. @end itemize
  1730. @section cropdetect
  1731. Auto-detect crop size.
  1732. Calculate necessary cropping parameters and prints the recommended
  1733. parameters through the logging system. The detected dimensions
  1734. correspond to the non-black area of the input video.
  1735. The filter accepts parameters as a list of @var{key}=@var{value}
  1736. pairs, separated by ":". If the key of the first options is omitted,
  1737. the arguments are interpreted according to the syntax
  1738. [@option{limit}[:@option{round}[:@option{reset}]]].
  1739. A description of the accepted options follows.
  1740. @table @option
  1741. @item limit
  1742. Set higher black value threshold, which can be optionally specified
  1743. from nothing (0) to everything (255). An intensity value greater
  1744. to the set value is considered non-black. Default value is 24.
  1745. @item round
  1746. Set the value for which the width/height should be divisible by. The
  1747. offset is automatically adjusted to center the video. Use 2 to get
  1748. only even dimensions (needed for 4:2:2 video). 16 is best when
  1749. encoding to most video codecs. Default value is 16.
  1750. @item reset
  1751. Set the counter that determines after how many frames cropdetect will
  1752. reset the previously detected largest video area and start over to
  1753. detect the current optimal crop area. Default value is 0.
  1754. This can be useful when channel logos distort the video area. 0
  1755. indicates never reset and return the largest area encountered during
  1756. playback.
  1757. @end table
  1758. @section curves
  1759. Apply color adjustments using curves.
  1760. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  1761. component (red, green and blue) has its values defined by @var{N} key points
  1762. tied from each other using a smooth curve. The x-axis represents the pixel
  1763. values from the input frame, and the y-axis the new pixel values to be set for
  1764. the output frame.
  1765. By default, a component curve is defined by the two points @var{(0;0)} and
  1766. @var{(1;1)}. This creates a straight line where each original pixel value is
  1767. "adjusted" to its own value, which means no change to the image.
  1768. The filter allows you to redefine these two points and add some more. A new
  1769. curve (using a natural cubic spline interpolation) will be define to pass
  1770. smoothly through all these new coordinates. The new defined points needs to be
  1771. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  1772. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  1773. the vector spaces, the values will be clipped accordingly.
  1774. If there is no key point defined in @code{x=0}, the filter will automatically
  1775. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  1776. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  1777. The filter accepts parameters as a list of @var{key}=@var{value}
  1778. pairs, separated by ":". If the key of the first options is omitted,
  1779. the arguments are interpreted according to the syntax
  1780. curves[=@var{preset}].
  1781. A description of the accepted parameters follows.
  1782. @table @option
  1783. @item red, r
  1784. Set the key points for the red component.
  1785. @item green, g
  1786. Set the key points for the green component.
  1787. @item blue, b
  1788. Set the key points for the blue component.
  1789. @item preset
  1790. Select one of the available color presets. This option can not be used in
  1791. addition to the @option{r}, @option{g}, @option{b} parameters.
  1792. Available presets are:
  1793. @table @samp
  1794. @item color_negative
  1795. @item cross_process
  1796. @item darker
  1797. @item increase_contrast
  1798. @item lighter
  1799. @item linear_contrast
  1800. @item medium_contrast
  1801. @item negative
  1802. @item strong_contrast
  1803. @item vintage
  1804. @end table
  1805. Default is unset.
  1806. @end table
  1807. To avoid some filtergraph syntax conflicts, each key points list need to be
  1808. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  1809. @subsection Examples
  1810. @itemize
  1811. @item
  1812. Increase slightly the middle level of blue:
  1813. @example
  1814. curves=blue='0.5/0.58'
  1815. @end example
  1816. @item
  1817. Vintage effect:
  1818. @example
  1819. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  1820. @end example
  1821. Here we obtain the following coordinates for each components:
  1822. @table @var
  1823. @item red
  1824. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  1825. @item green
  1826. @code{(0;0) (0.50;0.48) (1;1)}
  1827. @item blue
  1828. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  1829. @end table
  1830. @item
  1831. The previous example can also be achieved with the associated built-in preset:
  1832. @example
  1833. curves=preset=vintage
  1834. @end example
  1835. @item
  1836. Or simply:
  1837. @example
  1838. curves=vintage
  1839. @end example
  1840. @end itemize
  1841. @section decimate
  1842. Drop frames that do not differ greatly from the previous frame in
  1843. order to reduce framerate.
  1844. The main use of this filter is for very-low-bitrate encoding
  1845. (e.g. streaming over dialup modem), but it could in theory be used for
  1846. fixing movies that were inverse-telecined incorrectly.
  1847. The filter accepts parameters as a list of @var{key}=@var{value}
  1848. pairs, separated by ":". If the key of the first options is omitted,
  1849. the arguments are interpreted according to the syntax:
  1850. @option{max}:@option{hi}:@option{lo}:@option{frac}.
  1851. A description of the accepted options follows.
  1852. @table @option
  1853. @item max
  1854. Set the maximum number of consecutive frames which can be dropped (if
  1855. positive), or the minimum interval between dropped frames (if
  1856. negative). If the value is 0, the frame is dropped unregarding the
  1857. number of previous sequentially dropped frames.
  1858. Default value is 0.
  1859. @item hi
  1860. @item lo
  1861. @item frac
  1862. Set the dropping threshold values.
  1863. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  1864. represent actual pixel value differences, so a threshold of 64
  1865. corresponds to 1 unit of difference for each pixel, or the same spread
  1866. out differently over the block.
  1867. A frame is a candidate for dropping if no 8x8 blocks differ by more
  1868. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  1869. meaning the whole image) differ by more than a threshold of @option{lo}.
  1870. Default value for @option{hi} is 64*12, default value for @option{lo} is
  1871. 64*5, and default value for @option{frac} is 0.33.
  1872. @end table
  1873. @section delogo
  1874. Suppress a TV station logo by a simple interpolation of the surrounding
  1875. pixels. Just set a rectangle covering the logo and watch it disappear
  1876. (and sometimes something even uglier appear - your mileage may vary).
  1877. The filter accepts parameters as a string of the form
  1878. "@var{x}:@var{y}:@var{w}:@var{h}:@var{band}", or as a list of
  1879. @var{key}=@var{value} pairs, separated by ":".
  1880. The description of the accepted parameters follows.
  1881. @table @option
  1882. @item x, y
  1883. Specify the top left corner coordinates of the logo. They must be
  1884. specified.
  1885. @item w, h
  1886. Specify the width and height of the logo to clear. They must be
  1887. specified.
  1888. @item band, t
  1889. Specify the thickness of the fuzzy edge of the rectangle (added to
  1890. @var{w} and @var{h}). The default value is 4.
  1891. @item show
  1892. When set to 1, a green rectangle is drawn on the screen to simplify
  1893. finding the right @var{x}, @var{y}, @var{w}, @var{h} parameters, and
  1894. @var{band} is set to 4. The default value is 0.
  1895. @end table
  1896. @subsection Examples
  1897. @itemize
  1898. @item
  1899. Set a rectangle covering the area with top left corner coordinates 0,0
  1900. and size 100x77, setting a band of size 10:
  1901. @example
  1902. delogo=0:0:100:77:10
  1903. @end example
  1904. @item
  1905. As the previous example, but use named options:
  1906. @example
  1907. delogo=x=0:y=0:w=100:h=77:band=10
  1908. @end example
  1909. @end itemize
  1910. @section deshake
  1911. Attempt to fix small changes in horizontal and/or vertical shift. This
  1912. filter helps remove camera shake from hand-holding a camera, bumping a
  1913. tripod, moving on a vehicle, etc.
  1914. The filter accepts parameters as a list of @var{key}=@var{value}
  1915. pairs, separated by ":". If the key of the first options is omitted,
  1916. the arguments are interpreted according to the syntax
  1917. @var{x}:@var{y}:@var{w}:@var{h}:@var{rx}:@var{ry}:@var{edge}:@var{blocksize}:@var{contrast}:@var{search}:@var{filename}.
  1918. A description of the accepted parameters follows.
  1919. @table @option
  1920. @item x, y, w, h
  1921. Specify a rectangular area where to limit the search for motion
  1922. vectors.
  1923. If desired the search for motion vectors can be limited to a
  1924. rectangular area of the frame defined by its top left corner, width
  1925. and height. These parameters have the same meaning as the drawbox
  1926. filter which can be used to visualise the position of the bounding
  1927. box.
  1928. This is useful when simultaneous movement of subjects within the frame
  1929. might be confused for camera motion by the motion vector search.
  1930. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  1931. then the full frame is used. This allows later options to be set
  1932. without specifying the bounding box for the motion vector search.
  1933. Default - search the whole frame.
  1934. @item rx, ry
  1935. Specify the maximum extent of movement in x and y directions in the
  1936. range 0-64 pixels. Default 16.
  1937. @item edge
  1938. Specify how to generate pixels to fill blanks at the edge of the
  1939. frame. Available values are:
  1940. @table @samp
  1941. @item blank, 0
  1942. Fill zeroes at blank locations
  1943. @item original, 1
  1944. Original image at blank locations
  1945. @item clamp, 2
  1946. Extruded edge value at blank locations
  1947. @item mirror, 3
  1948. Mirrored edge at blank locations
  1949. @end table
  1950. Default value is @samp{mirror}.
  1951. @item blocksize
  1952. Specify the blocksize to use for motion search. Range 4-128 pixels,
  1953. default 8.
  1954. @item contrast
  1955. Specify the contrast threshold for blocks. Only blocks with more than
  1956. the specified contrast (difference between darkest and lightest
  1957. pixels) will be considered. Range 1-255, default 125.
  1958. @item search
  1959. Specify the search strategy. Available values are:
  1960. @table @samp
  1961. @item exhaustive, 0
  1962. Set exhaustive search
  1963. @item less, 1
  1964. Set less exhaustive search.
  1965. @end table
  1966. Default value is @samp{exhaustive}.
  1967. @item filename
  1968. If set then a detailed log of the motion search is written to the
  1969. specified file.
  1970. @end table
  1971. @section drawbox
  1972. Draw a colored box on the input image.
  1973. The filter accepts parameters as a list of @var{key}=@var{value}
  1974. pairs, separated by ":". If the key of the first options is omitted,
  1975. the arguments are interpreted according to the syntax
  1976. @option{x}:@option{y}:@option{width}:@option{height}:@option{color}:@option{thickness}.
  1977. A description of the accepted options follows.
  1978. @table @option
  1979. @item x, y
  1980. Specify the top left corner coordinates of the box. Default to 0.
  1981. @item width, w
  1982. @item height, h
  1983. Specify the width and height of the box, if 0 they are interpreted as
  1984. the input width and height. Default to 0.
  1985. @item color, c
  1986. Specify the color of the box to write, it can be the name of a color
  1987. (case insensitive match) or a 0xRRGGBB[AA] sequence. If the special
  1988. value @code{invert} is used, the box edge color is the same as the
  1989. video with inverted luma.
  1990. @item thickness, t
  1991. Set the thickness of the box edge. Default value is @code{4}.
  1992. @end table
  1993. @subsection Examples
  1994. @itemize
  1995. @item
  1996. Draw a black box around the edge of the input image:
  1997. @example
  1998. drawbox
  1999. @end example
  2000. @item
  2001. Draw a box with color red and an opacity of 50%:
  2002. @example
  2003. drawbox=10:20:200:60:red@@0.5
  2004. @end example
  2005. The previous example can be specified as:
  2006. @example
  2007. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  2008. @end example
  2009. @item
  2010. Fill the box with pink color:
  2011. @example
  2012. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  2013. @end example
  2014. @end itemize
  2015. @anchor{drawtext}
  2016. @section drawtext
  2017. Draw text string or text from specified file on top of video using the
  2018. libfreetype library.
  2019. To enable compilation of this filter you need to configure FFmpeg with
  2020. @code{--enable-libfreetype}.
  2021. @subsection Syntax
  2022. The filter accepts parameters as a list of @var{key}=@var{value} pairs,
  2023. separated by ":".
  2024. The description of the accepted parameters follows.
  2025. @table @option
  2026. @item box
  2027. Used to draw a box around text using background color.
  2028. Value should be either 1 (enable) or 0 (disable).
  2029. The default value of @var{box} is 0.
  2030. @item boxcolor
  2031. The color to be used for drawing box around text.
  2032. Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
  2033. (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  2034. The default value of @var{boxcolor} is "white".
  2035. @item draw
  2036. Set an expression which specifies if the text should be drawn. If the
  2037. expression evaluates to 0, the text is not drawn. This is useful for
  2038. specifying that the text should be drawn only when specific conditions
  2039. are met.
  2040. Default value is "1".
  2041. See below for the list of accepted constants and functions.
  2042. @item expansion
  2043. Select how the @var{text} is expanded. Can be either @code{none},
  2044. @code{strftime} (deprecated) or
  2045. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  2046. below for details.
  2047. @item fix_bounds
  2048. If true, check and fix text coords to avoid clipping.
  2049. @item fontcolor
  2050. The color to be used for drawing fonts.
  2051. Either a string (e.g. "red") or in 0xRRGGBB[AA] format
  2052. (e.g. "0xff000033"), possibly followed by an alpha specifier.
  2053. The default value of @var{fontcolor} is "black".
  2054. @item fontfile
  2055. The font file to be used for drawing text. Path must be included.
  2056. This parameter is mandatory.
  2057. @item fontsize
  2058. The font size to be used for drawing text.
  2059. The default value of @var{fontsize} is 16.
  2060. @item ft_load_flags
  2061. Flags to be used for loading the fonts.
  2062. The flags map the corresponding flags supported by libfreetype, and are
  2063. a combination of the following values:
  2064. @table @var
  2065. @item default
  2066. @item no_scale
  2067. @item no_hinting
  2068. @item render
  2069. @item no_bitmap
  2070. @item vertical_layout
  2071. @item force_autohint
  2072. @item crop_bitmap
  2073. @item pedantic
  2074. @item ignore_global_advance_width
  2075. @item no_recurse
  2076. @item ignore_transform
  2077. @item monochrome
  2078. @item linear_design
  2079. @item no_autohint
  2080. @item end table
  2081. @end table
  2082. Default value is "render".
  2083. For more information consult the documentation for the FT_LOAD_*
  2084. libfreetype flags.
  2085. @item shadowcolor
  2086. The color to be used for drawing a shadow behind the drawn text. It
  2087. can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
  2088. form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  2089. The default value of @var{shadowcolor} is "black".
  2090. @item shadowx, shadowy
  2091. The x and y offsets for the text shadow position with respect to the
  2092. position of the text. They can be either positive or negative
  2093. values. Default value for both is "0".
  2094. @item tabsize
  2095. The size in number of spaces to use for rendering the tab.
  2096. Default value is 4.
  2097. @item timecode
  2098. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  2099. format. It can be used with or without text parameter. @var{timecode_rate}
  2100. option must be specified.
  2101. @item timecode_rate, rate, r
  2102. Set the timecode frame rate (timecode only).
  2103. @item text
  2104. The text string to be drawn. The text must be a sequence of UTF-8
  2105. encoded characters.
  2106. This parameter is mandatory if no file is specified with the parameter
  2107. @var{textfile}.
  2108. @item textfile
  2109. A text file containing text to be drawn. The text must be a sequence
  2110. of UTF-8 encoded characters.
  2111. This parameter is mandatory if no text string is specified with the
  2112. parameter @var{text}.
  2113. If both @var{text} and @var{textfile} are specified, an error is thrown.
  2114. @item reload
  2115. If set to 1, the @var{textfile} will be reloaded before each frame.
  2116. Be sure to update it atomically, or it may be read partially, or even fail.
  2117. @item x, y
  2118. The expressions which specify the offsets where text will be drawn
  2119. within the video frame. They are relative to the top/left border of the
  2120. output image.
  2121. The default value of @var{x} and @var{y} is "0".
  2122. See below for the list of accepted constants and functions.
  2123. @end table
  2124. The parameters for @var{x} and @var{y} are expressions containing the
  2125. following constants and functions:
  2126. @table @option
  2127. @item dar
  2128. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  2129. @item hsub, vsub
  2130. horizontal and vertical chroma subsample values. For example for the
  2131. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2132. @item line_h, lh
  2133. the height of each text line
  2134. @item main_h, h, H
  2135. the input height
  2136. @item main_w, w, W
  2137. the input width
  2138. @item max_glyph_a, ascent
  2139. the maximum distance from the baseline to the highest/upper grid
  2140. coordinate used to place a glyph outline point, for all the rendered
  2141. glyphs.
  2142. It is a positive value, due to the grid's orientation with the Y axis
  2143. upwards.
  2144. @item max_glyph_d, descent
  2145. the maximum distance from the baseline to the lowest grid coordinate
  2146. used to place a glyph outline point, for all the rendered glyphs.
  2147. This is a negative value, due to the grid's orientation, with the Y axis
  2148. upwards.
  2149. @item max_glyph_h
  2150. maximum glyph height, that is the maximum height for all the glyphs
  2151. contained in the rendered text, it is equivalent to @var{ascent} -
  2152. @var{descent}.
  2153. @item max_glyph_w
  2154. maximum glyph width, that is the maximum width for all the glyphs
  2155. contained in the rendered text
  2156. @item n
  2157. the number of input frame, starting from 0
  2158. @item rand(min, max)
  2159. return a random number included between @var{min} and @var{max}
  2160. @item sar
  2161. input sample aspect ratio
  2162. @item t
  2163. timestamp expressed in seconds, NAN if the input timestamp is unknown
  2164. @item text_h, th
  2165. the height of the rendered text
  2166. @item text_w, tw
  2167. the width of the rendered text
  2168. @item x, y
  2169. the x and y offset coordinates where the text is drawn.
  2170. These parameters allow the @var{x} and @var{y} expressions to refer
  2171. each other, so you can for example specify @code{y=x/dar}.
  2172. @end table
  2173. If libavfilter was built with @code{--enable-fontconfig}, then
  2174. @option{fontfile} can be a fontconfig pattern or omitted.
  2175. @anchor{drawtext_expansion}
  2176. @subsection Text expansion
  2177. If @option{expansion} is set to @code{strftime},
  2178. the filter recognizes strftime() sequences in the provided text and
  2179. expands them accordingly. Check the documentation of strftime(). This
  2180. feature is deprecated.
  2181. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  2182. If @option{expansion} is set to @code{normal} (which is the default),
  2183. the following expansion mechanism is used.
  2184. The backslash character '\', followed by any character, always expands to
  2185. the second character.
  2186. Sequence of the form @code{%@{...@}} are expanded. The text between the
  2187. braces is a function name, possibly followed by arguments separated by ':'.
  2188. If the arguments contain special characters or delimiters (':' or '@}'),
  2189. they should be escaped.
  2190. Note that they probably must also be escaped as the value for the
  2191. @option{text} option in the filter argument string and as the filter
  2192. argument in the filter graph description, and possibly also for the shell,
  2193. that makes up to four levels of escaping; using a text file avoids these
  2194. problems.
  2195. The following functions are available:
  2196. @table @command
  2197. @item expr, e
  2198. The expression evaluation result.
  2199. It must take one argument specifying the expression to be evaluated,
  2200. which accepts the same constants and functions as the @var{x} and
  2201. @var{y} values. Note that not all constants should be used, for
  2202. example the text size is not known when evaluating the expression, so
  2203. the constants @var{text_w} and @var{text_h} will have an undefined
  2204. value.
  2205. @item gmtime
  2206. The time at which the filter is running, expressed in UTC.
  2207. It can accept an argument: a strftime() format string.
  2208. @item localtime
  2209. The time at which the filter is running, expressed in the local time zone.
  2210. It can accept an argument: a strftime() format string.
  2211. @item n, frame_num
  2212. The frame number, starting from 0.
  2213. @item pts
  2214. The timestamp of the current frame, in seconds, with microsecond accuracy.
  2215. @end table
  2216. @subsection Examples
  2217. @itemize
  2218. @item
  2219. Draw "Test Text" with font FreeSerif, using the default values for the
  2220. optional parameters.
  2221. @example
  2222. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  2223. @end example
  2224. @item
  2225. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  2226. and y=50 (counting from the top-left corner of the screen), text is
  2227. yellow with a red box around it. Both the text and the box have an
  2228. opacity of 20%.
  2229. @example
  2230. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  2231. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  2232. @end example
  2233. Note that the double quotes are not necessary if spaces are not used
  2234. within the parameter list.
  2235. @item
  2236. Show the text at the center of the video frame:
  2237. @example
  2238. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  2239. @end example
  2240. @item
  2241. Show a text line sliding from right to left in the last row of the video
  2242. frame. The file @file{LONG_LINE} is assumed to contain a single line
  2243. with no newlines.
  2244. @example
  2245. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  2246. @end example
  2247. @item
  2248. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  2249. @example
  2250. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  2251. @end example
  2252. @item
  2253. Draw a single green letter "g", at the center of the input video.
  2254. The glyph baseline is placed at half screen height.
  2255. @example
  2256. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  2257. @end example
  2258. @item
  2259. Show text for 1 second every 3 seconds:
  2260. @example
  2261. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:draw=lt(mod(t\,3)\,1):text='blink'"
  2262. @end example
  2263. @item
  2264. Use fontconfig to set the font. Note that the colons need to be escaped.
  2265. @example
  2266. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  2267. @end example
  2268. @item
  2269. Print the date of a real-time encoding (see strftime(3)):
  2270. @example
  2271. drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
  2272. @end example
  2273. @end itemize
  2274. For more information about libfreetype, check:
  2275. @url{http://www.freetype.org/}.
  2276. For more information about fontconfig, check:
  2277. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  2278. @section edgedetect
  2279. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  2280. This filter accepts the following optional named parameters:
  2281. @table @option
  2282. @item low, high
  2283. Set low and high threshold values used by the Canny thresholding
  2284. algorithm.
  2285. The high threshold selects the "strong" edge pixels, which are then
  2286. connected through 8-connectivity with the "weak" edge pixels selected
  2287. by the low threshold.
  2288. @var{low} and @var{high} threshold values must be choosen in the range
  2289. [0,1], and @var{low} should be lesser or equal to @var{high}.
  2290. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  2291. is @code{50/255}.
  2292. @end table
  2293. Example:
  2294. @example
  2295. edgedetect=low=0.1:high=0.4
  2296. @end example
  2297. @section fade
  2298. Apply fade-in/out effect to input video.
  2299. The filter accepts parameters as a list of @var{key}=@var{value}
  2300. pairs, separated by ":". If the key of the first options is omitted,
  2301. the arguments are interpreted according to the syntax
  2302. @var{type}:@var{start_frame}:@var{nb_frames}.
  2303. A description of the accepted parameters follows.
  2304. @table @option
  2305. @item type, t
  2306. Specify if the effect type, can be either @code{in} for fade-in, or
  2307. @code{out} for a fade-out effect. Default is @code{in}.
  2308. @item start_frame, s
  2309. Specify the number of the start frame for starting to apply the fade
  2310. effect. Default is 0.
  2311. @item nb_frames, n
  2312. Specify the number of frames for which the fade effect has to last. At
  2313. the end of the fade-in effect the output video will have the same
  2314. intensity as the input video, at the end of the fade-out transition
  2315. the output video will be completely black. Default is 25.
  2316. @item alpha
  2317. If set to 1, fade only alpha channel, if one exists on the input.
  2318. Default value is 0.
  2319. @end table
  2320. @subsection Examples
  2321. @itemize
  2322. @item
  2323. Fade in first 30 frames of video:
  2324. @example
  2325. fade=in:0:30
  2326. @end example
  2327. The command above is equivalent to:
  2328. @example
  2329. fade=t=in:s=0:n=30
  2330. @end example
  2331. @item
  2332. Fade out last 45 frames of a 200-frame video:
  2333. @example
  2334. fade=out:155:45
  2335. @end example
  2336. @item
  2337. Fade in first 25 frames and fade out last 25 frames of a 1000-frame video:
  2338. @example
  2339. fade=in:0:25, fade=out:975:25
  2340. @end example
  2341. @item
  2342. Make first 5 frames black, then fade in from frame 5-24:
  2343. @example
  2344. fade=in:5:20
  2345. @end example
  2346. @item
  2347. Fade in alpha over first 25 frames of video:
  2348. @example
  2349. fade=in:0:25:alpha=1
  2350. @end example
  2351. @end itemize
  2352. @section field
  2353. Extract a single field from an interlaced image using stride
  2354. arithmetic to avoid wasting CPU time. The output frames are marked as
  2355. non-interlaced.
  2356. This filter accepts the following named options:
  2357. @table @option
  2358. @item type
  2359. Specify whether to extract the top (if the value is @code{0} or
  2360. @code{top}) or the bottom field (if the value is @code{1} or
  2361. @code{bottom}).
  2362. @end table
  2363. If the option key is not specified, the first value sets the @var{type}
  2364. option. For example:
  2365. @example
  2366. field=bottom
  2367. @end example
  2368. is equivalent to:
  2369. @example
  2370. field=type=bottom
  2371. @end example
  2372. @section fieldorder
  2373. Transform the field order of the input video.
  2374. This filter accepts the named option @option{order} which
  2375. specifies the required field order that the input interlaced video
  2376. will be transformed to. The option name can be omitted.
  2377. The option @option{order} can assume one of the following values:
  2378. @table @samp
  2379. @item bff
  2380. output bottom field first
  2381. @item tff
  2382. output top field first
  2383. @end table
  2384. Default value is @samp{tff}.
  2385. Transformation is achieved by shifting the picture content up or down
  2386. by one line, and filling the remaining line with appropriate picture content.
  2387. This method is consistent with most broadcast field order converters.
  2388. If the input video is not flagged as being interlaced, or it is already
  2389. flagged as being of the required output field order then this filter does
  2390. not alter the incoming video.
  2391. This filter is very useful when converting to or from PAL DV material,
  2392. which is bottom field first.
  2393. For example:
  2394. @example
  2395. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  2396. @end example
  2397. @section fifo
  2398. Buffer input images and send them when they are requested.
  2399. This filter is mainly useful when auto-inserted by the libavfilter
  2400. framework.
  2401. The filter does not take parameters.
  2402. @anchor{format}
  2403. @section format
  2404. Convert the input video to one of the specified pixel formats.
  2405. Libavfilter will try to pick one that is supported for the input to
  2406. the next filter.
  2407. The filter accepts a list of pixel format names, separated by ":",
  2408. for example "yuv420p:monow:rgb24".
  2409. @subsection Examples
  2410. @itemize
  2411. @item
  2412. Convert the input video to the format @var{yuv420p}
  2413. @example
  2414. format=yuv420p
  2415. @end example
  2416. Convert the input video to any of the formats in the list
  2417. @example
  2418. format=yuv420p:yuv444p:yuv410p
  2419. @end example
  2420. @end itemize
  2421. @section fps
  2422. Convert the video to specified constant framerate by duplicating or dropping
  2423. frames as necessary.
  2424. This filter accepts the following named parameters:
  2425. @table @option
  2426. @item fps
  2427. Desired output framerate. The default is @code{25}.
  2428. @item round
  2429. Rounding method.
  2430. Possible values are:
  2431. @table @option
  2432. @item zero
  2433. zero round towards 0
  2434. @item inf
  2435. round away from 0
  2436. @item down
  2437. round towards -infinity
  2438. @item up
  2439. round towards +infinity
  2440. @item near
  2441. round to nearest
  2442. @end table
  2443. The default is @code{near}.
  2444. @end table
  2445. Alternatively, the options can be specified as a flat string:
  2446. @var{fps}[:@var{round}].
  2447. See also the @ref{setpts} filter.
  2448. @section framestep
  2449. Select one frame every N.
  2450. This filter accepts in input a string representing a positive
  2451. integer. Default argument is @code{1}.
  2452. @anchor{frei0r}
  2453. @section frei0r
  2454. Apply a frei0r effect to the input video.
  2455. To enable compilation of this filter you need to install the frei0r
  2456. header and configure FFmpeg with @code{--enable-frei0r}.
  2457. The filter supports the syntax:
  2458. @example
  2459. @var{filter_name}[@{:|=@}@var{param1}:@var{param2}:...:@var{paramN}]
  2460. @end example
  2461. @var{filter_name} is the name of the frei0r effect to load. If the
  2462. environment variable @env{FREI0R_PATH} is defined, the frei0r effect
  2463. is searched in each one of the directories specified by the colon (or
  2464. semicolon on Windows platforms) separated list in @env{FREIOR_PATH},
  2465. otherwise in the standard frei0r paths, which are in this order:
  2466. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  2467. @file{/usr/lib/frei0r-1/}.
  2468. @var{param1}, @var{param2}, ... , @var{paramN} specify the parameters
  2469. for the frei0r effect.
  2470. A frei0r effect parameter can be a boolean (whose values are specified
  2471. with "y" and "n"), a double, a color (specified by the syntax
  2472. @var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
  2473. numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
  2474. description), a position (specified by the syntax @var{X}/@var{Y},
  2475. @var{X} and @var{Y} being float numbers) and a string.
  2476. The number and kind of parameters depend on the loaded effect. If an
  2477. effect parameter is not specified the default value is set.
  2478. @subsection Examples
  2479. @itemize
  2480. @item
  2481. Apply the distort0r effect, set the first two double parameters:
  2482. @example
  2483. frei0r=distort0r:0.5:0.01
  2484. @end example
  2485. @item
  2486. Apply the colordistance effect, take a color as first parameter:
  2487. @example
  2488. frei0r=colordistance:0.2/0.3/0.4
  2489. frei0r=colordistance:violet
  2490. frei0r=colordistance:0x112233
  2491. @end example
  2492. @item
  2493. Apply the perspective effect, specify the top left and top right image
  2494. positions:
  2495. @example
  2496. frei0r=perspective:0.2/0.2:0.8/0.2
  2497. @end example
  2498. @end itemize
  2499. For more information see:
  2500. @url{http://frei0r.dyne.org}
  2501. @section geq
  2502. The filter takes one, two, three or four equations as parameter, separated by ':'.
  2503. The first equation is mandatory and applies to the luma plane. The two
  2504. following are respectively for chroma blue and chroma red planes.
  2505. The filter syntax allows named parameters:
  2506. @table @option
  2507. @item lum_expr
  2508. the luminance expression
  2509. @item cb_expr
  2510. the chrominance blue expression
  2511. @item cr_expr
  2512. the chrominance red expression
  2513. @item alpha_expr
  2514. the alpha expression
  2515. @end table
  2516. If one of the chrominance expression is not defined, it falls back on the other
  2517. one. If no alpha expression is specified it will evaluate to opaque value.
  2518. If none of chrominance expressions are
  2519. specified, they will evaluate the luminance expression.
  2520. The expressions can use the following variables and functions:
  2521. @table @option
  2522. @item N
  2523. The sequential number of the filtered frame, starting from @code{0}.
  2524. @item X, Y
  2525. The coordinates of the current sample.
  2526. @item W, H
  2527. The width and height of the image.
  2528. @item SW, SH
  2529. Width and height scale depending on the currently filtered plane. It is the
  2530. ratio between the corresponding luma plane number of pixels and the current
  2531. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  2532. @code{0.5,0.5} for chroma planes.
  2533. @item T
  2534. Time of the current frame, expressed in seconds.
  2535. @item p(x, y)
  2536. Return the value of the pixel at location (@var{x},@var{y}) of the current
  2537. plane.
  2538. @item lum(x, y)
  2539. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  2540. plane.
  2541. @item cb(x, y)
  2542. Return the value of the pixel at location (@var{x},@var{y}) of the
  2543. blue-difference chroma plane. Returns 0 if there is no such plane.
  2544. @item cr(x, y)
  2545. Return the value of the pixel at location (@var{x},@var{y}) of the
  2546. red-difference chroma plane. Returns 0 if there is no such plane.
  2547. @item alpha(x, y)
  2548. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  2549. plane. Returns 0 if there is no such plane.
  2550. @end table
  2551. For functions, if @var{x} and @var{y} are outside the area, the value will be
  2552. automatically clipped to the closer edge.
  2553. @subsection Examples
  2554. @itemize
  2555. @item
  2556. Flip the image horizontally:
  2557. @example
  2558. geq=p(W-X\,Y)
  2559. @end example
  2560. @item
  2561. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  2562. wavelength of 100 pixels:
  2563. @example
  2564. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  2565. @end example
  2566. @item
  2567. Generate a fancy enigmatic moving light:
  2568. @example
  2569. 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
  2570. @end example
  2571. @end itemize
  2572. @section gradfun
  2573. Fix the banding artifacts that are sometimes introduced into nearly flat
  2574. regions by truncation to 8bit color depth.
  2575. Interpolate the gradients that should go where the bands are, and
  2576. dither them.
  2577. This filter is designed for playback only. Do not use it prior to
  2578. lossy compression, because compression tends to lose the dither and
  2579. bring back the bands.
  2580. The filter accepts a list of options in the form of @var{key}=@var{value} pairs
  2581. separated by ":". A description of the accepted options follows.
  2582. @table @option
  2583. @item strength
  2584. The maximum amount by which the filter will change
  2585. any one pixel. Also the threshold for detecting nearly flat
  2586. regions. Acceptable values range from @code{0.51} to @code{64}, default value
  2587. is @code{1.2}.
  2588. @item radius
  2589. The neighborhood to fit the gradient to. A larger
  2590. radius makes for smoother gradients, but also prevents the filter from
  2591. modifying the pixels near detailed regions. Acceptable values are
  2592. @code{8-32}, default value is @code{16}.
  2593. @end table
  2594. Alternatively, the options can be specified as a flat string:
  2595. @var{strength}[:@var{radius}]
  2596. @subsection Examples
  2597. @itemize
  2598. @item
  2599. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  2600. @example
  2601. gradfun=3.5:8
  2602. @end example
  2603. @item
  2604. Specify radius, omitting the strength (which will fall-back to the default
  2605. value):
  2606. @example
  2607. gradfun=radius=8
  2608. @end example
  2609. @end itemize
  2610. @section hflip
  2611. Flip the input video horizontally.
  2612. For example to horizontally flip the input video with @command{ffmpeg}:
  2613. @example
  2614. ffmpeg -i in.avi -vf "hflip" out.avi
  2615. @end example
  2616. @section histeq
  2617. This filter applies a global color histogram equalization on a
  2618. per-frame basis.
  2619. It can be used to correct video that has a compressed range of pixel
  2620. intensities. The filter redistributes the pixel intensities to
  2621. equalize their distribution across the intensity range. It may be
  2622. viewed as an "automatically adjusting contrast filter". This filter is
  2623. useful only for correcting degraded or poorly captured source
  2624. video.
  2625. The filter accepts parameters as a list of @var{key}=@var{value}
  2626. pairs, separated by ":". If the key of the first options is omitted,
  2627. the arguments are interpreted according to syntax
  2628. @var{strength}:@var{intensity}:@var{antibanding}.
  2629. This filter accepts the following named options:
  2630. @table @option
  2631. @item strength
  2632. Determine the amount of equalization to be applied. As the strength
  2633. is reduced, the distribution of pixel intensities more-and-more
  2634. approaches that of the input frame. The value must be a float number
  2635. in the range [0,1] and defaults to 0.200.
  2636. @item intensity
  2637. Set the maximum intensity that can generated and scale the output
  2638. values appropriately. The strength should be set as desired and then
  2639. the intensity can be limited if needed to avoid washing-out. The value
  2640. must be a float number in the range [0,1] and defaults to 0.210.
  2641. @item antibanding
  2642. Set the antibanding level. If enabled the filter will randomly vary
  2643. the luminance of output pixels by a small amount to avoid banding of
  2644. the histogram. Possible values are @code{none}, @code{weak} or
  2645. @code{strong}. It defaults to @code{none}.
  2646. @end table
  2647. @section histogram
  2648. Compute and draw a color distribution histogram for the input video.
  2649. The computed histogram is a representation of distribution of color components
  2650. in an image.
  2651. The filter accepts the following named parameters:
  2652. @table @option
  2653. @item mode
  2654. Set histogram mode.
  2655. It accepts the following values:
  2656. @table @samp
  2657. @item levels
  2658. standard histogram that display color components distribution in an image.
  2659. Displays color graph for each color component. Shows distribution
  2660. of the Y, U, V, A or G, B, R components, depending on input format,
  2661. in current frame. Bellow each graph is color component scale meter.
  2662. @item color
  2663. chroma values in vectorscope, if brighter more such chroma values are
  2664. distributed in an image.
  2665. Displays chroma values (U/V color placement) in two dimensional graph
  2666. (which is called a vectorscope). It can be used to read of the hue and
  2667. saturation of the current frame. At a same time it is a histogram.
  2668. The whiter a pixel in the vectorscope, the more pixels of the input frame
  2669. correspond to that pixel (that is the more pixels have this chroma value).
  2670. The V component is displayed on the horizontal (X) axis, with the leftmost
  2671. side being V = 0 and the rightmost side being V = 255.
  2672. The U component is displayed on the vertical (Y) axis, with the top
  2673. representing U = 0 and the bottom representing U = 255.
  2674. The position of a white pixel in the graph corresponds to the chroma value
  2675. of a pixel of the input clip. So the graph can be used to read of the
  2676. hue (color flavor) and the saturation (the dominance of the hue in the color).
  2677. As the hue of a color changes, it moves around the square. At the center of
  2678. the square, the saturation is zero, which means that the corresponding pixel
  2679. has no color. If you increase the amount of a specific color, while leaving
  2680. the other colors unchanged, the saturation increases, and you move towards
  2681. the edge of the square.
  2682. @item color2
  2683. chroma values in vectorscope, similar as @code{color} but actual chroma values
  2684. are displayed.
  2685. @item waveform
  2686. per row/column color component graph. In row mode graph in the left side represents
  2687. color component value 0 and right side represents value = 255. In column mode top
  2688. side represents color component value = 0 and bottom side represents value = 255.
  2689. @end table
  2690. Default value is @code{levels}.
  2691. @item level_height
  2692. Set height of level in @code{levels}. Default value is @code{200}.
  2693. Allowed range is [50, 2048].
  2694. @item scale_height
  2695. Set height of color scale in @code{levels}. Default value is @code{12}.
  2696. Allowed range is [0, 40].
  2697. @item step
  2698. Set step for @code{waveform} mode. Smaller values are useful to find out how much
  2699. of same luminance values across input rows/columns are distributed.
  2700. Default value is @code{10}. Allowed range is [1, 255].
  2701. @item waveform_mode
  2702. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  2703. Default is @code{row}.
  2704. @item display_mode
  2705. Set display mode for @code{waveform} and @code{levels}.
  2706. It accepts the following values:
  2707. @table @samp
  2708. @item parade
  2709. Display separate graph for the color components side by side in
  2710. @code{row} waveform mode or one below other in @code{column} waveform mode
  2711. for @code{waveform} histogram mode. For @code{levels} histogram mode
  2712. per color component graphs are placed one bellow other.
  2713. This display mode in @code{waveform} histogram mode makes it easy to spot
  2714. color casts in the highlights and shadows of an image, by comparing the
  2715. contours of the top and the bottom of each waveform.
  2716. Since whites, grays, and blacks are characterized by
  2717. exactly equal amounts of red, green, and blue, neutral areas of the
  2718. picture should display three waveforms of roughly equal width/height.
  2719. If not, the correction is easy to make by making adjustments to level the
  2720. three waveforms.
  2721. @item overlay
  2722. Presents information that's identical to that in the @code{parade}, except
  2723. that the graphs representing color components are superimposed directly
  2724. over one another.
  2725. This display mode in @code{waveform} histogram mode can make it easier to spot
  2726. the relative differences or similarities in overlapping areas of the color
  2727. components that are supposed to be identical, such as neutral whites, grays,
  2728. or blacks.
  2729. @end table
  2730. Default is @code{parade}.
  2731. @end table
  2732. @subsection Examples
  2733. @itemize
  2734. @item
  2735. Calculate and draw histogram:
  2736. @example
  2737. ffplay -i input -vf histogram
  2738. @end example
  2739. @end itemize
  2740. @section hqdn3d
  2741. High precision/quality 3d denoise filter. This filter aims to reduce
  2742. image noise producing smooth images and making still images really
  2743. still. It should enhance compressibility.
  2744. It accepts the following optional parameters:
  2745. @var{luma_spatial}:@var{chroma_spatial}:@var{luma_tmp}:@var{chroma_tmp}
  2746. @table @option
  2747. @item luma_spatial
  2748. a non-negative float number which specifies spatial luma strength,
  2749. defaults to 4.0
  2750. @item chroma_spatial
  2751. a non-negative float number which specifies spatial chroma strength,
  2752. defaults to 3.0*@var{luma_spatial}/4.0
  2753. @item luma_tmp
  2754. a float number which specifies luma temporal strength, defaults to
  2755. 6.0*@var{luma_spatial}/4.0
  2756. @item chroma_tmp
  2757. a float number which specifies chroma temporal strength, defaults to
  2758. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
  2759. @end table
  2760. @section hue
  2761. Modify the hue and/or the saturation of the input.
  2762. This filter accepts the following optional named options:
  2763. @table @option
  2764. @item h
  2765. Specify the hue angle as a number of degrees. It accepts a float
  2766. number or an expression, and defaults to 0.0.
  2767. @item H
  2768. Specify the hue angle as a number of radians. It accepts a float
  2769. number or an expression, and defaults to 0.0.
  2770. @item s
  2771. Specify the saturation in the [-10,10] range. It accepts a float number and
  2772. defaults to 1.0.
  2773. @end table
  2774. The @var{h}, @var{H} and @var{s} parameters are expressions containing the
  2775. following constants:
  2776. @table @option
  2777. @item n
  2778. frame count of the input frame starting from 0
  2779. @item pts
  2780. presentation timestamp of the input frame expressed in time base units
  2781. @item r
  2782. frame rate of the input video, NAN if the input frame rate is unknown
  2783. @item t
  2784. timestamp expressed in seconds, NAN if the input timestamp is unknown
  2785. @item tb
  2786. time base of the input video
  2787. @end table
  2788. The options can also be set using the syntax: @var{hue}:@var{saturation}
  2789. In this case @var{hue} is expressed in degrees.
  2790. @subsection Examples
  2791. @itemize
  2792. @item
  2793. Set the hue to 90 degrees and the saturation to 1.0:
  2794. @example
  2795. hue=h=90:s=1
  2796. @end example
  2797. @item
  2798. Same command but expressing the hue in radians:
  2799. @example
  2800. hue=H=PI/2:s=1
  2801. @end example
  2802. @item
  2803. Same command without named options, hue must be expressed in degrees:
  2804. @example
  2805. hue=90:1
  2806. @end example
  2807. @item
  2808. Note that "h:s" syntax does not support expressions for the values of
  2809. h and s, so the following example will issue an error:
  2810. @example
  2811. hue=PI/2:1
  2812. @end example
  2813. @item
  2814. Rotate hue and make the saturation swing between 0
  2815. and 2 over a period of 1 second:
  2816. @example
  2817. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  2818. @end example
  2819. @item
  2820. Apply a 3 seconds saturation fade-in effect starting at 0:
  2821. @example
  2822. hue="s=min(t/3\,1)"
  2823. @end example
  2824. The general fade-in expression can be written as:
  2825. @example
  2826. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  2827. @end example
  2828. @item
  2829. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  2830. @example
  2831. hue="s=max(0\, min(1\, (8-t)/3))"
  2832. @end example
  2833. The general fade-out expression can be written as:
  2834. @example
  2835. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  2836. @end example
  2837. @end itemize
  2838. @subsection Commands
  2839. This filter supports the following command:
  2840. @table @option
  2841. @item reinit
  2842. Modify the hue and/or the saturation of the input video.
  2843. The command accepts the same named options and syntax than when calling the
  2844. filter from the command-line.
  2845. If a parameter is omitted, it is kept at its current value.
  2846. @end table
  2847. @section idet
  2848. Detect video interlacing type.
  2849. This filter tries to detect if the input is interlaced or progressive,
  2850. top or bottom field first.
  2851. @section il
  2852. Deinterleave or interleave fields.
  2853. This filter allows to process interlaced images fields without
  2854. deinterlacing them. Deinterleaving splits the input frame into 2
  2855. fields (so called half pictures). Odd lines are moved to the top
  2856. half of the output image, even lines to the bottom half.
  2857. You can process (filter) them independently and then re-interleave them.
  2858. It accepts a list of options in the form of @var{key}=@var{value} pairs
  2859. separated by ":". A description of the accepted options follows.
  2860. @table @option
  2861. @item luma_mode, l
  2862. @item chroma_mode, s
  2863. @item alpha_mode, a
  2864. Available values for @var{luma_mode}, @var{chroma_mode} and
  2865. @var{alpha_mode} are:
  2866. @table @samp
  2867. @item none
  2868. Do nothing.
  2869. @item deinterleave, d
  2870. Deinterleave fields, placing one above the other.
  2871. @item interleave, i
  2872. Interleave fields. Reverse the effect of deinterleaving.
  2873. @end table
  2874. Default value is @code{none}.
  2875. @item luma_swap, ls
  2876. @item chroma_swap, cs
  2877. @item alpha_swap, as
  2878. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  2879. @end table
  2880. @section kerndeint
  2881. Deinterlace input video by applying Donald Graft's adaptive kernel
  2882. deinterling. Work on interlaced parts of a video to produce
  2883. progressive frames.
  2884. This filter accepts parameters as a list of @var{key}=@var{value}
  2885. pairs, separated by ":". If the key of the first options is omitted,
  2886. the arguments are interpreted according to the following syntax:
  2887. @var{thresh}:@var{map}:@var{order}:@var{sharp}:@var{twoway}.
  2888. The description of the accepted parameters follows.
  2889. @table @option
  2890. @item thresh
  2891. Set the threshold which affects the filter's tolerance when
  2892. determining if a pixel line must be processed. It must be an integer
  2893. in the range [0,255] and defaults to 10. A value of 0 will result in
  2894. applying the process on every pixels.
  2895. @item map
  2896. Paint pixels exceeding the threshold value to white if set to 1.
  2897. Default is 0.
  2898. @item order
  2899. Set the fields order. Swap fields if set to 1, leave fields alone if
  2900. 0. Default is 0.
  2901. @item sharp
  2902. Enable additional sharpening if set to 1. Default is 0.
  2903. @item twoway
  2904. Enable twoway sharpening if set to 1. Default is 0.
  2905. @end table
  2906. @subsection Examples
  2907. @itemize
  2908. @item
  2909. Apply default values:
  2910. @example
  2911. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  2912. @end example
  2913. @item
  2914. Enable additional sharpening:
  2915. @example
  2916. kerndeint=sharp=1
  2917. @end example
  2918. @item
  2919. Paint processed pixels in white:
  2920. @example
  2921. kerndeint=map=1
  2922. @end example
  2923. @end itemize
  2924. @section lut, lutrgb, lutyuv
  2925. Compute a look-up table for binding each pixel component input value
  2926. to an output value, and apply it to input video.
  2927. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  2928. to an RGB input video.
  2929. These filters accept in input a ":"-separated list of options, which
  2930. specify the expressions used for computing the lookup table for the
  2931. corresponding pixel component values.
  2932. The @var{lut} filter requires either YUV or RGB pixel formats in
  2933. input, and accepts the options:
  2934. @table @option
  2935. @item c0
  2936. set first pixel component expression
  2937. @item c1
  2938. set second pixel component expression
  2939. @item c2
  2940. set third pixel component expression
  2941. @item c3
  2942. set fourth pixel component expression, corresponds to the alpha component
  2943. @end table
  2944. The exact component associated to each option depends on the format in
  2945. input.
  2946. The @var{lutrgb} filter requires RGB pixel formats in input, and
  2947. accepts the options:
  2948. @table @option
  2949. @item r
  2950. set red component expression
  2951. @item g
  2952. set green component expression
  2953. @item b
  2954. set blue component expression
  2955. @item a
  2956. alpha component expression
  2957. @end table
  2958. The @var{lutyuv} filter requires YUV pixel formats in input, and
  2959. accepts the options:
  2960. @table @option
  2961. @item y
  2962. set Y/luminance component expression
  2963. @item u
  2964. set U/Cb component expression
  2965. @item v
  2966. set V/Cr component expression
  2967. @item a
  2968. set alpha component expression
  2969. @end table
  2970. The expressions can contain the following constants and functions:
  2971. @table @option
  2972. @item w, h
  2973. the input width and height
  2974. @item val
  2975. input value for the pixel component
  2976. @item clipval
  2977. the input value clipped in the @var{minval}-@var{maxval} range
  2978. @item maxval
  2979. maximum value for the pixel component
  2980. @item minval
  2981. minimum value for the pixel component
  2982. @item negval
  2983. the negated value for the pixel component value clipped in the
  2984. @var{minval}-@var{maxval} range , it corresponds to the expression
  2985. "maxval-clipval+minval"
  2986. @item clip(val)
  2987. the computed value in @var{val} clipped in the
  2988. @var{minval}-@var{maxval} range
  2989. @item gammaval(gamma)
  2990. the computed gamma correction value of the pixel component value
  2991. clipped in the @var{minval}-@var{maxval} range, corresponds to the
  2992. expression
  2993. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  2994. @end table
  2995. All expressions default to "val".
  2996. @subsection Examples
  2997. @itemize
  2998. @item
  2999. Negate input video:
  3000. @example
  3001. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  3002. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  3003. @end example
  3004. The above is the same as:
  3005. @example
  3006. lutrgb="r=negval:g=negval:b=negval"
  3007. lutyuv="y=negval:u=negval:v=negval"
  3008. @end example
  3009. @item
  3010. Negate luminance:
  3011. @example
  3012. lutyuv=y=negval
  3013. @end example
  3014. @item
  3015. Remove chroma components, turns the video into a graytone image:
  3016. @example
  3017. lutyuv="u=128:v=128"
  3018. @end example
  3019. @item
  3020. Apply a luma burning effect:
  3021. @example
  3022. lutyuv="y=2*val"
  3023. @end example
  3024. @item
  3025. Remove green and blue components:
  3026. @example
  3027. lutrgb="g=0:b=0"
  3028. @end example
  3029. @item
  3030. Set a constant alpha channel value on input:
  3031. @example
  3032. format=rgba,lutrgb=a="maxval-minval/2"
  3033. @end example
  3034. @item
  3035. Correct luminance gamma by a 0.5 factor:
  3036. @example
  3037. lutyuv=y=gammaval(0.5)
  3038. @end example
  3039. @item
  3040. Discard least significant bits of luma:
  3041. @example
  3042. lutyuv=y='bitand(val, 128+64+32)'
  3043. @end example
  3044. @end itemize
  3045. @section mp
  3046. Apply an MPlayer filter to the input video.
  3047. This filter provides a wrapper around most of the filters of
  3048. MPlayer/MEncoder.
  3049. This wrapper is considered experimental. Some of the wrapped filters
  3050. may not work properly and we may drop support for them, as they will
  3051. be implemented natively into FFmpeg. Thus you should avoid
  3052. depending on them when writing portable scripts.
  3053. The filters accepts the parameters:
  3054. @var{filter_name}[:=]@var{filter_params}
  3055. @var{filter_name} is the name of a supported MPlayer filter,
  3056. @var{filter_params} is a string containing the parameters accepted by
  3057. the named filter.
  3058. The list of the currently supported filters follows:
  3059. @table @var
  3060. @item detc
  3061. @item dint
  3062. @item divtc
  3063. @item down3dright
  3064. @item eq2
  3065. @item eq
  3066. @item fil
  3067. @item fspp
  3068. @item ilpack
  3069. @item ivtc
  3070. @item mcdeint
  3071. @item ow
  3072. @item perspective
  3073. @item phase
  3074. @item pp7
  3075. @item pullup
  3076. @item qp
  3077. @item sab
  3078. @item softpulldown
  3079. @item spp
  3080. @item telecine
  3081. @item tinterlace
  3082. @item uspp
  3083. @end table
  3084. The parameter syntax and behavior for the listed filters are the same
  3085. of the corresponding MPlayer filters. For detailed instructions check
  3086. the "VIDEO FILTERS" section in the MPlayer manual.
  3087. @subsection Examples
  3088. @itemize
  3089. @item
  3090. Adjust gamma, brightness, contrast:
  3091. @example
  3092. mp=eq2=1.0:2:0.5
  3093. @end example
  3094. @end itemize
  3095. See also mplayer(1), @url{http://www.mplayerhq.hu/}.
  3096. @section negate
  3097. Negate input video.
  3098. This filter accepts an integer in input, if non-zero it negates the
  3099. alpha component (if available). The default value in input is 0.
  3100. @section noformat
  3101. Force libavfilter not to use any of the specified pixel formats for the
  3102. input to the next filter.
  3103. The filter accepts a list of pixel format names, separated by ":",
  3104. for example "yuv420p:monow:rgb24".
  3105. @subsection Examples
  3106. @itemize
  3107. @item
  3108. Force libavfilter to use a format different from @var{yuv420p} for the
  3109. input to the vflip filter:
  3110. @example
  3111. noformat=yuv420p,vflip
  3112. @end example
  3113. @item
  3114. Convert the input video to any of the formats not contained in the list:
  3115. @example
  3116. noformat=yuv420p:yuv444p:yuv410p
  3117. @end example
  3118. @end itemize
  3119. @section noise
  3120. Add noise on video input frame.
  3121. This filter accepts a list of options in the form of @var{key}=@var{value}
  3122. pairs separated by ":". A description of the accepted options follows.
  3123. @table @option
  3124. @item all_seed
  3125. @item c0_seed
  3126. @item c1_seed
  3127. @item c2_seed
  3128. @item c3_seed
  3129. Set noise seed for specific pixel component or all pixel components in case
  3130. of @var{all_seed}. Default value is @code{123457}.
  3131. @item all_strength, alls
  3132. @item c0_strength, c0s
  3133. @item c1_strength, c1s
  3134. @item c2_strength, c2s
  3135. @item c3_strength, c3s
  3136. Set noise strength for specific pixel component or all pixel components in case
  3137. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  3138. @item all_flags, allf
  3139. @item c0_flags, c0f
  3140. @item c1_flags, c1f
  3141. @item c2_flags, c2f
  3142. @item c3_flags, c3f
  3143. Set pixel component flags or set flags for all components if @var{all_flags}.
  3144. Available values for component flags are:
  3145. @table @samp
  3146. @item a
  3147. averaged temporal noise (smoother)
  3148. @item p
  3149. mix random noise with a (semi)regular pattern
  3150. @item q
  3151. higher quality (slightly better looking, slightly slower)
  3152. @item t
  3153. temporal noise (noise pattern changes between frames)
  3154. @item u
  3155. uniform noise (gaussian otherwise)
  3156. @end table
  3157. @end table
  3158. @subsection Examples
  3159. Add temporal and uniform noise to input video:
  3160. @example
  3161. noise=alls=20:allf=t+u
  3162. @end example
  3163. @section null
  3164. Pass the video source unchanged to the output.
  3165. @section ocv
  3166. Apply video transform using libopencv.
  3167. To enable this filter install libopencv library and headers and
  3168. configure FFmpeg with @code{--enable-libopencv}.
  3169. The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}.
  3170. @var{filter_name} is the name of the libopencv filter to apply.
  3171. @var{filter_params} specifies the parameters to pass to the libopencv
  3172. filter. If not specified the default values are assumed.
  3173. Refer to the official libopencv documentation for more precise
  3174. information:
  3175. @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
  3176. Follows the list of supported libopencv filters.
  3177. @anchor{dilate}
  3178. @subsection dilate
  3179. Dilate an image by using a specific structuring element.
  3180. This filter corresponds to the libopencv function @code{cvDilate}.
  3181. It accepts the parameters: @var{struct_el}:@var{nb_iterations}.
  3182. @var{struct_el} represents a structuring element, and has the syntax:
  3183. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  3184. @var{cols} and @var{rows} represent the number of columns and rows of
  3185. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  3186. point, and @var{shape} the shape for the structuring element, and
  3187. can be one of the values "rect", "cross", "ellipse", "custom".
  3188. If the value for @var{shape} is "custom", it must be followed by a
  3189. string of the form "=@var{filename}". The file with name
  3190. @var{filename} is assumed to represent a binary image, with each
  3191. printable character corresponding to a bright pixel. When a custom
  3192. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  3193. or columns and rows of the read file are assumed instead.
  3194. The default value for @var{struct_el} is "3x3+0x0/rect".
  3195. @var{nb_iterations} specifies the number of times the transform is
  3196. applied to the image, and defaults to 1.
  3197. Follow some example:
  3198. @example
  3199. # use the default values
  3200. ocv=dilate
  3201. # dilate using a structuring element with a 5x5 cross, iterate two times
  3202. ocv=dilate=5x5+2x2/cross:2
  3203. # read the shape from the file diamond.shape, iterate two times
  3204. # the file diamond.shape may contain a pattern of characters like this:
  3205. # *
  3206. # ***
  3207. # *****
  3208. # ***
  3209. # *
  3210. # the specified cols and rows are ignored (but not the anchor point coordinates)
  3211. ocv=0x0+2x2/custom=diamond.shape:2
  3212. @end example
  3213. @subsection erode
  3214. Erode an image by using a specific structuring element.
  3215. This filter corresponds to the libopencv function @code{cvErode}.
  3216. The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
  3217. with the same syntax and semantics as the @ref{dilate} filter.
  3218. @subsection smooth
  3219. Smooth the input video.
  3220. The filter takes the following parameters:
  3221. @var{type}:@var{param1}:@var{param2}:@var{param3}:@var{param4}.
  3222. @var{type} is the type of smooth filter to apply, and can be one of
  3223. the following values: "blur", "blur_no_scale", "median", "gaussian",
  3224. "bilateral". The default value is "gaussian".
  3225. @var{param1}, @var{param2}, @var{param3}, and @var{param4} are
  3226. parameters whose meanings depend on smooth type. @var{param1} and
  3227. @var{param2} accept integer positive values or 0, @var{param3} and
  3228. @var{param4} accept float values.
  3229. The default value for @var{param1} is 3, the default value for the
  3230. other parameters is 0.
  3231. These parameters correspond to the parameters assigned to the
  3232. libopencv function @code{cvSmooth}.
  3233. @anchor{overlay}
  3234. @section overlay
  3235. Overlay one video on top of another.
  3236. It takes two inputs and one output, the first input is the "main"
  3237. video on which the second input is overlayed.
  3238. This filter accepts a list of @var{key}=@var{value} pairs as argument,
  3239. separated by ":". If the key of the first options is omitted, the
  3240. arguments are interpreted according to the syntax @var{x}:@var{y}.
  3241. A description of the accepted options follows.
  3242. @table @option
  3243. @item x, y
  3244. Set the expression for the x and y coordinates of the overlayed video
  3245. on the main video. Default value is 0.
  3246. The @var{x} and @var{y} expressions can contain the following
  3247. parameters:
  3248. @table @option
  3249. @item main_w, main_h
  3250. main input width and height
  3251. @item W, H
  3252. same as @var{main_w} and @var{main_h}
  3253. @item overlay_w, overlay_h
  3254. overlay input width and height
  3255. @item w, h
  3256. same as @var{overlay_w} and @var{overlay_h}
  3257. @end table
  3258. @item format
  3259. Set the format for the output video.
  3260. It accepts the following values:
  3261. @table @samp
  3262. @item yuv420
  3263. force YUV420 output
  3264. @item yuv444
  3265. force YUV444 output
  3266. @item rgb
  3267. force RGB output
  3268. @end table
  3269. Default value is @samp{yuv420}.
  3270. @item rgb @emph{(deprecated)}
  3271. If set to 1, force the filter to accept inputs in the RGB
  3272. color space. Default value is 0. This option is deprecated, use
  3273. @option{format} instead.
  3274. @item shortest
  3275. If set to 1, force the output to terminate when the shortest input
  3276. terminates. Default value is 0.
  3277. @end table
  3278. Be aware that frames are taken from each input video in timestamp
  3279. order, hence, if their initial timestamps differ, it is a a good idea
  3280. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  3281. have them begin in the same zero timestamp, as it does the example for
  3282. the @var{movie} filter.
  3283. You can chain together more overlays but you should test the
  3284. efficiency of such approach.
  3285. @subsection Examples
  3286. @itemize
  3287. @item
  3288. Draw the overlay at 10 pixels from the bottom right corner of the main
  3289. video:
  3290. @example
  3291. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  3292. @end example
  3293. Using named options the example above becomes:
  3294. @example
  3295. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  3296. @end example
  3297. @item
  3298. Insert a transparent PNG logo in the bottom left corner of the input,
  3299. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  3300. @example
  3301. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  3302. @end example
  3303. @item
  3304. Insert 2 different transparent PNG logos (second logo on bottom
  3305. right corner) using the @command{ffmpeg} tool:
  3306. @example
  3307. ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=10:H-h-10,overlay=W-w-10:H-h-10' output
  3308. @end example
  3309. @item
  3310. Add a transparent color layer on top of the main video, WxH specifies
  3311. the size of the main input to the overlay filter:
  3312. @example
  3313. color=red@@.3:WxH [over]; [in][over] overlay [out]
  3314. @end example
  3315. @item
  3316. Play an original video and a filtered version (here with the deshake
  3317. filter) side by side using the @command{ffplay} tool:
  3318. @example
  3319. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  3320. @end example
  3321. The above command is the same as:
  3322. @example
  3323. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  3324. @end example
  3325. @item
  3326. Compose output by putting two input videos side to side:
  3327. @example
  3328. ffmpeg -i left.avi -i right.avi -filter_complex "
  3329. nullsrc=size=200x100 [background];
  3330. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  3331. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  3332. [background][left] overlay=shortest=1 [background+left];
  3333. [background+left][right] overlay=shortest=1:x=100 [left+right]
  3334. "
  3335. @end example
  3336. @item
  3337. Chain several overlays in cascade:
  3338. @example
  3339. nullsrc=s=200x200 [bg];
  3340. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  3341. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  3342. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  3343. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  3344. [in3] null, [mid2] overlay=100:100 [out0]
  3345. @end example
  3346. @end itemize
  3347. @section pad
  3348. Add paddings to the input image, and place the original input at the
  3349. given coordinates @var{x}, @var{y}.
  3350. The filter accepts parameters as a list of @var{key}=@var{value} pairs,
  3351. separated by ":".
  3352. If the key of the first options is omitted, the arguments are
  3353. interpreted according to the syntax
  3354. @var{width}:@var{height}:@var{x}:@var{y}:@var{color}.
  3355. A description of the accepted options follows.
  3356. @table @option
  3357. @item width, w
  3358. @item height, h
  3359. Specify an expression for the size of the output image with the
  3360. paddings added. If the value for @var{width} or @var{height} is 0, the
  3361. corresponding input size is used for the output.
  3362. The @var{width} expression can reference the value set by the
  3363. @var{height} expression, and vice versa.
  3364. The default value of @var{width} and @var{height} is 0.
  3365. @item x
  3366. @item y
  3367. Specify an expression for the offsets where to place the input image
  3368. in the padded area with respect to the top/left border of the output
  3369. image.
  3370. The @var{x} expression can reference the value set by the @var{y}
  3371. expression, and vice versa.
  3372. The default value of @var{x} and @var{y} is 0.
  3373. @item color
  3374. Specify the color of the padded area, it can be the name of a color
  3375. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  3376. The default value of @var{color} is "black".
  3377. @end table
  3378. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  3379. options are expressions containing the following constants:
  3380. @table @option
  3381. @item in_w, in_h
  3382. the input video width and height
  3383. @item iw, ih
  3384. same as @var{in_w} and @var{in_h}
  3385. @item out_w, out_h
  3386. the output width and height, that is the size of the padded area as
  3387. specified by the @var{width} and @var{height} expressions
  3388. @item ow, oh
  3389. same as @var{out_w} and @var{out_h}
  3390. @item x, y
  3391. x and y offsets as specified by the @var{x} and @var{y}
  3392. expressions, or NAN if not yet specified
  3393. @item a
  3394. same as @var{iw} / @var{ih}
  3395. @item sar
  3396. input sample aspect ratio
  3397. @item dar
  3398. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3399. @item hsub, vsub
  3400. horizontal and vertical chroma subsample values. For example for the
  3401. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3402. @end table
  3403. @subsection Examples
  3404. @itemize
  3405. @item
  3406. Add paddings with color "violet" to the input video. Output video
  3407. size is 640x480, the top-left corner of the input video is placed at
  3408. column 0, row 40:
  3409. @example
  3410. pad=640:480:0:40:violet
  3411. @end example
  3412. The example above is equivalent to the following command:
  3413. @example
  3414. pad=width=640:height=480:x=0:y=40:color=violet
  3415. @end example
  3416. @item
  3417. Pad the input to get an output with dimensions increased by 3/2,
  3418. and put the input video at the center of the padded area:
  3419. @example
  3420. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  3421. @end example
  3422. @item
  3423. Pad the input to get a squared output with size equal to the maximum
  3424. value between the input width and height, and put the input video at
  3425. the center of the padded area:
  3426. @example
  3427. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  3428. @end example
  3429. @item
  3430. Pad the input to get a final w/h ratio of 16:9:
  3431. @example
  3432. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  3433. @end example
  3434. @item
  3435. In case of anamorphic video, in order to set the output display aspect
  3436. correctly, it is necessary to use @var{sar} in the expression,
  3437. according to the relation:
  3438. @example
  3439. (ih * X / ih) * sar = output_dar
  3440. X = output_dar / sar
  3441. @end example
  3442. Thus the previous example needs to be modified to:
  3443. @example
  3444. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  3445. @end example
  3446. @item
  3447. Double output size and put the input video in the bottom-right
  3448. corner of the output padded area:
  3449. @example
  3450. pad="2*iw:2*ih:ow-iw:oh-ih"
  3451. @end example
  3452. @end itemize
  3453. @section pixdesctest
  3454. Pixel format descriptor test filter, mainly useful for internal
  3455. testing. The output video should be equal to the input video.
  3456. For example:
  3457. @example
  3458. format=monow, pixdesctest
  3459. @end example
  3460. can be used to test the monowhite pixel format descriptor definition.
  3461. @section pp
  3462. Enable the specified chain of postprocessing subfilters using libpostproc. This
  3463. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  3464. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  3465. Each subfilter and some options have a short and a long name that can be used
  3466. interchangeably, i.e. dr/dering are the same.
  3467. All subfilters share common options to determine their scope:
  3468. @table @option
  3469. @item a/autoq
  3470. Honor the quality commands for this subfilter.
  3471. @item c/chrom
  3472. Do chrominance filtering, too (default).
  3473. @item y/nochrom
  3474. Do luminance filtering only (no chrominance).
  3475. @item n/noluma
  3476. Do chrominance filtering only (no luminance).
  3477. @end table
  3478. These options can be appended after the subfilter name, separated by a ':'.
  3479. Available subfilters are:
  3480. @table @option
  3481. @item hb/hdeblock[:difference[:flatness]]
  3482. Horizontal deblocking filter
  3483. @table @option
  3484. @item difference
  3485. Difference factor where higher values mean more deblocking (default: @code{32}).
  3486. @item flatness
  3487. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  3488. @end table
  3489. @item vb/vdeblock[:difference[:flatness]]
  3490. Vertical deblocking filter
  3491. @table @option
  3492. @item difference
  3493. Difference factor where higher values mean more deblocking (default: @code{32}).
  3494. @item flatness
  3495. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  3496. @end table
  3497. @item ha/hadeblock[:difference[:flatness]]
  3498. Accurate horizontal deblocking filter
  3499. @table @option
  3500. @item difference
  3501. Difference factor where higher values mean more deblocking (default: @code{32}).
  3502. @item flatness
  3503. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  3504. @end table
  3505. @item va/vadeblock[:difference[:flatness]]
  3506. Accurate vertical deblocking filter
  3507. @table @option
  3508. @item difference
  3509. Difference factor where higher values mean more deblocking (default: @code{32}).
  3510. @item flatness
  3511. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  3512. @end table
  3513. @end table
  3514. The horizontal and vertical deblocking filters share the difference and
  3515. flatness values so you cannot set different horizontal and vertical
  3516. thresholds.
  3517. @table @option
  3518. @item h1/x1hdeblock
  3519. Experimental horizontal deblocking filter
  3520. @item v1/x1vdeblock
  3521. Experimental vertical deblocking filter
  3522. @item dr/dering
  3523. Deringing filter
  3524. @item tn/tmpnoise[:threshold1[:threshold2[:threshold3]]], temporal noise reducer
  3525. @table @option
  3526. @item threshold1
  3527. larger -> stronger filtering
  3528. @item threshold2
  3529. larger -> stronger filtering
  3530. @item threshold3
  3531. larger -> stronger filtering
  3532. @end table
  3533. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  3534. @table @option
  3535. @item f/fullyrange
  3536. Stretch luminance to @code{0-255}.
  3537. @end table
  3538. @item lb/linblenddeint
  3539. Linear blend deinterlacing filter that deinterlaces the given block by
  3540. filtering all lines with a @code{(1 2 1)} filter.
  3541. @item li/linipoldeint
  3542. Linear interpolating deinterlacing filter that deinterlaces the given block by
  3543. linearly interpolating every second line.
  3544. @item ci/cubicipoldeint
  3545. Cubic interpolating deinterlacing filter deinterlaces the given block by
  3546. cubically interpolating every second line.
  3547. @item md/mediandeint
  3548. Median deinterlacing filter that deinterlaces the given block by applying a
  3549. median filter to every second line.
  3550. @item fd/ffmpegdeint
  3551. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  3552. second line with a @code{(-1 4 2 4 -1)} filter.
  3553. @item l5/lowpass5
  3554. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  3555. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  3556. @item fq/forceQuant[:quantizer]
  3557. Overrides the quantizer table from the input with the constant quantizer you
  3558. specify.
  3559. @table @option
  3560. @item quantizer
  3561. Quantizer to use
  3562. @end table
  3563. @item de/default
  3564. Default pp filter combination (@code{hb:a,vb:a,dr:a})
  3565. @item fa/fast
  3566. Fast pp filter combination (@code{h1:a,v1:a,dr:a})
  3567. @item ac
  3568. High quality pp filter combination (@code{ha:a:128:7,va:a,dr:a})
  3569. @end table
  3570. @subsection Examples
  3571. @itemize
  3572. @item
  3573. Apply horizontal and vertical deblocking, deringing and automatic
  3574. brightness/contrast:
  3575. @example
  3576. pp=hb/vb/dr/al
  3577. @end example
  3578. @item
  3579. Apply default filters without brightness/contrast correction:
  3580. @example
  3581. pp=de/-al
  3582. @end example
  3583. @item
  3584. Apply default filters and temporal denoiser:
  3585. @example
  3586. pp=default/tmpnoise:1:2:3
  3587. @end example
  3588. @item
  3589. Apply deblocking on luminance only, and switch vertical deblocking on or off
  3590. automatically depending on available CPU time:
  3591. @example
  3592. pp=hb:y/vb:a
  3593. @end example
  3594. @end itemize
  3595. @section removelogo
  3596. Suppress a TV station logo, using an image file to determine which
  3597. pixels comprise the logo. It works by filling in the pixels that
  3598. comprise the logo with neighboring pixels.
  3599. This filter requires one argument which specifies the filter bitmap
  3600. file, which can be any image format supported by libavformat. The
  3601. width and height of the image file must match those of the video
  3602. stream being processed.
  3603. Pixels in the provided bitmap image with a value of zero are not
  3604. considered part of the logo, non-zero pixels are considered part of
  3605. the logo. If you use white (255) for the logo and black (0) for the
  3606. rest, you will be safe. For making the filter bitmap, it is
  3607. recommended to take a screen capture of a black frame with the logo
  3608. visible, and then using a threshold filter followed by the erode
  3609. filter once or twice.
  3610. If needed, little splotches can be fixed manually. Remember that if
  3611. logo pixels are not covered, the filter quality will be much
  3612. reduced. Marking too many pixels as part of the logo does not hurt as
  3613. much, but it will increase the amount of blurring needed to cover over
  3614. the image and will destroy more information than necessary, and extra
  3615. pixels will slow things down on a large logo.
  3616. @section scale
  3617. Scale (resize) the input video, using the libswscale library.
  3618. The scale filter forces the output display aspect ratio to be the same
  3619. of the input, by changing the output sample aspect ratio.
  3620. This filter accepts a list of named options in the form of
  3621. @var{key}=@var{value} pairs separated by ":". If the key for the first
  3622. two options is not specified, the assumed keys for the first two
  3623. values are @code{w} and @code{h}. If the first option has no key and
  3624. can be interpreted like a video size specification, it will be used
  3625. to set the video size.
  3626. A description of the accepted options follows.
  3627. @table @option
  3628. @item width, w
  3629. Set the video width expression, default value is @code{iw}. See below
  3630. for the list of accepted constants.
  3631. @item height, h
  3632. Set the video heiht expression, default value is @code{ih}.
  3633. See below for the list of accepted constants.
  3634. @item interl
  3635. Set the interlacing. It accepts the following values:
  3636. @table @option
  3637. @item 1
  3638. force interlaced aware scaling
  3639. @item 0
  3640. do not apply interlaced scaling
  3641. @item -1
  3642. select interlaced aware scaling depending on whether the source frames
  3643. are flagged as interlaced or not
  3644. @end table
  3645. Default value is @code{0}.
  3646. @item flags
  3647. Set libswscale scaling flags. If not explictly specified the filter
  3648. applies a bilinear scaling algorithm.
  3649. @item size, s
  3650. Set the video size, the value must be a valid abbreviation or in the
  3651. form @var{width}x@var{height}.
  3652. @end table
  3653. The values of the @var{w} and @var{h} options are expressions
  3654. containing the following constants:
  3655. @table @option
  3656. @item in_w, in_h
  3657. the input width and height
  3658. @item iw, ih
  3659. same as @var{in_w} and @var{in_h}
  3660. @item out_w, out_h
  3661. the output (cropped) width and height
  3662. @item ow, oh
  3663. same as @var{out_w} and @var{out_h}
  3664. @item a
  3665. same as @var{iw} / @var{ih}
  3666. @item sar
  3667. input sample aspect ratio
  3668. @item dar
  3669. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3670. @item hsub, vsub
  3671. horizontal and vertical chroma subsample values. For example for the
  3672. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3673. @end table
  3674. If the input image format is different from the format requested by
  3675. the next filter, the scale filter will convert the input to the
  3676. requested format.
  3677. If the value for @var{width} or @var{height} is 0, the respective input
  3678. size is used for the output.
  3679. If the value for @var{width} or @var{height} is -1, the scale filter will
  3680. use, for the respective output size, a value that maintains the aspect
  3681. ratio of the input image.
  3682. @subsection Examples
  3683. @itemize
  3684. @item
  3685. Scale the input video to a size of 200x100:
  3686. @example
  3687. scale=200:100
  3688. @end example
  3689. This is equivalent to:
  3690. @example
  3691. scale=w=200:h=100
  3692. @end example
  3693. or:
  3694. @example
  3695. scale=200x100
  3696. @end example
  3697. @item
  3698. Specify a size abbreviation for the output size:
  3699. @example
  3700. scale=qcif
  3701. @end example
  3702. which can also be written as:
  3703. @example
  3704. scale=size=qcif
  3705. @end example
  3706. @item
  3707. Scale the input to 2x:
  3708. @example
  3709. scale=2*iw:2*ih
  3710. @end example
  3711. @item
  3712. The above is the same as:
  3713. @example
  3714. scale=2*in_w:2*in_h
  3715. @end example
  3716. @item
  3717. Scale the input to 2x with forced interlaced scaling:
  3718. @example
  3719. scale=2*iw:2*ih:interl=1
  3720. @end example
  3721. @item
  3722. Scale the input to half size:
  3723. @example
  3724. scale=iw/2:ih/2
  3725. @end example
  3726. @item
  3727. Increase the width, and set the height to the same size:
  3728. @example
  3729. scale=3/2*iw:ow
  3730. @end example
  3731. @item
  3732. Seek for Greek harmony:
  3733. @example
  3734. scale=iw:1/PHI*iw
  3735. scale=ih*PHI:ih
  3736. @end example
  3737. @item
  3738. Increase the height, and set the width to 3/2 of the height:
  3739. @example
  3740. scale=3/2*oh:3/5*ih
  3741. @end example
  3742. @item
  3743. Increase the size, but make the size a multiple of the chroma:
  3744. @example
  3745. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  3746. @end example
  3747. @item
  3748. Increase the width to a maximum of 500 pixels, keep the same input
  3749. aspect ratio:
  3750. @example
  3751. scale='min(500\, iw*3/2):-1'
  3752. @end example
  3753. @end itemize
  3754. @section setdar, setsar
  3755. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  3756. output video.
  3757. This is done by changing the specified Sample (aka Pixel) Aspect
  3758. Ratio, according to the following equation:
  3759. @example
  3760. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  3761. @end example
  3762. Keep in mind that the @code{setdar} filter does not modify the pixel
  3763. dimensions of the video frame. Also the display aspect ratio set by
  3764. this filter may be changed by later filters in the filterchain,
  3765. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  3766. applied.
  3767. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  3768. the filter output video.
  3769. Note that as a consequence of the application of this filter, the
  3770. output display aspect ratio will change according to the equation
  3771. above.
  3772. Keep in mind that the sample aspect ratio set by the @code{setsar}
  3773. filter may be changed by later filters in the filterchain, e.g. if
  3774. another "setsar" or a "setdar" filter is applied.
  3775. The @code{setdar} and @code{setsar} filters accept a string in the
  3776. form @var{num}:@var{den} expressing an aspect ratio, or the following
  3777. named options, expressed as a sequence of @var{key}=@var{value} pairs,
  3778. separated by ":".
  3779. @table @option
  3780. @item max
  3781. Set the maximum integer value to use for expressing numerator and
  3782. denominator when reducing the expressed aspect ratio to a rational.
  3783. Default value is @code{100}.
  3784. @item r, ratio:
  3785. Set the aspect ratio used by the filter.
  3786. The parameter can be a floating point number string, an expression, or
  3787. a string of the form @var{num}:@var{den}, where @var{num} and
  3788. @var{den} are the numerator and denominator of the aspect ratio. If
  3789. the parameter is not specified, it is assumed the value "0".
  3790. In case the form "@var{num}:@var{den}" the @code{:} character should
  3791. be escaped.
  3792. @end table
  3793. If the keys are omitted in the named options list, the specifed values
  3794. are assumed to be @var{ratio} and @var{max} in that order.
  3795. For example to change the display aspect ratio to 16:9, specify:
  3796. @example
  3797. setdar='16:9'
  3798. @end example
  3799. The example above is equivalent to:
  3800. @example
  3801. setdar=1.77777
  3802. @end example
  3803. To change the sample aspect ratio to 10:11, specify:
  3804. @example
  3805. setsar='10:11'
  3806. @end example
  3807. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  3808. 1000 in the aspect ratio reduction, use the command:
  3809. @example
  3810. setdar=ratio='16:9':max=1000
  3811. @end example
  3812. @section setfield
  3813. Force field for the output video frame.
  3814. The @code{setfield} filter marks the interlace type field for the
  3815. output frames. It does not change the input frame, but only sets the
  3816. corresponding property, which affects how the frame is treated by
  3817. following filters (e.g. @code{fieldorder} or @code{yadif}).
  3818. This filter accepts a single option @option{mode}, which can be
  3819. specified either by setting @code{mode=VALUE} or setting the value
  3820. alone. Available values are:
  3821. @table @samp
  3822. @item auto
  3823. Keep the same field property.
  3824. @item bff
  3825. Mark the frame as bottom-field-first.
  3826. @item tff
  3827. Mark the frame as top-field-first.
  3828. @item prog
  3829. Mark the frame as progressive.
  3830. @end table
  3831. @section showinfo
  3832. Show a line containing various information for each input video frame.
  3833. The input video is not modified.
  3834. The shown line contains a sequence of key/value pairs of the form
  3835. @var{key}:@var{value}.
  3836. A description of each shown parameter follows:
  3837. @table @option
  3838. @item n
  3839. sequential number of the input frame, starting from 0
  3840. @item pts
  3841. Presentation TimeStamp of the input frame, expressed as a number of
  3842. time base units. The time base unit depends on the filter input pad.
  3843. @item pts_time
  3844. Presentation TimeStamp of the input frame, expressed as a number of
  3845. seconds
  3846. @item pos
  3847. position of the frame in the input stream, -1 if this information in
  3848. unavailable and/or meaningless (for example in case of synthetic video)
  3849. @item fmt
  3850. pixel format name
  3851. @item sar
  3852. sample aspect ratio of the input frame, expressed in the form
  3853. @var{num}/@var{den}
  3854. @item s
  3855. size of the input frame, expressed in the form
  3856. @var{width}x@var{height}
  3857. @item i
  3858. interlaced mode ("P" for "progressive", "T" for top field first, "B"
  3859. for bottom field first)
  3860. @item iskey
  3861. 1 if the frame is a key frame, 0 otherwise
  3862. @item type
  3863. picture type of the input frame ("I" for an I-frame, "P" for a
  3864. P-frame, "B" for a B-frame, "?" for unknown type).
  3865. Check also the documentation of the @code{AVPictureType} enum and of
  3866. the @code{av_get_picture_type_char} function defined in
  3867. @file{libavutil/avutil.h}.
  3868. @item checksum
  3869. Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
  3870. @item plane_checksum
  3871. Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  3872. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]"
  3873. @end table
  3874. @section smartblur
  3875. Blur the input video without impacting the outlines.
  3876. This filter accepts parameters as a list of @var{key}=@var{value} pairs,
  3877. separated by ":".
  3878. If the key of the first options is omitted, the arguments are
  3879. interpreted according to the syntax:
  3880. @var{luma_radius}:@var{luma_strength}:@var{luma_threshold}[:@var{chroma_radius}:@var{chroma_strength}:@var{chroma_threshold}]
  3881. A description of the accepted options follows.
  3882. @table @option
  3883. @item luma_radius, lr
  3884. @item chroma_radius, cr
  3885. Set the luma/chroma radius. The option value must be a float number in
  3886. the range [0.1,5.0] that specifies the variance of the gaussian filter
  3887. used to blur the image (slower if larger). Default value is 1.0.
  3888. @item luma_strength, ls
  3889. @item chroma_strength, cs
  3890. Set the luma/chroma strength. The option value must be a float number
  3891. in the range [-1.0,1.0] that configures the blurring. A value included
  3892. in [0.0,1.0] will blur the image whereas a value included in
  3893. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  3894. @item luma_threshold, lt
  3895. @item chroma_threshold, ct
  3896. Set the luma/chroma threshold used as a coefficient to determine
  3897. whether a pixel should be blurred or not. The option value must be an
  3898. integer in the range [-30,30]. A value of 0 will filter all the image,
  3899. a value included in [0,30] will filter flat areas and a value included
  3900. in [-30,0] will filter edges. Default value is 0.
  3901. @end table
  3902. If a chroma option is not explicitly set, the corresponding luma value
  3903. is set.
  3904. @section stereo3d
  3905. Convert between different stereoscopic image formats.
  3906. This filter accepts the following named options, expressed as a
  3907. sequence of @var{key}=@var{value} pairs, separated by ":".
  3908. @table @option
  3909. @item in
  3910. Set stereoscopic image format of input.
  3911. Available values for input image formats are:
  3912. @table @samp
  3913. @item sbsl
  3914. side by side parallel (left eye left, right eye right)
  3915. @item sbsr
  3916. side by side crosseye (right eye left, left eye right)
  3917. @item sbs2l
  3918. side by side parallel with half width resolution
  3919. (left eye left, right eye right)
  3920. @item sbs2r
  3921. side by side crosseye with half width resolution
  3922. (right eye left, left eye right)
  3923. @item abl
  3924. above-below (left eye above, right eye below)
  3925. @item abr
  3926. above-below (right eye above, left eye below)
  3927. @item ab2l
  3928. above-below with half height resolution
  3929. (left eye above, right eye below)
  3930. @item ab2r
  3931. above-below with half height resolution
  3932. (right eye above, left eye below)
  3933. Default value is @samp{sbsl}.
  3934. @end table
  3935. @item out
  3936. Set stereoscopic image format of output.
  3937. Available values for output image formats are all the input formats as well as:
  3938. @table @samp
  3939. @item arbg
  3940. anaglyph red/blue gray
  3941. (red filter on left eye, blue filter on right eye)
  3942. @item argg
  3943. anaglyph red/green gray
  3944. (red filter on left eye, green filter on right eye)
  3945. @item arcg
  3946. anaglyph red/cyan gray
  3947. (red filter on left eye, cyan filter on right eye)
  3948. @item arch
  3949. anaglyph red/cyan half colored
  3950. (red filter on left eye, cyan filter on right eye)
  3951. @item arcc
  3952. anaglyph red/cyan color
  3953. (red filter on left eye, cyan filter on right eye)
  3954. @item arcd
  3955. anaglyph red/cyan color optimized with the least squares projection of dubois
  3956. (red filter on left eye, cyan filter on right eye)
  3957. @item agmg
  3958. anaglyph green/magenta gray
  3959. (green filter on left eye, magenta filter on right eye)
  3960. @item agmh
  3961. anaglyph green/magenta half colored
  3962. (green filter on left eye, magenta filter on right eye)
  3963. @item agmc
  3964. anaglyph green/magenta colored
  3965. (green filter on left eye, magenta filter on right eye)
  3966. @item agmd
  3967. anaglyph green/magenta color optimized with the least squares projection of dubois
  3968. (green filter on left eye, magenta filter on right eye)
  3969. @item aybg
  3970. anaglyph yellow/blue gray
  3971. (yellow filter on left eye, blue filter on right eye)
  3972. @item aybh
  3973. anaglyph yellow/blue half colored
  3974. (yellow filter on left eye, blue filter on right eye)
  3975. @item aybc
  3976. anaglyph yellow/blue colored
  3977. (yellow filter on left eye, blue filter on right eye)
  3978. @item aybd
  3979. anaglyph yellow/blue color optimized with the least squares projection of dubois
  3980. (yellow filter on left eye, blue filter on right eye)
  3981. @item irl
  3982. interleaved rows (left eye has top row, right eye starts on next row)
  3983. @item irr
  3984. interleaved rows (right eye has top row, left eye starts on next row)
  3985. @item ml
  3986. mono output (left eye only)
  3987. @item mr
  3988. mono output (right eye only)
  3989. @end table
  3990. Default value is @samp{arcd}.
  3991. @end table
  3992. @anchor{subtitles}
  3993. @section subtitles
  3994. Draw subtitles on top of input video using the libass library.
  3995. To enable compilation of this filter you need to configure FFmpeg with
  3996. @code{--enable-libass}. This filter also requires a build with libavcodec and
  3997. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  3998. Alpha) subtitles format.
  3999. This filter accepts the following named options, expressed as a
  4000. sequence of @var{key}=@var{value} pairs, separated by ":".
  4001. @table @option
  4002. @item filename, f
  4003. Set the filename of the subtitle file to read. It must be specified.
  4004. @item original_size
  4005. Specify the size of the original video, the video for which the ASS file
  4006. was composed. Due to a misdesign in ASS aspect ratio arithmetic, this is
  4007. necessary to correctly scale the fonts if the aspect ratio has been changed.
  4008. @item charenc
  4009. Set subtitles input character encoding. @code{subtitles} filter only. Only
  4010. useful if not UTF-8.
  4011. @end table
  4012. If the first key is not specified, it is assumed that the first value
  4013. specifies the @option{filename}.
  4014. For example, to render the file @file{sub.srt} on top of the input
  4015. video, use the command:
  4016. @example
  4017. subtitles=sub.srt
  4018. @end example
  4019. which is equivalent to:
  4020. @example
  4021. subtitles=filename=sub.srt
  4022. @end example
  4023. @section split
  4024. Split input video into several identical outputs.
  4025. The filter accepts a single parameter which specifies the number of outputs. If
  4026. unspecified, it defaults to 2.
  4027. For example
  4028. @example
  4029. ffmpeg -i INPUT -filter_complex split=5 OUTPUT
  4030. @end example
  4031. will create 5 copies of the input video.
  4032. For example:
  4033. @example
  4034. [in] split [splitout1][splitout2];
  4035. [splitout1] crop=100:100:0:0 [cropout];
  4036. [splitout2] pad=200:200:100:100 [padout];
  4037. @end example
  4038. will create two separate outputs from the same input, one cropped and
  4039. one padded.
  4040. @section super2xsai
  4041. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  4042. Interpolate) pixel art scaling algorithm.
  4043. Useful for enlarging pixel art images without reducing sharpness.
  4044. @section swapuv
  4045. Swap U & V plane.
  4046. @section thumbnail
  4047. Select the most representative frame in a given sequence of consecutive frames.
  4048. The filter accepts parameters as a list of @var{key}=@var{value}
  4049. pairs, separated by ":". If the key of the first options is omitted,
  4050. the arguments are interpreted according to the syntax
  4051. thumbnail[=@var{n}].
  4052. @table @option
  4053. @item n
  4054. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  4055. will pick one of them, and then handle the next batch of @var{n} frames until
  4056. the end. Default is @code{100}.
  4057. @end table
  4058. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  4059. value will result in a higher memory usage, so a high value is not recommended.
  4060. @subsection Examples
  4061. @itemize
  4062. @item
  4063. Extract one picture each 50 frames:
  4064. @example
  4065. thumbnail=50
  4066. @end example
  4067. @item
  4068. Complete example of a thumbnail creation with @command{ffmpeg}:
  4069. @example
  4070. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  4071. @end example
  4072. @end itemize
  4073. @section tile
  4074. Tile several successive frames together.
  4075. It accepts a list of options in the form of @var{key}=@var{value} pairs
  4076. separated by ":". A description of the accepted options follows.
  4077. @table @option
  4078. @item layout
  4079. Set the grid size (i.e. the number of lines and columns) in the form
  4080. "@var{w}x@var{h}".
  4081. @item margin
  4082. Set the outer border margin in pixels.
  4083. @item padding
  4084. Set the inner border thickness (i.e. the number of pixels between frames). For
  4085. more advanced padding options (such as having different values for the edges),
  4086. refer to the pad video filter.
  4087. @item nb_frames
  4088. Set the maximum number of frames to render in the given area. It must be less
  4089. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  4090. the area will be used.
  4091. @end table
  4092. Alternatively, the options can be specified as a flat string:
  4093. @var{layout}[:@var{nb_frames}[:@var{margin}[:@var{padding}]]]
  4094. For example, produce 8x8 PNG tiles of all keyframes (@option{-skip_frame
  4095. nokey}) in a movie:
  4096. @example
  4097. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  4098. @end example
  4099. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  4100. duplicating each output frame to accomodate the originally detected frame
  4101. rate.
  4102. Another example to display @code{5} pictures in an area of @code{3x2} frames,
  4103. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  4104. mixed flat and named options:
  4105. @example
  4106. tile=3x2:nb_frames=5:padding=7:margin=2
  4107. @end example
  4108. @section tinterlace
  4109. Perform various types of temporal field interlacing.
  4110. Frames are counted starting from 1, so the first input frame is
  4111. considered odd.
  4112. This filter accepts options in the form of @var{key}=@var{value} pairs
  4113. separated by ":".
  4114. Alternatively, the @var{mode} option can be specified as a value alone,
  4115. optionally followed by a ":" and further ":" separated @var{key}=@var{value}
  4116. pairs.
  4117. A description of the accepted options follows.
  4118. @table @option
  4119. @item mode
  4120. Specify the mode of the interlacing. This option can also be specified
  4121. as a value alone. See below for a list of values for this option.
  4122. Available values are:
  4123. @table @samp
  4124. @item merge, 0
  4125. Move odd frames into the upper field, even into the lower field,
  4126. generating a double height frame at half framerate.
  4127. @item drop_odd, 1
  4128. Only output even frames, odd frames are dropped, generating a frame with
  4129. unchanged height at half framerate.
  4130. @item drop_even, 2
  4131. Only output odd frames, even frames are dropped, generating a frame with
  4132. unchanged height at half framerate.
  4133. @item pad, 3
  4134. Expand each frame to full height, but pad alternate lines with black,
  4135. generating a frame with double height at the same input framerate.
  4136. @item interleave_top, 4
  4137. Interleave the upper field from odd frames with the lower field from
  4138. even frames, generating a frame with unchanged height at half framerate.
  4139. @item interleave_bottom, 5
  4140. Interleave the lower field from odd frames with the upper field from
  4141. even frames, generating a frame with unchanged height at half framerate.
  4142. @item interlacex2, 6
  4143. Double frame rate with unchanged height. Frames are inserted each
  4144. containing the second temporal field from the previous input frame and
  4145. the first temporal field from the next input frame. This mode relies on
  4146. the top_field_first flag. Useful for interlaced video displays with no
  4147. field synchronisation.
  4148. @end table
  4149. Numeric values are deprecated but are accepted for backward
  4150. compatibility reasons.
  4151. Default mode is @code{merge}.
  4152. @item flags
  4153. Specify flags influencing the filter process.
  4154. Available value for @var{flags} is:
  4155. @table @option
  4156. @item low_pass_filter, vlfp
  4157. Enable vertical low-pass filtering in the filter.
  4158. Vertical low-pass filtering is required when creating an interlaced
  4159. destination from a progressive source which contains high-frequency
  4160. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  4161. patterning.
  4162. Vertical low-pass filtering can only be enabled for @option{mode}
  4163. @var{interleave_top} and @var{interleave_bottom}.
  4164. @end table
  4165. @end table
  4166. @section transpose
  4167. Transpose rows with columns in the input video and optionally flip it.
  4168. The filter accepts parameters as a list of @var{key}=@var{value}
  4169. pairs, separated by ':'. If the key of the first options is omitted,
  4170. the arguments are interpreted according to the syntax
  4171. @var{dir}:@var{passthrough}.
  4172. @table @option
  4173. @item dir
  4174. Specify the transposition direction. Can assume the following values:
  4175. @table @samp
  4176. @item 0, 4
  4177. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  4178. @example
  4179. L.R L.l
  4180. . . -> . .
  4181. l.r R.r
  4182. @end example
  4183. @item 1, 5
  4184. Rotate by 90 degrees clockwise, that is:
  4185. @example
  4186. L.R l.L
  4187. . . -> . .
  4188. l.r r.R
  4189. @end example
  4190. @item 2, 6
  4191. Rotate by 90 degrees counterclockwise, that is:
  4192. @example
  4193. L.R R.r
  4194. . . -> . .
  4195. l.r L.l
  4196. @end example
  4197. @item 3, 7
  4198. Rotate by 90 degrees clockwise and vertically flip, that is:
  4199. @example
  4200. L.R r.R
  4201. . . -> . .
  4202. l.r l.L
  4203. @end example
  4204. @end table
  4205. For values between 4-7, the transposition is only done if the input
  4206. video geometry is portrait and not landscape. These values are
  4207. deprecated, the @code{passthrough} option should be used instead.
  4208. @item passthrough
  4209. Do not apply the transposition if the input geometry matches the one
  4210. specified by the specified value. It accepts the following values:
  4211. @table @samp
  4212. @item none
  4213. Always apply transposition.
  4214. @item portrait
  4215. Preserve portrait geometry (when @var{height} >= @var{width}).
  4216. @item landscape
  4217. Preserve landscape geometry (when @var{width} >= @var{height}).
  4218. @end table
  4219. Default value is @code{none}.
  4220. @end table
  4221. For example to rotate by 90 degrees clockwise and preserve portrait
  4222. layout:
  4223. @example
  4224. transpose=dir=1:passthrough=portrait
  4225. @end example
  4226. The command above can also be specified as:
  4227. @example
  4228. transpose=1:portrait
  4229. @end example
  4230. @section unsharp
  4231. Sharpen or blur the input video.
  4232. This filter accepts parameters as a list of @var{key}=@var{value} pairs,
  4233. separated by ":".
  4234. If the key of the first options is omitted, the arguments are
  4235. interpreted according to the syntax:
  4236. @var{luma_msize_x}:@var{luma_msize_y}:@var{luma_amount}:@var{chroma_msize_x}:@var{chroma_msize_y}:@var{chroma_amount}
  4237. A description of the accepted options follows.
  4238. @table @option
  4239. @item luma_msize_x, lx
  4240. @item chroma_msize_x, cx
  4241. Set the luma/chroma matrix horizontal size. It must be an odd integer
  4242. between 3 and 63, default value is 5.
  4243. @item luma_msize_y, ly
  4244. @item chroma_msize_y, cy
  4245. Set the luma/chroma matrix vertical size. It must be an odd integer
  4246. between 3 and 63, default value is 5.
  4247. @item luma_amount, la
  4248. @item chroma_amount, ca
  4249. Set the luma/chroma effect strength. It can be a float number,
  4250. reasonable values lay between -1.5 and 1.5.
  4251. Negative values will blur the input video, while positive values will
  4252. sharpen it, a value of zero will disable the effect.
  4253. Default value is 1.0 for @option{luma_amount}, 0.0 for
  4254. @option{chroma_amount}.
  4255. @end table
  4256. @subsection Examples
  4257. @itemize
  4258. @item
  4259. Apply strong luma sharpen effect:
  4260. @example
  4261. unsharp=7:7:2.5
  4262. @end example
  4263. @item
  4264. Apply strong blur of both luma and chroma parameters:
  4265. @example
  4266. unsharp=7:7:-2:7:7:-2
  4267. @end example
  4268. @end itemize
  4269. @section vflip
  4270. Flip the input video vertically.
  4271. @example
  4272. ffmpeg -i in.avi -vf "vflip" out.avi
  4273. @end example
  4274. @section yadif
  4275. Deinterlace the input video ("yadif" means "yet another deinterlacing
  4276. filter").
  4277. The filter accepts parameters as a list of @var{key}=@var{value}
  4278. pairs, separated by ":". If the key of the first options is omitted,
  4279. the arguments are interpreted according to syntax
  4280. @var{mode}:@var{parity}:@var{deint}.
  4281. The description of the accepted parameters follows.
  4282. @table @option
  4283. @item mode
  4284. Specify the interlacing mode to adopt. Accept one of the following
  4285. values:
  4286. @table @option
  4287. @item 0, send_frame
  4288. output 1 frame for each frame
  4289. @item 1, send_field
  4290. output 1 frame for each field
  4291. @item 2, send_frame_nospatial
  4292. like @code{send_frame} but skip spatial interlacing check
  4293. @item 3, send_field_nospatial
  4294. like @code{send_field} but skip spatial interlacing check
  4295. @end table
  4296. Default value is @code{send_frame}.
  4297. @item parity
  4298. Specify the picture field parity assumed for the input interlaced
  4299. video. Accept one of the following values:
  4300. @table @option
  4301. @item 0, tff
  4302. assume top field first
  4303. @item 1, bff
  4304. assume bottom field first
  4305. @item -1, auto
  4306. enable automatic detection
  4307. @end table
  4308. Default value is @code{auto}.
  4309. If interlacing is unknown or decoder does not export this information,
  4310. top field first will be assumed.
  4311. @item deint
  4312. Specify which frames to deinterlace. Accept one of the following
  4313. values:
  4314. @table @option
  4315. @item 0, all
  4316. deinterlace all frames
  4317. @item 1, interlaced
  4318. only deinterlace frames marked as interlaced
  4319. @end table
  4320. Default value is @code{all}.
  4321. @end table
  4322. @c man end VIDEO FILTERS
  4323. @chapter Video Sources
  4324. @c man begin VIDEO SOURCES
  4325. Below is a description of the currently available video sources.
  4326. @section buffer
  4327. Buffer video frames, and make them available to the filter chain.
  4328. This source is mainly intended for a programmatic use, in particular
  4329. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  4330. It accepts a list of options in the form of @var{key}=@var{value} pairs
  4331. separated by ":". A description of the accepted options follows.
  4332. @table @option
  4333. @item video_size
  4334. Specify the size (width and height) of the buffered video frames.
  4335. @item pix_fmt
  4336. A string representing the pixel format of the buffered video frames.
  4337. It may be a number corresponding to a pixel format, or a pixel format
  4338. name.
  4339. @item time_base
  4340. Specify the timebase assumed by the timestamps of the buffered frames.
  4341. @item time_base
  4342. Specify the frame rate expected for the video stream.
  4343. @item pixel_aspect
  4344. Specify the sample aspect ratio assumed by the video frames.
  4345. @item sws_param
  4346. Specify the optional parameters to be used for the scale filter which
  4347. is automatically inserted when an input change is detected in the
  4348. input size or format.
  4349. @end table
  4350. For example:
  4351. @example
  4352. buffer=size=320x240:pix_fmt=yuv410p:time_base=1/24:pixel_aspect=1/1
  4353. @end example
  4354. will instruct the source to accept video frames with size 320x240 and
  4355. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  4356. square pixels (1:1 sample aspect ratio).
  4357. Since the pixel format with name "yuv410p" corresponds to the number 6
  4358. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  4359. this example corresponds to:
  4360. @example
  4361. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  4362. @end example
  4363. Alternatively, the options can be specified as a flat string, but this
  4364. syntax is deprecated:
  4365. @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}]
  4366. @section cellauto
  4367. Create a pattern generated by an elementary cellular automaton.
  4368. The initial state of the cellular automaton can be defined through the
  4369. @option{filename}, and @option{pattern} options. If such options are
  4370. not specified an initial state is created randomly.
  4371. At each new frame a new row in the video is filled with the result of
  4372. the cellular automaton next generation. The behavior when the whole
  4373. frame is filled is defined by the @option{scroll} option.
  4374. This source accepts a list of options in the form of
  4375. @var{key}=@var{value} pairs separated by ":". A description of the
  4376. accepted options follows.
  4377. @table @option
  4378. @item filename, f
  4379. Read the initial cellular automaton state, i.e. the starting row, from
  4380. the specified file.
  4381. In the file, each non-whitespace character is considered an alive
  4382. cell, a newline will terminate the row, and further characters in the
  4383. file will be ignored.
  4384. @item pattern, p
  4385. Read the initial cellular automaton state, i.e. the starting row, from
  4386. the specified string.
  4387. Each non-whitespace character in the string is considered an alive
  4388. cell, a newline will terminate the row, and further characters in the
  4389. string will be ignored.
  4390. @item rate, r
  4391. Set the video rate, that is the number of frames generated per second.
  4392. Default is 25.
  4393. @item random_fill_ratio, ratio
  4394. Set the random fill ratio for the initial cellular automaton row. It
  4395. is a floating point number value ranging from 0 to 1, defaults to
  4396. 1/PHI.
  4397. This option is ignored when a file or a pattern is specified.
  4398. @item random_seed, seed
  4399. Set the seed for filling randomly the initial row, must be an integer
  4400. included between 0 and UINT32_MAX. If not specified, or if explicitly
  4401. set to -1, the filter will try to use a good random seed on a best
  4402. effort basis.
  4403. @item rule
  4404. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  4405. Default value is 110.
  4406. @item size, s
  4407. Set the size of the output video.
  4408. If @option{filename} or @option{pattern} is specified, the size is set
  4409. by default to the width of the specified initial state row, and the
  4410. height is set to @var{width} * PHI.
  4411. If @option{size} is set, it must contain the width of the specified
  4412. pattern string, and the specified pattern will be centered in the
  4413. larger row.
  4414. If a filename or a pattern string is not specified, the size value
  4415. defaults to "320x518" (used for a randomly generated initial state).
  4416. @item scroll
  4417. If set to 1, scroll the output upward when all the rows in the output
  4418. have been already filled. If set to 0, the new generated row will be
  4419. written over the top row just after the bottom row is filled.
  4420. Defaults to 1.
  4421. @item start_full, full
  4422. If set to 1, completely fill the output with generated rows before
  4423. outputting the first frame.
  4424. This is the default behavior, for disabling set the value to 0.
  4425. @item stitch
  4426. If set to 1, stitch the left and right row edges together.
  4427. This is the default behavior, for disabling set the value to 0.
  4428. @end table
  4429. @subsection Examples
  4430. @itemize
  4431. @item
  4432. Read the initial state from @file{pattern}, and specify an output of
  4433. size 200x400.
  4434. @example
  4435. cellauto=f=pattern:s=200x400
  4436. @end example
  4437. @item
  4438. Generate a random initial row with a width of 200 cells, with a fill
  4439. ratio of 2/3:
  4440. @example
  4441. cellauto=ratio=2/3:s=200x200
  4442. @end example
  4443. @item
  4444. Create a pattern generated by rule 18 starting by a single alive cell
  4445. centered on an initial row with width 100:
  4446. @example
  4447. cellauto=p=@@:s=100x400:full=0:rule=18
  4448. @end example
  4449. @item
  4450. Specify a more elaborated initial pattern:
  4451. @example
  4452. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  4453. @end example
  4454. @end itemize
  4455. @section mandelbrot
  4456. Generate a Mandelbrot set fractal, and progressively zoom towards the
  4457. point specified with @var{start_x} and @var{start_y}.
  4458. This source accepts a list of options in the form of
  4459. @var{key}=@var{value} pairs separated by ":". A description of the
  4460. accepted options follows.
  4461. @table @option
  4462. @item end_pts
  4463. Set the terminal pts value. Default value is 400.
  4464. @item end_scale
  4465. Set the terminal scale value.
  4466. Must be a floating point value. Default value is 0.3.
  4467. @item inner
  4468. Set the inner coloring mode, that is the algorithm used to draw the
  4469. Mandelbrot fractal internal region.
  4470. It shall assume one of the following values:
  4471. @table @option
  4472. @item black
  4473. Set black mode.
  4474. @item convergence
  4475. Show time until convergence.
  4476. @item mincol
  4477. Set color based on point closest to the origin of the iterations.
  4478. @item period
  4479. Set period mode.
  4480. @end table
  4481. Default value is @var{mincol}.
  4482. @item bailout
  4483. Set the bailout value. Default value is 10.0.
  4484. @item maxiter
  4485. Set the maximum of iterations performed by the rendering
  4486. algorithm. Default value is 7189.
  4487. @item outer
  4488. Set outer coloring mode.
  4489. It shall assume one of following values:
  4490. @table @option
  4491. @item iteration_count
  4492. Set iteration cound mode.
  4493. @item normalized_iteration_count
  4494. set normalized iteration count mode.
  4495. @end table
  4496. Default value is @var{normalized_iteration_count}.
  4497. @item rate, r
  4498. Set frame rate, expressed as number of frames per second. Default
  4499. value is "25".
  4500. @item size, s
  4501. Set frame size. Default value is "640x480".
  4502. @item start_scale
  4503. Set the initial scale value. Default value is 3.0.
  4504. @item start_x
  4505. Set the initial x position. Must be a floating point value between
  4506. -100 and 100. Default value is -0.743643887037158704752191506114774.
  4507. @item start_y
  4508. Set the initial y position. Must be a floating point value between
  4509. -100 and 100. Default value is -0.131825904205311970493132056385139.
  4510. @end table
  4511. @section mptestsrc
  4512. Generate various test patterns, as generated by the MPlayer test filter.
  4513. The size of the generated video is fixed, and is 256x256.
  4514. This source is useful in particular for testing encoding features.
  4515. This source accepts an optional sequence of @var{key}=@var{value} pairs,
  4516. separated by ":". The description of the accepted options follows.
  4517. @table @option
  4518. @item rate, r
  4519. Specify the frame rate of the sourced video, as the number of frames
  4520. generated per second. It has to be a string in the format
  4521. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  4522. number or a valid video frame rate abbreviation. The default value is
  4523. "25".
  4524. @item duration, d
  4525. Set the video duration of the sourced video. The accepted syntax is:
  4526. @example
  4527. [-]HH:MM:SS[.m...]
  4528. [-]S+[.m...]
  4529. @end example
  4530. See also the function @code{av_parse_time()}.
  4531. If not specified, or the expressed duration is negative, the video is
  4532. supposed to be generated forever.
  4533. @item test, t
  4534. Set the number or the name of the test to perform. Supported tests are:
  4535. @table @option
  4536. @item dc_luma
  4537. @item dc_chroma
  4538. @item freq_luma
  4539. @item freq_chroma
  4540. @item amp_luma
  4541. @item amp_chroma
  4542. @item cbp
  4543. @item mv
  4544. @item ring1
  4545. @item ring2
  4546. @item all
  4547. @end table
  4548. Default value is "all", which will cycle through the list of all tests.
  4549. @end table
  4550. For example the following:
  4551. @example
  4552. testsrc=t=dc_luma
  4553. @end example
  4554. will generate a "dc_luma" test pattern.
  4555. @section frei0r_src
  4556. Provide a frei0r source.
  4557. To enable compilation of this filter you need to install the frei0r
  4558. header and configure FFmpeg with @code{--enable-frei0r}.
  4559. The source supports the syntax:
  4560. @example
  4561. @var{size}:@var{rate}:@var{src_name}[@{=|:@}@var{param1}:@var{param2}:...:@var{paramN}]
  4562. @end example
  4563. @var{size} is the size of the video to generate, may be a string of the
  4564. form @var{width}x@var{height} or a frame size abbreviation.
  4565. @var{rate} is the rate of the video to generate, may be a string of
  4566. the form @var{num}/@var{den} or a frame rate abbreviation.
  4567. @var{src_name} is the name to the frei0r source to load. For more
  4568. information regarding frei0r and how to set the parameters read the
  4569. section @ref{frei0r} in the description of the video filters.
  4570. For example, to generate a frei0r partik0l source with size 200x200
  4571. and frame rate 10 which is overlayed on the overlay filter main input:
  4572. @example
  4573. frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
  4574. @end example
  4575. @section life
  4576. Generate a life pattern.
  4577. This source is based on a generalization of John Conway's life game.
  4578. The sourced input represents a life grid, each pixel represents a cell
  4579. which can be in one of two possible states, alive or dead. Every cell
  4580. interacts with its eight neighbours, which are the cells that are
  4581. horizontally, vertically, or diagonally adjacent.
  4582. At each interaction the grid evolves according to the adopted rule,
  4583. which specifies the number of neighbor alive cells which will make a
  4584. cell stay alive or born. The @option{rule} option allows to specify
  4585. the rule to adopt.
  4586. This source accepts a list of options in the form of
  4587. @var{key}=@var{value} pairs separated by ":". A description of the
  4588. accepted options follows.
  4589. @table @option
  4590. @item filename, f
  4591. Set the file from which to read the initial grid state. In the file,
  4592. each non-whitespace character is considered an alive cell, and newline
  4593. is used to delimit the end of each row.
  4594. If this option is not specified, the initial grid is generated
  4595. randomly.
  4596. @item rate, r
  4597. Set the video rate, that is the number of frames generated per second.
  4598. Default is 25.
  4599. @item random_fill_ratio, ratio
  4600. Set the random fill ratio for the initial random grid. It is a
  4601. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  4602. It is ignored when a file is specified.
  4603. @item random_seed, seed
  4604. Set the seed for filling the initial random grid, must be an integer
  4605. included between 0 and UINT32_MAX. If not specified, or if explicitly
  4606. set to -1, the filter will try to use a good random seed on a best
  4607. effort basis.
  4608. @item rule
  4609. Set the life rule.
  4610. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  4611. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  4612. @var{NS} specifies the number of alive neighbor cells which make a
  4613. live cell stay alive, and @var{NB} the number of alive neighbor cells
  4614. which make a dead cell to become alive (i.e. to "born").
  4615. "s" and "b" can be used in place of "S" and "B", respectively.
  4616. Alternatively a rule can be specified by an 18-bits integer. The 9
  4617. high order bits are used to encode the next cell state if it is alive
  4618. for each number of neighbor alive cells, the low order bits specify
  4619. the rule for "borning" new cells. Higher order bits encode for an
  4620. higher number of neighbor cells.
  4621. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  4622. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  4623. Default value is "S23/B3", which is the original Conway's game of life
  4624. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  4625. cells, and will born a new cell if there are three alive cells around
  4626. a dead cell.
  4627. @item size, s
  4628. Set the size of the output video.
  4629. If @option{filename} is specified, the size is set by default to the
  4630. same size of the input file. If @option{size} is set, it must contain
  4631. the size specified in the input file, and the initial grid defined in
  4632. that file is centered in the larger resulting area.
  4633. If a filename is not specified, the size value defaults to "320x240"
  4634. (used for a randomly generated initial grid).
  4635. @item stitch
  4636. If set to 1, stitch the left and right grid edges together, and the
  4637. top and bottom edges also. Defaults to 1.
  4638. @item mold
  4639. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  4640. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  4641. value from 0 to 255.
  4642. @item life_color
  4643. Set the color of living (or new born) cells.
  4644. @item death_color
  4645. Set the color of dead cells. If @option{mold} is set, this is the first color
  4646. used to represent a dead cell.
  4647. @item mold_color
  4648. Set mold color, for definitely dead and moldy cells.
  4649. @end table
  4650. @subsection Examples
  4651. @itemize
  4652. @item
  4653. Read a grid from @file{pattern}, and center it on a grid of size
  4654. 300x300 pixels:
  4655. @example
  4656. life=f=pattern:s=300x300
  4657. @end example
  4658. @item
  4659. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  4660. @example
  4661. life=ratio=2/3:s=200x200
  4662. @end example
  4663. @item
  4664. Specify a custom rule for evolving a randomly generated grid:
  4665. @example
  4666. life=rule=S14/B34
  4667. @end example
  4668. @item
  4669. Full example with slow death effect (mold) using @command{ffplay}:
  4670. @example
  4671. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  4672. @end example
  4673. @end itemize
  4674. @section color, nullsrc, rgbtestsrc, smptebars, testsrc
  4675. The @code{color} source provides an uniformly colored input.
  4676. The @code{nullsrc} source returns unprocessed video frames. It is
  4677. mainly useful to be employed in analysis / debugging tools, or as the
  4678. source for filters which ignore the input data.
  4679. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  4680. detecting RGB vs BGR issues. You should see a red, green and blue
  4681. stripe from top to bottom.
  4682. The @code{smptebars} source generates a color bars pattern, based on
  4683. the SMPTE Engineering Guideline EG 1-1990.
  4684. The @code{testsrc} source generates a test video pattern, showing a
  4685. color pattern, a scrolling gradient and a timestamp. This is mainly
  4686. intended for testing purposes.
  4687. These sources accept an optional sequence of @var{key}=@var{value} pairs,
  4688. separated by ":". The description of the accepted options follows.
  4689. @table @option
  4690. @item color, c
  4691. Specify the color of the source, only used in the @code{color}
  4692. source. It can be the name of a color (case insensitive match) or a
  4693. 0xRRGGBB[AA] sequence, possibly followed by an alpha specifier. The
  4694. default value is "black".
  4695. @item size, s
  4696. Specify the size of the sourced video, it may be a string of the form
  4697. @var{width}x@var{height}, or the name of a size abbreviation. The
  4698. default value is "320x240".
  4699. @item rate, r
  4700. Specify the frame rate of the sourced video, as the number of frames
  4701. generated per second. It has to be a string in the format
  4702. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  4703. number or a valid video frame rate abbreviation. The default value is
  4704. "25".
  4705. @item sar
  4706. Set the sample aspect ratio of the sourced video.
  4707. @item duration, d
  4708. Set the video duration of the sourced video. The accepted syntax is:
  4709. @example
  4710. [-]HH[:MM[:SS[.m...]]]
  4711. [-]S+[.m...]
  4712. @end example
  4713. See also the function @code{av_parse_time()}.
  4714. If not specified, or the expressed duration is negative, the video is
  4715. supposed to be generated forever.
  4716. @item decimals, n
  4717. Set the number of decimals to show in the timestamp, only used in the
  4718. @code{testsrc} source.
  4719. The displayed timestamp value will correspond to the original
  4720. timestamp value multiplied by the power of 10 of the specified
  4721. value. Default value is 0.
  4722. @end table
  4723. For example the following:
  4724. @example
  4725. testsrc=duration=5.3:size=qcif:rate=10
  4726. @end example
  4727. will generate a video with a duration of 5.3 seconds, with size
  4728. 176x144 and a frame rate of 10 frames per second.
  4729. The following graph description will generate a red source
  4730. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  4731. frames per second.
  4732. @example
  4733. color=c=red@@0.2:s=qcif:r=10
  4734. @end example
  4735. If the input content is to be ignored, @code{nullsrc} can be used. The
  4736. following command generates noise in the luminance plane by employing
  4737. the @code{geq} filter:
  4738. @example
  4739. nullsrc=s=256x256, geq=random(1)*255:128:128
  4740. @end example
  4741. @c man end VIDEO SOURCES
  4742. @chapter Video Sinks
  4743. @c man begin VIDEO SINKS
  4744. Below is a description of the currently available video sinks.
  4745. @section buffersink
  4746. Buffer video frames, and make them available to the end of the filter
  4747. graph.
  4748. This sink is mainly intended for a programmatic use, in particular
  4749. through the interface defined in @file{libavfilter/buffersink.h}.
  4750. It does not require a string parameter in input, but you need to
  4751. specify a pointer to a list of supported pixel formats terminated by
  4752. -1 in the opaque parameter provided to @code{avfilter_init_filter}
  4753. when initializing this sink.
  4754. @section nullsink
  4755. Null video sink, do absolutely nothing with the input video. It is
  4756. mainly useful as a template and to be employed in analysis / debugging
  4757. tools.
  4758. @c man end VIDEO SINKS
  4759. @chapter Multimedia Filters
  4760. @c man begin MULTIMEDIA FILTERS
  4761. Below is a description of the currently available multimedia filters.
  4762. @section aperms, perms
  4763. Set read/write permissions for the output frames.
  4764. These filters are mainly aimed at developers to test direct path in the
  4765. following filter in the filtergraph.
  4766. The filters accept parameters as a list of @var{key}=@var{value} pairs,
  4767. separated by ":". If the key of the first options is omitted, the argument is
  4768. assumed to be the @var{mode}.
  4769. A description of the accepted parameters follows.
  4770. @table @option
  4771. @item mode
  4772. Select the permissions mode.
  4773. It accepts the following values:
  4774. @table @samp
  4775. @item none
  4776. Do nothing. This is the default.
  4777. @item ro
  4778. Set all the output frames read-only.
  4779. @item rw
  4780. Set all the output frames directly writable.
  4781. @item toggle
  4782. Make the frame read-only if writable, and writable if read-only.
  4783. @item random
  4784. Set each output frame read-only or writable randomly.
  4785. @end table
  4786. @item seed
  4787. Set the seed for the @var{random} mode, must be an integer included between
  4788. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  4789. @code{-1}, the filter will try to use a good random seed on a best effort
  4790. basis.
  4791. @end table
  4792. Note: in case of auto-inserted filter between the permission filter and the
  4793. following one, the permission might not be received as expected in that
  4794. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  4795. perms/aperms filter can avoid this problem.
  4796. @section aselect, select
  4797. Select frames to pass in output.
  4798. These filters accept a single option @option{expr} or @option{e}
  4799. specifying the select expression, which can be specified either by
  4800. specyfing @code{expr=VALUE} or specifying the expression
  4801. alone.
  4802. The select expression is evaluated for each input frame. If the
  4803. evaluation result is a non-zero value, the frame is selected and
  4804. passed to the output, otherwise it is discarded.
  4805. The expression can contain the following constants:
  4806. @table @option
  4807. @item n
  4808. the sequential number of the filtered frame, starting from 0
  4809. @item selected_n
  4810. the sequential number of the selected frame, starting from 0
  4811. @item prev_selected_n
  4812. the sequential number of the last selected frame, NAN if undefined
  4813. @item TB
  4814. timebase of the input timestamps
  4815. @item pts
  4816. the PTS (Presentation TimeStamp) of the filtered video frame,
  4817. expressed in @var{TB} units, NAN if undefined
  4818. @item t
  4819. the PTS (Presentation TimeStamp) of the filtered video frame,
  4820. expressed in seconds, NAN if undefined
  4821. @item prev_pts
  4822. the PTS of the previously filtered video frame, NAN if undefined
  4823. @item prev_selected_pts
  4824. the PTS of the last previously filtered video frame, NAN if undefined
  4825. @item prev_selected_t
  4826. the PTS of the last previously selected video frame, NAN if undefined
  4827. @item start_pts
  4828. the PTS of the first video frame in the video, NAN if undefined
  4829. @item start_t
  4830. the time of the first video frame in the video, NAN if undefined
  4831. @item pict_type @emph{(video only)}
  4832. the type of the filtered frame, can assume one of the following
  4833. values:
  4834. @table @option
  4835. @item I
  4836. @item P
  4837. @item B
  4838. @item S
  4839. @item SI
  4840. @item SP
  4841. @item BI
  4842. @end table
  4843. @item interlace_type @emph{(video only)}
  4844. the frame interlace type, can assume one of the following values:
  4845. @table @option
  4846. @item PROGRESSIVE
  4847. the frame is progressive (not interlaced)
  4848. @item TOPFIRST
  4849. the frame is top-field-first
  4850. @item BOTTOMFIRST
  4851. the frame is bottom-field-first
  4852. @end table
  4853. @item consumed_sample_n @emph{(audio only)}
  4854. the number of selected samples before the current frame
  4855. @item samples_n @emph{(audio only)}
  4856. the number of samples in the current frame
  4857. @item sample_rate @emph{(audio only)}
  4858. the input sample rate
  4859. @item key
  4860. 1 if the filtered frame is a key-frame, 0 otherwise
  4861. @item pos
  4862. the position in the file of the filtered frame, -1 if the information
  4863. is not available (e.g. for synthetic video)
  4864. @item scene @emph{(video only)}
  4865. value between 0 and 1 to indicate a new scene; a low value reflects a low
  4866. probability for the current frame to introduce a new scene, while a higher
  4867. value means the current frame is more likely to be one (see the example below)
  4868. @end table
  4869. The default value of the select expression is "1".
  4870. @subsection Examples
  4871. @itemize
  4872. @item
  4873. Select all frames in input:
  4874. @example
  4875. select
  4876. @end example
  4877. The example above is the same as:
  4878. @example
  4879. select=1
  4880. @end example
  4881. @item
  4882. Skip all frames:
  4883. @example
  4884. select=0
  4885. @end example
  4886. @item
  4887. Select only I-frames:
  4888. @example
  4889. select='eq(pict_type\,I)'
  4890. @end example
  4891. @item
  4892. Select one frame every 100:
  4893. @example
  4894. select='not(mod(n\,100))'
  4895. @end example
  4896. @item
  4897. Select only frames contained in the 10-20 time interval:
  4898. @example
  4899. select='gte(t\,10)*lte(t\,20)'
  4900. @end example
  4901. @item
  4902. Select only I frames contained in the 10-20 time interval:
  4903. @example
  4904. select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
  4905. @end example
  4906. @item
  4907. Select frames with a minimum distance of 10 seconds:
  4908. @example
  4909. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  4910. @end example
  4911. @item
  4912. Use aselect to select only audio frames with samples number > 100:
  4913. @example
  4914. aselect='gt(samples_n\,100)'
  4915. @end example
  4916. @item
  4917. Create a mosaic of the first scenes:
  4918. @example
  4919. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  4920. @end example
  4921. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  4922. choice.
  4923. @end itemize
  4924. @section asendcmd, sendcmd
  4925. Send commands to filters in the filtergraph.
  4926. These filters read commands to be sent to other filters in the
  4927. filtergraph.
  4928. @code{asendcmd} must be inserted between two audio filters,
  4929. @code{sendcmd} must be inserted between two video filters, but apart
  4930. from that they act the same way.
  4931. The specification of commands can be provided in the filter arguments
  4932. with the @var{commands} option, or in a file specified by the
  4933. @var{filename} option.
  4934. These filters accept the following options:
  4935. @table @option
  4936. @item commands, c
  4937. Set the commands to be read and sent to the other filters.
  4938. @item filename, f
  4939. Set the filename of the commands to be read and sent to the other
  4940. filters.
  4941. @end table
  4942. @subsection Commands syntax
  4943. A commands description consists of a sequence of interval
  4944. specifications, comprising a list of commands to be executed when a
  4945. particular event related to that interval occurs. The occurring event
  4946. is typically the current frame time entering or leaving a given time
  4947. interval.
  4948. An interval is specified by the following syntax:
  4949. @example
  4950. @var{START}[-@var{END}] @var{COMMANDS};
  4951. @end example
  4952. The time interval is specified by the @var{START} and @var{END} times.
  4953. @var{END} is optional and defaults to the maximum time.
  4954. The current frame time is considered within the specified interval if
  4955. it is included in the interval [@var{START}, @var{END}), that is when
  4956. the time is greater or equal to @var{START} and is lesser than
  4957. @var{END}.
  4958. @var{COMMANDS} consists of a sequence of one or more command
  4959. specifications, separated by ",", relating to that interval. The
  4960. syntax of a command specification is given by:
  4961. @example
  4962. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  4963. @end example
  4964. @var{FLAGS} is optional and specifies the type of events relating to
  4965. the time interval which enable sending the specified command, and must
  4966. be a non-null sequence of identifier flags separated by "+" or "|" and
  4967. enclosed between "[" and "]".
  4968. The following flags are recognized:
  4969. @table @option
  4970. @item enter
  4971. The command is sent when the current frame timestamp enters the
  4972. specified interval. In other words, the command is sent when the
  4973. previous frame timestamp was not in the given interval, and the
  4974. current is.
  4975. @item leave
  4976. The command is sent when the current frame timestamp leaves the
  4977. specified interval. In other words, the command is sent when the
  4978. previous frame timestamp was in the given interval, and the
  4979. current is not.
  4980. @end table
  4981. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  4982. assumed.
  4983. @var{TARGET} specifies the target of the command, usually the name of
  4984. the filter class or a specific filter instance name.
  4985. @var{COMMAND} specifies the name of the command for the target filter.
  4986. @var{ARG} is optional and specifies the optional list of argument for
  4987. the given @var{COMMAND}.
  4988. Between one interval specification and another, whitespaces, or
  4989. sequences of characters starting with @code{#} until the end of line,
  4990. are ignored and can be used to annotate comments.
  4991. A simplified BNF description of the commands specification syntax
  4992. follows:
  4993. @example
  4994. @var{COMMAND_FLAG} ::= "enter" | "leave"
  4995. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  4996. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  4997. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  4998. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  4999. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  5000. @end example
  5001. @subsection Examples
  5002. @itemize
  5003. @item
  5004. Specify audio tempo change at second 4:
  5005. @example
  5006. asendcmd=c='4.0 atempo tempo 1.5',atempo
  5007. @end example
  5008. @item
  5009. Specify a list of drawtext and hue commands in a file.
  5010. @example
  5011. # show text in the interval 5-10
  5012. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  5013. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  5014. # desaturate the image in the interval 15-20
  5015. 15.0-20.0 [enter] hue reinit s=0,
  5016. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  5017. [leave] hue reinit s=1,
  5018. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  5019. # apply an exponential saturation fade-out effect, starting from time 25
  5020. 25 [enter] hue s=exp(t-25)
  5021. @end example
  5022. A filtergraph allowing to read and process the above command list
  5023. stored in a file @file{test.cmd}, can be specified with:
  5024. @example
  5025. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  5026. @end example
  5027. @end itemize
  5028. @anchor{setpts}
  5029. @section asetpts, setpts
  5030. Change the PTS (presentation timestamp) of the input frames.
  5031. @code{asetpts} works on audio frames, @code{setpts} on video frames.
  5032. Accept in input an expression evaluated through the eval API, which
  5033. can contain the following constants:
  5034. @table @option
  5035. @item FRAME_RATE
  5036. frame rate, only defined for constant frame-rate video
  5037. @item PTS
  5038. the presentation timestamp in input
  5039. @item N
  5040. the count of the input frame, starting from 0.
  5041. @item NB_CONSUMED_SAMPLES
  5042. the number of consumed samples, not including the current frame (only
  5043. audio)
  5044. @item NB_SAMPLES
  5045. the number of samples in the current frame (only audio)
  5046. @item SAMPLE_RATE
  5047. audio sample rate
  5048. @item STARTPTS
  5049. the PTS of the first frame
  5050. @item STARTT
  5051. the time in seconds of the first frame
  5052. @item INTERLACED
  5053. tell if the current frame is interlaced
  5054. @item T
  5055. the time in seconds of the current frame
  5056. @item TB
  5057. the time base
  5058. @item POS
  5059. original position in the file of the frame, or undefined if undefined
  5060. for the current frame
  5061. @item PREV_INPTS
  5062. previous input PTS
  5063. @item PREV_INT
  5064. previous input time in seconds
  5065. @item PREV_OUTPTS
  5066. previous output PTS
  5067. @item PREV_OUTT
  5068. previous output time in seconds
  5069. @item RTCTIME
  5070. wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  5071. instead.
  5072. @item RTCSTART
  5073. wallclock (RTC) time at the start of the movie in microseconds
  5074. @end table
  5075. @subsection Examples
  5076. @itemize
  5077. @item
  5078. Start counting PTS from zero
  5079. @example
  5080. setpts=PTS-STARTPTS
  5081. @end example
  5082. @item
  5083. Apply fast motion effect:
  5084. @example
  5085. setpts=0.5*PTS
  5086. @end example
  5087. @item
  5088. Apply slow motion effect:
  5089. @example
  5090. setpts=2.0*PTS
  5091. @end example
  5092. @item
  5093. Set fixed rate of 25 frames per second:
  5094. @example
  5095. setpts=N/(25*TB)
  5096. @end example
  5097. @item
  5098. Set fixed rate 25 fps with some jitter:
  5099. @example
  5100. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  5101. @end example
  5102. @item
  5103. Apply an offset of 10 seconds to the input PTS:
  5104. @example
  5105. setpts=PTS+10/TB
  5106. @end example
  5107. @item
  5108. Generate timestamps from a "live source" and rebase onto the current timebase:
  5109. @example
  5110. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  5111. @end example
  5112. @end itemize
  5113. @section ebur128
  5114. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  5115. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  5116. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  5117. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  5118. The filter also has a video output (see the @var{video} option) with a real
  5119. time graph to observe the loudness evolution. The graphic contains the logged
  5120. message mentioned above, so it is not printed anymore when this option is set,
  5121. unless the verbose logging is set. The main graphing area contains the
  5122. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  5123. the momentary loudness (400 milliseconds).
  5124. More information about the Loudness Recommendation EBU R128 on
  5125. @url{http://tech.ebu.ch/loudness}.
  5126. The filter accepts the following named parameters:
  5127. @table @option
  5128. @item video
  5129. Activate the video output. The audio stream is passed unchanged whether this
  5130. option is set or no. The video stream will be the first output stream if
  5131. activated. Default is @code{0}.
  5132. @item size
  5133. Set the video size. This option is for video only. Default and minimum
  5134. resolution is @code{640x480}.
  5135. @item meter
  5136. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  5137. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  5138. other integer value between this range is allowed.
  5139. @item metadata
  5140. Set metadata injection. If set to @code{1}, the audio input will be segmented
  5141. into 100ms output frames, each of them containing various loudness information
  5142. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  5143. Default is @code{0}.
  5144. @item framelog
  5145. Force the frame logging level.
  5146. Available values are:
  5147. @table @samp
  5148. @item info
  5149. information logging level
  5150. @item verbose
  5151. verbose logging level
  5152. @end table
  5153. By default, the logging level is set to @var{info}. If the @option{video} or
  5154. the @option{metadata} options are set, it switches to @var{verbose}.
  5155. @end table
  5156. @subsection Examples
  5157. @itemize
  5158. @item
  5159. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  5160. @example
  5161. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  5162. @end example
  5163. @item
  5164. Run an analysis with @command{ffmpeg}:
  5165. @example
  5166. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  5167. @end example
  5168. @end itemize
  5169. @section settb, asettb
  5170. Set the timebase to use for the output frames timestamps.
  5171. It is mainly useful for testing timebase configuration.
  5172. This filter accepts a single option @option{tb}, which can be
  5173. specified either by setting @option{tb}=@var{VALUE} or setting the
  5174. value alone.
  5175. The value for @option{tb} is an arithmetic expression representing a
  5176. rational. The expression can contain the constants "AVTB" (the default
  5177. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  5178. audio only). Default value is "intb".
  5179. @subsection Examples
  5180. @itemize
  5181. @item
  5182. Set the timebase to 1/25:
  5183. @example
  5184. settb=1/25
  5185. @end example
  5186. @item
  5187. Set the timebase to 1/10:
  5188. @example
  5189. settb=0.1
  5190. @end example
  5191. @item
  5192. Set the timebase to 1001/1000:
  5193. @example
  5194. settb=1+0.001
  5195. @end example
  5196. @item
  5197. Set the timebase to 2*intb:
  5198. @example
  5199. settb=2*intb
  5200. @end example
  5201. @item
  5202. Set the default timebase value:
  5203. @example
  5204. settb=AVTB
  5205. @end example
  5206. @end itemize
  5207. @section concat
  5208. Concatenate audio and video streams, joining them together one after the
  5209. other.
  5210. The filter works on segments of synchronized video and audio streams. All
  5211. segments must have the same number of streams of each type, and that will
  5212. also be the number of streams at output.
  5213. The filter accepts the following named parameters:
  5214. @table @option
  5215. @item n
  5216. Set the number of segments. Default is 2.
  5217. @item v
  5218. Set the number of output video streams, that is also the number of video
  5219. streams in each segment. Default is 1.
  5220. @item a
  5221. Set the number of output audio streams, that is also the number of video
  5222. streams in each segment. Default is 0.
  5223. @item unsafe
  5224. Activate unsafe mode: do not fail if segments have a different format.
  5225. @end table
  5226. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  5227. @var{a} audio outputs.
  5228. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  5229. segment, in the same order as the outputs, then the inputs for the second
  5230. segment, etc.
  5231. Related streams do not always have exactly the same duration, for various
  5232. reasons including codec frame size or sloppy authoring. For that reason,
  5233. related synchronized streams (e.g. a video and its audio track) should be
  5234. concatenated at once. The concat filter will use the duration of the longest
  5235. stream in each segment (except the last one), and if necessary pad shorter
  5236. audio streams with silence.
  5237. For this filter to work correctly, all segments must start at timestamp 0.
  5238. All corresponding streams must have the same parameters in all segments; the
  5239. filtering system will automatically select a common pixel format for video
  5240. streams, and a common sample format, sample rate and channel layout for
  5241. audio streams, but other settings, such as resolution, must be converted
  5242. explicitly by the user.
  5243. Different frame rates are acceptable but will result in variable frame rate
  5244. at output; be sure to configure the output file to handle it.
  5245. @subsection Examples
  5246. @itemize
  5247. @item
  5248. Concatenate an opening, an episode and an ending, all in bilingual version
  5249. (video in stream 0, audio in streams 1 and 2):
  5250. @example
  5251. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  5252. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  5253. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  5254. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  5255. @end example
  5256. @item
  5257. Concatenate two parts, handling audio and video separately, using the
  5258. (a)movie sources, and adjusting the resolution:
  5259. @example
  5260. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  5261. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  5262. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  5263. @end example
  5264. Note that a desync will happen at the stitch if the audio and video streams
  5265. do not have exactly the same duration in the first file.
  5266. @end itemize
  5267. @section showspectrum
  5268. Convert input audio to a video output, representing the audio frequency
  5269. spectrum.
  5270. The filter accepts the following named parameters:
  5271. @table @option
  5272. @item size, s
  5273. Specify the video size for the output. Default value is @code{640x512}.
  5274. @item slide
  5275. Specify if the spectrum should slide along the window. Default value is
  5276. @code{0}.
  5277. @item mode
  5278. Specify display mode.
  5279. It accepts the following values:
  5280. @table @samp
  5281. @item combined
  5282. all channels are displayed in the same row
  5283. @item separate
  5284. all channels are displayed in separate rows
  5285. @end table
  5286. Default value is @samp{combined}.
  5287. @item color
  5288. Specify display color mode.
  5289. It accepts the following values:
  5290. @table @samp
  5291. @item channel
  5292. each channel is displayed in a separate color
  5293. @item intensity
  5294. each channel is is displayed using the same color scheme
  5295. @end table
  5296. Default value is @samp{channel}.
  5297. @item scale
  5298. Specify scale used for calculating intensity color values.
  5299. It accepts the following values:
  5300. @table @samp
  5301. @item lin
  5302. linear
  5303. @item sqrt
  5304. square root, default
  5305. @item cbrt
  5306. cubic root
  5307. @item log
  5308. logarithmic
  5309. @end table
  5310. Default value is @samp{sqrt}.
  5311. @item saturation
  5312. Set saturation modifier for displayed colors. Negative values provide
  5313. alternative color scheme. @code{0} is no saturation at all.
  5314. Saturation must be in [-10.0, 10.0] range.
  5315. Default value is @code{1}.
  5316. @end table
  5317. The usage is very similar to the showwaves filter; see the examples in that
  5318. section.
  5319. @subsection Examples
  5320. @itemize
  5321. @item
  5322. Large window with logarithmic color scaling:
  5323. @example
  5324. showspectrum=s=1280x480:scale=log
  5325. @end example
  5326. @item
  5327. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  5328. @example
  5329. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  5330. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  5331. @end example
  5332. @end itemize
  5333. @section showwaves
  5334. Convert input audio to a video output, representing the samples waves.
  5335. The filter accepts the following named parameters:
  5336. @table @option
  5337. @item mode
  5338. Set display mode.
  5339. Available values are:
  5340. @table @samp
  5341. @item point
  5342. Draw a point for each sample.
  5343. @item line
  5344. Draw a vertical line for each sample.
  5345. @end table
  5346. Default value is @code{point}.
  5347. @item n
  5348. Set the number of samples which are printed on the same column. A
  5349. larger value will decrease the frame rate. Must be a positive
  5350. integer. This option can be set only if the value for @var{rate}
  5351. is not explicitly specified.
  5352. @item rate, r
  5353. Set the (approximate) output frame rate. This is done by setting the
  5354. option @var{n}. Default value is "25".
  5355. @item size, s
  5356. Specify the video size for the output. Default value is "600x240".
  5357. @end table
  5358. @subsection Examples
  5359. @itemize
  5360. @item
  5361. Output the input file audio and the corresponding video representation
  5362. at the same time:
  5363. @example
  5364. amovie=a.mp3,asplit[out0],showwaves[out1]
  5365. @end example
  5366. @item
  5367. Create a synthetic signal and show it with showwaves, forcing a
  5368. framerate of 30 frames per second:
  5369. @example
  5370. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  5371. @end example
  5372. @end itemize
  5373. @c man end MULTIMEDIA FILTERS
  5374. @chapter Multimedia Sources
  5375. @c man begin MULTIMEDIA SOURCES
  5376. Below is a description of the currently available multimedia sources.
  5377. @section amovie
  5378. This is the same as @ref{movie} source, except it selects an audio
  5379. stream by default.
  5380. @anchor{movie}
  5381. @section movie
  5382. Read audio and/or video stream(s) from a movie container.
  5383. It accepts the syntax: @var{movie_name}[:@var{options}] where
  5384. @var{movie_name} is the name of the resource to read (not necessarily
  5385. a file but also a device or a stream accessed through some protocol),
  5386. and @var{options} is an optional sequence of @var{key}=@var{value}
  5387. pairs, separated by ":".
  5388. The description of the accepted options follows.
  5389. @table @option
  5390. @item format_name, f
  5391. Specifies the format assumed for the movie to read, and can be either
  5392. the name of a container or an input device. If not specified the
  5393. format is guessed from @var{movie_name} or by probing.
  5394. @item seek_point, sp
  5395. Specifies the seek point in seconds, the frames will be output
  5396. starting from this seek point, the parameter is evaluated with
  5397. @code{av_strtod} so the numerical value may be suffixed by an IS
  5398. postfix. Default value is "0".
  5399. @item streams, s
  5400. Specifies the streams to read. Several streams can be specified,
  5401. separated by "+". The source will then have as many outputs, in the
  5402. same order. The syntax is explained in the ``Stream specifiers''
  5403. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  5404. respectively the default (best suited) video and audio stream. Default
  5405. is "dv", or "da" if the filter is called as "amovie".
  5406. @item stream_index, si
  5407. Specifies the index of the video stream to read. If the value is -1,
  5408. the best suited video stream will be automatically selected. Default
  5409. value is "-1". Deprecated. If the filter is called "amovie", it will select
  5410. audio instead of video.
  5411. @item loop
  5412. Specifies how many times to read the stream in sequence.
  5413. If the value is less than 1, the stream will be read again and again.
  5414. Default value is "1".
  5415. Note that when the movie is looped the source timestamps are not
  5416. changed, so it will generate non monotonically increasing timestamps.
  5417. @end table
  5418. This filter allows to overlay a second video on top of main input of
  5419. a filtergraph as shown in this graph:
  5420. @example
  5421. input -----------> deltapts0 --> overlay --> output
  5422. ^
  5423. |
  5424. movie --> scale--> deltapts1 -------+
  5425. @end example
  5426. @subsection Examples
  5427. @itemize
  5428. @item
  5429. Skip 3.2 seconds from the start of the avi file in.avi, and overlay it
  5430. on top of the input labelled as "in":
  5431. @example
  5432. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
  5433. [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
  5434. @end example
  5435. @item
  5436. Read from a video4linux2 device, and overlay it on top of the input
  5437. labelled as "in":
  5438. @example
  5439. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
  5440. [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
  5441. @end example
  5442. @item
  5443. Read the first video stream and the audio stream with id 0x81 from
  5444. dvd.vob; the video is connected to the pad named "video" and the audio is
  5445. connected to the pad named "audio":
  5446. @example
  5447. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  5448. @end example
  5449. @end itemize
  5450. @c man end MULTIMEDIA SOURCES