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.

3874 lines
108KB

  1. @chapter Filtergraph description
  2. @c man begin FILTERGRAPH DESCRIPTION
  3. A filtergraph is a directed graph of connected filters. It can contain
  4. cycles, and there can be multiple links between a pair of
  5. filters. Each link has one input pad on one side connecting it to one
  6. filter from which it takes its input, and one output pad on the other
  7. side connecting it to the one filter accepting its output.
  8. Each filter in a filtergraph is an instance of a filter class
  9. registered in the application, which defines the features and the
  10. number of input and output pads of the filter.
  11. A filter with no input pads is called a "source", a filter with no
  12. output pads is called a "sink".
  13. @anchor{Filtergraph syntax}
  14. @section Filtergraph syntax
  15. A filtergraph can be represented using a textual representation, which is
  16. recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
  17. options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
  18. @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} function defined in
  19. @file{libavfilter/avfiltergraph.h}.
  20. A filterchain consists of a sequence of connected filters, each one
  21. connected to the previous one in the sequence. A filterchain is
  22. represented by a list of ","-separated filter descriptions.
  23. A filtergraph consists of a sequence of filterchains. A sequence of
  24. filterchains is represented by a list of ";"-separated filterchain
  25. descriptions.
  26. A filter is represented by a string of the form:
  27. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  28. @var{filter_name} is the name of the filter class of which the
  29. described filter is an instance of, and has to be the name of one of
  30. the filter classes registered in the program.
  31. The name of the filter class is optionally followed by a string
  32. "=@var{arguments}".
  33. @var{arguments} is a string which contains the parameters used to
  34. initialize the filter instance, and are described in the filter
  35. descriptions below.
  36. The list of arguments can be quoted using the character "'" as initial
  37. and ending mark, and the character '\' for escaping the characters
  38. within the quoted text; otherwise the argument string is considered
  39. terminated when the next special character (belonging to the set
  40. "[]=;,") is encountered.
  41. The name and arguments of the filter are optionally preceded and
  42. followed by a list of link labels.
  43. A link label allows to name a link and associate it to a filter output
  44. or input pad. The preceding labels @var{in_link_1}
  45. ... @var{in_link_N}, are associated to the filter input pads,
  46. the following labels @var{out_link_1} ... @var{out_link_M}, are
  47. associated to the output pads.
  48. When two link labels with the same name are found in the
  49. filtergraph, a link between the corresponding input and output pad is
  50. created.
  51. If an output pad is not labelled, it is linked by default to the first
  52. unlabelled input pad of the next filter in the filterchain.
  53. For example in the filterchain:
  54. @example
  55. nullsrc, split[L1], [L2]overlay, nullsink
  56. @end example
  57. the split filter instance has two output pads, and the overlay filter
  58. instance two input pads. The first output pad of split is labelled
  59. "L1", the first input pad of overlay is labelled "L2", and the second
  60. output pad of split is linked to the second input pad of overlay,
  61. which are both unlabelled.
  62. In a complete filterchain all the unlabelled filter input and output
  63. pads must be connected. A filtergraph is considered valid if all the
  64. filter input and output pads of all the filterchains are connected.
  65. Libavfilter will automatically insert scale filters where format
  66. conversion is required. It is possible to specify swscale flags
  67. for those automatically inserted scalers by prepending
  68. @code{sws_flags=@var{flags};}
  69. to the filtergraph description.
  70. Follows a BNF description for the filtergraph syntax:
  71. @example
  72. @var{NAME} ::= sequence of alphanumeric characters and '_'
  73. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  74. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  75. @var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
  76. @var{FILTER} ::= [@var{LINKNAMES}] @var{NAME} ["=" @var{ARGUMENTS}] [@var{LINKNAMES}]
  77. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  78. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  79. @end example
  80. @c man end FILTERGRAPH DESCRIPTION
  81. @chapter Audio Filters
  82. @c man begin AUDIO FILTERS
  83. When you configure your FFmpeg build, you can disable any of the
  84. existing filters using @code{--disable-filters}.
  85. The configure output will show the audio filters included in your
  86. build.
  87. Below is a description of the currently available audio filters.
  88. @section aconvert
  89. Convert the input audio format to the specified formats.
  90. The filter accepts a string of the form:
  91. "@var{sample_format}:@var{channel_layout}".
  92. @var{sample_format} specifies the sample format, and can be a string or the
  93. corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p'
  94. suffix for a planar sample format.
  95. @var{channel_layout} specifies the channel layout, and can be a string
  96. or the corresponding number value defined in @file{libavutil/audioconvert.h}.
  97. The special parameter "auto", signifies that the filter will
  98. automatically select the output format depending on the output filter.
  99. Some examples follow.
  100. @itemize
  101. @item
  102. Convert input to float, planar, stereo:
  103. @example
  104. aconvert=fltp:stereo
  105. @end example
  106. @item
  107. Convert input to unsigned 8-bit, automatically select out channel layout:
  108. @example
  109. aconvert=u8:auto
  110. @end example
  111. @end itemize
  112. @section aformat
  113. Convert the input audio to one of the specified formats. The framework will
  114. negotiate the most appropriate format to minimize conversions.
  115. The filter accepts the following named parameters:
  116. @table @option
  117. @item sample_fmts
  118. A comma-separated list of requested sample formats.
  119. @item sample_rates
  120. A comma-separated list of requested sample rates.
  121. @item channel_layouts
  122. A comma-separated list of requested channel layouts.
  123. @end table
  124. If a parameter is omitted, all values are allowed.
  125. For example to force the output to either unsigned 8-bit or signed 16-bit stereo:
  126. @example
  127. aformat=sample_fmts\=u8\,s16:channel_layouts\=stereo
  128. @end example
  129. @section amerge
  130. Merge two or more audio streams into a single multi-channel stream.
  131. The filter accepts the following named options:
  132. @table @option
  133. @item inputs
  134. Set the number of inputs. Default is 2.
  135. @end table
  136. If the channel layouts of the inputs are disjoint, and therefore compatible,
  137. the channel layout of the output will be set accordingly and the channels
  138. will be reordered as necessary. If the channel layouts of the inputs are not
  139. disjoint, the output will have all the channels of the first input then all
  140. the channels of the second input, in that order, and the channel layout of
  141. the output will be the default value corresponding to the total number of
  142. channels.
  143. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  144. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  145. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  146. first input, b1 is the first channel of the second input).
  147. On the other hand, if both input are in stereo, the output channels will be
  148. in the default order: a1, a2, b1, b2, and the channel layout will be
  149. arbitrarily set to 4.0, which may or may not be the expected value.
  150. All inputs must have the same sample rate, and format.
  151. If inputs do not have the same duration, the output will stop with the
  152. shortest.
  153. Example: merge two mono files into a stereo stream:
  154. @example
  155. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  156. @end example
  157. Example: multiple merges:
  158. @example
  159. ffmpeg -f lavfi -i "
  160. amovie=input.mkv:si=0 [a0];
  161. amovie=input.mkv:si=1 [a1];
  162. amovie=input.mkv:si=2 [a2];
  163. amovie=input.mkv:si=3 [a3];
  164. amovie=input.mkv:si=4 [a4];
  165. amovie=input.mkv:si=5 [a5];
  166. [a0][a1][a2][a3][a4][a5] amerge=inputs=6" -c:a pcm_s16le output.mkv
  167. @end example
  168. @section amix
  169. Mixes multiple audio inputs into a single output.
  170. For example
  171. @example
  172. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  173. @end example
  174. will mix 3 input audio streams to a single output with the same duration as the
  175. first input and a dropout transition time of 3 seconds.
  176. The filter accepts the following named parameters:
  177. @table @option
  178. @item inputs
  179. Number of inputs. If unspecified, it defaults to 2.
  180. @item duration
  181. How to determine the end-of-stream.
  182. @table @option
  183. @item longest
  184. Duration of longest input. (default)
  185. @item shortest
  186. Duration of shortest input.
  187. @item first
  188. Duration of first input.
  189. @end table
  190. @item dropout_transition
  191. Transition time, in seconds, for volume renormalization when an input
  192. stream ends. The default value is 2 seconds.
  193. @end table
  194. @section anull
  195. Pass the audio source unchanged to the output.
  196. @section aresample
  197. Resample the input audio to the specified sample rate.
  198. The filter accepts exactly one parameter, the output sample rate. If not
  199. specified then the filter will automatically convert between its input
  200. and output sample rates.
  201. For example, to resample the input audio to 44100Hz:
  202. @example
  203. aresample=44100
  204. @end example
  205. @section asetnsamples
  206. Set the number of samples per each output audio frame.
  207. The last output packet may contain a different number of samples, as
  208. the filter will flush all the remaining samples when the input audio
  209. signal its end.
  210. The filter accepts parameters as a list of @var{key}=@var{value} pairs,
  211. separated by ":".
  212. @table @option
  213. @item nb_out_samples, n
  214. Set the number of frames per each output audio frame. The number is
  215. intended as the number of samples @emph{per each channel}.
  216. Default value is 1024.
  217. @item pad, p
  218. If set to 1, the filter will pad the last audio frame with zeroes, so
  219. that the last frame will contain the same number of samples as the
  220. previous ones. Default value is 1.
  221. @end table
  222. For example, to set the number of per-frame samples to 1234 and
  223. disable padding for the last frame, use:
  224. @example
  225. asetnsamples=n=1234:p=0
  226. @end example
  227. @section ashowinfo
  228. Show a line containing various information for each input audio frame.
  229. The input audio is not modified.
  230. The shown line contains a sequence of key/value pairs of the form
  231. @var{key}:@var{value}.
  232. A description of each shown parameter follows:
  233. @table @option
  234. @item n
  235. sequential number of the input frame, starting from 0
  236. @item pts
  237. presentation TimeStamp of the input frame, expressed as a number of
  238. time base units. The time base unit depends on the filter input pad, and
  239. is usually 1/@var{sample_rate}.
  240. @item pts_time
  241. presentation TimeStamp of the input frame, expressed as a number of
  242. seconds
  243. @item pos
  244. position of the frame in the input stream, -1 if this information in
  245. unavailable and/or meaningless (for example in case of synthetic audio)
  246. @item fmt
  247. sample format name
  248. @item chlayout
  249. channel layout description
  250. @item nb_samples
  251. number of samples (per each channel) contained in the filtered frame
  252. @item rate
  253. sample rate for the audio frame
  254. @item checksum
  255. Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
  256. @item plane_checksum
  257. Adler-32 checksum (printed in hexadecimal) for each input frame plane,
  258. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3} @var{c4} @var{c5}
  259. @var{c6} @var{c7}]"
  260. @end table
  261. @section asplit
  262. Split input audio into several identical outputs.
  263. The filter accepts a single parameter which specifies the number of outputs. If
  264. unspecified, it defaults to 2.
  265. For example:
  266. @example
  267. [in] asplit [out0][out1]
  268. @end example
  269. will create two separate outputs from the same input.
  270. To create 3 or more outputs, you need to specify the number of
  271. outputs, like in:
  272. @example
  273. [in] asplit=3 [out0][out1][out2]
  274. @end example
  275. @example
  276. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  277. @end example
  278. will create 5 copies of the input audio.
  279. @section astreamsync
  280. Forward two audio streams and control the order the buffers are forwarded.
  281. The argument to the filter is an expression deciding which stream should be
  282. forwarded next: if the result is negative, the first stream is forwarded; if
  283. the result is positive or zero, the second stream is forwarded. It can use
  284. the following variables:
  285. @table @var
  286. @item b1 b2
  287. number of buffers forwarded so far on each stream
  288. @item s1 s2
  289. number of samples forwarded so far on each stream
  290. @item t1 t2
  291. current timestamp of each stream
  292. @end table
  293. The default value is @code{t1-t2}, which means to always forward the stream
  294. that has a smaller timestamp.
  295. Example: stress-test @code{amerge} by randomly sending buffers on the wrong
  296. input, while avoiding too much of a desynchronization:
  297. @example
  298. amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
  299. [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
  300. [a2] [b2] amerge
  301. @end example
  302. @section atempo
  303. Adjust audio tempo.
  304. The filter accepts exactly one parameter, the audio tempo. If not
  305. specified then the filter will assume nominal 1.0 tempo. Tempo must
  306. be in the [0.5, 2.0] range.
  307. For example, to slow down audio to 80% tempo:
  308. @example
  309. atempo=0.8
  310. @end example
  311. For example, to speed up audio to 125% tempo:
  312. @example
  313. atempo=1.25
  314. @end example
  315. @section earwax
  316. Make audio easier to listen to on headphones.
  317. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  318. so that when listened to on headphones the stereo image is moved from
  319. inside your head (standard for headphones) to outside and in front of
  320. the listener (standard for speakers).
  321. Ported from SoX.
  322. @section pan
  323. Mix channels with specific gain levels. The filter accepts the output
  324. channel layout followed by a set of channels definitions.
  325. This filter is also designed to remap efficiently the channels of an audio
  326. stream.
  327. The filter accepts parameters of the form:
  328. "@var{l}:@var{outdef}:@var{outdef}:..."
  329. @table @option
  330. @item l
  331. output channel layout or number of channels
  332. @item outdef
  333. output channel specification, of the form:
  334. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  335. @item out_name
  336. output channel to define, either a channel name (FL, FR, etc.) or a channel
  337. number (c0, c1, etc.)
  338. @item gain
  339. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  340. @item in_name
  341. input channel to use, see out_name for details; it is not possible to mix
  342. named and numbered input channels
  343. @end table
  344. If the `=' in a channel specification is replaced by `<', then the gains for
  345. that specification will be renormalized so that the total is 1, thus
  346. avoiding clipping noise.
  347. @subsection Mixing examples
  348. For example, if you want to down-mix from stereo to mono, but with a bigger
  349. factor for the left channel:
  350. @example
  351. pan=1:c0=0.9*c0+0.1*c1
  352. @end example
  353. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  354. 7-channels surround:
  355. @example
  356. pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  357. @end example
  358. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  359. that should be preferred (see "-ac" option) unless you have very specific
  360. needs.
  361. @subsection Remapping examples
  362. The channel remapping will be effective if, and only if:
  363. @itemize
  364. @item gain coefficients are zeroes or ones,
  365. @item only one input per channel output,
  366. @end itemize
  367. If all these conditions are satisfied, the filter will notify the user ("Pure
  368. channel mapping detected"), and use an optimized and lossless method to do the
  369. remapping.
  370. For example, if you have a 5.1 source and want a stereo audio stream by
  371. dropping the extra channels:
  372. @example
  373. pan="stereo: c0=FL : c1=FR"
  374. @end example
  375. Given the same source, you can also switch front left and front right channels
  376. and keep the input channel layout:
  377. @example
  378. pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
  379. @end example
  380. If the input is a stereo audio stream, you can mute the front left channel (and
  381. still keep the stereo channel layout) with:
  382. @example
  383. pan="stereo:c1=c1"
  384. @end example
  385. Still with a stereo audio stream input, you can copy the right channel in both
  386. front left and right:
  387. @example
  388. pan="stereo: c0=FR : c1=FR"
  389. @end example
  390. @section silencedetect
  391. Detect silence in an audio stream.
  392. This filter logs a message when it detects that the input audio volume is less
  393. or equal to a noise tolerance value for a duration greater or equal to the
  394. minimum detected noise duration.
  395. The printed times and duration are expressed in seconds.
  396. @table @option
  397. @item duration, d
  398. Set silence duration until notification (default is 2 seconds).
  399. @item noise, n
  400. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  401. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  402. @end table
  403. Detect 5 seconds of silence with -50dB noise tolerance:
  404. @example
  405. silencedetect=n=-50dB:d=5
  406. @end example
  407. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  408. tolerance in @file{silence.mp3}:
  409. @example
  410. ffmpeg -f lavfi -i amovie=silence.mp3,silencedetect=noise=0.0001 -f null -
  411. @end example
  412. @section volume
  413. Adjust the input audio volume.
  414. The filter accepts exactly one parameter @var{vol}, which expresses
  415. how the audio volume will be increased or decreased.
  416. Output values are clipped to the maximum value.
  417. If @var{vol} is expressed as a decimal number, the output audio
  418. volume is given by the relation:
  419. @example
  420. @var{output_volume} = @var{vol} * @var{input_volume}
  421. @end example
  422. If @var{vol} is expressed as a decimal number followed by the string
  423. "dB", the value represents the requested change in decibels of the
  424. input audio power, and the output audio volume is given by the
  425. relation:
  426. @example
  427. @var{output_volume} = 10^(@var{vol}/20) * @var{input_volume}
  428. @end example
  429. Otherwise @var{vol} is considered an expression and its evaluated
  430. value is used for computing the output audio volume according to the
  431. first relation.
  432. Default value for @var{vol} is 1.0.
  433. @subsection Examples
  434. @itemize
  435. @item
  436. Half the input audio volume:
  437. @example
  438. volume=0.5
  439. @end example
  440. The above example is equivalent to:
  441. @example
  442. volume=1/2
  443. @end example
  444. @item
  445. Decrease input audio power by 12 decibels:
  446. @example
  447. volume=-12dB
  448. @end example
  449. @end itemize
  450. @section asyncts
  451. Synchronize audio data with timestamps by squeezing/stretching it and/or
  452. dropping samples/adding silence when needed.
  453. The filter accepts the following named parameters:
  454. @table @option
  455. @item compensate
  456. Enable stretching/squeezing the data to make it match the timestamps.
  457. @item min_delta
  458. Minimum difference between timestamps and audio data (in seconds) to trigger
  459. adding/dropping samples.
  460. @item max_comp
  461. Maximum compensation in samples per second.
  462. @end table
  463. @section channelsplit
  464. Split each channel in input audio stream into a separate output stream.
  465. This filter accepts the following named parameters:
  466. @table @option
  467. @item channel_layout
  468. Channel layout of the input stream. Default is "stereo".
  469. @end table
  470. For example, assuming a stereo input MP3 file
  471. @example
  472. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  473. @end example
  474. will create an output Matroska file with two audio streams, one containing only
  475. the left channel and the other the right channel.
  476. To split a 5.1 WAV file into per-channel files
  477. @example
  478. ffmpeg -i in.wav -filter_complex
  479. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  480. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  481. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  482. side_right.wav
  483. @end example
  484. @section resample
  485. Convert the audio sample format, sample rate and channel layout. This filter is
  486. not meant to be used directly.
  487. @c man end AUDIO FILTERS
  488. @chapter Audio Sources
  489. @c man begin AUDIO SOURCES
  490. Below is a description of the currently available audio sources.
  491. @section abuffer
  492. Buffer audio frames, and make them available to the filter chain.
  493. This source is mainly intended for a programmatic use, in particular
  494. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  495. It accepts the following mandatory parameters:
  496. @var{sample_rate}:@var{sample_fmt}:@var{channel_layout}
  497. @table @option
  498. @item sample_rate
  499. The sample rate of the incoming audio buffers.
  500. @item sample_fmt
  501. The sample format of the incoming audio buffers.
  502. Either a sample format name or its corresponging integer representation from
  503. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  504. @item channel_layout
  505. The channel layout of the incoming audio buffers.
  506. Either a channel layout name from channel_layout_map in
  507. @file{libavutil/audioconvert.c} or its corresponding integer representation
  508. from the AV_CH_LAYOUT_* macros in @file{libavutil/audioconvert.h}
  509. @end table
  510. For example:
  511. @example
  512. abuffer=44100:s16p:stereo
  513. @end example
  514. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  515. Since the sample format with name "s16p" corresponds to the number
  516. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  517. equivalent to:
  518. @example
  519. abuffer=44100:6:0x3
  520. @end example
  521. @section aevalsrc
  522. Generate an audio signal specified by an expression.
  523. This source accepts in input one or more expressions (one for each
  524. channel), which are evaluated and used to generate a corresponding
  525. audio signal.
  526. It accepts the syntax: @var{exprs}[::@var{options}].
  527. @var{exprs} is a list of expressions separated by ":", one for each
  528. separate channel. In case the @var{channel_layout} is not
  529. specified, the selected channel layout depends on the number of
  530. provided expressions.
  531. @var{options} is an optional sequence of @var{key}=@var{value} pairs,
  532. separated by ":".
  533. The description of the accepted options follows.
  534. @table @option
  535. @item channel_layout, c
  536. Set the channel layout. The number of channels in the specified layout
  537. must be equal to the number of specified expressions.
  538. @item duration, d
  539. Set the minimum duration of the sourced audio. See the function
  540. @code{av_parse_time()} for the accepted format.
  541. Note that the resulting duration may be greater than the specified
  542. duration, as the generated audio is always cut at the end of a
  543. complete frame.
  544. If not specified, or the expressed duration is negative, the audio is
  545. supposed to be generated forever.
  546. @item nb_samples, n
  547. Set the number of samples per channel per each output frame,
  548. default to 1024.
  549. @item sample_rate, s
  550. Specify the sample rate, default to 44100.
  551. @end table
  552. Each expression in @var{exprs} can contain the following constants:
  553. @table @option
  554. @item n
  555. number of the evaluated sample, starting from 0
  556. @item t
  557. time of the evaluated sample expressed in seconds, starting from 0
  558. @item s
  559. sample rate
  560. @end table
  561. @subsection Examples
  562. @itemize
  563. @item
  564. Generate silence:
  565. @example
  566. aevalsrc=0
  567. @end example
  568. @item
  569. Generate a sin signal with frequency of 440 Hz, set sample rate to
  570. 8000 Hz:
  571. @example
  572. aevalsrc="sin(440*2*PI*t)::s=8000"
  573. @end example
  574. @item
  575. Generate a two channels signal, specify the channel layout (Front
  576. Center + Back Center) explicitly:
  577. @example
  578. aevalsrc="sin(420*2*PI*t):cos(430*2*PI*t)::c=FC|BC"
  579. @end example
  580. @item
  581. Generate white noise:
  582. @example
  583. aevalsrc="-2+random(0)"
  584. @end example
  585. @item
  586. Generate an amplitude modulated signal:
  587. @example
  588. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  589. @end example
  590. @item
  591. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  592. @example
  593. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) : 0.1*sin(2*PI*(360+2.5/2)*t)"
  594. @end example
  595. @end itemize
  596. @section amovie
  597. Read an audio stream from a movie container.
  598. It accepts the syntax: @var{movie_name}[:@var{options}] where
  599. @var{movie_name} is the name of the resource to read (not necessarily
  600. a file but also a device or a stream accessed through some protocol),
  601. and @var{options} is an optional sequence of @var{key}=@var{value}
  602. pairs, separated by ":".
  603. The description of the accepted options follows.
  604. @table @option
  605. @item format_name, f
  606. Specify the format assumed for the movie to read, and can be either
  607. the name of a container or an input device. If not specified the
  608. format is guessed from @var{movie_name} or by probing.
  609. @item seek_point, sp
  610. Specify the seek point in seconds, the frames will be output
  611. starting from this seek point, the parameter is evaluated with
  612. @code{av_strtod} so the numerical value may be suffixed by an IS
  613. postfix. Default value is "0".
  614. @item stream_index, si
  615. Specify the index of the audio stream to read. If the value is -1,
  616. the best suited audio stream will be automatically selected. Default
  617. value is "-1".
  618. @end table
  619. @section anullsrc
  620. Null audio source, return unprocessed audio frames. It is mainly useful
  621. as a template and to be employed in analysis / debugging tools, or as
  622. the source for filters which ignore the input data (for example the sox
  623. synth filter).
  624. It accepts an optional sequence of @var{key}=@var{value} pairs,
  625. separated by ":".
  626. The description of the accepted options follows.
  627. @table @option
  628. @item sample_rate, s
  629. Specify the sample rate, and defaults to 44100.
  630. @item channel_layout, cl
  631. Specify the channel layout, and can be either an integer or a string
  632. representing a channel layout. The default value of @var{channel_layout}
  633. is "stereo".
  634. Check the channel_layout_map definition in
  635. @file{libavcodec/audioconvert.c} for the mapping between strings and
  636. channel layout values.
  637. @item nb_samples, n
  638. Set the number of samples per requested frames.
  639. @end table
  640. Follow some examples:
  641. @example
  642. # set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  643. anullsrc=r=48000:cl=4
  644. # same as
  645. anullsrc=r=48000:cl=mono
  646. @end example
  647. @section abuffer
  648. Buffer audio frames, and make them available to the filter chain.
  649. This source is not intended to be part of user-supplied graph descriptions but
  650. for insertion by calling programs through the interface defined in
  651. @file{libavfilter/buffersrc.h}.
  652. It accepts the following named parameters:
  653. @table @option
  654. @item time_base
  655. Timebase which will be used for timestamps of submitted frames. It must be
  656. either a floating-point number or in @var{numerator}/@var{denominator} form.
  657. @item sample_rate
  658. Audio sample rate.
  659. @item sample_fmt
  660. Name of the sample format, as returned by @code{av_get_sample_fmt_name()}.
  661. @item channel_layout
  662. Channel layout of the audio data, in the form that can be accepted by
  663. @code{av_get_channel_layout()}.
  664. @end table
  665. All the parameters need to be explicitly defined.
  666. @c man end AUDIO SOURCES
  667. @chapter Audio Sinks
  668. @c man begin AUDIO SINKS
  669. Below is a description of the currently available audio sinks.
  670. @section abuffersink
  671. Buffer audio frames, and make them available to the end of filter chain.
  672. This sink is mainly intended for programmatic use, in particular
  673. through the interface defined in @file{libavfilter/buffersink.h}.
  674. It requires a pointer to an AVABufferSinkContext structure, which
  675. defines the incoming buffers' formats, to be passed as the opaque
  676. parameter to @code{avfilter_init_filter} for initialization.
  677. @section anullsink
  678. Null audio sink, do absolutely nothing with the input audio. It is
  679. mainly useful as a template and to be employed in analysis / debugging
  680. tools.
  681. @section abuffersink
  682. This sink is intended for programmatic use. Frames that arrive on this sink can
  683. be retrieved by the calling program using the interface defined in
  684. @file{libavfilter/buffersink.h}.
  685. This filter accepts no parameters.
  686. @c man end AUDIO SINKS
  687. @chapter Video Filters
  688. @c man begin VIDEO FILTERS
  689. When you configure your FFmpeg build, you can disable any of the
  690. existing filters using @code{--disable-filters}.
  691. The configure output will show the video filters included in your
  692. build.
  693. Below is a description of the currently available video filters.
  694. @section ass
  695. Draw ASS (Advanced Substation Alpha) subtitles on top of input video
  696. using the libass library.
  697. To enable compilation of this filter you need to configure FFmpeg with
  698. @code{--enable-libass}.
  699. This filter accepts the syntax: @var{ass_filename}[:@var{options}],
  700. where @var{ass_filename} is the filename of the ASS file to read, and
  701. @var{options} is an optional sequence of @var{key}=@var{value} pairs,
  702. separated by ":".
  703. A description of the accepted options follows.
  704. @table @option
  705. @item original_size
  706. Specifies the size of the original video, the video for which the ASS file
  707. was composed. Due to a misdesign in ASS aspect ratio arithmetic, this is
  708. necessary to correctly scale the fonts if the aspect ratio has been changed.
  709. @end table
  710. For example, to render the file @file{sub.ass} on top of the input
  711. video, use the command:
  712. @example
  713. ass=sub.ass
  714. @end example
  715. @section bbox
  716. Compute the bounding box for the non-black pixels in the input frame
  717. luminance plane.
  718. This filter computes the bounding box containing all the pixels with a
  719. luminance value greater than the minimum allowed value.
  720. The parameters describing the bounding box are printed on the filter
  721. log.
  722. @section blackdetect
  723. Detect video intervals that are (almost) completely black. Can be
  724. useful to detect chapter transitions, commercials, or invalid
  725. recordings. Output lines contains the time for the start, end and
  726. duration of the detected black interval expressed in seconds.
  727. In order to display the output lines, you need to set the loglevel at
  728. least to the AV_LOG_INFO value.
  729. This filter accepts a list of options in the form of
  730. @var{key}=@var{value} pairs separated by ":". A description of the
  731. accepted options follows.
  732. @table @option
  733. @item black_min_duration, d
  734. Set the minimum detected black duration expressed in seconds. It must
  735. be a non-negative floating point number.
  736. Default value is 2.0.
  737. @item picture_black_ratio_th, pic_th
  738. Set the threshold for considering a picture "black".
  739. Express the minimum value for the ratio:
  740. @example
  741. @var{nb_black_pixels} / @var{nb_pixels}
  742. @end example
  743. for which a picture is considered black.
  744. Default value is 0.98.
  745. @item pixel_black_th, pix_th
  746. Set the threshold for considering a pixel "black".
  747. The threshold expresses the maximum pixel luminance value for which a
  748. pixel is considered "black". The provided value is scaled according to
  749. the following equation:
  750. @example
  751. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  752. @end example
  753. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  754. the input video format, the range is [0-255] for YUV full-range
  755. formats and [16-235] for YUV non full-range formats.
  756. Default value is 0.10.
  757. @end table
  758. The following example sets the maximum pixel threshold to the minimum
  759. value, and detects only black intervals of 2 or more seconds:
  760. @example
  761. blackdetect=d=2:pix_th=0.00
  762. @end example
  763. @section blackframe
  764. Detect frames that are (almost) completely black. Can be useful to
  765. detect chapter transitions or commercials. Output lines consist of
  766. the frame number of the detected frame, the percentage of blackness,
  767. the position in the file if known or -1 and the timestamp in seconds.
  768. In order to display the output lines, you need to set the loglevel at
  769. least to the AV_LOG_INFO value.
  770. The filter accepts the syntax:
  771. @example
  772. blackframe[=@var{amount}:[@var{threshold}]]
  773. @end example
  774. @var{amount} is the percentage of the pixels that have to be below the
  775. threshold, and defaults to 98.
  776. @var{threshold} is the threshold below which a pixel value is
  777. considered black, and defaults to 32.
  778. @section boxblur
  779. Apply boxblur algorithm to the input video.
  780. This filter accepts the parameters:
  781. @var{luma_radius}:@var{luma_power}:@var{chroma_radius}:@var{chroma_power}:@var{alpha_radius}:@var{alpha_power}
  782. Chroma and alpha parameters are optional, if not specified they default
  783. to the corresponding values set for @var{luma_radius} and
  784. @var{luma_power}.
  785. @var{luma_radius}, @var{chroma_radius}, and @var{alpha_radius} represent
  786. the radius in pixels of the box used for blurring the corresponding
  787. input plane. They are expressions, and can contain the following
  788. constants:
  789. @table @option
  790. @item w, h
  791. the input width and height in pixels
  792. @item cw, ch
  793. the input chroma image width and height in pixels
  794. @item hsub, vsub
  795. horizontal and vertical chroma subsample values. For example for the
  796. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  797. @end table
  798. The radius must be a non-negative number, and must not be greater than
  799. the value of the expression @code{min(w,h)/2} for the luma and alpha planes,
  800. and of @code{min(cw,ch)/2} for the chroma planes.
  801. @var{luma_power}, @var{chroma_power}, and @var{alpha_power} represent
  802. how many times the boxblur filter is applied to the corresponding
  803. plane.
  804. Some examples follow:
  805. @itemize
  806. @item
  807. Apply a boxblur filter with luma, chroma, and alpha radius
  808. set to 2:
  809. @example
  810. boxblur=2:1
  811. @end example
  812. @item
  813. Set luma radius to 2, alpha and chroma radius to 0
  814. @example
  815. boxblur=2:1:0:0:0:0
  816. @end example
  817. @item
  818. Set luma and chroma radius to a fraction of the video dimension
  819. @example
  820. boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
  821. @end example
  822. @end itemize
  823. @section colormatrix
  824. The colormatrix filter allows conversion between any of the following color
  825. space: BT.709 (@var{bt709}), BT.601 (@var{bt601}), SMPTE-240M (@var{smpte240m})
  826. and FCC (@var{fcc}).
  827. The syntax of the parameters is @var{source}:@var{destination}:
  828. @example
  829. colormatrix=bt601:smpte240m
  830. @end example
  831. @section copy
  832. Copy the input source unchanged to the output. Mainly useful for
  833. testing purposes.
  834. @section crop
  835. Crop the input video to @var{out_w}:@var{out_h}:@var{x}:@var{y}:@var{keep_aspect}
  836. The @var{keep_aspect} parameter is optional, if specified and set to a
  837. non-zero value will force the output display aspect ratio to be the
  838. same of the input, by changing the output sample aspect ratio.
  839. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  840. expressions containing the following constants:
  841. @table @option
  842. @item x, y
  843. the computed values for @var{x} and @var{y}. They are evaluated for
  844. each new frame.
  845. @item in_w, in_h
  846. the input width and height
  847. @item iw, ih
  848. same as @var{in_w} and @var{in_h}
  849. @item out_w, out_h
  850. the output (cropped) width and height
  851. @item ow, oh
  852. same as @var{out_w} and @var{out_h}
  853. @item a
  854. same as @var{iw} / @var{ih}
  855. @item sar
  856. input sample aspect ratio
  857. @item dar
  858. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  859. @item hsub, vsub
  860. horizontal and vertical chroma subsample values. For example for the
  861. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  862. @item n
  863. the number of input frame, starting from 0
  864. @item pos
  865. the position in the file of the input frame, NAN if unknown
  866. @item t
  867. timestamp expressed in seconds, NAN if the input timestamp is unknown
  868. @end table
  869. The @var{out_w} and @var{out_h} parameters specify the expressions for
  870. the width and height of the output (cropped) video. They are
  871. evaluated just at the configuration of the filter.
  872. The default value of @var{out_w} is "in_w", and the default value of
  873. @var{out_h} is "in_h".
  874. The expression for @var{out_w} may depend on the value of @var{out_h},
  875. and the expression for @var{out_h} may depend on @var{out_w}, but they
  876. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  877. evaluated after @var{out_w} and @var{out_h}.
  878. The @var{x} and @var{y} parameters specify the expressions for the
  879. position of the top-left corner of the output (non-cropped) area. They
  880. are evaluated for each frame. If the evaluated value is not valid, it
  881. is approximated to the nearest valid value.
  882. The default value of @var{x} is "(in_w-out_w)/2", and the default
  883. value for @var{y} is "(in_h-out_h)/2", which set the cropped area at
  884. the center of the input image.
  885. The expression for @var{x} may depend on @var{y}, and the expression
  886. for @var{y} may depend on @var{x}.
  887. Follow some examples:
  888. @example
  889. # crop the central input area with size 100x100
  890. crop=100:100
  891. # crop the central input area with size 2/3 of the input video
  892. "crop=2/3*in_w:2/3*in_h"
  893. # crop the input video central square
  894. crop=in_h
  895. # delimit the rectangle with the top-left corner placed at position
  896. # 100:100 and the right-bottom corner corresponding to the right-bottom
  897. # corner of the input image.
  898. crop=in_w-100:in_h-100:100:100
  899. # crop 10 pixels from the left and right borders, and 20 pixels from
  900. # the top and bottom borders
  901. "crop=in_w-2*10:in_h-2*20"
  902. # keep only the bottom right quarter of the input image
  903. "crop=in_w/2:in_h/2:in_w/2:in_h/2"
  904. # crop height for getting Greek harmony
  905. "crop=in_w:1/PHI*in_w"
  906. # trembling effect
  907. "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)"
  908. # erratic camera effect depending on timestamp
  909. "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)"
  910. # set x depending on the value of y
  911. "crop=in_w/2:in_h/2:y:10+10*sin(n/10)"
  912. @end example
  913. @section cropdetect
  914. Auto-detect crop size.
  915. Calculate necessary cropping parameters and prints the recommended
  916. parameters through the logging system. The detected dimensions
  917. correspond to the non-black area of the input video.
  918. It accepts the syntax:
  919. @example
  920. cropdetect[=@var{limit}[:@var{round}[:@var{reset}]]]
  921. @end example
  922. @table @option
  923. @item limit
  924. Threshold, which can be optionally specified from nothing (0) to
  925. everything (255), defaults to 24.
  926. @item round
  927. Value which the width/height should be divisible by, defaults to
  928. 16. The offset is automatically adjusted to center the video. Use 2 to
  929. get only even dimensions (needed for 4:2:2 video). 16 is best when
  930. encoding to most video codecs.
  931. @item reset
  932. Counter that determines after how many frames cropdetect will reset
  933. the previously detected largest video area and start over to detect
  934. the current optimal crop area. Defaults to 0.
  935. This can be useful when channel logos distort the video area. 0
  936. indicates never reset and return the largest area encountered during
  937. playback.
  938. @end table
  939. @section delogo
  940. Suppress a TV station logo by a simple interpolation of the surrounding
  941. pixels. Just set a rectangle covering the logo and watch it disappear
  942. (and sometimes something even uglier appear - your mileage may vary).
  943. The filter accepts parameters as a string of the form
  944. "@var{x}:@var{y}:@var{w}:@var{h}:@var{band}", or as a list of
  945. @var{key}=@var{value} pairs, separated by ":".
  946. The description of the accepted parameters follows.
  947. @table @option
  948. @item x, y
  949. Specify the top left corner coordinates of the logo. They must be
  950. specified.
  951. @item w, h
  952. Specify the width and height of the logo to clear. They must be
  953. specified.
  954. @item band, t
  955. Specify the thickness of the fuzzy edge of the rectangle (added to
  956. @var{w} and @var{h}). The default value is 4.
  957. @item show
  958. When set to 1, a green rectangle is drawn on the screen to simplify
  959. finding the right @var{x}, @var{y}, @var{w}, @var{h} parameters, and
  960. @var{band} is set to 4. The default value is 0.
  961. @end table
  962. Some examples follow.
  963. @itemize
  964. @item
  965. Set a rectangle covering the area with top left corner coordinates 0,0
  966. and size 100x77, setting a band of size 10:
  967. @example
  968. delogo=0:0:100:77:10
  969. @end example
  970. @item
  971. As the previous example, but use named options:
  972. @example
  973. delogo=x=0:y=0:w=100:h=77:band=10
  974. @end example
  975. @end itemize
  976. @section deshake
  977. Attempt to fix small changes in horizontal and/or vertical shift. This
  978. filter helps remove camera shake from hand-holding a camera, bumping a
  979. tripod, moving on a vehicle, etc.
  980. The filter accepts parameters as a string of the form
  981. "@var{x}:@var{y}:@var{w}:@var{h}:@var{rx}:@var{ry}:@var{edge}:@var{blocksize}:@var{contrast}:@var{search}:@var{filename}"
  982. A description of the accepted parameters follows.
  983. @table @option
  984. @item x, y, w, h
  985. Specify a rectangular area where to limit the search for motion
  986. vectors.
  987. If desired the search for motion vectors can be limited to a
  988. rectangular area of the frame defined by its top left corner, width
  989. and height. These parameters have the same meaning as the drawbox
  990. filter which can be used to visualise the position of the bounding
  991. box.
  992. This is useful when simultaneous movement of subjects within the frame
  993. might be confused for camera motion by the motion vector search.
  994. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  995. then the full frame is used. This allows later options to be set
  996. without specifying the bounding box for the motion vector search.
  997. Default - search the whole frame.
  998. @item rx, ry
  999. Specify the maximum extent of movement in x and y directions in the
  1000. range 0-64 pixels. Default 16.
  1001. @item edge
  1002. Specify how to generate pixels to fill blanks at the edge of the
  1003. frame. An integer from 0 to 3 as follows:
  1004. @table @option
  1005. @item 0
  1006. Fill zeroes at blank locations
  1007. @item 1
  1008. Original image at blank locations
  1009. @item 2
  1010. Extruded edge value at blank locations
  1011. @item 3
  1012. Mirrored edge at blank locations
  1013. @end table
  1014. The default setting is mirror edge at blank locations.
  1015. @item blocksize
  1016. Specify the blocksize to use for motion search. Range 4-128 pixels,
  1017. default 8.
  1018. @item contrast
  1019. Specify the contrast threshold for blocks. Only blocks with more than
  1020. the specified contrast (difference between darkest and lightest
  1021. pixels) will be considered. Range 1-255, default 125.
  1022. @item search
  1023. Specify the search strategy 0 = exhaustive search, 1 = less exhaustive
  1024. search. Default - exhaustive search.
  1025. @item filename
  1026. If set then a detailed log of the motion search is written to the
  1027. specified file.
  1028. @end table
  1029. @section drawbox
  1030. Draw a colored box on the input image.
  1031. It accepts the syntax:
  1032. @example
  1033. drawbox=@var{x}:@var{y}:@var{width}:@var{height}:@var{color}
  1034. @end example
  1035. @table @option
  1036. @item x, y
  1037. Specify the top left corner coordinates of the box. Default to 0.
  1038. @item width, height
  1039. Specify the width and height of the box, if 0 they are interpreted as
  1040. the input width and height. Default to 0.
  1041. @item color
  1042. Specify the color of the box to write, it can be the name of a color
  1043. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  1044. @end table
  1045. Follow some examples:
  1046. @example
  1047. # draw a black box around the edge of the input image
  1048. drawbox
  1049. # draw a box with color red and an opacity of 50%
  1050. drawbox=10:20:200:60:red@@0.5"
  1051. @end example
  1052. @section drawtext
  1053. Draw text string or text from specified file on top of video using the
  1054. libfreetype library.
  1055. To enable compilation of this filter you need to configure FFmpeg with
  1056. @code{--enable-libfreetype}.
  1057. The filter also recognizes strftime() sequences in the provided text
  1058. and expands them accordingly. Check the documentation of strftime().
  1059. The filter accepts parameters as a list of @var{key}=@var{value} pairs,
  1060. separated by ":".
  1061. The description of the accepted parameters follows.
  1062. @table @option
  1063. @item box
  1064. Used to draw a box around text using background color.
  1065. Value should be either 1 (enable) or 0 (disable).
  1066. The default value of @var{box} is 0.
  1067. @item boxcolor
  1068. The color to be used for drawing box around text.
  1069. Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
  1070. (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  1071. The default value of @var{boxcolor} is "white".
  1072. @item draw
  1073. Set an expression which specifies if the text should be drawn. If the
  1074. expression evaluates to 0, the text is not drawn. This is useful for
  1075. specifying that the text should be drawn only when specific conditions
  1076. are met.
  1077. Default value is "1".
  1078. See below for the list of accepted constants and functions.
  1079. @item fix_bounds
  1080. If true, check and fix text coords to avoid clipping.
  1081. @item fontcolor
  1082. The color to be used for drawing fonts.
  1083. Either a string (e.g. "red") or in 0xRRGGBB[AA] format
  1084. (e.g. "0xff000033"), possibly followed by an alpha specifier.
  1085. The default value of @var{fontcolor} is "black".
  1086. @item fontfile
  1087. The font file to be used for drawing text. Path must be included.
  1088. This parameter is mandatory.
  1089. @item fontsize
  1090. The font size to be used for drawing text.
  1091. The default value of @var{fontsize} is 16.
  1092. @item ft_load_flags
  1093. Flags to be used for loading the fonts.
  1094. The flags map the corresponding flags supported by libfreetype, and are
  1095. a combination of the following values:
  1096. @table @var
  1097. @item default
  1098. @item no_scale
  1099. @item no_hinting
  1100. @item render
  1101. @item no_bitmap
  1102. @item vertical_layout
  1103. @item force_autohint
  1104. @item crop_bitmap
  1105. @item pedantic
  1106. @item ignore_global_advance_width
  1107. @item no_recurse
  1108. @item ignore_transform
  1109. @item monochrome
  1110. @item linear_design
  1111. @item no_autohint
  1112. @item end table
  1113. @end table
  1114. Default value is "render".
  1115. For more information consult the documentation for the FT_LOAD_*
  1116. libfreetype flags.
  1117. @item shadowcolor
  1118. The color to be used for drawing a shadow behind the drawn text. It
  1119. can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
  1120. form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  1121. The default value of @var{shadowcolor} is "black".
  1122. @item shadowx, shadowy
  1123. The x and y offsets for the text shadow position with respect to the
  1124. position of the text. They can be either positive or negative
  1125. values. Default value for both is "0".
  1126. @item tabsize
  1127. The size in number of spaces to use for rendering the tab.
  1128. Default value is 4.
  1129. @item timecode
  1130. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  1131. format. It can be used with or without text parameter. @var{timecode_rate}
  1132. option must be specified.
  1133. @item timecode_rate, rate, r
  1134. Set the timecode frame rate (timecode only).
  1135. @item text
  1136. The text string to be drawn. The text must be a sequence of UTF-8
  1137. encoded characters.
  1138. This parameter is mandatory if no file is specified with the parameter
  1139. @var{textfile}.
  1140. @item textfile
  1141. A text file containing text to be drawn. The text must be a sequence
  1142. of UTF-8 encoded characters.
  1143. This parameter is mandatory if no text string is specified with the
  1144. parameter @var{text}.
  1145. If both @var{text} and @var{textfile} are specified, an error is thrown.
  1146. @item x, y
  1147. The expressions which specify the offsets where text will be drawn
  1148. within the video frame. They are relative to the top/left border of the
  1149. output image.
  1150. The default value of @var{x} and @var{y} is "0".
  1151. See below for the list of accepted constants and functions.
  1152. @end table
  1153. The parameters for @var{x} and @var{y} are expressions containing the
  1154. following constants and functions:
  1155. @table @option
  1156. @item dar
  1157. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  1158. @item hsub, vsub
  1159. horizontal and vertical chroma subsample values. For example for the
  1160. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1161. @item line_h, lh
  1162. the height of each text line
  1163. @item main_h, h, H
  1164. the input height
  1165. @item main_w, w, W
  1166. the input width
  1167. @item max_glyph_a, ascent
  1168. the maximum distance from the baseline to the highest/upper grid
  1169. coordinate used to place a glyph outline point, for all the rendered
  1170. glyphs.
  1171. It is a positive value, due to the grid's orientation with the Y axis
  1172. upwards.
  1173. @item max_glyph_d, descent
  1174. the maximum distance from the baseline to the lowest grid coordinate
  1175. used to place a glyph outline point, for all the rendered glyphs.
  1176. This is a negative value, due to the grid's orientation, with the Y axis
  1177. upwards.
  1178. @item max_glyph_h
  1179. maximum glyph height, that is the maximum height for all the glyphs
  1180. contained in the rendered text, it is equivalent to @var{ascent} -
  1181. @var{descent}.
  1182. @item max_glyph_w
  1183. maximum glyph width, that is the maximum width for all the glyphs
  1184. contained in the rendered text
  1185. @item n
  1186. the number of input frame, starting from 0
  1187. @item rand(min, max)
  1188. return a random number included between @var{min} and @var{max}
  1189. @item sar
  1190. input sample aspect ratio
  1191. @item t
  1192. timestamp expressed in seconds, NAN if the input timestamp is unknown
  1193. @item text_h, th
  1194. the height of the rendered text
  1195. @item text_w, tw
  1196. the width of the rendered text
  1197. @item x, y
  1198. the x and y offset coordinates where the text is drawn.
  1199. These parameters allow the @var{x} and @var{y} expressions to refer
  1200. each other, so you can for example specify @code{y=x/dar}.
  1201. @end table
  1202. If libavfilter was built with @code{--enable-fontconfig}, then
  1203. @option{fontfile} can be a fontconfig pattern or omitted.
  1204. Some examples follow.
  1205. @itemize
  1206. @item
  1207. Draw "Test Text" with font FreeSerif, using the default values for the
  1208. optional parameters.
  1209. @example
  1210. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  1211. @end example
  1212. @item
  1213. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  1214. and y=50 (counting from the top-left corner of the screen), text is
  1215. yellow with a red box around it. Both the text and the box have an
  1216. opacity of 20%.
  1217. @example
  1218. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  1219. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  1220. @end example
  1221. Note that the double quotes are not necessary if spaces are not used
  1222. within the parameter list.
  1223. @item
  1224. Show the text at the center of the video frame:
  1225. @example
  1226. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  1227. @end example
  1228. @item
  1229. Show a text line sliding from right to left in the last row of the video
  1230. frame. The file @file{LONG_LINE} is assumed to contain a single line
  1231. with no newlines.
  1232. @example
  1233. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  1234. @end example
  1235. @item
  1236. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  1237. @example
  1238. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  1239. @end example
  1240. @item
  1241. Draw a single green letter "g", at the center of the input video.
  1242. The glyph baseline is placed at half screen height.
  1243. @example
  1244. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  1245. @end example
  1246. @item
  1247. Show text for 1 second every 3 seconds:
  1248. @example
  1249. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:draw=lt(mod(t\\,3)\\,1):text='blink'"
  1250. @end example
  1251. @item
  1252. Use fontconfig to set the font. Note that the colons need to be escaped.
  1253. @example
  1254. drawtext='fontfile=Linux Libertine O-40\\:style=Semibold:text=FFmpeg'
  1255. @end example
  1256. @end itemize
  1257. For more information about libfreetype, check:
  1258. @url{http://www.freetype.org/}.
  1259. For more information about fontconfig, check:
  1260. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  1261. @section fade
  1262. Apply fade-in/out effect to input video.
  1263. It accepts the parameters:
  1264. @var{type}:@var{start_frame}:@var{nb_frames}[:@var{options}]
  1265. @var{type} specifies if the effect type, can be either "in" for
  1266. fade-in, or "out" for a fade-out effect.
  1267. @var{start_frame} specifies the number of the start frame for starting
  1268. to apply the fade effect.
  1269. @var{nb_frames} specifies the number of frames for which the fade
  1270. effect has to last. At the end of the fade-in effect the output video
  1271. will have the same intensity as the input video, at the end of the
  1272. fade-out transition the output video will be completely black.
  1273. @var{options} is an optional sequence of @var{key}=@var{value} pairs,
  1274. separated by ":". The description of the accepted options follows.
  1275. @table @option
  1276. @item type, t
  1277. See @var{type}.
  1278. @item start_frame, s
  1279. See @var{start_frame}.
  1280. @item nb_frames, n
  1281. See @var{nb_frames}.
  1282. @item alpha
  1283. If set to 1, fade only alpha channel, if one exists on the input.
  1284. Default value is 0.
  1285. @end table
  1286. A few usage examples follow, usable too as test scenarios.
  1287. @example
  1288. # fade in first 30 frames of video
  1289. fade=in:0:30
  1290. # fade out last 45 frames of a 200-frame video
  1291. fade=out:155:45
  1292. # fade in first 25 frames and fade out last 25 frames of a 1000-frame video
  1293. fade=in:0:25, fade=out:975:25
  1294. # make first 5 frames black, then fade in from frame 5-24
  1295. fade=in:5:20
  1296. # fade in alpha over first 25 frames of video
  1297. fade=in:0:25:alpha=1
  1298. @end example
  1299. @section fieldorder
  1300. Transform the field order of the input video.
  1301. It accepts one parameter which specifies the required field order that
  1302. the input interlaced video will be transformed to. The parameter can
  1303. assume one of the following values:
  1304. @table @option
  1305. @item 0 or bff
  1306. output bottom field first
  1307. @item 1 or tff
  1308. output top field first
  1309. @end table
  1310. Default value is "tff".
  1311. Transformation is achieved by shifting the picture content up or down
  1312. by one line, and filling the remaining line with appropriate picture content.
  1313. This method is consistent with most broadcast field order converters.
  1314. If the input video is not flagged as being interlaced, or it is already
  1315. flagged as being of the required output field order then this filter does
  1316. not alter the incoming video.
  1317. This filter is very useful when converting to or from PAL DV material,
  1318. which is bottom field first.
  1319. For example:
  1320. @example
  1321. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  1322. @end example
  1323. @section fifo
  1324. Buffer input images and send them when they are requested.
  1325. This filter is mainly useful when auto-inserted by the libavfilter
  1326. framework.
  1327. The filter does not take parameters.
  1328. @section format
  1329. Convert the input video to one of the specified pixel formats.
  1330. Libavfilter will try to pick one that is supported for the input to
  1331. the next filter.
  1332. The filter accepts a list of pixel format names, separated by ":",
  1333. for example "yuv420p:monow:rgb24".
  1334. Some examples follow:
  1335. @example
  1336. # convert the input video to the format "yuv420p"
  1337. format=yuv420p
  1338. # convert the input video to any of the formats in the list
  1339. format=yuv420p:yuv444p:yuv410p
  1340. @end example
  1341. @section fps
  1342. Convert the video to specified constant framerate by duplicating or dropping
  1343. frames as necessary.
  1344. This filter accepts the following named parameters:
  1345. @table @option
  1346. @item fps
  1347. Desired output framerate.
  1348. @end table
  1349. @anchor{frei0r}
  1350. @section frei0r
  1351. Apply a frei0r effect to the input video.
  1352. To enable compilation of this filter you need to install the frei0r
  1353. header and configure FFmpeg with @code{--enable-frei0r}.
  1354. The filter supports the syntax:
  1355. @example
  1356. @var{filter_name}[@{:|=@}@var{param1}:@var{param2}:...:@var{paramN}]
  1357. @end example
  1358. @var{filter_name} is the name to the frei0r effect to load. If the
  1359. environment variable @env{FREI0R_PATH} is defined, the frei0r effect
  1360. is searched in each one of the directories specified by the colon
  1361. separated list in @env{FREIOR_PATH}, otherwise in the standard frei0r
  1362. paths, which are in this order: @file{HOME/.frei0r-1/lib/},
  1363. @file{/usr/local/lib/frei0r-1/}, @file{/usr/lib/frei0r-1/}.
  1364. @var{param1}, @var{param2}, ... , @var{paramN} specify the parameters
  1365. for the frei0r effect.
  1366. A frei0r effect parameter can be a boolean (whose values are specified
  1367. with "y" and "n"), a double, a color (specified by the syntax
  1368. @var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
  1369. numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
  1370. description), a position (specified by the syntax @var{X}/@var{Y},
  1371. @var{X} and @var{Y} being float numbers) and a string.
  1372. The number and kind of parameters depend on the loaded effect. If an
  1373. effect parameter is not specified the default value is set.
  1374. Some examples follow:
  1375. @itemize
  1376. @item
  1377. Apply the distort0r effect, set the first two double parameters:
  1378. @example
  1379. frei0r=distort0r:0.5:0.01
  1380. @end example
  1381. @item
  1382. Apply the colordistance effect, takes a color as first parameter:
  1383. @example
  1384. frei0r=colordistance:0.2/0.3/0.4
  1385. frei0r=colordistance:violet
  1386. frei0r=colordistance:0x112233
  1387. @end example
  1388. @item
  1389. Apply the perspective effect, specify the top left and top right image
  1390. positions:
  1391. @example
  1392. frei0r=perspective:0.2/0.2:0.8/0.2
  1393. @end example
  1394. @end itemize
  1395. For more information see:
  1396. @url{http://frei0r.dyne.org}
  1397. @section gradfun
  1398. Fix the banding artifacts that are sometimes introduced into nearly flat
  1399. regions by truncation to 8bit color depth.
  1400. Interpolate the gradients that should go where the bands are, and
  1401. dither them.
  1402. This filter is designed for playback only. Do not use it prior to
  1403. lossy compression, because compression tends to lose the dither and
  1404. bring back the bands.
  1405. The filter takes two optional parameters, separated by ':':
  1406. @var{strength}:@var{radius}
  1407. @var{strength} is the maximum amount by which the filter will change
  1408. any one pixel. Also the threshold for detecting nearly flat
  1409. regions. Acceptable values range from .51 to 255, default value is
  1410. 1.2, out-of-range values will be clipped to the valid range.
  1411. @var{radius} is the neighborhood to fit the gradient to. A larger
  1412. radius makes for smoother gradients, but also prevents the filter from
  1413. modifying the pixels near detailed regions. Acceptable values are
  1414. 8-32, default value is 16, out-of-range values will be clipped to the
  1415. valid range.
  1416. @example
  1417. # default parameters
  1418. gradfun=1.2:16
  1419. # omitting radius
  1420. gradfun=1.2
  1421. @end example
  1422. @section hflip
  1423. Flip the input video horizontally.
  1424. For example to horizontally flip the input video with @command{ffmpeg}:
  1425. @example
  1426. ffmpeg -i in.avi -vf "hflip" out.avi
  1427. @end example
  1428. @section hqdn3d
  1429. High precision/quality 3d denoise filter. This filter aims to reduce
  1430. image noise producing smooth images and making still images really
  1431. still. It should enhance compressibility.
  1432. It accepts the following optional parameters:
  1433. @var{luma_spatial}:@var{chroma_spatial}:@var{luma_tmp}:@var{chroma_tmp}
  1434. @table @option
  1435. @item luma_spatial
  1436. a non-negative float number which specifies spatial luma strength,
  1437. defaults to 4.0
  1438. @item chroma_spatial
  1439. a non-negative float number which specifies spatial chroma strength,
  1440. defaults to 3.0*@var{luma_spatial}/4.0
  1441. @item luma_tmp
  1442. a float number which specifies luma temporal strength, defaults to
  1443. 6.0*@var{luma_spatial}/4.0
  1444. @item chroma_tmp
  1445. a float number which specifies chroma temporal strength, defaults to
  1446. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
  1447. @end table
  1448. @section idet
  1449. Interlaceing detect filter. This filter tries to detect if the input is
  1450. interlaced or progressive. Top or bottom field first.
  1451. @section lut, lutrgb, lutyuv
  1452. Compute a look-up table for binding each pixel component input value
  1453. to an output value, and apply it to input video.
  1454. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  1455. to an RGB input video.
  1456. These filters accept in input a ":"-separated list of options, which
  1457. specify the expressions used for computing the lookup table for the
  1458. corresponding pixel component values.
  1459. The @var{lut} filter requires either YUV or RGB pixel formats in
  1460. input, and accepts the options:
  1461. @table @option
  1462. @item c0
  1463. first pixel component
  1464. @item c1
  1465. second pixel component
  1466. @item c2
  1467. third pixel component
  1468. @item c3
  1469. fourth pixel component, corresponds to the alpha component
  1470. @end table
  1471. The exact component associated to each option depends on the format in
  1472. input.
  1473. The @var{lutrgb} filter requires RGB pixel formats in input, and
  1474. accepts the options:
  1475. @table @option
  1476. @item r
  1477. red component
  1478. @item g
  1479. green component
  1480. @item b
  1481. blue component
  1482. @item a
  1483. alpha component
  1484. @end table
  1485. The @var{lutyuv} filter requires YUV pixel formats in input, and
  1486. accepts the options:
  1487. @table @option
  1488. @item y
  1489. Y/luminance component
  1490. @item u
  1491. U/Cb component
  1492. @item v
  1493. V/Cr component
  1494. @item a
  1495. alpha component
  1496. @end table
  1497. The expressions can contain the following constants and functions:
  1498. @table @option
  1499. @item w, h
  1500. the input width and height
  1501. @item val
  1502. input value for the pixel component
  1503. @item clipval
  1504. the input value clipped in the @var{minval}-@var{maxval} range
  1505. @item maxval
  1506. maximum value for the pixel component
  1507. @item minval
  1508. minimum value for the pixel component
  1509. @item negval
  1510. the negated value for the pixel component value clipped in the
  1511. @var{minval}-@var{maxval} range , it corresponds to the expression
  1512. "maxval-clipval+minval"
  1513. @item clip(val)
  1514. the computed value in @var{val} clipped in the
  1515. @var{minval}-@var{maxval} range
  1516. @item gammaval(gamma)
  1517. the computed gamma correction value of the pixel component value
  1518. clipped in the @var{minval}-@var{maxval} range, corresponds to the
  1519. expression
  1520. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  1521. @end table
  1522. All expressions default to "val".
  1523. Some examples follow:
  1524. @example
  1525. # negate input video
  1526. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  1527. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  1528. # the above is the same as
  1529. lutrgb="r=negval:g=negval:b=negval"
  1530. lutyuv="y=negval:u=negval:v=negval"
  1531. # negate luminance
  1532. lutyuv=y=negval
  1533. # remove chroma components, turns the video into a graytone image
  1534. lutyuv="u=128:v=128"
  1535. # apply a luma burning effect
  1536. lutyuv="y=2*val"
  1537. # remove green and blue components
  1538. lutrgb="g=0:b=0"
  1539. # set a constant alpha channel value on input
  1540. format=rgba,lutrgb=a="maxval-minval/2"
  1541. # correct luminance gamma by a 0.5 factor
  1542. lutyuv=y=gammaval(0.5)
  1543. @end example
  1544. @section mp
  1545. Apply an MPlayer filter to the input video.
  1546. This filter provides a wrapper around most of the filters of
  1547. MPlayer/MEncoder.
  1548. This wrapper is considered experimental. Some of the wrapped filters
  1549. may not work properly and we may drop support for them, as they will
  1550. be implemented natively into FFmpeg. Thus you should avoid
  1551. depending on them when writing portable scripts.
  1552. The filters accepts the parameters:
  1553. @var{filter_name}[:=]@var{filter_params}
  1554. @var{filter_name} is the name of a supported MPlayer filter,
  1555. @var{filter_params} is a string containing the parameters accepted by
  1556. the named filter.
  1557. The list of the currently supported filters follows:
  1558. @table @var
  1559. @item decimate
  1560. @item denoise3d
  1561. @item detc
  1562. @item dint
  1563. @item divtc
  1564. @item down3dright
  1565. @item dsize
  1566. @item eq2
  1567. @item eq
  1568. @item field
  1569. @item fil
  1570. @item fixpts
  1571. @item framestep
  1572. @item fspp
  1573. @item geq
  1574. @item harddup
  1575. @item hqdn3d
  1576. @item hue
  1577. @item il
  1578. @item ilpack
  1579. @item ivtc
  1580. @item kerndeint
  1581. @item mcdeint
  1582. @item noise
  1583. @item ow
  1584. @item palette
  1585. @item perspective
  1586. @item phase
  1587. @item pp7
  1588. @item pullup
  1589. @item qp
  1590. @item rectangle
  1591. @item rotate
  1592. @item sab
  1593. @item smartblur
  1594. @item softpulldown
  1595. @item softskip
  1596. @item spp
  1597. @item telecine
  1598. @item tile
  1599. @item tinterlace
  1600. @item unsharp
  1601. @item uspp
  1602. @item yuvcsp
  1603. @item yvu9
  1604. @end table
  1605. The parameter syntax and behavior for the listed filters are the same
  1606. of the corresponding MPlayer filters. For detailed instructions check
  1607. the "VIDEO FILTERS" section in the MPlayer manual.
  1608. Some examples follow:
  1609. @example
  1610. # adjust gamma, brightness, contrast
  1611. mp=eq2=1.0:2:0.5
  1612. # tweak hue and saturation
  1613. mp=hue=100:-10
  1614. @end example
  1615. See also mplayer(1), @url{http://www.mplayerhq.hu/}.
  1616. @section negate
  1617. Negate input video.
  1618. This filter accepts an integer in input, if non-zero it negates the
  1619. alpha component (if available). The default value in input is 0.
  1620. @section noformat
  1621. Force libavfilter not to use any of the specified pixel formats for the
  1622. input to the next filter.
  1623. The filter accepts a list of pixel format names, separated by ":",
  1624. for example "yuv420p:monow:rgb24".
  1625. Some examples follow:
  1626. @example
  1627. # force libavfilter to use a format different from "yuv420p" for the
  1628. # input to the vflip filter
  1629. noformat=yuv420p,vflip
  1630. # convert the input video to any of the formats not contained in the list
  1631. noformat=yuv420p:yuv444p:yuv410p
  1632. @end example
  1633. @section null
  1634. Pass the video source unchanged to the output.
  1635. @section ocv
  1636. Apply video transform using libopencv.
  1637. To enable this filter install libopencv library and headers and
  1638. configure FFmpeg with @code{--enable-libopencv}.
  1639. The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}.
  1640. @var{filter_name} is the name of the libopencv filter to apply.
  1641. @var{filter_params} specifies the parameters to pass to the libopencv
  1642. filter. If not specified the default values are assumed.
  1643. Refer to the official libopencv documentation for more precise
  1644. information:
  1645. @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
  1646. Follows the list of supported libopencv filters.
  1647. @anchor{dilate}
  1648. @subsection dilate
  1649. Dilate an image by using a specific structuring element.
  1650. This filter corresponds to the libopencv function @code{cvDilate}.
  1651. It accepts the parameters: @var{struct_el}:@var{nb_iterations}.
  1652. @var{struct_el} represents a structuring element, and has the syntax:
  1653. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  1654. @var{cols} and @var{rows} represent the number of columns and rows of
  1655. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  1656. point, and @var{shape} the shape for the structuring element, and
  1657. can be one of the values "rect", "cross", "ellipse", "custom".
  1658. If the value for @var{shape} is "custom", it must be followed by a
  1659. string of the form "=@var{filename}". The file with name
  1660. @var{filename} is assumed to represent a binary image, with each
  1661. printable character corresponding to a bright pixel. When a custom
  1662. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  1663. or columns and rows of the read file are assumed instead.
  1664. The default value for @var{struct_el} is "3x3+0x0/rect".
  1665. @var{nb_iterations} specifies the number of times the transform is
  1666. applied to the image, and defaults to 1.
  1667. Follow some example:
  1668. @example
  1669. # use the default values
  1670. ocv=dilate
  1671. # dilate using a structuring element with a 5x5 cross, iterate two times
  1672. ocv=dilate=5x5+2x2/cross:2
  1673. # read the shape from the file diamond.shape, iterate two times
  1674. # the file diamond.shape may contain a pattern of characters like this:
  1675. # *
  1676. # ***
  1677. # *****
  1678. # ***
  1679. # *
  1680. # the specified cols and rows are ignored (but not the anchor point coordinates)
  1681. ocv=0x0+2x2/custom=diamond.shape:2
  1682. @end example
  1683. @subsection erode
  1684. Erode an image by using a specific structuring element.
  1685. This filter corresponds to the libopencv function @code{cvErode}.
  1686. The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
  1687. with the same syntax and semantics as the @ref{dilate} filter.
  1688. @subsection smooth
  1689. Smooth the input video.
  1690. The filter takes the following parameters:
  1691. @var{type}:@var{param1}:@var{param2}:@var{param3}:@var{param4}.
  1692. @var{type} is the type of smooth filter to apply, and can be one of
  1693. the following values: "blur", "blur_no_scale", "median", "gaussian",
  1694. "bilateral". The default value is "gaussian".
  1695. @var{param1}, @var{param2}, @var{param3}, and @var{param4} are
  1696. parameters whose meanings depend on smooth type. @var{param1} and
  1697. @var{param2} accept integer positive values or 0, @var{param3} and
  1698. @var{param4} accept float values.
  1699. The default value for @var{param1} is 3, the default value for the
  1700. other parameters is 0.
  1701. These parameters correspond to the parameters assigned to the
  1702. libopencv function @code{cvSmooth}.
  1703. @anchor{overlay}
  1704. @section overlay
  1705. Overlay one video on top of another.
  1706. It takes two inputs and one output, the first input is the "main"
  1707. video on which the second input is overlayed.
  1708. It accepts the parameters: @var{x}:@var{y}[:@var{options}].
  1709. @var{x} is the x coordinate of the overlayed video on the main video,
  1710. @var{y} is the y coordinate. @var{x} and @var{y} are expressions containing
  1711. the following parameters:
  1712. @table @option
  1713. @item main_w, main_h
  1714. main input width and height
  1715. @item W, H
  1716. same as @var{main_w} and @var{main_h}
  1717. @item overlay_w, overlay_h
  1718. overlay input width and height
  1719. @item w, h
  1720. same as @var{overlay_w} and @var{overlay_h}
  1721. @end table
  1722. @var{options} is an optional list of @var{key}=@var{value} pairs,
  1723. separated by ":".
  1724. The description of the accepted options follows.
  1725. @table @option
  1726. @item rgb
  1727. If set to 1, force the filter to accept inputs in the RGB
  1728. color space. Default value is 0.
  1729. @end table
  1730. Be aware that frames are taken from each input video in timestamp
  1731. order, hence, if their initial timestamps differ, it is a a good idea
  1732. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  1733. have them begin in the same zero timestamp, as it does the example for
  1734. the @var{movie} filter.
  1735. Follow some examples:
  1736. @example
  1737. # draw the overlay at 10 pixels from the bottom right
  1738. # corner of the main video.
  1739. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  1740. # insert a transparent PNG logo in the bottom left corner of the input
  1741. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  1742. # insert 2 different transparent PNG logos (second logo on bottom
  1743. # right corner):
  1744. ffmpeg -i input -i logo1 -i logo2 -filter_complex
  1745. 'overlay=10:H-h-10,overlay=W-w-10:H-h-10' output
  1746. # add a transparent color layer on top of the main video,
  1747. # WxH specifies the size of the main input to the overlay filter
  1748. color=red@.3:WxH [over]; [in][over] overlay [out]
  1749. # play an original video and a filtered version (here with the deshake filter)
  1750. # side by side
  1751. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  1752. # the previous example is the same as:
  1753. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  1754. @end example
  1755. You can chain together more overlays but the efficiency of such
  1756. approach is yet to be tested.
  1757. @section pad
  1758. Add paddings to the input image, and places the original input at the
  1759. given coordinates @var{x}, @var{y}.
  1760. It accepts the following parameters:
  1761. @var{width}:@var{height}:@var{x}:@var{y}:@var{color}.
  1762. The parameters @var{width}, @var{height}, @var{x}, and @var{y} are
  1763. expressions containing the following constants:
  1764. @table @option
  1765. @item in_w, in_h
  1766. the input video width and height
  1767. @item iw, ih
  1768. same as @var{in_w} and @var{in_h}
  1769. @item out_w, out_h
  1770. the output width and height, that is the size of the padded area as
  1771. specified by the @var{width} and @var{height} expressions
  1772. @item ow, oh
  1773. same as @var{out_w} and @var{out_h}
  1774. @item x, y
  1775. x and y offsets as specified by the @var{x} and @var{y}
  1776. expressions, or NAN if not yet specified
  1777. @item a
  1778. same as @var{iw} / @var{ih}
  1779. @item sar
  1780. input sample aspect ratio
  1781. @item dar
  1782. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  1783. @item hsub, vsub
  1784. horizontal and vertical chroma subsample values. For example for the
  1785. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1786. @end table
  1787. Follows the description of the accepted parameters.
  1788. @table @option
  1789. @item width, height
  1790. Specify the size of the output image with the paddings added. If the
  1791. value for @var{width} or @var{height} is 0, the corresponding input size
  1792. is used for the output.
  1793. The @var{width} expression can reference the value set by the
  1794. @var{height} expression, and vice versa.
  1795. The default value of @var{width} and @var{height} is 0.
  1796. @item x, y
  1797. Specify the offsets where to place the input image in the padded area
  1798. with respect to the top/left border of the output image.
  1799. The @var{x} expression can reference the value set by the @var{y}
  1800. expression, and vice versa.
  1801. The default value of @var{x} and @var{y} is 0.
  1802. @item color
  1803. Specify the color of the padded area, it can be the name of a color
  1804. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  1805. The default value of @var{color} is "black".
  1806. @end table
  1807. Some examples follow:
  1808. @example
  1809. # Add paddings with color "violet" to the input video. Output video
  1810. # size is 640x480, the top-left corner of the input video is placed at
  1811. # column 0, row 40.
  1812. pad=640:480:0:40:violet
  1813. # pad the input to get an output with dimensions increased bt 3/2,
  1814. # and put the input video at the center of the padded area
  1815. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  1816. # pad the input to get a squared output with size equal to the maximum
  1817. # value between the input width and height, and put the input video at
  1818. # the center of the padded area
  1819. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  1820. # pad the input to get a final w/h ratio of 16:9
  1821. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  1822. # for anamorphic video, in order to set the output display aspect ratio,
  1823. # it is necessary to use sar in the expression, according to the relation:
  1824. # (ih * X / ih) * sar = output_dar
  1825. # X = output_dar / sar
  1826. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  1827. # double output size and put the input video in the bottom-right
  1828. # corner of the output padded area
  1829. pad="2*iw:2*ih:ow-iw:oh-ih"
  1830. @end example
  1831. @section pixdesctest
  1832. Pixel format descriptor test filter, mainly useful for internal
  1833. testing. The output video should be equal to the input video.
  1834. For example:
  1835. @example
  1836. format=monow, pixdesctest
  1837. @end example
  1838. can be used to test the monowhite pixel format descriptor definition.
  1839. @section removelogo
  1840. Suppress a TV station logo, using an image file to determine which
  1841. pixels comprise the logo. It works by filling in the pixels that
  1842. comprise the logo with neighboring pixels.
  1843. This filter requires one argument which specifies the filter bitmap
  1844. file, which can be any image format supported by libavformat. The
  1845. width and height of the image file must match those of the video
  1846. stream being processed.
  1847. Pixels in the provided bitmap image with a value of zero are not
  1848. considered part of the logo, non-zero pixels are considered part of
  1849. the logo. If you use white (255) for the logo and black (0) for the
  1850. rest, you will be safe. For making the filter bitmap, it is
  1851. recommended to take a screen capture of a black frame with the logo
  1852. visible, and then using a threshold filter followed by the erode
  1853. filter once or twice.
  1854. If needed, little splotches can be fixed manually. Remember that if
  1855. logo pixels are not covered, the filter quality will be much
  1856. reduced. Marking too many pixels as part of the logo does not hurt as
  1857. much, but it will increase the amount of blurring needed to cover over
  1858. the image and will destroy more information than necessary, and extra
  1859. pixels will slow things down on a large logo.
  1860. @section scale
  1861. Scale the input video to @var{width}:@var{height}[:@var{interl}=@{1|-1@}] and/or convert the image format.
  1862. The scale filter forces the output display aspect ratio to be the same
  1863. of the input, by changing the output sample aspect ratio.
  1864. The parameters @var{width} and @var{height} are expressions containing
  1865. the following constants:
  1866. @table @option
  1867. @item in_w, in_h
  1868. the input width and height
  1869. @item iw, ih
  1870. same as @var{in_w} and @var{in_h}
  1871. @item out_w, out_h
  1872. the output (cropped) width and height
  1873. @item ow, oh
  1874. same as @var{out_w} and @var{out_h}
  1875. @item a
  1876. same as @var{iw} / @var{ih}
  1877. @item sar
  1878. input sample aspect ratio
  1879. @item dar
  1880. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  1881. @item hsub, vsub
  1882. horizontal and vertical chroma subsample values. For example for the
  1883. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1884. @end table
  1885. If the input image format is different from the format requested by
  1886. the next filter, the scale filter will convert the input to the
  1887. requested format.
  1888. If the value for @var{width} or @var{height} is 0, the respective input
  1889. size is used for the output.
  1890. If the value for @var{width} or @var{height} is -1, the scale filter will
  1891. use, for the respective output size, a value that maintains the aspect
  1892. ratio of the input image.
  1893. The default value of @var{width} and @var{height} is 0.
  1894. Valid values for the optional parameter @var{interl} are:
  1895. @table @option
  1896. @item 1
  1897. force interlaced aware scaling
  1898. @item -1
  1899. select interlaced aware scaling depending on whether the source frames
  1900. are flagged as interlaced or not
  1901. @end table
  1902. Unless @var{interl} is set to one of the above options, interlaced scaling will not be used.
  1903. Some examples follow:
  1904. @example
  1905. # scale the input video to a size of 200x100.
  1906. scale=200:100
  1907. # scale the input to 2x
  1908. scale=2*iw:2*ih
  1909. # the above is the same as
  1910. scale=2*in_w:2*in_h
  1911. # scale the input to 2x with forced interlaced scaling
  1912. scale=2*iw:2*ih:interl=1
  1913. # scale the input to half size
  1914. scale=iw/2:ih/2
  1915. # increase the width, and set the height to the same size
  1916. scale=3/2*iw:ow
  1917. # seek for Greek harmony
  1918. scale=iw:1/PHI*iw
  1919. scale=ih*PHI:ih
  1920. # increase the height, and set the width to 3/2 of the height
  1921. scale=3/2*oh:3/5*ih
  1922. # increase the size, but make the size a multiple of the chroma
  1923. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  1924. # increase the width to a maximum of 500 pixels, keep the same input aspect ratio
  1925. scale='min(500\, iw*3/2):-1'
  1926. @end example
  1927. @section select
  1928. Select frames to pass in output.
  1929. It accepts in input an expression, which is evaluated for each input
  1930. frame. If the expression is evaluated to a non-zero value, the frame
  1931. is selected and passed to the output, otherwise it is discarded.
  1932. The expression can contain the following constants:
  1933. @table @option
  1934. @item n
  1935. the sequential number of the filtered frame, starting from 0
  1936. @item selected_n
  1937. the sequential number of the selected frame, starting from 0
  1938. @item prev_selected_n
  1939. the sequential number of the last selected frame, NAN if undefined
  1940. @item TB
  1941. timebase of the input timestamps
  1942. @item pts
  1943. the PTS (Presentation TimeStamp) of the filtered video frame,
  1944. expressed in @var{TB} units, NAN if undefined
  1945. @item t
  1946. the PTS (Presentation TimeStamp) of the filtered video frame,
  1947. expressed in seconds, NAN if undefined
  1948. @item prev_pts
  1949. the PTS of the previously filtered video frame, NAN if undefined
  1950. @item prev_selected_pts
  1951. the PTS of the last previously filtered video frame, NAN if undefined
  1952. @item prev_selected_t
  1953. the PTS of the last previously selected video frame, NAN if undefined
  1954. @item start_pts
  1955. the PTS of the first video frame in the video, NAN if undefined
  1956. @item start_t
  1957. the time of the first video frame in the video, NAN if undefined
  1958. @item pict_type
  1959. the type of the filtered frame, can assume one of the following
  1960. values:
  1961. @table @option
  1962. @item I
  1963. @item P
  1964. @item B
  1965. @item S
  1966. @item SI
  1967. @item SP
  1968. @item BI
  1969. @end table
  1970. @item interlace_type
  1971. the frame interlace type, can assume one of the following values:
  1972. @table @option
  1973. @item PROGRESSIVE
  1974. the frame is progressive (not interlaced)
  1975. @item TOPFIRST
  1976. the frame is top-field-first
  1977. @item BOTTOMFIRST
  1978. the frame is bottom-field-first
  1979. @end table
  1980. @item key
  1981. 1 if the filtered frame is a key-frame, 0 otherwise
  1982. @item pos
  1983. the position in the file of the filtered frame, -1 if the information
  1984. is not available (e.g. for synthetic video)
  1985. @item scene
  1986. value between 0 and 1 to indicate a new scene; a low value reflects a low
  1987. probability for the current frame to introduce a new scene, while a higher
  1988. value means the current frame is more likely to be one (see the example below)
  1989. @end table
  1990. The default value of the select expression is "1".
  1991. Some examples follow:
  1992. @example
  1993. # select all frames in input
  1994. select
  1995. # the above is the same as:
  1996. select=1
  1997. # skip all frames:
  1998. select=0
  1999. # select only I-frames
  2000. select='eq(pict_type\,I)'
  2001. # select one frame every 100
  2002. select='not(mod(n\,100))'
  2003. # select only frames contained in the 10-20 time interval
  2004. select='gte(t\,10)*lte(t\,20)'
  2005. # select only I frames contained in the 10-20 time interval
  2006. select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
  2007. # select frames with a minimum distance of 10 seconds
  2008. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  2009. @end example
  2010. Complete example to create a mosaic of the first scenes:
  2011. @example
  2012. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  2013. @end example
  2014. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  2015. choice.
  2016. @section setdar, setsar
  2017. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  2018. output video.
  2019. This is done by changing the specified Sample (aka Pixel) Aspect
  2020. Ratio, according to the following equation:
  2021. @example
  2022. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  2023. @end example
  2024. Keep in mind that the @code{setdar} filter does not modify the pixel
  2025. dimensions of the video frame. Also the display aspect ratio set by
  2026. this filter may be changed by later filters in the filterchain,
  2027. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  2028. applied.
  2029. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  2030. the filter output video.
  2031. Note that as a consequence of the application of this filter, the
  2032. output display aspect ratio will change according to the equation
  2033. above.
  2034. Keep in mind that the sample aspect ratio set by the @code{setsar}
  2035. filter may be changed by later filters in the filterchain, e.g. if
  2036. another "setsar" or a "setdar" filter is applied.
  2037. The @code{setdar} and @code{setsar} filters accept a parameter string
  2038. which represents the wanted aspect ratio. The parameter can
  2039. be a floating point number string, an expression, or a string of the form
  2040. @var{num}:@var{den}, where @var{num} and @var{den} are the numerator
  2041. and denominator of the aspect ratio. If the parameter is not
  2042. specified, it is assumed the value "0:1".
  2043. For example to change the display aspect ratio to 16:9, specify:
  2044. @example
  2045. setdar=16:9
  2046. @end example
  2047. The example above is equivalent to:
  2048. @example
  2049. setdar=1.77777
  2050. @end example
  2051. To change the sample aspect ratio to 10:11, specify:
  2052. @example
  2053. setsar=10:11
  2054. @end example
  2055. @section setfield
  2056. Force field for the output video frame.
  2057. The @code{setfield} filter marks the interlace type field for the
  2058. output frames. It does not change the input frame, but only sets the
  2059. corresponding property, which affects how the frame is treated by
  2060. following filters (e.g. @code{fieldorder} or @code{yadif}).
  2061. It accepts a string parameter, which can assume the following values:
  2062. @table @samp
  2063. @item auto
  2064. Keep the same field property.
  2065. @item bff
  2066. Mark the frame as bottom-field-first.
  2067. @item tff
  2068. Mark the frame as top-field-first.
  2069. @item prog
  2070. Mark the frame as progressive.
  2071. @end table
  2072. @section setpts
  2073. Change the PTS (presentation timestamp) of the input video frames.
  2074. Accept in input an expression evaluated through the eval API, which
  2075. can contain the following constants:
  2076. @table @option
  2077. @item PTS
  2078. the presentation timestamp in input
  2079. @item N
  2080. the count of the input frame, starting from 0.
  2081. @item STARTPTS
  2082. the PTS of the first video frame
  2083. @item INTERLACED
  2084. tell if the current frame is interlaced
  2085. @item POS
  2086. original position in the file of the frame, or undefined if undefined
  2087. for the current frame
  2088. @item PREV_INPTS
  2089. previous input PTS
  2090. @item PREV_OUTPTS
  2091. previous output PTS
  2092. @end table
  2093. Some examples follow:
  2094. @example
  2095. # start counting PTS from zero
  2096. setpts=PTS-STARTPTS
  2097. # fast motion
  2098. setpts=0.5*PTS
  2099. # slow motion
  2100. setpts=2.0*PTS
  2101. # fixed rate 25 fps
  2102. setpts=N/(25*TB)
  2103. # fixed rate 25 fps with some jitter
  2104. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  2105. @end example
  2106. @section settb
  2107. Set the timebase to use for the output frames timestamps.
  2108. It is mainly useful for testing timebase configuration.
  2109. It accepts in input an arithmetic expression representing a rational.
  2110. The expression can contain the constants "AVTB" (the
  2111. default timebase), and "intb" (the input timebase).
  2112. The default value for the input is "intb".
  2113. Follow some examples.
  2114. @example
  2115. # set the timebase to 1/25
  2116. settb=1/25
  2117. # set the timebase to 1/10
  2118. settb=0.1
  2119. #set the timebase to 1001/1000
  2120. settb=1+0.001
  2121. #set the timebase to 2*intb
  2122. settb=2*intb
  2123. #set the default timebase value
  2124. settb=AVTB
  2125. @end example
  2126. @section showinfo
  2127. Show a line containing various information for each input video frame.
  2128. The input video is not modified.
  2129. The shown line contains a sequence of key/value pairs of the form
  2130. @var{key}:@var{value}.
  2131. A description of each shown parameter follows:
  2132. @table @option
  2133. @item n
  2134. sequential number of the input frame, starting from 0
  2135. @item pts
  2136. Presentation TimeStamp of the input frame, expressed as a number of
  2137. time base units. The time base unit depends on the filter input pad.
  2138. @item pts_time
  2139. Presentation TimeStamp of the input frame, expressed as a number of
  2140. seconds
  2141. @item pos
  2142. position of the frame in the input stream, -1 if this information in
  2143. unavailable and/or meaningless (for example in case of synthetic video)
  2144. @item fmt
  2145. pixel format name
  2146. @item sar
  2147. sample aspect ratio of the input frame, expressed in the form
  2148. @var{num}/@var{den}
  2149. @item s
  2150. size of the input frame, expressed in the form
  2151. @var{width}x@var{height}
  2152. @item i
  2153. interlaced mode ("P" for "progressive", "T" for top field first, "B"
  2154. for bottom field first)
  2155. @item iskey
  2156. 1 if the frame is a key frame, 0 otherwise
  2157. @item type
  2158. picture type of the input frame ("I" for an I-frame, "P" for a
  2159. P-frame, "B" for a B-frame, "?" for unknown type).
  2160. Check also the documentation of the @code{AVPictureType} enum and of
  2161. the @code{av_get_picture_type_char} function defined in
  2162. @file{libavutil/avutil.h}.
  2163. @item checksum
  2164. Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
  2165. @item plane_checksum
  2166. Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  2167. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]"
  2168. @end table
  2169. @section slicify
  2170. Pass the images of input video on to next video filter as multiple
  2171. slices.
  2172. @example
  2173. ffmpeg -i in.avi -vf "slicify=32" out.avi
  2174. @end example
  2175. The filter accepts the slice height as parameter. If the parameter is
  2176. not specified it will use the default value of 16.
  2177. Adding this in the beginning of filter chains should make filtering
  2178. faster due to better use of the memory cache.
  2179. @section split
  2180. Split input video into several identical outputs.
  2181. The filter accepts a single parameter which specifies the number of outputs. If
  2182. unspecified, it defaults to 2.
  2183. For example
  2184. @example
  2185. ffmpeg -i INPUT -filter_complex split=5 OUTPUT
  2186. @end example
  2187. will create 5 copies of the input video.
  2188. For example:
  2189. @example
  2190. [in] split [splitout1][splitout2];
  2191. [splitout1] crop=100:100:0:0 [cropout];
  2192. [splitout2] pad=200:200:100:100 [padout];
  2193. @end example
  2194. will create two separate outputs from the same input, one cropped and
  2195. one padded.
  2196. @section super2xsai
  2197. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  2198. Interpolate) pixel art scaling algorithm.
  2199. Useful for enlarging pixel art images without reducing sharpness.
  2200. @section swapuv
  2201. Swap U & V plane.
  2202. @section thumbnail
  2203. Select the most representative frame in a given sequence of consecutive frames.
  2204. It accepts as argument the frames batch size to analyze (default @var{N}=100);
  2205. in a set of @var{N} frames, the filter will pick one of them, and then handle
  2206. the next batch of @var{N} frames until the end.
  2207. Since the filter keeps track of the whole frames sequence, a bigger @var{N}
  2208. value will result in a higher memory usage, so a high value is not recommended.
  2209. The following example extract one picture each 50 frames:
  2210. @example
  2211. thumbnail=50
  2212. @end example
  2213. Complete example of a thumbnail creation with @command{ffmpeg}:
  2214. @example
  2215. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  2216. @end example
  2217. @section tile
  2218. Tile several successive frames together.
  2219. It accepts as argument the tile size (i.e. the number of lines and columns)
  2220. in the form "@var{w}x@var{h}".
  2221. For example, produce 8×8 PNG tiles of all keyframes (@option{-skip_frame
  2222. nokey}) in a movie:
  2223. @example
  2224. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  2225. @end example
  2226. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  2227. duplicating each output frame to accomodate the originally detected frame
  2228. rate.
  2229. @section tinterlace
  2230. Perform various types of temporal field interlacing.
  2231. Frames are counted starting from 1, so the first input frame is
  2232. considered odd.
  2233. This filter accepts a single parameter specifying the mode. Available
  2234. modes are:
  2235. @table @samp
  2236. @item merge, 0
  2237. Move odd frames into the upper field, even into the lower field,
  2238. generating a double height frame at half framerate.
  2239. @item drop_odd, 1
  2240. Only output even frames, odd frames are dropped, generating a frame with
  2241. unchanged height at half framerate.
  2242. @item drop_even, 2
  2243. Only output odd frames, even frames are dropped, generating a frame with
  2244. unchanged height at half framerate.
  2245. @item pad, 3
  2246. Expand each frame to full height, but pad alternate lines with black,
  2247. generating a frame with double height at the same input framerate.
  2248. @item interleave_top, 4
  2249. Interleave the upper field from odd frames with the lower field from
  2250. even frames, generating a frame with unchanged height at half framerate.
  2251. @item interleave_bottom, 5
  2252. Interleave the lower field from odd frames with the upper field from
  2253. even frames, generating a frame with unchanged height at half framerate.
  2254. @item interlacex2, 6
  2255. Double frame rate with unchanged height. Frames are inserted each
  2256. containing the second temporal field from the previous input frame and
  2257. the first temporal field from the next input frame. This mode relies on
  2258. the top_field_first flag. Useful for interlaced video displays with no
  2259. field synchronisation.
  2260. @end table
  2261. Numeric values are deprecated but are accepted for backward
  2262. compatibility reasons.
  2263. Default mode is @code{merge}.
  2264. @section transpose
  2265. Transpose rows with columns in the input video and optionally flip it.
  2266. It accepts a parameter representing an integer, which can assume the
  2267. values:
  2268. @table @samp
  2269. @item 0
  2270. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  2271. @example
  2272. L.R L.l
  2273. . . -> . .
  2274. l.r R.r
  2275. @end example
  2276. @item 1
  2277. Rotate by 90 degrees clockwise, that is:
  2278. @example
  2279. L.R l.L
  2280. . . -> . .
  2281. l.r r.R
  2282. @end example
  2283. @item 2
  2284. Rotate by 90 degrees counterclockwise, that is:
  2285. @example
  2286. L.R R.r
  2287. . . -> . .
  2288. l.r L.l
  2289. @end example
  2290. @item 3
  2291. Rotate by 90 degrees clockwise and vertically flip, that is:
  2292. @example
  2293. L.R r.R
  2294. . . -> . .
  2295. l.r l.L
  2296. @end example
  2297. @end table
  2298. @section unsharp
  2299. Sharpen or blur the input video.
  2300. It accepts the following parameters:
  2301. @var{luma_msize_x}:@var{luma_msize_y}:@var{luma_amount}:@var{chroma_msize_x}:@var{chroma_msize_y}:@var{chroma_amount}
  2302. Negative values for the amount will blur the input video, while positive
  2303. values will sharpen. All parameters are optional and default to the
  2304. equivalent of the string '5:5:1.0:5:5:0.0'.
  2305. @table @option
  2306. @item luma_msize_x
  2307. Set the luma matrix horizontal size. It can be an integer between 3
  2308. and 13, default value is 5.
  2309. @item luma_msize_y
  2310. Set the luma matrix vertical size. It can be an integer between 3
  2311. and 13, default value is 5.
  2312. @item luma_amount
  2313. Set the luma effect strength. It can be a float number between -2.0
  2314. and 5.0, default value is 1.0.
  2315. @item chroma_msize_x
  2316. Set the chroma matrix horizontal size. It can be an integer between 3
  2317. and 13, default value is 5.
  2318. @item chroma_msize_y
  2319. Set the chroma matrix vertical size. It can be an integer between 3
  2320. and 13, default value is 5.
  2321. @item chroma_amount
  2322. Set the chroma effect strength. It can be a float number between -2.0
  2323. and 5.0, default value is 0.0.
  2324. @end table
  2325. @example
  2326. # Strong luma sharpen effect parameters
  2327. unsharp=7:7:2.5
  2328. # Strong blur of both luma and chroma parameters
  2329. unsharp=7:7:-2:7:7:-2
  2330. # Use the default values with @command{ffmpeg}
  2331. ffmpeg -i in.avi -vf "unsharp" out.mp4
  2332. @end example
  2333. @section vflip
  2334. Flip the input video vertically.
  2335. @example
  2336. ffmpeg -i in.avi -vf "vflip" out.avi
  2337. @end example
  2338. @section yadif
  2339. Deinterlace the input video ("yadif" means "yet another deinterlacing
  2340. filter").
  2341. It accepts the optional parameters: @var{mode}:@var{parity}:@var{auto}.
  2342. @var{mode} specifies the interlacing mode to adopt, accepts one of the
  2343. following values:
  2344. @table @option
  2345. @item 0
  2346. output 1 frame for each frame
  2347. @item 1
  2348. output 1 frame for each field
  2349. @item 2
  2350. like 0 but skips spatial interlacing check
  2351. @item 3
  2352. like 1 but skips spatial interlacing check
  2353. @end table
  2354. Default value is 0.
  2355. @var{parity} specifies the picture field parity assumed for the input
  2356. interlaced video, accepts one of the following values:
  2357. @table @option
  2358. @item 0
  2359. assume top field first
  2360. @item 1
  2361. assume bottom field first
  2362. @item -1
  2363. enable automatic detection
  2364. @end table
  2365. Default value is -1.
  2366. If interlacing is unknown or decoder does not export this information,
  2367. top field first will be assumed.
  2368. @var{auto} specifies if deinterlacer should trust the interlaced flag
  2369. and only deinterlace frames marked as interlaced
  2370. @table @option
  2371. @item 0
  2372. deinterlace all frames
  2373. @item 1
  2374. only deinterlace frames marked as interlaced
  2375. @end table
  2376. Default value is 0.
  2377. @c man end VIDEO FILTERS
  2378. @chapter Video Sources
  2379. @c man begin VIDEO SOURCES
  2380. Below is a description of the currently available video sources.
  2381. @section buffer
  2382. Buffer video frames, and make them available to the filter chain.
  2383. This source is mainly intended for a programmatic use, in particular
  2384. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  2385. It accepts a list of options in the form of @var{key}=@var{value} pairs
  2386. separated by ":". A descroption of the accepted options follows.
  2387. @table @option
  2388. @item video_size
  2389. Specify the size (width and height) of the buffered video frames.
  2390. @item pix_fmt
  2391. A string representing the pixel format of the buffered video frames.
  2392. It may be a number corresponding to a pixel format, or a pixel format
  2393. name.
  2394. @item time_base
  2395. Specify the timebase assumed by the timestamps of the buffered frames.
  2396. @item time_base
  2397. Specify the frame rate expected for the video stream.
  2398. @item pixel_aspect
  2399. Specify the sample aspect ratio assumed by the video frames.
  2400. @item sws_param
  2401. Specify the optional parameters to be used for the scale filter which
  2402. is automatically inserted when an input change is detected in the
  2403. input size or format.
  2404. @end table
  2405. For example:
  2406. @example
  2407. buffer=size=320x240:pix_fmt=yuv410p:time_base=1/24:pixel_aspect=1/1
  2408. @end example
  2409. will instruct the source to accept video frames with size 320x240 and
  2410. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  2411. square pixels (1:1 sample aspect ratio).
  2412. Since the pixel format with name "yuv410p" corresponds to the number 6
  2413. (check the enum PixelFormat definition in @file{libavutil/pixfmt.h}),
  2414. this example corresponds to:
  2415. @example
  2416. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  2417. @end example
  2418. Alternatively, the options can be specified as a flat string, but this
  2419. syntax is deprecated:
  2420. @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}]
  2421. @section cellauto
  2422. Create a pattern generated by an elementary cellular automaton.
  2423. The initial state of the cellular automaton can be defined through the
  2424. @option{filename}, and @option{pattern} options. If such options are
  2425. not specified an initial state is created randomly.
  2426. At each new frame a new row in the video is filled with the result of
  2427. the cellular automaton next generation. The behavior when the whole
  2428. frame is filled is defined by the @option{scroll} option.
  2429. This source accepts a list of options in the form of
  2430. @var{key}=@var{value} pairs separated by ":". A description of the
  2431. accepted options follows.
  2432. @table @option
  2433. @item filename, f
  2434. Read the initial cellular automaton state, i.e. the starting row, from
  2435. the specified file.
  2436. In the file, each non-whitespace character is considered an alive
  2437. cell, a newline will terminate the row, and further characters in the
  2438. file will be ignored.
  2439. @item pattern, p
  2440. Read the initial cellular automaton state, i.e. the starting row, from
  2441. the specified string.
  2442. Each non-whitespace character in the string is considered an alive
  2443. cell, a newline will terminate the row, and further characters in the
  2444. string will be ignored.
  2445. @item rate, r
  2446. Set the video rate, that is the number of frames generated per second.
  2447. Default is 25.
  2448. @item random_fill_ratio, ratio
  2449. Set the random fill ratio for the initial cellular automaton row. It
  2450. is a floating point number value ranging from 0 to 1, defaults to
  2451. 1/PHI.
  2452. This option is ignored when a file or a pattern is specified.
  2453. @item random_seed, seed
  2454. Set the seed for filling randomly the initial row, must be an integer
  2455. included between 0 and UINT32_MAX. If not specified, or if explicitly
  2456. set to -1, the filter will try to use a good random seed on a best
  2457. effort basis.
  2458. @item rule
  2459. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  2460. Default value is 110.
  2461. @item size, s
  2462. Set the size of the output video.
  2463. If @option{filename} or @option{pattern} is specified, the size is set
  2464. by default to the width of the specified initial state row, and the
  2465. height is set to @var{width} * PHI.
  2466. If @option{size} is set, it must contain the width of the specified
  2467. pattern string, and the specified pattern will be centered in the
  2468. larger row.
  2469. If a filename or a pattern string is not specified, the size value
  2470. defaults to "320x518" (used for a randomly generated initial state).
  2471. @item scroll
  2472. If set to 1, scroll the output upward when all the rows in the output
  2473. have been already filled. If set to 0, the new generated row will be
  2474. written over the top row just after the bottom row is filled.
  2475. Defaults to 1.
  2476. @item start_full, full
  2477. If set to 1, completely fill the output with generated rows before
  2478. outputting the first frame.
  2479. This is the default behavior, for disabling set the value to 0.
  2480. @item stitch
  2481. If set to 1, stitch the left and right row edges together.
  2482. This is the default behavior, for disabling set the value to 0.
  2483. @end table
  2484. @subsection Examples
  2485. @itemize
  2486. @item
  2487. Read the initial state from @file{pattern}, and specify an output of
  2488. size 200x400.
  2489. @example
  2490. cellauto=f=pattern:s=200x400
  2491. @end example
  2492. @item
  2493. Generate a random initial row with a width of 200 cells, with a fill
  2494. ratio of 2/3:
  2495. @example
  2496. cellauto=ratio=2/3:s=200x200
  2497. @end example
  2498. @item
  2499. Create a pattern generated by rule 18 starting by a single alive cell
  2500. centered on an initial row with width 100:
  2501. @example
  2502. cellauto=p=@@:s=100x400:full=0:rule=18
  2503. @end example
  2504. @item
  2505. Specify a more elaborated initial pattern:
  2506. @example
  2507. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  2508. @end example
  2509. @end itemize
  2510. @section color
  2511. Provide an uniformly colored input.
  2512. This source accepts list of options in the form of
  2513. @var{key}=@var{value} pairs separated by ":".
  2514. Alternatively, it accepts a string in the form
  2515. @var{color}:@var{size}:@var{rate}, but this syntax is
  2516. deprecated.
  2517. Follows the description of the accepted parameters.
  2518. @table @option
  2519. @item color, c
  2520. Specify the color of the source. It can be the name of a color (case
  2521. insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
  2522. alpha specifier. The default value is "black".
  2523. @item size, s
  2524. Specify the size of the sourced video, it may be a string of the form
  2525. @var{width}x@var{height}, or the name of a size abbreviation. The
  2526. default value is "320x240".
  2527. @item rate, r
  2528. Specify the frame rate of the sourced video, as the number of frames
  2529. generated per second. It has to be a string in the format
  2530. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  2531. number or a valid video frame rate abbreviation. The default value is
  2532. "25".
  2533. @end table
  2534. For example the following graph description will generate a red source
  2535. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  2536. frames per second, which will be overlayed over the source connected
  2537. to the pad with identifier "in".
  2538. @example
  2539. "color=c=red@@0.2:s=qcif:r=10 [color]; [in][color] overlay [out]"
  2540. @end example
  2541. @section movie
  2542. Read a video stream from a movie container.
  2543. It accepts the syntax: @var{movie_name}[:@var{options}] where
  2544. @var{movie_name} is the name of the resource to read (not necessarily
  2545. a file but also a device or a stream accessed through some protocol),
  2546. and @var{options} is an optional sequence of @var{key}=@var{value}
  2547. pairs, separated by ":".
  2548. The description of the accepted options follows.
  2549. @table @option
  2550. @item format_name, f
  2551. Specifies the format assumed for the movie to read, and can be either
  2552. the name of a container or an input device. If not specified the
  2553. format is guessed from @var{movie_name} or by probing.
  2554. @item seek_point, sp
  2555. Specifies the seek point in seconds, the frames will be output
  2556. starting from this seek point, the parameter is evaluated with
  2557. @code{av_strtod} so the numerical value may be suffixed by an IS
  2558. postfix. Default value is "0".
  2559. @item stream_index, si
  2560. Specifies the index of the video stream to read. If the value is -1,
  2561. the best suited video stream will be automatically selected. Default
  2562. value is "-1".
  2563. @item loop
  2564. Specifies how many times to read the video stream in sequence.
  2565. If the value is less than 1, the stream will be read again and again.
  2566. Default value is "1".
  2567. Note that when the movie is looped the source timestamps are not
  2568. changed, so it will generate non monotonically increasing timestamps.
  2569. @end table
  2570. This filter allows to overlay a second video on top of main input of
  2571. a filtergraph as shown in this graph:
  2572. @example
  2573. input -----------> deltapts0 --> overlay --> output
  2574. ^
  2575. |
  2576. movie --> scale--> deltapts1 -------+
  2577. @end example
  2578. Some examples follow:
  2579. @example
  2580. # skip 3.2 seconds from the start of the avi file in.avi, and overlay it
  2581. # on top of the input labelled as "in".
  2582. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
  2583. [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
  2584. # read from a video4linux2 device, and overlay it on top of the input
  2585. # labelled as "in"
  2586. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
  2587. [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
  2588. @end example
  2589. @section mptestsrc
  2590. Generate various test patterns, as generated by the MPlayer test filter.
  2591. The size of the generated video is fixed, and is 256x256.
  2592. This source is useful in particular for testing encoding features.
  2593. This source accepts an optional sequence of @var{key}=@var{value} pairs,
  2594. separated by ":". The description of the accepted options follows.
  2595. @table @option
  2596. @item rate, r
  2597. Specify the frame rate of the sourced video, as the number of frames
  2598. generated per second. It has to be a string in the format
  2599. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  2600. number or a valid video frame rate abbreviation. The default value is
  2601. "25".
  2602. @item duration, d
  2603. Set the video duration of the sourced video. The accepted syntax is:
  2604. @example
  2605. [-]HH:MM:SS[.m...]
  2606. [-]S+[.m...]
  2607. @end example
  2608. See also the function @code{av_parse_time()}.
  2609. If not specified, or the expressed duration is negative, the video is
  2610. supposed to be generated forever.
  2611. @item test, t
  2612. Set the number or the name of the test to perform. Supported tests are:
  2613. @table @option
  2614. @item dc_luma
  2615. @item dc_chroma
  2616. @item freq_luma
  2617. @item freq_chroma
  2618. @item amp_luma
  2619. @item amp_chroma
  2620. @item cbp
  2621. @item mv
  2622. @item ring1
  2623. @item ring2
  2624. @item all
  2625. @end table
  2626. Default value is "all", which will cycle through the list of all tests.
  2627. @end table
  2628. For example the following:
  2629. @example
  2630. testsrc=t=dc_luma
  2631. @end example
  2632. will generate a "dc_luma" test pattern.
  2633. @section frei0r_src
  2634. Provide a frei0r source.
  2635. To enable compilation of this filter you need to install the frei0r
  2636. header and configure FFmpeg with @code{--enable-frei0r}.
  2637. The source supports the syntax:
  2638. @example
  2639. @var{size}:@var{rate}:@var{src_name}[@{=|:@}@var{param1}:@var{param2}:...:@var{paramN}]
  2640. @end example
  2641. @var{size} is the size of the video to generate, may be a string of the
  2642. form @var{width}x@var{height} or a frame size abbreviation.
  2643. @var{rate} is the rate of the video to generate, may be a string of
  2644. the form @var{num}/@var{den} or a frame rate abbreviation.
  2645. @var{src_name} is the name to the frei0r source to load. For more
  2646. information regarding frei0r and how to set the parameters read the
  2647. section @ref{frei0r} in the description of the video filters.
  2648. For example, to generate a frei0r partik0l source with size 200x200
  2649. and frame rate 10 which is overlayed on the overlay filter main input:
  2650. @example
  2651. frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
  2652. @end example
  2653. @section life
  2654. Generate a life pattern.
  2655. This source is based on a generalization of John Conway's life game.
  2656. The sourced input represents a life grid, each pixel represents a cell
  2657. which can be in one of two possible states, alive or dead. Every cell
  2658. interacts with its eight neighbours, which are the cells that are
  2659. horizontally, vertically, or diagonally adjacent.
  2660. At each interaction the grid evolves according to the adopted rule,
  2661. which specifies the number of neighbor alive cells which will make a
  2662. cell stay alive or born. The @option{rule} option allows to specify
  2663. the rule to adopt.
  2664. This source accepts a list of options in the form of
  2665. @var{key}=@var{value} pairs separated by ":". A description of the
  2666. accepted options follows.
  2667. @table @option
  2668. @item filename, f
  2669. Set the file from which to read the initial grid state. In the file,
  2670. each non-whitespace character is considered an alive cell, and newline
  2671. is used to delimit the end of each row.
  2672. If this option is not specified, the initial grid is generated
  2673. randomly.
  2674. @item rate, r
  2675. Set the video rate, that is the number of frames generated per second.
  2676. Default is 25.
  2677. @item random_fill_ratio, ratio
  2678. Set the random fill ratio for the initial random grid. It is a
  2679. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  2680. It is ignored when a file is specified.
  2681. @item random_seed, seed
  2682. Set the seed for filling the initial random grid, must be an integer
  2683. included between 0 and UINT32_MAX. If not specified, or if explicitly
  2684. set to -1, the filter will try to use a good random seed on a best
  2685. effort basis.
  2686. @item rule
  2687. Set the life rule.
  2688. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  2689. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  2690. @var{NS} specifies the number of alive neighbor cells which make a
  2691. live cell stay alive, and @var{NB} the number of alive neighbor cells
  2692. which make a dead cell to become alive (i.e. to "born").
  2693. "s" and "b" can be used in place of "S" and "B", respectively.
  2694. Alternatively a rule can be specified by an 18-bits integer. The 9
  2695. high order bits are used to encode the next cell state if it is alive
  2696. for each number of neighbor alive cells, the low order bits specify
  2697. the rule for "borning" new cells. Higher order bits encode for an
  2698. higher number of neighbor cells.
  2699. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  2700. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  2701. Default value is "S23/B3", which is the original Conway's game of life
  2702. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  2703. cells, and will born a new cell if there are three alive cells around
  2704. a dead cell.
  2705. @item size, s
  2706. Set the size of the output video.
  2707. If @option{filename} is specified, the size is set by default to the
  2708. same size of the input file. If @option{size} is set, it must contain
  2709. the size specified in the input file, and the initial grid defined in
  2710. that file is centered in the larger resulting area.
  2711. If a filename is not specified, the size value defaults to "320x240"
  2712. (used for a randomly generated initial grid).
  2713. @item stitch
  2714. If set to 1, stitch the left and right grid edges together, and the
  2715. top and bottom edges also. Defaults to 1.
  2716. @item mold
  2717. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  2718. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  2719. value from 0 to 255.
  2720. @item life_color
  2721. Set the color of living (or new born) cells.
  2722. @item death_color
  2723. Set the color of dead cells. If @option{mold} is set, this is the first color
  2724. used to represent a dead cell.
  2725. @item mold_color
  2726. Set mold color, for definitely dead and moldy cells.
  2727. @end table
  2728. @subsection Examples
  2729. @itemize
  2730. @item
  2731. Read a grid from @file{pattern}, and center it on a grid of size
  2732. 300x300 pixels:
  2733. @example
  2734. life=f=pattern:s=300x300
  2735. @end example
  2736. @item
  2737. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  2738. @example
  2739. life=ratio=2/3:s=200x200
  2740. @end example
  2741. @item
  2742. Specify a custom rule for evolving a randomly generated grid:
  2743. @example
  2744. life=rule=S14/B34
  2745. @end example
  2746. @item
  2747. Full example with slow death effect (mold) using @command{ffplay}:
  2748. @example
  2749. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  2750. @end example
  2751. @end itemize
  2752. @section nullsrc, rgbtestsrc, testsrc
  2753. The @code{nullsrc} source returns unprocessed video frames. It is
  2754. mainly useful to be employed in analysis / debugging tools, or as the
  2755. source for filters which ignore the input data.
  2756. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  2757. detecting RGB vs BGR issues. You should see a red, green and blue
  2758. stripe from top to bottom.
  2759. The @code{testsrc} source generates a test video pattern, showing a
  2760. color pattern, a scrolling gradient and a timestamp. This is mainly
  2761. intended for testing purposes.
  2762. These sources accept an optional sequence of @var{key}=@var{value} pairs,
  2763. separated by ":". The description of the accepted options follows.
  2764. @table @option
  2765. @item size, s
  2766. Specify the size of the sourced video, it may be a string of the form
  2767. @var{width}x@var{height}, or the name of a size abbreviation. The
  2768. default value is "320x240".
  2769. @item rate, r
  2770. Specify the frame rate of the sourced video, as the number of frames
  2771. generated per second. It has to be a string in the format
  2772. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  2773. number or a valid video frame rate abbreviation. The default value is
  2774. "25".
  2775. @item sar
  2776. Set the sample aspect ratio of the sourced video.
  2777. @item duration, d
  2778. Set the video duration of the sourced video. The accepted syntax is:
  2779. @example
  2780. [-]HH[:MM[:SS[.m...]]]
  2781. [-]S+[.m...]
  2782. @end example
  2783. See also the function @code{av_parse_time()}.
  2784. If not specified, or the expressed duration is negative, the video is
  2785. supposed to be generated forever.
  2786. @item decimals, n
  2787. Set the number of decimals to show in the timestamp, only used in the
  2788. @code{testsrc} source.
  2789. The displayed timestamp value will correspond to the original
  2790. timestamp value multiplied by the power of 10 of the specified
  2791. value. Default value is 0.
  2792. @end table
  2793. For example the following:
  2794. @example
  2795. testsrc=duration=5.3:size=qcif:rate=10
  2796. @end example
  2797. will generate a video with a duration of 5.3 seconds, with size
  2798. 176x144 and a frame rate of 10 frames per second.
  2799. If the input content is to be ignored, @code{nullsrc} can be used. The
  2800. following command generates noise in the luminance plane by employing
  2801. the @code{mp=geq} filter:
  2802. @example
  2803. nullsrc=s=256x256, mp=geq=random(1)*255:128:128
  2804. @end example
  2805. @c man end VIDEO SOURCES
  2806. @chapter Video Sinks
  2807. @c man begin VIDEO SINKS
  2808. Below is a description of the currently available video sinks.
  2809. @section buffersink
  2810. Buffer video frames, and make them available to the end of the filter
  2811. graph.
  2812. This sink is mainly intended for a programmatic use, in particular
  2813. through the interface defined in @file{libavfilter/buffersink.h}.
  2814. It does not require a string parameter in input, but you need to
  2815. specify a pointer to a list of supported pixel formats terminated by
  2816. -1 in the opaque parameter provided to @code{avfilter_init_filter}
  2817. when initializing this sink.
  2818. @section nullsink
  2819. Null video sink, do absolutely nothing with the input video. It is
  2820. mainly useful as a template and to be employed in analysis / debugging
  2821. tools.
  2822. @c man end VIDEO SINKS
  2823. @chapter Transmedia Filters
  2824. @c man begin TRANSMEDIA FILTERS
  2825. Below is a description of the currently available transmedia filters.
  2826. @section showwaves
  2827. Convert input audio to a video output, representing the samples waves.
  2828. The filter accepts the following named parameters:
  2829. @table @option
  2830. @item n
  2831. Set the number of samples which are printed on the same column. A
  2832. larger value will decrease the frame rate. Must be a positive
  2833. integer. This option can be set only if the value for @var{rate}
  2834. is not explicitly specified.
  2835. @item rate, r
  2836. Set the (approximate) output frame rate. This is done by setting the
  2837. option @var{n}. Default value is "25".
  2838. @item size, s
  2839. Specify the video size for the output. Default value is "600x240".
  2840. @end table
  2841. Some examples follow.
  2842. @itemize
  2843. @item
  2844. Output the input file audio and the corresponding video representation
  2845. at the same time:
  2846. @example
  2847. amovie=a.mp3,asplit[out0],showwaves[out1]
  2848. @end example
  2849. @item
  2850. Create a synthetic signal and show it with showwaves, forcing a
  2851. framerate of 30 frames per second:
  2852. @example
  2853. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  2854. @end example
  2855. @end itemize
  2856. @c man end TRANSMEDIA FILTERS