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.

9403 lines
251KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @example
  9. input --> split ---------------------> overlay --> output
  10. | ^
  11. | |
  12. +-----> crop --> vflip -------+
  13. @end example
  14. This filtergraph splits the input stream in two streams, sends one
  15. stream through the crop filter and the vflip filter before merging it
  16. back with the other stream by overlaying it on top. You can use the
  17. following command to achieve this:
  18. @example
  19. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  20. @end example
  21. The result will be that in output the top half of the video is mirrored
  22. onto the bottom half.
  23. Filters in the same linear chain are separated by commas, and distinct
  24. linear chains of filters are separated by semicolons. In our example,
  25. @var{crop,vflip} are in one linear chain, @var{split} and
  26. @var{overlay} are separately in another. The points where the linear
  27. chains join are labelled by names enclosed in square brackets. In the
  28. example, the split filter generates two outputs that are associated to
  29. the labels @var{[main]} and @var{[tmp]}.
  30. The stream sent to the second output of @var{split}, labelled as
  31. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  32. away the lower half part of the video, and then vertically flipped. The
  33. @var{overlay} filter takes in input the first unchanged output of the
  34. split filter (which was labelled as @var{[main]}), and overlay on its
  35. lower half the output generated by the @var{crop,vflip} filterchain.
  36. Some filters take in input a list of parameters: they are specified
  37. after the filter name and an equal sign, and are separated from each other
  38. by a colon.
  39. There exist so-called @var{source filters} that do not have an
  40. audio/video input, and @var{sink filters} that will not have audio/video
  41. output.
  42. @c man end FILTERING INTRODUCTION
  43. @chapter graph2dot
  44. @c man begin GRAPH2DOT
  45. The @file{graph2dot} program included in the FFmpeg @file{tools}
  46. directory can be used to parse a filtergraph description and issue a
  47. corresponding textual representation in the dot language.
  48. Invoke the command:
  49. @example
  50. graph2dot -h
  51. @end example
  52. to see how to use @file{graph2dot}.
  53. You can then pass the dot description to the @file{dot} program (from
  54. the graphviz suite of programs) and obtain a graphical representation
  55. of the filtergraph.
  56. For example the sequence of commands:
  57. @example
  58. echo @var{GRAPH_DESCRIPTION} | \
  59. tools/graph2dot -o graph.tmp && \
  60. dot -Tpng graph.tmp -o graph.png && \
  61. display graph.png
  62. @end example
  63. can be used to create and display an image representing the graph
  64. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  65. a complete self-contained graph, with its inputs and outputs explicitly defined.
  66. For example if your command line is of the form:
  67. @example
  68. ffmpeg -i infile -vf scale=640:360 outfile
  69. @end example
  70. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  71. @example
  72. nullsrc,scale=640:360,nullsink
  73. @end example
  74. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  75. filter in order to simulate a specific input file.
  76. @c man end GRAPH2DOT
  77. @chapter Filtergraph description
  78. @c man begin FILTERGRAPH DESCRIPTION
  79. A filtergraph is a directed graph of connected filters. It can contain
  80. cycles, and there can be multiple links between a pair of
  81. filters. Each link has one input pad on one side connecting it to one
  82. filter from which it takes its input, and one output pad on the other
  83. side connecting it to the one filter accepting its output.
  84. Each filter in a filtergraph is an instance of a filter class
  85. registered in the application, which defines the features and the
  86. number of input and output pads of the filter.
  87. A filter with no input pads is called a "source", a filter with no
  88. output pads is called a "sink".
  89. @anchor{Filtergraph syntax}
  90. @section Filtergraph syntax
  91. A filtergraph can be represented using a textual representation, which is
  92. recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
  93. options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
  94. @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} function defined in
  95. @file{libavfilter/avfilter.h}.
  96. A filterchain consists of a sequence of connected filters, each one
  97. connected to the previous one in the sequence. A filterchain is
  98. represented by a list of ","-separated filter descriptions.
  99. A filtergraph consists of a sequence of filterchains. A sequence of
  100. filterchains is represented by a list of ";"-separated filterchain
  101. descriptions.
  102. A filter is represented by a string of the form:
  103. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  104. @var{filter_name} is the name of the filter class of which the
  105. described filter is an instance of, and has to be the name of one of
  106. the filter classes registered in the program.
  107. The name of the filter class is optionally followed by a string
  108. "=@var{arguments}".
  109. @var{arguments} is a string which contains the parameters used to
  110. initialize the filter instance. It may have one of the following forms:
  111. @itemize
  112. @item
  113. A ':'-separated list of @var{key=value} pairs.
  114. @item
  115. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  116. the option names in the order they are declared. E.g. the @code{fade} filter
  117. declares three options in this order -- @option{type}, @option{start_frame} and
  118. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  119. @var{in} is assigned to the option @option{type}, @var{0} to
  120. @option{start_frame} and @var{30} to @option{nb_frames}.
  121. @item
  122. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  123. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  124. follow the same constraints order of the previous point. The following
  125. @var{key=value} pairs can be set in any preferred order.
  126. @end itemize
  127. If the option value itself is a list of items (e.g. the @code{format} filter
  128. takes a list of pixel formats), the items in the list are usually separated by
  129. '|'.
  130. The list of arguments can be quoted using the character "'" as initial
  131. and ending mark, and the character '\' for escaping the characters
  132. within the quoted text; otherwise the argument string is considered
  133. terminated when the next special character (belonging to the set
  134. "[]=;,") is encountered.
  135. The name and arguments of the filter are optionally preceded and
  136. followed by a list of link labels.
  137. A link label allows to name a link and associate it to a filter output
  138. or input pad. The preceding labels @var{in_link_1}
  139. ... @var{in_link_N}, are associated to the filter input pads,
  140. the following labels @var{out_link_1} ... @var{out_link_M}, are
  141. associated to the output pads.
  142. When two link labels with the same name are found in the
  143. filtergraph, a link between the corresponding input and output pad is
  144. created.
  145. If an output pad is not labelled, it is linked by default to the first
  146. unlabelled input pad of the next filter in the filterchain.
  147. For example in the filterchain:
  148. @example
  149. nullsrc, split[L1], [L2]overlay, nullsink
  150. @end example
  151. the split filter instance has two output pads, and the overlay filter
  152. instance two input pads. The first output pad of split is labelled
  153. "L1", the first input pad of overlay is labelled "L2", and the second
  154. output pad of split is linked to the second input pad of overlay,
  155. which are both unlabelled.
  156. In a complete filterchain all the unlabelled filter input and output
  157. pads must be connected. A filtergraph is considered valid if all the
  158. filter input and output pads of all the filterchains are connected.
  159. Libavfilter will automatically insert scale filters where format
  160. conversion is required. It is possible to specify swscale flags
  161. for those automatically inserted scalers by prepending
  162. @code{sws_flags=@var{flags};}
  163. to the filtergraph description.
  164. Follows a BNF description for the filtergraph syntax:
  165. @example
  166. @var{NAME} ::= sequence of alphanumeric characters and '_'
  167. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  168. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  169. @var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
  170. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  171. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  172. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  173. @end example
  174. @section Notes on filtergraph escaping
  175. Some filter arguments require the use of special characters, typically
  176. @code{:} to separate key=value pairs in a named options list. In this
  177. case the user should perform a first level escaping when specifying
  178. the filter arguments. For example, consider the following literal
  179. string to be embedded in the @ref{drawtext} filter arguments:
  180. @example
  181. this is a 'string': may contain one, or more, special characters
  182. @end example
  183. Since @code{:} is special for the filter arguments syntax, it needs to
  184. be escaped, so you get:
  185. @example
  186. text=this is a \'string\'\: may contain one, or more, special characters
  187. @end example
  188. A second level of escaping is required when embedding the filter
  189. arguments in a filtergraph description, in order to escape all the
  190. filtergraph special characters. Thus the example above becomes:
  191. @example
  192. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  193. @end example
  194. Finally an additional level of escaping may be needed when writing the
  195. filtergraph description in a shell command, which depends on the
  196. escaping rules of the adopted shell. For example, assuming that
  197. @code{\} is special and needs to be escaped with another @code{\}, the
  198. previous string will finally result in:
  199. @example
  200. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  201. @end example
  202. Sometimes, it might be more convenient to employ quoting in place of
  203. escaping. For example the string:
  204. @example
  205. Caesar: tu quoque, Brute, fili mi
  206. @end example
  207. Can be quoted in the filter arguments as:
  208. @example
  209. text='Caesar: tu quoque, Brute, fili mi'
  210. @end example
  211. And finally inserted in a filtergraph like:
  212. @example
  213. drawtext=text=\'Caesar: tu quoque\, Brute\, fili mi\'
  214. @end example
  215. See the ``Quoting and escaping'' section in the ffmpeg-utils manual
  216. for more information about the escaping and quoting rules adopted by
  217. FFmpeg.
  218. @chapter Timeline editing
  219. Some filters support a generic @option{enable} option. For the filters
  220. supporting timeline editing, this option can be set to an expression which is
  221. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  222. the filter will be enabled, otherwise the frame will be sent unchanged to the
  223. next filter in the filtergraph.
  224. The expression accepts the following values:
  225. @table @samp
  226. @item t
  227. timestamp expressed in seconds, NAN if the input timestamp is unknown
  228. @item n
  229. sequential number of the input frame, starting from 0
  230. @item pos
  231. the position in the file of the input frame, NAN if unknown
  232. @end table
  233. Additionally, these filters support an @option{enable} command that can be used
  234. to re-define the expression.
  235. Like any other filtering option, the @option{enable} option follows the same
  236. rules.
  237. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  238. minutes, and a @ref{curves} filter starting at 3 seconds:
  239. @example
  240. smartblur = enable='between(t,10,3*60)',
  241. curves = enable='gte(t,3)' : preset=cross_process
  242. @end example
  243. @c man end FILTERGRAPH DESCRIPTION
  244. @chapter Audio Filters
  245. @c man begin AUDIO FILTERS
  246. When you configure your FFmpeg build, you can disable any of the
  247. existing filters using @code{--disable-filters}.
  248. The configure output will show the audio filters included in your
  249. build.
  250. Below is a description of the currently available audio filters.
  251. @section aconvert
  252. Convert the input audio format to the specified formats.
  253. @emph{This filter is deprecated. Use @ref{aformat} instead.}
  254. The filter accepts a string of the form:
  255. "@var{sample_format}:@var{channel_layout}".
  256. @var{sample_format} specifies the sample format, and can be a string or the
  257. corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p'
  258. suffix for a planar sample format.
  259. @var{channel_layout} specifies the channel layout, and can be a string
  260. or the corresponding number value defined in @file{libavutil/channel_layout.h}.
  261. The special parameter "auto", signifies that the filter will
  262. automatically select the output format depending on the output filter.
  263. @subsection Examples
  264. @itemize
  265. @item
  266. Convert input to float, planar, stereo:
  267. @example
  268. aconvert=fltp:stereo
  269. @end example
  270. @item
  271. Convert input to unsigned 8-bit, automatically select out channel layout:
  272. @example
  273. aconvert=u8:auto
  274. @end example
  275. @end itemize
  276. @section aecho
  277. Apply echoing to the input audio.
  278. Echoes are reflected sound and can occur naturally amongst mountains
  279. (and sometimes large buildings) when talking or shouting; digital echo
  280. effects emulate this behaviour and are often used to help fill out the
  281. sound of a single instrument or vocal. The time difference between the
  282. original signal and the reflection is the @code{delay}, and the
  283. loudness of the reflected signal is the @code{decay}.
  284. Multiple echoes can have different delays and decays.
  285. A description of the accepted parameters follows.
  286. @table @option
  287. @item in_gain
  288. Set input gain of reflected signal. Default is @code{0.6}.
  289. @item out_gain
  290. Set output gain of reflected signal. Default is @code{0.3}.
  291. @item delays
  292. Set list of time intervals in milliseconds between original signal and reflections
  293. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  294. Default is @code{1000}.
  295. @item decays
  296. Set list of loudnesses of reflected signals separated by '|'.
  297. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  298. Default is @code{0.5}.
  299. @end table
  300. @subsection Examples
  301. @itemize
  302. @item
  303. Make it sound as if there are twice as many instruments as are actually playing:
  304. @example
  305. aecho=0.8:0.88:60:0.4
  306. @end example
  307. @item
  308. If delay is very short, then it sound like a (metallic) robot playing music:
  309. @example
  310. aecho=0.8:0.88:6:0.4
  311. @end example
  312. @item
  313. A longer delay will sound like an open air concert in the mountains:
  314. @example
  315. aecho=0.8:0.9:1000:0.3
  316. @end example
  317. @item
  318. Same as above but with one more mountain:
  319. @example
  320. aecho=0.8:0.9:1000|1800:0.3|0.25
  321. @end example
  322. @end itemize
  323. @section afade
  324. Apply fade-in/out effect to input audio.
  325. A description of the accepted parameters follows.
  326. @table @option
  327. @item type, t
  328. Specify the effect type, can be either @code{in} for fade-in, or
  329. @code{out} for a fade-out effect. Default is @code{in}.
  330. @item start_sample, ss
  331. Specify the number of the start sample for starting to apply the fade
  332. effect. Default is 0.
  333. @item nb_samples, ns
  334. Specify the number of samples for which the fade effect has to last. At
  335. the end of the fade-in effect the output audio will have the same
  336. volume as the input audio, at the end of the fade-out transition
  337. the output audio will be silence. Default is 44100.
  338. @item start_time, st
  339. Specify time for starting to apply the fade effect. Default is 0.
  340. The accepted syntax is:
  341. @example
  342. [-]HH[:MM[:SS[.m...]]]
  343. [-]S+[.m...]
  344. @end example
  345. See also the function @code{av_parse_time()}.
  346. If set this option is used instead of @var{start_sample} one.
  347. @item duration, d
  348. Specify the duration for which the fade effect has to last. Default is 0.
  349. The accepted syntax is:
  350. @example
  351. [-]HH[:MM[:SS[.m...]]]
  352. [-]S+[.m...]
  353. @end example
  354. See also the function @code{av_parse_time()}.
  355. At the end of the fade-in effect the output audio will have the same
  356. volume as the input audio, at the end of the fade-out transition
  357. the output audio will be silence.
  358. If set this option is used instead of @var{nb_samples} one.
  359. @item curve
  360. Set curve for fade transition.
  361. It accepts the following values:
  362. @table @option
  363. @item tri
  364. select triangular, linear slope (default)
  365. @item qsin
  366. select quarter of sine wave
  367. @item hsin
  368. select half of sine wave
  369. @item esin
  370. select exponential sine wave
  371. @item log
  372. select logarithmic
  373. @item par
  374. select inverted parabola
  375. @item qua
  376. select quadratic
  377. @item cub
  378. select cubic
  379. @item squ
  380. select square root
  381. @item cbr
  382. select cubic root
  383. @end table
  384. @end table
  385. @subsection Examples
  386. @itemize
  387. @item
  388. Fade in first 15 seconds of audio:
  389. @example
  390. afade=t=in:ss=0:d=15
  391. @end example
  392. @item
  393. Fade out last 25 seconds of a 900 seconds audio:
  394. @example
  395. afade=t=out:st=875:d=25
  396. @end example
  397. @end itemize
  398. @anchor{aformat}
  399. @section aformat
  400. Set output format constraints for the input audio. The framework will
  401. negotiate the most appropriate format to minimize conversions.
  402. The filter accepts the following named parameters:
  403. @table @option
  404. @item sample_fmts
  405. A '|'-separated list of requested sample formats.
  406. @item sample_rates
  407. A '|'-separated list of requested sample rates.
  408. @item channel_layouts
  409. A '|'-separated list of requested channel layouts.
  410. @end table
  411. If a parameter is omitted, all values are allowed.
  412. For example to force the output to either unsigned 8-bit or signed 16-bit stereo:
  413. @example
  414. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  415. @end example
  416. @section allpass
  417. Apply a two-pole all-pass filter with central frequency (in Hz)
  418. @var{frequency}, and filter-width @var{width}.
  419. An all-pass filter changes the audio's frequency to phase relationship
  420. without changing its frequency to amplitude relationship.
  421. The filter accepts the following options:
  422. @table @option
  423. @item frequency, f
  424. Set frequency in Hz.
  425. @item width_type
  426. Set method to specify band-width of filter.
  427. @table @option
  428. @item h
  429. Hz
  430. @item q
  431. Q-Factor
  432. @item o
  433. octave
  434. @item s
  435. slope
  436. @end table
  437. @item width, w
  438. Specify the band-width of a filter in width_type units.
  439. @end table
  440. @section amerge
  441. Merge two or more audio streams into a single multi-channel stream.
  442. The filter accepts the following options:
  443. @table @option
  444. @item inputs
  445. Set the number of inputs. Default is 2.
  446. @end table
  447. If the channel layouts of the inputs are disjoint, and therefore compatible,
  448. the channel layout of the output will be set accordingly and the channels
  449. will be reordered as necessary. If the channel layouts of the inputs are not
  450. disjoint, the output will have all the channels of the first input then all
  451. the channels of the second input, in that order, and the channel layout of
  452. the output will be the default value corresponding to the total number of
  453. channels.
  454. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  455. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  456. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  457. first input, b1 is the first channel of the second input).
  458. On the other hand, if both input are in stereo, the output channels will be
  459. in the default order: a1, a2, b1, b2, and the channel layout will be
  460. arbitrarily set to 4.0, which may or may not be the expected value.
  461. All inputs must have the same sample rate, and format.
  462. If inputs do not have the same duration, the output will stop with the
  463. shortest.
  464. @subsection Examples
  465. @itemize
  466. @item
  467. Merge two mono files into a stereo stream:
  468. @example
  469. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  470. @end example
  471. @item
  472. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  473. @example
  474. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  475. @end example
  476. @end itemize
  477. @section amix
  478. Mixes multiple audio inputs into a single output.
  479. For example
  480. @example
  481. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  482. @end example
  483. will mix 3 input audio streams to a single output with the same duration as the
  484. first input and a dropout transition time of 3 seconds.
  485. The filter accepts the following named parameters:
  486. @table @option
  487. @item inputs
  488. Number of inputs. If unspecified, it defaults to 2.
  489. @item duration
  490. How to determine the end-of-stream.
  491. @table @option
  492. @item longest
  493. Duration of longest input. (default)
  494. @item shortest
  495. Duration of shortest input.
  496. @item first
  497. Duration of first input.
  498. @end table
  499. @item dropout_transition
  500. Transition time, in seconds, for volume renormalization when an input
  501. stream ends. The default value is 2 seconds.
  502. @end table
  503. @section anull
  504. Pass the audio source unchanged to the output.
  505. @section apad
  506. Pad the end of a audio stream with silence, this can be used together with
  507. -shortest to extend audio streams to the same length as the video stream.
  508. @section aphaser
  509. Add a phasing effect to the input audio.
  510. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  511. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  512. A description of the accepted parameters follows.
  513. @table @option
  514. @item in_gain
  515. Set input gain. Default is 0.4.
  516. @item out_gain
  517. Set output gain. Default is 0.74
  518. @item delay
  519. Set delay in milliseconds. Default is 3.0.
  520. @item decay
  521. Set decay. Default is 0.4.
  522. @item speed
  523. Set modulation speed in Hz. Default is 0.5.
  524. @item type
  525. Set modulation type. Default is triangular.
  526. It accepts the following values:
  527. @table @samp
  528. @item triangular, t
  529. @item sinusoidal, s
  530. @end table
  531. @end table
  532. @anchor{aresample}
  533. @section aresample
  534. Resample the input audio to the specified parameters, using the
  535. libswresample library. If none are specified then the filter will
  536. automatically convert between its input and output.
  537. This filter is also able to stretch/squeeze the audio data to make it match
  538. the timestamps or to inject silence / cut out audio to make it match the
  539. timestamps, do a combination of both or do neither.
  540. The filter accepts the syntax
  541. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  542. expresses a sample rate and @var{resampler_options} is a list of
  543. @var{key}=@var{value} pairs, separated by ":". See the
  544. ffmpeg-resampler manual for the complete list of supported options.
  545. @subsection Examples
  546. @itemize
  547. @item
  548. Resample the input audio to 44100Hz:
  549. @example
  550. aresample=44100
  551. @end example
  552. @item
  553. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  554. samples per second compensation:
  555. @example
  556. aresample=async=1000
  557. @end example
  558. @end itemize
  559. @section asetnsamples
  560. Set the number of samples per each output audio frame.
  561. The last output packet may contain a different number of samples, as
  562. the filter will flush all the remaining samples when the input audio
  563. signal its end.
  564. The filter accepts the following options:
  565. @table @option
  566. @item nb_out_samples, n
  567. Set the number of frames per each output audio frame. The number is
  568. intended as the number of samples @emph{per each channel}.
  569. Default value is 1024.
  570. @item pad, p
  571. If set to 1, the filter will pad the last audio frame with zeroes, so
  572. that the last frame will contain the same number of samples as the
  573. previous ones. Default value is 1.
  574. @end table
  575. For example, to set the number of per-frame samples to 1234 and
  576. disable padding for the last frame, use:
  577. @example
  578. asetnsamples=n=1234:p=0
  579. @end example
  580. @section asetrate
  581. Set the sample rate without altering the PCM data.
  582. This will result in a change of speed and pitch.
  583. The filter accepts the following options:
  584. @table @option
  585. @item sample_rate, r
  586. Set the output sample rate. Default is 44100 Hz.
  587. @end table
  588. @section ashowinfo
  589. Show a line containing various information for each input audio frame.
  590. The input audio is not modified.
  591. The shown line contains a sequence of key/value pairs of the form
  592. @var{key}:@var{value}.
  593. A description of each shown parameter follows:
  594. @table @option
  595. @item n
  596. sequential number of the input frame, starting from 0
  597. @item pts
  598. Presentation timestamp of the input frame, in time base units; the time base
  599. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  600. @item pts_time
  601. presentation timestamp of the input frame in seconds
  602. @item pos
  603. position of the frame in the input stream, -1 if this information in
  604. unavailable and/or meaningless (for example in case of synthetic audio)
  605. @item fmt
  606. sample format
  607. @item chlayout
  608. channel layout
  609. @item rate
  610. sample rate for the audio frame
  611. @item nb_samples
  612. number of samples (per channel) in the frame
  613. @item checksum
  614. Adler-32 checksum (printed in hexadecimal) of the audio data. For planar audio
  615. the data is treated as if all the planes were concatenated.
  616. @item plane_checksums
  617. A list of Adler-32 checksums for each data plane.
  618. @end table
  619. @section astats
  620. Display time domain statistical information about the audio channels.
  621. Statistics are calculated and displayed for each audio channel and,
  622. where applicable, an overall figure is also given.
  623. The filter accepts the following option:
  624. @table @option
  625. @item length
  626. Short window length in seconds, used for peak and trough RMS measurement.
  627. Default is @code{0.05} (50 miliseconds). Allowed range is @code{[0.1 - 10]}.
  628. @end table
  629. A description of each shown parameter follows:
  630. @table @option
  631. @item DC offset
  632. Mean amplitude displacement from zero.
  633. @item Min level
  634. Minimal sample level.
  635. @item Max level
  636. Maximal sample level.
  637. @item Peak level dB
  638. @item RMS level dB
  639. Standard peak and RMS level measured in dBFS.
  640. @item RMS peak dB
  641. @item RMS trough dB
  642. Peak and trough values for RMS level measured over a short window.
  643. @item Crest factor
  644. Standard ratio of peak to RMS level (note: not in dB).
  645. @item Flat factor
  646. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  647. (i.e. either @var{Min level} or @var{Max level}).
  648. @item Peak count
  649. Number of occasions (not the number of samples) that the signal attained either
  650. @var{Min level} or @var{Max level}.
  651. @end table
  652. @section astreamsync
  653. Forward two audio streams and control the order the buffers are forwarded.
  654. The filter accepts the following options:
  655. @table @option
  656. @item expr, e
  657. Set the expression deciding which stream should be
  658. forwarded next: if the result is negative, the first stream is forwarded; if
  659. the result is positive or zero, the second stream is forwarded. It can use
  660. the following variables:
  661. @table @var
  662. @item b1 b2
  663. number of buffers forwarded so far on each stream
  664. @item s1 s2
  665. number of samples forwarded so far on each stream
  666. @item t1 t2
  667. current timestamp of each stream
  668. @end table
  669. The default value is @code{t1-t2}, which means to always forward the stream
  670. that has a smaller timestamp.
  671. @end table
  672. @subsection Examples
  673. Stress-test @code{amerge} by randomly sending buffers on the wrong
  674. input, while avoiding too much of a desynchronization:
  675. @example
  676. amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
  677. [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
  678. [a2] [b2] amerge
  679. @end example
  680. @section asyncts
  681. Synchronize audio data with timestamps by squeezing/stretching it and/or
  682. dropping samples/adding silence when needed.
  683. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  684. The filter accepts the following named parameters:
  685. @table @option
  686. @item compensate
  687. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  688. by default. When disabled, time gaps are covered with silence.
  689. @item min_delta
  690. Minimum difference between timestamps and audio data (in seconds) to trigger
  691. adding/dropping samples. Default value is 0.1. If you get non-perfect sync with
  692. this filter, try setting this parameter to 0.
  693. @item max_comp
  694. Maximum compensation in samples per second. Relevant only with compensate=1.
  695. Default value 500.
  696. @item first_pts
  697. Assume the first pts should be this value. The time base is 1 / sample rate.
  698. This allows for padding/trimming at the start of stream. By default, no
  699. assumption is made about the first frame's expected pts, so no padding or
  700. trimming is done. For example, this could be set to 0 to pad the beginning with
  701. silence if an audio stream starts after the video stream or to trim any samples
  702. with a negative pts due to encoder delay.
  703. @end table
  704. @section atempo
  705. Adjust audio tempo.
  706. The filter accepts exactly one parameter, the audio tempo. If not
  707. specified then the filter will assume nominal 1.0 tempo. Tempo must
  708. be in the [0.5, 2.0] range.
  709. @subsection Examples
  710. @itemize
  711. @item
  712. Slow down audio to 80% tempo:
  713. @example
  714. atempo=0.8
  715. @end example
  716. @item
  717. To speed up audio to 125% tempo:
  718. @example
  719. atempo=1.25
  720. @end example
  721. @end itemize
  722. @section atrim
  723. Trim the input so that the output contains one continuous subpart of the input.
  724. This filter accepts the following options:
  725. @table @option
  726. @item start
  727. Specify time of the start of the kept section, i.e. the audio sample
  728. with the timestamp @var{start} will be the first sample in the output.
  729. @item end
  730. Specify time of the first audio sample that will be dropped, i.e. the
  731. audio sample immediately preceding the one with the timestamp @var{end} will be
  732. the last sample in the output.
  733. @item start_pts
  734. Same as @var{start}, except this option sets the start timestamp in samples
  735. instead of seconds.
  736. @item end_pts
  737. Same as @var{end}, except this option sets the end timestamp in samples instead
  738. of seconds.
  739. @item duration
  740. Specify maximum duration of the output.
  741. @item start_sample
  742. Number of the first sample that should be passed to output.
  743. @item end_sample
  744. Number of the first sample that should be dropped.
  745. @end table
  746. @option{start}, @option{end}, @option{duration} are expressed as time
  747. duration specifications, check the "Time duration" section in the
  748. ffmpeg-utils manual.
  749. Note that the first two sets of the start/end options and the @option{duration}
  750. option look at the frame timestamp, while the _sample options simply count the
  751. samples that pass through the filter. So start/end_pts and start/end_sample will
  752. give different results when the timestamps are wrong, inexact or do not start at
  753. zero. Also note that this filter does not modify the timestamps. If you wish
  754. that the output timestamps start at zero, insert the asetpts filter after the
  755. atrim filter.
  756. If multiple start or end options are set, this filter tries to be greedy and
  757. keep all samples that match at least one of the specified constraints. To keep
  758. only the part that matches all the constraints at once, chain multiple atrim
  759. filters.
  760. The defaults are such that all the input is kept. So it is possible to set e.g.
  761. just the end values to keep everything before the specified time.
  762. Examples:
  763. @itemize
  764. @item
  765. drop everything except the second minute of input
  766. @example
  767. ffmpeg -i INPUT -af atrim=60:120
  768. @end example
  769. @item
  770. keep only the first 1000 samples
  771. @example
  772. ffmpeg -i INPUT -af atrim=end_sample=1000
  773. @end example
  774. @end itemize
  775. @section bandpass
  776. Apply a two-pole Butterworth band-pass filter with central
  777. frequency @var{frequency}, and (3dB-point) band-width width.
  778. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  779. instead of the default: constant 0dB peak gain.
  780. The filter roll off at 6dB per octave (20dB per decade).
  781. The filter accepts the following options:
  782. @table @option
  783. @item frequency, f
  784. Set the filter's central frequency. Default is @code{3000}.
  785. @item csg
  786. Constant skirt gain if set to 1. Defaults to 0.
  787. @item width_type
  788. Set method to specify band-width of filter.
  789. @table @option
  790. @item h
  791. Hz
  792. @item q
  793. Q-Factor
  794. @item o
  795. octave
  796. @item s
  797. slope
  798. @end table
  799. @item width, w
  800. Specify the band-width of a filter in width_type units.
  801. @end table
  802. @section bandreject
  803. Apply a two-pole Butterworth band-reject filter with central
  804. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  805. The filter roll off at 6dB per octave (20dB per decade).
  806. The filter accepts the following options:
  807. @table @option
  808. @item frequency, f
  809. Set the filter's central frequency. Default is @code{3000}.
  810. @item width_type
  811. Set method to specify band-width of filter.
  812. @table @option
  813. @item h
  814. Hz
  815. @item q
  816. Q-Factor
  817. @item o
  818. octave
  819. @item s
  820. slope
  821. @end table
  822. @item width, w
  823. Specify the band-width of a filter in width_type units.
  824. @end table
  825. @section bass
  826. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  827. shelving filter with a response similar to that of a standard
  828. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  829. The filter accepts the following options:
  830. @table @option
  831. @item gain, g
  832. Give the gain at 0 Hz. Its useful range is about -20
  833. (for a large cut) to +20 (for a large boost).
  834. Beware of clipping when using a positive gain.
  835. @item frequency, f
  836. Set the filter's central frequency and so can be used
  837. to extend or reduce the frequency range to be boosted or cut.
  838. The default value is @code{100} Hz.
  839. @item width_type
  840. Set method to specify band-width of filter.
  841. @table @option
  842. @item h
  843. Hz
  844. @item q
  845. Q-Factor
  846. @item o
  847. octave
  848. @item s
  849. slope
  850. @end table
  851. @item width, w
  852. Determine how steep is the filter's shelf transition.
  853. @end table
  854. @section biquad
  855. Apply a biquad IIR filter with the given coefficients.
  856. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  857. are the numerator and denominator coefficients respectively.
  858. @section channelmap
  859. Remap input channels to new locations.
  860. This filter accepts the following named parameters:
  861. @table @option
  862. @item channel_layout
  863. Channel layout of the output stream.
  864. @item map
  865. Map channels from input to output. The argument is a '|'-separated list of
  866. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  867. @var{in_channel} form. @var{in_channel} can be either the name of the input
  868. channel (e.g. FL for front left) or its index in the input channel layout.
  869. @var{out_channel} is the name of the output channel or its index in the output
  870. channel layout. If @var{out_channel} is not given then it is implicitly an
  871. index, starting with zero and increasing by one for each mapping.
  872. @end table
  873. If no mapping is present, the filter will implicitly map input channels to
  874. output channels preserving index.
  875. For example, assuming a 5.1+downmix input MOV file
  876. @example
  877. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  878. @end example
  879. will create an output WAV file tagged as stereo from the downmix channels of
  880. the input.
  881. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  882. @example
  883. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:channel_layout=5.1' out.wav
  884. @end example
  885. @section channelsplit
  886. Split each channel in input audio stream into a separate output stream.
  887. This filter accepts the following named parameters:
  888. @table @option
  889. @item channel_layout
  890. Channel layout of the input stream. Default is "stereo".
  891. @end table
  892. For example, assuming a stereo input MP3 file
  893. @example
  894. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  895. @end example
  896. will create an output Matroska file with two audio streams, one containing only
  897. the left channel and the other the right channel.
  898. To split a 5.1 WAV file into per-channel files
  899. @example
  900. ffmpeg -i in.wav -filter_complex
  901. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  902. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  903. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  904. side_right.wav
  905. @end example
  906. @section earwax
  907. Make audio easier to listen to on headphones.
  908. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  909. so that when listened to on headphones the stereo image is moved from
  910. inside your head (standard for headphones) to outside and in front of
  911. the listener (standard for speakers).
  912. Ported from SoX.
  913. @section equalizer
  914. Apply a two-pole peaking equalisation (EQ) filter. With this
  915. filter, the signal-level at and around a selected frequency can
  916. be increased or decreased, whilst (unlike bandpass and bandreject
  917. filters) that at all other frequencies is unchanged.
  918. In order to produce complex equalisation curves, this filter can
  919. be given several times, each with a different central frequency.
  920. The filter accepts the following options:
  921. @table @option
  922. @item frequency, f
  923. Set the filter's central frequency in Hz.
  924. @item width_type
  925. Set method to specify band-width of filter.
  926. @table @option
  927. @item h
  928. Hz
  929. @item q
  930. Q-Factor
  931. @item o
  932. octave
  933. @item s
  934. slope
  935. @end table
  936. @item width, w
  937. Specify the band-width of a filter in width_type units.
  938. @item gain, g
  939. Set the required gain or attenuation in dB.
  940. Beware of clipping when using a positive gain.
  941. @end table
  942. @section highpass
  943. Apply a high-pass filter with 3dB point frequency.
  944. The filter can be either single-pole, or double-pole (the default).
  945. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  946. The filter accepts the following options:
  947. @table @option
  948. @item frequency, f
  949. Set frequency in Hz. Default is 3000.
  950. @item poles, p
  951. Set number of poles. Default is 2.
  952. @item width_type
  953. Set method to specify band-width of filter.
  954. @table @option
  955. @item h
  956. Hz
  957. @item q
  958. Q-Factor
  959. @item o
  960. octave
  961. @item s
  962. slope
  963. @end table
  964. @item width, w
  965. Specify the band-width of a filter in width_type units.
  966. Applies only to double-pole filter.
  967. The default is 0.707q and gives a Butterworth response.
  968. @end table
  969. @section join
  970. Join multiple input streams into one multi-channel stream.
  971. The filter accepts the following named parameters:
  972. @table @option
  973. @item inputs
  974. Number of input streams. Defaults to 2.
  975. @item channel_layout
  976. Desired output channel layout. Defaults to stereo.
  977. @item map
  978. Map channels from inputs to output. The argument is a '|'-separated list of
  979. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  980. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  981. can be either the name of the input channel (e.g. FL for front left) or its
  982. index in the specified input stream. @var{out_channel} is the name of the output
  983. channel.
  984. @end table
  985. The filter will attempt to guess the mappings when those are not specified
  986. explicitly. It does so by first trying to find an unused matching input channel
  987. and if that fails it picks the first unused input channel.
  988. E.g. to join 3 inputs (with properly set channel layouts)
  989. @example
  990. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  991. @end example
  992. To build a 5.1 output from 6 single-channel streams:
  993. @example
  994. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  995. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  996. out
  997. @end example
  998. @section lowpass
  999. Apply a low-pass filter with 3dB point frequency.
  1000. The filter can be either single-pole or double-pole (the default).
  1001. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1002. The filter accepts the following options:
  1003. @table @option
  1004. @item frequency, f
  1005. Set frequency in Hz. Default is 500.
  1006. @item poles, p
  1007. Set number of poles. Default is 2.
  1008. @item width_type
  1009. Set method to specify band-width of filter.
  1010. @table @option
  1011. @item h
  1012. Hz
  1013. @item q
  1014. Q-Factor
  1015. @item o
  1016. octave
  1017. @item s
  1018. slope
  1019. @end table
  1020. @item width, w
  1021. Specify the band-width of a filter in width_type units.
  1022. Applies only to double-pole filter.
  1023. The default is 0.707q and gives a Butterworth response.
  1024. @end table
  1025. @section pan
  1026. Mix channels with specific gain levels. The filter accepts the output
  1027. channel layout followed by a set of channels definitions.
  1028. This filter is also designed to remap efficiently the channels of an audio
  1029. stream.
  1030. The filter accepts parameters of the form:
  1031. "@var{l}:@var{outdef}:@var{outdef}:..."
  1032. @table @option
  1033. @item l
  1034. output channel layout or number of channels
  1035. @item outdef
  1036. output channel specification, of the form:
  1037. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1038. @item out_name
  1039. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1040. number (c0, c1, etc.)
  1041. @item gain
  1042. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1043. @item in_name
  1044. input channel to use, see out_name for details; it is not possible to mix
  1045. named and numbered input channels
  1046. @end table
  1047. If the `=' in a channel specification is replaced by `<', then the gains for
  1048. that specification will be renormalized so that the total is 1, thus
  1049. avoiding clipping noise.
  1050. @subsection Mixing examples
  1051. For example, if you want to down-mix from stereo to mono, but with a bigger
  1052. factor for the left channel:
  1053. @example
  1054. pan=1:c0=0.9*c0+0.1*c1
  1055. @end example
  1056. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1057. 7-channels surround:
  1058. @example
  1059. pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1060. @end example
  1061. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1062. that should be preferred (see "-ac" option) unless you have very specific
  1063. needs.
  1064. @subsection Remapping examples
  1065. The channel remapping will be effective if, and only if:
  1066. @itemize
  1067. @item gain coefficients are zeroes or ones,
  1068. @item only one input per channel output,
  1069. @end itemize
  1070. If all these conditions are satisfied, the filter will notify the user ("Pure
  1071. channel mapping detected"), and use an optimized and lossless method to do the
  1072. remapping.
  1073. For example, if you have a 5.1 source and want a stereo audio stream by
  1074. dropping the extra channels:
  1075. @example
  1076. pan="stereo: c0=FL : c1=FR"
  1077. @end example
  1078. Given the same source, you can also switch front left and front right channels
  1079. and keep the input channel layout:
  1080. @example
  1081. pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
  1082. @end example
  1083. If the input is a stereo audio stream, you can mute the front left channel (and
  1084. still keep the stereo channel layout) with:
  1085. @example
  1086. pan="stereo:c1=c1"
  1087. @end example
  1088. Still with a stereo audio stream input, you can copy the right channel in both
  1089. front left and right:
  1090. @example
  1091. pan="stereo: c0=FR : c1=FR"
  1092. @end example
  1093. @section resample
  1094. Convert the audio sample format, sample rate and channel layout. This filter is
  1095. not meant to be used directly.
  1096. @section silencedetect
  1097. Detect silence in an audio stream.
  1098. This filter logs a message when it detects that the input audio volume is less
  1099. or equal to a noise tolerance value for a duration greater or equal to the
  1100. minimum detected noise duration.
  1101. The printed times and duration are expressed in seconds.
  1102. The filter accepts the following options:
  1103. @table @option
  1104. @item duration, d
  1105. Set silence duration until notification (default is 2 seconds).
  1106. @item noise, n
  1107. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  1108. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  1109. @end table
  1110. @subsection Examples
  1111. @itemize
  1112. @item
  1113. Detect 5 seconds of silence with -50dB noise tolerance:
  1114. @example
  1115. silencedetect=n=-50dB:d=5
  1116. @end example
  1117. @item
  1118. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  1119. tolerance in @file{silence.mp3}:
  1120. @example
  1121. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  1122. @end example
  1123. @end itemize
  1124. @section treble
  1125. Boost or cut treble (upper) frequencies of the audio using a two-pole
  1126. shelving filter with a response similar to that of a standard
  1127. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1128. The filter accepts the following options:
  1129. @table @option
  1130. @item gain, g
  1131. Give the gain at whichever is the lower of ~22 kHz and the
  1132. Nyquist frequency. Its useful range is about -20 (for a large cut)
  1133. to +20 (for a large boost). Beware of clipping when using a positive gain.
  1134. @item frequency, f
  1135. Set the filter's central frequency and so can be used
  1136. to extend or reduce the frequency range to be boosted or cut.
  1137. The default value is @code{3000} Hz.
  1138. @item width_type
  1139. Set method to specify band-width of filter.
  1140. @table @option
  1141. @item h
  1142. Hz
  1143. @item q
  1144. Q-Factor
  1145. @item o
  1146. octave
  1147. @item s
  1148. slope
  1149. @end table
  1150. @item width, w
  1151. Determine how steep is the filter's shelf transition.
  1152. @end table
  1153. @section volume
  1154. Adjust the input audio volume.
  1155. The filter accepts the following options:
  1156. @table @option
  1157. @item volume
  1158. Expresses how the audio volume will be increased or decreased.
  1159. Output values are clipped to the maximum value.
  1160. The output audio volume is given by the relation:
  1161. @example
  1162. @var{output_volume} = @var{volume} * @var{input_volume}
  1163. @end example
  1164. Default value for @var{volume} is 1.0.
  1165. @item precision
  1166. Set the mathematical precision.
  1167. This determines which input sample formats will be allowed, which affects the
  1168. precision of the volume scaling.
  1169. @table @option
  1170. @item fixed
  1171. 8-bit fixed-point; limits input sample format to U8, S16, and S32.
  1172. @item float
  1173. 32-bit floating-point; limits input sample format to FLT. (default)
  1174. @item double
  1175. 64-bit floating-point; limits input sample format to DBL.
  1176. @end table
  1177. @end table
  1178. @subsection Examples
  1179. @itemize
  1180. @item
  1181. Halve the input audio volume:
  1182. @example
  1183. volume=volume=0.5
  1184. volume=volume=1/2
  1185. volume=volume=-6.0206dB
  1186. @end example
  1187. In all the above example the named key for @option{volume} can be
  1188. omitted, for example like in:
  1189. @example
  1190. volume=0.5
  1191. @end example
  1192. @item
  1193. Increase input audio power by 6 decibels using fixed-point precision:
  1194. @example
  1195. volume=volume=6dB:precision=fixed
  1196. @end example
  1197. @end itemize
  1198. @section volumedetect
  1199. Detect the volume of the input video.
  1200. The filter has no parameters. The input is not modified. Statistics about
  1201. the volume will be printed in the log when the input stream end is reached.
  1202. In particular it will show the mean volume (root mean square), maximum
  1203. volume (on a per-sample basis), and the beginning of an histogram of the
  1204. registered volume values (from the maximum value to a cumulated 1/1000 of
  1205. the samples).
  1206. All volumes are in decibels relative to the maximum PCM value.
  1207. @subsection Examples
  1208. Here is an excerpt of the output:
  1209. @example
  1210. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  1211. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  1212. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  1213. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  1214. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  1215. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  1216. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  1217. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  1218. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  1219. @end example
  1220. It means that:
  1221. @itemize
  1222. @item
  1223. The mean square energy is approximately -27 dB, or 10^-2.7.
  1224. @item
  1225. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  1226. @item
  1227. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  1228. @end itemize
  1229. In other words, raising the volume by +4 dB does not cause any clipping,
  1230. raising it by +5 dB causes clipping for 6 samples, etc.
  1231. @c man end AUDIO FILTERS
  1232. @chapter Audio Sources
  1233. @c man begin AUDIO SOURCES
  1234. Below is a description of the currently available audio sources.
  1235. @section abuffer
  1236. Buffer audio frames, and make them available to the filter chain.
  1237. This source is mainly intended for a programmatic use, in particular
  1238. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  1239. It accepts the following named parameters:
  1240. @table @option
  1241. @item time_base
  1242. Timebase which will be used for timestamps of submitted frames. It must be
  1243. either a floating-point number or in @var{numerator}/@var{denominator} form.
  1244. @item sample_rate
  1245. The sample rate of the incoming audio buffers.
  1246. @item sample_fmt
  1247. The sample format of the incoming audio buffers.
  1248. Either a sample format name or its corresponging integer representation from
  1249. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  1250. @item channel_layout
  1251. The channel layout of the incoming audio buffers.
  1252. Either a channel layout name from channel_layout_map in
  1253. @file{libavutil/channel_layout.c} or its corresponding integer representation
  1254. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  1255. @item channels
  1256. The number of channels of the incoming audio buffers.
  1257. If both @var{channels} and @var{channel_layout} are specified, then they
  1258. must be consistent.
  1259. @end table
  1260. @subsection Examples
  1261. @example
  1262. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  1263. @end example
  1264. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  1265. Since the sample format with name "s16p" corresponds to the number
  1266. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  1267. equivalent to:
  1268. @example
  1269. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  1270. @end example
  1271. @section aevalsrc
  1272. Generate an audio signal specified by an expression.
  1273. This source accepts in input one or more expressions (one for each
  1274. channel), which are evaluated and used to generate a corresponding
  1275. audio signal.
  1276. This source accepts the following options:
  1277. @table @option
  1278. @item exprs
  1279. Set the '|'-separated expressions list for each separate channel. In case the
  1280. @option{channel_layout} option is not specified, the selected channel layout
  1281. depends on the number of provided expressions.
  1282. @item channel_layout, c
  1283. Set the channel layout. The number of channels in the specified layout
  1284. must be equal to the number of specified expressions.
  1285. @item duration, d
  1286. Set the minimum duration of the sourced audio. See the function
  1287. @code{av_parse_time()} for the accepted format.
  1288. Note that the resulting duration may be greater than the specified
  1289. duration, as the generated audio is always cut at the end of a
  1290. complete frame.
  1291. If not specified, or the expressed duration is negative, the audio is
  1292. supposed to be generated forever.
  1293. @item nb_samples, n
  1294. Set the number of samples per channel per each output frame,
  1295. default to 1024.
  1296. @item sample_rate, s
  1297. Specify the sample rate, default to 44100.
  1298. @end table
  1299. Each expression in @var{exprs} can contain the following constants:
  1300. @table @option
  1301. @item n
  1302. number of the evaluated sample, starting from 0
  1303. @item t
  1304. time of the evaluated sample expressed in seconds, starting from 0
  1305. @item s
  1306. sample rate
  1307. @end table
  1308. @subsection Examples
  1309. @itemize
  1310. @item
  1311. Generate silence:
  1312. @example
  1313. aevalsrc=0
  1314. @end example
  1315. @item
  1316. Generate a sin signal with frequency of 440 Hz, set sample rate to
  1317. 8000 Hz:
  1318. @example
  1319. aevalsrc="sin(440*2*PI*t):s=8000"
  1320. @end example
  1321. @item
  1322. Generate a two channels signal, specify the channel layout (Front
  1323. Center + Back Center) explicitly:
  1324. @example
  1325. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  1326. @end example
  1327. @item
  1328. Generate white noise:
  1329. @example
  1330. aevalsrc="-2+random(0)"
  1331. @end example
  1332. @item
  1333. Generate an amplitude modulated signal:
  1334. @example
  1335. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  1336. @end example
  1337. @item
  1338. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  1339. @example
  1340. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  1341. @end example
  1342. @end itemize
  1343. @section anullsrc
  1344. Null audio source, return unprocessed audio frames. It is mainly useful
  1345. as a template and to be employed in analysis / debugging tools, or as
  1346. the source for filters which ignore the input data (for example the sox
  1347. synth filter).
  1348. This source accepts the following options:
  1349. @table @option
  1350. @item channel_layout, cl
  1351. Specify the channel layout, and can be either an integer or a string
  1352. representing a channel layout. The default value of @var{channel_layout}
  1353. is "stereo".
  1354. Check the channel_layout_map definition in
  1355. @file{libavutil/channel_layout.c} for the mapping between strings and
  1356. channel layout values.
  1357. @item sample_rate, r
  1358. Specify the sample rate, and defaults to 44100.
  1359. @item nb_samples, n
  1360. Set the number of samples per requested frames.
  1361. @end table
  1362. @subsection Examples
  1363. @itemize
  1364. @item
  1365. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  1366. @example
  1367. anullsrc=r=48000:cl=4
  1368. @end example
  1369. @item
  1370. Do the same operation with a more obvious syntax:
  1371. @example
  1372. anullsrc=r=48000:cl=mono
  1373. @end example
  1374. @end itemize
  1375. All the parameters need to be explicitly defined.
  1376. @section flite
  1377. Synthesize a voice utterance using the libflite library.
  1378. To enable compilation of this filter you need to configure FFmpeg with
  1379. @code{--enable-libflite}.
  1380. Note that the flite library is not thread-safe.
  1381. The filter accepts the following options:
  1382. @table @option
  1383. @item list_voices
  1384. If set to 1, list the names of the available voices and exit
  1385. immediately. Default value is 0.
  1386. @item nb_samples, n
  1387. Set the maximum number of samples per frame. Default value is 512.
  1388. @item textfile
  1389. Set the filename containing the text to speak.
  1390. @item text
  1391. Set the text to speak.
  1392. @item voice, v
  1393. Set the voice to use for the speech synthesis. Default value is
  1394. @code{kal}. See also the @var{list_voices} option.
  1395. @end table
  1396. @subsection Examples
  1397. @itemize
  1398. @item
  1399. Read from file @file{speech.txt}, and synthetize the text using the
  1400. standard flite voice:
  1401. @example
  1402. flite=textfile=speech.txt
  1403. @end example
  1404. @item
  1405. Read the specified text selecting the @code{slt} voice:
  1406. @example
  1407. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1408. @end example
  1409. @item
  1410. Input text to ffmpeg:
  1411. @example
  1412. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1413. @end example
  1414. @item
  1415. Make @file{ffplay} speak the specified text, using @code{flite} and
  1416. the @code{lavfi} device:
  1417. @example
  1418. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  1419. @end example
  1420. @end itemize
  1421. For more information about libflite, check:
  1422. @url{http://www.speech.cs.cmu.edu/flite/}
  1423. @section sine
  1424. Generate an audio signal made of a sine wave with amplitude 1/8.
  1425. The audio signal is bit-exact.
  1426. The filter accepts the following options:
  1427. @table @option
  1428. @item frequency, f
  1429. Set the carrier frequency. Default is 440 Hz.
  1430. @item beep_factor, b
  1431. Enable a periodic beep every second with frequency @var{beep_factor} times
  1432. the carrier frequency. Default is 0, meaning the beep is disabled.
  1433. @item sample_rate, s
  1434. Specify the sample rate, default is 44100.
  1435. @item duration, d
  1436. Specify the duration of the generated audio stream.
  1437. @item samples_per_frame
  1438. Set the number of samples per output frame, default is 1024.
  1439. @end table
  1440. @subsection Examples
  1441. @itemize
  1442. @item
  1443. Generate a simple 440 Hz sine wave:
  1444. @example
  1445. sine
  1446. @end example
  1447. @item
  1448. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  1449. @example
  1450. sine=220:4:d=5
  1451. sine=f=220:b=4:d=5
  1452. sine=frequency=220:beep_factor=4:duration=5
  1453. @end example
  1454. @end itemize
  1455. @c man end AUDIO SOURCES
  1456. @chapter Audio Sinks
  1457. @c man begin AUDIO SINKS
  1458. Below is a description of the currently available audio sinks.
  1459. @section abuffersink
  1460. Buffer audio frames, and make them available to the end of filter chain.
  1461. This sink is mainly intended for programmatic use, in particular
  1462. through the interface defined in @file{libavfilter/buffersink.h}
  1463. or the options system.
  1464. It accepts a pointer to an AVABufferSinkContext structure, which
  1465. defines the incoming buffers' formats, to be passed as the opaque
  1466. parameter to @code{avfilter_init_filter} for initialization.
  1467. @section anullsink
  1468. Null audio sink, do absolutely nothing with the input audio. It is
  1469. mainly useful as a template and to be employed in analysis / debugging
  1470. tools.
  1471. @c man end AUDIO SINKS
  1472. @chapter Video Filters
  1473. @c man begin VIDEO FILTERS
  1474. When you configure your FFmpeg build, you can disable any of the
  1475. existing filters using @code{--disable-filters}.
  1476. The configure output will show the video filters included in your
  1477. build.
  1478. Below is a description of the currently available video filters.
  1479. @section alphaextract
  1480. Extract the alpha component from the input as a grayscale video. This
  1481. is especially useful with the @var{alphamerge} filter.
  1482. @section alphamerge
  1483. Add or replace the alpha component of the primary input with the
  1484. grayscale value of a second input. This is intended for use with
  1485. @var{alphaextract} to allow the transmission or storage of frame
  1486. sequences that have alpha in a format that doesn't support an alpha
  1487. channel.
  1488. For example, to reconstruct full frames from a normal YUV-encoded video
  1489. and a separate video created with @var{alphaextract}, you might use:
  1490. @example
  1491. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  1492. @end example
  1493. Since this filter is designed for reconstruction, it operates on frame
  1494. sequences without considering timestamps, and terminates when either
  1495. input reaches end of stream. This will cause problems if your encoding
  1496. pipeline drops frames. If you're trying to apply an image as an
  1497. overlay to a video stream, consider the @var{overlay} filter instead.
  1498. @section ass
  1499. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  1500. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  1501. Substation Alpha) subtitles files.
  1502. @section bbox
  1503. Compute the bounding box for the non-black pixels in the input frame
  1504. luminance plane.
  1505. This filter computes the bounding box containing all the pixels with a
  1506. luminance value greater than the minimum allowed value.
  1507. The parameters describing the bounding box are printed on the filter
  1508. log.
  1509. The filter accepts the following option:
  1510. @table @option
  1511. @item min_val
  1512. Set the minimal luminance value. Default is @code{16}.
  1513. @end table
  1514. @section blackdetect
  1515. Detect video intervals that are (almost) completely black. Can be
  1516. useful to detect chapter transitions, commercials, or invalid
  1517. recordings. Output lines contains the time for the start, end and
  1518. duration of the detected black interval expressed in seconds.
  1519. In order to display the output lines, you need to set the loglevel at
  1520. least to the AV_LOG_INFO value.
  1521. The filter accepts the following options:
  1522. @table @option
  1523. @item black_min_duration, d
  1524. Set the minimum detected black duration expressed in seconds. It must
  1525. be a non-negative floating point number.
  1526. Default value is 2.0.
  1527. @item picture_black_ratio_th, pic_th
  1528. Set the threshold for considering a picture "black".
  1529. Express the minimum value for the ratio:
  1530. @example
  1531. @var{nb_black_pixels} / @var{nb_pixels}
  1532. @end example
  1533. for which a picture is considered black.
  1534. Default value is 0.98.
  1535. @item pixel_black_th, pix_th
  1536. Set the threshold for considering a pixel "black".
  1537. The threshold expresses the maximum pixel luminance value for which a
  1538. pixel is considered "black". The provided value is scaled according to
  1539. the following equation:
  1540. @example
  1541. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  1542. @end example
  1543. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  1544. the input video format, the range is [0-255] for YUV full-range
  1545. formats and [16-235] for YUV non full-range formats.
  1546. Default value is 0.10.
  1547. @end table
  1548. The following example sets the maximum pixel threshold to the minimum
  1549. value, and detects only black intervals of 2 or more seconds:
  1550. @example
  1551. blackdetect=d=2:pix_th=0.00
  1552. @end example
  1553. @section blackframe
  1554. Detect frames that are (almost) completely black. Can be useful to
  1555. detect chapter transitions or commercials. Output lines consist of
  1556. the frame number of the detected frame, the percentage of blackness,
  1557. the position in the file if known or -1 and the timestamp in seconds.
  1558. In order to display the output lines, you need to set the loglevel at
  1559. least to the AV_LOG_INFO value.
  1560. The filter accepts the following options:
  1561. @table @option
  1562. @item amount
  1563. Set the percentage of the pixels that have to be below the threshold, defaults
  1564. to @code{98}.
  1565. @item threshold, thresh
  1566. Set the threshold below which a pixel value is considered black, defaults to
  1567. @code{32}.
  1568. @end table
  1569. @section blend
  1570. Blend two video frames into each other.
  1571. It takes two input streams and outputs one stream, the first input is the
  1572. "top" layer and second input is "bottom" layer.
  1573. Output terminates when shortest input terminates.
  1574. A description of the accepted options follows.
  1575. @table @option
  1576. @item c0_mode
  1577. @item c1_mode
  1578. @item c2_mode
  1579. @item c3_mode
  1580. @item all_mode
  1581. Set blend mode for specific pixel component or all pixel components in case
  1582. of @var{all_mode}. Default value is @code{normal}.
  1583. Available values for component modes are:
  1584. @table @samp
  1585. @item addition
  1586. @item and
  1587. @item average
  1588. @item burn
  1589. @item darken
  1590. @item difference
  1591. @item divide
  1592. @item dodge
  1593. @item exclusion
  1594. @item hardlight
  1595. @item lighten
  1596. @item multiply
  1597. @item negation
  1598. @item normal
  1599. @item or
  1600. @item overlay
  1601. @item phoenix
  1602. @item pinlight
  1603. @item reflect
  1604. @item screen
  1605. @item softlight
  1606. @item subtract
  1607. @item vividlight
  1608. @item xor
  1609. @end table
  1610. @item c0_opacity
  1611. @item c1_opacity
  1612. @item c2_opacity
  1613. @item c3_opacity
  1614. @item all_opacity
  1615. Set blend opacity for specific pixel component or all pixel components in case
  1616. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  1617. @item c0_expr
  1618. @item c1_expr
  1619. @item c2_expr
  1620. @item c3_expr
  1621. @item all_expr
  1622. Set blend expression for specific pixel component or all pixel components in case
  1623. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  1624. The expressions can use the following variables:
  1625. @table @option
  1626. @item N
  1627. The sequential number of the filtered frame, starting from @code{0}.
  1628. @item X
  1629. @item Y
  1630. the coordinates of the current sample
  1631. @item W
  1632. @item H
  1633. the width and height of currently filtered plane
  1634. @item SW
  1635. @item SH
  1636. Width and height scale depending on the currently filtered plane. It is the
  1637. ratio between the corresponding luma plane number of pixels and the current
  1638. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  1639. @code{0.5,0.5} for chroma planes.
  1640. @item T
  1641. Time of the current frame, expressed in seconds.
  1642. @item TOP, A
  1643. Value of pixel component at current location for first video frame (top layer).
  1644. @item BOTTOM, B
  1645. Value of pixel component at current location for second video frame (bottom layer).
  1646. @end table
  1647. @item shortest
  1648. Force termination when the shortest input terminates. Default is @code{0}.
  1649. @item repeatlast
  1650. Continue applying the last bottom frame after the end of the stream. A value of
  1651. @code{0} disable the filter after the last frame of the bottom layer is reached.
  1652. Default is @code{1}.
  1653. @end table
  1654. @subsection Examples
  1655. @itemize
  1656. @item
  1657. Apply transition from bottom layer to top layer in first 10 seconds:
  1658. @example
  1659. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  1660. @end example
  1661. @item
  1662. Apply 1x1 checkerboard effect:
  1663. @example
  1664. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  1665. @end example
  1666. @end itemize
  1667. @section boxblur
  1668. Apply boxblur algorithm to the input video.
  1669. The filter accepts the following options:
  1670. @table @option
  1671. @item luma_radius, lr
  1672. @item luma_power, lp
  1673. @item chroma_radius, cr
  1674. @item chroma_power, cp
  1675. @item alpha_radius, ar
  1676. @item alpha_power, ap
  1677. @end table
  1678. A description of the accepted options follows.
  1679. @table @option
  1680. @item luma_radius, lr
  1681. @item chroma_radius, cr
  1682. @item alpha_radius, ar
  1683. Set an expression for the box radius in pixels used for blurring the
  1684. corresponding input plane.
  1685. The radius value must be a non-negative number, and must not be
  1686. greater than the value of the expression @code{min(w,h)/2} for the
  1687. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  1688. planes.
  1689. Default value for @option{luma_radius} is "2". If not specified,
  1690. @option{chroma_radius} and @option{alpha_radius} default to the
  1691. corresponding value set for @option{luma_radius}.
  1692. The expressions can contain the following constants:
  1693. @table @option
  1694. @item w
  1695. @item h
  1696. the input width and height in pixels
  1697. @item cw
  1698. @item ch
  1699. the input chroma image width and height in pixels
  1700. @item hsub
  1701. @item vsub
  1702. horizontal and vertical chroma subsample values. For example for the
  1703. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1704. @end table
  1705. @item luma_power, lp
  1706. @item chroma_power, cp
  1707. @item alpha_power, ap
  1708. Specify how many times the boxblur filter is applied to the
  1709. corresponding plane.
  1710. Default value for @option{luma_power} is 2. If not specified,
  1711. @option{chroma_power} and @option{alpha_power} default to the
  1712. corresponding value set for @option{luma_power}.
  1713. A value of 0 will disable the effect.
  1714. @end table
  1715. @subsection Examples
  1716. @itemize
  1717. @item
  1718. Apply a boxblur filter with luma, chroma, and alpha radius
  1719. set to 2:
  1720. @example
  1721. boxblur=luma_radius=2:luma_power=1
  1722. boxblur=2:1
  1723. @end example
  1724. @item
  1725. Set luma radius to 2, alpha and chroma radius to 0:
  1726. @example
  1727. boxblur=2:1:cr=0:ar=0
  1728. @end example
  1729. @item
  1730. Set luma and chroma radius to a fraction of the video dimension:
  1731. @example
  1732. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  1733. @end example
  1734. @end itemize
  1735. @section colorbalance
  1736. Modify intensity of primary colors (red, green and blue) of input frames.
  1737. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  1738. regions for the red-cyan, green-magenta or blue-yellow balance.
  1739. A positive adjustment value shifts the balance towards the primary color, a negative
  1740. value towards the complementary color.
  1741. The filter accepts the following options:
  1742. @table @option
  1743. @item rs
  1744. @item gs
  1745. @item bs
  1746. Adjust red, green and blue shadows (darkest pixels).
  1747. @item rm
  1748. @item gm
  1749. @item bm
  1750. Adjust red, green and blue midtones (medium pixels).
  1751. @item rh
  1752. @item gh
  1753. @item bh
  1754. Adjust red, green and blue highlights (brightest pixels).
  1755. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  1756. @end table
  1757. @subsection Examples
  1758. @itemize
  1759. @item
  1760. Add red color cast to shadows:
  1761. @example
  1762. colorbalance=rs=.3
  1763. @end example
  1764. @end itemize
  1765. @section colorchannelmixer
  1766. Adjust video input frames by re-mixing color channels.
  1767. This filter modifies a color channel by adding the values associated to
  1768. the other channels of the same pixels. For example if the value to
  1769. modify is red, the output value will be:
  1770. @example
  1771. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  1772. @end example
  1773. The filter accepts the following options:
  1774. @table @option
  1775. @item rr
  1776. @item rg
  1777. @item rb
  1778. @item ra
  1779. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  1780. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  1781. @item gr
  1782. @item gg
  1783. @item gb
  1784. @item ga
  1785. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  1786. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  1787. @item br
  1788. @item bg
  1789. @item bb
  1790. @item ba
  1791. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  1792. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  1793. @item ar
  1794. @item ag
  1795. @item ab
  1796. @item aa
  1797. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  1798. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  1799. Allowed ranges for options are @code{[-2.0, 2.0]}.
  1800. @end table
  1801. @subsection Examples
  1802. @itemize
  1803. @item
  1804. Convert source to grayscale:
  1805. @example
  1806. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  1807. @end example
  1808. @end itemize
  1809. @section colormatrix
  1810. Convert color matrix.
  1811. The filter accepts the following options:
  1812. @table @option
  1813. @item src
  1814. @item dst
  1815. Specify the source and destination color matrix. Both values must be
  1816. specified.
  1817. The accepted values are:
  1818. @table @samp
  1819. @item bt709
  1820. BT.709
  1821. @item bt601
  1822. BT.601
  1823. @item smpte240m
  1824. SMPTE-240M
  1825. @item fcc
  1826. FCC
  1827. @end table
  1828. @end table
  1829. For example to convert from BT.601 to SMPTE-240M, use the command:
  1830. @example
  1831. colormatrix=bt601:smpte240m
  1832. @end example
  1833. @section copy
  1834. Copy the input source unchanged to the output. Mainly useful for
  1835. testing purposes.
  1836. @section crop
  1837. Crop the input video to given dimensions.
  1838. The filter accepts the following options:
  1839. @table @option
  1840. @item w, out_w
  1841. Width of the output video. It defaults to @code{iw}.
  1842. This expression is evaluated only once during the filter
  1843. configuration.
  1844. @item h, out_h
  1845. Height of the output video. It defaults to @code{ih}.
  1846. This expression is evaluated only once during the filter
  1847. configuration.
  1848. @item x
  1849. Horizontal position, in the input video, of the left edge of the output video.
  1850. It defaults to @code{(in_w-out_w)/2}.
  1851. This expression is evaluated per-frame.
  1852. @item y
  1853. Vertical position, in the input video, of the top edge of the output video.
  1854. It defaults to @code{(in_h-out_h)/2}.
  1855. This expression is evaluated per-frame.
  1856. @item keep_aspect
  1857. If set to 1 will force the output display aspect ratio
  1858. to be the same of the input, by changing the output sample aspect
  1859. ratio. It defaults to 0.
  1860. @end table
  1861. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  1862. expressions containing the following constants:
  1863. @table @option
  1864. @item x
  1865. @item y
  1866. the computed values for @var{x} and @var{y}. They are evaluated for
  1867. each new frame.
  1868. @item in_w
  1869. @item in_h
  1870. the input width and height
  1871. @item iw
  1872. @item ih
  1873. same as @var{in_w} and @var{in_h}
  1874. @item out_w
  1875. @item out_h
  1876. the output (cropped) width and height
  1877. @item ow
  1878. @item oh
  1879. same as @var{out_w} and @var{out_h}
  1880. @item a
  1881. same as @var{iw} / @var{ih}
  1882. @item sar
  1883. input sample aspect ratio
  1884. @item dar
  1885. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  1886. @item hsub
  1887. @item vsub
  1888. horizontal and vertical chroma subsample values. For example for the
  1889. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1890. @item n
  1891. the number of input frame, starting from 0
  1892. @item pos
  1893. the position in the file of the input frame, NAN if unknown
  1894. @item t
  1895. timestamp expressed in seconds, NAN if the input timestamp is unknown
  1896. @end table
  1897. The expression for @var{out_w} may depend on the value of @var{out_h},
  1898. and the expression for @var{out_h} may depend on @var{out_w}, but they
  1899. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  1900. evaluated after @var{out_w} and @var{out_h}.
  1901. The @var{x} and @var{y} parameters specify the expressions for the
  1902. position of the top-left corner of the output (non-cropped) area. They
  1903. are evaluated for each frame. If the evaluated value is not valid, it
  1904. is approximated to the nearest valid value.
  1905. The expression for @var{x} may depend on @var{y}, and the expression
  1906. for @var{y} may depend on @var{x}.
  1907. @subsection Examples
  1908. @itemize
  1909. @item
  1910. Crop area with size 100x100 at position (12,34).
  1911. @example
  1912. crop=100:100:12:34
  1913. @end example
  1914. Using named options, the example above becomes:
  1915. @example
  1916. crop=w=100:h=100:x=12:y=34
  1917. @end example
  1918. @item
  1919. Crop the central input area with size 100x100:
  1920. @example
  1921. crop=100:100
  1922. @end example
  1923. @item
  1924. Crop the central input area with size 2/3 of the input video:
  1925. @example
  1926. crop=2/3*in_w:2/3*in_h
  1927. @end example
  1928. @item
  1929. Crop the input video central square:
  1930. @example
  1931. crop=out_w=in_h
  1932. crop=in_h
  1933. @end example
  1934. @item
  1935. Delimit the rectangle with the top-left corner placed at position
  1936. 100:100 and the right-bottom corner corresponding to the right-bottom
  1937. corner of the input image:
  1938. @example
  1939. crop=in_w-100:in_h-100:100:100
  1940. @end example
  1941. @item
  1942. Crop 10 pixels from the left and right borders, and 20 pixels from
  1943. the top and bottom borders
  1944. @example
  1945. crop=in_w-2*10:in_h-2*20
  1946. @end example
  1947. @item
  1948. Keep only the bottom right quarter of the input image:
  1949. @example
  1950. crop=in_w/2:in_h/2:in_w/2:in_h/2
  1951. @end example
  1952. @item
  1953. Crop height for getting Greek harmony:
  1954. @example
  1955. crop=in_w:1/PHI*in_w
  1956. @end example
  1957. @item
  1958. Appply trembling effect:
  1959. @example
  1960. 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)
  1961. @end example
  1962. @item
  1963. Apply erratic camera effect depending on timestamp:
  1964. @example
  1965. 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)"
  1966. @end example
  1967. @item
  1968. Set x depending on the value of y:
  1969. @example
  1970. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  1971. @end example
  1972. @end itemize
  1973. @section cropdetect
  1974. Auto-detect crop size.
  1975. Calculate necessary cropping parameters and prints the recommended
  1976. parameters through the logging system. The detected dimensions
  1977. correspond to the non-black area of the input video.
  1978. The filter accepts the following options:
  1979. @table @option
  1980. @item limit
  1981. Set higher black value threshold, which can be optionally specified
  1982. from nothing (0) to everything (255). An intensity value greater
  1983. to the set value is considered non-black. Default value is 24.
  1984. @item round
  1985. Set the value for which the width/height should be divisible by. The
  1986. offset is automatically adjusted to center the video. Use 2 to get
  1987. only even dimensions (needed for 4:2:2 video). 16 is best when
  1988. encoding to most video codecs. Default value is 16.
  1989. @item reset_count, reset
  1990. Set the counter that determines after how many frames cropdetect will
  1991. reset the previously detected largest video area and start over to
  1992. detect the current optimal crop area. Default value is 0.
  1993. This can be useful when channel logos distort the video area. 0
  1994. indicates never reset and return the largest area encountered during
  1995. playback.
  1996. @end table
  1997. @anchor{curves}
  1998. @section curves
  1999. Apply color adjustments using curves.
  2000. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  2001. component (red, green and blue) has its values defined by @var{N} key points
  2002. tied from each other using a smooth curve. The x-axis represents the pixel
  2003. values from the input frame, and the y-axis the new pixel values to be set for
  2004. the output frame.
  2005. By default, a component curve is defined by the two points @var{(0;0)} and
  2006. @var{(1;1)}. This creates a straight line where each original pixel value is
  2007. "adjusted" to its own value, which means no change to the image.
  2008. The filter allows you to redefine these two points and add some more. A new
  2009. curve (using a natural cubic spline interpolation) will be define to pass
  2010. smoothly through all these new coordinates. The new defined points needs to be
  2011. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  2012. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  2013. the vector spaces, the values will be clipped accordingly.
  2014. If there is no key point defined in @code{x=0}, the filter will automatically
  2015. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  2016. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  2017. The filter accepts the following options:
  2018. @table @option
  2019. @item preset
  2020. Select one of the available color presets. This option can be used in addition
  2021. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  2022. options takes priority on the preset values.
  2023. Available presets are:
  2024. @table @samp
  2025. @item none
  2026. @item color_negative
  2027. @item cross_process
  2028. @item darker
  2029. @item increase_contrast
  2030. @item lighter
  2031. @item linear_contrast
  2032. @item medium_contrast
  2033. @item negative
  2034. @item strong_contrast
  2035. @item vintage
  2036. @end table
  2037. Default is @code{none}.
  2038. @item master, m
  2039. Set the master key points. These points will define a second pass mapping. It
  2040. is sometimes called a "luminance" or "value" mapping. It can be used with
  2041. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  2042. post-processing LUT.
  2043. @item red, r
  2044. Set the key points for the red component.
  2045. @item green, g
  2046. Set the key points for the green component.
  2047. @item blue, b
  2048. Set the key points for the blue component.
  2049. @item all
  2050. Set the key points for all components (not including master).
  2051. Can be used in addition to the other key points component
  2052. options. In this case, the unset component(s) will fallback on this
  2053. @option{all} setting.
  2054. @item psfile
  2055. Specify a Photoshop curves file (@code{.asv}) to import the settings from.
  2056. @end table
  2057. To avoid some filtergraph syntax conflicts, each key points list need to be
  2058. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  2059. @subsection Examples
  2060. @itemize
  2061. @item
  2062. Increase slightly the middle level of blue:
  2063. @example
  2064. curves=blue='0.5/0.58'
  2065. @end example
  2066. @item
  2067. Vintage effect:
  2068. @example
  2069. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  2070. @end example
  2071. Here we obtain the following coordinates for each components:
  2072. @table @var
  2073. @item red
  2074. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  2075. @item green
  2076. @code{(0;0) (0.50;0.48) (1;1)}
  2077. @item blue
  2078. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  2079. @end table
  2080. @item
  2081. The previous example can also be achieved with the associated built-in preset:
  2082. @example
  2083. curves=preset=vintage
  2084. @end example
  2085. @item
  2086. Or simply:
  2087. @example
  2088. curves=vintage
  2089. @end example
  2090. @item
  2091. Use a Photoshop preset and redefine the points of the green component:
  2092. @example
  2093. curves=psfile='MyCurvesPresets/purple.asv':green='0.45/0.53'
  2094. @end example
  2095. @end itemize
  2096. @section dctdnoiz
  2097. Denoise frames using 2D DCT (frequency domain filtering).
  2098. This filter is not designed for real time and can be extremely slow.
  2099. The filter accepts the following options:
  2100. @table @option
  2101. @item sigma, s
  2102. Set the noise sigma constant.
  2103. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  2104. coefficient (absolute value) below this threshold with be dropped.
  2105. If you need a more advanced filtering, see @option{expr}.
  2106. Default is @code{0}.
  2107. @item overlap
  2108. Set number overlapping pixels for each block. Each block is of size
  2109. @code{16x16}. Since the filter can be slow, you may want to reduce this value,
  2110. at the cost of a less effective filter and the risk of various artefacts.
  2111. If the overlapping value doesn't allow to process the whole input width or
  2112. height, a warning will be displayed and according borders won't be denoised.
  2113. Default value is @code{15}.
  2114. @item expr, e
  2115. Set the coefficient factor expression.
  2116. For each coefficient of a DCT block, this expression will be evaluated as a
  2117. multiplier value for the coefficient.
  2118. If this is option is set, the @option{sigma} option will be ignored.
  2119. The absolute value of the coefficient can be accessed through the @var{c}
  2120. variable.
  2121. @end table
  2122. @subsection Examples
  2123. Apply a denoise with a @option{sigma} of @code{4.5}:
  2124. @example
  2125. dctdnoiz=4.5
  2126. @end example
  2127. The same operation can be achieved using the expression system:
  2128. @example
  2129. dctdnoiz=e='gte(c, 4.5*3)'
  2130. @end example
  2131. @anchor{decimate}
  2132. @section decimate
  2133. Drop duplicated frames at regular intervals.
  2134. The filter accepts the following options:
  2135. @table @option
  2136. @item cycle
  2137. Set the number of frames from which one will be dropped. Setting this to
  2138. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  2139. Default is @code{5}.
  2140. @item dupthresh
  2141. Set the threshold for duplicate detection. If the difference metric for a frame
  2142. is less than or equal to this value, then it is declared as duplicate. Default
  2143. is @code{1.1}
  2144. @item scthresh
  2145. Set scene change threshold. Default is @code{15}.
  2146. @item blockx
  2147. @item blocky
  2148. Set the size of the x and y-axis blocks used during metric calculations.
  2149. Larger blocks give better noise suppression, but also give worse detection of
  2150. small movements. Must be a power of two. Default is @code{32}.
  2151. @item ppsrc
  2152. Mark main input as a pre-processed input and activate clean source input
  2153. stream. This allows the input to be pre-processed with various filters to help
  2154. the metrics calculation while keeping the frame selection lossless. When set to
  2155. @code{1}, the first stream is for the pre-processed input, and the second
  2156. stream is the clean source from where the kept frames are chosen. Default is
  2157. @code{0}.
  2158. @item chroma
  2159. Set whether or not chroma is considered in the metric calculations. Default is
  2160. @code{1}.
  2161. @end table
  2162. @section delogo
  2163. Suppress a TV station logo by a simple interpolation of the surrounding
  2164. pixels. Just set a rectangle covering the logo and watch it disappear
  2165. (and sometimes something even uglier appear - your mileage may vary).
  2166. This filter accepts the following options:
  2167. @table @option
  2168. @item x
  2169. @item y
  2170. Specify the top left corner coordinates of the logo. They must be
  2171. specified.
  2172. @item w
  2173. @item h
  2174. Specify the width and height of the logo to clear. They must be
  2175. specified.
  2176. @item band, t
  2177. Specify the thickness of the fuzzy edge of the rectangle (added to
  2178. @var{w} and @var{h}). The default value is 4.
  2179. @item show
  2180. When set to 1, a green rectangle is drawn on the screen to simplify
  2181. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  2182. The default value is 0.
  2183. The rectangle is drawn on the outermost pixels which will be (partly)
  2184. replaced with interpolated values. The values of the next pixels
  2185. immediately outside this rectangle in each direction will be used to
  2186. compute the interpolated pixel values inside the rectangle.
  2187. @end table
  2188. @subsection Examples
  2189. @itemize
  2190. @item
  2191. Set a rectangle covering the area with top left corner coordinates 0,0
  2192. and size 100x77, setting a band of size 10:
  2193. @example
  2194. delogo=x=0:y=0:w=100:h=77:band=10
  2195. @end example
  2196. @end itemize
  2197. @section deshake
  2198. Attempt to fix small changes in horizontal and/or vertical shift. This
  2199. filter helps remove camera shake from hand-holding a camera, bumping a
  2200. tripod, moving on a vehicle, etc.
  2201. The filter accepts the following options:
  2202. @table @option
  2203. @item x
  2204. @item y
  2205. @item w
  2206. @item h
  2207. Specify a rectangular area where to limit the search for motion
  2208. vectors.
  2209. If desired the search for motion vectors can be limited to a
  2210. rectangular area of the frame defined by its top left corner, width
  2211. and height. These parameters have the same meaning as the drawbox
  2212. filter which can be used to visualise the position of the bounding
  2213. box.
  2214. This is useful when simultaneous movement of subjects within the frame
  2215. might be confused for camera motion by the motion vector search.
  2216. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  2217. then the full frame is used. This allows later options to be set
  2218. without specifying the bounding box for the motion vector search.
  2219. Default - search the whole frame.
  2220. @item rx
  2221. @item ry
  2222. Specify the maximum extent of movement in x and y directions in the
  2223. range 0-64 pixels. Default 16.
  2224. @item edge
  2225. Specify how to generate pixels to fill blanks at the edge of the
  2226. frame. Available values are:
  2227. @table @samp
  2228. @item blank, 0
  2229. Fill zeroes at blank locations
  2230. @item original, 1
  2231. Original image at blank locations
  2232. @item clamp, 2
  2233. Extruded edge value at blank locations
  2234. @item mirror, 3
  2235. Mirrored edge at blank locations
  2236. @end table
  2237. Default value is @samp{mirror}.
  2238. @item blocksize
  2239. Specify the blocksize to use for motion search. Range 4-128 pixels,
  2240. default 8.
  2241. @item contrast
  2242. Specify the contrast threshold for blocks. Only blocks with more than
  2243. the specified contrast (difference between darkest and lightest
  2244. pixels) will be considered. Range 1-255, default 125.
  2245. @item search
  2246. Specify the search strategy. Available values are:
  2247. @table @samp
  2248. @item exhaustive, 0
  2249. Set exhaustive search
  2250. @item less, 1
  2251. Set less exhaustive search.
  2252. @end table
  2253. Default value is @samp{exhaustive}.
  2254. @item filename
  2255. If set then a detailed log of the motion search is written to the
  2256. specified file.
  2257. @item opencl
  2258. If set to 1, specify using OpenCL capabilities, only available if
  2259. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  2260. @end table
  2261. @section drawbox
  2262. Draw a colored box on the input image.
  2263. This filter accepts the following options:
  2264. @table @option
  2265. @item x
  2266. @item y
  2267. The expressions which specify the top left corner coordinates of the box. Default to 0.
  2268. @item width, w
  2269. @item height, h
  2270. The expressions which specify the width and height of the box, if 0 they are interpreted as
  2271. the input width and height. Default to 0.
  2272. @item color, c
  2273. Specify the color of the box to write, it can be the name of a color
  2274. (case insensitive match) or a 0xRRGGBB[AA] sequence. If the special
  2275. value @code{invert} is used, the box edge color is the same as the
  2276. video with inverted luma.
  2277. @item thickness, t
  2278. The expression which sets the thickness of the box edge. Default value is @code{3}.
  2279. See below for the list of accepted constants.
  2280. @end table
  2281. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2282. following constants:
  2283. @table @option
  2284. @item dar
  2285. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2286. @item hsub
  2287. @item vsub
  2288. horizontal and vertical chroma subsample values. For example for the
  2289. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2290. @item in_h, ih
  2291. @item in_w, iw
  2292. The input width and height.
  2293. @item sar
  2294. The input sample aspect ratio.
  2295. @item x
  2296. @item y
  2297. The x and y offset coordinates where the box is drawn.
  2298. @item w
  2299. @item h
  2300. The width and height of the drawn box.
  2301. @item t
  2302. The thickness of the drawn box.
  2303. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2304. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2305. @end table
  2306. @subsection Examples
  2307. @itemize
  2308. @item
  2309. Draw a black box around the edge of the input image:
  2310. @example
  2311. drawbox
  2312. @end example
  2313. @item
  2314. Draw a box with color red and an opacity of 50%:
  2315. @example
  2316. drawbox=10:20:200:60:red@@0.5
  2317. @end example
  2318. The previous example can be specified as:
  2319. @example
  2320. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  2321. @end example
  2322. @item
  2323. Fill the box with pink color:
  2324. @example
  2325. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  2326. @end example
  2327. @item
  2328. Draw a 2-pixel red 2.40:1 mask:
  2329. @example
  2330. drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
  2331. @end example
  2332. @end itemize
  2333. @section drawgrid
  2334. Draw a grid on the input image.
  2335. This filter accepts the following options:
  2336. @table @option
  2337. @item x
  2338. @item y
  2339. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  2340. @item width, w
  2341. @item height, h
  2342. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  2343. input width and height, respectively, minus @code{thickness}, so image gets
  2344. framed. Default to 0.
  2345. @item color, c
  2346. Specify the color of the grid, it can be the name of a color
  2347. (case insensitive match) or a 0xRRGGBB[AA] sequence. If the special
  2348. value @code{invert} is used, the grid color is the same as the
  2349. video with inverted luma.
  2350. Note that you can append opacity value (in range of 0.0 - 1.0)
  2351. to color name after @@ sign.
  2352. @item thickness, t
  2353. The expression which sets the thickness of the grid line. Default value is @code{1}.
  2354. See below for the list of accepted constants.
  2355. @end table
  2356. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2357. following constants:
  2358. @table @option
  2359. @item dar
  2360. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2361. @item hsub
  2362. @item vsub
  2363. horizontal and vertical chroma subsample values. For example for the
  2364. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2365. @item in_h, ih
  2366. @item in_w, iw
  2367. The input grid cell width and height.
  2368. @item sar
  2369. The input sample aspect ratio.
  2370. @item x
  2371. @item y
  2372. The x and y coordinates of some point of grid intersection (meant to configure offset).
  2373. @item w
  2374. @item h
  2375. The width and height of the drawn cell.
  2376. @item t
  2377. The thickness of the drawn cell.
  2378. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2379. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2380. @end table
  2381. @subsection Examples
  2382. @itemize
  2383. @item
  2384. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  2385. @example
  2386. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  2387. @end example
  2388. @item
  2389. Draw a white 3x3 grid with an opacity of 50%:
  2390. @example
  2391. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  2392. @end example
  2393. @end itemize
  2394. @anchor{drawtext}
  2395. @section drawtext
  2396. Draw text string or text from specified file on top of video using the
  2397. libfreetype library.
  2398. To enable compilation of this filter you need to configure FFmpeg with
  2399. @code{--enable-libfreetype}.
  2400. @subsection Syntax
  2401. The description of the accepted parameters follows.
  2402. @table @option
  2403. @item box
  2404. Used to draw a box around text using background color.
  2405. Value should be either 1 (enable) or 0 (disable).
  2406. The default value of @var{box} is 0.
  2407. @item boxcolor
  2408. The color to be used for drawing box around text.
  2409. Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
  2410. (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  2411. The default value of @var{boxcolor} is "white".
  2412. @item draw
  2413. Set an expression which specifies if the text should be drawn. If the
  2414. expression evaluates to 0, the text is not drawn. This is useful for
  2415. specifying that the text should be drawn only when specific conditions
  2416. are met.
  2417. Default value is "1".
  2418. See below for the list of accepted constants and functions.
  2419. @item expansion
  2420. Select how the @var{text} is expanded. Can be either @code{none},
  2421. @code{strftime} (deprecated) or
  2422. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  2423. below for details.
  2424. @item fix_bounds
  2425. If true, check and fix text coords to avoid clipping.
  2426. @item fontcolor
  2427. The color to be used for drawing fonts.
  2428. Either a string (e.g. "red") or in 0xRRGGBB[AA] format
  2429. (e.g. "0xff000033"), possibly followed by an alpha specifier.
  2430. The default value of @var{fontcolor} is "black".
  2431. @item fontfile
  2432. The font file to be used for drawing text. Path must be included.
  2433. This parameter is mandatory.
  2434. @item fontsize
  2435. The font size to be used for drawing text.
  2436. The default value of @var{fontsize} is 16.
  2437. @item ft_load_flags
  2438. Flags to be used for loading the fonts.
  2439. The flags map the corresponding flags supported by libfreetype, and are
  2440. a combination of the following values:
  2441. @table @var
  2442. @item default
  2443. @item no_scale
  2444. @item no_hinting
  2445. @item render
  2446. @item no_bitmap
  2447. @item vertical_layout
  2448. @item force_autohint
  2449. @item crop_bitmap
  2450. @item pedantic
  2451. @item ignore_global_advance_width
  2452. @item no_recurse
  2453. @item ignore_transform
  2454. @item monochrome
  2455. @item linear_design
  2456. @item no_autohint
  2457. @end table
  2458. Default value is "render".
  2459. For more information consult the documentation for the FT_LOAD_*
  2460. libfreetype flags.
  2461. @item shadowcolor
  2462. The color to be used for drawing a shadow behind the drawn text. It
  2463. can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
  2464. form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  2465. The default value of @var{shadowcolor} is "black".
  2466. @item shadowx
  2467. @item shadowy
  2468. The x and y offsets for the text shadow position with respect to the
  2469. position of the text. They can be either positive or negative
  2470. values. Default value for both is "0".
  2471. @item start_number
  2472. The starting frame number for the n/frame_num variable. The default value
  2473. is "0".
  2474. @item tabsize
  2475. The size in number of spaces to use for rendering the tab.
  2476. Default value is 4.
  2477. @item timecode
  2478. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  2479. format. It can be used with or without text parameter. @var{timecode_rate}
  2480. option must be specified.
  2481. @item timecode_rate, rate, r
  2482. Set the timecode frame rate (timecode only).
  2483. @item text
  2484. The text string to be drawn. The text must be a sequence of UTF-8
  2485. encoded characters.
  2486. This parameter is mandatory if no file is specified with the parameter
  2487. @var{textfile}.
  2488. @item textfile
  2489. A text file containing text to be drawn. The text must be a sequence
  2490. of UTF-8 encoded characters.
  2491. This parameter is mandatory if no text string is specified with the
  2492. parameter @var{text}.
  2493. If both @var{text} and @var{textfile} are specified, an error is thrown.
  2494. @item reload
  2495. If set to 1, the @var{textfile} will be reloaded before each frame.
  2496. Be sure to update it atomically, or it may be read partially, or even fail.
  2497. @item x
  2498. @item y
  2499. The expressions which specify the offsets where text will be drawn
  2500. within the video frame. They are relative to the top/left border of the
  2501. output image.
  2502. The default value of @var{x} and @var{y} is "0".
  2503. See below for the list of accepted constants and functions.
  2504. @end table
  2505. The parameters for @var{x} and @var{y} are expressions containing the
  2506. following constants and functions:
  2507. @table @option
  2508. @item dar
  2509. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  2510. @item hsub
  2511. @item vsub
  2512. horizontal and vertical chroma subsample values. For example for the
  2513. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2514. @item line_h, lh
  2515. the height of each text line
  2516. @item main_h, h, H
  2517. the input height
  2518. @item main_w, w, W
  2519. the input width
  2520. @item max_glyph_a, ascent
  2521. the maximum distance from the baseline to the highest/upper grid
  2522. coordinate used to place a glyph outline point, for all the rendered
  2523. glyphs.
  2524. It is a positive value, due to the grid's orientation with the Y axis
  2525. upwards.
  2526. @item max_glyph_d, descent
  2527. the maximum distance from the baseline to the lowest grid coordinate
  2528. used to place a glyph outline point, for all the rendered glyphs.
  2529. This is a negative value, due to the grid's orientation, with the Y axis
  2530. upwards.
  2531. @item max_glyph_h
  2532. maximum glyph height, that is the maximum height for all the glyphs
  2533. contained in the rendered text, it is equivalent to @var{ascent} -
  2534. @var{descent}.
  2535. @item max_glyph_w
  2536. maximum glyph width, that is the maximum width for all the glyphs
  2537. contained in the rendered text
  2538. @item n
  2539. the number of input frame, starting from 0
  2540. @item rand(min, max)
  2541. return a random number included between @var{min} and @var{max}
  2542. @item sar
  2543. input sample aspect ratio
  2544. @item t
  2545. timestamp expressed in seconds, NAN if the input timestamp is unknown
  2546. @item text_h, th
  2547. the height of the rendered text
  2548. @item text_w, tw
  2549. the width of the rendered text
  2550. @item x
  2551. @item y
  2552. the x and y offset coordinates where the text is drawn.
  2553. These parameters allow the @var{x} and @var{y} expressions to refer
  2554. each other, so you can for example specify @code{y=x/dar}.
  2555. @end table
  2556. If libavfilter was built with @code{--enable-fontconfig}, then
  2557. @option{fontfile} can be a fontconfig pattern or omitted.
  2558. @anchor{drawtext_expansion}
  2559. @subsection Text expansion
  2560. If @option{expansion} is set to @code{strftime},
  2561. the filter recognizes strftime() sequences in the provided text and
  2562. expands them accordingly. Check the documentation of strftime(). This
  2563. feature is deprecated.
  2564. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  2565. If @option{expansion} is set to @code{normal} (which is the default),
  2566. the following expansion mechanism is used.
  2567. The backslash character '\', followed by any character, always expands to
  2568. the second character.
  2569. Sequence of the form @code{%@{...@}} are expanded. The text between the
  2570. braces is a function name, possibly followed by arguments separated by ':'.
  2571. If the arguments contain special characters or delimiters (':' or '@}'),
  2572. they should be escaped.
  2573. Note that they probably must also be escaped as the value for the
  2574. @option{text} option in the filter argument string and as the filter
  2575. argument in the filtergraph description, and possibly also for the shell,
  2576. that makes up to four levels of escaping; using a text file avoids these
  2577. problems.
  2578. The following functions are available:
  2579. @table @command
  2580. @item expr, e
  2581. The expression evaluation result.
  2582. It must take one argument specifying the expression to be evaluated,
  2583. which accepts the same constants and functions as the @var{x} and
  2584. @var{y} values. Note that not all constants should be used, for
  2585. example the text size is not known when evaluating the expression, so
  2586. the constants @var{text_w} and @var{text_h} will have an undefined
  2587. value.
  2588. @item gmtime
  2589. The time at which the filter is running, expressed in UTC.
  2590. It can accept an argument: a strftime() format string.
  2591. @item localtime
  2592. The time at which the filter is running, expressed in the local time zone.
  2593. It can accept an argument: a strftime() format string.
  2594. @item metadata
  2595. Frame metadata. It must take one argument specifying metadata key.
  2596. @item n, frame_num
  2597. The frame number, starting from 0.
  2598. @item pict_type
  2599. A 1 character description of the current picture type.
  2600. @item pts
  2601. The timestamp of the current frame, in seconds, with microsecond accuracy.
  2602. @end table
  2603. @subsection Examples
  2604. @itemize
  2605. @item
  2606. Draw "Test Text" with font FreeSerif, using the default values for the
  2607. optional parameters.
  2608. @example
  2609. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  2610. @end example
  2611. @item
  2612. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  2613. and y=50 (counting from the top-left corner of the screen), text is
  2614. yellow with a red box around it. Both the text and the box have an
  2615. opacity of 20%.
  2616. @example
  2617. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  2618. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  2619. @end example
  2620. Note that the double quotes are not necessary if spaces are not used
  2621. within the parameter list.
  2622. @item
  2623. Show the text at the center of the video frame:
  2624. @example
  2625. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  2626. @end example
  2627. @item
  2628. Show a text line sliding from right to left in the last row of the video
  2629. frame. The file @file{LONG_LINE} is assumed to contain a single line
  2630. with no newlines.
  2631. @example
  2632. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  2633. @end example
  2634. @item
  2635. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  2636. @example
  2637. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  2638. @end example
  2639. @item
  2640. Draw a single green letter "g", at the center of the input video.
  2641. The glyph baseline is placed at half screen height.
  2642. @example
  2643. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  2644. @end example
  2645. @item
  2646. Show text for 1 second every 3 seconds:
  2647. @example
  2648. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:draw=lt(mod(t\,3)\,1):text='blink'"
  2649. @end example
  2650. @item
  2651. Use fontconfig to set the font. Note that the colons need to be escaped.
  2652. @example
  2653. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  2654. @end example
  2655. @item
  2656. Print the date of a real-time encoding (see strftime(3)):
  2657. @example
  2658. drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
  2659. @end example
  2660. @end itemize
  2661. For more information about libfreetype, check:
  2662. @url{http://www.freetype.org/}.
  2663. For more information about fontconfig, check:
  2664. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  2665. @section edgedetect
  2666. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  2667. The filter accepts the following options:
  2668. @table @option
  2669. @item low
  2670. @item high
  2671. Set low and high threshold values used by the Canny thresholding
  2672. algorithm.
  2673. The high threshold selects the "strong" edge pixels, which are then
  2674. connected through 8-connectivity with the "weak" edge pixels selected
  2675. by the low threshold.
  2676. @var{low} and @var{high} threshold values must be choosen in the range
  2677. [0,1], and @var{low} should be lesser or equal to @var{high}.
  2678. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  2679. is @code{50/255}.
  2680. @end table
  2681. Example:
  2682. @example
  2683. edgedetect=low=0.1:high=0.4
  2684. @end example
  2685. @section extractplanes
  2686. Extract color channel components from input video stream into
  2687. separate grayscale video streams.
  2688. The filter accepts the following option:
  2689. @table @option
  2690. @item planes
  2691. Set plane(s) to extract.
  2692. Available values for planes are:
  2693. @table @samp
  2694. @item y
  2695. @item u
  2696. @item v
  2697. @item a
  2698. @item r
  2699. @item g
  2700. @item b
  2701. @end table
  2702. Choosing planes not available in the input will result in an error.
  2703. That means you cannot select @code{r}, @code{g}, @code{b} planes
  2704. with @code{y}, @code{u}, @code{v} planes at same time.
  2705. @end table
  2706. @subsection Examples
  2707. @itemize
  2708. @item
  2709. Extract luma, u and v color channel component from input video frame
  2710. into 3 grayscale outputs:
  2711. @example
  2712. ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
  2713. @end example
  2714. @end itemize
  2715. @section fade
  2716. Apply fade-in/out effect to input video.
  2717. This filter accepts the following options:
  2718. @table @option
  2719. @item type, t
  2720. The effect type -- can be either "in" for fade-in, or "out" for a fade-out
  2721. effect.
  2722. Default is @code{in}.
  2723. @item start_frame, s
  2724. Specify the number of the start frame for starting to apply the fade
  2725. effect. Default is 0.
  2726. @item nb_frames, n
  2727. The number of frames for which the fade effect has to last. At the end of the
  2728. fade-in effect the output video will have the same intensity as the input video,
  2729. at the end of the fade-out transition the output video will be completely black.
  2730. Default is 25.
  2731. @item alpha
  2732. If set to 1, fade only alpha channel, if one exists on the input.
  2733. Default value is 0.
  2734. @item start_time, st
  2735. Specify the timestamp (in seconds) of the frame to start to apply the fade
  2736. effect. If both start_frame and start_time are specified, the fade will start at
  2737. whichever comes last. Default is 0.
  2738. @item duration, d
  2739. The number of seconds for which the fade effect has to last. At the end of the
  2740. fade-in effect the output video will have the same intensity as the input video,
  2741. at the end of the fade-out transition the output video will be completely black.
  2742. If both duration and nb_frames are specified, duration is used. Default is 0.
  2743. @end table
  2744. @subsection Examples
  2745. @itemize
  2746. @item
  2747. Fade in first 30 frames of video:
  2748. @example
  2749. fade=in:0:30
  2750. @end example
  2751. The command above is equivalent to:
  2752. @example
  2753. fade=t=in:s=0:n=30
  2754. @end example
  2755. @item
  2756. Fade out last 45 frames of a 200-frame video:
  2757. @example
  2758. fade=out:155:45
  2759. fade=type=out:start_frame=155:nb_frames=45
  2760. @end example
  2761. @item
  2762. Fade in first 25 frames and fade out last 25 frames of a 1000-frame video:
  2763. @example
  2764. fade=in:0:25, fade=out:975:25
  2765. @end example
  2766. @item
  2767. Make first 5 frames black, then fade in from frame 5-24:
  2768. @example
  2769. fade=in:5:20
  2770. @end example
  2771. @item
  2772. Fade in alpha over first 25 frames of video:
  2773. @example
  2774. fade=in:0:25:alpha=1
  2775. @end example
  2776. @item
  2777. Make first 5.5 seconds black, then fade in for 0.5 seconds:
  2778. @example
  2779. fade=t=in:st=5.5:d=0.5
  2780. @end example
  2781. @end itemize
  2782. @section field
  2783. Extract a single field from an interlaced image using stride
  2784. arithmetic to avoid wasting CPU time. The output frames are marked as
  2785. non-interlaced.
  2786. The filter accepts the following options:
  2787. @table @option
  2788. @item type
  2789. Specify whether to extract the top (if the value is @code{0} or
  2790. @code{top}) or the bottom field (if the value is @code{1} or
  2791. @code{bottom}).
  2792. @end table
  2793. @section fieldmatch
  2794. Field matching filter for inverse telecine. It is meant to reconstruct the
  2795. progressive frames from a telecined stream. The filter does not drop duplicated
  2796. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  2797. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  2798. The separation of the field matching and the decimation is notably motivated by
  2799. the possibility of inserting a de-interlacing filter fallback between the two.
  2800. If the source has mixed telecined and real interlaced content,
  2801. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  2802. But these remaining combed frames will be marked as interlaced, and thus can be
  2803. de-interlaced by a later filter such as @ref{yadif} before decimation.
  2804. In addition to the various configuration options, @code{fieldmatch} can take an
  2805. optional second stream, activated through the @option{ppsrc} option. If
  2806. enabled, the frames reconstruction will be based on the fields and frames from
  2807. this second stream. This allows the first input to be pre-processed in order to
  2808. help the various algorithms of the filter, while keeping the output lossless
  2809. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  2810. or brightness/contrast adjustments can help.
  2811. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  2812. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  2813. which @code{fieldmatch} is based on. While the semantic and usage are very
  2814. close, some behaviour and options names can differ.
  2815. The filter accepts the following options:
  2816. @table @option
  2817. @item order
  2818. Specify the assumed field order of the input stream. Available values are:
  2819. @table @samp
  2820. @item auto
  2821. Auto detect parity (use FFmpeg's internal parity value).
  2822. @item bff
  2823. Assume bottom field first.
  2824. @item tff
  2825. Assume top field first.
  2826. @end table
  2827. Note that it is sometimes recommended not to trust the parity announced by the
  2828. stream.
  2829. Default value is @var{auto}.
  2830. @item mode
  2831. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  2832. sense that it won't risk creating jerkiness due to duplicate frames when
  2833. possible, but if there are bad edits or blended fields it will end up
  2834. outputting combed frames when a good match might actually exist. On the other
  2835. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  2836. but will almost always find a good frame if there is one. The other values are
  2837. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  2838. jerkiness and creating duplicate frames versus finding good matches in sections
  2839. with bad edits, orphaned fields, blended fields, etc.
  2840. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  2841. Available values are:
  2842. @table @samp
  2843. @item pc
  2844. 2-way matching (p/c)
  2845. @item pc_n
  2846. 2-way matching, and trying 3rd match if still combed (p/c + n)
  2847. @item pc_u
  2848. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  2849. @item pc_n_ub
  2850. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  2851. still combed (p/c + n + u/b)
  2852. @item pcn
  2853. 3-way matching (p/c/n)
  2854. @item pcn_ub
  2855. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  2856. detected as combed (p/c/n + u/b)
  2857. @end table
  2858. The parenthesis at the end indicate the matches that would be used for that
  2859. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  2860. @var{top}).
  2861. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  2862. the slowest.
  2863. Default value is @var{pc_n}.
  2864. @item ppsrc
  2865. Mark the main input stream as a pre-processed input, and enable the secondary
  2866. input stream as the clean source to pick the fields from. See the filter
  2867. introduction for more details. It is similar to the @option{clip2} feature from
  2868. VFM/TFM.
  2869. Default value is @code{0} (disabled).
  2870. @item field
  2871. Set the field to match from. It is recommended to set this to the same value as
  2872. @option{order} unless you experience matching failures with that setting. In
  2873. certain circumstances changing the field that is used to match from can have a
  2874. large impact on matching performance. Available values are:
  2875. @table @samp
  2876. @item auto
  2877. Automatic (same value as @option{order}).
  2878. @item bottom
  2879. Match from the bottom field.
  2880. @item top
  2881. Match from the top field.
  2882. @end table
  2883. Default value is @var{auto}.
  2884. @item mchroma
  2885. Set whether or not chroma is included during the match comparisons. In most
  2886. cases it is recommended to leave this enabled. You should set this to @code{0}
  2887. only if your clip has bad chroma problems such as heavy rainbowing or other
  2888. artifacts. Setting this to @code{0} could also be used to speed things up at
  2889. the cost of some accuracy.
  2890. Default value is @code{1}.
  2891. @item y0
  2892. @item y1
  2893. These define an exclusion band which excludes the lines between @option{y0} and
  2894. @option{y1} from being included in the field matching decision. An exclusion
  2895. band can be used to ignore subtitles, a logo, or other things that may
  2896. interfere with the matching. @option{y0} sets the starting scan line and
  2897. @option{y1} sets the ending line; all lines in between @option{y0} and
  2898. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  2899. @option{y0} and @option{y1} to the same value will disable the feature.
  2900. @option{y0} and @option{y1} defaults to @code{0}.
  2901. @item scthresh
  2902. Set the scene change detection threshold as a percentage of maximum change on
  2903. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  2904. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  2905. @option{scthresh} is @code{[0.0, 100.0]}.
  2906. Default value is @code{12.0}.
  2907. @item combmatch
  2908. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  2909. account the combed scores of matches when deciding what match to use as the
  2910. final match. Available values are:
  2911. @table @samp
  2912. @item none
  2913. No final matching based on combed scores.
  2914. @item sc
  2915. Combed scores are only used when a scene change is detected.
  2916. @item full
  2917. Use combed scores all the time.
  2918. @end table
  2919. Default is @var{sc}.
  2920. @item combdbg
  2921. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  2922. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  2923. Available values are:
  2924. @table @samp
  2925. @item none
  2926. No forced calculation.
  2927. @item pcn
  2928. Force p/c/n calculations.
  2929. @item pcnub
  2930. Force p/c/n/u/b calculations.
  2931. @end table
  2932. Default value is @var{none}.
  2933. @item cthresh
  2934. This is the area combing threshold used for combed frame detection. This
  2935. essentially controls how "strong" or "visible" combing must be to be detected.
  2936. Larger values mean combing must be more visible and smaller values mean combing
  2937. can be less visible or strong and still be detected. Valid settings are from
  2938. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  2939. be detected as combed). This is basically a pixel difference value. A good
  2940. range is @code{[8, 12]}.
  2941. Default value is @code{9}.
  2942. @item chroma
  2943. Sets whether or not chroma is considered in the combed frame decision. Only
  2944. disable this if your source has chroma problems (rainbowing, etc.) that are
  2945. causing problems for the combed frame detection with chroma enabled. Actually,
  2946. using @option{chroma}=@var{0} is usually more reliable, except for the case
  2947. where there is chroma only combing in the source.
  2948. Default value is @code{0}.
  2949. @item blockx
  2950. @item blocky
  2951. Respectively set the x-axis and y-axis size of the window used during combed
  2952. frame detection. This has to do with the size of the area in which
  2953. @option{combpel} pixels are required to be detected as combed for a frame to be
  2954. declared combed. See the @option{combpel} parameter description for more info.
  2955. Possible values are any number that is a power of 2 starting at 4 and going up
  2956. to 512.
  2957. Default value is @code{16}.
  2958. @item combpel
  2959. The number of combed pixels inside any of the @option{blocky} by
  2960. @option{blockx} size blocks on the frame for the frame to be detected as
  2961. combed. While @option{cthresh} controls how "visible" the combing must be, this
  2962. setting controls "how much" combing there must be in any localized area (a
  2963. window defined by the @option{blockx} and @option{blocky} settings) on the
  2964. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  2965. which point no frames will ever be detected as combed). This setting is known
  2966. as @option{MI} in TFM/VFM vocabulary.
  2967. Default value is @code{80}.
  2968. @end table
  2969. @anchor{p/c/n/u/b meaning}
  2970. @subsection p/c/n/u/b meaning
  2971. @subsubsection p/c/n
  2972. We assume the following telecined stream:
  2973. @example
  2974. Top fields: 1 2 2 3 4
  2975. Bottom fields: 1 2 3 4 4
  2976. @end example
  2977. The numbers correspond to the progressive frame the fields relate to. Here, the
  2978. first two frames are progressive, the 3rd and 4th are combed, and so on.
  2979. When @code{fieldmatch} is configured to run a matching from bottom
  2980. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  2981. @example
  2982. Input stream:
  2983. T 1 2 2 3 4
  2984. B 1 2 3 4 4 <-- matching reference
  2985. Matches: c c n n c
  2986. Output stream:
  2987. T 1 2 3 4 4
  2988. B 1 2 3 4 4
  2989. @end example
  2990. As a result of the field matching, we can see that some frames get duplicated.
  2991. To perform a complete inverse telecine, you need to rely on a decimation filter
  2992. after this operation. See for instance the @ref{decimate} filter.
  2993. The same operation now matching from top fields (@option{field}=@var{top})
  2994. looks like this:
  2995. @example
  2996. Input stream:
  2997. T 1 2 2 3 4 <-- matching reference
  2998. B 1 2 3 4 4
  2999. Matches: c c p p c
  3000. Output stream:
  3001. T 1 2 2 3 4
  3002. B 1 2 2 3 4
  3003. @end example
  3004. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  3005. basically, they refer to the frame and field of the opposite parity:
  3006. @itemize
  3007. @item @var{p} matches the field of the opposite parity in the previous frame
  3008. @item @var{c} matches the field of the opposite parity in the current frame
  3009. @item @var{n} matches the field of the opposite parity in the next frame
  3010. @end itemize
  3011. @subsubsection u/b
  3012. The @var{u} and @var{b} matching are a bit special in the sense that they match
  3013. from the opposite parity flag. In the following examples, we assume that we are
  3014. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  3015. 'x' is placed above and below each matched fields.
  3016. With bottom matching (@option{field}=@var{bottom}):
  3017. @example
  3018. Match: c p n b u
  3019. x x x x x
  3020. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3021. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3022. x x x x x
  3023. Output frames:
  3024. 2 1 2 2 2
  3025. 2 2 2 1 3
  3026. @end example
  3027. With top matching (@option{field}=@var{top}):
  3028. @example
  3029. Match: c p n b u
  3030. x x x x x
  3031. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3032. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3033. x x x x x
  3034. Output frames:
  3035. 2 2 2 1 2
  3036. 2 1 3 2 2
  3037. @end example
  3038. @subsection Examples
  3039. Simple IVTC of a top field first telecined stream:
  3040. @example
  3041. fieldmatch=order=tff:combmatch=none, decimate
  3042. @end example
  3043. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  3044. @example
  3045. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  3046. @end example
  3047. @section fieldorder
  3048. Transform the field order of the input video.
  3049. This filter accepts the following options:
  3050. @table @option
  3051. @item order
  3052. Output field order. Valid values are @var{tff} for top field first or @var{bff}
  3053. for bottom field first.
  3054. @end table
  3055. Default value is @samp{tff}.
  3056. Transformation is achieved by shifting the picture content up or down
  3057. by one line, and filling the remaining line with appropriate picture content.
  3058. This method is consistent with most broadcast field order converters.
  3059. If the input video is not flagged as being interlaced, or it is already
  3060. flagged as being of the required output field order then this filter does
  3061. not alter the incoming video.
  3062. This filter is very useful when converting to or from PAL DV material,
  3063. which is bottom field first.
  3064. For example:
  3065. @example
  3066. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  3067. @end example
  3068. @section fifo
  3069. Buffer input images and send them when they are requested.
  3070. This filter is mainly useful when auto-inserted by the libavfilter
  3071. framework.
  3072. The filter does not take parameters.
  3073. @anchor{format}
  3074. @section format
  3075. Convert the input video to one of the specified pixel formats.
  3076. Libavfilter will try to pick one that is supported for the input to
  3077. the next filter.
  3078. This filter accepts the following parameters:
  3079. @table @option
  3080. @item pix_fmts
  3081. A '|'-separated list of pixel format names, for example
  3082. "pix_fmts=yuv420p|monow|rgb24".
  3083. @end table
  3084. @subsection Examples
  3085. @itemize
  3086. @item
  3087. Convert the input video to the format @var{yuv420p}
  3088. @example
  3089. format=pix_fmts=yuv420p
  3090. @end example
  3091. Convert the input video to any of the formats in the list
  3092. @example
  3093. format=pix_fmts=yuv420p|yuv444p|yuv410p
  3094. @end example
  3095. @end itemize
  3096. @section fps
  3097. Convert the video to specified constant frame rate by duplicating or dropping
  3098. frames as necessary.
  3099. This filter accepts the following named parameters:
  3100. @table @option
  3101. @item fps
  3102. Desired output frame rate. The default is @code{25}.
  3103. @item round
  3104. Rounding method.
  3105. Possible values are:
  3106. @table @option
  3107. @item zero
  3108. zero round towards 0
  3109. @item inf
  3110. round away from 0
  3111. @item down
  3112. round towards -infinity
  3113. @item up
  3114. round towards +infinity
  3115. @item near
  3116. round to nearest
  3117. @end table
  3118. The default is @code{near}.
  3119. @end table
  3120. Alternatively, the options can be specified as a flat string:
  3121. @var{fps}[:@var{round}].
  3122. See also the @ref{setpts} filter.
  3123. @subsection Examples
  3124. @itemize
  3125. @item
  3126. A typical usage in order to set the fps to 25:
  3127. @example
  3128. fps=fps=25
  3129. @end example
  3130. @item
  3131. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  3132. @example
  3133. fps=fps=film:round=near
  3134. @end example
  3135. @end itemize
  3136. @section framestep
  3137. Select one frame every N-th frame.
  3138. This filter accepts the following option:
  3139. @table @option
  3140. @item step
  3141. Select frame after every @code{step} frames.
  3142. Allowed values are positive integers higher than 0. Default value is @code{1}.
  3143. @end table
  3144. @anchor{frei0r}
  3145. @section frei0r
  3146. Apply a frei0r effect to the input video.
  3147. To enable compilation of this filter you need to install the frei0r
  3148. header and configure FFmpeg with @code{--enable-frei0r}.
  3149. This filter accepts the following options:
  3150. @table @option
  3151. @item filter_name
  3152. The name to the frei0r effect to load. If the environment variable
  3153. @env{FREI0R_PATH} is defined, the frei0r effect is searched in each one of the
  3154. directories specified by the colon separated list in @env{FREIOR_PATH},
  3155. otherwise in the standard frei0r paths, which are in this order:
  3156. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  3157. @file{/usr/lib/frei0r-1/}.
  3158. @item filter_params
  3159. A '|'-separated list of parameters to pass to the frei0r effect.
  3160. @end table
  3161. A frei0r effect parameter can be a boolean (whose values are specified
  3162. with "y" and "n"), a double, a color (specified by the syntax
  3163. @var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
  3164. numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
  3165. description), a position (specified by the syntax @var{X}/@var{Y},
  3166. @var{X} and @var{Y} being float numbers) and a string.
  3167. The number and kind of parameters depend on the loaded effect. If an
  3168. effect parameter is not specified the default value is set.
  3169. @subsection Examples
  3170. @itemize
  3171. @item
  3172. Apply the distort0r effect, set the first two double parameters:
  3173. @example
  3174. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  3175. @end example
  3176. @item
  3177. Apply the colordistance effect, take a color as first parameter:
  3178. @example
  3179. frei0r=colordistance:0.2/0.3/0.4
  3180. frei0r=colordistance:violet
  3181. frei0r=colordistance:0x112233
  3182. @end example
  3183. @item
  3184. Apply the perspective effect, specify the top left and top right image
  3185. positions:
  3186. @example
  3187. frei0r=perspective:0.2/0.2|0.8/0.2
  3188. @end example
  3189. @end itemize
  3190. For more information see:
  3191. @url{http://frei0r.dyne.org}
  3192. @section geq
  3193. The filter accepts the following options:
  3194. @table @option
  3195. @item lum_expr, lum
  3196. Set the luminance expression.
  3197. @item cb_expr, cb
  3198. Set the chrominance blue expression.
  3199. @item cr_expr, cr
  3200. Set the chrominance red expression.
  3201. @item alpha_expr, a
  3202. Set the alpha expression.
  3203. @item red_expr, r
  3204. Set the red expression.
  3205. @item green_expr, g
  3206. Set the green expression.
  3207. @item blue_expr, b
  3208. Set the blue expression.
  3209. @end table
  3210. The colorspace is selected according to the specified options. If one
  3211. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  3212. options is specified, the filter will automatically select a YCbCr
  3213. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  3214. @option{blue_expr} options is specified, it will select an RGB
  3215. colorspace.
  3216. If one of the chrominance expression is not defined, it falls back on the other
  3217. one. If no alpha expression is specified it will evaluate to opaque value.
  3218. If none of chrominance expressions are specified, they will evaluate
  3219. to the luminance expression.
  3220. The expressions can use the following variables and functions:
  3221. @table @option
  3222. @item N
  3223. The sequential number of the filtered frame, starting from @code{0}.
  3224. @item X
  3225. @item Y
  3226. The coordinates of the current sample.
  3227. @item W
  3228. @item H
  3229. The width and height of the image.
  3230. @item SW
  3231. @item SH
  3232. Width and height scale depending on the currently filtered plane. It is the
  3233. ratio between the corresponding luma plane number of pixels and the current
  3234. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3235. @code{0.5,0.5} for chroma planes.
  3236. @item T
  3237. Time of the current frame, expressed in seconds.
  3238. @item p(x, y)
  3239. Return the value of the pixel at location (@var{x},@var{y}) of the current
  3240. plane.
  3241. @item lum(x, y)
  3242. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  3243. plane.
  3244. @item cb(x, y)
  3245. Return the value of the pixel at location (@var{x},@var{y}) of the
  3246. blue-difference chroma plane. Return 0 if there is no such plane.
  3247. @item cr(x, y)
  3248. Return the value of the pixel at location (@var{x},@var{y}) of the
  3249. red-difference chroma plane. Return 0 if there is no such plane.
  3250. @item r(x, y)
  3251. @item g(x, y)
  3252. @item b(x, y)
  3253. Return the value of the pixel at location (@var{x},@var{y}) of the
  3254. red/green/blue component. Return 0 if there is no such component.
  3255. @item alpha(x, y)
  3256. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  3257. plane. Return 0 if there is no such plane.
  3258. @end table
  3259. For functions, if @var{x} and @var{y} are outside the area, the value will be
  3260. automatically clipped to the closer edge.
  3261. @subsection Examples
  3262. @itemize
  3263. @item
  3264. Flip the image horizontally:
  3265. @example
  3266. geq=p(W-X\,Y)
  3267. @end example
  3268. @item
  3269. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  3270. wavelength of 100 pixels:
  3271. @example
  3272. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  3273. @end example
  3274. @item
  3275. Generate a fancy enigmatic moving light:
  3276. @example
  3277. nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
  3278. @end example
  3279. @item
  3280. Generate a quick emboss effect:
  3281. @example
  3282. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  3283. @end example
  3284. @item
  3285. Modify RGB components depending on pixel position:
  3286. @example
  3287. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  3288. @end example
  3289. @end itemize
  3290. @section gradfun
  3291. Fix the banding artifacts that are sometimes introduced into nearly flat
  3292. regions by truncation to 8bit color depth.
  3293. Interpolate the gradients that should go where the bands are, and
  3294. dither them.
  3295. This filter is designed for playback only. Do not use it prior to
  3296. lossy compression, because compression tends to lose the dither and
  3297. bring back the bands.
  3298. This filter accepts the following options:
  3299. @table @option
  3300. @item strength
  3301. The maximum amount by which the filter will change any one pixel. Also the
  3302. threshold for detecting nearly flat regions. Acceptable values range from .51 to
  3303. 64, default value is 1.2, out-of-range values will be clipped to the valid
  3304. range.
  3305. @item radius
  3306. The neighborhood to fit the gradient to. A larger radius makes for smoother
  3307. gradients, but also prevents the filter from modifying the pixels near detailed
  3308. regions. Acceptable values are 8-32, default value is 16, out-of-range values
  3309. will be clipped to the valid range.
  3310. @end table
  3311. Alternatively, the options can be specified as a flat string:
  3312. @var{strength}[:@var{radius}]
  3313. @subsection Examples
  3314. @itemize
  3315. @item
  3316. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  3317. @example
  3318. gradfun=3.5:8
  3319. @end example
  3320. @item
  3321. Specify radius, omitting the strength (which will fall-back to the default
  3322. value):
  3323. @example
  3324. gradfun=radius=8
  3325. @end example
  3326. @end itemize
  3327. @anchor{haldclut}
  3328. @section haldclut
  3329. Apply a Hald CLUT to a video stream.
  3330. First input is the video stream to process, and second one is the Hald CLUT.
  3331. The Hald CLUT input can be a simple picture or a complete video stream.
  3332. The filter accepts the following options:
  3333. @table @option
  3334. @item shortest
  3335. Force termination when the shortest input terminates. Default is @code{0}.
  3336. @item repeatlast
  3337. Continue applying the last CLUT after the end of the stream. A value of
  3338. @code{0} disable the filter after the last frame of the CLUT is reached.
  3339. Default is @code{1}.
  3340. @end table
  3341. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  3342. filters share the same internals).
  3343. More information about the Hald CLUT can be found on Eskil Steenberg's website
  3344. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  3345. @subsection Workflow examples
  3346. @subsubsection Hald CLUT video stream
  3347. Generate an identity Hald CLUT stream altered with various effects:
  3348. @example
  3349. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
  3350. @end example
  3351. Note: make sure you use a lossless codec.
  3352. Then use it with @code{haldclut} to apply it on some random stream:
  3353. @example
  3354. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  3355. @end example
  3356. The Hald CLUT will be applied to the 10 first seconds (duration of
  3357. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  3358. to the remaining frames of the @code{mandelbrot} stream.
  3359. @subsubsection Hald CLUT with preview
  3360. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  3361. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  3362. biggest possible square starting at the top left of the picture. The remaining
  3363. padding pixels (bottom or right) will be ignored. This area can be used to add
  3364. a preview of the Hald CLUT.
  3365. Typically, the following generated Hald CLUT will be supported by the
  3366. @code{haldclut} filter:
  3367. @example
  3368. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  3369. pad=iw+320 [padded_clut];
  3370. smptebars=s=320x256, split [a][b];
  3371. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  3372. [main][b] overlay=W-320" -frames:v 1 clut.png
  3373. @end example
  3374. It contains the original and a preview of the effect of the CLUT: SMPTE color
  3375. bars are displayed on the right-top, and below the same color bars processed by
  3376. the color changes.
  3377. Then, the effect of this Hald CLUT can be visualized with:
  3378. @example
  3379. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  3380. @end example
  3381. @section hflip
  3382. Flip the input video horizontally.
  3383. For example to horizontally flip the input video with @command{ffmpeg}:
  3384. @example
  3385. ffmpeg -i in.avi -vf "hflip" out.avi
  3386. @end example
  3387. @section histeq
  3388. This filter applies a global color histogram equalization on a
  3389. per-frame basis.
  3390. It can be used to correct video that has a compressed range of pixel
  3391. intensities. The filter redistributes the pixel intensities to
  3392. equalize their distribution across the intensity range. It may be
  3393. viewed as an "automatically adjusting contrast filter". This filter is
  3394. useful only for correcting degraded or poorly captured source
  3395. video.
  3396. The filter accepts the following options:
  3397. @table @option
  3398. @item strength
  3399. Determine the amount of equalization to be applied. As the strength
  3400. is reduced, the distribution of pixel intensities more-and-more
  3401. approaches that of the input frame. The value must be a float number
  3402. in the range [0,1] and defaults to 0.200.
  3403. @item intensity
  3404. Set the maximum intensity that can generated and scale the output
  3405. values appropriately. The strength should be set as desired and then
  3406. the intensity can be limited if needed to avoid washing-out. The value
  3407. must be a float number in the range [0,1] and defaults to 0.210.
  3408. @item antibanding
  3409. Set the antibanding level. If enabled the filter will randomly vary
  3410. the luminance of output pixels by a small amount to avoid banding of
  3411. the histogram. Possible values are @code{none}, @code{weak} or
  3412. @code{strong}. It defaults to @code{none}.
  3413. @end table
  3414. @section histogram
  3415. Compute and draw a color distribution histogram for the input video.
  3416. The computed histogram is a representation of distribution of color components
  3417. in an image.
  3418. The filter accepts the following options:
  3419. @table @option
  3420. @item mode
  3421. Set histogram mode.
  3422. It accepts the following values:
  3423. @table @samp
  3424. @item levels
  3425. standard histogram that display color components distribution in an image.
  3426. Displays color graph for each color component. Shows distribution
  3427. of the Y, U, V, A or G, B, R components, depending on input format,
  3428. in current frame. Bellow each graph is color component scale meter.
  3429. @item color
  3430. chroma values in vectorscope, if brighter more such chroma values are
  3431. distributed in an image.
  3432. Displays chroma values (U/V color placement) in two dimensional graph
  3433. (which is called a vectorscope). It can be used to read of the hue and
  3434. saturation of the current frame. At a same time it is a histogram.
  3435. The whiter a pixel in the vectorscope, the more pixels of the input frame
  3436. correspond to that pixel (that is the more pixels have this chroma value).
  3437. The V component is displayed on the horizontal (X) axis, with the leftmost
  3438. side being V = 0 and the rightmost side being V = 255.
  3439. The U component is displayed on the vertical (Y) axis, with the top
  3440. representing U = 0 and the bottom representing U = 255.
  3441. The position of a white pixel in the graph corresponds to the chroma value
  3442. of a pixel of the input clip. So the graph can be used to read of the
  3443. hue (color flavor) and the saturation (the dominance of the hue in the color).
  3444. As the hue of a color changes, it moves around the square. At the center of
  3445. the square, the saturation is zero, which means that the corresponding pixel
  3446. has no color. If you increase the amount of a specific color, while leaving
  3447. the other colors unchanged, the saturation increases, and you move towards
  3448. the edge of the square.
  3449. @item color2
  3450. chroma values in vectorscope, similar as @code{color} but actual chroma values
  3451. are displayed.
  3452. @item waveform
  3453. per row/column color component graph. In row mode graph in the left side represents
  3454. color component value 0 and right side represents value = 255. In column mode top
  3455. side represents color component value = 0 and bottom side represents value = 255.
  3456. @end table
  3457. Default value is @code{levels}.
  3458. @item level_height
  3459. Set height of level in @code{levels}. Default value is @code{200}.
  3460. Allowed range is [50, 2048].
  3461. @item scale_height
  3462. Set height of color scale in @code{levels}. Default value is @code{12}.
  3463. Allowed range is [0, 40].
  3464. @item step
  3465. Set step for @code{waveform} mode. Smaller values are useful to find out how much
  3466. of same luminance values across input rows/columns are distributed.
  3467. Default value is @code{10}. Allowed range is [1, 255].
  3468. @item waveform_mode
  3469. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  3470. Default is @code{row}.
  3471. @item display_mode
  3472. Set display mode for @code{waveform} and @code{levels}.
  3473. It accepts the following values:
  3474. @table @samp
  3475. @item parade
  3476. Display separate graph for the color components side by side in
  3477. @code{row} waveform mode or one below other in @code{column} waveform mode
  3478. for @code{waveform} histogram mode. For @code{levels} histogram mode
  3479. per color component graphs are placed one bellow other.
  3480. This display mode in @code{waveform} histogram mode makes it easy to spot
  3481. color casts in the highlights and shadows of an image, by comparing the
  3482. contours of the top and the bottom of each waveform.
  3483. Since whites, grays, and blacks are characterized by
  3484. exactly equal amounts of red, green, and blue, neutral areas of the
  3485. picture should display three waveforms of roughly equal width/height.
  3486. If not, the correction is easy to make by making adjustments to level the
  3487. three waveforms.
  3488. @item overlay
  3489. Presents information that's identical to that in the @code{parade}, except
  3490. that the graphs representing color components are superimposed directly
  3491. over one another.
  3492. This display mode in @code{waveform} histogram mode can make it easier to spot
  3493. the relative differences or similarities in overlapping areas of the color
  3494. components that are supposed to be identical, such as neutral whites, grays,
  3495. or blacks.
  3496. @end table
  3497. Default is @code{parade}.
  3498. @item levels_mode
  3499. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  3500. Default is @code{linear}.
  3501. @end table
  3502. @subsection Examples
  3503. @itemize
  3504. @item
  3505. Calculate and draw histogram:
  3506. @example
  3507. ffplay -i input -vf histogram
  3508. @end example
  3509. @end itemize
  3510. @anchor{hqdn3d}
  3511. @section hqdn3d
  3512. High precision/quality 3d denoise filter. This filter aims to reduce
  3513. image noise producing smooth images and making still images really
  3514. still. It should enhance compressibility.
  3515. It accepts the following optional parameters:
  3516. @table @option
  3517. @item luma_spatial
  3518. a non-negative float number which specifies spatial luma strength,
  3519. defaults to 4.0
  3520. @item chroma_spatial
  3521. a non-negative float number which specifies spatial chroma strength,
  3522. defaults to 3.0*@var{luma_spatial}/4.0
  3523. @item luma_tmp
  3524. a float number which specifies luma temporal strength, defaults to
  3525. 6.0*@var{luma_spatial}/4.0
  3526. @item chroma_tmp
  3527. a float number which specifies chroma temporal strength, defaults to
  3528. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
  3529. @end table
  3530. @section hue
  3531. Modify the hue and/or the saturation of the input.
  3532. This filter accepts the following options:
  3533. @table @option
  3534. @item h
  3535. Specify the hue angle as a number of degrees. It accepts an expression,
  3536. and defaults to "0".
  3537. @item s
  3538. Specify the saturation in the [-10,10] range. It accepts an expression and
  3539. defaults to "1".
  3540. @item H
  3541. Specify the hue angle as a number of radians. It accepts an
  3542. expression, and defaults to "0".
  3543. @end table
  3544. @option{h} and @option{H} are mutually exclusive, and can't be
  3545. specified at the same time.
  3546. The @option{h}, @option{H} and @option{s} option values are
  3547. expressions containing the following constants:
  3548. @table @option
  3549. @item n
  3550. frame count of the input frame starting from 0
  3551. @item pts
  3552. presentation timestamp of the input frame expressed in time base units
  3553. @item r
  3554. frame rate of the input video, NAN if the input frame rate is unknown
  3555. @item t
  3556. timestamp expressed in seconds, NAN if the input timestamp is unknown
  3557. @item tb
  3558. time base of the input video
  3559. @end table
  3560. @subsection Examples
  3561. @itemize
  3562. @item
  3563. Set the hue to 90 degrees and the saturation to 1.0:
  3564. @example
  3565. hue=h=90:s=1
  3566. @end example
  3567. @item
  3568. Same command but expressing the hue in radians:
  3569. @example
  3570. hue=H=PI/2:s=1
  3571. @end example
  3572. @item
  3573. Rotate hue and make the saturation swing between 0
  3574. and 2 over a period of 1 second:
  3575. @example
  3576. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  3577. @end example
  3578. @item
  3579. Apply a 3 seconds saturation fade-in effect starting at 0:
  3580. @example
  3581. hue="s=min(t/3\,1)"
  3582. @end example
  3583. The general fade-in expression can be written as:
  3584. @example
  3585. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  3586. @end example
  3587. @item
  3588. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  3589. @example
  3590. hue="s=max(0\, min(1\, (8-t)/3))"
  3591. @end example
  3592. The general fade-out expression can be written as:
  3593. @example
  3594. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  3595. @end example
  3596. @end itemize
  3597. @subsection Commands
  3598. This filter supports the following commands:
  3599. @table @option
  3600. @item s
  3601. @item h
  3602. @item H
  3603. Modify the hue and/or the saturation of the input video.
  3604. The command accepts the same syntax of the corresponding option.
  3605. If the specified expression is not valid, it is kept at its current
  3606. value.
  3607. @end table
  3608. @section idet
  3609. Detect video interlacing type.
  3610. This filter tries to detect if the input is interlaced or progressive,
  3611. top or bottom field first.
  3612. The filter accepts the following options:
  3613. @table @option
  3614. @item intl_thres
  3615. Set interlacing threshold.
  3616. @item prog_thres
  3617. Set progressive threshold.
  3618. @end table
  3619. @section il
  3620. Deinterleave or interleave fields.
  3621. This filter allows to process interlaced images fields without
  3622. deinterlacing them. Deinterleaving splits the input frame into 2
  3623. fields (so called half pictures). Odd lines are moved to the top
  3624. half of the output image, even lines to the bottom half.
  3625. You can process (filter) them independently and then re-interleave them.
  3626. The filter accepts the following options:
  3627. @table @option
  3628. @item luma_mode, l
  3629. @item chroma_mode, c
  3630. @item alpha_mode, a
  3631. Available values for @var{luma_mode}, @var{chroma_mode} and
  3632. @var{alpha_mode} are:
  3633. @table @samp
  3634. @item none
  3635. Do nothing.
  3636. @item deinterleave, d
  3637. Deinterleave fields, placing one above the other.
  3638. @item interleave, i
  3639. Interleave fields. Reverse the effect of deinterleaving.
  3640. @end table
  3641. Default value is @code{none}.
  3642. @item luma_swap, ls
  3643. @item chroma_swap, cs
  3644. @item alpha_swap, as
  3645. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  3646. @end table
  3647. @section interlace
  3648. Simple interlacing filter from progressive contents. This interleaves upper (or
  3649. lower) lines from odd frames with lower (or upper) lines from even frames,
  3650. halving the frame rate and preserving image height.
  3651. @example
  3652. Original Original New Frame
  3653. Frame 'j' Frame 'j+1' (tff)
  3654. ========== =========== ==================
  3655. Line 0 --------------------> Frame 'j' Line 0
  3656. Line 1 Line 1 ----> Frame 'j+1' Line 1
  3657. Line 2 ---------------------> Frame 'j' Line 2
  3658. Line 3 Line 3 ----> Frame 'j+1' Line 3
  3659. ... ... ...
  3660. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  3661. @end example
  3662. It accepts the following optional parameters:
  3663. @table @option
  3664. @item scan
  3665. determines whether the interlaced frame is taken from the even (tff - default)
  3666. or odd (bff) lines of the progressive frame.
  3667. @item lowpass
  3668. Enable (default) or disable the vertical lowpass filter to avoid twitter
  3669. interlacing and reduce moire patterns.
  3670. @end table
  3671. @section kerndeint
  3672. Deinterlace input video by applying Donald Graft's adaptive kernel
  3673. deinterling. Work on interlaced parts of a video to produce
  3674. progressive frames.
  3675. The description of the accepted parameters follows.
  3676. @table @option
  3677. @item thresh
  3678. Set the threshold which affects the filter's tolerance when
  3679. determining if a pixel line must be processed. It must be an integer
  3680. in the range [0,255] and defaults to 10. A value of 0 will result in
  3681. applying the process on every pixels.
  3682. @item map
  3683. Paint pixels exceeding the threshold value to white if set to 1.
  3684. Default is 0.
  3685. @item order
  3686. Set the fields order. Swap fields if set to 1, leave fields alone if
  3687. 0. Default is 0.
  3688. @item sharp
  3689. Enable additional sharpening if set to 1. Default is 0.
  3690. @item twoway
  3691. Enable twoway sharpening if set to 1. Default is 0.
  3692. @end table
  3693. @subsection Examples
  3694. @itemize
  3695. @item
  3696. Apply default values:
  3697. @example
  3698. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  3699. @end example
  3700. @item
  3701. Enable additional sharpening:
  3702. @example
  3703. kerndeint=sharp=1
  3704. @end example
  3705. @item
  3706. Paint processed pixels in white:
  3707. @example
  3708. kerndeint=map=1
  3709. @end example
  3710. @end itemize
  3711. @anchor{lut3d}
  3712. @section lut3d
  3713. Apply a 3D LUT to an input video.
  3714. The filter accepts the following options:
  3715. @table @option
  3716. @item file
  3717. Set the 3D LUT file name.
  3718. Currently supported formats:
  3719. @table @samp
  3720. @item 3dl
  3721. AfterEffects
  3722. @item cube
  3723. Iridas
  3724. @item dat
  3725. DaVinci
  3726. @item m3d
  3727. Pandora
  3728. @end table
  3729. @item interp
  3730. Select interpolation mode.
  3731. Available values are:
  3732. @table @samp
  3733. @item nearest
  3734. Use values from the nearest defined point.
  3735. @item trilinear
  3736. Interpolate values using the 8 points defining a cube.
  3737. @item tetrahedral
  3738. Interpolate values using a tetrahedron.
  3739. @end table
  3740. @end table
  3741. @section lut, lutrgb, lutyuv
  3742. Compute a look-up table for binding each pixel component input value
  3743. to an output value, and apply it to input video.
  3744. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  3745. to an RGB input video.
  3746. These filters accept the following options:
  3747. @table @option
  3748. @item c0
  3749. set first pixel component expression
  3750. @item c1
  3751. set second pixel component expression
  3752. @item c2
  3753. set third pixel component expression
  3754. @item c3
  3755. set fourth pixel component expression, corresponds to the alpha component
  3756. @item r
  3757. set red component expression
  3758. @item g
  3759. set green component expression
  3760. @item b
  3761. set blue component expression
  3762. @item a
  3763. alpha component expression
  3764. @item y
  3765. set Y/luminance component expression
  3766. @item u
  3767. set U/Cb component expression
  3768. @item v
  3769. set V/Cr component expression
  3770. @end table
  3771. Each of them specifies the expression to use for computing the lookup table for
  3772. the corresponding pixel component values.
  3773. The exact component associated to each of the @var{c*} options depends on the
  3774. format in input.
  3775. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  3776. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  3777. The expressions can contain the following constants and functions:
  3778. @table @option
  3779. @item w
  3780. @item h
  3781. the input width and height
  3782. @item val
  3783. input value for the pixel component
  3784. @item clipval
  3785. the input value clipped in the @var{minval}-@var{maxval} range
  3786. @item maxval
  3787. maximum value for the pixel component
  3788. @item minval
  3789. minimum value for the pixel component
  3790. @item negval
  3791. the negated value for the pixel component value clipped in the
  3792. @var{minval}-@var{maxval} range , it corresponds to the expression
  3793. "maxval-clipval+minval"
  3794. @item clip(val)
  3795. the computed value in @var{val} clipped in the
  3796. @var{minval}-@var{maxval} range
  3797. @item gammaval(gamma)
  3798. the computed gamma correction value of the pixel component value
  3799. clipped in the @var{minval}-@var{maxval} range, corresponds to the
  3800. expression
  3801. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  3802. @end table
  3803. All expressions default to "val".
  3804. @subsection Examples
  3805. @itemize
  3806. @item
  3807. Negate input video:
  3808. @example
  3809. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  3810. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  3811. @end example
  3812. The above is the same as:
  3813. @example
  3814. lutrgb="r=negval:g=negval:b=negval"
  3815. lutyuv="y=negval:u=negval:v=negval"
  3816. @end example
  3817. @item
  3818. Negate luminance:
  3819. @example
  3820. lutyuv=y=negval
  3821. @end example
  3822. @item
  3823. Remove chroma components, turns the video into a graytone image:
  3824. @example
  3825. lutyuv="u=128:v=128"
  3826. @end example
  3827. @item
  3828. Apply a luma burning effect:
  3829. @example
  3830. lutyuv="y=2*val"
  3831. @end example
  3832. @item
  3833. Remove green and blue components:
  3834. @example
  3835. lutrgb="g=0:b=0"
  3836. @end example
  3837. @item
  3838. Set a constant alpha channel value on input:
  3839. @example
  3840. format=rgba,lutrgb=a="maxval-minval/2"
  3841. @end example
  3842. @item
  3843. Correct luminance gamma by a 0.5 factor:
  3844. @example
  3845. lutyuv=y=gammaval(0.5)
  3846. @end example
  3847. @item
  3848. Discard least significant bits of luma:
  3849. @example
  3850. lutyuv=y='bitand(val, 128+64+32)'
  3851. @end example
  3852. @end itemize
  3853. @section mcdeint
  3854. Apply motion-compensation deinterlacing.
  3855. It needs one field per frame as input and must thus be used together
  3856. with yadif=1/3 or equivalent.
  3857. This filter accepts the following options:
  3858. @table @option
  3859. @item mode
  3860. Set the deinterlacing mode.
  3861. It accepts one of the following values:
  3862. @table @samp
  3863. @item fast
  3864. @item medium
  3865. @item slow
  3866. use iterative motion estimation
  3867. @item extra_slow
  3868. like @samp{slow}, but use multiple reference frames.
  3869. @end table
  3870. Default value is @samp{fast}.
  3871. @item parity
  3872. Set the picture field parity assumed for the input video. It must be
  3873. one of the following values:
  3874. @table @samp
  3875. @item 0, tff
  3876. assume top field first
  3877. @item 1, bff
  3878. assume bottom field first
  3879. @end table
  3880. Default value is @samp{bff}.
  3881. @item qp
  3882. Set per-block quantization parameter (QP) used by the internal
  3883. encoder.
  3884. Higher values should result in a smoother motion vector field but less
  3885. optimal individual vectors. Default value is 1.
  3886. @end table
  3887. @section mp
  3888. Apply an MPlayer filter to the input video.
  3889. This filter provides a wrapper around most of the filters of
  3890. MPlayer/MEncoder.
  3891. This wrapper is considered experimental. Some of the wrapped filters
  3892. may not work properly and we may drop support for them, as they will
  3893. be implemented natively into FFmpeg. Thus you should avoid
  3894. depending on them when writing portable scripts.
  3895. The filters accepts the parameters:
  3896. @var{filter_name}[:=]@var{filter_params}
  3897. @var{filter_name} is the name of a supported MPlayer filter,
  3898. @var{filter_params} is a string containing the parameters accepted by
  3899. the named filter.
  3900. The list of the currently supported filters follows:
  3901. @table @var
  3902. @item dint
  3903. @item eq2
  3904. @item eq
  3905. @item fil
  3906. @item fspp
  3907. @item ilpack
  3908. @item perspective
  3909. @item phase
  3910. @item pp7
  3911. @item pullup
  3912. @item qp
  3913. @item softpulldown
  3914. @item uspp
  3915. @end table
  3916. The parameter syntax and behavior for the listed filters are the same
  3917. of the corresponding MPlayer filters. For detailed instructions check
  3918. the "VIDEO FILTERS" section in the MPlayer manual.
  3919. @subsection Examples
  3920. @itemize
  3921. @item
  3922. Adjust gamma, brightness, contrast:
  3923. @example
  3924. mp=eq2=1.0:2:0.5
  3925. @end example
  3926. @end itemize
  3927. See also mplayer(1), @url{http://www.mplayerhq.hu/}.
  3928. @section mpdecimate
  3929. Drop frames that do not differ greatly from the previous frame in
  3930. order to reduce frame rate.
  3931. The main use of this filter is for very-low-bitrate encoding
  3932. (e.g. streaming over dialup modem), but it could in theory be used for
  3933. fixing movies that were inverse-telecined incorrectly.
  3934. A description of the accepted options follows.
  3935. @table @option
  3936. @item max
  3937. Set the maximum number of consecutive frames which can be dropped (if
  3938. positive), or the minimum interval between dropped frames (if
  3939. negative). If the value is 0, the frame is dropped unregarding the
  3940. number of previous sequentially dropped frames.
  3941. Default value is 0.
  3942. @item hi
  3943. @item lo
  3944. @item frac
  3945. Set the dropping threshold values.
  3946. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  3947. represent actual pixel value differences, so a threshold of 64
  3948. corresponds to 1 unit of difference for each pixel, or the same spread
  3949. out differently over the block.
  3950. A frame is a candidate for dropping if no 8x8 blocks differ by more
  3951. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  3952. meaning the whole image) differ by more than a threshold of @option{lo}.
  3953. Default value for @option{hi} is 64*12, default value for @option{lo} is
  3954. 64*5, and default value for @option{frac} is 0.33.
  3955. @end table
  3956. @section negate
  3957. Negate input video.
  3958. This filter accepts an integer in input, if non-zero it negates the
  3959. alpha component (if available). The default value in input is 0.
  3960. @section noformat
  3961. Force libavfilter not to use any of the specified pixel formats for the
  3962. input to the next filter.
  3963. This filter accepts the following parameters:
  3964. @table @option
  3965. @item pix_fmts
  3966. A '|'-separated list of pixel format names, for example
  3967. "pix_fmts=yuv420p|monow|rgb24".
  3968. @end table
  3969. @subsection Examples
  3970. @itemize
  3971. @item
  3972. Force libavfilter to use a format different from @var{yuv420p} for the
  3973. input to the vflip filter:
  3974. @example
  3975. noformat=pix_fmts=yuv420p,vflip
  3976. @end example
  3977. @item
  3978. Convert the input video to any of the formats not contained in the list:
  3979. @example
  3980. noformat=yuv420p|yuv444p|yuv410p
  3981. @end example
  3982. @end itemize
  3983. @section noise
  3984. Add noise on video input frame.
  3985. The filter accepts the following options:
  3986. @table @option
  3987. @item all_seed
  3988. @item c0_seed
  3989. @item c1_seed
  3990. @item c2_seed
  3991. @item c3_seed
  3992. Set noise seed for specific pixel component or all pixel components in case
  3993. of @var{all_seed}. Default value is @code{123457}.
  3994. @item all_strength, alls
  3995. @item c0_strength, c0s
  3996. @item c1_strength, c1s
  3997. @item c2_strength, c2s
  3998. @item c3_strength, c3s
  3999. Set noise strength for specific pixel component or all pixel components in case
  4000. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  4001. @item all_flags, allf
  4002. @item c0_flags, c0f
  4003. @item c1_flags, c1f
  4004. @item c2_flags, c2f
  4005. @item c3_flags, c3f
  4006. Set pixel component flags or set flags for all components if @var{all_flags}.
  4007. Available values for component flags are:
  4008. @table @samp
  4009. @item a
  4010. averaged temporal noise (smoother)
  4011. @item p
  4012. mix random noise with a (semi)regular pattern
  4013. @item t
  4014. temporal noise (noise pattern changes between frames)
  4015. @item u
  4016. uniform noise (gaussian otherwise)
  4017. @end table
  4018. @end table
  4019. @subsection Examples
  4020. Add temporal and uniform noise to input video:
  4021. @example
  4022. noise=alls=20:allf=t+u
  4023. @end example
  4024. @section null
  4025. Pass the video source unchanged to the output.
  4026. @section ocv
  4027. Apply video transform using libopencv.
  4028. To enable this filter install libopencv library and headers and
  4029. configure FFmpeg with @code{--enable-libopencv}.
  4030. This filter accepts the following parameters:
  4031. @table @option
  4032. @item filter_name
  4033. The name of the libopencv filter to apply.
  4034. @item filter_params
  4035. The parameters to pass to the libopencv filter. If not specified the default
  4036. values are assumed.
  4037. @end table
  4038. Refer to the official libopencv documentation for more precise
  4039. information:
  4040. @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
  4041. Follows the list of supported libopencv filters.
  4042. @anchor{dilate}
  4043. @subsection dilate
  4044. Dilate an image by using a specific structuring element.
  4045. This filter corresponds to the libopencv function @code{cvDilate}.
  4046. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  4047. @var{struct_el} represents a structuring element, and has the syntax:
  4048. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  4049. @var{cols} and @var{rows} represent the number of columns and rows of
  4050. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  4051. point, and @var{shape} the shape for the structuring element, and
  4052. can be one of the values "rect", "cross", "ellipse", "custom".
  4053. If the value for @var{shape} is "custom", it must be followed by a
  4054. string of the form "=@var{filename}". The file with name
  4055. @var{filename} is assumed to represent a binary image, with each
  4056. printable character corresponding to a bright pixel. When a custom
  4057. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  4058. or columns and rows of the read file are assumed instead.
  4059. The default value for @var{struct_el} is "3x3+0x0/rect".
  4060. @var{nb_iterations} specifies the number of times the transform is
  4061. applied to the image, and defaults to 1.
  4062. Follow some example:
  4063. @example
  4064. # use the default values
  4065. ocv=dilate
  4066. # dilate using a structuring element with a 5x5 cross, iterate two times
  4067. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  4068. # read the shape from the file diamond.shape, iterate two times
  4069. # the file diamond.shape may contain a pattern of characters like this:
  4070. # *
  4071. # ***
  4072. # *****
  4073. # ***
  4074. # *
  4075. # the specified cols and rows are ignored (but not the anchor point coordinates)
  4076. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  4077. @end example
  4078. @subsection erode
  4079. Erode an image by using a specific structuring element.
  4080. This filter corresponds to the libopencv function @code{cvErode}.
  4081. The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
  4082. with the same syntax and semantics as the @ref{dilate} filter.
  4083. @subsection smooth
  4084. Smooth the input video.
  4085. The filter takes the following parameters:
  4086. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  4087. @var{type} is the type of smooth filter to apply, and can be one of
  4088. the following values: "blur", "blur_no_scale", "median", "gaussian",
  4089. "bilateral". The default value is "gaussian".
  4090. @var{param1}, @var{param2}, @var{param3}, and @var{param4} are
  4091. parameters whose meanings depend on smooth type. @var{param1} and
  4092. @var{param2} accept integer positive values or 0, @var{param3} and
  4093. @var{param4} accept float values.
  4094. The default value for @var{param1} is 3, the default value for the
  4095. other parameters is 0.
  4096. These parameters correspond to the parameters assigned to the
  4097. libopencv function @code{cvSmooth}.
  4098. @anchor{overlay}
  4099. @section overlay
  4100. Overlay one video on top of another.
  4101. It takes two inputs and one output, the first input is the "main"
  4102. video on which the second input is overlayed.
  4103. This filter accepts the following parameters:
  4104. A description of the accepted options follows.
  4105. @table @option
  4106. @item x
  4107. @item y
  4108. Set the expression for the x and y coordinates of the overlayed video
  4109. on the main video. Default value is "0" for both expressions. In case
  4110. the expression is invalid, it is set to a huge value (meaning that the
  4111. overlay will not be displayed within the output visible area).
  4112. @item eval
  4113. Set when the expressions for @option{x}, and @option{y} are evaluated.
  4114. It accepts the following values:
  4115. @table @samp
  4116. @item init
  4117. only evaluate expressions once during the filter initialization or
  4118. when a command is processed
  4119. @item frame
  4120. evaluate expressions for each incoming frame
  4121. @end table
  4122. Default value is @samp{frame}.
  4123. @item shortest
  4124. If set to 1, force the output to terminate when the shortest input
  4125. terminates. Default value is 0.
  4126. @item format
  4127. Set the format for the output video.
  4128. It accepts the following values:
  4129. @table @samp
  4130. @item yuv420
  4131. force YUV420 output
  4132. @item yuv444
  4133. force YUV444 output
  4134. @item rgb
  4135. force RGB output
  4136. @end table
  4137. Default value is @samp{yuv420}.
  4138. @item rgb @emph{(deprecated)}
  4139. If set to 1, force the filter to accept inputs in the RGB
  4140. color space. Default value is 0. This option is deprecated, use
  4141. @option{format} instead.
  4142. @item repeatlast
  4143. If set to 1, force the filter to draw the last overlay frame over the
  4144. main input until the end of the stream. A value of 0 disables this
  4145. behavior. Default value is 1.
  4146. @end table
  4147. The @option{x}, and @option{y} expressions can contain the following
  4148. parameters.
  4149. @table @option
  4150. @item main_w, W
  4151. @item main_h, H
  4152. main input width and height
  4153. @item overlay_w, w
  4154. @item overlay_h, h
  4155. overlay input width and height
  4156. @item x
  4157. @item y
  4158. the computed values for @var{x} and @var{y}. They are evaluated for
  4159. each new frame.
  4160. @item hsub
  4161. @item vsub
  4162. horizontal and vertical chroma subsample values of the output
  4163. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  4164. @var{vsub} is 1.
  4165. @item n
  4166. the number of input frame, starting from 0
  4167. @item pos
  4168. the position in the file of the input frame, NAN if unknown
  4169. @item t
  4170. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4171. @end table
  4172. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  4173. when evaluation is done @emph{per frame}, and will evaluate to NAN
  4174. when @option{eval} is set to @samp{init}.
  4175. Be aware that frames are taken from each input video in timestamp
  4176. order, hence, if their initial timestamps differ, it is a a good idea
  4177. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  4178. have them begin in the same zero timestamp, as it does the example for
  4179. the @var{movie} filter.
  4180. You can chain together more overlays but you should test the
  4181. efficiency of such approach.
  4182. @subsection Commands
  4183. This filter supports the following commands:
  4184. @table @option
  4185. @item x
  4186. @item y
  4187. Modify the x and y of the overlay input.
  4188. The command accepts the same syntax of the corresponding option.
  4189. If the specified expression is not valid, it is kept at its current
  4190. value.
  4191. @end table
  4192. @subsection Examples
  4193. @itemize
  4194. @item
  4195. Draw the overlay at 10 pixels from the bottom right corner of the main
  4196. video:
  4197. @example
  4198. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  4199. @end example
  4200. Using named options the example above becomes:
  4201. @example
  4202. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  4203. @end example
  4204. @item
  4205. Insert a transparent PNG logo in the bottom left corner of the input,
  4206. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  4207. @example
  4208. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  4209. @end example
  4210. @item
  4211. Insert 2 different transparent PNG logos (second logo on bottom
  4212. right corner) using the @command{ffmpeg} tool:
  4213. @example
  4214. ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
  4215. @end example
  4216. @item
  4217. Add a transparent color layer on top of the main video, @code{WxH}
  4218. must specify the size of the main input to the overlay filter:
  4219. @example
  4220. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  4221. @end example
  4222. @item
  4223. Play an original video and a filtered version (here with the deshake
  4224. filter) side by side using the @command{ffplay} tool:
  4225. @example
  4226. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  4227. @end example
  4228. The above command is the same as:
  4229. @example
  4230. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  4231. @end example
  4232. @item
  4233. Make a sliding overlay appearing from the left to the right top part of the
  4234. screen starting since time 2:
  4235. @example
  4236. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  4237. @end example
  4238. @item
  4239. Compose output by putting two input videos side to side:
  4240. @example
  4241. ffmpeg -i left.avi -i right.avi -filter_complex "
  4242. nullsrc=size=200x100 [background];
  4243. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  4244. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  4245. [background][left] overlay=shortest=1 [background+left];
  4246. [background+left][right] overlay=shortest=1:x=100 [left+right]
  4247. "
  4248. @end example
  4249. @item
  4250. Chain several overlays in cascade:
  4251. @example
  4252. nullsrc=s=200x200 [bg];
  4253. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  4254. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  4255. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  4256. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  4257. [in3] null, [mid2] overlay=100:100 [out0]
  4258. @end example
  4259. @end itemize
  4260. @section owdenoise
  4261. Apply Overcomplete Wavelet denoiser.
  4262. The filter accepts the following options:
  4263. @table @option
  4264. @item depth
  4265. Set depth.
  4266. Larger depth values will denoise lower frequency components more, but
  4267. slow down filtering.
  4268. Must be an int in the range 8-16, default is @code{8}.
  4269. @item luma_strength, ls
  4270. Set luma strength.
  4271. Must be a double value in the range 0-1000, default is @code{1.0}.
  4272. @item chroma_strength, cs
  4273. Set chroma strength.
  4274. Must be a double value in the range 0-1000, default is @code{1.0}.
  4275. @end table
  4276. @section pad
  4277. Add paddings to the input image, and place the original input at the
  4278. given coordinates @var{x}, @var{y}.
  4279. This filter accepts the following parameters:
  4280. @table @option
  4281. @item width, w
  4282. @item height, h
  4283. Specify an expression for the size of the output image with the
  4284. paddings added. If the value for @var{width} or @var{height} is 0, the
  4285. corresponding input size is used for the output.
  4286. The @var{width} expression can reference the value set by the
  4287. @var{height} expression, and vice versa.
  4288. The default value of @var{width} and @var{height} is 0.
  4289. @item x
  4290. @item y
  4291. Specify an expression for the offsets where to place the input image
  4292. in the padded area with respect to the top/left border of the output
  4293. image.
  4294. The @var{x} expression can reference the value set by the @var{y}
  4295. expression, and vice versa.
  4296. The default value of @var{x} and @var{y} is 0.
  4297. @item color
  4298. Specify the color of the padded area, it can be the name of a color
  4299. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  4300. The default value of @var{color} is "black".
  4301. @end table
  4302. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  4303. options are expressions containing the following constants:
  4304. @table @option
  4305. @item in_w
  4306. @item in_h
  4307. the input video width and height
  4308. @item iw
  4309. @item ih
  4310. same as @var{in_w} and @var{in_h}
  4311. @item out_w
  4312. @item out_h
  4313. the output width and height, that is the size of the padded area as
  4314. specified by the @var{width} and @var{height} expressions
  4315. @item ow
  4316. @item oh
  4317. same as @var{out_w} and @var{out_h}
  4318. @item x
  4319. @item y
  4320. x and y offsets as specified by the @var{x} and @var{y}
  4321. expressions, or NAN if not yet specified
  4322. @item a
  4323. same as @var{iw} / @var{ih}
  4324. @item sar
  4325. input sample aspect ratio
  4326. @item dar
  4327. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4328. @item hsub
  4329. @item vsub
  4330. horizontal and vertical chroma subsample values. For example for the
  4331. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4332. @end table
  4333. @subsection Examples
  4334. @itemize
  4335. @item
  4336. Add paddings with color "violet" to the input video. Output video
  4337. size is 640x480, the top-left corner of the input video is placed at
  4338. column 0, row 40:
  4339. @example
  4340. pad=640:480:0:40:violet
  4341. @end example
  4342. The example above is equivalent to the following command:
  4343. @example
  4344. pad=width=640:height=480:x=0:y=40:color=violet
  4345. @end example
  4346. @item
  4347. Pad the input to get an output with dimensions increased by 3/2,
  4348. and put the input video at the center of the padded area:
  4349. @example
  4350. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  4351. @end example
  4352. @item
  4353. Pad the input to get a squared output with size equal to the maximum
  4354. value between the input width and height, and put the input video at
  4355. the center of the padded area:
  4356. @example
  4357. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  4358. @end example
  4359. @item
  4360. Pad the input to get a final w/h ratio of 16:9:
  4361. @example
  4362. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  4363. @end example
  4364. @item
  4365. In case of anamorphic video, in order to set the output display aspect
  4366. correctly, it is necessary to use @var{sar} in the expression,
  4367. according to the relation:
  4368. @example
  4369. (ih * X / ih) * sar = output_dar
  4370. X = output_dar / sar
  4371. @end example
  4372. Thus the previous example needs to be modified to:
  4373. @example
  4374. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  4375. @end example
  4376. @item
  4377. Double output size and put the input video in the bottom-right
  4378. corner of the output padded area:
  4379. @example
  4380. pad="2*iw:2*ih:ow-iw:oh-ih"
  4381. @end example
  4382. @end itemize
  4383. @section perspective
  4384. Correct perspective of video not recorded perpendicular to the screen.
  4385. A description of the accepted parameters follows.
  4386. @table @option
  4387. @item x0
  4388. @item y0
  4389. @item x1
  4390. @item y1
  4391. @item x2
  4392. @item y2
  4393. @item x3
  4394. @item y3
  4395. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  4396. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  4397. The expressions can use the following variables:
  4398. @table @option
  4399. @item W
  4400. @item H
  4401. the width and height of video frame.
  4402. @end table
  4403. @item interpolation
  4404. Set interpolation for perspective correction.
  4405. It accepts the following values:
  4406. @table @samp
  4407. @item linear
  4408. @item cubic
  4409. @end table
  4410. Default value is @samp{linear}.
  4411. @end table
  4412. @section pixdesctest
  4413. Pixel format descriptor test filter, mainly useful for internal
  4414. testing. The output video should be equal to the input video.
  4415. For example:
  4416. @example
  4417. format=monow, pixdesctest
  4418. @end example
  4419. can be used to test the monowhite pixel format descriptor definition.
  4420. @section pp
  4421. Enable the specified chain of postprocessing subfilters using libpostproc. This
  4422. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  4423. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  4424. Each subfilter and some options have a short and a long name that can be used
  4425. interchangeably, i.e. dr/dering are the same.
  4426. The filters accept the following options:
  4427. @table @option
  4428. @item subfilters
  4429. Set postprocessing subfilters string.
  4430. @end table
  4431. All subfilters share common options to determine their scope:
  4432. @table @option
  4433. @item a/autoq
  4434. Honor the quality commands for this subfilter.
  4435. @item c/chrom
  4436. Do chrominance filtering, too (default).
  4437. @item y/nochrom
  4438. Do luminance filtering only (no chrominance).
  4439. @item n/noluma
  4440. Do chrominance filtering only (no luminance).
  4441. @end table
  4442. These options can be appended after the subfilter name, separated by a '|'.
  4443. Available subfilters are:
  4444. @table @option
  4445. @item hb/hdeblock[|difference[|flatness]]
  4446. Horizontal deblocking filter
  4447. @table @option
  4448. @item difference
  4449. Difference factor where higher values mean more deblocking (default: @code{32}).
  4450. @item flatness
  4451. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4452. @end table
  4453. @item vb/vdeblock[|difference[|flatness]]
  4454. Vertical deblocking filter
  4455. @table @option
  4456. @item difference
  4457. Difference factor where higher values mean more deblocking (default: @code{32}).
  4458. @item flatness
  4459. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4460. @end table
  4461. @item ha/hadeblock[|difference[|flatness]]
  4462. Accurate horizontal deblocking filter
  4463. @table @option
  4464. @item difference
  4465. Difference factor where higher values mean more deblocking (default: @code{32}).
  4466. @item flatness
  4467. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4468. @end table
  4469. @item va/vadeblock[|difference[|flatness]]
  4470. Accurate vertical deblocking filter
  4471. @table @option
  4472. @item difference
  4473. Difference factor where higher values mean more deblocking (default: @code{32}).
  4474. @item flatness
  4475. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4476. @end table
  4477. @end table
  4478. The horizontal and vertical deblocking filters share the difference and
  4479. flatness values so you cannot set different horizontal and vertical
  4480. thresholds.
  4481. @table @option
  4482. @item h1/x1hdeblock
  4483. Experimental horizontal deblocking filter
  4484. @item v1/x1vdeblock
  4485. Experimental vertical deblocking filter
  4486. @item dr/dering
  4487. Deringing filter
  4488. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  4489. @table @option
  4490. @item threshold1
  4491. larger -> stronger filtering
  4492. @item threshold2
  4493. larger -> stronger filtering
  4494. @item threshold3
  4495. larger -> stronger filtering
  4496. @end table
  4497. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  4498. @table @option
  4499. @item f/fullyrange
  4500. Stretch luminance to @code{0-255}.
  4501. @end table
  4502. @item lb/linblenddeint
  4503. Linear blend deinterlacing filter that deinterlaces the given block by
  4504. filtering all lines with a @code{(1 2 1)} filter.
  4505. @item li/linipoldeint
  4506. Linear interpolating deinterlacing filter that deinterlaces the given block by
  4507. linearly interpolating every second line.
  4508. @item ci/cubicipoldeint
  4509. Cubic interpolating deinterlacing filter deinterlaces the given block by
  4510. cubically interpolating every second line.
  4511. @item md/mediandeint
  4512. Median deinterlacing filter that deinterlaces the given block by applying a
  4513. median filter to every second line.
  4514. @item fd/ffmpegdeint
  4515. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  4516. second line with a @code{(-1 4 2 4 -1)} filter.
  4517. @item l5/lowpass5
  4518. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  4519. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  4520. @item fq/forceQuant[|quantizer]
  4521. Overrides the quantizer table from the input with the constant quantizer you
  4522. specify.
  4523. @table @option
  4524. @item quantizer
  4525. Quantizer to use
  4526. @end table
  4527. @item de/default
  4528. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  4529. @item fa/fast
  4530. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  4531. @item ac
  4532. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  4533. @end table
  4534. @subsection Examples
  4535. @itemize
  4536. @item
  4537. Apply horizontal and vertical deblocking, deringing and automatic
  4538. brightness/contrast:
  4539. @example
  4540. pp=hb/vb/dr/al
  4541. @end example
  4542. @item
  4543. Apply default filters without brightness/contrast correction:
  4544. @example
  4545. pp=de/-al
  4546. @end example
  4547. @item
  4548. Apply default filters and temporal denoiser:
  4549. @example
  4550. pp=default/tmpnoise|1|2|3
  4551. @end example
  4552. @item
  4553. Apply deblocking on luminance only, and switch vertical deblocking on or off
  4554. automatically depending on available CPU time:
  4555. @example
  4556. pp=hb|y/vb|a
  4557. @end example
  4558. @end itemize
  4559. @section psnr
  4560. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  4561. Ratio) between two input videos.
  4562. This filter takes in input two input videos, the first input is
  4563. considered the "main" source and is passed unchanged to the
  4564. output. The second input is used as a "reference" video for computing
  4565. the PSNR.
  4566. Both video inputs must have the same resolution and pixel format for
  4567. this filter to work correctly. Also it assumes that both inputs
  4568. have the same number of frames, which are compared one by one.
  4569. The obtained average PSNR is printed through the logging system.
  4570. The filter stores the accumulated MSE (mean squared error) of each
  4571. frame, and at the end of the processing it is averaged across all frames
  4572. equally, and the following formula is applied to obtain the PSNR:
  4573. @example
  4574. PSNR = 10*log10(MAX^2/MSE)
  4575. @end example
  4576. Where MAX is the average of the maximum values of each component of the
  4577. image.
  4578. The description of the accepted parameters follows.
  4579. @table @option
  4580. @item stats_file, f
  4581. If specified the filter will use the named file to save the PSNR of
  4582. each individual frame.
  4583. @end table
  4584. The file printed if @var{stats_file} is selected, contains a sequence of
  4585. key/value pairs of the form @var{key}:@var{value} for each compared
  4586. couple of frames.
  4587. A description of each shown parameter follows:
  4588. @table @option
  4589. @item n
  4590. sequential number of the input frame, starting from 1
  4591. @item mse_avg
  4592. Mean Square Error pixel-by-pixel average difference of the compared
  4593. frames, averaged over all the image components.
  4594. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  4595. Mean Square Error pixel-by-pixel average difference of the compared
  4596. frames for the component specified by the suffix.
  4597. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  4598. Peak Signal to Noise ratio of the compared frames for the component
  4599. specified by the suffix.
  4600. @end table
  4601. For example:
  4602. @example
  4603. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  4604. [main][ref] psnr="stats_file=stats.log" [out]
  4605. @end example
  4606. On this example the input file being processed is compared with the
  4607. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  4608. is stored in @file{stats.log}.
  4609. @section removelogo
  4610. Suppress a TV station logo, using an image file to determine which
  4611. pixels comprise the logo. It works by filling in the pixels that
  4612. comprise the logo with neighboring pixels.
  4613. The filter accepts the following options:
  4614. @table @option
  4615. @item filename, f
  4616. Set the filter bitmap file, which can be any image format supported by
  4617. libavformat. The width and height of the image file must match those of the
  4618. video stream being processed.
  4619. @end table
  4620. Pixels in the provided bitmap image with a value of zero are not
  4621. considered part of the logo, non-zero pixels are considered part of
  4622. the logo. If you use white (255) for the logo and black (0) for the
  4623. rest, you will be safe. For making the filter bitmap, it is
  4624. recommended to take a screen capture of a black frame with the logo
  4625. visible, and then using a threshold filter followed by the erode
  4626. filter once or twice.
  4627. If needed, little splotches can be fixed manually. Remember that if
  4628. logo pixels are not covered, the filter quality will be much
  4629. reduced. Marking too many pixels as part of the logo does not hurt as
  4630. much, but it will increase the amount of blurring needed to cover over
  4631. the image and will destroy more information than necessary, and extra
  4632. pixels will slow things down on a large logo.
  4633. @section rotate
  4634. Rotate video by an arbitrary angle expressed in radians.
  4635. The filter accepts the following options:
  4636. A description of the optional parameters follows.
  4637. @table @option
  4638. @item angle, a
  4639. Set an expression for the angle by which to rotate the input video
  4640. clockwise, expressed as a number of radians. A negative value will
  4641. result in a counter-clockwise rotation. By default it is set to "0".
  4642. This expression is evaluated for each frame.
  4643. @item out_w, ow
  4644. Set the output width expression, default value is "iw".
  4645. This expression is evaluated just once during configuration.
  4646. @item out_h, oh
  4647. Set the output height expression, default value is "ih".
  4648. This expression is evaluated just once during configuration.
  4649. @item bilinear
  4650. Enable bilinear interpolation if set to 1, a value of 0 disables
  4651. it. Default value is 1.
  4652. @item fillcolor, c
  4653. Set the color used to fill the output area not covered by the rotated
  4654. image. If the special value "none" is selected then no background is
  4655. printed (useful for example if the background is never shown). Default
  4656. value is "black".
  4657. @end table
  4658. The expressions for the angle and the output size can contain the
  4659. following constants and functions:
  4660. @table @option
  4661. @item n
  4662. sequential number of the input frame, starting from 0. It is always NAN
  4663. before the first frame is filtered.
  4664. @item t
  4665. time in seconds of the input frame, it is set to 0 when the filter is
  4666. configured. It is always NAN before the first frame is filtered.
  4667. @item hsub
  4668. @item vsub
  4669. horizontal and vertical chroma subsample values. For example for the
  4670. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4671. @item in_w, iw
  4672. @item in_h, ih
  4673. the input video width and heigth
  4674. @item out_w, ow
  4675. @item out_h, oh
  4676. the output width and heigth, that is the size of the padded area as
  4677. specified by the @var{width} and @var{height} expressions
  4678. @item rotw(a)
  4679. @item roth(a)
  4680. the minimal width/height required for completely containing the input
  4681. video rotated by @var{a} radians.
  4682. These are only available when computing the @option{out_w} and
  4683. @option{out_h} expressions.
  4684. @end table
  4685. @subsection Examples
  4686. @itemize
  4687. @item
  4688. Rotate the input by PI/6 radians clockwise:
  4689. @example
  4690. rotate=PI/6
  4691. @end example
  4692. @item
  4693. Rotate the input by PI/6 radians counter-clockwise:
  4694. @example
  4695. rotate=-PI/6
  4696. @end example
  4697. @item
  4698. Apply a constant rotation with period T, starting from an angle of PI/3:
  4699. @example
  4700. rotate=PI/3+2*PI*t/T
  4701. @end example
  4702. @item
  4703. Make the input video rotation oscillating with a period of T
  4704. seconds and an amplitude of A radians:
  4705. @example
  4706. rotate=A*sin(2*PI/T*t)
  4707. @end example
  4708. @item
  4709. Rotate the video, output size is choosen so that the whole rotating
  4710. input video is always completely contained in the output:
  4711. @example
  4712. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  4713. @end example
  4714. @item
  4715. Rotate the video, reduce the output size so that no background is ever
  4716. shown:
  4717. @example
  4718. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  4719. @end example
  4720. @end itemize
  4721. @subsection Commands
  4722. The filter supports the following commands:
  4723. @table @option
  4724. @item a, angle
  4725. Set the angle expression.
  4726. The command accepts the same syntax of the corresponding option.
  4727. If the specified expression is not valid, it is kept at its current
  4728. value.
  4729. @end table
  4730. @section sab
  4731. Apply Shape Adaptive Blur.
  4732. The filter accepts the following options:
  4733. @table @option
  4734. @item luma_radius, lr
  4735. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  4736. value is 1.0. A greater value will result in a more blurred image, and
  4737. in slower processing.
  4738. @item luma_pre_filter_radius, lpfr
  4739. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  4740. value is 1.0.
  4741. @item luma_strength, ls
  4742. Set luma maximum difference between pixels to still be considered, must
  4743. be a value in the 0.1-100.0 range, default value is 1.0.
  4744. @item chroma_radius, cr
  4745. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  4746. greater value will result in a more blurred image, and in slower
  4747. processing.
  4748. @item chroma_pre_filter_radius, cpfr
  4749. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  4750. @item chroma_strength, cs
  4751. Set chroma maximum difference between pixels to still be considered,
  4752. must be a value in the 0.1-100.0 range.
  4753. @end table
  4754. Each chroma option value, if not explicitly specified, is set to the
  4755. corresponding luma option value.
  4756. @section scale
  4757. Scale (resize) the input video, using the libswscale library.
  4758. The scale filter forces the output display aspect ratio to be the same
  4759. of the input, by changing the output sample aspect ratio.
  4760. The filter accepts the following options:
  4761. @table @option
  4762. @item width, w
  4763. Set the output video width expression. Default value is @code{iw}. See
  4764. below for the list of accepted constants.
  4765. @item height, h
  4766. Set the output video height expression. Default value is @code{ih}.
  4767. See below for the list of accepted constants.
  4768. @item interl
  4769. Set the interlacing. It accepts the following values:
  4770. @table @option
  4771. @item 1
  4772. force interlaced aware scaling
  4773. @item 0
  4774. do not apply interlaced scaling
  4775. @item -1
  4776. select interlaced aware scaling depending on whether the source frames
  4777. are flagged as interlaced or not
  4778. @end table
  4779. Default value is @code{0}.
  4780. @item flags
  4781. Set libswscale scaling flags. If not explictly specified the filter
  4782. applies a bilinear scaling algorithm.
  4783. @item size, s
  4784. Set the video size, the value must be a valid abbreviation or in the
  4785. form @var{width}x@var{height}.
  4786. @end table
  4787. The values of the @var{w} and @var{h} options are expressions
  4788. containing the following constants:
  4789. @table @option
  4790. @item in_w
  4791. @item in_h
  4792. the input width and height
  4793. @item iw
  4794. @item ih
  4795. same as @var{in_w} and @var{in_h}
  4796. @item out_w
  4797. @item out_h
  4798. the output (cropped) width and height
  4799. @item ow
  4800. @item oh
  4801. same as @var{out_w} and @var{out_h}
  4802. @item a
  4803. same as @var{iw} / @var{ih}
  4804. @item sar
  4805. input sample aspect ratio
  4806. @item dar
  4807. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4808. @item hsub
  4809. @item vsub
  4810. horizontal and vertical chroma subsample values. For example for the
  4811. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4812. @end table
  4813. If the input image format is different from the format requested by
  4814. the next filter, the scale filter will convert the input to the
  4815. requested format.
  4816. If the value for @var{w} or @var{h} is 0, the respective input
  4817. size is used for the output.
  4818. If the value for @var{w} or @var{h} is -1, the scale filter will use, for the
  4819. respective output size, a value that maintains the aspect ratio of the input
  4820. image.
  4821. @subsection Examples
  4822. @itemize
  4823. @item
  4824. Scale the input video to a size of 200x100:
  4825. @example
  4826. scale=w=200:h=100
  4827. @end example
  4828. This is equivalent to:
  4829. @example
  4830. scale=200:100
  4831. @end example
  4832. or:
  4833. @example
  4834. scale=200x100
  4835. @end example
  4836. @item
  4837. Specify a size abbreviation for the output size:
  4838. @example
  4839. scale=qcif
  4840. @end example
  4841. which can also be written as:
  4842. @example
  4843. scale=size=qcif
  4844. @end example
  4845. @item
  4846. Scale the input to 2x:
  4847. @example
  4848. scale=w=2*iw:h=2*ih
  4849. @end example
  4850. @item
  4851. The above is the same as:
  4852. @example
  4853. scale=2*in_w:2*in_h
  4854. @end example
  4855. @item
  4856. Scale the input to 2x with forced interlaced scaling:
  4857. @example
  4858. scale=2*iw:2*ih:interl=1
  4859. @end example
  4860. @item
  4861. Scale the input to half size:
  4862. @example
  4863. scale=w=iw/2:h=ih/2
  4864. @end example
  4865. @item
  4866. Increase the width, and set the height to the same size:
  4867. @example
  4868. scale=3/2*iw:ow
  4869. @end example
  4870. @item
  4871. Seek for Greek harmony:
  4872. @example
  4873. scale=iw:1/PHI*iw
  4874. scale=ih*PHI:ih
  4875. @end example
  4876. @item
  4877. Increase the height, and set the width to 3/2 of the height:
  4878. @example
  4879. scale=w=3/2*oh:h=3/5*ih
  4880. @end example
  4881. @item
  4882. Increase the size, but make the size a multiple of the chroma
  4883. subsample values:
  4884. @example
  4885. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  4886. @end example
  4887. @item
  4888. Increase the width to a maximum of 500 pixels, keep the same input
  4889. aspect ratio:
  4890. @example
  4891. scale=w='min(500\, iw*3/2):h=-1'
  4892. @end example
  4893. @end itemize
  4894. @section separatefields
  4895. The @code{separatefields} takes a frame-based video input and splits
  4896. each frame into its components fields, producing a new half height clip
  4897. with twice the frame rate and twice the frame count.
  4898. This filter use field-dominance information in frame to decide which
  4899. of each pair of fields to place first in the output.
  4900. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  4901. @section setdar, setsar
  4902. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  4903. output video.
  4904. This is done by changing the specified Sample (aka Pixel) Aspect
  4905. Ratio, according to the following equation:
  4906. @example
  4907. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  4908. @end example
  4909. Keep in mind that the @code{setdar} filter does not modify the pixel
  4910. dimensions of the video frame. Also the display aspect ratio set by
  4911. this filter may be changed by later filters in the filterchain,
  4912. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  4913. applied.
  4914. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  4915. the filter output video.
  4916. Note that as a consequence of the application of this filter, the
  4917. output display aspect ratio will change according to the equation
  4918. above.
  4919. Keep in mind that the sample aspect ratio set by the @code{setsar}
  4920. filter may be changed by later filters in the filterchain, e.g. if
  4921. another "setsar" or a "setdar" filter is applied.
  4922. The filters accept the following options:
  4923. @table @option
  4924. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  4925. Set the aspect ratio used by the filter.
  4926. The parameter can be a floating point number string, an expression, or
  4927. a string of the form @var{num}:@var{den}, where @var{num} and
  4928. @var{den} are the numerator and denominator of the aspect ratio. If
  4929. the parameter is not specified, it is assumed the value "0".
  4930. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  4931. should be escaped.
  4932. @item max
  4933. Set the maximum integer value to use for expressing numerator and
  4934. denominator when reducing the expressed aspect ratio to a rational.
  4935. Default value is @code{100}.
  4936. @end table
  4937. @subsection Examples
  4938. @itemize
  4939. @item
  4940. To change the display aspect ratio to 16:9, specify one of the following:
  4941. @example
  4942. setdar=dar=1.77777
  4943. setdar=dar=16/9
  4944. setdar=dar=1.77777
  4945. @end example
  4946. @item
  4947. To change the sample aspect ratio to 10:11, specify:
  4948. @example
  4949. setsar=sar=10/11
  4950. @end example
  4951. @item
  4952. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  4953. 1000 in the aspect ratio reduction, use the command:
  4954. @example
  4955. setdar=ratio=16/9:max=1000
  4956. @end example
  4957. @end itemize
  4958. @anchor{setfield}
  4959. @section setfield
  4960. Force field for the output video frame.
  4961. The @code{setfield} filter marks the interlace type field for the
  4962. output frames. It does not change the input frame, but only sets the
  4963. corresponding property, which affects how the frame is treated by
  4964. following filters (e.g. @code{fieldorder} or @code{yadif}).
  4965. The filter accepts the following options:
  4966. @table @option
  4967. @item mode
  4968. Available values are:
  4969. @table @samp
  4970. @item auto
  4971. Keep the same field property.
  4972. @item bff
  4973. Mark the frame as bottom-field-first.
  4974. @item tff
  4975. Mark the frame as top-field-first.
  4976. @item prog
  4977. Mark the frame as progressive.
  4978. @end table
  4979. @end table
  4980. @section showinfo
  4981. Show a line containing various information for each input video frame.
  4982. The input video is not modified.
  4983. The shown line contains a sequence of key/value pairs of the form
  4984. @var{key}:@var{value}.
  4985. A description of each shown parameter follows:
  4986. @table @option
  4987. @item n
  4988. sequential number of the input frame, starting from 0
  4989. @item pts
  4990. Presentation TimeStamp of the input frame, expressed as a number of
  4991. time base units. The time base unit depends on the filter input pad.
  4992. @item pts_time
  4993. Presentation TimeStamp of the input frame, expressed as a number of
  4994. seconds
  4995. @item pos
  4996. position of the frame in the input stream, -1 if this information in
  4997. unavailable and/or meaningless (for example in case of synthetic video)
  4998. @item fmt
  4999. pixel format name
  5000. @item sar
  5001. sample aspect ratio of the input frame, expressed in the form
  5002. @var{num}/@var{den}
  5003. @item s
  5004. size of the input frame, expressed in the form
  5005. @var{width}x@var{height}
  5006. @item i
  5007. interlaced mode ("P" for "progressive", "T" for top field first, "B"
  5008. for bottom field first)
  5009. @item iskey
  5010. 1 if the frame is a key frame, 0 otherwise
  5011. @item type
  5012. picture type of the input frame ("I" for an I-frame, "P" for a
  5013. P-frame, "B" for a B-frame, "?" for unknown type).
  5014. Check also the documentation of the @code{AVPictureType} enum and of
  5015. the @code{av_get_picture_type_char} function defined in
  5016. @file{libavutil/avutil.h}.
  5017. @item checksum
  5018. Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
  5019. @item plane_checksum
  5020. Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  5021. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]"
  5022. @end table
  5023. @anchor{smartblur}
  5024. @section smartblur
  5025. Blur the input video without impacting the outlines.
  5026. The filter accepts the following options:
  5027. @table @option
  5028. @item luma_radius, lr
  5029. Set the luma radius. The option value must be a float number in
  5030. the range [0.1,5.0] that specifies the variance of the gaussian filter
  5031. used to blur the image (slower if larger). Default value is 1.0.
  5032. @item luma_strength, ls
  5033. Set the luma strength. The option value must be a float number
  5034. in the range [-1.0,1.0] that configures the blurring. A value included
  5035. in [0.0,1.0] will blur the image whereas a value included in
  5036. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  5037. @item luma_threshold, lt
  5038. Set the luma threshold used as a coefficient to determine
  5039. whether a pixel should be blurred or not. The option value must be an
  5040. integer in the range [-30,30]. A value of 0 will filter all the image,
  5041. a value included in [0,30] will filter flat areas and a value included
  5042. in [-30,0] will filter edges. Default value is 0.
  5043. @item chroma_radius, cr
  5044. Set the chroma radius. The option value must be a float number in
  5045. the range [0.1,5.0] that specifies the variance of the gaussian filter
  5046. used to blur the image (slower if larger). Default value is 1.0.
  5047. @item chroma_strength, cs
  5048. Set the chroma strength. The option value must be a float number
  5049. in the range [-1.0,1.0] that configures the blurring. A value included
  5050. in [0.0,1.0] will blur the image whereas a value included in
  5051. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  5052. @item chroma_threshold, ct
  5053. Set the chroma threshold used as a coefficient to determine
  5054. whether a pixel should be blurred or not. The option value must be an
  5055. integer in the range [-30,30]. A value of 0 will filter all the image,
  5056. a value included in [0,30] will filter flat areas and a value included
  5057. in [-30,0] will filter edges. Default value is 0.
  5058. @end table
  5059. If a chroma option is not explicitly set, the corresponding luma value
  5060. is set.
  5061. @section stereo3d
  5062. Convert between different stereoscopic image formats.
  5063. The filters accept the following options:
  5064. @table @option
  5065. @item in
  5066. Set stereoscopic image format of input.
  5067. Available values for input image formats are:
  5068. @table @samp
  5069. @item sbsl
  5070. side by side parallel (left eye left, right eye right)
  5071. @item sbsr
  5072. side by side crosseye (right eye left, left eye right)
  5073. @item sbs2l
  5074. side by side parallel with half width resolution
  5075. (left eye left, right eye right)
  5076. @item sbs2r
  5077. side by side crosseye with half width resolution
  5078. (right eye left, left eye right)
  5079. @item abl
  5080. above-below (left eye above, right eye below)
  5081. @item abr
  5082. above-below (right eye above, left eye below)
  5083. @item ab2l
  5084. above-below with half height resolution
  5085. (left eye above, right eye below)
  5086. @item ab2r
  5087. above-below with half height resolution
  5088. (right eye above, left eye below)
  5089. @item al
  5090. alternating frames (left eye first, right eye second)
  5091. @item ar
  5092. alternating frames (right eye first, left eye second)
  5093. Default value is @samp{sbsl}.
  5094. @end table
  5095. @item out
  5096. Set stereoscopic image format of output.
  5097. Available values for output image formats are all the input formats as well as:
  5098. @table @samp
  5099. @item arbg
  5100. anaglyph red/blue gray
  5101. (red filter on left eye, blue filter on right eye)
  5102. @item argg
  5103. anaglyph red/green gray
  5104. (red filter on left eye, green filter on right eye)
  5105. @item arcg
  5106. anaglyph red/cyan gray
  5107. (red filter on left eye, cyan filter on right eye)
  5108. @item arch
  5109. anaglyph red/cyan half colored
  5110. (red filter on left eye, cyan filter on right eye)
  5111. @item arcc
  5112. anaglyph red/cyan color
  5113. (red filter on left eye, cyan filter on right eye)
  5114. @item arcd
  5115. anaglyph red/cyan color optimized with the least squares projection of dubois
  5116. (red filter on left eye, cyan filter on right eye)
  5117. @item agmg
  5118. anaglyph green/magenta gray
  5119. (green filter on left eye, magenta filter on right eye)
  5120. @item agmh
  5121. anaglyph green/magenta half colored
  5122. (green filter on left eye, magenta filter on right eye)
  5123. @item agmc
  5124. anaglyph green/magenta colored
  5125. (green filter on left eye, magenta filter on right eye)
  5126. @item agmd
  5127. anaglyph green/magenta color optimized with the least squares projection of dubois
  5128. (green filter on left eye, magenta filter on right eye)
  5129. @item aybg
  5130. anaglyph yellow/blue gray
  5131. (yellow filter on left eye, blue filter on right eye)
  5132. @item aybh
  5133. anaglyph yellow/blue half colored
  5134. (yellow filter on left eye, blue filter on right eye)
  5135. @item aybc
  5136. anaglyph yellow/blue colored
  5137. (yellow filter on left eye, blue filter on right eye)
  5138. @item aybd
  5139. anaglyph yellow/blue color optimized with the least squares projection of dubois
  5140. (yellow filter on left eye, blue filter on right eye)
  5141. @item irl
  5142. interleaved rows (left eye has top row, right eye starts on next row)
  5143. @item irr
  5144. interleaved rows (right eye has top row, left eye starts on next row)
  5145. @item ml
  5146. mono output (left eye only)
  5147. @item mr
  5148. mono output (right eye only)
  5149. @end table
  5150. Default value is @samp{arcd}.
  5151. @end table
  5152. @subsection Examples
  5153. @itemize
  5154. @item
  5155. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  5156. @example
  5157. stereo3d=sbsl:aybd
  5158. @end example
  5159. @item
  5160. Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
  5161. @example
  5162. stereo3d=abl:sbsr
  5163. @end example
  5164. @end itemize
  5165. @section spp
  5166. Apply a simple postprocessing filter that compresses and decompresses the image
  5167. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  5168. and average the results.
  5169. The filter accepts the following options:
  5170. @table @option
  5171. @item quality
  5172. Set quality. This option defines the number of levels for averaging. It accepts
  5173. an integer in the range 0-6. If set to @code{0}, the filter will have no
  5174. effect. A value of @code{6} means the higher quality. For each increment of
  5175. that value the speed drops by a factor of approximately 2. Default value is
  5176. @code{3}.
  5177. @item qp
  5178. Force a constant quantization parameter. If not set, the filter will use the QP
  5179. from the video stream (if available).
  5180. @item mode
  5181. Set thresholding mode. Available modes are:
  5182. @table @samp
  5183. @item hard
  5184. Set hard thresholding (default).
  5185. @item soft
  5186. Set soft thresholding (better de-ringing effect, but likely blurrier).
  5187. @end table
  5188. @item use_bframe_qp
  5189. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5190. option may cause flicker since the B-Frames have often larger QP. Default is
  5191. @code{0} (not enabled).
  5192. @end table
  5193. @anchor{subtitles}
  5194. @section subtitles
  5195. Draw subtitles on top of input video using the libass library.
  5196. To enable compilation of this filter you need to configure FFmpeg with
  5197. @code{--enable-libass}. This filter also requires a build with libavcodec and
  5198. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  5199. Alpha) subtitles format.
  5200. The filter accepts the following options:
  5201. @table @option
  5202. @item filename, f
  5203. Set the filename of the subtitle file to read. It must be specified.
  5204. @item original_size
  5205. Specify the size of the original video, the video for which the ASS file
  5206. was composed. Due to a misdesign in ASS aspect ratio arithmetic, this is
  5207. necessary to correctly scale the fonts if the aspect ratio has been changed.
  5208. @item charenc
  5209. Set subtitles input character encoding. @code{subtitles} filter only. Only
  5210. useful if not UTF-8.
  5211. @end table
  5212. If the first key is not specified, it is assumed that the first value
  5213. specifies the @option{filename}.
  5214. For example, to render the file @file{sub.srt} on top of the input
  5215. video, use the command:
  5216. @example
  5217. subtitles=sub.srt
  5218. @end example
  5219. which is equivalent to:
  5220. @example
  5221. subtitles=filename=sub.srt
  5222. @end example
  5223. @section super2xsai
  5224. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  5225. Interpolate) pixel art scaling algorithm.
  5226. Useful for enlarging pixel art images without reducing sharpness.
  5227. @section swapuv
  5228. Swap U & V plane.
  5229. @section telecine
  5230. Apply telecine process to the video.
  5231. This filter accepts the following options:
  5232. @table @option
  5233. @item first_field
  5234. @table @samp
  5235. @item top, t
  5236. top field first
  5237. @item bottom, b
  5238. bottom field first
  5239. The default value is @code{top}.
  5240. @end table
  5241. @item pattern
  5242. A string of numbers representing the pulldown pattern you wish to apply.
  5243. The default value is @code{23}.
  5244. @end table
  5245. @example
  5246. Some typical patterns:
  5247. NTSC output (30i):
  5248. 27.5p: 32222
  5249. 24p: 23 (classic)
  5250. 24p: 2332 (preferred)
  5251. 20p: 33
  5252. 18p: 334
  5253. 16p: 3444
  5254. PAL output (25i):
  5255. 27.5p: 12222
  5256. 24p: 222222222223 ("Euro pulldown")
  5257. 16.67p: 33
  5258. 16p: 33333334
  5259. @end example
  5260. @section thumbnail
  5261. Select the most representative frame in a given sequence of consecutive frames.
  5262. The filter accepts the following options:
  5263. @table @option
  5264. @item n
  5265. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  5266. will pick one of them, and then handle the next batch of @var{n} frames until
  5267. the end. Default is @code{100}.
  5268. @end table
  5269. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  5270. value will result in a higher memory usage, so a high value is not recommended.
  5271. @subsection Examples
  5272. @itemize
  5273. @item
  5274. Extract one picture each 50 frames:
  5275. @example
  5276. thumbnail=50
  5277. @end example
  5278. @item
  5279. Complete example of a thumbnail creation with @command{ffmpeg}:
  5280. @example
  5281. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  5282. @end example
  5283. @end itemize
  5284. @section tile
  5285. Tile several successive frames together.
  5286. The filter accepts the following options:
  5287. @table @option
  5288. @item layout
  5289. Set the grid size (i.e. the number of lines and columns) in the form
  5290. "@var{w}x@var{h}".
  5291. @item nb_frames
  5292. Set the maximum number of frames to render in the given area. It must be less
  5293. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  5294. the area will be used.
  5295. @item margin
  5296. Set the outer border margin in pixels.
  5297. @item padding
  5298. Set the inner border thickness (i.e. the number of pixels between frames). For
  5299. more advanced padding options (such as having different values for the edges),
  5300. refer to the pad video filter.
  5301. @end table
  5302. @subsection Examples
  5303. @itemize
  5304. @item
  5305. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  5306. @example
  5307. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  5308. @end example
  5309. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  5310. duplicating each output frame to accomodate the originally detected frame
  5311. rate.
  5312. @item
  5313. Display @code{5} pictures in an area of @code{3x2} frames,
  5314. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  5315. mixed flat and named options:
  5316. @example
  5317. tile=3x2:nb_frames=5:padding=7:margin=2
  5318. @end example
  5319. @end itemize
  5320. @section tinterlace
  5321. Perform various types of temporal field interlacing.
  5322. Frames are counted starting from 1, so the first input frame is
  5323. considered odd.
  5324. The filter accepts the following options:
  5325. @table @option
  5326. @item mode
  5327. Specify the mode of the interlacing. This option can also be specified
  5328. as a value alone. See below for a list of values for this option.
  5329. Available values are:
  5330. @table @samp
  5331. @item merge, 0
  5332. Move odd frames into the upper field, even into the lower field,
  5333. generating a double height frame at half frame rate.
  5334. @item drop_odd, 1
  5335. Only output even frames, odd frames are dropped, generating a frame with
  5336. unchanged height at half frame rate.
  5337. @item drop_even, 2
  5338. Only output odd frames, even frames are dropped, generating a frame with
  5339. unchanged height at half frame rate.
  5340. @item pad, 3
  5341. Expand each frame to full height, but pad alternate lines with black,
  5342. generating a frame with double height at the same input frame rate.
  5343. @item interleave_top, 4
  5344. Interleave the upper field from odd frames with the lower field from
  5345. even frames, generating a frame with unchanged height at half frame rate.
  5346. @item interleave_bottom, 5
  5347. Interleave the lower field from odd frames with the upper field from
  5348. even frames, generating a frame with unchanged height at half frame rate.
  5349. @item interlacex2, 6
  5350. Double frame rate with unchanged height. Frames are inserted each
  5351. containing the second temporal field from the previous input frame and
  5352. the first temporal field from the next input frame. This mode relies on
  5353. the top_field_first flag. Useful for interlaced video displays with no
  5354. field synchronisation.
  5355. @end table
  5356. Numeric values are deprecated but are accepted for backward
  5357. compatibility reasons.
  5358. Default mode is @code{merge}.
  5359. @item flags
  5360. Specify flags influencing the filter process.
  5361. Available value for @var{flags} is:
  5362. @table @option
  5363. @item low_pass_filter, vlfp
  5364. Enable vertical low-pass filtering in the filter.
  5365. Vertical low-pass filtering is required when creating an interlaced
  5366. destination from a progressive source which contains high-frequency
  5367. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  5368. patterning.
  5369. Vertical low-pass filtering can only be enabled for @option{mode}
  5370. @var{interleave_top} and @var{interleave_bottom}.
  5371. @end table
  5372. @end table
  5373. @section transpose
  5374. Transpose rows with columns in the input video and optionally flip it.
  5375. This filter accepts the following options:
  5376. @table @option
  5377. @item dir
  5378. Specify the transposition direction.
  5379. Can assume the following values:
  5380. @table @samp
  5381. @item 0, 4, cclock_flip
  5382. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  5383. @example
  5384. L.R L.l
  5385. . . -> . .
  5386. l.r R.r
  5387. @end example
  5388. @item 1, 5, clock
  5389. Rotate by 90 degrees clockwise, that is:
  5390. @example
  5391. L.R l.L
  5392. . . -> . .
  5393. l.r r.R
  5394. @end example
  5395. @item 2, 6, cclock
  5396. Rotate by 90 degrees counterclockwise, that is:
  5397. @example
  5398. L.R R.r
  5399. . . -> . .
  5400. l.r L.l
  5401. @end example
  5402. @item 3, 7, clock_flip
  5403. Rotate by 90 degrees clockwise and vertically flip, that is:
  5404. @example
  5405. L.R r.R
  5406. . . -> . .
  5407. l.r l.L
  5408. @end example
  5409. @end table
  5410. For values between 4-7, the transposition is only done if the input
  5411. video geometry is portrait and not landscape. These values are
  5412. deprecated, the @code{passthrough} option should be used instead.
  5413. Numerical values are deprecated, and should be dropped in favor of
  5414. symbolic constants.
  5415. @item passthrough
  5416. Do not apply the transposition if the input geometry matches the one
  5417. specified by the specified value. It accepts the following values:
  5418. @table @samp
  5419. @item none
  5420. Always apply transposition.
  5421. @item portrait
  5422. Preserve portrait geometry (when @var{height} >= @var{width}).
  5423. @item landscape
  5424. Preserve landscape geometry (when @var{width} >= @var{height}).
  5425. @end table
  5426. Default value is @code{none}.
  5427. @end table
  5428. For example to rotate by 90 degrees clockwise and preserve portrait
  5429. layout:
  5430. @example
  5431. transpose=dir=1:passthrough=portrait
  5432. @end example
  5433. The command above can also be specified as:
  5434. @example
  5435. transpose=1:portrait
  5436. @end example
  5437. @section trim
  5438. Trim the input so that the output contains one continuous subpart of the input.
  5439. This filter accepts the following options:
  5440. @table @option
  5441. @item start
  5442. Specify time of the start of the kept section, i.e. the frame with the
  5443. timestamp @var{start} will be the first frame in the output.
  5444. @item end
  5445. Specify time of the first frame that will be dropped, i.e. the frame
  5446. immediately preceding the one with the timestamp @var{end} will be the last
  5447. frame in the output.
  5448. @item start_pts
  5449. Same as @var{start}, except this option sets the start timestamp in timebase
  5450. units instead of seconds.
  5451. @item end_pts
  5452. Same as @var{end}, except this option sets the end timestamp in timebase units
  5453. instead of seconds.
  5454. @item duration
  5455. Specify maximum duration of the output.
  5456. @item start_frame
  5457. Number of the first frame that should be passed to output.
  5458. @item end_frame
  5459. Number of the first frame that should be dropped.
  5460. @end table
  5461. @option{start}, @option{end}, @option{duration} are expressed as time
  5462. duration specifications, check the "Time duration" section in the
  5463. ffmpeg-utils manual.
  5464. Note that the first two sets of the start/end options and the @option{duration}
  5465. option look at the frame timestamp, while the _frame variants simply count the
  5466. frames that pass through the filter. Also note that this filter does not modify
  5467. the timestamps. If you wish that the output timestamps start at zero, insert a
  5468. setpts filter after the trim filter.
  5469. If multiple start or end options are set, this filter tries to be greedy and
  5470. keep all the frames that match at least one of the specified constraints. To keep
  5471. only the part that matches all the constraints at once, chain multiple trim
  5472. filters.
  5473. The defaults are such that all the input is kept. So it is possible to set e.g.
  5474. just the end values to keep everything before the specified time.
  5475. Examples:
  5476. @itemize
  5477. @item
  5478. drop everything except the second minute of input
  5479. @example
  5480. ffmpeg -i INPUT -vf trim=60:120
  5481. @end example
  5482. @item
  5483. keep only the first second
  5484. @example
  5485. ffmpeg -i INPUT -vf trim=duration=1
  5486. @end example
  5487. @end itemize
  5488. @section unsharp
  5489. Sharpen or blur the input video.
  5490. It accepts the following parameters:
  5491. @table @option
  5492. @item luma_msize_x, lx
  5493. Set the luma matrix horizontal size. It must be an odd integer between
  5494. 3 and 63, default value is 5.
  5495. @item luma_msize_y, ly
  5496. Set the luma matrix vertical size. It must be an odd integer between 3
  5497. and 63, default value is 5.
  5498. @item luma_amount, la
  5499. Set the luma effect strength. It can be a float number, reasonable
  5500. values lay between -1.5 and 1.5.
  5501. Negative values will blur the input video, while positive values will
  5502. sharpen it, a value of zero will disable the effect.
  5503. Default value is 1.0.
  5504. @item chroma_msize_x, cx
  5505. Set the chroma matrix horizontal size. It must be an odd integer
  5506. between 3 and 63, default value is 5.
  5507. @item chroma_msize_y, cy
  5508. Set the chroma matrix vertical size. It must be an odd integer
  5509. between 3 and 63, default value is 5.
  5510. @item chroma_amount, ca
  5511. Set the chroma effect strength. It can be a float number, reasonable
  5512. values lay between -1.5 and 1.5.
  5513. Negative values will blur the input video, while positive values will
  5514. sharpen it, a value of zero will disable the effect.
  5515. Default value is 0.0.
  5516. @item opencl
  5517. If set to 1, specify using OpenCL capabilities, only available if
  5518. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5519. @end table
  5520. All parameters are optional and default to the equivalent of the
  5521. string '5:5:1.0:5:5:0.0'.
  5522. @subsection Examples
  5523. @itemize
  5524. @item
  5525. Apply strong luma sharpen effect:
  5526. @example
  5527. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  5528. @end example
  5529. @item
  5530. Apply strong blur of both luma and chroma parameters:
  5531. @example
  5532. unsharp=7:7:-2:7:7:-2
  5533. @end example
  5534. @end itemize
  5535. @anchor{vidstabdetect}
  5536. @section vidstabdetect
  5537. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  5538. @ref{vidstabtransform} for pass 2.
  5539. This filter generates a file with relative translation and rotation
  5540. transform information about subsequent frames, which is then used by
  5541. the @ref{vidstabtransform} filter.
  5542. To enable compilation of this filter you need to configure FFmpeg with
  5543. @code{--enable-libvidstab}.
  5544. This filter accepts the following options:
  5545. @table @option
  5546. @item result
  5547. Set the path to the file used to write the transforms information.
  5548. Default value is @file{transforms.trf}.
  5549. @item shakiness
  5550. Set how shaky the video is and how quick the camera is. It accepts an
  5551. integer in the range 1-10, a value of 1 means little shakiness, a
  5552. value of 10 means strong shakiness. Default value is 5.
  5553. @item accuracy
  5554. Set the accuracy of the detection process. It must be a value in the
  5555. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  5556. accuracy. Default value is 9.
  5557. @item stepsize
  5558. Set stepsize of the search process. The region around minimum is
  5559. scanned with 1 pixel resolution. Default value is 6.
  5560. @item mincontrast
  5561. Set minimum contrast. Below this value a local measurement field is
  5562. discarded. Must be a floating point value in the range 0-1. Default
  5563. value is 0.3.
  5564. @item tripod
  5565. Set reference frame number for tripod mode.
  5566. If enabled, the motion of the frames is compared to a reference frame
  5567. in the filtered stream, identified by the specified number. The idea
  5568. is to compensate all movements in a more-or-less static scene and keep
  5569. the camera view absolutely still.
  5570. If set to 0, it is disabled. The frames are counted starting from 1.
  5571. @item show
  5572. Show fields and transforms in the resulting frames. It accepts an
  5573. integer in the range 0-2. Default value is 0, which disables any
  5574. visualization.
  5575. @end table
  5576. @subsection Examples
  5577. @itemize
  5578. @item
  5579. Use default values:
  5580. @example
  5581. vidstabdetect
  5582. @end example
  5583. @item
  5584. Analyze strongly shaky movie and put the results in file
  5585. @file{mytransforms.trf}:
  5586. @example
  5587. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  5588. @end example
  5589. @item
  5590. Visualize the result of internal transformations in the resulting
  5591. video:
  5592. @example
  5593. vidstabdetect=show=1
  5594. @end example
  5595. @item
  5596. Analyze a video with medium shakiness using @command{ffmpeg}:
  5597. @example
  5598. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  5599. @end example
  5600. @end itemize
  5601. @anchor{vidstabtransform}
  5602. @section vidstabtransform
  5603. Video stabilization/deshaking: pass 2 of 2,
  5604. see @ref{vidstabdetect} for pass 1.
  5605. Read a file with transform information for each frame and
  5606. apply/compensate them. Together with the @ref{vidstabdetect}
  5607. filter this can be used to deshake videos. See also
  5608. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  5609. the unsharp filter, see below.
  5610. To enable compilation of this filter you need to configure FFmpeg with
  5611. @code{--enable-libvidstab}.
  5612. This filter accepts the following options:
  5613. @table @option
  5614. @item input
  5615. path to the file used to read the transforms (default: @file{transforms.trf})
  5616. @item smoothing
  5617. number of frames (value*2 + 1) used for lowpass filtering the camera movements
  5618. (default: 10). For example a number of 10 means that 21 frames are used
  5619. (10 in the past and 10 in the future) to smoothen the motion in the
  5620. video. A larger values leads to a smoother video, but limits the
  5621. acceleration of the camera (pan/tilt movements).
  5622. @item maxshift
  5623. maximal number of pixels to translate frames (default: -1 no limit)
  5624. @item maxangle
  5625. maximal angle in radians (degree*PI/180) to rotate frames (default: -1
  5626. no limit)
  5627. @item crop
  5628. How to deal with borders that may be visible due to movement
  5629. compensation. Available values are:
  5630. @table @samp
  5631. @item keep
  5632. keep image information from previous frame (default)
  5633. @item black
  5634. fill the border black
  5635. @end table
  5636. @item invert
  5637. @table @samp
  5638. @item 0
  5639. keep transforms normal (default)
  5640. @item 1
  5641. invert transforms
  5642. @end table
  5643. @item relative
  5644. consider transforms as
  5645. @table @samp
  5646. @item 0
  5647. absolute
  5648. @item 1
  5649. relative to previous frame (default)
  5650. @end table
  5651. @item zoom
  5652. percentage to zoom (default: 0)
  5653. @table @samp
  5654. @item >0
  5655. zoom in
  5656. @item <0
  5657. zoom out
  5658. @end table
  5659. @item optzoom
  5660. if 1 then optimal zoom value is determined (default).
  5661. Optimal zoom means no (or only little) border should be visible.
  5662. Note that the value given at zoom is added to the one calculated
  5663. here.
  5664. @item interpol
  5665. type of interpolation
  5666. Available values are:
  5667. @table @samp
  5668. @item no
  5669. no interpolation
  5670. @item linear
  5671. linear only horizontal
  5672. @item bilinear
  5673. linear in both directions (default)
  5674. @item bicubic
  5675. cubic in both directions (slow)
  5676. @end table
  5677. @item tripod
  5678. virtual tripod mode means that the video is stabilized such that the
  5679. camera stays stationary. Use also @code{tripod} option of
  5680. @ref{vidstabdetect}.
  5681. @table @samp
  5682. @item 0
  5683. off (default)
  5684. @item 1
  5685. virtual tripod mode: equivalent to @code{relative=0:smoothing=0}
  5686. @end table
  5687. @end table
  5688. @subsection Examples
  5689. @itemize
  5690. @item
  5691. typical call with default default values:
  5692. (note the unsharp filter which is always recommended)
  5693. @example
  5694. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  5695. @end example
  5696. @item
  5697. zoom in a bit more and load transform data from a given file
  5698. @example
  5699. vidstabtransform=zoom=5:input="mytransforms.trf"
  5700. @end example
  5701. @item
  5702. smoothen the video even more
  5703. @example
  5704. vidstabtransform=smoothing=30
  5705. @end example
  5706. @end itemize
  5707. @section vflip
  5708. Flip the input video vertically.
  5709. For example, to vertically flip a video with @command{ffmpeg}:
  5710. @example
  5711. ffmpeg -i in.avi -vf "vflip" out.avi
  5712. @end example
  5713. @section vignette
  5714. Make or reverse a natural vignetting effect.
  5715. The filter accepts the following options:
  5716. @table @option
  5717. @item angle, a
  5718. Set lens angle expression as a number of radians.
  5719. The value is clipped in the @code{[0,PI/2]} range.
  5720. Default value: @code{"PI/5"}
  5721. @item x0
  5722. @item y0
  5723. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  5724. by default.
  5725. @item mode
  5726. Set forward/backward mode.
  5727. Available modes are:
  5728. @table @samp
  5729. @item forward
  5730. The larger the distance from the central point, the darker the image becomes.
  5731. @item backward
  5732. The larger the distance from the central point, the brighter the image becomes.
  5733. This can be used to reverse a vignette effect, though there is no automatic
  5734. detection to extract the lens @option{angle} and other settings (yet). It can
  5735. also be used to create a burning effect.
  5736. @end table
  5737. Default value is @samp{forward}.
  5738. @item eval
  5739. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  5740. It accepts the following values:
  5741. @table @samp
  5742. @item init
  5743. Evaluate expressions only once during the filter initialization.
  5744. @item frame
  5745. Evaluate expressions for each incoming frame. This is way slower than the
  5746. @samp{init} mode since it requires all the scalers to be re-computed, but it
  5747. allows advanced dynamic expressions.
  5748. @end table
  5749. Default value is @samp{init}.
  5750. @item dither
  5751. Set dithering to reduce the circular banding effects. Default is @code{1}
  5752. (enabled).
  5753. @item aspect
  5754. Set vignette aspect. This setting allows to adjust the shape of the vignette.
  5755. Setting this value to the SAR of the input will make a rectangular vignetting
  5756. following the dimensions of the video.
  5757. Default is @code{1/1}.
  5758. @end table
  5759. @subsection Expressions
  5760. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  5761. following parameters.
  5762. @table @option
  5763. @item w
  5764. @item h
  5765. input width and height
  5766. @item n
  5767. the number of input frame, starting from 0
  5768. @item pts
  5769. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  5770. @var{TB} units, NAN if undefined
  5771. @item r
  5772. frame rate of the input video, NAN if the input frame rate is unknown
  5773. @item t
  5774. the PTS (Presentation TimeStamp) of the filtered video frame,
  5775. expressed in seconds, NAN if undefined
  5776. @item tb
  5777. time base of the input video
  5778. @end table
  5779. @subsection Examples
  5780. @itemize
  5781. @item
  5782. Apply simple strong vignetting effect:
  5783. @example
  5784. vignette=PI/4
  5785. @end example
  5786. @item
  5787. Make a flickering vignetting:
  5788. @example
  5789. vignette='PI/4+random(1)*PI/50':eval=frame
  5790. @end example
  5791. @end itemize
  5792. @anchor{yadif}
  5793. @section yadif
  5794. Deinterlace the input video ("yadif" means "yet another deinterlacing
  5795. filter").
  5796. This filter accepts the following options:
  5797. @table @option
  5798. @item mode
  5799. The interlacing mode to adopt, accepts one of the following values:
  5800. @table @option
  5801. @item 0, send_frame
  5802. output 1 frame for each frame
  5803. @item 1, send_field
  5804. output 1 frame for each field
  5805. @item 2, send_frame_nospatial
  5806. like @code{send_frame} but skip spatial interlacing check
  5807. @item 3, send_field_nospatial
  5808. like @code{send_field} but skip spatial interlacing check
  5809. @end table
  5810. Default value is @code{send_frame}.
  5811. @item parity
  5812. The picture field parity assumed for the input interlaced video, accepts one of
  5813. the following values:
  5814. @table @option
  5815. @item 0, tff
  5816. assume top field first
  5817. @item 1, bff
  5818. assume bottom field first
  5819. @item -1, auto
  5820. enable automatic detection
  5821. @end table
  5822. Default value is @code{auto}.
  5823. If interlacing is unknown or decoder does not export this information,
  5824. top field first will be assumed.
  5825. @item deint
  5826. Specify which frames to deinterlace. Accept one of the following
  5827. values:
  5828. @table @option
  5829. @item 0, all
  5830. deinterlace all frames
  5831. @item 1, interlaced
  5832. only deinterlace frames marked as interlaced
  5833. @end table
  5834. Default value is @code{all}.
  5835. @end table
  5836. @c man end VIDEO FILTERS
  5837. @chapter Video Sources
  5838. @c man begin VIDEO SOURCES
  5839. Below is a description of the currently available video sources.
  5840. @section buffer
  5841. Buffer video frames, and make them available to the filter chain.
  5842. This source is mainly intended for a programmatic use, in particular
  5843. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  5844. This source accepts the following options:
  5845. @table @option
  5846. @item video_size
  5847. Specify the size (width and height) of the buffered video frames.
  5848. @item width
  5849. Input video width.
  5850. @item height
  5851. Input video height.
  5852. @item pix_fmt
  5853. A string representing the pixel format of the buffered video frames.
  5854. It may be a number corresponding to a pixel format, or a pixel format
  5855. name.
  5856. @item time_base
  5857. Specify the timebase assumed by the timestamps of the buffered frames.
  5858. @item frame_rate
  5859. Specify the frame rate expected for the video stream.
  5860. @item pixel_aspect, sar
  5861. Specify the sample aspect ratio assumed by the video frames.
  5862. @item sws_param
  5863. Specify the optional parameters to be used for the scale filter which
  5864. is automatically inserted when an input change is detected in the
  5865. input size or format.
  5866. @end table
  5867. For example:
  5868. @example
  5869. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  5870. @end example
  5871. will instruct the source to accept video frames with size 320x240 and
  5872. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  5873. square pixels (1:1 sample aspect ratio).
  5874. Since the pixel format with name "yuv410p" corresponds to the number 6
  5875. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  5876. this example corresponds to:
  5877. @example
  5878. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  5879. @end example
  5880. Alternatively, the options can be specified as a flat string, but this
  5881. syntax is deprecated:
  5882. @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}]
  5883. @section cellauto
  5884. Create a pattern generated by an elementary cellular automaton.
  5885. The initial state of the cellular automaton can be defined through the
  5886. @option{filename}, and @option{pattern} options. If such options are
  5887. not specified an initial state is created randomly.
  5888. At each new frame a new row in the video is filled with the result of
  5889. the cellular automaton next generation. The behavior when the whole
  5890. frame is filled is defined by the @option{scroll} option.
  5891. This source accepts the following options:
  5892. @table @option
  5893. @item filename, f
  5894. Read the initial cellular automaton state, i.e. the starting row, from
  5895. the specified file.
  5896. In the file, each non-whitespace character is considered an alive
  5897. cell, a newline will terminate the row, and further characters in the
  5898. file will be ignored.
  5899. @item pattern, p
  5900. Read the initial cellular automaton state, i.e. the starting row, from
  5901. the specified string.
  5902. Each non-whitespace character in the string is considered an alive
  5903. cell, a newline will terminate the row, and further characters in the
  5904. string will be ignored.
  5905. @item rate, r
  5906. Set the video rate, that is the number of frames generated per second.
  5907. Default is 25.
  5908. @item random_fill_ratio, ratio
  5909. Set the random fill ratio for the initial cellular automaton row. It
  5910. is a floating point number value ranging from 0 to 1, defaults to
  5911. 1/PHI.
  5912. This option is ignored when a file or a pattern is specified.
  5913. @item random_seed, seed
  5914. Set the seed for filling randomly the initial row, must be an integer
  5915. included between 0 and UINT32_MAX. If not specified, or if explicitly
  5916. set to -1, the filter will try to use a good random seed on a best
  5917. effort basis.
  5918. @item rule
  5919. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  5920. Default value is 110.
  5921. @item size, s
  5922. Set the size of the output video.
  5923. If @option{filename} or @option{pattern} is specified, the size is set
  5924. by default to the width of the specified initial state row, and the
  5925. height is set to @var{width} * PHI.
  5926. If @option{size} is set, it must contain the width of the specified
  5927. pattern string, and the specified pattern will be centered in the
  5928. larger row.
  5929. If a filename or a pattern string is not specified, the size value
  5930. defaults to "320x518" (used for a randomly generated initial state).
  5931. @item scroll
  5932. If set to 1, scroll the output upward when all the rows in the output
  5933. have been already filled. If set to 0, the new generated row will be
  5934. written over the top row just after the bottom row is filled.
  5935. Defaults to 1.
  5936. @item start_full, full
  5937. If set to 1, completely fill the output with generated rows before
  5938. outputting the first frame.
  5939. This is the default behavior, for disabling set the value to 0.
  5940. @item stitch
  5941. If set to 1, stitch the left and right row edges together.
  5942. This is the default behavior, for disabling set the value to 0.
  5943. @end table
  5944. @subsection Examples
  5945. @itemize
  5946. @item
  5947. Read the initial state from @file{pattern}, and specify an output of
  5948. size 200x400.
  5949. @example
  5950. cellauto=f=pattern:s=200x400
  5951. @end example
  5952. @item
  5953. Generate a random initial row with a width of 200 cells, with a fill
  5954. ratio of 2/3:
  5955. @example
  5956. cellauto=ratio=2/3:s=200x200
  5957. @end example
  5958. @item
  5959. Create a pattern generated by rule 18 starting by a single alive cell
  5960. centered on an initial row with width 100:
  5961. @example
  5962. cellauto=p=@@:s=100x400:full=0:rule=18
  5963. @end example
  5964. @item
  5965. Specify a more elaborated initial pattern:
  5966. @example
  5967. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  5968. @end example
  5969. @end itemize
  5970. @section mandelbrot
  5971. Generate a Mandelbrot set fractal, and progressively zoom towards the
  5972. point specified with @var{start_x} and @var{start_y}.
  5973. This source accepts the following options:
  5974. @table @option
  5975. @item end_pts
  5976. Set the terminal pts value. Default value is 400.
  5977. @item end_scale
  5978. Set the terminal scale value.
  5979. Must be a floating point value. Default value is 0.3.
  5980. @item inner
  5981. Set the inner coloring mode, that is the algorithm used to draw the
  5982. Mandelbrot fractal internal region.
  5983. It shall assume one of the following values:
  5984. @table @option
  5985. @item black
  5986. Set black mode.
  5987. @item convergence
  5988. Show time until convergence.
  5989. @item mincol
  5990. Set color based on point closest to the origin of the iterations.
  5991. @item period
  5992. Set period mode.
  5993. @end table
  5994. Default value is @var{mincol}.
  5995. @item bailout
  5996. Set the bailout value. Default value is 10.0.
  5997. @item maxiter
  5998. Set the maximum of iterations performed by the rendering
  5999. algorithm. Default value is 7189.
  6000. @item outer
  6001. Set outer coloring mode.
  6002. It shall assume one of following values:
  6003. @table @option
  6004. @item iteration_count
  6005. Set iteration cound mode.
  6006. @item normalized_iteration_count
  6007. set normalized iteration count mode.
  6008. @end table
  6009. Default value is @var{normalized_iteration_count}.
  6010. @item rate, r
  6011. Set frame rate, expressed as number of frames per second. Default
  6012. value is "25".
  6013. @item size, s
  6014. Set frame size. Default value is "640x480".
  6015. @item start_scale
  6016. Set the initial scale value. Default value is 3.0.
  6017. @item start_x
  6018. Set the initial x position. Must be a floating point value between
  6019. -100 and 100. Default value is -0.743643887037158704752191506114774.
  6020. @item start_y
  6021. Set the initial y position. Must be a floating point value between
  6022. -100 and 100. Default value is -0.131825904205311970493132056385139.
  6023. @end table
  6024. @section mptestsrc
  6025. Generate various test patterns, as generated by the MPlayer test filter.
  6026. The size of the generated video is fixed, and is 256x256.
  6027. This source is useful in particular for testing encoding features.
  6028. This source accepts the following options:
  6029. @table @option
  6030. @item rate, r
  6031. Specify the frame rate of the sourced video, as the number of frames
  6032. generated per second. It has to be a string in the format
  6033. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  6034. number or a valid video frame rate abbreviation. The default value is
  6035. "25".
  6036. @item duration, d
  6037. Set the video duration of the sourced video. The accepted syntax is:
  6038. @example
  6039. [-]HH:MM:SS[.m...]
  6040. [-]S+[.m...]
  6041. @end example
  6042. See also the function @code{av_parse_time()}.
  6043. If not specified, or the expressed duration is negative, the video is
  6044. supposed to be generated forever.
  6045. @item test, t
  6046. Set the number or the name of the test to perform. Supported tests are:
  6047. @table @option
  6048. @item dc_luma
  6049. @item dc_chroma
  6050. @item freq_luma
  6051. @item freq_chroma
  6052. @item amp_luma
  6053. @item amp_chroma
  6054. @item cbp
  6055. @item mv
  6056. @item ring1
  6057. @item ring2
  6058. @item all
  6059. @end table
  6060. Default value is "all", which will cycle through the list of all tests.
  6061. @end table
  6062. For example the following:
  6063. @example
  6064. testsrc=t=dc_luma
  6065. @end example
  6066. will generate a "dc_luma" test pattern.
  6067. @section frei0r_src
  6068. Provide a frei0r source.
  6069. To enable compilation of this filter you need to install the frei0r
  6070. header and configure FFmpeg with @code{--enable-frei0r}.
  6071. This source accepts the following options:
  6072. @table @option
  6073. @item size
  6074. The size of the video to generate, may be a string of the form
  6075. @var{width}x@var{height} or a frame size abbreviation.
  6076. @item framerate
  6077. Framerate of the generated video, may be a string of the form
  6078. @var{num}/@var{den} or a frame rate abbreviation.
  6079. @item filter_name
  6080. The name to the frei0r source to load. For more information regarding frei0r and
  6081. how to set the parameters read the section @ref{frei0r} in the description of
  6082. the video filters.
  6083. @item filter_params
  6084. A '|'-separated list of parameters to pass to the frei0r source.
  6085. @end table
  6086. For example, to generate a frei0r partik0l source with size 200x200
  6087. and frame rate 10 which is overlayed on the overlay filter main input:
  6088. @example
  6089. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  6090. @end example
  6091. @section life
  6092. Generate a life pattern.
  6093. This source is based on a generalization of John Conway's life game.
  6094. The sourced input represents a life grid, each pixel represents a cell
  6095. which can be in one of two possible states, alive or dead. Every cell
  6096. interacts with its eight neighbours, which are the cells that are
  6097. horizontally, vertically, or diagonally adjacent.
  6098. At each interaction the grid evolves according to the adopted rule,
  6099. which specifies the number of neighbor alive cells which will make a
  6100. cell stay alive or born. The @option{rule} option allows to specify
  6101. the rule to adopt.
  6102. This source accepts the following options:
  6103. @table @option
  6104. @item filename, f
  6105. Set the file from which to read the initial grid state. In the file,
  6106. each non-whitespace character is considered an alive cell, and newline
  6107. is used to delimit the end of each row.
  6108. If this option is not specified, the initial grid is generated
  6109. randomly.
  6110. @item rate, r
  6111. Set the video rate, that is the number of frames generated per second.
  6112. Default is 25.
  6113. @item random_fill_ratio, ratio
  6114. Set the random fill ratio for the initial random grid. It is a
  6115. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  6116. It is ignored when a file is specified.
  6117. @item random_seed, seed
  6118. Set the seed for filling the initial random grid, must be an integer
  6119. included between 0 and UINT32_MAX. If not specified, or if explicitly
  6120. set to -1, the filter will try to use a good random seed on a best
  6121. effort basis.
  6122. @item rule
  6123. Set the life rule.
  6124. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  6125. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  6126. @var{NS} specifies the number of alive neighbor cells which make a
  6127. live cell stay alive, and @var{NB} the number of alive neighbor cells
  6128. which make a dead cell to become alive (i.e. to "born").
  6129. "s" and "b" can be used in place of "S" and "B", respectively.
  6130. Alternatively a rule can be specified by an 18-bits integer. The 9
  6131. high order bits are used to encode the next cell state if it is alive
  6132. for each number of neighbor alive cells, the low order bits specify
  6133. the rule for "borning" new cells. Higher order bits encode for an
  6134. higher number of neighbor cells.
  6135. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  6136. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  6137. Default value is "S23/B3", which is the original Conway's game of life
  6138. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  6139. cells, and will born a new cell if there are three alive cells around
  6140. a dead cell.
  6141. @item size, s
  6142. Set the size of the output video.
  6143. If @option{filename} is specified, the size is set by default to the
  6144. same size of the input file. If @option{size} is set, it must contain
  6145. the size specified in the input file, and the initial grid defined in
  6146. that file is centered in the larger resulting area.
  6147. If a filename is not specified, the size value defaults to "320x240"
  6148. (used for a randomly generated initial grid).
  6149. @item stitch
  6150. If set to 1, stitch the left and right grid edges together, and the
  6151. top and bottom edges also. Defaults to 1.
  6152. @item mold
  6153. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  6154. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  6155. value from 0 to 255.
  6156. @item life_color
  6157. Set the color of living (or new born) cells.
  6158. @item death_color
  6159. Set the color of dead cells. If @option{mold} is set, this is the first color
  6160. used to represent a dead cell.
  6161. @item mold_color
  6162. Set mold color, for definitely dead and moldy cells.
  6163. @end table
  6164. @subsection Examples
  6165. @itemize
  6166. @item
  6167. Read a grid from @file{pattern}, and center it on a grid of size
  6168. 300x300 pixels:
  6169. @example
  6170. life=f=pattern:s=300x300
  6171. @end example
  6172. @item
  6173. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  6174. @example
  6175. life=ratio=2/3:s=200x200
  6176. @end example
  6177. @item
  6178. Specify a custom rule for evolving a randomly generated grid:
  6179. @example
  6180. life=rule=S14/B34
  6181. @end example
  6182. @item
  6183. Full example with slow death effect (mold) using @command{ffplay}:
  6184. @example
  6185. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  6186. @end example
  6187. @end itemize
  6188. @anchor{color}
  6189. @anchor{haldclutsrc}
  6190. @anchor{nullsrc}
  6191. @anchor{rgbtestsrc}
  6192. @anchor{smptebars}
  6193. @anchor{smptehdbars}
  6194. @anchor{testsrc}
  6195. @section color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  6196. The @code{color} source provides an uniformly colored input.
  6197. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  6198. @ref{haldclut} filter.
  6199. The @code{nullsrc} source returns unprocessed video frames. It is
  6200. mainly useful to be employed in analysis / debugging tools, or as the
  6201. source for filters which ignore the input data.
  6202. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  6203. detecting RGB vs BGR issues. You should see a red, green and blue
  6204. stripe from top to bottom.
  6205. The @code{smptebars} source generates a color bars pattern, based on
  6206. the SMPTE Engineering Guideline EG 1-1990.
  6207. The @code{smptehdbars} source generates a color bars pattern, based on
  6208. the SMPTE RP 219-2002.
  6209. The @code{testsrc} source generates a test video pattern, showing a
  6210. color pattern, a scrolling gradient and a timestamp. This is mainly
  6211. intended for testing purposes.
  6212. The sources accept the following options:
  6213. @table @option
  6214. @item color, c
  6215. Specify the color of the source, only available in the @code{color}
  6216. source. It can be the name of a color (case insensitive match) or a
  6217. 0xRRGGBB[AA] sequence, possibly followed by an alpha specifier. The
  6218. default value is "black".
  6219. @item level
  6220. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  6221. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  6222. pixels to be used as identity matrix for 3D lookup tables. Each component is
  6223. coded on a @code{1/(N*N)} scale.
  6224. @item size, s
  6225. Specify the size of the sourced video, it may be a string of the form
  6226. @var{width}x@var{height}, or the name of a size abbreviation. The
  6227. default value is "320x240".
  6228. This option is not available with the @code{haldclutsrc} filter.
  6229. @item rate, r
  6230. Specify the frame rate of the sourced video, as the number of frames
  6231. generated per second. It has to be a string in the format
  6232. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  6233. number or a valid video frame rate abbreviation. The default value is
  6234. "25".
  6235. @item sar
  6236. Set the sample aspect ratio of the sourced video.
  6237. @item duration, d
  6238. Set the video duration of the sourced video. The accepted syntax is:
  6239. @example
  6240. [-]HH[:MM[:SS[.m...]]]
  6241. [-]S+[.m...]
  6242. @end example
  6243. See also the function @code{av_parse_time()}.
  6244. If not specified, or the expressed duration is negative, the video is
  6245. supposed to be generated forever.
  6246. @item decimals, n
  6247. Set the number of decimals to show in the timestamp, only available in the
  6248. @code{testsrc} source.
  6249. The displayed timestamp value will correspond to the original
  6250. timestamp value multiplied by the power of 10 of the specified
  6251. value. Default value is 0.
  6252. @end table
  6253. For example the following:
  6254. @example
  6255. testsrc=duration=5.3:size=qcif:rate=10
  6256. @end example
  6257. will generate a video with a duration of 5.3 seconds, with size
  6258. 176x144 and a frame rate of 10 frames per second.
  6259. The following graph description will generate a red source
  6260. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  6261. frames per second.
  6262. @example
  6263. color=c=red@@0.2:s=qcif:r=10
  6264. @end example
  6265. If the input content is to be ignored, @code{nullsrc} can be used. The
  6266. following command generates noise in the luminance plane by employing
  6267. the @code{geq} filter:
  6268. @example
  6269. nullsrc=s=256x256, geq=random(1)*255:128:128
  6270. @end example
  6271. @subsection Commands
  6272. The @code{color} source supports the following commands:
  6273. @table @option
  6274. @item c, color
  6275. Set the color of the created image. Accepts the same syntax of the
  6276. corresponding @option{color} option.
  6277. @end table
  6278. @c man end VIDEO SOURCES
  6279. @chapter Video Sinks
  6280. @c man begin VIDEO SINKS
  6281. Below is a description of the currently available video sinks.
  6282. @section buffersink
  6283. Buffer video frames, and make them available to the end of the filter
  6284. graph.
  6285. This sink is mainly intended for a programmatic use, in particular
  6286. through the interface defined in @file{libavfilter/buffersink.h}
  6287. or the options system.
  6288. It accepts a pointer to an AVBufferSinkContext structure, which
  6289. defines the incoming buffers' formats, to be passed as the opaque
  6290. parameter to @code{avfilter_init_filter} for initialization.
  6291. @section nullsink
  6292. Null video sink, do absolutely nothing with the input video. It is
  6293. mainly useful as a template and to be employed in analysis / debugging
  6294. tools.
  6295. @c man end VIDEO SINKS
  6296. @chapter Multimedia Filters
  6297. @c man begin MULTIMEDIA FILTERS
  6298. Below is a description of the currently available multimedia filters.
  6299. @section avectorscope
  6300. Convert input audio to a video output, representing the audio vector
  6301. scope.
  6302. The filter is used to measure the difference between channels of stereo
  6303. audio stream. A monoaural signal, consisting of identical left and right
  6304. signal, results in straight vertical line. Any stereo separation is visible
  6305. as a deviation from this line, creating a Lissajous figure.
  6306. If the straight (or deviation from it) but horizontal line appears this
  6307. indicates that the left and right channels are out of phase.
  6308. The filter accepts the following options:
  6309. @table @option
  6310. @item mode, m
  6311. Set the vectorscope mode.
  6312. Available values are:
  6313. @table @samp
  6314. @item lissajous
  6315. Lissajous rotated by 45 degrees.
  6316. @item lissajous_xy
  6317. Same as above but not rotated.
  6318. @end table
  6319. Default value is @samp{lissajous}.
  6320. @item size, s
  6321. Set the video size for the output. Default value is @code{400x400}.
  6322. @item rate, r
  6323. Set the output frame rate. Default value is @code{25}.
  6324. @item rc
  6325. @item gc
  6326. @item bc
  6327. Specify the red, green and blue contrast. Default values are @code{40}, @code{160} and @code{80}.
  6328. Allowed range is @code{[0, 255]}.
  6329. @item rf
  6330. @item gf
  6331. @item bf
  6332. Specify the red, green and blue fade. Default values are @code{15}, @code{10} and @code{5}.
  6333. Allowed range is @code{[0, 255]}.
  6334. @item zoom
  6335. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  6336. @end table
  6337. @subsection Examples
  6338. @itemize
  6339. @item
  6340. Complete example using @command{ffplay}:
  6341. @example
  6342. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  6343. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  6344. @end example
  6345. @end itemize
  6346. @section concat
  6347. Concatenate audio and video streams, joining them together one after the
  6348. other.
  6349. The filter works on segments of synchronized video and audio streams. All
  6350. segments must have the same number of streams of each type, and that will
  6351. also be the number of streams at output.
  6352. The filter accepts the following options:
  6353. @table @option
  6354. @item n
  6355. Set the number of segments. Default is 2.
  6356. @item v
  6357. Set the number of output video streams, that is also the number of video
  6358. streams in each segment. Default is 1.
  6359. @item a
  6360. Set the number of output audio streams, that is also the number of video
  6361. streams in each segment. Default is 0.
  6362. @item unsafe
  6363. Activate unsafe mode: do not fail if segments have a different format.
  6364. @end table
  6365. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  6366. @var{a} audio outputs.
  6367. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  6368. segment, in the same order as the outputs, then the inputs for the second
  6369. segment, etc.
  6370. Related streams do not always have exactly the same duration, for various
  6371. reasons including codec frame size or sloppy authoring. For that reason,
  6372. related synchronized streams (e.g. a video and its audio track) should be
  6373. concatenated at once. The concat filter will use the duration of the longest
  6374. stream in each segment (except the last one), and if necessary pad shorter
  6375. audio streams with silence.
  6376. For this filter to work correctly, all segments must start at timestamp 0.
  6377. All corresponding streams must have the same parameters in all segments; the
  6378. filtering system will automatically select a common pixel format for video
  6379. streams, and a common sample format, sample rate and channel layout for
  6380. audio streams, but other settings, such as resolution, must be converted
  6381. explicitly by the user.
  6382. Different frame rates are acceptable but will result in variable frame rate
  6383. at output; be sure to configure the output file to handle it.
  6384. @subsection Examples
  6385. @itemize
  6386. @item
  6387. Concatenate an opening, an episode and an ending, all in bilingual version
  6388. (video in stream 0, audio in streams 1 and 2):
  6389. @example
  6390. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  6391. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  6392. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  6393. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  6394. @end example
  6395. @item
  6396. Concatenate two parts, handling audio and video separately, using the
  6397. (a)movie sources, and adjusting the resolution:
  6398. @example
  6399. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  6400. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  6401. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  6402. @end example
  6403. Note that a desync will happen at the stitch if the audio and video streams
  6404. do not have exactly the same duration in the first file.
  6405. @end itemize
  6406. @section ebur128
  6407. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  6408. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  6409. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  6410. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  6411. The filter also has a video output (see the @var{video} option) with a real
  6412. time graph to observe the loudness evolution. The graphic contains the logged
  6413. message mentioned above, so it is not printed anymore when this option is set,
  6414. unless the verbose logging is set. The main graphing area contains the
  6415. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  6416. the momentary loudness (400 milliseconds).
  6417. More information about the Loudness Recommendation EBU R128 on
  6418. @url{http://tech.ebu.ch/loudness}.
  6419. The filter accepts the following options:
  6420. @table @option
  6421. @item video
  6422. Activate the video output. The audio stream is passed unchanged whether this
  6423. option is set or no. The video stream will be the first output stream if
  6424. activated. Default is @code{0}.
  6425. @item size
  6426. Set the video size. This option is for video only. Default and minimum
  6427. resolution is @code{640x480}.
  6428. @item meter
  6429. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  6430. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  6431. other integer value between this range is allowed.
  6432. @item metadata
  6433. Set metadata injection. If set to @code{1}, the audio input will be segmented
  6434. into 100ms output frames, each of them containing various loudness information
  6435. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  6436. Default is @code{0}.
  6437. @item framelog
  6438. Force the frame logging level.
  6439. Available values are:
  6440. @table @samp
  6441. @item info
  6442. information logging level
  6443. @item verbose
  6444. verbose logging level
  6445. @end table
  6446. By default, the logging level is set to @var{info}. If the @option{video} or
  6447. the @option{metadata} options are set, it switches to @var{verbose}.
  6448. @end table
  6449. @subsection Examples
  6450. @itemize
  6451. @item
  6452. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  6453. @example
  6454. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  6455. @end example
  6456. @item
  6457. Run an analysis with @command{ffmpeg}:
  6458. @example
  6459. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  6460. @end example
  6461. @end itemize
  6462. @section interleave, ainterleave
  6463. Temporally interleave frames from several inputs.
  6464. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  6465. These filters read frames from several inputs and send the oldest
  6466. queued frame to the output.
  6467. Input streams must have a well defined, monotonically increasing frame
  6468. timestamp values.
  6469. In order to submit one frame to output, these filters need to enqueue
  6470. at least one frame for each input, so they cannot work in case one
  6471. input is not yet terminated and will not receive incoming frames.
  6472. For example consider the case when one input is a @code{select} filter
  6473. which always drop input frames. The @code{interleave} filter will keep
  6474. reading from that input, but it will never be able to send new frames
  6475. to output until the input will send an end-of-stream signal.
  6476. Also, depending on inputs synchronization, the filters will drop
  6477. frames in case one input receives more frames than the other ones, and
  6478. the queue is already filled.
  6479. These filters accept the following options:
  6480. @table @option
  6481. @item nb_inputs, n
  6482. Set the number of different inputs, it is 2 by default.
  6483. @end table
  6484. @subsection Examples
  6485. @itemize
  6486. @item
  6487. Interleave frames belonging to different streams using @command{ffmpeg}:
  6488. @example
  6489. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  6490. @end example
  6491. @item
  6492. Add flickering blur effect:
  6493. @example
  6494. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  6495. @end example
  6496. @end itemize
  6497. @section perms, aperms
  6498. Set read/write permissions for the output frames.
  6499. These filters are mainly aimed at developers to test direct path in the
  6500. following filter in the filtergraph.
  6501. The filters accept the following options:
  6502. @table @option
  6503. @item mode
  6504. Select the permissions mode.
  6505. It accepts the following values:
  6506. @table @samp
  6507. @item none
  6508. Do nothing. This is the default.
  6509. @item ro
  6510. Set all the output frames read-only.
  6511. @item rw
  6512. Set all the output frames directly writable.
  6513. @item toggle
  6514. Make the frame read-only if writable, and writable if read-only.
  6515. @item random
  6516. Set each output frame read-only or writable randomly.
  6517. @end table
  6518. @item seed
  6519. Set the seed for the @var{random} mode, must be an integer included between
  6520. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  6521. @code{-1}, the filter will try to use a good random seed on a best effort
  6522. basis.
  6523. @end table
  6524. Note: in case of auto-inserted filter between the permission filter and the
  6525. following one, the permission might not be received as expected in that
  6526. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  6527. perms/aperms filter can avoid this problem.
  6528. @section select, aselect
  6529. Select frames to pass in output.
  6530. This filter accepts the following options:
  6531. @table @option
  6532. @item expr, e
  6533. Set expression, which is evaluated for each input frame.
  6534. If the expression is evaluated to zero, the frame is discarded.
  6535. If the evaluation result is negative or NaN, the frame is sent to the
  6536. first output; otherwise it is sent to the output with index
  6537. @code{ceil(val)-1}, assuming that the input index starts from 0.
  6538. For example a value of @code{1.2} corresponds to the output with index
  6539. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  6540. @item outputs, n
  6541. Set the number of outputs. The output to which to send the selected
  6542. frame is based on the result of the evaluation. Default value is 1.
  6543. @end table
  6544. The expression can contain the following constants:
  6545. @table @option
  6546. @item n
  6547. the sequential number of the filtered frame, starting from 0
  6548. @item selected_n
  6549. the sequential number of the selected frame, starting from 0
  6550. @item prev_selected_n
  6551. the sequential number of the last selected frame, NAN if undefined
  6552. @item TB
  6553. timebase of the input timestamps
  6554. @item pts
  6555. the PTS (Presentation TimeStamp) of the filtered video frame,
  6556. expressed in @var{TB} units, NAN if undefined
  6557. @item t
  6558. the PTS (Presentation TimeStamp) of the filtered video frame,
  6559. expressed in seconds, NAN if undefined
  6560. @item prev_pts
  6561. the PTS of the previously filtered video frame, NAN if undefined
  6562. @item prev_selected_pts
  6563. the PTS of the last previously filtered video frame, NAN if undefined
  6564. @item prev_selected_t
  6565. the PTS of the last previously selected video frame, NAN if undefined
  6566. @item start_pts
  6567. the PTS of the first video frame in the video, NAN if undefined
  6568. @item start_t
  6569. the time of the first video frame in the video, NAN if undefined
  6570. @item pict_type @emph{(video only)}
  6571. the type of the filtered frame, can assume one of the following
  6572. values:
  6573. @table @option
  6574. @item I
  6575. @item P
  6576. @item B
  6577. @item S
  6578. @item SI
  6579. @item SP
  6580. @item BI
  6581. @end table
  6582. @item interlace_type @emph{(video only)}
  6583. the frame interlace type, can assume one of the following values:
  6584. @table @option
  6585. @item PROGRESSIVE
  6586. the frame is progressive (not interlaced)
  6587. @item TOPFIRST
  6588. the frame is top-field-first
  6589. @item BOTTOMFIRST
  6590. the frame is bottom-field-first
  6591. @end table
  6592. @item consumed_sample_n @emph{(audio only)}
  6593. the number of selected samples before the current frame
  6594. @item samples_n @emph{(audio only)}
  6595. the number of samples in the current frame
  6596. @item sample_rate @emph{(audio only)}
  6597. the input sample rate
  6598. @item key
  6599. 1 if the filtered frame is a key-frame, 0 otherwise
  6600. @item pos
  6601. the position in the file of the filtered frame, -1 if the information
  6602. is not available (e.g. for synthetic video)
  6603. @item scene @emph{(video only)}
  6604. value between 0 and 1 to indicate a new scene; a low value reflects a low
  6605. probability for the current frame to introduce a new scene, while a higher
  6606. value means the current frame is more likely to be one (see the example below)
  6607. @end table
  6608. The default value of the select expression is "1".
  6609. @subsection Examples
  6610. @itemize
  6611. @item
  6612. Select all frames in input:
  6613. @example
  6614. select
  6615. @end example
  6616. The example above is the same as:
  6617. @example
  6618. select=1
  6619. @end example
  6620. @item
  6621. Skip all frames:
  6622. @example
  6623. select=0
  6624. @end example
  6625. @item
  6626. Select only I-frames:
  6627. @example
  6628. select='eq(pict_type\,I)'
  6629. @end example
  6630. @item
  6631. Select one frame every 100:
  6632. @example
  6633. select='not(mod(n\,100))'
  6634. @end example
  6635. @item
  6636. Select only frames contained in the 10-20 time interval:
  6637. @example
  6638. select='gte(t\,10)*lte(t\,20)'
  6639. @end example
  6640. @item
  6641. Select only I frames contained in the 10-20 time interval:
  6642. @example
  6643. select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
  6644. @end example
  6645. @item
  6646. Select frames with a minimum distance of 10 seconds:
  6647. @example
  6648. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  6649. @end example
  6650. @item
  6651. Use aselect to select only audio frames with samples number > 100:
  6652. @example
  6653. aselect='gt(samples_n\,100)'
  6654. @end example
  6655. @item
  6656. Create a mosaic of the first scenes:
  6657. @example
  6658. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  6659. @end example
  6660. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  6661. choice.
  6662. @item
  6663. Send even and odd frames to separate outputs, and compose them:
  6664. @example
  6665. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  6666. @end example
  6667. @end itemize
  6668. @section sendcmd, asendcmd
  6669. Send commands to filters in the filtergraph.
  6670. These filters read commands to be sent to other filters in the
  6671. filtergraph.
  6672. @code{sendcmd} must be inserted between two video filters,
  6673. @code{asendcmd} must be inserted between two audio filters, but apart
  6674. from that they act the same way.
  6675. The specification of commands can be provided in the filter arguments
  6676. with the @var{commands} option, or in a file specified by the
  6677. @var{filename} option.
  6678. These filters accept the following options:
  6679. @table @option
  6680. @item commands, c
  6681. Set the commands to be read and sent to the other filters.
  6682. @item filename, f
  6683. Set the filename of the commands to be read and sent to the other
  6684. filters.
  6685. @end table
  6686. @subsection Commands syntax
  6687. A commands description consists of a sequence of interval
  6688. specifications, comprising a list of commands to be executed when a
  6689. particular event related to that interval occurs. The occurring event
  6690. is typically the current frame time entering or leaving a given time
  6691. interval.
  6692. An interval is specified by the following syntax:
  6693. @example
  6694. @var{START}[-@var{END}] @var{COMMANDS};
  6695. @end example
  6696. The time interval is specified by the @var{START} and @var{END} times.
  6697. @var{END} is optional and defaults to the maximum time.
  6698. The current frame time is considered within the specified interval if
  6699. it is included in the interval [@var{START}, @var{END}), that is when
  6700. the time is greater or equal to @var{START} and is lesser than
  6701. @var{END}.
  6702. @var{COMMANDS} consists of a sequence of one or more command
  6703. specifications, separated by ",", relating to that interval. The
  6704. syntax of a command specification is given by:
  6705. @example
  6706. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  6707. @end example
  6708. @var{FLAGS} is optional and specifies the type of events relating to
  6709. the time interval which enable sending the specified command, and must
  6710. be a non-null sequence of identifier flags separated by "+" or "|" and
  6711. enclosed between "[" and "]".
  6712. The following flags are recognized:
  6713. @table @option
  6714. @item enter
  6715. The command is sent when the current frame timestamp enters the
  6716. specified interval. In other words, the command is sent when the
  6717. previous frame timestamp was not in the given interval, and the
  6718. current is.
  6719. @item leave
  6720. The command is sent when the current frame timestamp leaves the
  6721. specified interval. In other words, the command is sent when the
  6722. previous frame timestamp was in the given interval, and the
  6723. current is not.
  6724. @end table
  6725. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  6726. assumed.
  6727. @var{TARGET} specifies the target of the command, usually the name of
  6728. the filter class or a specific filter instance name.
  6729. @var{COMMAND} specifies the name of the command for the target filter.
  6730. @var{ARG} is optional and specifies the optional list of argument for
  6731. the given @var{COMMAND}.
  6732. Between one interval specification and another, whitespaces, or
  6733. sequences of characters starting with @code{#} until the end of line,
  6734. are ignored and can be used to annotate comments.
  6735. A simplified BNF description of the commands specification syntax
  6736. follows:
  6737. @example
  6738. @var{COMMAND_FLAG} ::= "enter" | "leave"
  6739. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  6740. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  6741. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  6742. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  6743. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  6744. @end example
  6745. @subsection Examples
  6746. @itemize
  6747. @item
  6748. Specify audio tempo change at second 4:
  6749. @example
  6750. asendcmd=c='4.0 atempo tempo 1.5',atempo
  6751. @end example
  6752. @item
  6753. Specify a list of drawtext and hue commands in a file.
  6754. @example
  6755. # show text in the interval 5-10
  6756. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  6757. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  6758. # desaturate the image in the interval 15-20
  6759. 15.0-20.0 [enter] hue s 0,
  6760. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  6761. [leave] hue s 1,
  6762. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  6763. # apply an exponential saturation fade-out effect, starting from time 25
  6764. 25 [enter] hue s exp(25-t)
  6765. @end example
  6766. A filtergraph allowing to read and process the above command list
  6767. stored in a file @file{test.cmd}, can be specified with:
  6768. @example
  6769. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  6770. @end example
  6771. @end itemize
  6772. @anchor{setpts}
  6773. @section setpts, asetpts
  6774. Change the PTS (presentation timestamp) of the input frames.
  6775. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  6776. This filter accepts the following options:
  6777. @table @option
  6778. @item expr
  6779. The expression which is evaluated for each frame to construct its timestamp.
  6780. @end table
  6781. The expression is evaluated through the eval API and can contain the following
  6782. constants:
  6783. @table @option
  6784. @item FRAME_RATE
  6785. frame rate, only defined for constant frame-rate video
  6786. @item PTS
  6787. the presentation timestamp in input
  6788. @item N
  6789. the count of the input frame for video or the number of consumed samples,
  6790. not including the current frame for audio, starting from 0.
  6791. @item NB_CONSUMED_SAMPLES
  6792. the number of consumed samples, not including the current frame (only
  6793. audio)
  6794. @item NB_SAMPLES, S
  6795. the number of samples in the current frame (only audio)
  6796. @item SAMPLE_RATE, SR
  6797. audio sample rate
  6798. @item STARTPTS
  6799. the PTS of the first frame
  6800. @item STARTT
  6801. the time in seconds of the first frame
  6802. @item INTERLACED
  6803. tell if the current frame is interlaced
  6804. @item T
  6805. the time in seconds of the current frame
  6806. @item TB
  6807. the time base
  6808. @item POS
  6809. original position in the file of the frame, or undefined if undefined
  6810. for the current frame
  6811. @item PREV_INPTS
  6812. previous input PTS
  6813. @item PREV_INT
  6814. previous input time in seconds
  6815. @item PREV_OUTPTS
  6816. previous output PTS
  6817. @item PREV_OUTT
  6818. previous output time in seconds
  6819. @item RTCTIME
  6820. wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  6821. instead.
  6822. @item RTCSTART
  6823. wallclock (RTC) time at the start of the movie in microseconds
  6824. @end table
  6825. @subsection Examples
  6826. @itemize
  6827. @item
  6828. Start counting PTS from zero
  6829. @example
  6830. setpts=PTS-STARTPTS
  6831. @end example
  6832. @item
  6833. Apply fast motion effect:
  6834. @example
  6835. setpts=0.5*PTS
  6836. @end example
  6837. @item
  6838. Apply slow motion effect:
  6839. @example
  6840. setpts=2.0*PTS
  6841. @end example
  6842. @item
  6843. Set fixed rate of 25 frames per second:
  6844. @example
  6845. setpts=N/(25*TB)
  6846. @end example
  6847. @item
  6848. Set fixed rate 25 fps with some jitter:
  6849. @example
  6850. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  6851. @end example
  6852. @item
  6853. Apply an offset of 10 seconds to the input PTS:
  6854. @example
  6855. setpts=PTS+10/TB
  6856. @end example
  6857. @item
  6858. Generate timestamps from a "live source" and rebase onto the current timebase:
  6859. @example
  6860. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  6861. @end example
  6862. @item
  6863. Generate timestamps by counting samples:
  6864. @example
  6865. asetpts=N/SR/TB
  6866. @end example
  6867. @end itemize
  6868. @section settb, asettb
  6869. Set the timebase to use for the output frames timestamps.
  6870. It is mainly useful for testing timebase configuration.
  6871. This filter accepts the following options:
  6872. @table @option
  6873. @item expr, tb
  6874. The expression which is evaluated into the output timebase.
  6875. @end table
  6876. The value for @option{tb} is an arithmetic expression representing a
  6877. rational. The expression can contain the constants "AVTB" (the default
  6878. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  6879. audio only). Default value is "intb".
  6880. @subsection Examples
  6881. @itemize
  6882. @item
  6883. Set the timebase to 1/25:
  6884. @example
  6885. settb=expr=1/25
  6886. @end example
  6887. @item
  6888. Set the timebase to 1/10:
  6889. @example
  6890. settb=expr=0.1
  6891. @end example
  6892. @item
  6893. Set the timebase to 1001/1000:
  6894. @example
  6895. settb=1+0.001
  6896. @end example
  6897. @item
  6898. Set the timebase to 2*intb:
  6899. @example
  6900. settb=2*intb
  6901. @end example
  6902. @item
  6903. Set the default timebase value:
  6904. @example
  6905. settb=AVTB
  6906. @end example
  6907. @end itemize
  6908. @section showspectrum
  6909. Convert input audio to a video output, representing the audio frequency
  6910. spectrum.
  6911. The filter accepts the following options:
  6912. @table @option
  6913. @item size, s
  6914. Specify the video size for the output. Default value is @code{640x512}.
  6915. @item slide
  6916. Specify if the spectrum should slide along the window. Default value is
  6917. @code{0}.
  6918. @item mode
  6919. Specify display mode.
  6920. It accepts the following values:
  6921. @table @samp
  6922. @item combined
  6923. all channels are displayed in the same row
  6924. @item separate
  6925. all channels are displayed in separate rows
  6926. @end table
  6927. Default value is @samp{combined}.
  6928. @item color
  6929. Specify display color mode.
  6930. It accepts the following values:
  6931. @table @samp
  6932. @item channel
  6933. each channel is displayed in a separate color
  6934. @item intensity
  6935. each channel is is displayed using the same color scheme
  6936. @end table
  6937. Default value is @samp{channel}.
  6938. @item scale
  6939. Specify scale used for calculating intensity color values.
  6940. It accepts the following values:
  6941. @table @samp
  6942. @item lin
  6943. linear
  6944. @item sqrt
  6945. square root, default
  6946. @item cbrt
  6947. cubic root
  6948. @item log
  6949. logarithmic
  6950. @end table
  6951. Default value is @samp{sqrt}.
  6952. @item saturation
  6953. Set saturation modifier for displayed colors. Negative values provide
  6954. alternative color scheme. @code{0} is no saturation at all.
  6955. Saturation must be in [-10.0, 10.0] range.
  6956. Default value is @code{1}.
  6957. @end table
  6958. The usage is very similar to the showwaves filter; see the examples in that
  6959. section.
  6960. @subsection Examples
  6961. @itemize
  6962. @item
  6963. Large window with logarithmic color scaling:
  6964. @example
  6965. showspectrum=s=1280x480:scale=log
  6966. @end example
  6967. @item
  6968. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  6969. @example
  6970. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  6971. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  6972. @end example
  6973. @end itemize
  6974. @section showwaves
  6975. Convert input audio to a video output, representing the samples waves.
  6976. The filter accepts the following options:
  6977. @table @option
  6978. @item size, s
  6979. Specify the video size for the output. Default value is "600x240".
  6980. @item mode
  6981. Set display mode.
  6982. Available values are:
  6983. @table @samp
  6984. @item point
  6985. Draw a point for each sample.
  6986. @item line
  6987. Draw a vertical line for each sample.
  6988. @end table
  6989. Default value is @code{point}.
  6990. @item n
  6991. Set the number of samples which are printed on the same column. A
  6992. larger value will decrease the frame rate. Must be a positive
  6993. integer. This option can be set only if the value for @var{rate}
  6994. is not explicitly specified.
  6995. @item rate, r
  6996. Set the (approximate) output frame rate. This is done by setting the
  6997. option @var{n}. Default value is "25".
  6998. @end table
  6999. @subsection Examples
  7000. @itemize
  7001. @item
  7002. Output the input file audio and the corresponding video representation
  7003. at the same time:
  7004. @example
  7005. amovie=a.mp3,asplit[out0],showwaves[out1]
  7006. @end example
  7007. @item
  7008. Create a synthetic signal and show it with showwaves, forcing a
  7009. frame rate of 30 frames per second:
  7010. @example
  7011. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  7012. @end example
  7013. @end itemize
  7014. @section split, asplit
  7015. Split input into several identical outputs.
  7016. @code{asplit} works with audio input, @code{split} with video.
  7017. The filter accepts a single parameter which specifies the number of outputs. If
  7018. unspecified, it defaults to 2.
  7019. @subsection Examples
  7020. @itemize
  7021. @item
  7022. Create two separate outputs from the same input:
  7023. @example
  7024. [in] split [out0][out1]
  7025. @end example
  7026. @item
  7027. To create 3 or more outputs, you need to specify the number of
  7028. outputs, like in:
  7029. @example
  7030. [in] asplit=3 [out0][out1][out2]
  7031. @end example
  7032. @item
  7033. Create two separate outputs from the same input, one cropped and
  7034. one padded:
  7035. @example
  7036. [in] split [splitout1][splitout2];
  7037. [splitout1] crop=100:100:0:0 [cropout];
  7038. [splitout2] pad=200:200:100:100 [padout];
  7039. @end example
  7040. @item
  7041. Create 5 copies of the input audio with @command{ffmpeg}:
  7042. @example
  7043. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  7044. @end example
  7045. @end itemize
  7046. @section zmq, azmq
  7047. Receive commands sent through a libzmq client, and forward them to
  7048. filters in the filtergraph.
  7049. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  7050. must be inserted between two video filters, @code{azmq} between two
  7051. audio filters.
  7052. To enable these filters you need to install the libzmq library and
  7053. headers and configure FFmpeg with @code{--enable-libzmq}.
  7054. For more information about libzmq see:
  7055. @url{http://www.zeromq.org/}
  7056. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  7057. receives messages sent through a network interface defined by the
  7058. @option{bind_address} option.
  7059. The received message must be in the form:
  7060. @example
  7061. @var{TARGET} @var{COMMAND} [@var{ARG}]
  7062. @end example
  7063. @var{TARGET} specifies the target of the command, usually the name of
  7064. the filter class or a specific filter instance name.
  7065. @var{COMMAND} specifies the name of the command for the target filter.
  7066. @var{ARG} is optional and specifies the optional argument list for the
  7067. given @var{COMMAND}.
  7068. Upon reception, the message is processed and the corresponding command
  7069. is injected into the filtergraph. Depending on the result, the filter
  7070. will send a reply to the client, adopting the format:
  7071. @example
  7072. @var{ERROR_CODE} @var{ERROR_REASON}
  7073. @var{MESSAGE}
  7074. @end example
  7075. @var{MESSAGE} is optional.
  7076. @subsection Examples
  7077. Look at @file{tools/zmqsend} for an example of a zmq client which can
  7078. be used to send commands processed by these filters.
  7079. Consider the following filtergraph generated by @command{ffplay}
  7080. @example
  7081. ffplay -dumpgraph 1 -f lavfi "
  7082. color=s=100x100:c=red [l];
  7083. color=s=100x100:c=blue [r];
  7084. nullsrc=s=200x100, zmq [bg];
  7085. [bg][l] overlay [bg+l];
  7086. [bg+l][r] overlay=x=100 "
  7087. @end example
  7088. To change the color of the left side of the video, the following
  7089. command can be used:
  7090. @example
  7091. echo Parsed_color_0 c yellow | tools/zmqsend
  7092. @end example
  7093. To change the right side:
  7094. @example
  7095. echo Parsed_color_1 c pink | tools/zmqsend
  7096. @end example
  7097. @c man end MULTIMEDIA FILTERS
  7098. @chapter Multimedia Sources
  7099. @c man begin MULTIMEDIA SOURCES
  7100. Below is a description of the currently available multimedia sources.
  7101. @section amovie
  7102. This is the same as @ref{movie} source, except it selects an audio
  7103. stream by default.
  7104. @anchor{movie}
  7105. @section movie
  7106. Read audio and/or video stream(s) from a movie container.
  7107. This filter accepts the following options:
  7108. @table @option
  7109. @item filename
  7110. The name of the resource to read (not necessarily a file but also a device or a
  7111. stream accessed through some protocol).
  7112. @item format_name, f
  7113. Specifies the format assumed for the movie to read, and can be either
  7114. the name of a container or an input device. If not specified the
  7115. format is guessed from @var{movie_name} or by probing.
  7116. @item seek_point, sp
  7117. Specifies the seek point in seconds, the frames will be output
  7118. starting from this seek point, the parameter is evaluated with
  7119. @code{av_strtod} so the numerical value may be suffixed by an IS
  7120. postfix. Default value is "0".
  7121. @item streams, s
  7122. Specifies the streams to read. Several streams can be specified,
  7123. separated by "+". The source will then have as many outputs, in the
  7124. same order. The syntax is explained in the ``Stream specifiers''
  7125. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  7126. respectively the default (best suited) video and audio stream. Default
  7127. is "dv", or "da" if the filter is called as "amovie".
  7128. @item stream_index, si
  7129. Specifies the index of the video stream to read. If the value is -1,
  7130. the best suited video stream will be automatically selected. Default
  7131. value is "-1". Deprecated. If the filter is called "amovie", it will select
  7132. audio instead of video.
  7133. @item loop
  7134. Specifies how many times to read the stream in sequence.
  7135. If the value is less than 1, the stream will be read again and again.
  7136. Default value is "1".
  7137. Note that when the movie is looped the source timestamps are not
  7138. changed, so it will generate non monotonically increasing timestamps.
  7139. @end table
  7140. This filter allows to overlay a second video on top of main input of
  7141. a filtergraph as shown in this graph:
  7142. @example
  7143. input -----------> deltapts0 --> overlay --> output
  7144. ^
  7145. |
  7146. movie --> scale--> deltapts1 -------+
  7147. @end example
  7148. @subsection Examples
  7149. @itemize
  7150. @item
  7151. Skip 3.2 seconds from the start of the avi file in.avi, and overlay it
  7152. on top of the input labelled as "in":
  7153. @example
  7154. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  7155. [in] setpts=PTS-STARTPTS [main];
  7156. [main][over] overlay=16:16 [out]
  7157. @end example
  7158. @item
  7159. Read from a video4linux2 device, and overlay it on top of the input
  7160. labelled as "in":
  7161. @example
  7162. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  7163. [in] setpts=PTS-STARTPTS [main];
  7164. [main][over] overlay=16:16 [out]
  7165. @end example
  7166. @item
  7167. Read the first video stream and the audio stream with id 0x81 from
  7168. dvd.vob; the video is connected to the pad named "video" and the audio is
  7169. connected to the pad named "audio":
  7170. @example
  7171. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  7172. @end example
  7173. @end itemize
  7174. @c man end MULTIMEDIA SOURCES