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.

6978 lines
191KB

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