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.

9434 lines
252KB

  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. @item
  1809. Simulate sepia tones:
  1810. @example
  1811. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  1812. @end example
  1813. @end itemize
  1814. @section colormatrix
  1815. Convert color matrix.
  1816. The filter accepts the following options:
  1817. @table @option
  1818. @item src
  1819. @item dst
  1820. Specify the source and destination color matrix. Both values must be
  1821. specified.
  1822. The accepted values are:
  1823. @table @samp
  1824. @item bt709
  1825. BT.709
  1826. @item bt601
  1827. BT.601
  1828. @item smpte240m
  1829. SMPTE-240M
  1830. @item fcc
  1831. FCC
  1832. @end table
  1833. @end table
  1834. For example to convert from BT.601 to SMPTE-240M, use the command:
  1835. @example
  1836. colormatrix=bt601:smpte240m
  1837. @end example
  1838. @section copy
  1839. Copy the input source unchanged to the output. Mainly useful for
  1840. testing purposes.
  1841. @section crop
  1842. Crop the input video to given dimensions.
  1843. The filter accepts the following options:
  1844. @table @option
  1845. @item w, out_w
  1846. Width of the output video. It defaults to @code{iw}.
  1847. This expression is evaluated only once during the filter
  1848. configuration.
  1849. @item h, out_h
  1850. Height of the output video. It defaults to @code{ih}.
  1851. This expression is evaluated only once during the filter
  1852. configuration.
  1853. @item x
  1854. Horizontal position, in the input video, of the left edge of the output video.
  1855. It defaults to @code{(in_w-out_w)/2}.
  1856. This expression is evaluated per-frame.
  1857. @item y
  1858. Vertical position, in the input video, of the top edge of the output video.
  1859. It defaults to @code{(in_h-out_h)/2}.
  1860. This expression is evaluated per-frame.
  1861. @item keep_aspect
  1862. If set to 1 will force the output display aspect ratio
  1863. to be the same of the input, by changing the output sample aspect
  1864. ratio. It defaults to 0.
  1865. @end table
  1866. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  1867. expressions containing the following constants:
  1868. @table @option
  1869. @item x
  1870. @item y
  1871. the computed values for @var{x} and @var{y}. They are evaluated for
  1872. each new frame.
  1873. @item in_w
  1874. @item in_h
  1875. the input width and height
  1876. @item iw
  1877. @item ih
  1878. same as @var{in_w} and @var{in_h}
  1879. @item out_w
  1880. @item out_h
  1881. the output (cropped) width and height
  1882. @item ow
  1883. @item oh
  1884. same as @var{out_w} and @var{out_h}
  1885. @item a
  1886. same as @var{iw} / @var{ih}
  1887. @item sar
  1888. input sample aspect ratio
  1889. @item dar
  1890. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  1891. @item hsub
  1892. @item vsub
  1893. horizontal and vertical chroma subsample values. For example for the
  1894. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1895. @item n
  1896. the number of input frame, starting from 0
  1897. @item pos
  1898. the position in the file of the input frame, NAN if unknown
  1899. @item t
  1900. timestamp expressed in seconds, NAN if the input timestamp is unknown
  1901. @end table
  1902. The expression for @var{out_w} may depend on the value of @var{out_h},
  1903. and the expression for @var{out_h} may depend on @var{out_w}, but they
  1904. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  1905. evaluated after @var{out_w} and @var{out_h}.
  1906. The @var{x} and @var{y} parameters specify the expressions for the
  1907. position of the top-left corner of the output (non-cropped) area. They
  1908. are evaluated for each frame. If the evaluated value is not valid, it
  1909. is approximated to the nearest valid value.
  1910. The expression for @var{x} may depend on @var{y}, and the expression
  1911. for @var{y} may depend on @var{x}.
  1912. @subsection Examples
  1913. @itemize
  1914. @item
  1915. Crop area with size 100x100 at position (12,34).
  1916. @example
  1917. crop=100:100:12:34
  1918. @end example
  1919. Using named options, the example above becomes:
  1920. @example
  1921. crop=w=100:h=100:x=12:y=34
  1922. @end example
  1923. @item
  1924. Crop the central input area with size 100x100:
  1925. @example
  1926. crop=100:100
  1927. @end example
  1928. @item
  1929. Crop the central input area with size 2/3 of the input video:
  1930. @example
  1931. crop=2/3*in_w:2/3*in_h
  1932. @end example
  1933. @item
  1934. Crop the input video central square:
  1935. @example
  1936. crop=out_w=in_h
  1937. crop=in_h
  1938. @end example
  1939. @item
  1940. Delimit the rectangle with the top-left corner placed at position
  1941. 100:100 and the right-bottom corner corresponding to the right-bottom
  1942. corner of the input image:
  1943. @example
  1944. crop=in_w-100:in_h-100:100:100
  1945. @end example
  1946. @item
  1947. Crop 10 pixels from the left and right borders, and 20 pixels from
  1948. the top and bottom borders
  1949. @example
  1950. crop=in_w-2*10:in_h-2*20
  1951. @end example
  1952. @item
  1953. Keep only the bottom right quarter of the input image:
  1954. @example
  1955. crop=in_w/2:in_h/2:in_w/2:in_h/2
  1956. @end example
  1957. @item
  1958. Crop height for getting Greek harmony:
  1959. @example
  1960. crop=in_w:1/PHI*in_w
  1961. @end example
  1962. @item
  1963. Appply trembling effect:
  1964. @example
  1965. 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)
  1966. @end example
  1967. @item
  1968. Apply erratic camera effect depending on timestamp:
  1969. @example
  1970. 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)"
  1971. @end example
  1972. @item
  1973. Set x depending on the value of y:
  1974. @example
  1975. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  1976. @end example
  1977. @end itemize
  1978. @section cropdetect
  1979. Auto-detect crop size.
  1980. Calculate necessary cropping parameters and prints the recommended
  1981. parameters through the logging system. The detected dimensions
  1982. correspond to the non-black area of the input video.
  1983. The filter accepts the following options:
  1984. @table @option
  1985. @item limit
  1986. Set higher black value threshold, which can be optionally specified
  1987. from nothing (0) to everything (255). An intensity value greater
  1988. to the set value is considered non-black. Default value is 24.
  1989. @item round
  1990. Set the value for which the width/height should be divisible by. The
  1991. offset is automatically adjusted to center the video. Use 2 to get
  1992. only even dimensions (needed for 4:2:2 video). 16 is best when
  1993. encoding to most video codecs. Default value is 16.
  1994. @item reset_count, reset
  1995. Set the counter that determines after how many frames cropdetect will
  1996. reset the previously detected largest video area and start over to
  1997. detect the current optimal crop area. Default value is 0.
  1998. This can be useful when channel logos distort the video area. 0
  1999. indicates never reset and return the largest area encountered during
  2000. playback.
  2001. @end table
  2002. @anchor{curves}
  2003. @section curves
  2004. Apply color adjustments using curves.
  2005. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  2006. component (red, green and blue) has its values defined by @var{N} key points
  2007. tied from each other using a smooth curve. The x-axis represents the pixel
  2008. values from the input frame, and the y-axis the new pixel values to be set for
  2009. the output frame.
  2010. By default, a component curve is defined by the two points @var{(0;0)} and
  2011. @var{(1;1)}. This creates a straight line where each original pixel value is
  2012. "adjusted" to its own value, which means no change to the image.
  2013. The filter allows you to redefine these two points and add some more. A new
  2014. curve (using a natural cubic spline interpolation) will be define to pass
  2015. smoothly through all these new coordinates. The new defined points needs to be
  2016. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  2017. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  2018. the vector spaces, the values will be clipped accordingly.
  2019. If there is no key point defined in @code{x=0}, the filter will automatically
  2020. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  2021. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  2022. The filter accepts the following options:
  2023. @table @option
  2024. @item preset
  2025. Select one of the available color presets. This option can be used in addition
  2026. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  2027. options takes priority on the preset values.
  2028. Available presets are:
  2029. @table @samp
  2030. @item none
  2031. @item color_negative
  2032. @item cross_process
  2033. @item darker
  2034. @item increase_contrast
  2035. @item lighter
  2036. @item linear_contrast
  2037. @item medium_contrast
  2038. @item negative
  2039. @item strong_contrast
  2040. @item vintage
  2041. @end table
  2042. Default is @code{none}.
  2043. @item master, m
  2044. Set the master key points. These points will define a second pass mapping. It
  2045. is sometimes called a "luminance" or "value" mapping. It can be used with
  2046. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  2047. post-processing LUT.
  2048. @item red, r
  2049. Set the key points for the red component.
  2050. @item green, g
  2051. Set the key points for the green component.
  2052. @item blue, b
  2053. Set the key points for the blue component.
  2054. @item all
  2055. Set the key points for all components (not including master).
  2056. Can be used in addition to the other key points component
  2057. options. In this case, the unset component(s) will fallback on this
  2058. @option{all} setting.
  2059. @item psfile
  2060. Specify a Photoshop curves file (@code{.asv}) to import the settings from.
  2061. @end table
  2062. To avoid some filtergraph syntax conflicts, each key points list need to be
  2063. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  2064. @subsection Examples
  2065. @itemize
  2066. @item
  2067. Increase slightly the middle level of blue:
  2068. @example
  2069. curves=blue='0.5/0.58'
  2070. @end example
  2071. @item
  2072. Vintage effect:
  2073. @example
  2074. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  2075. @end example
  2076. Here we obtain the following coordinates for each components:
  2077. @table @var
  2078. @item red
  2079. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  2080. @item green
  2081. @code{(0;0) (0.50;0.48) (1;1)}
  2082. @item blue
  2083. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  2084. @end table
  2085. @item
  2086. The previous example can also be achieved with the associated built-in preset:
  2087. @example
  2088. curves=preset=vintage
  2089. @end example
  2090. @item
  2091. Or simply:
  2092. @example
  2093. curves=vintage
  2094. @end example
  2095. @item
  2096. Use a Photoshop preset and redefine the points of the green component:
  2097. @example
  2098. curves=psfile='MyCurvesPresets/purple.asv':green='0.45/0.53'
  2099. @end example
  2100. @end itemize
  2101. @section dctdnoiz
  2102. Denoise frames using 2D DCT (frequency domain filtering).
  2103. This filter is not designed for real time and can be extremely slow.
  2104. The filter accepts the following options:
  2105. @table @option
  2106. @item sigma, s
  2107. Set the noise sigma constant.
  2108. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  2109. coefficient (absolute value) below this threshold with be dropped.
  2110. If you need a more advanced filtering, see @option{expr}.
  2111. Default is @code{0}.
  2112. @item overlap
  2113. Set number overlapping pixels for each block. Each block is of size
  2114. @code{16x16}. Since the filter can be slow, you may want to reduce this value,
  2115. at the cost of a less effective filter and the risk of various artefacts.
  2116. If the overlapping value doesn't allow to process the whole input width or
  2117. height, a warning will be displayed and according borders won't be denoised.
  2118. Default value is @code{15}.
  2119. @item expr, e
  2120. Set the coefficient factor expression.
  2121. For each coefficient of a DCT block, this expression will be evaluated as a
  2122. multiplier value for the coefficient.
  2123. If this is option is set, the @option{sigma} option will be ignored.
  2124. The absolute value of the coefficient can be accessed through the @var{c}
  2125. variable.
  2126. @end table
  2127. @subsection Examples
  2128. Apply a denoise with a @option{sigma} of @code{4.5}:
  2129. @example
  2130. dctdnoiz=4.5
  2131. @end example
  2132. The same operation can be achieved using the expression system:
  2133. @example
  2134. dctdnoiz=e='gte(c, 4.5*3)'
  2135. @end example
  2136. @anchor{decimate}
  2137. @section decimate
  2138. Drop duplicated frames at regular intervals.
  2139. The filter accepts the following options:
  2140. @table @option
  2141. @item cycle
  2142. Set the number of frames from which one will be dropped. Setting this to
  2143. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  2144. Default is @code{5}.
  2145. @item dupthresh
  2146. Set the threshold for duplicate detection. If the difference metric for a frame
  2147. is less than or equal to this value, then it is declared as duplicate. Default
  2148. is @code{1.1}
  2149. @item scthresh
  2150. Set scene change threshold. Default is @code{15}.
  2151. @item blockx
  2152. @item blocky
  2153. Set the size of the x and y-axis blocks used during metric calculations.
  2154. Larger blocks give better noise suppression, but also give worse detection of
  2155. small movements. Must be a power of two. Default is @code{32}.
  2156. @item ppsrc
  2157. Mark main input as a pre-processed input and activate clean source input
  2158. stream. This allows the input to be pre-processed with various filters to help
  2159. the metrics calculation while keeping the frame selection lossless. When set to
  2160. @code{1}, the first stream is for the pre-processed input, and the second
  2161. stream is the clean source from where the kept frames are chosen. Default is
  2162. @code{0}.
  2163. @item chroma
  2164. Set whether or not chroma is considered in the metric calculations. Default is
  2165. @code{1}.
  2166. @end table
  2167. @section delogo
  2168. Suppress a TV station logo by a simple interpolation of the surrounding
  2169. pixels. Just set a rectangle covering the logo and watch it disappear
  2170. (and sometimes something even uglier appear - your mileage may vary).
  2171. This filter accepts the following options:
  2172. @table @option
  2173. @item x
  2174. @item y
  2175. Specify the top left corner coordinates of the logo. They must be
  2176. specified.
  2177. @item w
  2178. @item h
  2179. Specify the width and height of the logo to clear. They must be
  2180. specified.
  2181. @item band, t
  2182. Specify the thickness of the fuzzy edge of the rectangle (added to
  2183. @var{w} and @var{h}). The default value is 4.
  2184. @item show
  2185. When set to 1, a green rectangle is drawn on the screen to simplify
  2186. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  2187. The default value is 0.
  2188. The rectangle is drawn on the outermost pixels which will be (partly)
  2189. replaced with interpolated values. The values of the next pixels
  2190. immediately outside this rectangle in each direction will be used to
  2191. compute the interpolated pixel values inside the rectangle.
  2192. @end table
  2193. @subsection Examples
  2194. @itemize
  2195. @item
  2196. Set a rectangle covering the area with top left corner coordinates 0,0
  2197. and size 100x77, setting a band of size 10:
  2198. @example
  2199. delogo=x=0:y=0:w=100:h=77:band=10
  2200. @end example
  2201. @end itemize
  2202. @section deshake
  2203. Attempt to fix small changes in horizontal and/or vertical shift. This
  2204. filter helps remove camera shake from hand-holding a camera, bumping a
  2205. tripod, moving on a vehicle, etc.
  2206. The filter accepts the following options:
  2207. @table @option
  2208. @item x
  2209. @item y
  2210. @item w
  2211. @item h
  2212. Specify a rectangular area where to limit the search for motion
  2213. vectors.
  2214. If desired the search for motion vectors can be limited to a
  2215. rectangular area of the frame defined by its top left corner, width
  2216. and height. These parameters have the same meaning as the drawbox
  2217. filter which can be used to visualise the position of the bounding
  2218. box.
  2219. This is useful when simultaneous movement of subjects within the frame
  2220. might be confused for camera motion by the motion vector search.
  2221. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  2222. then the full frame is used. This allows later options to be set
  2223. without specifying the bounding box for the motion vector search.
  2224. Default - search the whole frame.
  2225. @item rx
  2226. @item ry
  2227. Specify the maximum extent of movement in x and y directions in the
  2228. range 0-64 pixels. Default 16.
  2229. @item edge
  2230. Specify how to generate pixels to fill blanks at the edge of the
  2231. frame. Available values are:
  2232. @table @samp
  2233. @item blank, 0
  2234. Fill zeroes at blank locations
  2235. @item original, 1
  2236. Original image at blank locations
  2237. @item clamp, 2
  2238. Extruded edge value at blank locations
  2239. @item mirror, 3
  2240. Mirrored edge at blank locations
  2241. @end table
  2242. Default value is @samp{mirror}.
  2243. @item blocksize
  2244. Specify the blocksize to use for motion search. Range 4-128 pixels,
  2245. default 8.
  2246. @item contrast
  2247. Specify the contrast threshold for blocks. Only blocks with more than
  2248. the specified contrast (difference between darkest and lightest
  2249. pixels) will be considered. Range 1-255, default 125.
  2250. @item search
  2251. Specify the search strategy. Available values are:
  2252. @table @samp
  2253. @item exhaustive, 0
  2254. Set exhaustive search
  2255. @item less, 1
  2256. Set less exhaustive search.
  2257. @end table
  2258. Default value is @samp{exhaustive}.
  2259. @item filename
  2260. If set then a detailed log of the motion search is written to the
  2261. specified file.
  2262. @item opencl
  2263. If set to 1, specify using OpenCL capabilities, only available if
  2264. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  2265. @end table
  2266. @section drawbox
  2267. Draw a colored box on the input image.
  2268. This filter accepts the following options:
  2269. @table @option
  2270. @item x
  2271. @item y
  2272. The expressions which specify the top left corner coordinates of the box. Default to 0.
  2273. @item width, w
  2274. @item height, h
  2275. The expressions which specify the width and height of the box, if 0 they are interpreted as
  2276. the input width and height. Default to 0.
  2277. @item color, c
  2278. Specify the color of the box to write, it can be the name of a color
  2279. (case insensitive match) or a 0xRRGGBB[AA] sequence. If the special
  2280. value @code{invert} is used, the box edge color is the same as the
  2281. video with inverted luma.
  2282. @item thickness, t
  2283. The expression which sets the thickness of the box edge. Default value is @code{3}.
  2284. See below for the list of accepted constants.
  2285. @end table
  2286. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2287. following constants:
  2288. @table @option
  2289. @item dar
  2290. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2291. @item hsub
  2292. @item vsub
  2293. horizontal and vertical chroma subsample values. For example for the
  2294. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2295. @item in_h, ih
  2296. @item in_w, iw
  2297. The input width and height.
  2298. @item sar
  2299. The input sample aspect ratio.
  2300. @item x
  2301. @item y
  2302. The x and y offset coordinates where the box is drawn.
  2303. @item w
  2304. @item h
  2305. The width and height of the drawn box.
  2306. @item t
  2307. The thickness of the drawn box.
  2308. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2309. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2310. @end table
  2311. @subsection Examples
  2312. @itemize
  2313. @item
  2314. Draw a black box around the edge of the input image:
  2315. @example
  2316. drawbox
  2317. @end example
  2318. @item
  2319. Draw a box with color red and an opacity of 50%:
  2320. @example
  2321. drawbox=10:20:200:60:red@@0.5
  2322. @end example
  2323. The previous example can be specified as:
  2324. @example
  2325. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  2326. @end example
  2327. @item
  2328. Fill the box with pink color:
  2329. @example
  2330. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  2331. @end example
  2332. @item
  2333. Draw a 2-pixel red 2.40:1 mask:
  2334. @example
  2335. 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
  2336. @end example
  2337. @end itemize
  2338. @section drawgrid
  2339. Draw a grid on the input image.
  2340. This filter accepts the following options:
  2341. @table @option
  2342. @item x
  2343. @item y
  2344. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  2345. @item width, w
  2346. @item height, h
  2347. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  2348. input width and height, respectively, minus @code{thickness}, so image gets
  2349. framed. Default to 0.
  2350. @item color, c
  2351. Specify the color of the grid, it can be the name of a color
  2352. (case insensitive match) or a 0xRRGGBB[AA] sequence. If the special
  2353. value @code{invert} is used, the grid color is the same as the
  2354. video with inverted luma.
  2355. Note that you can append opacity value (in range of 0.0 - 1.0)
  2356. to color name after @@ sign.
  2357. @item thickness, t
  2358. The expression which sets the thickness of the grid line. Default value is @code{1}.
  2359. See below for the list of accepted constants.
  2360. @end table
  2361. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2362. following constants:
  2363. @table @option
  2364. @item dar
  2365. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2366. @item hsub
  2367. @item vsub
  2368. horizontal and vertical chroma subsample values. For example for the
  2369. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2370. @item in_h, ih
  2371. @item in_w, iw
  2372. The input grid cell width and height.
  2373. @item sar
  2374. The input sample aspect ratio.
  2375. @item x
  2376. @item y
  2377. The x and y coordinates of some point of grid intersection (meant to configure offset).
  2378. @item w
  2379. @item h
  2380. The width and height of the drawn cell.
  2381. @item t
  2382. The thickness of the drawn cell.
  2383. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2384. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2385. @end table
  2386. @subsection Examples
  2387. @itemize
  2388. @item
  2389. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  2390. @example
  2391. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  2392. @end example
  2393. @item
  2394. Draw a white 3x3 grid with an opacity of 50%:
  2395. @example
  2396. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  2397. @end example
  2398. @end itemize
  2399. @anchor{drawtext}
  2400. @section drawtext
  2401. Draw text string or text from specified file on top of video using the
  2402. libfreetype library.
  2403. To enable compilation of this filter you need to configure FFmpeg with
  2404. @code{--enable-libfreetype}.
  2405. @subsection Syntax
  2406. The description of the accepted parameters follows.
  2407. @table @option
  2408. @item box
  2409. Used to draw a box around text using background color.
  2410. Value should be either 1 (enable) or 0 (disable).
  2411. The default value of @var{box} is 0.
  2412. @item boxcolor
  2413. The color to be used for drawing box around text.
  2414. Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
  2415. (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  2416. The default value of @var{boxcolor} is "white".
  2417. @item draw
  2418. Set an expression which specifies if the text should be drawn. If the
  2419. expression evaluates to 0, the text is not drawn. This is useful for
  2420. specifying that the text should be drawn only when specific conditions
  2421. are met.
  2422. Default value is "1".
  2423. See below for the list of accepted constants and functions.
  2424. @item expansion
  2425. Select how the @var{text} is expanded. Can be either @code{none},
  2426. @code{strftime} (deprecated) or
  2427. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  2428. below for details.
  2429. @item fix_bounds
  2430. If true, check and fix text coords to avoid clipping.
  2431. @item fontcolor
  2432. The color to be used for drawing fonts.
  2433. Either a string (e.g. "red") or in 0xRRGGBB[AA] format
  2434. (e.g. "0xff000033"), possibly followed by an alpha specifier.
  2435. The default value of @var{fontcolor} is "black".
  2436. @item fontfile
  2437. The font file to be used for drawing text. Path must be included.
  2438. This parameter is mandatory.
  2439. @item fontsize
  2440. The font size to be used for drawing text.
  2441. The default value of @var{fontsize} is 16.
  2442. @item ft_load_flags
  2443. Flags to be used for loading the fonts.
  2444. The flags map the corresponding flags supported by libfreetype, and are
  2445. a combination of the following values:
  2446. @table @var
  2447. @item default
  2448. @item no_scale
  2449. @item no_hinting
  2450. @item render
  2451. @item no_bitmap
  2452. @item vertical_layout
  2453. @item force_autohint
  2454. @item crop_bitmap
  2455. @item pedantic
  2456. @item ignore_global_advance_width
  2457. @item no_recurse
  2458. @item ignore_transform
  2459. @item monochrome
  2460. @item linear_design
  2461. @item no_autohint
  2462. @end table
  2463. Default value is "render".
  2464. For more information consult the documentation for the FT_LOAD_*
  2465. libfreetype flags.
  2466. @item shadowcolor
  2467. The color to be used for drawing a shadow behind the drawn text. It
  2468. can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
  2469. form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  2470. The default value of @var{shadowcolor} is "black".
  2471. @item shadowx
  2472. @item shadowy
  2473. The x and y offsets for the text shadow position with respect to the
  2474. position of the text. They can be either positive or negative
  2475. values. Default value for both is "0".
  2476. @item start_number
  2477. The starting frame number for the n/frame_num variable. The default value
  2478. is "0".
  2479. @item tabsize
  2480. The size in number of spaces to use for rendering the tab.
  2481. Default value is 4.
  2482. @item timecode
  2483. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  2484. format. It can be used with or without text parameter. @var{timecode_rate}
  2485. option must be specified.
  2486. @item timecode_rate, rate, r
  2487. Set the timecode frame rate (timecode only).
  2488. @item text
  2489. The text string to be drawn. The text must be a sequence of UTF-8
  2490. encoded characters.
  2491. This parameter is mandatory if no file is specified with the parameter
  2492. @var{textfile}.
  2493. @item textfile
  2494. A text file containing text to be drawn. The text must be a sequence
  2495. of UTF-8 encoded characters.
  2496. This parameter is mandatory if no text string is specified with the
  2497. parameter @var{text}.
  2498. If both @var{text} and @var{textfile} are specified, an error is thrown.
  2499. @item reload
  2500. If set to 1, the @var{textfile} will be reloaded before each frame.
  2501. Be sure to update it atomically, or it may be read partially, or even fail.
  2502. @item x
  2503. @item y
  2504. The expressions which specify the offsets where text will be drawn
  2505. within the video frame. They are relative to the top/left border of the
  2506. output image.
  2507. The default value of @var{x} and @var{y} is "0".
  2508. See below for the list of accepted constants and functions.
  2509. @end table
  2510. The parameters for @var{x} and @var{y} are expressions containing the
  2511. following constants and functions:
  2512. @table @option
  2513. @item dar
  2514. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  2515. @item hsub
  2516. @item vsub
  2517. horizontal and vertical chroma subsample values. For example for the
  2518. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2519. @item line_h, lh
  2520. the height of each text line
  2521. @item main_h, h, H
  2522. the input height
  2523. @item main_w, w, W
  2524. the input width
  2525. @item max_glyph_a, ascent
  2526. the maximum distance from the baseline to the highest/upper grid
  2527. coordinate used to place a glyph outline point, for all the rendered
  2528. glyphs.
  2529. It is a positive value, due to the grid's orientation with the Y axis
  2530. upwards.
  2531. @item max_glyph_d, descent
  2532. the maximum distance from the baseline to the lowest grid coordinate
  2533. used to place a glyph outline point, for all the rendered glyphs.
  2534. This is a negative value, due to the grid's orientation, with the Y axis
  2535. upwards.
  2536. @item max_glyph_h
  2537. maximum glyph height, that is the maximum height for all the glyphs
  2538. contained in the rendered text, it is equivalent to @var{ascent} -
  2539. @var{descent}.
  2540. @item max_glyph_w
  2541. maximum glyph width, that is the maximum width for all the glyphs
  2542. contained in the rendered text
  2543. @item n
  2544. the number of input frame, starting from 0
  2545. @item rand(min, max)
  2546. return a random number included between @var{min} and @var{max}
  2547. @item sar
  2548. input sample aspect ratio
  2549. @item t
  2550. timestamp expressed in seconds, NAN if the input timestamp is unknown
  2551. @item text_h, th
  2552. the height of the rendered text
  2553. @item text_w, tw
  2554. the width of the rendered text
  2555. @item x
  2556. @item y
  2557. the x and y offset coordinates where the text is drawn.
  2558. These parameters allow the @var{x} and @var{y} expressions to refer
  2559. each other, so you can for example specify @code{y=x/dar}.
  2560. @end table
  2561. If libavfilter was built with @code{--enable-fontconfig}, then
  2562. @option{fontfile} can be a fontconfig pattern or omitted.
  2563. @anchor{drawtext_expansion}
  2564. @subsection Text expansion
  2565. If @option{expansion} is set to @code{strftime},
  2566. the filter recognizes strftime() sequences in the provided text and
  2567. expands them accordingly. Check the documentation of strftime(). This
  2568. feature is deprecated.
  2569. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  2570. If @option{expansion} is set to @code{normal} (which is the default),
  2571. the following expansion mechanism is used.
  2572. The backslash character '\', followed by any character, always expands to
  2573. the second character.
  2574. Sequence of the form @code{%@{...@}} are expanded. The text between the
  2575. braces is a function name, possibly followed by arguments separated by ':'.
  2576. If the arguments contain special characters or delimiters (':' or '@}'),
  2577. they should be escaped.
  2578. Note that they probably must also be escaped as the value for the
  2579. @option{text} option in the filter argument string and as the filter
  2580. argument in the filtergraph description, and possibly also for the shell,
  2581. that makes up to four levels of escaping; using a text file avoids these
  2582. problems.
  2583. The following functions are available:
  2584. @table @command
  2585. @item expr, e
  2586. The expression evaluation result.
  2587. It must take one argument specifying the expression to be evaluated,
  2588. which accepts the same constants and functions as the @var{x} and
  2589. @var{y} values. Note that not all constants should be used, for
  2590. example the text size is not known when evaluating the expression, so
  2591. the constants @var{text_w} and @var{text_h} will have an undefined
  2592. value.
  2593. @item gmtime
  2594. The time at which the filter is running, expressed in UTC.
  2595. It can accept an argument: a strftime() format string.
  2596. @item localtime
  2597. The time at which the filter is running, expressed in the local time zone.
  2598. It can accept an argument: a strftime() format string.
  2599. @item metadata
  2600. Frame metadata. It must take one argument specifying metadata key.
  2601. @item n, frame_num
  2602. The frame number, starting from 0.
  2603. @item pict_type
  2604. A 1 character description of the current picture type.
  2605. @item pts
  2606. The timestamp of the current frame, in seconds, with microsecond accuracy.
  2607. @end table
  2608. @subsection Examples
  2609. @itemize
  2610. @item
  2611. Draw "Test Text" with font FreeSerif, using the default values for the
  2612. optional parameters.
  2613. @example
  2614. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  2615. @end example
  2616. @item
  2617. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  2618. and y=50 (counting from the top-left corner of the screen), text is
  2619. yellow with a red box around it. Both the text and the box have an
  2620. opacity of 20%.
  2621. @example
  2622. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  2623. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  2624. @end example
  2625. Note that the double quotes are not necessary if spaces are not used
  2626. within the parameter list.
  2627. @item
  2628. Show the text at the center of the video frame:
  2629. @example
  2630. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  2631. @end example
  2632. @item
  2633. Show a text line sliding from right to left in the last row of the video
  2634. frame. The file @file{LONG_LINE} is assumed to contain a single line
  2635. with no newlines.
  2636. @example
  2637. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  2638. @end example
  2639. @item
  2640. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  2641. @example
  2642. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  2643. @end example
  2644. @item
  2645. Draw a single green letter "g", at the center of the input video.
  2646. The glyph baseline is placed at half screen height.
  2647. @example
  2648. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  2649. @end example
  2650. @item
  2651. Show text for 1 second every 3 seconds:
  2652. @example
  2653. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:draw=lt(mod(t\,3)\,1):text='blink'"
  2654. @end example
  2655. @item
  2656. Use fontconfig to set the font. Note that the colons need to be escaped.
  2657. @example
  2658. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  2659. @end example
  2660. @item
  2661. Print the date of a real-time encoding (see strftime(3)):
  2662. @example
  2663. drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
  2664. @end example
  2665. @end itemize
  2666. For more information about libfreetype, check:
  2667. @url{http://www.freetype.org/}.
  2668. For more information about fontconfig, check:
  2669. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  2670. @section edgedetect
  2671. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  2672. The filter accepts the following options:
  2673. @table @option
  2674. @item low
  2675. @item high
  2676. Set low and high threshold values used by the Canny thresholding
  2677. algorithm.
  2678. The high threshold selects the "strong" edge pixels, which are then
  2679. connected through 8-connectivity with the "weak" edge pixels selected
  2680. by the low threshold.
  2681. @var{low} and @var{high} threshold values must be choosen in the range
  2682. [0,1], and @var{low} should be lesser or equal to @var{high}.
  2683. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  2684. is @code{50/255}.
  2685. @end table
  2686. Example:
  2687. @example
  2688. edgedetect=low=0.1:high=0.4
  2689. @end example
  2690. @section extractplanes
  2691. Extract color channel components from input video stream into
  2692. separate grayscale video streams.
  2693. The filter accepts the following option:
  2694. @table @option
  2695. @item planes
  2696. Set plane(s) to extract.
  2697. Available values for planes are:
  2698. @table @samp
  2699. @item y
  2700. @item u
  2701. @item v
  2702. @item a
  2703. @item r
  2704. @item g
  2705. @item b
  2706. @end table
  2707. Choosing planes not available in the input will result in an error.
  2708. That means you cannot select @code{r}, @code{g}, @code{b} planes
  2709. with @code{y}, @code{u}, @code{v} planes at same time.
  2710. @end table
  2711. @subsection Examples
  2712. @itemize
  2713. @item
  2714. Extract luma, u and v color channel component from input video frame
  2715. into 3 grayscale outputs:
  2716. @example
  2717. 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
  2718. @end example
  2719. @end itemize
  2720. @section fade
  2721. Apply fade-in/out effect to input video.
  2722. This filter accepts the following options:
  2723. @table @option
  2724. @item type, t
  2725. The effect type -- can be either "in" for fade-in, or "out" for a fade-out
  2726. effect.
  2727. Default is @code{in}.
  2728. @item start_frame, s
  2729. Specify the number of the start frame for starting to apply the fade
  2730. effect. Default is 0.
  2731. @item nb_frames, n
  2732. The number of frames for which the fade effect has to last. At the end of the
  2733. fade-in effect the output video will have the same intensity as the input video,
  2734. at the end of the fade-out transition the output video will be completely black.
  2735. Default is 25.
  2736. @item alpha
  2737. If set to 1, fade only alpha channel, if one exists on the input.
  2738. Default value is 0.
  2739. @item start_time, st
  2740. Specify the timestamp (in seconds) of the frame to start to apply the fade
  2741. effect. If both start_frame and start_time are specified, the fade will start at
  2742. whichever comes last. Default is 0.
  2743. @item duration, d
  2744. The number of seconds for which the fade effect has to last. At the end of the
  2745. fade-in effect the output video will have the same intensity as the input video,
  2746. at the end of the fade-out transition the output video will be completely black.
  2747. If both duration and nb_frames are specified, duration is used. Default is 0.
  2748. @end table
  2749. @subsection Examples
  2750. @itemize
  2751. @item
  2752. Fade in first 30 frames of video:
  2753. @example
  2754. fade=in:0:30
  2755. @end example
  2756. The command above is equivalent to:
  2757. @example
  2758. fade=t=in:s=0:n=30
  2759. @end example
  2760. @item
  2761. Fade out last 45 frames of a 200-frame video:
  2762. @example
  2763. fade=out:155:45
  2764. fade=type=out:start_frame=155:nb_frames=45
  2765. @end example
  2766. @item
  2767. Fade in first 25 frames and fade out last 25 frames of a 1000-frame video:
  2768. @example
  2769. fade=in:0:25, fade=out:975:25
  2770. @end example
  2771. @item
  2772. Make first 5 frames black, then fade in from frame 5-24:
  2773. @example
  2774. fade=in:5:20
  2775. @end example
  2776. @item
  2777. Fade in alpha over first 25 frames of video:
  2778. @example
  2779. fade=in:0:25:alpha=1
  2780. @end example
  2781. @item
  2782. Make first 5.5 seconds black, then fade in for 0.5 seconds:
  2783. @example
  2784. fade=t=in:st=5.5:d=0.5
  2785. @end example
  2786. @end itemize
  2787. @section field
  2788. Extract a single field from an interlaced image using stride
  2789. arithmetic to avoid wasting CPU time. The output frames are marked as
  2790. non-interlaced.
  2791. The filter accepts the following options:
  2792. @table @option
  2793. @item type
  2794. Specify whether to extract the top (if the value is @code{0} or
  2795. @code{top}) or the bottom field (if the value is @code{1} or
  2796. @code{bottom}).
  2797. @end table
  2798. @section fieldmatch
  2799. Field matching filter for inverse telecine. It is meant to reconstruct the
  2800. progressive frames from a telecined stream. The filter does not drop duplicated
  2801. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  2802. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  2803. The separation of the field matching and the decimation is notably motivated by
  2804. the possibility of inserting a de-interlacing filter fallback between the two.
  2805. If the source has mixed telecined and real interlaced content,
  2806. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  2807. But these remaining combed frames will be marked as interlaced, and thus can be
  2808. de-interlaced by a later filter such as @ref{yadif} before decimation.
  2809. In addition to the various configuration options, @code{fieldmatch} can take an
  2810. optional second stream, activated through the @option{ppsrc} option. If
  2811. enabled, the frames reconstruction will be based on the fields and frames from
  2812. this second stream. This allows the first input to be pre-processed in order to
  2813. help the various algorithms of the filter, while keeping the output lossless
  2814. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  2815. or brightness/contrast adjustments can help.
  2816. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  2817. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  2818. which @code{fieldmatch} is based on. While the semantic and usage are very
  2819. close, some behaviour and options names can differ.
  2820. The filter accepts the following options:
  2821. @table @option
  2822. @item order
  2823. Specify the assumed field order of the input stream. Available values are:
  2824. @table @samp
  2825. @item auto
  2826. Auto detect parity (use FFmpeg's internal parity value).
  2827. @item bff
  2828. Assume bottom field first.
  2829. @item tff
  2830. Assume top field first.
  2831. @end table
  2832. Note that it is sometimes recommended not to trust the parity announced by the
  2833. stream.
  2834. Default value is @var{auto}.
  2835. @item mode
  2836. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  2837. sense that it won't risk creating jerkiness due to duplicate frames when
  2838. possible, but if there are bad edits or blended fields it will end up
  2839. outputting combed frames when a good match might actually exist. On the other
  2840. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  2841. but will almost always find a good frame if there is one. The other values are
  2842. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  2843. jerkiness and creating duplicate frames versus finding good matches in sections
  2844. with bad edits, orphaned fields, blended fields, etc.
  2845. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  2846. Available values are:
  2847. @table @samp
  2848. @item pc
  2849. 2-way matching (p/c)
  2850. @item pc_n
  2851. 2-way matching, and trying 3rd match if still combed (p/c + n)
  2852. @item pc_u
  2853. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  2854. @item pc_n_ub
  2855. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  2856. still combed (p/c + n + u/b)
  2857. @item pcn
  2858. 3-way matching (p/c/n)
  2859. @item pcn_ub
  2860. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  2861. detected as combed (p/c/n + u/b)
  2862. @end table
  2863. The parenthesis at the end indicate the matches that would be used for that
  2864. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  2865. @var{top}).
  2866. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  2867. the slowest.
  2868. Default value is @var{pc_n}.
  2869. @item ppsrc
  2870. Mark the main input stream as a pre-processed input, and enable the secondary
  2871. input stream as the clean source to pick the fields from. See the filter
  2872. introduction for more details. It is similar to the @option{clip2} feature from
  2873. VFM/TFM.
  2874. Default value is @code{0} (disabled).
  2875. @item field
  2876. Set the field to match from. It is recommended to set this to the same value as
  2877. @option{order} unless you experience matching failures with that setting. In
  2878. certain circumstances changing the field that is used to match from can have a
  2879. large impact on matching performance. Available values are:
  2880. @table @samp
  2881. @item auto
  2882. Automatic (same value as @option{order}).
  2883. @item bottom
  2884. Match from the bottom field.
  2885. @item top
  2886. Match from the top field.
  2887. @end table
  2888. Default value is @var{auto}.
  2889. @item mchroma
  2890. Set whether or not chroma is included during the match comparisons. In most
  2891. cases it is recommended to leave this enabled. You should set this to @code{0}
  2892. only if your clip has bad chroma problems such as heavy rainbowing or other
  2893. artifacts. Setting this to @code{0} could also be used to speed things up at
  2894. the cost of some accuracy.
  2895. Default value is @code{1}.
  2896. @item y0
  2897. @item y1
  2898. These define an exclusion band which excludes the lines between @option{y0} and
  2899. @option{y1} from being included in the field matching decision. An exclusion
  2900. band can be used to ignore subtitles, a logo, or other things that may
  2901. interfere with the matching. @option{y0} sets the starting scan line and
  2902. @option{y1} sets the ending line; all lines in between @option{y0} and
  2903. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  2904. @option{y0} and @option{y1} to the same value will disable the feature.
  2905. @option{y0} and @option{y1} defaults to @code{0}.
  2906. @item scthresh
  2907. Set the scene change detection threshold as a percentage of maximum change on
  2908. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  2909. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  2910. @option{scthresh} is @code{[0.0, 100.0]}.
  2911. Default value is @code{12.0}.
  2912. @item combmatch
  2913. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  2914. account the combed scores of matches when deciding what match to use as the
  2915. final match. Available values are:
  2916. @table @samp
  2917. @item none
  2918. No final matching based on combed scores.
  2919. @item sc
  2920. Combed scores are only used when a scene change is detected.
  2921. @item full
  2922. Use combed scores all the time.
  2923. @end table
  2924. Default is @var{sc}.
  2925. @item combdbg
  2926. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  2927. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  2928. Available values are:
  2929. @table @samp
  2930. @item none
  2931. No forced calculation.
  2932. @item pcn
  2933. Force p/c/n calculations.
  2934. @item pcnub
  2935. Force p/c/n/u/b calculations.
  2936. @end table
  2937. Default value is @var{none}.
  2938. @item cthresh
  2939. This is the area combing threshold used for combed frame detection. This
  2940. essentially controls how "strong" or "visible" combing must be to be detected.
  2941. Larger values mean combing must be more visible and smaller values mean combing
  2942. can be less visible or strong and still be detected. Valid settings are from
  2943. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  2944. be detected as combed). This is basically a pixel difference value. A good
  2945. range is @code{[8, 12]}.
  2946. Default value is @code{9}.
  2947. @item chroma
  2948. Sets whether or not chroma is considered in the combed frame decision. Only
  2949. disable this if your source has chroma problems (rainbowing, etc.) that are
  2950. causing problems for the combed frame detection with chroma enabled. Actually,
  2951. using @option{chroma}=@var{0} is usually more reliable, except for the case
  2952. where there is chroma only combing in the source.
  2953. Default value is @code{0}.
  2954. @item blockx
  2955. @item blocky
  2956. Respectively set the x-axis and y-axis size of the window used during combed
  2957. frame detection. This has to do with the size of the area in which
  2958. @option{combpel} pixels are required to be detected as combed for a frame to be
  2959. declared combed. See the @option{combpel} parameter description for more info.
  2960. Possible values are any number that is a power of 2 starting at 4 and going up
  2961. to 512.
  2962. Default value is @code{16}.
  2963. @item combpel
  2964. The number of combed pixels inside any of the @option{blocky} by
  2965. @option{blockx} size blocks on the frame for the frame to be detected as
  2966. combed. While @option{cthresh} controls how "visible" the combing must be, this
  2967. setting controls "how much" combing there must be in any localized area (a
  2968. window defined by the @option{blockx} and @option{blocky} settings) on the
  2969. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  2970. which point no frames will ever be detected as combed). This setting is known
  2971. as @option{MI} in TFM/VFM vocabulary.
  2972. Default value is @code{80}.
  2973. @end table
  2974. @anchor{p/c/n/u/b meaning}
  2975. @subsection p/c/n/u/b meaning
  2976. @subsubsection p/c/n
  2977. We assume the following telecined stream:
  2978. @example
  2979. Top fields: 1 2 2 3 4
  2980. Bottom fields: 1 2 3 4 4
  2981. @end example
  2982. The numbers correspond to the progressive frame the fields relate to. Here, the
  2983. first two frames are progressive, the 3rd and 4th are combed, and so on.
  2984. When @code{fieldmatch} is configured to run a matching from bottom
  2985. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  2986. @example
  2987. Input stream:
  2988. T 1 2 2 3 4
  2989. B 1 2 3 4 4 <-- matching reference
  2990. Matches: c c n n c
  2991. Output stream:
  2992. T 1 2 3 4 4
  2993. B 1 2 3 4 4
  2994. @end example
  2995. As a result of the field matching, we can see that some frames get duplicated.
  2996. To perform a complete inverse telecine, you need to rely on a decimation filter
  2997. after this operation. See for instance the @ref{decimate} filter.
  2998. The same operation now matching from top fields (@option{field}=@var{top})
  2999. looks like this:
  3000. @example
  3001. Input stream:
  3002. T 1 2 2 3 4 <-- matching reference
  3003. B 1 2 3 4 4
  3004. Matches: c c p p c
  3005. Output stream:
  3006. T 1 2 2 3 4
  3007. B 1 2 2 3 4
  3008. @end example
  3009. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  3010. basically, they refer to the frame and field of the opposite parity:
  3011. @itemize
  3012. @item @var{p} matches the field of the opposite parity in the previous frame
  3013. @item @var{c} matches the field of the opposite parity in the current frame
  3014. @item @var{n} matches the field of the opposite parity in the next frame
  3015. @end itemize
  3016. @subsubsection u/b
  3017. The @var{u} and @var{b} matching are a bit special in the sense that they match
  3018. from the opposite parity flag. In the following examples, we assume that we are
  3019. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  3020. 'x' is placed above and below each matched fields.
  3021. With bottom matching (@option{field}=@var{bottom}):
  3022. @example
  3023. Match: c p n b u
  3024. x x x x x
  3025. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3026. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3027. x x x x x
  3028. Output frames:
  3029. 2 1 2 2 2
  3030. 2 2 2 1 3
  3031. @end example
  3032. With top matching (@option{field}=@var{top}):
  3033. @example
  3034. Match: c p n b u
  3035. x x x x x
  3036. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3037. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3038. x x x x x
  3039. Output frames:
  3040. 2 2 2 1 2
  3041. 2 1 3 2 2
  3042. @end example
  3043. @subsection Examples
  3044. Simple IVTC of a top field first telecined stream:
  3045. @example
  3046. fieldmatch=order=tff:combmatch=none, decimate
  3047. @end example
  3048. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  3049. @example
  3050. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  3051. @end example
  3052. @section fieldorder
  3053. Transform the field order of the input video.
  3054. This filter accepts the following options:
  3055. @table @option
  3056. @item order
  3057. Output field order. Valid values are @var{tff} for top field first or @var{bff}
  3058. for bottom field first.
  3059. @end table
  3060. Default value is @samp{tff}.
  3061. Transformation is achieved by shifting the picture content up or down
  3062. by one line, and filling the remaining line with appropriate picture content.
  3063. This method is consistent with most broadcast field order converters.
  3064. If the input video is not flagged as being interlaced, or it is already
  3065. flagged as being of the required output field order then this filter does
  3066. not alter the incoming video.
  3067. This filter is very useful when converting to or from PAL DV material,
  3068. which is bottom field first.
  3069. For example:
  3070. @example
  3071. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  3072. @end example
  3073. @section fifo
  3074. Buffer input images and send them when they are requested.
  3075. This filter is mainly useful when auto-inserted by the libavfilter
  3076. framework.
  3077. The filter does not take parameters.
  3078. @anchor{format}
  3079. @section format
  3080. Convert the input video to one of the specified pixel formats.
  3081. Libavfilter will try to pick one that is supported for the input to
  3082. the next filter.
  3083. This filter accepts the following parameters:
  3084. @table @option
  3085. @item pix_fmts
  3086. A '|'-separated list of pixel format names, for example
  3087. "pix_fmts=yuv420p|monow|rgb24".
  3088. @end table
  3089. @subsection Examples
  3090. @itemize
  3091. @item
  3092. Convert the input video to the format @var{yuv420p}
  3093. @example
  3094. format=pix_fmts=yuv420p
  3095. @end example
  3096. Convert the input video to any of the formats in the list
  3097. @example
  3098. format=pix_fmts=yuv420p|yuv444p|yuv410p
  3099. @end example
  3100. @end itemize
  3101. @section fps
  3102. Convert the video to specified constant frame rate by duplicating or dropping
  3103. frames as necessary.
  3104. This filter accepts the following named parameters:
  3105. @table @option
  3106. @item fps
  3107. Desired output frame rate. The default is @code{25}.
  3108. @item round
  3109. Rounding method.
  3110. Possible values are:
  3111. @table @option
  3112. @item zero
  3113. zero round towards 0
  3114. @item inf
  3115. round away from 0
  3116. @item down
  3117. round towards -infinity
  3118. @item up
  3119. round towards +infinity
  3120. @item near
  3121. round to nearest
  3122. @end table
  3123. The default is @code{near}.
  3124. @end table
  3125. Alternatively, the options can be specified as a flat string:
  3126. @var{fps}[:@var{round}].
  3127. See also the @ref{setpts} filter.
  3128. @subsection Examples
  3129. @itemize
  3130. @item
  3131. A typical usage in order to set the fps to 25:
  3132. @example
  3133. fps=fps=25
  3134. @end example
  3135. @item
  3136. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  3137. @example
  3138. fps=fps=film:round=near
  3139. @end example
  3140. @end itemize
  3141. @section framestep
  3142. Select one frame every N-th frame.
  3143. This filter accepts the following option:
  3144. @table @option
  3145. @item step
  3146. Select frame after every @code{step} frames.
  3147. Allowed values are positive integers higher than 0. Default value is @code{1}.
  3148. @end table
  3149. @anchor{frei0r}
  3150. @section frei0r
  3151. Apply a frei0r effect to the input video.
  3152. To enable compilation of this filter you need to install the frei0r
  3153. header and configure FFmpeg with @code{--enable-frei0r}.
  3154. This filter accepts the following options:
  3155. @table @option
  3156. @item filter_name
  3157. The name to the frei0r effect to load. If the environment variable
  3158. @env{FREI0R_PATH} is defined, the frei0r effect is searched in each one of the
  3159. directories specified by the colon separated list in @env{FREIOR_PATH},
  3160. otherwise in the standard frei0r paths, which are in this order:
  3161. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  3162. @file{/usr/lib/frei0r-1/}.
  3163. @item filter_params
  3164. A '|'-separated list of parameters to pass to the frei0r effect.
  3165. @end table
  3166. A frei0r effect parameter can be a boolean (whose values are specified
  3167. with "y" and "n"), a double, a color (specified by the syntax
  3168. @var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
  3169. numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
  3170. description), a position (specified by the syntax @var{X}/@var{Y},
  3171. @var{X} and @var{Y} being float numbers) and a string.
  3172. The number and kind of parameters depend on the loaded effect. If an
  3173. effect parameter is not specified the default value is set.
  3174. @subsection Examples
  3175. @itemize
  3176. @item
  3177. Apply the distort0r effect, set the first two double parameters:
  3178. @example
  3179. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  3180. @end example
  3181. @item
  3182. Apply the colordistance effect, take a color as first parameter:
  3183. @example
  3184. frei0r=colordistance:0.2/0.3/0.4
  3185. frei0r=colordistance:violet
  3186. frei0r=colordistance:0x112233
  3187. @end example
  3188. @item
  3189. Apply the perspective effect, specify the top left and top right image
  3190. positions:
  3191. @example
  3192. frei0r=perspective:0.2/0.2|0.8/0.2
  3193. @end example
  3194. @end itemize
  3195. For more information see:
  3196. @url{http://frei0r.dyne.org}
  3197. @section geq
  3198. The filter accepts the following options:
  3199. @table @option
  3200. @item lum_expr, lum
  3201. Set the luminance expression.
  3202. @item cb_expr, cb
  3203. Set the chrominance blue expression.
  3204. @item cr_expr, cr
  3205. Set the chrominance red expression.
  3206. @item alpha_expr, a
  3207. Set the alpha expression.
  3208. @item red_expr, r
  3209. Set the red expression.
  3210. @item green_expr, g
  3211. Set the green expression.
  3212. @item blue_expr, b
  3213. Set the blue expression.
  3214. @end table
  3215. The colorspace is selected according to the specified options. If one
  3216. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  3217. options is specified, the filter will automatically select a YCbCr
  3218. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  3219. @option{blue_expr} options is specified, it will select an RGB
  3220. colorspace.
  3221. If one of the chrominance expression is not defined, it falls back on the other
  3222. one. If no alpha expression is specified it will evaluate to opaque value.
  3223. If none of chrominance expressions are specified, they will evaluate
  3224. to the luminance expression.
  3225. The expressions can use the following variables and functions:
  3226. @table @option
  3227. @item N
  3228. The sequential number of the filtered frame, starting from @code{0}.
  3229. @item X
  3230. @item Y
  3231. The coordinates of the current sample.
  3232. @item W
  3233. @item H
  3234. The width and height of the image.
  3235. @item SW
  3236. @item SH
  3237. Width and height scale depending on the currently filtered plane. It is the
  3238. ratio between the corresponding luma plane number of pixels and the current
  3239. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3240. @code{0.5,0.5} for chroma planes.
  3241. @item T
  3242. Time of the current frame, expressed in seconds.
  3243. @item p(x, y)
  3244. Return the value of the pixel at location (@var{x},@var{y}) of the current
  3245. plane.
  3246. @item lum(x, y)
  3247. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  3248. plane.
  3249. @item cb(x, y)
  3250. Return the value of the pixel at location (@var{x},@var{y}) of the
  3251. blue-difference chroma plane. Return 0 if there is no such plane.
  3252. @item cr(x, y)
  3253. Return the value of the pixel at location (@var{x},@var{y}) of the
  3254. red-difference chroma plane. Return 0 if there is no such plane.
  3255. @item r(x, y)
  3256. @item g(x, y)
  3257. @item b(x, y)
  3258. Return the value of the pixel at location (@var{x},@var{y}) of the
  3259. red/green/blue component. Return 0 if there is no such component.
  3260. @item alpha(x, y)
  3261. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  3262. plane. Return 0 if there is no such plane.
  3263. @end table
  3264. For functions, if @var{x} and @var{y} are outside the area, the value will be
  3265. automatically clipped to the closer edge.
  3266. @subsection Examples
  3267. @itemize
  3268. @item
  3269. Flip the image horizontally:
  3270. @example
  3271. geq=p(W-X\,Y)
  3272. @end example
  3273. @item
  3274. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  3275. wavelength of 100 pixels:
  3276. @example
  3277. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  3278. @end example
  3279. @item
  3280. Generate a fancy enigmatic moving light:
  3281. @example
  3282. 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
  3283. @end example
  3284. @item
  3285. Generate a quick emboss effect:
  3286. @example
  3287. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  3288. @end example
  3289. @item
  3290. Modify RGB components depending on pixel position:
  3291. @example
  3292. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  3293. @end example
  3294. @end itemize
  3295. @section gradfun
  3296. Fix the banding artifacts that are sometimes introduced into nearly flat
  3297. regions by truncation to 8bit color depth.
  3298. Interpolate the gradients that should go where the bands are, and
  3299. dither them.
  3300. This filter is designed for playback only. Do not use it prior to
  3301. lossy compression, because compression tends to lose the dither and
  3302. bring back the bands.
  3303. This filter accepts the following options:
  3304. @table @option
  3305. @item strength
  3306. The maximum amount by which the filter will change any one pixel. Also the
  3307. threshold for detecting nearly flat regions. Acceptable values range from .51 to
  3308. 64, default value is 1.2, out-of-range values will be clipped to the valid
  3309. range.
  3310. @item radius
  3311. The neighborhood to fit the gradient to. A larger radius makes for smoother
  3312. gradients, but also prevents the filter from modifying the pixels near detailed
  3313. regions. Acceptable values are 8-32, default value is 16, out-of-range values
  3314. will be clipped to the valid range.
  3315. @end table
  3316. Alternatively, the options can be specified as a flat string:
  3317. @var{strength}[:@var{radius}]
  3318. @subsection Examples
  3319. @itemize
  3320. @item
  3321. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  3322. @example
  3323. gradfun=3.5:8
  3324. @end example
  3325. @item
  3326. Specify radius, omitting the strength (which will fall-back to the default
  3327. value):
  3328. @example
  3329. gradfun=radius=8
  3330. @end example
  3331. @end itemize
  3332. @anchor{haldclut}
  3333. @section haldclut
  3334. Apply a Hald CLUT to a video stream.
  3335. First input is the video stream to process, and second one is the Hald CLUT.
  3336. The Hald CLUT input can be a simple picture or a complete video stream.
  3337. The filter accepts the following options:
  3338. @table @option
  3339. @item shortest
  3340. Force termination when the shortest input terminates. Default is @code{0}.
  3341. @item repeatlast
  3342. Continue applying the last CLUT after the end of the stream. A value of
  3343. @code{0} disable the filter after the last frame of the CLUT is reached.
  3344. Default is @code{1}.
  3345. @end table
  3346. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  3347. filters share the same internals).
  3348. More information about the Hald CLUT can be found on Eskil Steenberg's website
  3349. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  3350. @subsection Workflow examples
  3351. @subsubsection Hald CLUT video stream
  3352. Generate an identity Hald CLUT stream altered with various effects:
  3353. @example
  3354. 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
  3355. @end example
  3356. Note: make sure you use a lossless codec.
  3357. Then use it with @code{haldclut} to apply it on some random stream:
  3358. @example
  3359. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  3360. @end example
  3361. The Hald CLUT will be applied to the 10 first seconds (duration of
  3362. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  3363. to the remaining frames of the @code{mandelbrot} stream.
  3364. @subsubsection Hald CLUT with preview
  3365. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  3366. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  3367. biggest possible square starting at the top left of the picture. The remaining
  3368. padding pixels (bottom or right) will be ignored. This area can be used to add
  3369. a preview of the Hald CLUT.
  3370. Typically, the following generated Hald CLUT will be supported by the
  3371. @code{haldclut} filter:
  3372. @example
  3373. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  3374. pad=iw+320 [padded_clut];
  3375. smptebars=s=320x256, split [a][b];
  3376. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  3377. [main][b] overlay=W-320" -frames:v 1 clut.png
  3378. @end example
  3379. It contains the original and a preview of the effect of the CLUT: SMPTE color
  3380. bars are displayed on the right-top, and below the same color bars processed by
  3381. the color changes.
  3382. Then, the effect of this Hald CLUT can be visualized with:
  3383. @example
  3384. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  3385. @end example
  3386. @section hflip
  3387. Flip the input video horizontally.
  3388. For example to horizontally flip the input video with @command{ffmpeg}:
  3389. @example
  3390. ffmpeg -i in.avi -vf "hflip" out.avi
  3391. @end example
  3392. @section histeq
  3393. This filter applies a global color histogram equalization on a
  3394. per-frame basis.
  3395. It can be used to correct video that has a compressed range of pixel
  3396. intensities. The filter redistributes the pixel intensities to
  3397. equalize their distribution across the intensity range. It may be
  3398. viewed as an "automatically adjusting contrast filter". This filter is
  3399. useful only for correcting degraded or poorly captured source
  3400. video.
  3401. The filter accepts the following options:
  3402. @table @option
  3403. @item strength
  3404. Determine the amount of equalization to be applied. As the strength
  3405. is reduced, the distribution of pixel intensities more-and-more
  3406. approaches that of the input frame. The value must be a float number
  3407. in the range [0,1] and defaults to 0.200.
  3408. @item intensity
  3409. Set the maximum intensity that can generated and scale the output
  3410. values appropriately. The strength should be set as desired and then
  3411. the intensity can be limited if needed to avoid washing-out. The value
  3412. must be a float number in the range [0,1] and defaults to 0.210.
  3413. @item antibanding
  3414. Set the antibanding level. If enabled the filter will randomly vary
  3415. the luminance of output pixels by a small amount to avoid banding of
  3416. the histogram. Possible values are @code{none}, @code{weak} or
  3417. @code{strong}. It defaults to @code{none}.
  3418. @end table
  3419. @section histogram
  3420. Compute and draw a color distribution histogram for the input video.
  3421. The computed histogram is a representation of distribution of color components
  3422. in an image.
  3423. The filter accepts the following options:
  3424. @table @option
  3425. @item mode
  3426. Set histogram mode.
  3427. It accepts the following values:
  3428. @table @samp
  3429. @item levels
  3430. standard histogram that display color components distribution in an image.
  3431. Displays color graph for each color component. Shows distribution
  3432. of the Y, U, V, A or G, B, R components, depending on input format,
  3433. in current frame. Bellow each graph is color component scale meter.
  3434. @item color
  3435. chroma values in vectorscope, if brighter more such chroma values are
  3436. distributed in an image.
  3437. Displays chroma values (U/V color placement) in two dimensional graph
  3438. (which is called a vectorscope). It can be used to read of the hue and
  3439. saturation of the current frame. At a same time it is a histogram.
  3440. The whiter a pixel in the vectorscope, the more pixels of the input frame
  3441. correspond to that pixel (that is the more pixels have this chroma value).
  3442. The V component is displayed on the horizontal (X) axis, with the leftmost
  3443. side being V = 0 and the rightmost side being V = 255.
  3444. The U component is displayed on the vertical (Y) axis, with the top
  3445. representing U = 0 and the bottom representing U = 255.
  3446. The position of a white pixel in the graph corresponds to the chroma value
  3447. of a pixel of the input clip. So the graph can be used to read of the
  3448. hue (color flavor) and the saturation (the dominance of the hue in the color).
  3449. As the hue of a color changes, it moves around the square. At the center of
  3450. the square, the saturation is zero, which means that the corresponding pixel
  3451. has no color. If you increase the amount of a specific color, while leaving
  3452. the other colors unchanged, the saturation increases, and you move towards
  3453. the edge of the square.
  3454. @item color2
  3455. chroma values in vectorscope, similar as @code{color} but actual chroma values
  3456. are displayed.
  3457. @item waveform
  3458. per row/column color component graph. In row mode graph in the left side represents
  3459. color component value 0 and right side represents value = 255. In column mode top
  3460. side represents color component value = 0 and bottom side represents value = 255.
  3461. @end table
  3462. Default value is @code{levels}.
  3463. @item level_height
  3464. Set height of level in @code{levels}. Default value is @code{200}.
  3465. Allowed range is [50, 2048].
  3466. @item scale_height
  3467. Set height of color scale in @code{levels}. Default value is @code{12}.
  3468. Allowed range is [0, 40].
  3469. @item step
  3470. Set step for @code{waveform} mode. Smaller values are useful to find out how much
  3471. of same luminance values across input rows/columns are distributed.
  3472. Default value is @code{10}. Allowed range is [1, 255].
  3473. @item waveform_mode
  3474. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  3475. Default is @code{row}.
  3476. @item display_mode
  3477. Set display mode for @code{waveform} and @code{levels}.
  3478. It accepts the following values:
  3479. @table @samp
  3480. @item parade
  3481. Display separate graph for the color components side by side in
  3482. @code{row} waveform mode or one below other in @code{column} waveform mode
  3483. for @code{waveform} histogram mode. For @code{levels} histogram mode
  3484. per color component graphs are placed one bellow other.
  3485. This display mode in @code{waveform} histogram mode makes it easy to spot
  3486. color casts in the highlights and shadows of an image, by comparing the
  3487. contours of the top and the bottom of each waveform.
  3488. Since whites, grays, and blacks are characterized by
  3489. exactly equal amounts of red, green, and blue, neutral areas of the
  3490. picture should display three waveforms of roughly equal width/height.
  3491. If not, the correction is easy to make by making adjustments to level the
  3492. three waveforms.
  3493. @item overlay
  3494. Presents information that's identical to that in the @code{parade}, except
  3495. that the graphs representing color components are superimposed directly
  3496. over one another.
  3497. This display mode in @code{waveform} histogram mode can make it easier to spot
  3498. the relative differences or similarities in overlapping areas of the color
  3499. components that are supposed to be identical, such as neutral whites, grays,
  3500. or blacks.
  3501. @end table
  3502. Default is @code{parade}.
  3503. @item levels_mode
  3504. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  3505. Default is @code{linear}.
  3506. @end table
  3507. @subsection Examples
  3508. @itemize
  3509. @item
  3510. Calculate and draw histogram:
  3511. @example
  3512. ffplay -i input -vf histogram
  3513. @end example
  3514. @end itemize
  3515. @anchor{hqdn3d}
  3516. @section hqdn3d
  3517. High precision/quality 3d denoise filter. This filter aims to reduce
  3518. image noise producing smooth images and making still images really
  3519. still. It should enhance compressibility.
  3520. It accepts the following optional parameters:
  3521. @table @option
  3522. @item luma_spatial
  3523. a non-negative float number which specifies spatial luma strength,
  3524. defaults to 4.0
  3525. @item chroma_spatial
  3526. a non-negative float number which specifies spatial chroma strength,
  3527. defaults to 3.0*@var{luma_spatial}/4.0
  3528. @item luma_tmp
  3529. a float number which specifies luma temporal strength, defaults to
  3530. 6.0*@var{luma_spatial}/4.0
  3531. @item chroma_tmp
  3532. a float number which specifies chroma temporal strength, defaults to
  3533. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
  3534. @end table
  3535. @section hue
  3536. Modify the hue and/or the saturation of the input.
  3537. This filter accepts the following options:
  3538. @table @option
  3539. @item h
  3540. Specify the hue angle as a number of degrees. It accepts an expression,
  3541. and defaults to "0".
  3542. @item s
  3543. Specify the saturation in the [-10,10] range. It accepts an expression and
  3544. defaults to "1".
  3545. @item H
  3546. Specify the hue angle as a number of radians. It accepts an
  3547. expression, and defaults to "0".
  3548. @end table
  3549. @option{h} and @option{H} are mutually exclusive, and can't be
  3550. specified at the same time.
  3551. The @option{h}, @option{H} and @option{s} option values are
  3552. expressions containing the following constants:
  3553. @table @option
  3554. @item n
  3555. frame count of the input frame starting from 0
  3556. @item pts
  3557. presentation timestamp of the input frame expressed in time base units
  3558. @item r
  3559. frame rate of the input video, NAN if the input frame rate is unknown
  3560. @item t
  3561. timestamp expressed in seconds, NAN if the input timestamp is unknown
  3562. @item tb
  3563. time base of the input video
  3564. @end table
  3565. @subsection Examples
  3566. @itemize
  3567. @item
  3568. Set the hue to 90 degrees and the saturation to 1.0:
  3569. @example
  3570. hue=h=90:s=1
  3571. @end example
  3572. @item
  3573. Same command but expressing the hue in radians:
  3574. @example
  3575. hue=H=PI/2:s=1
  3576. @end example
  3577. @item
  3578. Rotate hue and make the saturation swing between 0
  3579. and 2 over a period of 1 second:
  3580. @example
  3581. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  3582. @end example
  3583. @item
  3584. Apply a 3 seconds saturation fade-in effect starting at 0:
  3585. @example
  3586. hue="s=min(t/3\,1)"
  3587. @end example
  3588. The general fade-in expression can be written as:
  3589. @example
  3590. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  3591. @end example
  3592. @item
  3593. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  3594. @example
  3595. hue="s=max(0\, min(1\, (8-t)/3))"
  3596. @end example
  3597. The general fade-out expression can be written as:
  3598. @example
  3599. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  3600. @end example
  3601. @end itemize
  3602. @subsection Commands
  3603. This filter supports the following commands:
  3604. @table @option
  3605. @item s
  3606. @item h
  3607. @item H
  3608. Modify the hue and/or the saturation of the input video.
  3609. The command accepts the same syntax of the corresponding option.
  3610. If the specified expression is not valid, it is kept at its current
  3611. value.
  3612. @end table
  3613. @section idet
  3614. Detect video interlacing type.
  3615. This filter tries to detect if the input is interlaced or progressive,
  3616. top or bottom field first.
  3617. The filter accepts the following options:
  3618. @table @option
  3619. @item intl_thres
  3620. Set interlacing threshold.
  3621. @item prog_thres
  3622. Set progressive threshold.
  3623. @end table
  3624. @section il
  3625. Deinterleave or interleave fields.
  3626. This filter allows to process interlaced images fields without
  3627. deinterlacing them. Deinterleaving splits the input frame into 2
  3628. fields (so called half pictures). Odd lines are moved to the top
  3629. half of the output image, even lines to the bottom half.
  3630. You can process (filter) them independently and then re-interleave them.
  3631. The filter accepts the following options:
  3632. @table @option
  3633. @item luma_mode, l
  3634. @item chroma_mode, c
  3635. @item alpha_mode, a
  3636. Available values for @var{luma_mode}, @var{chroma_mode} and
  3637. @var{alpha_mode} are:
  3638. @table @samp
  3639. @item none
  3640. Do nothing.
  3641. @item deinterleave, d
  3642. Deinterleave fields, placing one above the other.
  3643. @item interleave, i
  3644. Interleave fields. Reverse the effect of deinterleaving.
  3645. @end table
  3646. Default value is @code{none}.
  3647. @item luma_swap, ls
  3648. @item chroma_swap, cs
  3649. @item alpha_swap, as
  3650. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  3651. @end table
  3652. @section interlace
  3653. Simple interlacing filter from progressive contents. This interleaves upper (or
  3654. lower) lines from odd frames with lower (or upper) lines from even frames,
  3655. halving the frame rate and preserving image height.
  3656. @example
  3657. Original Original New Frame
  3658. Frame 'j' Frame 'j+1' (tff)
  3659. ========== =========== ==================
  3660. Line 0 --------------------> Frame 'j' Line 0
  3661. Line 1 Line 1 ----> Frame 'j+1' Line 1
  3662. Line 2 ---------------------> Frame 'j' Line 2
  3663. Line 3 Line 3 ----> Frame 'j+1' Line 3
  3664. ... ... ...
  3665. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  3666. @end example
  3667. It accepts the following optional parameters:
  3668. @table @option
  3669. @item scan
  3670. determines whether the interlaced frame is taken from the even (tff - default)
  3671. or odd (bff) lines of the progressive frame.
  3672. @item lowpass
  3673. Enable (default) or disable the vertical lowpass filter to avoid twitter
  3674. interlacing and reduce moire patterns.
  3675. @end table
  3676. @section kerndeint
  3677. Deinterlace input video by applying Donald Graft's adaptive kernel
  3678. deinterling. Work on interlaced parts of a video to produce
  3679. progressive frames.
  3680. The description of the accepted parameters follows.
  3681. @table @option
  3682. @item thresh
  3683. Set the threshold which affects the filter's tolerance when
  3684. determining if a pixel line must be processed. It must be an integer
  3685. in the range [0,255] and defaults to 10. A value of 0 will result in
  3686. applying the process on every pixels.
  3687. @item map
  3688. Paint pixels exceeding the threshold value to white if set to 1.
  3689. Default is 0.
  3690. @item order
  3691. Set the fields order. Swap fields if set to 1, leave fields alone if
  3692. 0. Default is 0.
  3693. @item sharp
  3694. Enable additional sharpening if set to 1. Default is 0.
  3695. @item twoway
  3696. Enable twoway sharpening if set to 1. Default is 0.
  3697. @end table
  3698. @subsection Examples
  3699. @itemize
  3700. @item
  3701. Apply default values:
  3702. @example
  3703. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  3704. @end example
  3705. @item
  3706. Enable additional sharpening:
  3707. @example
  3708. kerndeint=sharp=1
  3709. @end example
  3710. @item
  3711. Paint processed pixels in white:
  3712. @example
  3713. kerndeint=map=1
  3714. @end example
  3715. @end itemize
  3716. @anchor{lut3d}
  3717. @section lut3d
  3718. Apply a 3D LUT to an input video.
  3719. The filter accepts the following options:
  3720. @table @option
  3721. @item file
  3722. Set the 3D LUT file name.
  3723. Currently supported formats:
  3724. @table @samp
  3725. @item 3dl
  3726. AfterEffects
  3727. @item cube
  3728. Iridas
  3729. @item dat
  3730. DaVinci
  3731. @item m3d
  3732. Pandora
  3733. @end table
  3734. @item interp
  3735. Select interpolation mode.
  3736. Available values are:
  3737. @table @samp
  3738. @item nearest
  3739. Use values from the nearest defined point.
  3740. @item trilinear
  3741. Interpolate values using the 8 points defining a cube.
  3742. @item tetrahedral
  3743. Interpolate values using a tetrahedron.
  3744. @end table
  3745. @end table
  3746. @section lut, lutrgb, lutyuv
  3747. Compute a look-up table for binding each pixel component input value
  3748. to an output value, and apply it to input video.
  3749. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  3750. to an RGB input video.
  3751. These filters accept the following options:
  3752. @table @option
  3753. @item c0
  3754. set first pixel component expression
  3755. @item c1
  3756. set second pixel component expression
  3757. @item c2
  3758. set third pixel component expression
  3759. @item c3
  3760. set fourth pixel component expression, corresponds to the alpha component
  3761. @item r
  3762. set red component expression
  3763. @item g
  3764. set green component expression
  3765. @item b
  3766. set blue component expression
  3767. @item a
  3768. alpha component expression
  3769. @item y
  3770. set Y/luminance component expression
  3771. @item u
  3772. set U/Cb component expression
  3773. @item v
  3774. set V/Cr component expression
  3775. @end table
  3776. Each of them specifies the expression to use for computing the lookup table for
  3777. the corresponding pixel component values.
  3778. The exact component associated to each of the @var{c*} options depends on the
  3779. format in input.
  3780. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  3781. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  3782. The expressions can contain the following constants and functions:
  3783. @table @option
  3784. @item w
  3785. @item h
  3786. the input width and height
  3787. @item val
  3788. input value for the pixel component
  3789. @item clipval
  3790. the input value clipped in the @var{minval}-@var{maxval} range
  3791. @item maxval
  3792. maximum value for the pixel component
  3793. @item minval
  3794. minimum value for the pixel component
  3795. @item negval
  3796. the negated value for the pixel component value clipped in the
  3797. @var{minval}-@var{maxval} range , it corresponds to the expression
  3798. "maxval-clipval+minval"
  3799. @item clip(val)
  3800. the computed value in @var{val} clipped in the
  3801. @var{minval}-@var{maxval} range
  3802. @item gammaval(gamma)
  3803. the computed gamma correction value of the pixel component value
  3804. clipped in the @var{minval}-@var{maxval} range, corresponds to the
  3805. expression
  3806. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  3807. @end table
  3808. All expressions default to "val".
  3809. @subsection Examples
  3810. @itemize
  3811. @item
  3812. Negate input video:
  3813. @example
  3814. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  3815. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  3816. @end example
  3817. The above is the same as:
  3818. @example
  3819. lutrgb="r=negval:g=negval:b=negval"
  3820. lutyuv="y=negval:u=negval:v=negval"
  3821. @end example
  3822. @item
  3823. Negate luminance:
  3824. @example
  3825. lutyuv=y=negval
  3826. @end example
  3827. @item
  3828. Remove chroma components, turns the video into a graytone image:
  3829. @example
  3830. lutyuv="u=128:v=128"
  3831. @end example
  3832. @item
  3833. Apply a luma burning effect:
  3834. @example
  3835. lutyuv="y=2*val"
  3836. @end example
  3837. @item
  3838. Remove green and blue components:
  3839. @example
  3840. lutrgb="g=0:b=0"
  3841. @end example
  3842. @item
  3843. Set a constant alpha channel value on input:
  3844. @example
  3845. format=rgba,lutrgb=a="maxval-minval/2"
  3846. @end example
  3847. @item
  3848. Correct luminance gamma by a 0.5 factor:
  3849. @example
  3850. lutyuv=y=gammaval(0.5)
  3851. @end example
  3852. @item
  3853. Discard least significant bits of luma:
  3854. @example
  3855. lutyuv=y='bitand(val, 128+64+32)'
  3856. @end example
  3857. @end itemize
  3858. @section mcdeint
  3859. Apply motion-compensation deinterlacing.
  3860. It needs one field per frame as input and must thus be used together
  3861. with yadif=1/3 or equivalent.
  3862. This filter accepts the following options:
  3863. @table @option
  3864. @item mode
  3865. Set the deinterlacing mode.
  3866. It accepts one of the following values:
  3867. @table @samp
  3868. @item fast
  3869. @item medium
  3870. @item slow
  3871. use iterative motion estimation
  3872. @item extra_slow
  3873. like @samp{slow}, but use multiple reference frames.
  3874. @end table
  3875. Default value is @samp{fast}.
  3876. @item parity
  3877. Set the picture field parity assumed for the input video. It must be
  3878. one of the following values:
  3879. @table @samp
  3880. @item 0, tff
  3881. assume top field first
  3882. @item 1, bff
  3883. assume bottom field first
  3884. @end table
  3885. Default value is @samp{bff}.
  3886. @item qp
  3887. Set per-block quantization parameter (QP) used by the internal
  3888. encoder.
  3889. Higher values should result in a smoother motion vector field but less
  3890. optimal individual vectors. Default value is 1.
  3891. @end table
  3892. @section mp
  3893. Apply an MPlayer filter to the input video.
  3894. This filter provides a wrapper around some of the filters of
  3895. MPlayer/MEncoder.
  3896. This wrapper is considered experimental. Some of the wrapped filters
  3897. may not work properly and we may drop support for them, as they will
  3898. be implemented natively into FFmpeg. Thus you should avoid
  3899. depending on them when writing portable scripts.
  3900. The filter accepts the parameters:
  3901. @var{filter_name}[:=]@var{filter_params}
  3902. @var{filter_name} is the name of a supported MPlayer filter,
  3903. @var{filter_params} is a string containing the parameters accepted by
  3904. the named filter.
  3905. The list of the currently supported filters follows:
  3906. @table @var
  3907. @item dint
  3908. @item eq2
  3909. @item eq
  3910. @item fil
  3911. @item fspp
  3912. @item ilpack
  3913. @item phase
  3914. @item pp7
  3915. @item pullup
  3916. @item qp
  3917. @item softpulldown
  3918. @item uspp
  3919. @end table
  3920. The parameter syntax and behavior for the listed filters are the same
  3921. of the corresponding MPlayer filters. For detailed instructions check
  3922. the "VIDEO FILTERS" section in the MPlayer manual.
  3923. @subsection Examples
  3924. @itemize
  3925. @item
  3926. Adjust gamma, brightness, contrast:
  3927. @example
  3928. mp=eq2=1.0:2:0.5
  3929. @end example
  3930. @end itemize
  3931. See also mplayer(1), @url{http://www.mplayerhq.hu/}.
  3932. @section mpdecimate
  3933. Drop frames that do not differ greatly from the previous frame in
  3934. order to reduce frame rate.
  3935. The main use of this filter is for very-low-bitrate encoding
  3936. (e.g. streaming over dialup modem), but it could in theory be used for
  3937. fixing movies that were inverse-telecined incorrectly.
  3938. A description of the accepted options follows.
  3939. @table @option
  3940. @item max
  3941. Set the maximum number of consecutive frames which can be dropped (if
  3942. positive), or the minimum interval between dropped frames (if
  3943. negative). If the value is 0, the frame is dropped unregarding the
  3944. number of previous sequentially dropped frames.
  3945. Default value is 0.
  3946. @item hi
  3947. @item lo
  3948. @item frac
  3949. Set the dropping threshold values.
  3950. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  3951. represent actual pixel value differences, so a threshold of 64
  3952. corresponds to 1 unit of difference for each pixel, or the same spread
  3953. out differently over the block.
  3954. A frame is a candidate for dropping if no 8x8 blocks differ by more
  3955. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  3956. meaning the whole image) differ by more than a threshold of @option{lo}.
  3957. Default value for @option{hi} is 64*12, default value for @option{lo} is
  3958. 64*5, and default value for @option{frac} is 0.33.
  3959. @end table
  3960. @section negate
  3961. Negate input video.
  3962. This filter accepts an integer in input, if non-zero it negates the
  3963. alpha component (if available). The default value in input is 0.
  3964. @section noformat
  3965. Force libavfilter not to use any of the specified pixel formats for the
  3966. input to the next filter.
  3967. This filter accepts the following parameters:
  3968. @table @option
  3969. @item pix_fmts
  3970. A '|'-separated list of pixel format names, for example
  3971. "pix_fmts=yuv420p|monow|rgb24".
  3972. @end table
  3973. @subsection Examples
  3974. @itemize
  3975. @item
  3976. Force libavfilter to use a format different from @var{yuv420p} for the
  3977. input to the vflip filter:
  3978. @example
  3979. noformat=pix_fmts=yuv420p,vflip
  3980. @end example
  3981. @item
  3982. Convert the input video to any of the formats not contained in the list:
  3983. @example
  3984. noformat=yuv420p|yuv444p|yuv410p
  3985. @end example
  3986. @end itemize
  3987. @section noise
  3988. Add noise on video input frame.
  3989. The filter accepts the following options:
  3990. @table @option
  3991. @item all_seed
  3992. @item c0_seed
  3993. @item c1_seed
  3994. @item c2_seed
  3995. @item c3_seed
  3996. Set noise seed for specific pixel component or all pixel components in case
  3997. of @var{all_seed}. Default value is @code{123457}.
  3998. @item all_strength, alls
  3999. @item c0_strength, c0s
  4000. @item c1_strength, c1s
  4001. @item c2_strength, c2s
  4002. @item c3_strength, c3s
  4003. Set noise strength for specific pixel component or all pixel components in case
  4004. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  4005. @item all_flags, allf
  4006. @item c0_flags, c0f
  4007. @item c1_flags, c1f
  4008. @item c2_flags, c2f
  4009. @item c3_flags, c3f
  4010. Set pixel component flags or set flags for all components if @var{all_flags}.
  4011. Available values for component flags are:
  4012. @table @samp
  4013. @item a
  4014. averaged temporal noise (smoother)
  4015. @item p
  4016. mix random noise with a (semi)regular pattern
  4017. @item t
  4018. temporal noise (noise pattern changes between frames)
  4019. @item u
  4020. uniform noise (gaussian otherwise)
  4021. @end table
  4022. @end table
  4023. @subsection Examples
  4024. Add temporal and uniform noise to input video:
  4025. @example
  4026. noise=alls=20:allf=t+u
  4027. @end example
  4028. @section null
  4029. Pass the video source unchanged to the output.
  4030. @section ocv
  4031. Apply video transform using libopencv.
  4032. To enable this filter install libopencv library and headers and
  4033. configure FFmpeg with @code{--enable-libopencv}.
  4034. This filter accepts the following parameters:
  4035. @table @option
  4036. @item filter_name
  4037. The name of the libopencv filter to apply.
  4038. @item filter_params
  4039. The parameters to pass to the libopencv filter. If not specified the default
  4040. values are assumed.
  4041. @end table
  4042. Refer to the official libopencv documentation for more precise
  4043. information:
  4044. @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
  4045. Follows the list of supported libopencv filters.
  4046. @anchor{dilate}
  4047. @subsection dilate
  4048. Dilate an image by using a specific structuring element.
  4049. This filter corresponds to the libopencv function @code{cvDilate}.
  4050. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  4051. @var{struct_el} represents a structuring element, and has the syntax:
  4052. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  4053. @var{cols} and @var{rows} represent the number of columns and rows of
  4054. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  4055. point, and @var{shape} the shape for the structuring element, and
  4056. can be one of the values "rect", "cross", "ellipse", "custom".
  4057. If the value for @var{shape} is "custom", it must be followed by a
  4058. string of the form "=@var{filename}". The file with name
  4059. @var{filename} is assumed to represent a binary image, with each
  4060. printable character corresponding to a bright pixel. When a custom
  4061. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  4062. or columns and rows of the read file are assumed instead.
  4063. The default value for @var{struct_el} is "3x3+0x0/rect".
  4064. @var{nb_iterations} specifies the number of times the transform is
  4065. applied to the image, and defaults to 1.
  4066. Follow some example:
  4067. @example
  4068. # use the default values
  4069. ocv=dilate
  4070. # dilate using a structuring element with a 5x5 cross, iterate two times
  4071. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  4072. # read the shape from the file diamond.shape, iterate two times
  4073. # the file diamond.shape may contain a pattern of characters like this:
  4074. # *
  4075. # ***
  4076. # *****
  4077. # ***
  4078. # *
  4079. # the specified cols and rows are ignored (but not the anchor point coordinates)
  4080. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  4081. @end example
  4082. @subsection erode
  4083. Erode an image by using a specific structuring element.
  4084. This filter corresponds to the libopencv function @code{cvErode}.
  4085. The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
  4086. with the same syntax and semantics as the @ref{dilate} filter.
  4087. @subsection smooth
  4088. Smooth the input video.
  4089. The filter takes the following parameters:
  4090. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  4091. @var{type} is the type of smooth filter to apply, and can be one of
  4092. the following values: "blur", "blur_no_scale", "median", "gaussian",
  4093. "bilateral". The default value is "gaussian".
  4094. @var{param1}, @var{param2}, @var{param3}, and @var{param4} are
  4095. parameters whose meanings depend on smooth type. @var{param1} and
  4096. @var{param2} accept integer positive values or 0, @var{param3} and
  4097. @var{param4} accept float values.
  4098. The default value for @var{param1} is 3, the default value for the
  4099. other parameters is 0.
  4100. These parameters correspond to the parameters assigned to the
  4101. libopencv function @code{cvSmooth}.
  4102. @anchor{overlay}
  4103. @section overlay
  4104. Overlay one video on top of another.
  4105. It takes two inputs and one output, the first input is the "main"
  4106. video on which the second input is overlayed.
  4107. This filter accepts the following parameters:
  4108. A description of the accepted options follows.
  4109. @table @option
  4110. @item x
  4111. @item y
  4112. Set the expression for the x and y coordinates of the overlayed video
  4113. on the main video. Default value is "0" for both expressions. In case
  4114. the expression is invalid, it is set to a huge value (meaning that the
  4115. overlay will not be displayed within the output visible area).
  4116. @item eval
  4117. Set when the expressions for @option{x}, and @option{y} are evaluated.
  4118. It accepts the following values:
  4119. @table @samp
  4120. @item init
  4121. only evaluate expressions once during the filter initialization or
  4122. when a command is processed
  4123. @item frame
  4124. evaluate expressions for each incoming frame
  4125. @end table
  4126. Default value is @samp{frame}.
  4127. @item shortest
  4128. If set to 1, force the output to terminate when the shortest input
  4129. terminates. Default value is 0.
  4130. @item format
  4131. Set the format for the output video.
  4132. It accepts the following values:
  4133. @table @samp
  4134. @item yuv420
  4135. force YUV420 output
  4136. @item yuv444
  4137. force YUV444 output
  4138. @item rgb
  4139. force RGB output
  4140. @end table
  4141. Default value is @samp{yuv420}.
  4142. @item rgb @emph{(deprecated)}
  4143. If set to 1, force the filter to accept inputs in the RGB
  4144. color space. Default value is 0. This option is deprecated, use
  4145. @option{format} instead.
  4146. @item repeatlast
  4147. If set to 1, force the filter to draw the last overlay frame over the
  4148. main input until the end of the stream. A value of 0 disables this
  4149. behavior. Default value is 1.
  4150. @end table
  4151. The @option{x}, and @option{y} expressions can contain the following
  4152. parameters.
  4153. @table @option
  4154. @item main_w, W
  4155. @item main_h, H
  4156. main input width and height
  4157. @item overlay_w, w
  4158. @item overlay_h, h
  4159. overlay input width and height
  4160. @item x
  4161. @item y
  4162. the computed values for @var{x} and @var{y}. They are evaluated for
  4163. each new frame.
  4164. @item hsub
  4165. @item vsub
  4166. horizontal and vertical chroma subsample values of the output
  4167. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  4168. @var{vsub} is 1.
  4169. @item n
  4170. the number of input frame, starting from 0
  4171. @item pos
  4172. the position in the file of the input frame, NAN if unknown
  4173. @item t
  4174. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4175. @end table
  4176. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  4177. when evaluation is done @emph{per frame}, and will evaluate to NAN
  4178. when @option{eval} is set to @samp{init}.
  4179. Be aware that frames are taken from each input video in timestamp
  4180. order, hence, if their initial timestamps differ, it is a a good idea
  4181. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  4182. have them begin in the same zero timestamp, as it does the example for
  4183. the @var{movie} filter.
  4184. You can chain together more overlays but you should test the
  4185. efficiency of such approach.
  4186. @subsection Commands
  4187. This filter supports the following commands:
  4188. @table @option
  4189. @item x
  4190. @item y
  4191. Modify the x and y of the overlay input.
  4192. The command accepts the same syntax of the corresponding option.
  4193. If the specified expression is not valid, it is kept at its current
  4194. value.
  4195. @end table
  4196. @subsection Examples
  4197. @itemize
  4198. @item
  4199. Draw the overlay at 10 pixels from the bottom right corner of the main
  4200. video:
  4201. @example
  4202. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  4203. @end example
  4204. Using named options the example above becomes:
  4205. @example
  4206. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  4207. @end example
  4208. @item
  4209. Insert a transparent PNG logo in the bottom left corner of the input,
  4210. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  4211. @example
  4212. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  4213. @end example
  4214. @item
  4215. Insert 2 different transparent PNG logos (second logo on bottom
  4216. right corner) using the @command{ffmpeg} tool:
  4217. @example
  4218. 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
  4219. @end example
  4220. @item
  4221. Add a transparent color layer on top of the main video, @code{WxH}
  4222. must specify the size of the main input to the overlay filter:
  4223. @example
  4224. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  4225. @end example
  4226. @item
  4227. Play an original video and a filtered version (here with the deshake
  4228. filter) side by side using the @command{ffplay} tool:
  4229. @example
  4230. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  4231. @end example
  4232. The above command is the same as:
  4233. @example
  4234. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  4235. @end example
  4236. @item
  4237. Make a sliding overlay appearing from the left to the right top part of the
  4238. screen starting since time 2:
  4239. @example
  4240. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  4241. @end example
  4242. @item
  4243. Compose output by putting two input videos side to side:
  4244. @example
  4245. ffmpeg -i left.avi -i right.avi -filter_complex "
  4246. nullsrc=size=200x100 [background];
  4247. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  4248. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  4249. [background][left] overlay=shortest=1 [background+left];
  4250. [background+left][right] overlay=shortest=1:x=100 [left+right]
  4251. "
  4252. @end example
  4253. @item
  4254. Chain several overlays in cascade:
  4255. @example
  4256. nullsrc=s=200x200 [bg];
  4257. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  4258. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  4259. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  4260. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  4261. [in3] null, [mid2] overlay=100:100 [out0]
  4262. @end example
  4263. @end itemize
  4264. @section owdenoise
  4265. Apply Overcomplete Wavelet denoiser.
  4266. The filter accepts the following options:
  4267. @table @option
  4268. @item depth
  4269. Set depth.
  4270. Larger depth values will denoise lower frequency components more, but
  4271. slow down filtering.
  4272. Must be an int in the range 8-16, default is @code{8}.
  4273. @item luma_strength, ls
  4274. Set luma strength.
  4275. Must be a double value in the range 0-1000, default is @code{1.0}.
  4276. @item chroma_strength, cs
  4277. Set chroma strength.
  4278. Must be a double value in the range 0-1000, default is @code{1.0}.
  4279. @end table
  4280. @section pad
  4281. Add paddings to the input image, and place the original input at the
  4282. given coordinates @var{x}, @var{y}.
  4283. This filter accepts the following parameters:
  4284. @table @option
  4285. @item width, w
  4286. @item height, h
  4287. Specify an expression for the size of the output image with the
  4288. paddings added. If the value for @var{width} or @var{height} is 0, the
  4289. corresponding input size is used for the output.
  4290. The @var{width} expression can reference the value set by the
  4291. @var{height} expression, and vice versa.
  4292. The default value of @var{width} and @var{height} is 0.
  4293. @item x
  4294. @item y
  4295. Specify an expression for the offsets where to place the input image
  4296. in the padded area with respect to the top/left border of the output
  4297. image.
  4298. The @var{x} expression can reference the value set by the @var{y}
  4299. expression, and vice versa.
  4300. The default value of @var{x} and @var{y} is 0.
  4301. @item color
  4302. Specify the color of the padded area, it can be the name of a color
  4303. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  4304. The default value of @var{color} is "black".
  4305. @end table
  4306. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  4307. options are expressions containing the following constants:
  4308. @table @option
  4309. @item in_w
  4310. @item in_h
  4311. the input video width and height
  4312. @item iw
  4313. @item ih
  4314. same as @var{in_w} and @var{in_h}
  4315. @item out_w
  4316. @item out_h
  4317. the output width and height, that is the size of the padded area as
  4318. specified by the @var{width} and @var{height} expressions
  4319. @item ow
  4320. @item oh
  4321. same as @var{out_w} and @var{out_h}
  4322. @item x
  4323. @item y
  4324. x and y offsets as specified by the @var{x} and @var{y}
  4325. expressions, or NAN if not yet specified
  4326. @item a
  4327. same as @var{iw} / @var{ih}
  4328. @item sar
  4329. input sample aspect ratio
  4330. @item dar
  4331. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4332. @item hsub
  4333. @item vsub
  4334. horizontal and vertical chroma subsample values. For example for the
  4335. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4336. @end table
  4337. @subsection Examples
  4338. @itemize
  4339. @item
  4340. Add paddings with color "violet" to the input video. Output video
  4341. size is 640x480, the top-left corner of the input video is placed at
  4342. column 0, row 40:
  4343. @example
  4344. pad=640:480:0:40:violet
  4345. @end example
  4346. The example above is equivalent to the following command:
  4347. @example
  4348. pad=width=640:height=480:x=0:y=40:color=violet
  4349. @end example
  4350. @item
  4351. Pad the input to get an output with dimensions increased by 3/2,
  4352. and put the input video at the center of the padded area:
  4353. @example
  4354. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  4355. @end example
  4356. @item
  4357. Pad the input to get a squared output with size equal to the maximum
  4358. value between the input width and height, and put the input video at
  4359. the center of the padded area:
  4360. @example
  4361. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  4362. @end example
  4363. @item
  4364. Pad the input to get a final w/h ratio of 16:9:
  4365. @example
  4366. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  4367. @end example
  4368. @item
  4369. In case of anamorphic video, in order to set the output display aspect
  4370. correctly, it is necessary to use @var{sar} in the expression,
  4371. according to the relation:
  4372. @example
  4373. (ih * X / ih) * sar = output_dar
  4374. X = output_dar / sar
  4375. @end example
  4376. Thus the previous example needs to be modified to:
  4377. @example
  4378. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  4379. @end example
  4380. @item
  4381. Double output size and put the input video in the bottom-right
  4382. corner of the output padded area:
  4383. @example
  4384. pad="2*iw:2*ih:ow-iw:oh-ih"
  4385. @end example
  4386. @end itemize
  4387. @section perspective
  4388. Correct perspective of video not recorded perpendicular to the screen.
  4389. A description of the accepted parameters follows.
  4390. @table @option
  4391. @item x0
  4392. @item y0
  4393. @item x1
  4394. @item y1
  4395. @item x2
  4396. @item y2
  4397. @item x3
  4398. @item y3
  4399. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  4400. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  4401. The expressions can use the following variables:
  4402. @table @option
  4403. @item W
  4404. @item H
  4405. the width and height of video frame.
  4406. @end table
  4407. @item interpolation
  4408. Set interpolation for perspective correction.
  4409. It accepts the following values:
  4410. @table @samp
  4411. @item linear
  4412. @item cubic
  4413. @end table
  4414. Default value is @samp{linear}.
  4415. @end table
  4416. @section pixdesctest
  4417. Pixel format descriptor test filter, mainly useful for internal
  4418. testing. The output video should be equal to the input video.
  4419. For example:
  4420. @example
  4421. format=monow, pixdesctest
  4422. @end example
  4423. can be used to test the monowhite pixel format descriptor definition.
  4424. @section pp
  4425. Enable the specified chain of postprocessing subfilters using libpostproc. This
  4426. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  4427. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  4428. Each subfilter and some options have a short and a long name that can be used
  4429. interchangeably, i.e. dr/dering are the same.
  4430. The filters accept the following options:
  4431. @table @option
  4432. @item subfilters
  4433. Set postprocessing subfilters string.
  4434. @end table
  4435. All subfilters share common options to determine their scope:
  4436. @table @option
  4437. @item a/autoq
  4438. Honor the quality commands for this subfilter.
  4439. @item c/chrom
  4440. Do chrominance filtering, too (default).
  4441. @item y/nochrom
  4442. Do luminance filtering only (no chrominance).
  4443. @item n/noluma
  4444. Do chrominance filtering only (no luminance).
  4445. @end table
  4446. These options can be appended after the subfilter name, separated by a '|'.
  4447. Available subfilters are:
  4448. @table @option
  4449. @item hb/hdeblock[|difference[|flatness]]
  4450. Horizontal deblocking filter
  4451. @table @option
  4452. @item difference
  4453. Difference factor where higher values mean more deblocking (default: @code{32}).
  4454. @item flatness
  4455. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4456. @end table
  4457. @item vb/vdeblock[|difference[|flatness]]
  4458. Vertical deblocking filter
  4459. @table @option
  4460. @item difference
  4461. Difference factor where higher values mean more deblocking (default: @code{32}).
  4462. @item flatness
  4463. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4464. @end table
  4465. @item ha/hadeblock[|difference[|flatness]]
  4466. Accurate horizontal deblocking filter
  4467. @table @option
  4468. @item difference
  4469. Difference factor where higher values mean more deblocking (default: @code{32}).
  4470. @item flatness
  4471. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4472. @end table
  4473. @item va/vadeblock[|difference[|flatness]]
  4474. Accurate vertical deblocking filter
  4475. @table @option
  4476. @item difference
  4477. Difference factor where higher values mean more deblocking (default: @code{32}).
  4478. @item flatness
  4479. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4480. @end table
  4481. @end table
  4482. The horizontal and vertical deblocking filters share the difference and
  4483. flatness values so you cannot set different horizontal and vertical
  4484. thresholds.
  4485. @table @option
  4486. @item h1/x1hdeblock
  4487. Experimental horizontal deblocking filter
  4488. @item v1/x1vdeblock
  4489. Experimental vertical deblocking filter
  4490. @item dr/dering
  4491. Deringing filter
  4492. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  4493. @table @option
  4494. @item threshold1
  4495. larger -> stronger filtering
  4496. @item threshold2
  4497. larger -> stronger filtering
  4498. @item threshold3
  4499. larger -> stronger filtering
  4500. @end table
  4501. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  4502. @table @option
  4503. @item f/fullyrange
  4504. Stretch luminance to @code{0-255}.
  4505. @end table
  4506. @item lb/linblenddeint
  4507. Linear blend deinterlacing filter that deinterlaces the given block by
  4508. filtering all lines with a @code{(1 2 1)} filter.
  4509. @item li/linipoldeint
  4510. Linear interpolating deinterlacing filter that deinterlaces the given block by
  4511. linearly interpolating every second line.
  4512. @item ci/cubicipoldeint
  4513. Cubic interpolating deinterlacing filter deinterlaces the given block by
  4514. cubically interpolating every second line.
  4515. @item md/mediandeint
  4516. Median deinterlacing filter that deinterlaces the given block by applying a
  4517. median filter to every second line.
  4518. @item fd/ffmpegdeint
  4519. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  4520. second line with a @code{(-1 4 2 4 -1)} filter.
  4521. @item l5/lowpass5
  4522. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  4523. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  4524. @item fq/forceQuant[|quantizer]
  4525. Overrides the quantizer table from the input with the constant quantizer you
  4526. specify.
  4527. @table @option
  4528. @item quantizer
  4529. Quantizer to use
  4530. @end table
  4531. @item de/default
  4532. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  4533. @item fa/fast
  4534. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  4535. @item ac
  4536. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  4537. @end table
  4538. @subsection Examples
  4539. @itemize
  4540. @item
  4541. Apply horizontal and vertical deblocking, deringing and automatic
  4542. brightness/contrast:
  4543. @example
  4544. pp=hb/vb/dr/al
  4545. @end example
  4546. @item
  4547. Apply default filters without brightness/contrast correction:
  4548. @example
  4549. pp=de/-al
  4550. @end example
  4551. @item
  4552. Apply default filters and temporal denoiser:
  4553. @example
  4554. pp=default/tmpnoise|1|2|3
  4555. @end example
  4556. @item
  4557. Apply deblocking on luminance only, and switch vertical deblocking on or off
  4558. automatically depending on available CPU time:
  4559. @example
  4560. pp=hb|y/vb|a
  4561. @end example
  4562. @end itemize
  4563. @section psnr
  4564. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  4565. Ratio) between two input videos.
  4566. This filter takes in input two input videos, the first input is
  4567. considered the "main" source and is passed unchanged to the
  4568. output. The second input is used as a "reference" video for computing
  4569. the PSNR.
  4570. Both video inputs must have the same resolution and pixel format for
  4571. this filter to work correctly. Also it assumes that both inputs
  4572. have the same number of frames, which are compared one by one.
  4573. The obtained average PSNR is printed through the logging system.
  4574. The filter stores the accumulated MSE (mean squared error) of each
  4575. frame, and at the end of the processing it is averaged across all frames
  4576. equally, and the following formula is applied to obtain the PSNR:
  4577. @example
  4578. PSNR = 10*log10(MAX^2/MSE)
  4579. @end example
  4580. Where MAX is the average of the maximum values of each component of the
  4581. image.
  4582. The description of the accepted parameters follows.
  4583. @table @option
  4584. @item stats_file, f
  4585. If specified the filter will use the named file to save the PSNR of
  4586. each individual frame.
  4587. @end table
  4588. The file printed if @var{stats_file} is selected, contains a sequence of
  4589. key/value pairs of the form @var{key}:@var{value} for each compared
  4590. couple of frames.
  4591. A description of each shown parameter follows:
  4592. @table @option
  4593. @item n
  4594. sequential number of the input frame, starting from 1
  4595. @item mse_avg
  4596. Mean Square Error pixel-by-pixel average difference of the compared
  4597. frames, averaged over all the image components.
  4598. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  4599. Mean Square Error pixel-by-pixel average difference of the compared
  4600. frames for the component specified by the suffix.
  4601. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  4602. Peak Signal to Noise ratio of the compared frames for the component
  4603. specified by the suffix.
  4604. @end table
  4605. For example:
  4606. @example
  4607. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  4608. [main][ref] psnr="stats_file=stats.log" [out]
  4609. @end example
  4610. On this example the input file being processed is compared with the
  4611. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  4612. is stored in @file{stats.log}.
  4613. @section removelogo
  4614. Suppress a TV station logo, using an image file to determine which
  4615. pixels comprise the logo. It works by filling in the pixels that
  4616. comprise the logo with neighboring pixels.
  4617. The filter accepts the following options:
  4618. @table @option
  4619. @item filename, f
  4620. Set the filter bitmap file, which can be any image format supported by
  4621. libavformat. The width and height of the image file must match those of the
  4622. video stream being processed.
  4623. @end table
  4624. Pixels in the provided bitmap image with a value of zero are not
  4625. considered part of the logo, non-zero pixels are considered part of
  4626. the logo. If you use white (255) for the logo and black (0) for the
  4627. rest, you will be safe. For making the filter bitmap, it is
  4628. recommended to take a screen capture of a black frame with the logo
  4629. visible, and then using a threshold filter followed by the erode
  4630. filter once or twice.
  4631. If needed, little splotches can be fixed manually. Remember that if
  4632. logo pixels are not covered, the filter quality will be much
  4633. reduced. Marking too many pixels as part of the logo does not hurt as
  4634. much, but it will increase the amount of blurring needed to cover over
  4635. the image and will destroy more information than necessary, and extra
  4636. pixels will slow things down on a large logo.
  4637. @section rotate
  4638. Rotate video by an arbitrary angle expressed in radians.
  4639. The filter accepts the following options:
  4640. A description of the optional parameters follows.
  4641. @table @option
  4642. @item angle, a
  4643. Set an expression for the angle by which to rotate the input video
  4644. clockwise, expressed as a number of radians. A negative value will
  4645. result in a counter-clockwise rotation. By default it is set to "0".
  4646. This expression is evaluated for each frame.
  4647. @item out_w, ow
  4648. Set the output width expression, default value is "iw".
  4649. This expression is evaluated just once during configuration.
  4650. @item out_h, oh
  4651. Set the output height expression, default value is "ih".
  4652. This expression is evaluated just once during configuration.
  4653. @item bilinear
  4654. Enable bilinear interpolation if set to 1, a value of 0 disables
  4655. it. Default value is 1.
  4656. @item fillcolor, c
  4657. Set the color used to fill the output area not covered by the rotated
  4658. image. If the special value "none" is selected then no background is
  4659. printed (useful for example if the background is never shown). Default
  4660. value is "black".
  4661. @end table
  4662. The expressions for the angle and the output size can contain the
  4663. following constants and functions:
  4664. @table @option
  4665. @item n
  4666. sequential number of the input frame, starting from 0. It is always NAN
  4667. before the first frame is filtered.
  4668. @item t
  4669. time in seconds of the input frame, it is set to 0 when the filter is
  4670. configured. It is always NAN before the first frame is filtered.
  4671. @item hsub
  4672. @item vsub
  4673. horizontal and vertical chroma subsample values. For example for the
  4674. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4675. @item in_w, iw
  4676. @item in_h, ih
  4677. the input video width and heigth
  4678. @item out_w, ow
  4679. @item out_h, oh
  4680. the output width and heigth, that is the size of the padded area as
  4681. specified by the @var{width} and @var{height} expressions
  4682. @item rotw(a)
  4683. @item roth(a)
  4684. the minimal width/height required for completely containing the input
  4685. video rotated by @var{a} radians.
  4686. These are only available when computing the @option{out_w} and
  4687. @option{out_h} expressions.
  4688. @end table
  4689. @subsection Examples
  4690. @itemize
  4691. @item
  4692. Rotate the input by PI/6 radians clockwise:
  4693. @example
  4694. rotate=PI/6
  4695. @end example
  4696. @item
  4697. Rotate the input by PI/6 radians counter-clockwise:
  4698. @example
  4699. rotate=-PI/6
  4700. @end example
  4701. @item
  4702. Apply a constant rotation with period T, starting from an angle of PI/3:
  4703. @example
  4704. rotate=PI/3+2*PI*t/T
  4705. @end example
  4706. @item
  4707. Make the input video rotation oscillating with a period of T
  4708. seconds and an amplitude of A radians:
  4709. @example
  4710. rotate=A*sin(2*PI/T*t)
  4711. @end example
  4712. @item
  4713. Rotate the video, output size is choosen so that the whole rotating
  4714. input video is always completely contained in the output:
  4715. @example
  4716. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  4717. @end example
  4718. @item
  4719. Rotate the video, reduce the output size so that no background is ever
  4720. shown:
  4721. @example
  4722. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  4723. @end example
  4724. @end itemize
  4725. @subsection Commands
  4726. The filter supports the following commands:
  4727. @table @option
  4728. @item a, angle
  4729. Set the angle expression.
  4730. The command accepts the same syntax of the corresponding option.
  4731. If the specified expression is not valid, it is kept at its current
  4732. value.
  4733. @end table
  4734. @section sab
  4735. Apply Shape Adaptive Blur.
  4736. The filter accepts the following options:
  4737. @table @option
  4738. @item luma_radius, lr
  4739. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  4740. value is 1.0. A greater value will result in a more blurred image, and
  4741. in slower processing.
  4742. @item luma_pre_filter_radius, lpfr
  4743. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  4744. value is 1.0.
  4745. @item luma_strength, ls
  4746. Set luma maximum difference between pixels to still be considered, must
  4747. be a value in the 0.1-100.0 range, default value is 1.0.
  4748. @item chroma_radius, cr
  4749. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  4750. greater value will result in a more blurred image, and in slower
  4751. processing.
  4752. @item chroma_pre_filter_radius, cpfr
  4753. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  4754. @item chroma_strength, cs
  4755. Set chroma maximum difference between pixels to still be considered,
  4756. must be a value in the 0.1-100.0 range.
  4757. @end table
  4758. Each chroma option value, if not explicitly specified, is set to the
  4759. corresponding luma option value.
  4760. @section scale
  4761. Scale (resize) the input video, using the libswscale library.
  4762. The scale filter forces the output display aspect ratio to be the same
  4763. of the input, by changing the output sample aspect ratio.
  4764. The filter accepts the following options:
  4765. @table @option
  4766. @item width, w
  4767. Set the output video width expression. Default value is @code{iw}. See
  4768. below for the list of accepted constants.
  4769. @item height, h
  4770. Set the output video height expression. Default value is @code{ih}.
  4771. See below for the list of accepted constants.
  4772. @item interl
  4773. Set the interlacing. It accepts the following values:
  4774. @table @option
  4775. @item 1
  4776. force interlaced aware scaling
  4777. @item 0
  4778. do not apply interlaced scaling
  4779. @item -1
  4780. select interlaced aware scaling depending on whether the source frames
  4781. are flagged as interlaced or not
  4782. @end table
  4783. Default value is @code{0}.
  4784. @item flags
  4785. Set libswscale scaling flags. If not explictly specified the filter
  4786. applies a bilinear scaling algorithm.
  4787. @item size, s
  4788. Set the video size, the value must be a valid abbreviation or in the
  4789. form @var{width}x@var{height}.
  4790. @item in_color_matrix
  4791. @item out_color_matrix
  4792. Set in/output YCbCr colorspace type.
  4793. This allows the autodetected value to be overridden as well as allows forcing
  4794. a specific value used for the output and encoder.
  4795. If not specified, the colorspace type depends on the pixel format.
  4796. @table @samp
  4797. @item auto
  4798. Choose automatically
  4799. @item bt709
  4800. ITU Rec BT709
  4801. @item fcc
  4802. United States Federal Communications Commission Title 47 Code of
  4803. Federal Regulations (2003) 73.682 (a)
  4804. @item bt601
  4805. ITU Rec BT601
  4806. ITU-R Rec. BT.470-6 System B, G
  4807. Society of Motion Picture and Television Engineers 170M (2004)
  4808. @item smpte240m
  4809. Society of Motion Picture and Television Engineers 240M
  4810. @end table
  4811. @end table
  4812. The values of the @var{w} and @var{h} options are expressions
  4813. containing the following constants:
  4814. @table @option
  4815. @item in_w
  4816. @item in_h
  4817. the input width and height
  4818. @item iw
  4819. @item ih
  4820. same as @var{in_w} and @var{in_h}
  4821. @item out_w
  4822. @item out_h
  4823. the output (cropped) width and height
  4824. @item ow
  4825. @item oh
  4826. same as @var{out_w} and @var{out_h}
  4827. @item a
  4828. same as @var{iw} / @var{ih}
  4829. @item sar
  4830. input sample aspect ratio
  4831. @item dar
  4832. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4833. @item hsub
  4834. @item vsub
  4835. horizontal and vertical chroma subsample values. For example for the
  4836. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4837. @end table
  4838. If the input image format is different from the format requested by
  4839. the next filter, the scale filter will convert the input to the
  4840. requested format.
  4841. If the value for @var{w} or @var{h} is 0, the respective input
  4842. size is used for the output.
  4843. If the value for @var{w} or @var{h} is -1, the scale filter will use, for the
  4844. respective output size, a value that maintains the aspect ratio of the input
  4845. image.
  4846. @subsection Examples
  4847. @itemize
  4848. @item
  4849. Scale the input video to a size of 200x100:
  4850. @example
  4851. scale=w=200:h=100
  4852. @end example
  4853. This is equivalent to:
  4854. @example
  4855. scale=200:100
  4856. @end example
  4857. or:
  4858. @example
  4859. scale=200x100
  4860. @end example
  4861. @item
  4862. Specify a size abbreviation for the output size:
  4863. @example
  4864. scale=qcif
  4865. @end example
  4866. which can also be written as:
  4867. @example
  4868. scale=size=qcif
  4869. @end example
  4870. @item
  4871. Scale the input to 2x:
  4872. @example
  4873. scale=w=2*iw:h=2*ih
  4874. @end example
  4875. @item
  4876. The above is the same as:
  4877. @example
  4878. scale=2*in_w:2*in_h
  4879. @end example
  4880. @item
  4881. Scale the input to 2x with forced interlaced scaling:
  4882. @example
  4883. scale=2*iw:2*ih:interl=1
  4884. @end example
  4885. @item
  4886. Scale the input to half size:
  4887. @example
  4888. scale=w=iw/2:h=ih/2
  4889. @end example
  4890. @item
  4891. Increase the width, and set the height to the same size:
  4892. @example
  4893. scale=3/2*iw:ow
  4894. @end example
  4895. @item
  4896. Seek for Greek harmony:
  4897. @example
  4898. scale=iw:1/PHI*iw
  4899. scale=ih*PHI:ih
  4900. @end example
  4901. @item
  4902. Increase the height, and set the width to 3/2 of the height:
  4903. @example
  4904. scale=w=3/2*oh:h=3/5*ih
  4905. @end example
  4906. @item
  4907. Increase the size, but make the size a multiple of the chroma
  4908. subsample values:
  4909. @example
  4910. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  4911. @end example
  4912. @item
  4913. Increase the width to a maximum of 500 pixels, keep the same input
  4914. aspect ratio:
  4915. @example
  4916. scale=w='min(500\, iw*3/2):h=-1'
  4917. @end example
  4918. @end itemize
  4919. @section separatefields
  4920. The @code{separatefields} takes a frame-based video input and splits
  4921. each frame into its components fields, producing a new half height clip
  4922. with twice the frame rate and twice the frame count.
  4923. This filter use field-dominance information in frame to decide which
  4924. of each pair of fields to place first in the output.
  4925. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  4926. @section setdar, setsar
  4927. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  4928. output video.
  4929. This is done by changing the specified Sample (aka Pixel) Aspect
  4930. Ratio, according to the following equation:
  4931. @example
  4932. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  4933. @end example
  4934. Keep in mind that the @code{setdar} filter does not modify the pixel
  4935. dimensions of the video frame. Also the display aspect ratio set by
  4936. this filter may be changed by later filters in the filterchain,
  4937. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  4938. applied.
  4939. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  4940. the filter output video.
  4941. Note that as a consequence of the application of this filter, the
  4942. output display aspect ratio will change according to the equation
  4943. above.
  4944. Keep in mind that the sample aspect ratio set by the @code{setsar}
  4945. filter may be changed by later filters in the filterchain, e.g. if
  4946. another "setsar" or a "setdar" filter is applied.
  4947. The filters accept the following options:
  4948. @table @option
  4949. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  4950. Set the aspect ratio used by the filter.
  4951. The parameter can be a floating point number string, an expression, or
  4952. a string of the form @var{num}:@var{den}, where @var{num} and
  4953. @var{den} are the numerator and denominator of the aspect ratio. If
  4954. the parameter is not specified, it is assumed the value "0".
  4955. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  4956. should be escaped.
  4957. @item max
  4958. Set the maximum integer value to use for expressing numerator and
  4959. denominator when reducing the expressed aspect ratio to a rational.
  4960. Default value is @code{100}.
  4961. @end table
  4962. @subsection Examples
  4963. @itemize
  4964. @item
  4965. To change the display aspect ratio to 16:9, specify one of the following:
  4966. @example
  4967. setdar=dar=1.77777
  4968. setdar=dar=16/9
  4969. setdar=dar=1.77777
  4970. @end example
  4971. @item
  4972. To change the sample aspect ratio to 10:11, specify:
  4973. @example
  4974. setsar=sar=10/11
  4975. @end example
  4976. @item
  4977. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  4978. 1000 in the aspect ratio reduction, use the command:
  4979. @example
  4980. setdar=ratio=16/9:max=1000
  4981. @end example
  4982. @end itemize
  4983. @anchor{setfield}
  4984. @section setfield
  4985. Force field for the output video frame.
  4986. The @code{setfield} filter marks the interlace type field for the
  4987. output frames. It does not change the input frame, but only sets the
  4988. corresponding property, which affects how the frame is treated by
  4989. following filters (e.g. @code{fieldorder} or @code{yadif}).
  4990. The filter accepts the following options:
  4991. @table @option
  4992. @item mode
  4993. Available values are:
  4994. @table @samp
  4995. @item auto
  4996. Keep the same field property.
  4997. @item bff
  4998. Mark the frame as bottom-field-first.
  4999. @item tff
  5000. Mark the frame as top-field-first.
  5001. @item prog
  5002. Mark the frame as progressive.
  5003. @end table
  5004. @end table
  5005. @section showinfo
  5006. Show a line containing various information for each input video frame.
  5007. The input video is not modified.
  5008. The shown line contains a sequence of key/value pairs of the form
  5009. @var{key}:@var{value}.
  5010. A description of each shown parameter follows:
  5011. @table @option
  5012. @item n
  5013. sequential number of the input frame, starting from 0
  5014. @item pts
  5015. Presentation TimeStamp of the input frame, expressed as a number of
  5016. time base units. The time base unit depends on the filter input pad.
  5017. @item pts_time
  5018. Presentation TimeStamp of the input frame, expressed as a number of
  5019. seconds
  5020. @item pos
  5021. position of the frame in the input stream, -1 if this information in
  5022. unavailable and/or meaningless (for example in case of synthetic video)
  5023. @item fmt
  5024. pixel format name
  5025. @item sar
  5026. sample aspect ratio of the input frame, expressed in the form
  5027. @var{num}/@var{den}
  5028. @item s
  5029. size of the input frame, expressed in the form
  5030. @var{width}x@var{height}
  5031. @item i
  5032. interlaced mode ("P" for "progressive", "T" for top field first, "B"
  5033. for bottom field first)
  5034. @item iskey
  5035. 1 if the frame is a key frame, 0 otherwise
  5036. @item type
  5037. picture type of the input frame ("I" for an I-frame, "P" for a
  5038. P-frame, "B" for a B-frame, "?" for unknown type).
  5039. Check also the documentation of the @code{AVPictureType} enum and of
  5040. the @code{av_get_picture_type_char} function defined in
  5041. @file{libavutil/avutil.h}.
  5042. @item checksum
  5043. Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
  5044. @item plane_checksum
  5045. Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  5046. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]"
  5047. @end table
  5048. @anchor{smartblur}
  5049. @section smartblur
  5050. Blur the input video without impacting the outlines.
  5051. The filter accepts the following options:
  5052. @table @option
  5053. @item luma_radius, lr
  5054. Set the luma radius. The option value must be a float number in
  5055. the range [0.1,5.0] that specifies the variance of the gaussian filter
  5056. used to blur the image (slower if larger). Default value is 1.0.
  5057. @item luma_strength, ls
  5058. Set the luma strength. The option value must be a float number
  5059. in the range [-1.0,1.0] that configures the blurring. A value included
  5060. in [0.0,1.0] will blur the image whereas a value included in
  5061. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  5062. @item luma_threshold, lt
  5063. Set the luma threshold used as a coefficient to determine
  5064. whether a pixel should be blurred or not. The option value must be an
  5065. integer in the range [-30,30]. A value of 0 will filter all the image,
  5066. a value included in [0,30] will filter flat areas and a value included
  5067. in [-30,0] will filter edges. Default value is 0.
  5068. @item chroma_radius, cr
  5069. Set the chroma radius. The option value must be a float number in
  5070. the range [0.1,5.0] that specifies the variance of the gaussian filter
  5071. used to blur the image (slower if larger). Default value is 1.0.
  5072. @item chroma_strength, cs
  5073. Set the chroma strength. The option value must be a float number
  5074. in the range [-1.0,1.0] that configures the blurring. A value included
  5075. in [0.0,1.0] will blur the image whereas a value included in
  5076. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  5077. @item chroma_threshold, ct
  5078. Set the chroma threshold used as a coefficient to determine
  5079. whether a pixel should be blurred or not. The option value must be an
  5080. integer in the range [-30,30]. A value of 0 will filter all the image,
  5081. a value included in [0,30] will filter flat areas and a value included
  5082. in [-30,0] will filter edges. Default value is 0.
  5083. @end table
  5084. If a chroma option is not explicitly set, the corresponding luma value
  5085. is set.
  5086. @section stereo3d
  5087. Convert between different stereoscopic image formats.
  5088. The filters accept the following options:
  5089. @table @option
  5090. @item in
  5091. Set stereoscopic image format of input.
  5092. Available values for input image formats are:
  5093. @table @samp
  5094. @item sbsl
  5095. side by side parallel (left eye left, right eye right)
  5096. @item sbsr
  5097. side by side crosseye (right eye left, left eye right)
  5098. @item sbs2l
  5099. side by side parallel with half width resolution
  5100. (left eye left, right eye right)
  5101. @item sbs2r
  5102. side by side crosseye with half width resolution
  5103. (right eye left, left eye right)
  5104. @item abl
  5105. above-below (left eye above, right eye below)
  5106. @item abr
  5107. above-below (right eye above, left eye below)
  5108. @item ab2l
  5109. above-below with half height resolution
  5110. (left eye above, right eye below)
  5111. @item ab2r
  5112. above-below with half height resolution
  5113. (right eye above, left eye below)
  5114. @item al
  5115. alternating frames (left eye first, right eye second)
  5116. @item ar
  5117. alternating frames (right eye first, left eye second)
  5118. Default value is @samp{sbsl}.
  5119. @end table
  5120. @item out
  5121. Set stereoscopic image format of output.
  5122. Available values for output image formats are all the input formats as well as:
  5123. @table @samp
  5124. @item arbg
  5125. anaglyph red/blue gray
  5126. (red filter on left eye, blue filter on right eye)
  5127. @item argg
  5128. anaglyph red/green gray
  5129. (red filter on left eye, green filter on right eye)
  5130. @item arcg
  5131. anaglyph red/cyan gray
  5132. (red filter on left eye, cyan filter on right eye)
  5133. @item arch
  5134. anaglyph red/cyan half colored
  5135. (red filter on left eye, cyan filter on right eye)
  5136. @item arcc
  5137. anaglyph red/cyan color
  5138. (red filter on left eye, cyan filter on right eye)
  5139. @item arcd
  5140. anaglyph red/cyan color optimized with the least squares projection of dubois
  5141. (red filter on left eye, cyan filter on right eye)
  5142. @item agmg
  5143. anaglyph green/magenta gray
  5144. (green filter on left eye, magenta filter on right eye)
  5145. @item agmh
  5146. anaglyph green/magenta half colored
  5147. (green filter on left eye, magenta filter on right eye)
  5148. @item agmc
  5149. anaglyph green/magenta colored
  5150. (green filter on left eye, magenta filter on right eye)
  5151. @item agmd
  5152. anaglyph green/magenta color optimized with the least squares projection of dubois
  5153. (green filter on left eye, magenta filter on right eye)
  5154. @item aybg
  5155. anaglyph yellow/blue gray
  5156. (yellow filter on left eye, blue filter on right eye)
  5157. @item aybh
  5158. anaglyph yellow/blue half colored
  5159. (yellow filter on left eye, blue filter on right eye)
  5160. @item aybc
  5161. anaglyph yellow/blue colored
  5162. (yellow filter on left eye, blue filter on right eye)
  5163. @item aybd
  5164. anaglyph yellow/blue color optimized with the least squares projection of dubois
  5165. (yellow filter on left eye, blue filter on right eye)
  5166. @item irl
  5167. interleaved rows (left eye has top row, right eye starts on next row)
  5168. @item irr
  5169. interleaved rows (right eye has top row, left eye starts on next row)
  5170. @item ml
  5171. mono output (left eye only)
  5172. @item mr
  5173. mono output (right eye only)
  5174. @end table
  5175. Default value is @samp{arcd}.
  5176. @end table
  5177. @subsection Examples
  5178. @itemize
  5179. @item
  5180. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  5181. @example
  5182. stereo3d=sbsl:aybd
  5183. @end example
  5184. @item
  5185. Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
  5186. @example
  5187. stereo3d=abl:sbsr
  5188. @end example
  5189. @end itemize
  5190. @section spp
  5191. Apply a simple postprocessing filter that compresses and decompresses the image
  5192. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  5193. and average the results.
  5194. The filter accepts the following options:
  5195. @table @option
  5196. @item quality
  5197. Set quality. This option defines the number of levels for averaging. It accepts
  5198. an integer in the range 0-6. If set to @code{0}, the filter will have no
  5199. effect. A value of @code{6} means the higher quality. For each increment of
  5200. that value the speed drops by a factor of approximately 2. Default value is
  5201. @code{3}.
  5202. @item qp
  5203. Force a constant quantization parameter. If not set, the filter will use the QP
  5204. from the video stream (if available).
  5205. @item mode
  5206. Set thresholding mode. Available modes are:
  5207. @table @samp
  5208. @item hard
  5209. Set hard thresholding (default).
  5210. @item soft
  5211. Set soft thresholding (better de-ringing effect, but likely blurrier).
  5212. @end table
  5213. @item use_bframe_qp
  5214. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5215. option may cause flicker since the B-Frames have often larger QP. Default is
  5216. @code{0} (not enabled).
  5217. @end table
  5218. @anchor{subtitles}
  5219. @section subtitles
  5220. Draw subtitles on top of input video using the libass library.
  5221. To enable compilation of this filter you need to configure FFmpeg with
  5222. @code{--enable-libass}. This filter also requires a build with libavcodec and
  5223. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  5224. Alpha) subtitles format.
  5225. The filter accepts the following options:
  5226. @table @option
  5227. @item filename, f
  5228. Set the filename of the subtitle file to read. It must be specified.
  5229. @item original_size
  5230. Specify the size of the original video, the video for which the ASS file
  5231. was composed. Due to a misdesign in ASS aspect ratio arithmetic, this is
  5232. necessary to correctly scale the fonts if the aspect ratio has been changed.
  5233. @item charenc
  5234. Set subtitles input character encoding. @code{subtitles} filter only. Only
  5235. useful if not UTF-8.
  5236. @end table
  5237. If the first key is not specified, it is assumed that the first value
  5238. specifies the @option{filename}.
  5239. For example, to render the file @file{sub.srt} on top of the input
  5240. video, use the command:
  5241. @example
  5242. subtitles=sub.srt
  5243. @end example
  5244. which is equivalent to:
  5245. @example
  5246. subtitles=filename=sub.srt
  5247. @end example
  5248. @section super2xsai
  5249. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  5250. Interpolate) pixel art scaling algorithm.
  5251. Useful for enlarging pixel art images without reducing sharpness.
  5252. @section swapuv
  5253. Swap U & V plane.
  5254. @section telecine
  5255. Apply telecine process to the video.
  5256. This filter accepts the following options:
  5257. @table @option
  5258. @item first_field
  5259. @table @samp
  5260. @item top, t
  5261. top field first
  5262. @item bottom, b
  5263. bottom field first
  5264. The default value is @code{top}.
  5265. @end table
  5266. @item pattern
  5267. A string of numbers representing the pulldown pattern you wish to apply.
  5268. The default value is @code{23}.
  5269. @end table
  5270. @example
  5271. Some typical patterns:
  5272. NTSC output (30i):
  5273. 27.5p: 32222
  5274. 24p: 23 (classic)
  5275. 24p: 2332 (preferred)
  5276. 20p: 33
  5277. 18p: 334
  5278. 16p: 3444
  5279. PAL output (25i):
  5280. 27.5p: 12222
  5281. 24p: 222222222223 ("Euro pulldown")
  5282. 16.67p: 33
  5283. 16p: 33333334
  5284. @end example
  5285. @section thumbnail
  5286. Select the most representative frame in a given sequence of consecutive frames.
  5287. The filter accepts the following options:
  5288. @table @option
  5289. @item n
  5290. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  5291. will pick one of them, and then handle the next batch of @var{n} frames until
  5292. the end. Default is @code{100}.
  5293. @end table
  5294. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  5295. value will result in a higher memory usage, so a high value is not recommended.
  5296. @subsection Examples
  5297. @itemize
  5298. @item
  5299. Extract one picture each 50 frames:
  5300. @example
  5301. thumbnail=50
  5302. @end example
  5303. @item
  5304. Complete example of a thumbnail creation with @command{ffmpeg}:
  5305. @example
  5306. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  5307. @end example
  5308. @end itemize
  5309. @section tile
  5310. Tile several successive frames together.
  5311. The filter accepts the following options:
  5312. @table @option
  5313. @item layout
  5314. Set the grid size (i.e. the number of lines and columns) in the form
  5315. "@var{w}x@var{h}".
  5316. @item nb_frames
  5317. Set the maximum number of frames to render in the given area. It must be less
  5318. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  5319. the area will be used.
  5320. @item margin
  5321. Set the outer border margin in pixels.
  5322. @item padding
  5323. Set the inner border thickness (i.e. the number of pixels between frames). For
  5324. more advanced padding options (such as having different values for the edges),
  5325. refer to the pad video filter.
  5326. @end table
  5327. @subsection Examples
  5328. @itemize
  5329. @item
  5330. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  5331. @example
  5332. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  5333. @end example
  5334. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  5335. duplicating each output frame to accomodate the originally detected frame
  5336. rate.
  5337. @item
  5338. Display @code{5} pictures in an area of @code{3x2} frames,
  5339. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  5340. mixed flat and named options:
  5341. @example
  5342. tile=3x2:nb_frames=5:padding=7:margin=2
  5343. @end example
  5344. @end itemize
  5345. @section tinterlace
  5346. Perform various types of temporal field interlacing.
  5347. Frames are counted starting from 1, so the first input frame is
  5348. considered odd.
  5349. The filter accepts the following options:
  5350. @table @option
  5351. @item mode
  5352. Specify the mode of the interlacing. This option can also be specified
  5353. as a value alone. See below for a list of values for this option.
  5354. Available values are:
  5355. @table @samp
  5356. @item merge, 0
  5357. Move odd frames into the upper field, even into the lower field,
  5358. generating a double height frame at half frame rate.
  5359. @item drop_odd, 1
  5360. Only output even frames, odd frames are dropped, generating a frame with
  5361. unchanged height at half frame rate.
  5362. @item drop_even, 2
  5363. Only output odd frames, even frames are dropped, generating a frame with
  5364. unchanged height at half frame rate.
  5365. @item pad, 3
  5366. Expand each frame to full height, but pad alternate lines with black,
  5367. generating a frame with double height at the same input frame rate.
  5368. @item interleave_top, 4
  5369. Interleave the upper field from odd frames with the lower field from
  5370. even frames, generating a frame with unchanged height at half frame rate.
  5371. @item interleave_bottom, 5
  5372. Interleave the lower field from odd frames with the upper field from
  5373. even frames, generating a frame with unchanged height at half frame rate.
  5374. @item interlacex2, 6
  5375. Double frame rate with unchanged height. Frames are inserted each
  5376. containing the second temporal field from the previous input frame and
  5377. the first temporal field from the next input frame. This mode relies on
  5378. the top_field_first flag. Useful for interlaced video displays with no
  5379. field synchronisation.
  5380. @end table
  5381. Numeric values are deprecated but are accepted for backward
  5382. compatibility reasons.
  5383. Default mode is @code{merge}.
  5384. @item flags
  5385. Specify flags influencing the filter process.
  5386. Available value for @var{flags} is:
  5387. @table @option
  5388. @item low_pass_filter, vlfp
  5389. Enable vertical low-pass filtering in the filter.
  5390. Vertical low-pass filtering is required when creating an interlaced
  5391. destination from a progressive source which contains high-frequency
  5392. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  5393. patterning.
  5394. Vertical low-pass filtering can only be enabled for @option{mode}
  5395. @var{interleave_top} and @var{interleave_bottom}.
  5396. @end table
  5397. @end table
  5398. @section transpose
  5399. Transpose rows with columns in the input video and optionally flip it.
  5400. This filter accepts the following options:
  5401. @table @option
  5402. @item dir
  5403. Specify the transposition direction.
  5404. Can assume the following values:
  5405. @table @samp
  5406. @item 0, 4, cclock_flip
  5407. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  5408. @example
  5409. L.R L.l
  5410. . . -> . .
  5411. l.r R.r
  5412. @end example
  5413. @item 1, 5, clock
  5414. Rotate by 90 degrees clockwise, that is:
  5415. @example
  5416. L.R l.L
  5417. . . -> . .
  5418. l.r r.R
  5419. @end example
  5420. @item 2, 6, cclock
  5421. Rotate by 90 degrees counterclockwise, that is:
  5422. @example
  5423. L.R R.r
  5424. . . -> . .
  5425. l.r L.l
  5426. @end example
  5427. @item 3, 7, clock_flip
  5428. Rotate by 90 degrees clockwise and vertically flip, that is:
  5429. @example
  5430. L.R r.R
  5431. . . -> . .
  5432. l.r l.L
  5433. @end example
  5434. @end table
  5435. For values between 4-7, the transposition is only done if the input
  5436. video geometry is portrait and not landscape. These values are
  5437. deprecated, the @code{passthrough} option should be used instead.
  5438. Numerical values are deprecated, and should be dropped in favor of
  5439. symbolic constants.
  5440. @item passthrough
  5441. Do not apply the transposition if the input geometry matches the one
  5442. specified by the specified value. It accepts the following values:
  5443. @table @samp
  5444. @item none
  5445. Always apply transposition.
  5446. @item portrait
  5447. Preserve portrait geometry (when @var{height} >= @var{width}).
  5448. @item landscape
  5449. Preserve landscape geometry (when @var{width} >= @var{height}).
  5450. @end table
  5451. Default value is @code{none}.
  5452. @end table
  5453. For example to rotate by 90 degrees clockwise and preserve portrait
  5454. layout:
  5455. @example
  5456. transpose=dir=1:passthrough=portrait
  5457. @end example
  5458. The command above can also be specified as:
  5459. @example
  5460. transpose=1:portrait
  5461. @end example
  5462. @section trim
  5463. Trim the input so that the output contains one continuous subpart of the input.
  5464. This filter accepts the following options:
  5465. @table @option
  5466. @item start
  5467. Specify time of the start of the kept section, i.e. the frame with the
  5468. timestamp @var{start} will be the first frame in the output.
  5469. @item end
  5470. Specify time of the first frame that will be dropped, i.e. the frame
  5471. immediately preceding the one with the timestamp @var{end} will be the last
  5472. frame in the output.
  5473. @item start_pts
  5474. Same as @var{start}, except this option sets the start timestamp in timebase
  5475. units instead of seconds.
  5476. @item end_pts
  5477. Same as @var{end}, except this option sets the end timestamp in timebase units
  5478. instead of seconds.
  5479. @item duration
  5480. Specify maximum duration of the output.
  5481. @item start_frame
  5482. Number of the first frame that should be passed to output.
  5483. @item end_frame
  5484. Number of the first frame that should be dropped.
  5485. @end table
  5486. @option{start}, @option{end}, @option{duration} are expressed as time
  5487. duration specifications, check the "Time duration" section in the
  5488. ffmpeg-utils manual.
  5489. Note that the first two sets of the start/end options and the @option{duration}
  5490. option look at the frame timestamp, while the _frame variants simply count the
  5491. frames that pass through the filter. Also note that this filter does not modify
  5492. the timestamps. If you wish that the output timestamps start at zero, insert a
  5493. setpts filter after the trim filter.
  5494. If multiple start or end options are set, this filter tries to be greedy and
  5495. keep all the frames that match at least one of the specified constraints. To keep
  5496. only the part that matches all the constraints at once, chain multiple trim
  5497. filters.
  5498. The defaults are such that all the input is kept. So it is possible to set e.g.
  5499. just the end values to keep everything before the specified time.
  5500. Examples:
  5501. @itemize
  5502. @item
  5503. drop everything except the second minute of input
  5504. @example
  5505. ffmpeg -i INPUT -vf trim=60:120
  5506. @end example
  5507. @item
  5508. keep only the first second
  5509. @example
  5510. ffmpeg -i INPUT -vf trim=duration=1
  5511. @end example
  5512. @end itemize
  5513. @section unsharp
  5514. Sharpen or blur the input video.
  5515. It accepts the following parameters:
  5516. @table @option
  5517. @item luma_msize_x, lx
  5518. Set the luma matrix horizontal size. It must be an odd integer between
  5519. 3 and 63, default value is 5.
  5520. @item luma_msize_y, ly
  5521. Set the luma matrix vertical size. It must be an odd integer between 3
  5522. and 63, default value is 5.
  5523. @item luma_amount, la
  5524. Set the luma effect strength. It can be a float number, reasonable
  5525. values lay between -1.5 and 1.5.
  5526. Negative values will blur the input video, while positive values will
  5527. sharpen it, a value of zero will disable the effect.
  5528. Default value is 1.0.
  5529. @item chroma_msize_x, cx
  5530. Set the chroma matrix horizontal size. It must be an odd integer
  5531. between 3 and 63, default value is 5.
  5532. @item chroma_msize_y, cy
  5533. Set the chroma matrix vertical size. It must be an odd integer
  5534. between 3 and 63, default value is 5.
  5535. @item chroma_amount, ca
  5536. Set the chroma effect strength. It can be a float number, reasonable
  5537. values lay between -1.5 and 1.5.
  5538. Negative values will blur the input video, while positive values will
  5539. sharpen it, a value of zero will disable the effect.
  5540. Default value is 0.0.
  5541. @item opencl
  5542. If set to 1, specify using OpenCL capabilities, only available if
  5543. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5544. @end table
  5545. All parameters are optional and default to the equivalent of the
  5546. string '5:5:1.0:5:5:0.0'.
  5547. @subsection Examples
  5548. @itemize
  5549. @item
  5550. Apply strong luma sharpen effect:
  5551. @example
  5552. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  5553. @end example
  5554. @item
  5555. Apply strong blur of both luma and chroma parameters:
  5556. @example
  5557. unsharp=7:7:-2:7:7:-2
  5558. @end example
  5559. @end itemize
  5560. @anchor{vidstabdetect}
  5561. @section vidstabdetect
  5562. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  5563. @ref{vidstabtransform} for pass 2.
  5564. This filter generates a file with relative translation and rotation
  5565. transform information about subsequent frames, which is then used by
  5566. the @ref{vidstabtransform} filter.
  5567. To enable compilation of this filter you need to configure FFmpeg with
  5568. @code{--enable-libvidstab}.
  5569. This filter accepts the following options:
  5570. @table @option
  5571. @item result
  5572. Set the path to the file used to write the transforms information.
  5573. Default value is @file{transforms.trf}.
  5574. @item shakiness
  5575. Set how shaky the video is and how quick the camera is. It accepts an
  5576. integer in the range 1-10, a value of 1 means little shakiness, a
  5577. value of 10 means strong shakiness. Default value is 5.
  5578. @item accuracy
  5579. Set the accuracy of the detection process. It must be a value in the
  5580. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  5581. accuracy. Default value is 9.
  5582. @item stepsize
  5583. Set stepsize of the search process. The region around minimum is
  5584. scanned with 1 pixel resolution. Default value is 6.
  5585. @item mincontrast
  5586. Set minimum contrast. Below this value a local measurement field is
  5587. discarded. Must be a floating point value in the range 0-1. Default
  5588. value is 0.3.
  5589. @item tripod
  5590. Set reference frame number for tripod mode.
  5591. If enabled, the motion of the frames is compared to a reference frame
  5592. in the filtered stream, identified by the specified number. The idea
  5593. is to compensate all movements in a more-or-less static scene and keep
  5594. the camera view absolutely still.
  5595. If set to 0, it is disabled. The frames are counted starting from 1.
  5596. @item show
  5597. Show fields and transforms in the resulting frames. It accepts an
  5598. integer in the range 0-2. Default value is 0, which disables any
  5599. visualization.
  5600. @end table
  5601. @subsection Examples
  5602. @itemize
  5603. @item
  5604. Use default values:
  5605. @example
  5606. vidstabdetect
  5607. @end example
  5608. @item
  5609. Analyze strongly shaky movie and put the results in file
  5610. @file{mytransforms.trf}:
  5611. @example
  5612. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  5613. @end example
  5614. @item
  5615. Visualize the result of internal transformations in the resulting
  5616. video:
  5617. @example
  5618. vidstabdetect=show=1
  5619. @end example
  5620. @item
  5621. Analyze a video with medium shakiness using @command{ffmpeg}:
  5622. @example
  5623. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  5624. @end example
  5625. @end itemize
  5626. @anchor{vidstabtransform}
  5627. @section vidstabtransform
  5628. Video stabilization/deshaking: pass 2 of 2,
  5629. see @ref{vidstabdetect} for pass 1.
  5630. Read a file with transform information for each frame and
  5631. apply/compensate them. Together with the @ref{vidstabdetect}
  5632. filter this can be used to deshake videos. See also
  5633. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  5634. the unsharp filter, see below.
  5635. To enable compilation of this filter you need to configure FFmpeg with
  5636. @code{--enable-libvidstab}.
  5637. This filter accepts the following options:
  5638. @table @option
  5639. @item input
  5640. path to the file used to read the transforms (default: @file{transforms.trf})
  5641. @item smoothing
  5642. number of frames (value*2 + 1) used for lowpass filtering the camera movements
  5643. (default: 10). For example a number of 10 means that 21 frames are used
  5644. (10 in the past and 10 in the future) to smoothen the motion in the
  5645. video. A larger values leads to a smoother video, but limits the
  5646. acceleration of the camera (pan/tilt movements).
  5647. @item maxshift
  5648. maximal number of pixels to translate frames (default: -1 no limit)
  5649. @item maxangle
  5650. maximal angle in radians (degree*PI/180) to rotate frames (default: -1
  5651. no limit)
  5652. @item crop
  5653. How to deal with borders that may be visible due to movement
  5654. compensation. Available values are:
  5655. @table @samp
  5656. @item keep
  5657. keep image information from previous frame (default)
  5658. @item black
  5659. fill the border black
  5660. @end table
  5661. @item invert
  5662. @table @samp
  5663. @item 0
  5664. keep transforms normal (default)
  5665. @item 1
  5666. invert transforms
  5667. @end table
  5668. @item relative
  5669. consider transforms as
  5670. @table @samp
  5671. @item 0
  5672. absolute
  5673. @item 1
  5674. relative to previous frame (default)
  5675. @end table
  5676. @item zoom
  5677. percentage to zoom (default: 0)
  5678. @table @samp
  5679. @item >0
  5680. zoom in
  5681. @item <0
  5682. zoom out
  5683. @end table
  5684. @item optzoom
  5685. if 1 then optimal zoom value is determined (default).
  5686. Optimal zoom means no (or only little) border should be visible.
  5687. Note that the value given at zoom is added to the one calculated
  5688. here.
  5689. @item interpol
  5690. type of interpolation
  5691. Available values are:
  5692. @table @samp
  5693. @item no
  5694. no interpolation
  5695. @item linear
  5696. linear only horizontal
  5697. @item bilinear
  5698. linear in both directions (default)
  5699. @item bicubic
  5700. cubic in both directions (slow)
  5701. @end table
  5702. @item tripod
  5703. virtual tripod mode means that the video is stabilized such that the
  5704. camera stays stationary. Use also @code{tripod} option of
  5705. @ref{vidstabdetect}.
  5706. @table @samp
  5707. @item 0
  5708. off (default)
  5709. @item 1
  5710. virtual tripod mode: equivalent to @code{relative=0:smoothing=0}
  5711. @end table
  5712. @end table
  5713. @subsection Examples
  5714. @itemize
  5715. @item
  5716. typical call with default default values:
  5717. (note the unsharp filter which is always recommended)
  5718. @example
  5719. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  5720. @end example
  5721. @item
  5722. zoom in a bit more and load transform data from a given file
  5723. @example
  5724. vidstabtransform=zoom=5:input="mytransforms.trf"
  5725. @end example
  5726. @item
  5727. smoothen the video even more
  5728. @example
  5729. vidstabtransform=smoothing=30
  5730. @end example
  5731. @end itemize
  5732. @section vflip
  5733. Flip the input video vertically.
  5734. For example, to vertically flip a video with @command{ffmpeg}:
  5735. @example
  5736. ffmpeg -i in.avi -vf "vflip" out.avi
  5737. @end example
  5738. @section vignette
  5739. Make or reverse a natural vignetting effect.
  5740. The filter accepts the following options:
  5741. @table @option
  5742. @item angle, a
  5743. Set lens angle expression as a number of radians.
  5744. The value is clipped in the @code{[0,PI/2]} range.
  5745. Default value: @code{"PI/5"}
  5746. @item x0
  5747. @item y0
  5748. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  5749. by default.
  5750. @item mode
  5751. Set forward/backward mode.
  5752. Available modes are:
  5753. @table @samp
  5754. @item forward
  5755. The larger the distance from the central point, the darker the image becomes.
  5756. @item backward
  5757. The larger the distance from the central point, the brighter the image becomes.
  5758. This can be used to reverse a vignette effect, though there is no automatic
  5759. detection to extract the lens @option{angle} and other settings (yet). It can
  5760. also be used to create a burning effect.
  5761. @end table
  5762. Default value is @samp{forward}.
  5763. @item eval
  5764. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  5765. It accepts the following values:
  5766. @table @samp
  5767. @item init
  5768. Evaluate expressions only once during the filter initialization.
  5769. @item frame
  5770. Evaluate expressions for each incoming frame. This is way slower than the
  5771. @samp{init} mode since it requires all the scalers to be re-computed, but it
  5772. allows advanced dynamic expressions.
  5773. @end table
  5774. Default value is @samp{init}.
  5775. @item dither
  5776. Set dithering to reduce the circular banding effects. Default is @code{1}
  5777. (enabled).
  5778. @item aspect
  5779. Set vignette aspect. This setting allows to adjust the shape of the vignette.
  5780. Setting this value to the SAR of the input will make a rectangular vignetting
  5781. following the dimensions of the video.
  5782. Default is @code{1/1}.
  5783. @end table
  5784. @subsection Expressions
  5785. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  5786. following parameters.
  5787. @table @option
  5788. @item w
  5789. @item h
  5790. input width and height
  5791. @item n
  5792. the number of input frame, starting from 0
  5793. @item pts
  5794. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  5795. @var{TB} units, NAN if undefined
  5796. @item r
  5797. frame rate of the input video, NAN if the input frame rate is unknown
  5798. @item t
  5799. the PTS (Presentation TimeStamp) of the filtered video frame,
  5800. expressed in seconds, NAN if undefined
  5801. @item tb
  5802. time base of the input video
  5803. @end table
  5804. @subsection Examples
  5805. @itemize
  5806. @item
  5807. Apply simple strong vignetting effect:
  5808. @example
  5809. vignette=PI/4
  5810. @end example
  5811. @item
  5812. Make a flickering vignetting:
  5813. @example
  5814. vignette='PI/4+random(1)*PI/50':eval=frame
  5815. @end example
  5816. @end itemize
  5817. @anchor{yadif}
  5818. @section yadif
  5819. Deinterlace the input video ("yadif" means "yet another deinterlacing
  5820. filter").
  5821. This filter accepts the following options:
  5822. @table @option
  5823. @item mode
  5824. The interlacing mode to adopt, accepts one of the following values:
  5825. @table @option
  5826. @item 0, send_frame
  5827. output 1 frame for each frame
  5828. @item 1, send_field
  5829. output 1 frame for each field
  5830. @item 2, send_frame_nospatial
  5831. like @code{send_frame} but skip spatial interlacing check
  5832. @item 3, send_field_nospatial
  5833. like @code{send_field} but skip spatial interlacing check
  5834. @end table
  5835. Default value is @code{send_frame}.
  5836. @item parity
  5837. The picture field parity assumed for the input interlaced video, accepts one of
  5838. the following values:
  5839. @table @option
  5840. @item 0, tff
  5841. assume top field first
  5842. @item 1, bff
  5843. assume bottom field first
  5844. @item -1, auto
  5845. enable automatic detection
  5846. @end table
  5847. Default value is @code{auto}.
  5848. If interlacing is unknown or decoder does not export this information,
  5849. top field first will be assumed.
  5850. @item deint
  5851. Specify which frames to deinterlace. Accept one of the following
  5852. values:
  5853. @table @option
  5854. @item 0, all
  5855. deinterlace all frames
  5856. @item 1, interlaced
  5857. only deinterlace frames marked as interlaced
  5858. @end table
  5859. Default value is @code{all}.
  5860. @end table
  5861. @c man end VIDEO FILTERS
  5862. @chapter Video Sources
  5863. @c man begin VIDEO SOURCES
  5864. Below is a description of the currently available video sources.
  5865. @section buffer
  5866. Buffer video frames, and make them available to the filter chain.
  5867. This source is mainly intended for a programmatic use, in particular
  5868. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  5869. This source accepts the following options:
  5870. @table @option
  5871. @item video_size
  5872. Specify the size (width and height) of the buffered video frames.
  5873. @item width
  5874. Input video width.
  5875. @item height
  5876. Input video height.
  5877. @item pix_fmt
  5878. A string representing the pixel format of the buffered video frames.
  5879. It may be a number corresponding to a pixel format, or a pixel format
  5880. name.
  5881. @item time_base
  5882. Specify the timebase assumed by the timestamps of the buffered frames.
  5883. @item frame_rate
  5884. Specify the frame rate expected for the video stream.
  5885. @item pixel_aspect, sar
  5886. Specify the sample aspect ratio assumed by the video frames.
  5887. @item sws_param
  5888. Specify the optional parameters to be used for the scale filter which
  5889. is automatically inserted when an input change is detected in the
  5890. input size or format.
  5891. @end table
  5892. For example:
  5893. @example
  5894. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  5895. @end example
  5896. will instruct the source to accept video frames with size 320x240 and
  5897. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  5898. square pixels (1:1 sample aspect ratio).
  5899. Since the pixel format with name "yuv410p" corresponds to the number 6
  5900. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  5901. this example corresponds to:
  5902. @example
  5903. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  5904. @end example
  5905. Alternatively, the options can be specified as a flat string, but this
  5906. syntax is deprecated:
  5907. @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}]
  5908. @section cellauto
  5909. Create a pattern generated by an elementary cellular automaton.
  5910. The initial state of the cellular automaton can be defined through the
  5911. @option{filename}, and @option{pattern} options. If such options are
  5912. not specified an initial state is created randomly.
  5913. At each new frame a new row in the video is filled with the result of
  5914. the cellular automaton next generation. The behavior when the whole
  5915. frame is filled is defined by the @option{scroll} option.
  5916. This source accepts the following options:
  5917. @table @option
  5918. @item filename, f
  5919. Read the initial cellular automaton state, i.e. the starting row, from
  5920. the specified file.
  5921. In the file, each non-whitespace character is considered an alive
  5922. cell, a newline will terminate the row, and further characters in the
  5923. file will be ignored.
  5924. @item pattern, p
  5925. Read the initial cellular automaton state, i.e. the starting row, from
  5926. the specified string.
  5927. Each non-whitespace character in the string is considered an alive
  5928. cell, a newline will terminate the row, and further characters in the
  5929. string will be ignored.
  5930. @item rate, r
  5931. Set the video rate, that is the number of frames generated per second.
  5932. Default is 25.
  5933. @item random_fill_ratio, ratio
  5934. Set the random fill ratio for the initial cellular automaton row. It
  5935. is a floating point number value ranging from 0 to 1, defaults to
  5936. 1/PHI.
  5937. This option is ignored when a file or a pattern is specified.
  5938. @item random_seed, seed
  5939. Set the seed for filling randomly the initial row, must be an integer
  5940. included between 0 and UINT32_MAX. If not specified, or if explicitly
  5941. set to -1, the filter will try to use a good random seed on a best
  5942. effort basis.
  5943. @item rule
  5944. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  5945. Default value is 110.
  5946. @item size, s
  5947. Set the size of the output video.
  5948. If @option{filename} or @option{pattern} is specified, the size is set
  5949. by default to the width of the specified initial state row, and the
  5950. height is set to @var{width} * PHI.
  5951. If @option{size} is set, it must contain the width of the specified
  5952. pattern string, and the specified pattern will be centered in the
  5953. larger row.
  5954. If a filename or a pattern string is not specified, the size value
  5955. defaults to "320x518" (used for a randomly generated initial state).
  5956. @item scroll
  5957. If set to 1, scroll the output upward when all the rows in the output
  5958. have been already filled. If set to 0, the new generated row will be
  5959. written over the top row just after the bottom row is filled.
  5960. Defaults to 1.
  5961. @item start_full, full
  5962. If set to 1, completely fill the output with generated rows before
  5963. outputting the first frame.
  5964. This is the default behavior, for disabling set the value to 0.
  5965. @item stitch
  5966. If set to 1, stitch the left and right row edges together.
  5967. This is the default behavior, for disabling set the value to 0.
  5968. @end table
  5969. @subsection Examples
  5970. @itemize
  5971. @item
  5972. Read the initial state from @file{pattern}, and specify an output of
  5973. size 200x400.
  5974. @example
  5975. cellauto=f=pattern:s=200x400
  5976. @end example
  5977. @item
  5978. Generate a random initial row with a width of 200 cells, with a fill
  5979. ratio of 2/3:
  5980. @example
  5981. cellauto=ratio=2/3:s=200x200
  5982. @end example
  5983. @item
  5984. Create a pattern generated by rule 18 starting by a single alive cell
  5985. centered on an initial row with width 100:
  5986. @example
  5987. cellauto=p=@@:s=100x400:full=0:rule=18
  5988. @end example
  5989. @item
  5990. Specify a more elaborated initial pattern:
  5991. @example
  5992. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  5993. @end example
  5994. @end itemize
  5995. @section mandelbrot
  5996. Generate a Mandelbrot set fractal, and progressively zoom towards the
  5997. point specified with @var{start_x} and @var{start_y}.
  5998. This source accepts the following options:
  5999. @table @option
  6000. @item end_pts
  6001. Set the terminal pts value. Default value is 400.
  6002. @item end_scale
  6003. Set the terminal scale value.
  6004. Must be a floating point value. Default value is 0.3.
  6005. @item inner
  6006. Set the inner coloring mode, that is the algorithm used to draw the
  6007. Mandelbrot fractal internal region.
  6008. It shall assume one of the following values:
  6009. @table @option
  6010. @item black
  6011. Set black mode.
  6012. @item convergence
  6013. Show time until convergence.
  6014. @item mincol
  6015. Set color based on point closest to the origin of the iterations.
  6016. @item period
  6017. Set period mode.
  6018. @end table
  6019. Default value is @var{mincol}.
  6020. @item bailout
  6021. Set the bailout value. Default value is 10.0.
  6022. @item maxiter
  6023. Set the maximum of iterations performed by the rendering
  6024. algorithm. Default value is 7189.
  6025. @item outer
  6026. Set outer coloring mode.
  6027. It shall assume one of following values:
  6028. @table @option
  6029. @item iteration_count
  6030. Set iteration cound mode.
  6031. @item normalized_iteration_count
  6032. set normalized iteration count mode.
  6033. @end table
  6034. Default value is @var{normalized_iteration_count}.
  6035. @item rate, r
  6036. Set frame rate, expressed as number of frames per second. Default
  6037. value is "25".
  6038. @item size, s
  6039. Set frame size. Default value is "640x480".
  6040. @item start_scale
  6041. Set the initial scale value. Default value is 3.0.
  6042. @item start_x
  6043. Set the initial x position. Must be a floating point value between
  6044. -100 and 100. Default value is -0.743643887037158704752191506114774.
  6045. @item start_y
  6046. Set the initial y position. Must be a floating point value between
  6047. -100 and 100. Default value is -0.131825904205311970493132056385139.
  6048. @end table
  6049. @section mptestsrc
  6050. Generate various test patterns, as generated by the MPlayer test filter.
  6051. The size of the generated video is fixed, and is 256x256.
  6052. This source is useful in particular for testing encoding features.
  6053. This source accepts the following options:
  6054. @table @option
  6055. @item rate, r
  6056. Specify the frame rate of the sourced video, as the number of frames
  6057. generated per second. It has to be a string in the format
  6058. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  6059. number or a valid video frame rate abbreviation. The default value is
  6060. "25".
  6061. @item duration, d
  6062. Set the video duration of the sourced video. The accepted syntax is:
  6063. @example
  6064. [-]HH:MM:SS[.m...]
  6065. [-]S+[.m...]
  6066. @end example
  6067. See also the function @code{av_parse_time()}.
  6068. If not specified, or the expressed duration is negative, the video is
  6069. supposed to be generated forever.
  6070. @item test, t
  6071. Set the number or the name of the test to perform. Supported tests are:
  6072. @table @option
  6073. @item dc_luma
  6074. @item dc_chroma
  6075. @item freq_luma
  6076. @item freq_chroma
  6077. @item amp_luma
  6078. @item amp_chroma
  6079. @item cbp
  6080. @item mv
  6081. @item ring1
  6082. @item ring2
  6083. @item all
  6084. @end table
  6085. Default value is "all", which will cycle through the list of all tests.
  6086. @end table
  6087. For example the following:
  6088. @example
  6089. testsrc=t=dc_luma
  6090. @end example
  6091. will generate a "dc_luma" test pattern.
  6092. @section frei0r_src
  6093. Provide a frei0r source.
  6094. To enable compilation of this filter you need to install the frei0r
  6095. header and configure FFmpeg with @code{--enable-frei0r}.
  6096. This source accepts the following options:
  6097. @table @option
  6098. @item size
  6099. The size of the video to generate, may be a string of the form
  6100. @var{width}x@var{height} or a frame size abbreviation.
  6101. @item framerate
  6102. Framerate of the generated video, may be a string of the form
  6103. @var{num}/@var{den} or a frame rate abbreviation.
  6104. @item filter_name
  6105. The name to the frei0r source to load. For more information regarding frei0r and
  6106. how to set the parameters read the section @ref{frei0r} in the description of
  6107. the video filters.
  6108. @item filter_params
  6109. A '|'-separated list of parameters to pass to the frei0r source.
  6110. @end table
  6111. For example, to generate a frei0r partik0l source with size 200x200
  6112. and frame rate 10 which is overlayed on the overlay filter main input:
  6113. @example
  6114. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  6115. @end example
  6116. @section life
  6117. Generate a life pattern.
  6118. This source is based on a generalization of John Conway's life game.
  6119. The sourced input represents a life grid, each pixel represents a cell
  6120. which can be in one of two possible states, alive or dead. Every cell
  6121. interacts with its eight neighbours, which are the cells that are
  6122. horizontally, vertically, or diagonally adjacent.
  6123. At each interaction the grid evolves according to the adopted rule,
  6124. which specifies the number of neighbor alive cells which will make a
  6125. cell stay alive or born. The @option{rule} option allows to specify
  6126. the rule to adopt.
  6127. This source accepts the following options:
  6128. @table @option
  6129. @item filename, f
  6130. Set the file from which to read the initial grid state. In the file,
  6131. each non-whitespace character is considered an alive cell, and newline
  6132. is used to delimit the end of each row.
  6133. If this option is not specified, the initial grid is generated
  6134. randomly.
  6135. @item rate, r
  6136. Set the video rate, that is the number of frames generated per second.
  6137. Default is 25.
  6138. @item random_fill_ratio, ratio
  6139. Set the random fill ratio for the initial random grid. It is a
  6140. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  6141. It is ignored when a file is specified.
  6142. @item random_seed, seed
  6143. Set the seed for filling the initial random grid, must be an integer
  6144. included between 0 and UINT32_MAX. If not specified, or if explicitly
  6145. set to -1, the filter will try to use a good random seed on a best
  6146. effort basis.
  6147. @item rule
  6148. Set the life rule.
  6149. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  6150. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  6151. @var{NS} specifies the number of alive neighbor cells which make a
  6152. live cell stay alive, and @var{NB} the number of alive neighbor cells
  6153. which make a dead cell to become alive (i.e. to "born").
  6154. "s" and "b" can be used in place of "S" and "B", respectively.
  6155. Alternatively a rule can be specified by an 18-bits integer. The 9
  6156. high order bits are used to encode the next cell state if it is alive
  6157. for each number of neighbor alive cells, the low order bits specify
  6158. the rule for "borning" new cells. Higher order bits encode for an
  6159. higher number of neighbor cells.
  6160. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  6161. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  6162. Default value is "S23/B3", which is the original Conway's game of life
  6163. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  6164. cells, and will born a new cell if there are three alive cells around
  6165. a dead cell.
  6166. @item size, s
  6167. Set the size of the output video.
  6168. If @option{filename} is specified, the size is set by default to the
  6169. same size of the input file. If @option{size} is set, it must contain
  6170. the size specified in the input file, and the initial grid defined in
  6171. that file is centered in the larger resulting area.
  6172. If a filename is not specified, the size value defaults to "320x240"
  6173. (used for a randomly generated initial grid).
  6174. @item stitch
  6175. If set to 1, stitch the left and right grid edges together, and the
  6176. top and bottom edges also. Defaults to 1.
  6177. @item mold
  6178. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  6179. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  6180. value from 0 to 255.
  6181. @item life_color
  6182. Set the color of living (or new born) cells.
  6183. @item death_color
  6184. Set the color of dead cells. If @option{mold} is set, this is the first color
  6185. used to represent a dead cell.
  6186. @item mold_color
  6187. Set mold color, for definitely dead and moldy cells.
  6188. @end table
  6189. @subsection Examples
  6190. @itemize
  6191. @item
  6192. Read a grid from @file{pattern}, and center it on a grid of size
  6193. 300x300 pixels:
  6194. @example
  6195. life=f=pattern:s=300x300
  6196. @end example
  6197. @item
  6198. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  6199. @example
  6200. life=ratio=2/3:s=200x200
  6201. @end example
  6202. @item
  6203. Specify a custom rule for evolving a randomly generated grid:
  6204. @example
  6205. life=rule=S14/B34
  6206. @end example
  6207. @item
  6208. Full example with slow death effect (mold) using @command{ffplay}:
  6209. @example
  6210. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  6211. @end example
  6212. @end itemize
  6213. @anchor{color}
  6214. @anchor{haldclutsrc}
  6215. @anchor{nullsrc}
  6216. @anchor{rgbtestsrc}
  6217. @anchor{smptebars}
  6218. @anchor{smptehdbars}
  6219. @anchor{testsrc}
  6220. @section color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  6221. The @code{color} source provides an uniformly colored input.
  6222. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  6223. @ref{haldclut} filter.
  6224. The @code{nullsrc} source returns unprocessed video frames. It is
  6225. mainly useful to be employed in analysis / debugging tools, or as the
  6226. source for filters which ignore the input data.
  6227. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  6228. detecting RGB vs BGR issues. You should see a red, green and blue
  6229. stripe from top to bottom.
  6230. The @code{smptebars} source generates a color bars pattern, based on
  6231. the SMPTE Engineering Guideline EG 1-1990.
  6232. The @code{smptehdbars} source generates a color bars pattern, based on
  6233. the SMPTE RP 219-2002.
  6234. The @code{testsrc} source generates a test video pattern, showing a
  6235. color pattern, a scrolling gradient and a timestamp. This is mainly
  6236. intended for testing purposes.
  6237. The sources accept the following options:
  6238. @table @option
  6239. @item color, c
  6240. Specify the color of the source, only available in the @code{color}
  6241. source. It can be the name of a color (case insensitive match) or a
  6242. 0xRRGGBB[AA] sequence, possibly followed by an alpha specifier. The
  6243. default value is "black".
  6244. @item level
  6245. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  6246. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  6247. pixels to be used as identity matrix for 3D lookup tables. Each component is
  6248. coded on a @code{1/(N*N)} scale.
  6249. @item size, s
  6250. Specify the size of the sourced video, it may be a string of the form
  6251. @var{width}x@var{height}, or the name of a size abbreviation. The
  6252. default value is "320x240".
  6253. This option is not available with the @code{haldclutsrc} filter.
  6254. @item rate, r
  6255. Specify the frame rate of the sourced video, as the number of frames
  6256. generated per second. It has to be a string in the format
  6257. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  6258. number or a valid video frame rate abbreviation. The default value is
  6259. "25".
  6260. @item sar
  6261. Set the sample aspect ratio of the sourced video.
  6262. @item duration, d
  6263. Set the video duration of the sourced video. The accepted syntax is:
  6264. @example
  6265. [-]HH[:MM[:SS[.m...]]]
  6266. [-]S+[.m...]
  6267. @end example
  6268. See also the function @code{av_parse_time()}.
  6269. If not specified, or the expressed duration is negative, the video is
  6270. supposed to be generated forever.
  6271. @item decimals, n
  6272. Set the number of decimals to show in the timestamp, only available in the
  6273. @code{testsrc} source.
  6274. The displayed timestamp value will correspond to the original
  6275. timestamp value multiplied by the power of 10 of the specified
  6276. value. Default value is 0.
  6277. @end table
  6278. For example the following:
  6279. @example
  6280. testsrc=duration=5.3:size=qcif:rate=10
  6281. @end example
  6282. will generate a video with a duration of 5.3 seconds, with size
  6283. 176x144 and a frame rate of 10 frames per second.
  6284. The following graph description will generate a red source
  6285. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  6286. frames per second.
  6287. @example
  6288. color=c=red@@0.2:s=qcif:r=10
  6289. @end example
  6290. If the input content is to be ignored, @code{nullsrc} can be used. The
  6291. following command generates noise in the luminance plane by employing
  6292. the @code{geq} filter:
  6293. @example
  6294. nullsrc=s=256x256, geq=random(1)*255:128:128
  6295. @end example
  6296. @subsection Commands
  6297. The @code{color} source supports the following commands:
  6298. @table @option
  6299. @item c, color
  6300. Set the color of the created image. Accepts the same syntax of the
  6301. corresponding @option{color} option.
  6302. @end table
  6303. @c man end VIDEO SOURCES
  6304. @chapter Video Sinks
  6305. @c man begin VIDEO SINKS
  6306. Below is a description of the currently available video sinks.
  6307. @section buffersink
  6308. Buffer video frames, and make them available to the end of the filter
  6309. graph.
  6310. This sink is mainly intended for a programmatic use, in particular
  6311. through the interface defined in @file{libavfilter/buffersink.h}
  6312. or the options system.
  6313. It accepts a pointer to an AVBufferSinkContext structure, which
  6314. defines the incoming buffers' formats, to be passed as the opaque
  6315. parameter to @code{avfilter_init_filter} for initialization.
  6316. @section nullsink
  6317. Null video sink, do absolutely nothing with the input video. It is
  6318. mainly useful as a template and to be employed in analysis / debugging
  6319. tools.
  6320. @c man end VIDEO SINKS
  6321. @chapter Multimedia Filters
  6322. @c man begin MULTIMEDIA FILTERS
  6323. Below is a description of the currently available multimedia filters.
  6324. @section avectorscope
  6325. Convert input audio to a video output, representing the audio vector
  6326. scope.
  6327. The filter is used to measure the difference between channels of stereo
  6328. audio stream. A monoaural signal, consisting of identical left and right
  6329. signal, results in straight vertical line. Any stereo separation is visible
  6330. as a deviation from this line, creating a Lissajous figure.
  6331. If the straight (or deviation from it) but horizontal line appears this
  6332. indicates that the left and right channels are out of phase.
  6333. The filter accepts the following options:
  6334. @table @option
  6335. @item mode, m
  6336. Set the vectorscope mode.
  6337. Available values are:
  6338. @table @samp
  6339. @item lissajous
  6340. Lissajous rotated by 45 degrees.
  6341. @item lissajous_xy
  6342. Same as above but not rotated.
  6343. @end table
  6344. Default value is @samp{lissajous}.
  6345. @item size, s
  6346. Set the video size for the output. Default value is @code{400x400}.
  6347. @item rate, r
  6348. Set the output frame rate. Default value is @code{25}.
  6349. @item rc
  6350. @item gc
  6351. @item bc
  6352. Specify the red, green and blue contrast. Default values are @code{40}, @code{160} and @code{80}.
  6353. Allowed range is @code{[0, 255]}.
  6354. @item rf
  6355. @item gf
  6356. @item bf
  6357. Specify the red, green and blue fade. Default values are @code{15}, @code{10} and @code{5}.
  6358. Allowed range is @code{[0, 255]}.
  6359. @item zoom
  6360. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  6361. @end table
  6362. @subsection Examples
  6363. @itemize
  6364. @item
  6365. Complete example using @command{ffplay}:
  6366. @example
  6367. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  6368. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  6369. @end example
  6370. @end itemize
  6371. @section concat
  6372. Concatenate audio and video streams, joining them together one after the
  6373. other.
  6374. The filter works on segments of synchronized video and audio streams. All
  6375. segments must have the same number of streams of each type, and that will
  6376. also be the number of streams at output.
  6377. The filter accepts the following options:
  6378. @table @option
  6379. @item n
  6380. Set the number of segments. Default is 2.
  6381. @item v
  6382. Set the number of output video streams, that is also the number of video
  6383. streams in each segment. Default is 1.
  6384. @item a
  6385. Set the number of output audio streams, that is also the number of video
  6386. streams in each segment. Default is 0.
  6387. @item unsafe
  6388. Activate unsafe mode: do not fail if segments have a different format.
  6389. @end table
  6390. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  6391. @var{a} audio outputs.
  6392. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  6393. segment, in the same order as the outputs, then the inputs for the second
  6394. segment, etc.
  6395. Related streams do not always have exactly the same duration, for various
  6396. reasons including codec frame size or sloppy authoring. For that reason,
  6397. related synchronized streams (e.g. a video and its audio track) should be
  6398. concatenated at once. The concat filter will use the duration of the longest
  6399. stream in each segment (except the last one), and if necessary pad shorter
  6400. audio streams with silence.
  6401. For this filter to work correctly, all segments must start at timestamp 0.
  6402. All corresponding streams must have the same parameters in all segments; the
  6403. filtering system will automatically select a common pixel format for video
  6404. streams, and a common sample format, sample rate and channel layout for
  6405. audio streams, but other settings, such as resolution, must be converted
  6406. explicitly by the user.
  6407. Different frame rates are acceptable but will result in variable frame rate
  6408. at output; be sure to configure the output file to handle it.
  6409. @subsection Examples
  6410. @itemize
  6411. @item
  6412. Concatenate an opening, an episode and an ending, all in bilingual version
  6413. (video in stream 0, audio in streams 1 and 2):
  6414. @example
  6415. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  6416. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  6417. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  6418. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  6419. @end example
  6420. @item
  6421. Concatenate two parts, handling audio and video separately, using the
  6422. (a)movie sources, and adjusting the resolution:
  6423. @example
  6424. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  6425. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  6426. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  6427. @end example
  6428. Note that a desync will happen at the stitch if the audio and video streams
  6429. do not have exactly the same duration in the first file.
  6430. @end itemize
  6431. @section ebur128
  6432. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  6433. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  6434. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  6435. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  6436. The filter also has a video output (see the @var{video} option) with a real
  6437. time graph to observe the loudness evolution. The graphic contains the logged
  6438. message mentioned above, so it is not printed anymore when this option is set,
  6439. unless the verbose logging is set. The main graphing area contains the
  6440. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  6441. the momentary loudness (400 milliseconds).
  6442. More information about the Loudness Recommendation EBU R128 on
  6443. @url{http://tech.ebu.ch/loudness}.
  6444. The filter accepts the following options:
  6445. @table @option
  6446. @item video
  6447. Activate the video output. The audio stream is passed unchanged whether this
  6448. option is set or no. The video stream will be the first output stream if
  6449. activated. Default is @code{0}.
  6450. @item size
  6451. Set the video size. This option is for video only. Default and minimum
  6452. resolution is @code{640x480}.
  6453. @item meter
  6454. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  6455. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  6456. other integer value between this range is allowed.
  6457. @item metadata
  6458. Set metadata injection. If set to @code{1}, the audio input will be segmented
  6459. into 100ms output frames, each of them containing various loudness information
  6460. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  6461. Default is @code{0}.
  6462. @item framelog
  6463. Force the frame logging level.
  6464. Available values are:
  6465. @table @samp
  6466. @item info
  6467. information logging level
  6468. @item verbose
  6469. verbose logging level
  6470. @end table
  6471. By default, the logging level is set to @var{info}. If the @option{video} or
  6472. the @option{metadata} options are set, it switches to @var{verbose}.
  6473. @end table
  6474. @subsection Examples
  6475. @itemize
  6476. @item
  6477. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  6478. @example
  6479. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  6480. @end example
  6481. @item
  6482. Run an analysis with @command{ffmpeg}:
  6483. @example
  6484. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  6485. @end example
  6486. @end itemize
  6487. @section interleave, ainterleave
  6488. Temporally interleave frames from several inputs.
  6489. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  6490. These filters read frames from several inputs and send the oldest
  6491. queued frame to the output.
  6492. Input streams must have a well defined, monotonically increasing frame
  6493. timestamp values.
  6494. In order to submit one frame to output, these filters need to enqueue
  6495. at least one frame for each input, so they cannot work in case one
  6496. input is not yet terminated and will not receive incoming frames.
  6497. For example consider the case when one input is a @code{select} filter
  6498. which always drop input frames. The @code{interleave} filter will keep
  6499. reading from that input, but it will never be able to send new frames
  6500. to output until the input will send an end-of-stream signal.
  6501. Also, depending on inputs synchronization, the filters will drop
  6502. frames in case one input receives more frames than the other ones, and
  6503. the queue is already filled.
  6504. These filters accept the following options:
  6505. @table @option
  6506. @item nb_inputs, n
  6507. Set the number of different inputs, it is 2 by default.
  6508. @end table
  6509. @subsection Examples
  6510. @itemize
  6511. @item
  6512. Interleave frames belonging to different streams using @command{ffmpeg}:
  6513. @example
  6514. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  6515. @end example
  6516. @item
  6517. Add flickering blur effect:
  6518. @example
  6519. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  6520. @end example
  6521. @end itemize
  6522. @section perms, aperms
  6523. Set read/write permissions for the output frames.
  6524. These filters are mainly aimed at developers to test direct path in the
  6525. following filter in the filtergraph.
  6526. The filters accept the following options:
  6527. @table @option
  6528. @item mode
  6529. Select the permissions mode.
  6530. It accepts the following values:
  6531. @table @samp
  6532. @item none
  6533. Do nothing. This is the default.
  6534. @item ro
  6535. Set all the output frames read-only.
  6536. @item rw
  6537. Set all the output frames directly writable.
  6538. @item toggle
  6539. Make the frame read-only if writable, and writable if read-only.
  6540. @item random
  6541. Set each output frame read-only or writable randomly.
  6542. @end table
  6543. @item seed
  6544. Set the seed for the @var{random} mode, must be an integer included between
  6545. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  6546. @code{-1}, the filter will try to use a good random seed on a best effort
  6547. basis.
  6548. @end table
  6549. Note: in case of auto-inserted filter between the permission filter and the
  6550. following one, the permission might not be received as expected in that
  6551. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  6552. perms/aperms filter can avoid this problem.
  6553. @section select, aselect
  6554. Select frames to pass in output.
  6555. This filter accepts the following options:
  6556. @table @option
  6557. @item expr, e
  6558. Set expression, which is evaluated for each input frame.
  6559. If the expression is evaluated to zero, the frame is discarded.
  6560. If the evaluation result is negative or NaN, the frame is sent to the
  6561. first output; otherwise it is sent to the output with index
  6562. @code{ceil(val)-1}, assuming that the input index starts from 0.
  6563. For example a value of @code{1.2} corresponds to the output with index
  6564. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  6565. @item outputs, n
  6566. Set the number of outputs. The output to which to send the selected
  6567. frame is based on the result of the evaluation. Default value is 1.
  6568. @end table
  6569. The expression can contain the following constants:
  6570. @table @option
  6571. @item n
  6572. the sequential number of the filtered frame, starting from 0
  6573. @item selected_n
  6574. the sequential number of the selected frame, starting from 0
  6575. @item prev_selected_n
  6576. the sequential number of the last selected frame, NAN if undefined
  6577. @item TB
  6578. timebase of the input timestamps
  6579. @item pts
  6580. the PTS (Presentation TimeStamp) of the filtered video frame,
  6581. expressed in @var{TB} units, NAN if undefined
  6582. @item t
  6583. the PTS (Presentation TimeStamp) of the filtered video frame,
  6584. expressed in seconds, NAN if undefined
  6585. @item prev_pts
  6586. the PTS of the previously filtered video frame, NAN if undefined
  6587. @item prev_selected_pts
  6588. the PTS of the last previously filtered video frame, NAN if undefined
  6589. @item prev_selected_t
  6590. the PTS of the last previously selected video frame, NAN if undefined
  6591. @item start_pts
  6592. the PTS of the first video frame in the video, NAN if undefined
  6593. @item start_t
  6594. the time of the first video frame in the video, NAN if undefined
  6595. @item pict_type @emph{(video only)}
  6596. the type of the filtered frame, can assume one of the following
  6597. values:
  6598. @table @option
  6599. @item I
  6600. @item P
  6601. @item B
  6602. @item S
  6603. @item SI
  6604. @item SP
  6605. @item BI
  6606. @end table
  6607. @item interlace_type @emph{(video only)}
  6608. the frame interlace type, can assume one of the following values:
  6609. @table @option
  6610. @item PROGRESSIVE
  6611. the frame is progressive (not interlaced)
  6612. @item TOPFIRST
  6613. the frame is top-field-first
  6614. @item BOTTOMFIRST
  6615. the frame is bottom-field-first
  6616. @end table
  6617. @item consumed_sample_n @emph{(audio only)}
  6618. the number of selected samples before the current frame
  6619. @item samples_n @emph{(audio only)}
  6620. the number of samples in the current frame
  6621. @item sample_rate @emph{(audio only)}
  6622. the input sample rate
  6623. @item key
  6624. 1 if the filtered frame is a key-frame, 0 otherwise
  6625. @item pos
  6626. the position in the file of the filtered frame, -1 if the information
  6627. is not available (e.g. for synthetic video)
  6628. @item scene @emph{(video only)}
  6629. value between 0 and 1 to indicate a new scene; a low value reflects a low
  6630. probability for the current frame to introduce a new scene, while a higher
  6631. value means the current frame is more likely to be one (see the example below)
  6632. @end table
  6633. The default value of the select expression is "1".
  6634. @subsection Examples
  6635. @itemize
  6636. @item
  6637. Select all frames in input:
  6638. @example
  6639. select
  6640. @end example
  6641. The example above is the same as:
  6642. @example
  6643. select=1
  6644. @end example
  6645. @item
  6646. Skip all frames:
  6647. @example
  6648. select=0
  6649. @end example
  6650. @item
  6651. Select only I-frames:
  6652. @example
  6653. select='eq(pict_type\,I)'
  6654. @end example
  6655. @item
  6656. Select one frame every 100:
  6657. @example
  6658. select='not(mod(n\,100))'
  6659. @end example
  6660. @item
  6661. Select only frames contained in the 10-20 time interval:
  6662. @example
  6663. select='gte(t\,10)*lte(t\,20)'
  6664. @end example
  6665. @item
  6666. Select only I frames contained in the 10-20 time interval:
  6667. @example
  6668. select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
  6669. @end example
  6670. @item
  6671. Select frames with a minimum distance of 10 seconds:
  6672. @example
  6673. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  6674. @end example
  6675. @item
  6676. Use aselect to select only audio frames with samples number > 100:
  6677. @example
  6678. aselect='gt(samples_n\,100)'
  6679. @end example
  6680. @item
  6681. Create a mosaic of the first scenes:
  6682. @example
  6683. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  6684. @end example
  6685. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  6686. choice.
  6687. @item
  6688. Send even and odd frames to separate outputs, and compose them:
  6689. @example
  6690. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  6691. @end example
  6692. @end itemize
  6693. @section sendcmd, asendcmd
  6694. Send commands to filters in the filtergraph.
  6695. These filters read commands to be sent to other filters in the
  6696. filtergraph.
  6697. @code{sendcmd} must be inserted between two video filters,
  6698. @code{asendcmd} must be inserted between two audio filters, but apart
  6699. from that they act the same way.
  6700. The specification of commands can be provided in the filter arguments
  6701. with the @var{commands} option, or in a file specified by the
  6702. @var{filename} option.
  6703. These filters accept the following options:
  6704. @table @option
  6705. @item commands, c
  6706. Set the commands to be read and sent to the other filters.
  6707. @item filename, f
  6708. Set the filename of the commands to be read and sent to the other
  6709. filters.
  6710. @end table
  6711. @subsection Commands syntax
  6712. A commands description consists of a sequence of interval
  6713. specifications, comprising a list of commands to be executed when a
  6714. particular event related to that interval occurs. The occurring event
  6715. is typically the current frame time entering or leaving a given time
  6716. interval.
  6717. An interval is specified by the following syntax:
  6718. @example
  6719. @var{START}[-@var{END}] @var{COMMANDS};
  6720. @end example
  6721. The time interval is specified by the @var{START} and @var{END} times.
  6722. @var{END} is optional and defaults to the maximum time.
  6723. The current frame time is considered within the specified interval if
  6724. it is included in the interval [@var{START}, @var{END}), that is when
  6725. the time is greater or equal to @var{START} and is lesser than
  6726. @var{END}.
  6727. @var{COMMANDS} consists of a sequence of one or more command
  6728. specifications, separated by ",", relating to that interval. The
  6729. syntax of a command specification is given by:
  6730. @example
  6731. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  6732. @end example
  6733. @var{FLAGS} is optional and specifies the type of events relating to
  6734. the time interval which enable sending the specified command, and must
  6735. be a non-null sequence of identifier flags separated by "+" or "|" and
  6736. enclosed between "[" and "]".
  6737. The following flags are recognized:
  6738. @table @option
  6739. @item enter
  6740. The command is sent when the current frame timestamp enters the
  6741. specified interval. In other words, the command is sent when the
  6742. previous frame timestamp was not in the given interval, and the
  6743. current is.
  6744. @item leave
  6745. The command is sent when the current frame timestamp leaves the
  6746. specified interval. In other words, the command is sent when the
  6747. previous frame timestamp was in the given interval, and the
  6748. current is not.
  6749. @end table
  6750. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  6751. assumed.
  6752. @var{TARGET} specifies the target of the command, usually the name of
  6753. the filter class or a specific filter instance name.
  6754. @var{COMMAND} specifies the name of the command for the target filter.
  6755. @var{ARG} is optional and specifies the optional list of argument for
  6756. the given @var{COMMAND}.
  6757. Between one interval specification and another, whitespaces, or
  6758. sequences of characters starting with @code{#} until the end of line,
  6759. are ignored and can be used to annotate comments.
  6760. A simplified BNF description of the commands specification syntax
  6761. follows:
  6762. @example
  6763. @var{COMMAND_FLAG} ::= "enter" | "leave"
  6764. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  6765. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  6766. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  6767. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  6768. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  6769. @end example
  6770. @subsection Examples
  6771. @itemize
  6772. @item
  6773. Specify audio tempo change at second 4:
  6774. @example
  6775. asendcmd=c='4.0 atempo tempo 1.5',atempo
  6776. @end example
  6777. @item
  6778. Specify a list of drawtext and hue commands in a file.
  6779. @example
  6780. # show text in the interval 5-10
  6781. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  6782. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  6783. # desaturate the image in the interval 15-20
  6784. 15.0-20.0 [enter] hue s 0,
  6785. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  6786. [leave] hue s 1,
  6787. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  6788. # apply an exponential saturation fade-out effect, starting from time 25
  6789. 25 [enter] hue s exp(25-t)
  6790. @end example
  6791. A filtergraph allowing to read and process the above command list
  6792. stored in a file @file{test.cmd}, can be specified with:
  6793. @example
  6794. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  6795. @end example
  6796. @end itemize
  6797. @anchor{setpts}
  6798. @section setpts, asetpts
  6799. Change the PTS (presentation timestamp) of the input frames.
  6800. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  6801. This filter accepts the following options:
  6802. @table @option
  6803. @item expr
  6804. The expression which is evaluated for each frame to construct its timestamp.
  6805. @end table
  6806. The expression is evaluated through the eval API and can contain the following
  6807. constants:
  6808. @table @option
  6809. @item FRAME_RATE
  6810. frame rate, only defined for constant frame-rate video
  6811. @item PTS
  6812. the presentation timestamp in input
  6813. @item N
  6814. the count of the input frame for video or the number of consumed samples,
  6815. not including the current frame for audio, starting from 0.
  6816. @item NB_CONSUMED_SAMPLES
  6817. the number of consumed samples, not including the current frame (only
  6818. audio)
  6819. @item NB_SAMPLES, S
  6820. the number of samples in the current frame (only audio)
  6821. @item SAMPLE_RATE, SR
  6822. audio sample rate
  6823. @item STARTPTS
  6824. the PTS of the first frame
  6825. @item STARTT
  6826. the time in seconds of the first frame
  6827. @item INTERLACED
  6828. tell if the current frame is interlaced
  6829. @item T
  6830. the time in seconds of the current frame
  6831. @item TB
  6832. the time base
  6833. @item POS
  6834. original position in the file of the frame, or undefined if undefined
  6835. for the current frame
  6836. @item PREV_INPTS
  6837. previous input PTS
  6838. @item PREV_INT
  6839. previous input time in seconds
  6840. @item PREV_OUTPTS
  6841. previous output PTS
  6842. @item PREV_OUTT
  6843. previous output time in seconds
  6844. @item RTCTIME
  6845. wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  6846. instead.
  6847. @item RTCSTART
  6848. wallclock (RTC) time at the start of the movie in microseconds
  6849. @end table
  6850. @subsection Examples
  6851. @itemize
  6852. @item
  6853. Start counting PTS from zero
  6854. @example
  6855. setpts=PTS-STARTPTS
  6856. @end example
  6857. @item
  6858. Apply fast motion effect:
  6859. @example
  6860. setpts=0.5*PTS
  6861. @end example
  6862. @item
  6863. Apply slow motion effect:
  6864. @example
  6865. setpts=2.0*PTS
  6866. @end example
  6867. @item
  6868. Set fixed rate of 25 frames per second:
  6869. @example
  6870. setpts=N/(25*TB)
  6871. @end example
  6872. @item
  6873. Set fixed rate 25 fps with some jitter:
  6874. @example
  6875. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  6876. @end example
  6877. @item
  6878. Apply an offset of 10 seconds to the input PTS:
  6879. @example
  6880. setpts=PTS+10/TB
  6881. @end example
  6882. @item
  6883. Generate timestamps from a "live source" and rebase onto the current timebase:
  6884. @example
  6885. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  6886. @end example
  6887. @item
  6888. Generate timestamps by counting samples:
  6889. @example
  6890. asetpts=N/SR/TB
  6891. @end example
  6892. @end itemize
  6893. @section settb, asettb
  6894. Set the timebase to use for the output frames timestamps.
  6895. It is mainly useful for testing timebase configuration.
  6896. This filter accepts the following options:
  6897. @table @option
  6898. @item expr, tb
  6899. The expression which is evaluated into the output timebase.
  6900. @end table
  6901. The value for @option{tb} is an arithmetic expression representing a
  6902. rational. The expression can contain the constants "AVTB" (the default
  6903. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  6904. audio only). Default value is "intb".
  6905. @subsection Examples
  6906. @itemize
  6907. @item
  6908. Set the timebase to 1/25:
  6909. @example
  6910. settb=expr=1/25
  6911. @end example
  6912. @item
  6913. Set the timebase to 1/10:
  6914. @example
  6915. settb=expr=0.1
  6916. @end example
  6917. @item
  6918. Set the timebase to 1001/1000:
  6919. @example
  6920. settb=1+0.001
  6921. @end example
  6922. @item
  6923. Set the timebase to 2*intb:
  6924. @example
  6925. settb=2*intb
  6926. @end example
  6927. @item
  6928. Set the default timebase value:
  6929. @example
  6930. settb=AVTB
  6931. @end example
  6932. @end itemize
  6933. @section showspectrum
  6934. Convert input audio to a video output, representing the audio frequency
  6935. spectrum.
  6936. The filter accepts the following options:
  6937. @table @option
  6938. @item size, s
  6939. Specify the video size for the output. Default value is @code{640x512}.
  6940. @item slide
  6941. Specify if the spectrum should slide along the window. Default value is
  6942. @code{0}.
  6943. @item mode
  6944. Specify display mode.
  6945. It accepts the following values:
  6946. @table @samp
  6947. @item combined
  6948. all channels are displayed in the same row
  6949. @item separate
  6950. all channels are displayed in separate rows
  6951. @end table
  6952. Default value is @samp{combined}.
  6953. @item color
  6954. Specify display color mode.
  6955. It accepts the following values:
  6956. @table @samp
  6957. @item channel
  6958. each channel is displayed in a separate color
  6959. @item intensity
  6960. each channel is is displayed using the same color scheme
  6961. @end table
  6962. Default value is @samp{channel}.
  6963. @item scale
  6964. Specify scale used for calculating intensity color values.
  6965. It accepts the following values:
  6966. @table @samp
  6967. @item lin
  6968. linear
  6969. @item sqrt
  6970. square root, default
  6971. @item cbrt
  6972. cubic root
  6973. @item log
  6974. logarithmic
  6975. @end table
  6976. Default value is @samp{sqrt}.
  6977. @item saturation
  6978. Set saturation modifier for displayed colors. Negative values provide
  6979. alternative color scheme. @code{0} is no saturation at all.
  6980. Saturation must be in [-10.0, 10.0] range.
  6981. Default value is @code{1}.
  6982. @end table
  6983. The usage is very similar to the showwaves filter; see the examples in that
  6984. section.
  6985. @subsection Examples
  6986. @itemize
  6987. @item
  6988. Large window with logarithmic color scaling:
  6989. @example
  6990. showspectrum=s=1280x480:scale=log
  6991. @end example
  6992. @item
  6993. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  6994. @example
  6995. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  6996. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  6997. @end example
  6998. @end itemize
  6999. @section showwaves
  7000. Convert input audio to a video output, representing the samples waves.
  7001. The filter accepts the following options:
  7002. @table @option
  7003. @item size, s
  7004. Specify the video size for the output. Default value is "600x240".
  7005. @item mode
  7006. Set display mode.
  7007. Available values are:
  7008. @table @samp
  7009. @item point
  7010. Draw a point for each sample.
  7011. @item line
  7012. Draw a vertical line for each sample.
  7013. @end table
  7014. Default value is @code{point}.
  7015. @item n
  7016. Set the number of samples which are printed on the same column. A
  7017. larger value will decrease the frame rate. Must be a positive
  7018. integer. This option can be set only if the value for @var{rate}
  7019. is not explicitly specified.
  7020. @item rate, r
  7021. Set the (approximate) output frame rate. This is done by setting the
  7022. option @var{n}. Default value is "25".
  7023. @end table
  7024. @subsection Examples
  7025. @itemize
  7026. @item
  7027. Output the input file audio and the corresponding video representation
  7028. at the same time:
  7029. @example
  7030. amovie=a.mp3,asplit[out0],showwaves[out1]
  7031. @end example
  7032. @item
  7033. Create a synthetic signal and show it with showwaves, forcing a
  7034. frame rate of 30 frames per second:
  7035. @example
  7036. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  7037. @end example
  7038. @end itemize
  7039. @section split, asplit
  7040. Split input into several identical outputs.
  7041. @code{asplit} works with audio input, @code{split} with video.
  7042. The filter accepts a single parameter which specifies the number of outputs. If
  7043. unspecified, it defaults to 2.
  7044. @subsection Examples
  7045. @itemize
  7046. @item
  7047. Create two separate outputs from the same input:
  7048. @example
  7049. [in] split [out0][out1]
  7050. @end example
  7051. @item
  7052. To create 3 or more outputs, you need to specify the number of
  7053. outputs, like in:
  7054. @example
  7055. [in] asplit=3 [out0][out1][out2]
  7056. @end example
  7057. @item
  7058. Create two separate outputs from the same input, one cropped and
  7059. one padded:
  7060. @example
  7061. [in] split [splitout1][splitout2];
  7062. [splitout1] crop=100:100:0:0 [cropout];
  7063. [splitout2] pad=200:200:100:100 [padout];
  7064. @end example
  7065. @item
  7066. Create 5 copies of the input audio with @command{ffmpeg}:
  7067. @example
  7068. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  7069. @end example
  7070. @end itemize
  7071. @section zmq, azmq
  7072. Receive commands sent through a libzmq client, and forward them to
  7073. filters in the filtergraph.
  7074. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  7075. must be inserted between two video filters, @code{azmq} between two
  7076. audio filters.
  7077. To enable these filters you need to install the libzmq library and
  7078. headers and configure FFmpeg with @code{--enable-libzmq}.
  7079. For more information about libzmq see:
  7080. @url{http://www.zeromq.org/}
  7081. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  7082. receives messages sent through a network interface defined by the
  7083. @option{bind_address} option.
  7084. The received message must be in the form:
  7085. @example
  7086. @var{TARGET} @var{COMMAND} [@var{ARG}]
  7087. @end example
  7088. @var{TARGET} specifies the target of the command, usually the name of
  7089. the filter class or a specific filter instance name.
  7090. @var{COMMAND} specifies the name of the command for the target filter.
  7091. @var{ARG} is optional and specifies the optional argument list for the
  7092. given @var{COMMAND}.
  7093. Upon reception, the message is processed and the corresponding command
  7094. is injected into the filtergraph. Depending on the result, the filter
  7095. will send a reply to the client, adopting the format:
  7096. @example
  7097. @var{ERROR_CODE} @var{ERROR_REASON}
  7098. @var{MESSAGE}
  7099. @end example
  7100. @var{MESSAGE} is optional.
  7101. @subsection Examples
  7102. Look at @file{tools/zmqsend} for an example of a zmq client which can
  7103. be used to send commands processed by these filters.
  7104. Consider the following filtergraph generated by @command{ffplay}
  7105. @example
  7106. ffplay -dumpgraph 1 -f lavfi "
  7107. color=s=100x100:c=red [l];
  7108. color=s=100x100:c=blue [r];
  7109. nullsrc=s=200x100, zmq [bg];
  7110. [bg][l] overlay [bg+l];
  7111. [bg+l][r] overlay=x=100 "
  7112. @end example
  7113. To change the color of the left side of the video, the following
  7114. command can be used:
  7115. @example
  7116. echo Parsed_color_0 c yellow | tools/zmqsend
  7117. @end example
  7118. To change the right side:
  7119. @example
  7120. echo Parsed_color_1 c pink | tools/zmqsend
  7121. @end example
  7122. @c man end MULTIMEDIA FILTERS
  7123. @chapter Multimedia Sources
  7124. @c man begin MULTIMEDIA SOURCES
  7125. Below is a description of the currently available multimedia sources.
  7126. @section amovie
  7127. This is the same as @ref{movie} source, except it selects an audio
  7128. stream by default.
  7129. @anchor{movie}
  7130. @section movie
  7131. Read audio and/or video stream(s) from a movie container.
  7132. This filter accepts the following options:
  7133. @table @option
  7134. @item filename
  7135. The name of the resource to read (not necessarily a file but also a device or a
  7136. stream accessed through some protocol).
  7137. @item format_name, f
  7138. Specifies the format assumed for the movie to read, and can be either
  7139. the name of a container or an input device. If not specified the
  7140. format is guessed from @var{movie_name} or by probing.
  7141. @item seek_point, sp
  7142. Specifies the seek point in seconds, the frames will be output
  7143. starting from this seek point, the parameter is evaluated with
  7144. @code{av_strtod} so the numerical value may be suffixed by an IS
  7145. postfix. Default value is "0".
  7146. @item streams, s
  7147. Specifies the streams to read. Several streams can be specified,
  7148. separated by "+". The source will then have as many outputs, in the
  7149. same order. The syntax is explained in the ``Stream specifiers''
  7150. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  7151. respectively the default (best suited) video and audio stream. Default
  7152. is "dv", or "da" if the filter is called as "amovie".
  7153. @item stream_index, si
  7154. Specifies the index of the video stream to read. If the value is -1,
  7155. the best suited video stream will be automatically selected. Default
  7156. value is "-1". Deprecated. If the filter is called "amovie", it will select
  7157. audio instead of video.
  7158. @item loop
  7159. Specifies how many times to read the stream in sequence.
  7160. If the value is less than 1, the stream will be read again and again.
  7161. Default value is "1".
  7162. Note that when the movie is looped the source timestamps are not
  7163. changed, so it will generate non monotonically increasing timestamps.
  7164. @end table
  7165. This filter allows to overlay a second video on top of main input of
  7166. a filtergraph as shown in this graph:
  7167. @example
  7168. input -----------> deltapts0 --> overlay --> output
  7169. ^
  7170. |
  7171. movie --> scale--> deltapts1 -------+
  7172. @end example
  7173. @subsection Examples
  7174. @itemize
  7175. @item
  7176. Skip 3.2 seconds from the start of the avi file in.avi, and overlay it
  7177. on top of the input labelled as "in":
  7178. @example
  7179. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  7180. [in] setpts=PTS-STARTPTS [main];
  7181. [main][over] overlay=16:16 [out]
  7182. @end example
  7183. @item
  7184. Read from a video4linux2 device, and overlay it on top of the input
  7185. labelled as "in":
  7186. @example
  7187. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  7188. [in] setpts=PTS-STARTPTS [main];
  7189. [main][over] overlay=16:16 [out]
  7190. @end example
  7191. @item
  7192. Read the first video stream and the audio stream with id 0x81 from
  7193. dvd.vob; the video is connected to the pad named "video" and the audio is
  7194. connected to the pad named "audio":
  7195. @example
  7196. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  7197. @end example
  7198. @end itemize
  7199. @c man end MULTIMEDIA SOURCES