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.

6909 lines
189KB

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