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.

10142 lines
273KB

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