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.

14631 lines
401KB

  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. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then 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 the top half of the video is mirrored
  23. onto the bottom half of the output video.
  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 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", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  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. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item threshold
  284. If a signal of second stream rises above this level it will affect the gain
  285. reduction of the first stream.
  286. By default it is 0.125. Range is between 0.00097563 and 1.
  287. @item ratio
  288. Set a ratio by which the signal is reduced. 1:2 means that if the level
  289. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  290. Default is 2. Range is between 1 and 20.
  291. @item attack
  292. Amount of milliseconds the signal has to rise above the threshold before gain
  293. reduction starts. Default is 20. Range is between 0.01 and 2000.
  294. @item release
  295. Amount of milliseconds the signal has to fall below the threshold before
  296. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  297. @item makeup
  298. Set the amount by how much signal will be amplified after processing.
  299. Default is 2. Range is from 1 and 64.
  300. @item knee
  301. Curve the sharp knee around the threshold to enter gain reduction more softly.
  302. Default is 2.82843. Range is between 1 and 8.
  303. @item link
  304. Choose if the @code{average} level between all channels of input stream
  305. or the louder(@code{maximum}) channel of input stream affects the
  306. reduction. Default is @code{average}.
  307. @item detection
  308. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  309. of @code{rms}. Default is @code{rms} which is mostly smoother.
  310. @item mix
  311. How much to use compressed signal in output. Default is 1.
  312. Range is between 0 and 1.
  313. @end table
  314. @section acrossfade
  315. Apply cross fade from one input audio stream to another input audio stream.
  316. The cross fade is applied for specified duration near the end of first stream.
  317. The filter accepts the following options:
  318. @table @option
  319. @item nb_samples, ns
  320. Specify the number of samples for which the cross fade effect has to last.
  321. At the end of the cross fade effect the first input audio will be completely
  322. silent. Default is 44100.
  323. @item duration, d
  324. Specify the duration of the cross fade effect. See
  325. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  326. for the accepted syntax.
  327. By default the duration is determined by @var{nb_samples}.
  328. If set this option is used instead of @var{nb_samples}.
  329. @item overlap, o
  330. Should first stream end overlap with second stream start. Default is enabled.
  331. @item curve1
  332. Set curve for cross fade transition for first stream.
  333. @item curve2
  334. Set curve for cross fade transition for second stream.
  335. For description of available curve types see @ref{afade} filter description.
  336. @end table
  337. @subsection Examples
  338. @itemize
  339. @item
  340. Cross fade from one input to another:
  341. @example
  342. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  343. @end example
  344. @item
  345. Cross fade from one input to another but without overlapping:
  346. @example
  347. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  348. @end example
  349. @end itemize
  350. @section adelay
  351. Delay one or more audio channels.
  352. Samples in delayed channel are filled with silence.
  353. The filter accepts the following option:
  354. @table @option
  355. @item delays
  356. Set list of delays in milliseconds for each channel separated by '|'.
  357. At least one delay greater than 0 should be provided.
  358. Unused delays will be silently ignored. If number of given delays is
  359. smaller than number of channels all remaining channels will not be delayed.
  360. @end table
  361. @subsection Examples
  362. @itemize
  363. @item
  364. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  365. the second channel (and any other channels that may be present) unchanged.
  366. @example
  367. adelay=1500|0|500
  368. @end example
  369. @end itemize
  370. @section aecho
  371. Apply echoing to the input audio.
  372. Echoes are reflected sound and can occur naturally amongst mountains
  373. (and sometimes large buildings) when talking or shouting; digital echo
  374. effects emulate this behaviour and are often used to help fill out the
  375. sound of a single instrument or vocal. The time difference between the
  376. original signal and the reflection is the @code{delay}, and the
  377. loudness of the reflected signal is the @code{decay}.
  378. Multiple echoes can have different delays and decays.
  379. A description of the accepted parameters follows.
  380. @table @option
  381. @item in_gain
  382. Set input gain of reflected signal. Default is @code{0.6}.
  383. @item out_gain
  384. Set output gain of reflected signal. Default is @code{0.3}.
  385. @item delays
  386. Set list of time intervals in milliseconds between original signal and reflections
  387. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  388. Default is @code{1000}.
  389. @item decays
  390. Set list of loudnesses of reflected signals separated by '|'.
  391. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  392. Default is @code{0.5}.
  393. @end table
  394. @subsection Examples
  395. @itemize
  396. @item
  397. Make it sound as if there are twice as many instruments as are actually playing:
  398. @example
  399. aecho=0.8:0.88:60:0.4
  400. @end example
  401. @item
  402. If delay is very short, then it sound like a (metallic) robot playing music:
  403. @example
  404. aecho=0.8:0.88:6:0.4
  405. @end example
  406. @item
  407. A longer delay will sound like an open air concert in the mountains:
  408. @example
  409. aecho=0.8:0.9:1000:0.3
  410. @end example
  411. @item
  412. Same as above but with one more mountain:
  413. @example
  414. aecho=0.8:0.9:1000|1800:0.3|0.25
  415. @end example
  416. @end itemize
  417. @section aeval
  418. Modify an audio signal according to the specified expressions.
  419. This filter accepts one or more expressions (one for each channel),
  420. which are evaluated and used to modify a corresponding audio signal.
  421. It accepts the following parameters:
  422. @table @option
  423. @item exprs
  424. Set the '|'-separated expressions list for each separate channel. If
  425. the number of input channels is greater than the number of
  426. expressions, the last specified expression is used for the remaining
  427. output channels.
  428. @item channel_layout, c
  429. Set output channel layout. If not specified, the channel layout is
  430. specified by the number of expressions. If set to @samp{same}, it will
  431. use by default the same input channel layout.
  432. @end table
  433. Each expression in @var{exprs} can contain the following constants and functions:
  434. @table @option
  435. @item ch
  436. channel number of the current expression
  437. @item n
  438. number of the evaluated sample, starting from 0
  439. @item s
  440. sample rate
  441. @item t
  442. time of the evaluated sample expressed in seconds
  443. @item nb_in_channels
  444. @item nb_out_channels
  445. input and output number of channels
  446. @item val(CH)
  447. the value of input channel with number @var{CH}
  448. @end table
  449. Note: this filter is slow. For faster processing you should use a
  450. dedicated filter.
  451. @subsection Examples
  452. @itemize
  453. @item
  454. Half volume:
  455. @example
  456. aeval=val(ch)/2:c=same
  457. @end example
  458. @item
  459. Invert phase of the second channel:
  460. @example
  461. aeval=val(0)|-val(1)
  462. @end example
  463. @end itemize
  464. @anchor{afade}
  465. @section afade
  466. Apply fade-in/out effect to input audio.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item type, t
  470. Specify the effect type, can be either @code{in} for fade-in, or
  471. @code{out} for a fade-out effect. Default is @code{in}.
  472. @item start_sample, ss
  473. Specify the number of the start sample for starting to apply the fade
  474. effect. Default is 0.
  475. @item nb_samples, ns
  476. Specify the number of samples for which the fade effect has to last. At
  477. the end of the fade-in effect the output audio will have the same
  478. volume as the input audio, at the end of the fade-out transition
  479. the output audio will be silence. Default is 44100.
  480. @item start_time, st
  481. Specify the start time of the fade effect. Default is 0.
  482. The value must be specified as a time duration; see
  483. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  484. for the accepted syntax.
  485. If set this option is used instead of @var{start_sample}.
  486. @item duration, d
  487. Specify the duration of the fade effect. See
  488. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  489. for the accepted syntax.
  490. At the end of the fade-in effect the output audio will have the same
  491. volume as the input audio, at the end of the fade-out transition
  492. the output audio will be silence.
  493. By default the duration is determined by @var{nb_samples}.
  494. If set this option is used instead of @var{nb_samples}.
  495. @item curve
  496. Set curve for fade transition.
  497. It accepts the following values:
  498. @table @option
  499. @item tri
  500. select triangular, linear slope (default)
  501. @item qsin
  502. select quarter of sine wave
  503. @item hsin
  504. select half of sine wave
  505. @item esin
  506. select exponential sine wave
  507. @item log
  508. select logarithmic
  509. @item ipar
  510. select inverted parabola
  511. @item qua
  512. select quadratic
  513. @item cub
  514. select cubic
  515. @item squ
  516. select square root
  517. @item cbr
  518. select cubic root
  519. @item par
  520. select parabola
  521. @item exp
  522. select exponential
  523. @item iqsin
  524. select inverted quarter of sine wave
  525. @item ihsin
  526. select inverted half of sine wave
  527. @item dese
  528. select double-exponential seat
  529. @item desi
  530. select double-exponential sigmoid
  531. @end table
  532. @end table
  533. @subsection Examples
  534. @itemize
  535. @item
  536. Fade in first 15 seconds of audio:
  537. @example
  538. afade=t=in:ss=0:d=15
  539. @end example
  540. @item
  541. Fade out last 25 seconds of a 900 seconds audio:
  542. @example
  543. afade=t=out:st=875:d=25
  544. @end example
  545. @end itemize
  546. @anchor{aformat}
  547. @section aformat
  548. Set output format constraints for the input audio. The framework will
  549. negotiate the most appropriate format to minimize conversions.
  550. It accepts the following parameters:
  551. @table @option
  552. @item sample_fmts
  553. A '|'-separated list of requested sample formats.
  554. @item sample_rates
  555. A '|'-separated list of requested sample rates.
  556. @item channel_layouts
  557. A '|'-separated list of requested channel layouts.
  558. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  559. for the required syntax.
  560. @end table
  561. If a parameter is omitted, all values are allowed.
  562. Force the output to either unsigned 8-bit or signed 16-bit stereo
  563. @example
  564. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  565. @end example
  566. @section agate
  567. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  568. processing reduces disturbing noise between useful signals.
  569. Gating is done by detecting the volume below a chosen level @var{threshold}
  570. and divide it by the factor set with @var{ratio}. The bottom of the noise
  571. floor is set via @var{range}. Because an exact manipulation of the signal
  572. would cause distortion of the waveform the reduction can be levelled over
  573. time. This is done by setting @var{attack} and @var{release}.
  574. @var{attack} determines how long the signal has to fall below the threshold
  575. before any reduction will occur and @var{release} sets the time the signal
  576. has to raise above the threshold to reduce the reduction again.
  577. Shorter signals than the chosen attack time will be left untouched.
  578. @table @option
  579. @item level_in
  580. Set input level before filtering.
  581. Default is 1. Allowed range is from 0.015625 to 64.
  582. @item range
  583. Set the level of gain reduction when the signal is below the threshold.
  584. Default is 0.06125. Allowed range is from 0 to 1.
  585. @item threshold
  586. If a signal rises above this level the gain reduction is released.
  587. Default is 0.125. Allowed range is from 0 to 1.
  588. @item ratio
  589. Set a ratio about which the signal is reduced.
  590. Default is 2. Allowed range is from 1 to 9000.
  591. @item attack
  592. Amount of milliseconds the signal has to rise above the threshold before gain
  593. reduction stops.
  594. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  595. @item release
  596. Amount of milliseconds the signal has to fall below the threshold before the
  597. reduction is increased again. Default is 250 milliseconds.
  598. Allowed range is from 0.01 to 9000.
  599. @item makeup
  600. Set amount of amplification of signal after processing.
  601. Default is 1. Allowed range is from 1 to 64.
  602. @item knee
  603. Curve the sharp knee around the threshold to enter gain reduction more softly.
  604. Default is 2.828427125. Allowed range is from 1 to 8.
  605. @item detection
  606. Choose if exact signal should be taken for detection or an RMS like one.
  607. Default is peak. Can be peak or rms.
  608. @item link
  609. Choose if the average level between all channels or the louder channel affects
  610. the reduction.
  611. Default is average. Can be average or maximum.
  612. @end table
  613. @section alimiter
  614. The limiter prevents input signal from raising over a desired threshold.
  615. This limiter uses lookahead technology to prevent your signal from distorting.
  616. It means that there is a small delay after signal is processed. Keep in mind
  617. that the delay it produces is the attack time you set.
  618. The filter accepts the following options:
  619. @table @option
  620. @item limit
  621. Don't let signals above this level pass the limiter. The removed amplitude is
  622. added automatically. Default is 1.
  623. @item attack
  624. The limiter will reach its attenuation level in this amount of time in
  625. milliseconds. Default is 5 milliseconds.
  626. @item release
  627. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  628. Default is 50 milliseconds.
  629. @item asc
  630. When gain reduction is always needed ASC takes care of releasing to an
  631. average reduction level rather than reaching a reduction of 0 in the release
  632. time.
  633. @item asc_level
  634. Select how much the release time is affected by ASC, 0 means nearly no changes
  635. in release time while 1 produces higher release times.
  636. @end table
  637. Depending on picked setting it is recommended to upsample input 2x or 4x times
  638. with @ref{aresample} before applying this filter.
  639. @section allpass
  640. Apply a two-pole all-pass filter with central frequency (in Hz)
  641. @var{frequency}, and filter-width @var{width}.
  642. An all-pass filter changes the audio's frequency to phase relationship
  643. without changing its frequency to amplitude relationship.
  644. The filter accepts the following options:
  645. @table @option
  646. @item frequency, f
  647. Set frequency in Hz.
  648. @item width_type
  649. Set method to specify band-width of filter.
  650. @table @option
  651. @item h
  652. Hz
  653. @item q
  654. Q-Factor
  655. @item o
  656. octave
  657. @item s
  658. slope
  659. @end table
  660. @item width, w
  661. Specify the band-width of a filter in width_type units.
  662. @end table
  663. @anchor{amerge}
  664. @section amerge
  665. Merge two or more audio streams into a single multi-channel stream.
  666. The filter accepts the following options:
  667. @table @option
  668. @item inputs
  669. Set the number of inputs. Default is 2.
  670. @end table
  671. If the channel layouts of the inputs are disjoint, and therefore compatible,
  672. the channel layout of the output will be set accordingly and the channels
  673. will be reordered as necessary. If the channel layouts of the inputs are not
  674. disjoint, the output will have all the channels of the first input then all
  675. the channels of the second input, in that order, and the channel layout of
  676. the output will be the default value corresponding to the total number of
  677. channels.
  678. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  679. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  680. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  681. first input, b1 is the first channel of the second input).
  682. On the other hand, if both input are in stereo, the output channels will be
  683. in the default order: a1, a2, b1, b2, and the channel layout will be
  684. arbitrarily set to 4.0, which may or may not be the expected value.
  685. All inputs must have the same sample rate, and format.
  686. If inputs do not have the same duration, the output will stop with the
  687. shortest.
  688. @subsection Examples
  689. @itemize
  690. @item
  691. Merge two mono files into a stereo stream:
  692. @example
  693. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  694. @end example
  695. @item
  696. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  697. @example
  698. 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
  699. @end example
  700. @end itemize
  701. @section amix
  702. Mixes multiple audio inputs into a single output.
  703. Note that this filter only supports float samples (the @var{amerge}
  704. and @var{pan} audio filters support many formats). If the @var{amix}
  705. input has integer samples then @ref{aresample} will be automatically
  706. inserted to perform the conversion to float samples.
  707. For example
  708. @example
  709. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  710. @end example
  711. will mix 3 input audio streams to a single output with the same duration as the
  712. first input and a dropout transition time of 3 seconds.
  713. It accepts the following parameters:
  714. @table @option
  715. @item inputs
  716. The number of inputs. If unspecified, it defaults to 2.
  717. @item duration
  718. How to determine the end-of-stream.
  719. @table @option
  720. @item longest
  721. The duration of the longest input. (default)
  722. @item shortest
  723. The duration of the shortest input.
  724. @item first
  725. The duration of the first input.
  726. @end table
  727. @item dropout_transition
  728. The transition time, in seconds, for volume renormalization when an input
  729. stream ends. The default value is 2 seconds.
  730. @end table
  731. @section anull
  732. Pass the audio source unchanged to the output.
  733. @section apad
  734. Pad the end of an audio stream with silence.
  735. This can be used together with @command{ffmpeg} @option{-shortest} to
  736. extend audio streams to the same length as the video stream.
  737. A description of the accepted options follows.
  738. @table @option
  739. @item packet_size
  740. Set silence packet size. Default value is 4096.
  741. @item pad_len
  742. Set the number of samples of silence to add to the end. After the
  743. value is reached, the stream is terminated. This option is mutually
  744. exclusive with @option{whole_len}.
  745. @item whole_len
  746. Set the minimum total number of samples in the output audio stream. If
  747. the value is longer than the input audio length, silence is added to
  748. the end, until the value is reached. This option is mutually exclusive
  749. with @option{pad_len}.
  750. @end table
  751. If neither the @option{pad_len} nor the @option{whole_len} option is
  752. set, the filter will add silence to the end of the input stream
  753. indefinitely.
  754. @subsection Examples
  755. @itemize
  756. @item
  757. Add 1024 samples of silence to the end of the input:
  758. @example
  759. apad=pad_len=1024
  760. @end example
  761. @item
  762. Make sure the audio output will contain at least 10000 samples, pad
  763. the input with silence if required:
  764. @example
  765. apad=whole_len=10000
  766. @end example
  767. @item
  768. Use @command{ffmpeg} to pad the audio input with silence, so that the
  769. video stream will always result the shortest and will be converted
  770. until the end in the output file when using the @option{shortest}
  771. option:
  772. @example
  773. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  774. @end example
  775. @end itemize
  776. @section aphaser
  777. Add a phasing effect to the input audio.
  778. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  779. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  780. A description of the accepted parameters follows.
  781. @table @option
  782. @item in_gain
  783. Set input gain. Default is 0.4.
  784. @item out_gain
  785. Set output gain. Default is 0.74
  786. @item delay
  787. Set delay in milliseconds. Default is 3.0.
  788. @item decay
  789. Set decay. Default is 0.4.
  790. @item speed
  791. Set modulation speed in Hz. Default is 0.5.
  792. @item type
  793. Set modulation type. Default is triangular.
  794. It accepts the following values:
  795. @table @samp
  796. @item triangular, t
  797. @item sinusoidal, s
  798. @end table
  799. @end table
  800. @anchor{aresample}
  801. @section aresample
  802. Resample the input audio to the specified parameters, using the
  803. libswresample library. If none are specified then the filter will
  804. automatically convert between its input and output.
  805. This filter is also able to stretch/squeeze the audio data to make it match
  806. the timestamps or to inject silence / cut out audio to make it match the
  807. timestamps, do a combination of both or do neither.
  808. The filter accepts the syntax
  809. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  810. expresses a sample rate and @var{resampler_options} is a list of
  811. @var{key}=@var{value} pairs, separated by ":". See the
  812. ffmpeg-resampler manual for the complete list of supported options.
  813. @subsection Examples
  814. @itemize
  815. @item
  816. Resample the input audio to 44100Hz:
  817. @example
  818. aresample=44100
  819. @end example
  820. @item
  821. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  822. samples per second compensation:
  823. @example
  824. aresample=async=1000
  825. @end example
  826. @end itemize
  827. @section asetnsamples
  828. Set the number of samples per each output audio frame.
  829. The last output packet may contain a different number of samples, as
  830. the filter will flush all the remaining samples when the input audio
  831. signal its end.
  832. The filter accepts the following options:
  833. @table @option
  834. @item nb_out_samples, n
  835. Set the number of frames per each output audio frame. The number is
  836. intended as the number of samples @emph{per each channel}.
  837. Default value is 1024.
  838. @item pad, p
  839. If set to 1, the filter will pad the last audio frame with zeroes, so
  840. that the last frame will contain the same number of samples as the
  841. previous ones. Default value is 1.
  842. @end table
  843. For example, to set the number of per-frame samples to 1234 and
  844. disable padding for the last frame, use:
  845. @example
  846. asetnsamples=n=1234:p=0
  847. @end example
  848. @section asetrate
  849. Set the sample rate without altering the PCM data.
  850. This will result in a change of speed and pitch.
  851. The filter accepts the following options:
  852. @table @option
  853. @item sample_rate, r
  854. Set the output sample rate. Default is 44100 Hz.
  855. @end table
  856. @section ashowinfo
  857. Show a line containing various information for each input audio frame.
  858. The input audio is not modified.
  859. The shown line contains a sequence of key/value pairs of the form
  860. @var{key}:@var{value}.
  861. The following values are shown in the output:
  862. @table @option
  863. @item n
  864. The (sequential) number of the input frame, starting from 0.
  865. @item pts
  866. The presentation timestamp of the input frame, in time base units; the time base
  867. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  868. @item pts_time
  869. The presentation timestamp of the input frame in seconds.
  870. @item pos
  871. position of the frame in the input stream, -1 if this information in
  872. unavailable and/or meaningless (for example in case of synthetic audio)
  873. @item fmt
  874. The sample format.
  875. @item chlayout
  876. The channel layout.
  877. @item rate
  878. The sample rate for the audio frame.
  879. @item nb_samples
  880. The number of samples (per channel) in the frame.
  881. @item checksum
  882. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  883. audio, the data is treated as if all the planes were concatenated.
  884. @item plane_checksums
  885. A list of Adler-32 checksums for each data plane.
  886. @end table
  887. @anchor{astats}
  888. @section astats
  889. Display time domain statistical information about the audio channels.
  890. Statistics are calculated and displayed for each audio channel and,
  891. where applicable, an overall figure is also given.
  892. It accepts the following option:
  893. @table @option
  894. @item length
  895. Short window length in seconds, used for peak and trough RMS measurement.
  896. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  897. @item metadata
  898. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  899. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  900. disabled.
  901. Available keys for each channel are:
  902. DC_offset
  903. Min_level
  904. Max_level
  905. Min_difference
  906. Max_difference
  907. Mean_difference
  908. Peak_level
  909. RMS_peak
  910. RMS_trough
  911. Crest_factor
  912. Flat_factor
  913. Peak_count
  914. Bit_depth
  915. and for Overall:
  916. DC_offset
  917. Min_level
  918. Max_level
  919. Min_difference
  920. Max_difference
  921. Mean_difference
  922. Peak_level
  923. RMS_level
  924. RMS_peak
  925. RMS_trough
  926. Flat_factor
  927. Peak_count
  928. Bit_depth
  929. Number_of_samples
  930. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  931. this @code{lavfi.astats.Overall.Peak_count}.
  932. For description what each key means read below.
  933. @item reset
  934. Set number of frame after which stats are going to be recalculated.
  935. Default is disabled.
  936. @end table
  937. A description of each shown parameter follows:
  938. @table @option
  939. @item DC offset
  940. Mean amplitude displacement from zero.
  941. @item Min level
  942. Minimal sample level.
  943. @item Max level
  944. Maximal sample level.
  945. @item Min difference
  946. Minimal difference between two consecutive samples.
  947. @item Max difference
  948. Maximal difference between two consecutive samples.
  949. @item Mean difference
  950. Mean difference between two consecutive samples.
  951. The average of each difference between two consecutive samples.
  952. @item Peak level dB
  953. @item RMS level dB
  954. Standard peak and RMS level measured in dBFS.
  955. @item RMS peak dB
  956. @item RMS trough dB
  957. Peak and trough values for RMS level measured over a short window.
  958. @item Crest factor
  959. Standard ratio of peak to RMS level (note: not in dB).
  960. @item Flat factor
  961. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  962. (i.e. either @var{Min level} or @var{Max level}).
  963. @item Peak count
  964. Number of occasions (not the number of samples) that the signal attained either
  965. @var{Min level} or @var{Max level}.
  966. @item Bit depth
  967. Overall bit depth of audio. Number of bits used for each sample.
  968. @end table
  969. @section asyncts
  970. Synchronize audio data with timestamps by squeezing/stretching it and/or
  971. dropping samples/adding silence when needed.
  972. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  973. It accepts the following parameters:
  974. @table @option
  975. @item compensate
  976. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  977. by default. When disabled, time gaps are covered with silence.
  978. @item min_delta
  979. The minimum difference between timestamps and audio data (in seconds) to trigger
  980. adding/dropping samples. The default value is 0.1. If you get an imperfect
  981. sync with this filter, try setting this parameter to 0.
  982. @item max_comp
  983. The maximum compensation in samples per second. Only relevant with compensate=1.
  984. The default value is 500.
  985. @item first_pts
  986. Assume that the first PTS should be this value. The time base is 1 / sample
  987. rate. This allows for padding/trimming at the start of the stream. By default,
  988. no assumption is made about the first frame's expected PTS, so no padding or
  989. trimming is done. For example, this could be set to 0 to pad the beginning with
  990. silence if an audio stream starts after the video stream or to trim any samples
  991. with a negative PTS due to encoder delay.
  992. @end table
  993. @section atempo
  994. Adjust audio tempo.
  995. The filter accepts exactly one parameter, the audio tempo. If not
  996. specified then the filter will assume nominal 1.0 tempo. Tempo must
  997. be in the [0.5, 2.0] range.
  998. @subsection Examples
  999. @itemize
  1000. @item
  1001. Slow down audio to 80% tempo:
  1002. @example
  1003. atempo=0.8
  1004. @end example
  1005. @item
  1006. To speed up audio to 125% tempo:
  1007. @example
  1008. atempo=1.25
  1009. @end example
  1010. @end itemize
  1011. @section atrim
  1012. Trim the input so that the output contains one continuous subpart of the input.
  1013. It accepts the following parameters:
  1014. @table @option
  1015. @item start
  1016. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1017. sample with the timestamp @var{start} will be the first sample in the output.
  1018. @item end
  1019. Specify time of the first audio sample that will be dropped, i.e. the
  1020. audio sample immediately preceding the one with the timestamp @var{end} will be
  1021. the last sample in the output.
  1022. @item start_pts
  1023. Same as @var{start}, except this option sets the start timestamp in samples
  1024. instead of seconds.
  1025. @item end_pts
  1026. Same as @var{end}, except this option sets the end timestamp in samples instead
  1027. of seconds.
  1028. @item duration
  1029. The maximum duration of the output in seconds.
  1030. @item start_sample
  1031. The number of the first sample that should be output.
  1032. @item end_sample
  1033. The number of the first sample that should be dropped.
  1034. @end table
  1035. @option{start}, @option{end}, and @option{duration} are expressed as time
  1036. duration specifications; see
  1037. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1038. Note that the first two sets of the start/end options and the @option{duration}
  1039. option look at the frame timestamp, while the _sample options simply count the
  1040. samples that pass through the filter. So start/end_pts and start/end_sample will
  1041. give different results when the timestamps are wrong, inexact or do not start at
  1042. zero. Also note that this filter does not modify the timestamps. If you wish
  1043. to have the output timestamps start at zero, insert the asetpts filter after the
  1044. atrim filter.
  1045. If multiple start or end options are set, this filter tries to be greedy and
  1046. keep all samples that match at least one of the specified constraints. To keep
  1047. only the part that matches all the constraints at once, chain multiple atrim
  1048. filters.
  1049. The defaults are such that all the input is kept. So it is possible to set e.g.
  1050. just the end values to keep everything before the specified time.
  1051. Examples:
  1052. @itemize
  1053. @item
  1054. Drop everything except the second minute of input:
  1055. @example
  1056. ffmpeg -i INPUT -af atrim=60:120
  1057. @end example
  1058. @item
  1059. Keep only the first 1000 samples:
  1060. @example
  1061. ffmpeg -i INPUT -af atrim=end_sample=1000
  1062. @end example
  1063. @end itemize
  1064. @section bandpass
  1065. Apply a two-pole Butterworth band-pass filter with central
  1066. frequency @var{frequency}, and (3dB-point) band-width width.
  1067. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1068. instead of the default: constant 0dB peak gain.
  1069. The filter roll off at 6dB per octave (20dB per decade).
  1070. The filter accepts the following options:
  1071. @table @option
  1072. @item frequency, f
  1073. Set the filter's central frequency. Default is @code{3000}.
  1074. @item csg
  1075. Constant skirt gain if set to 1. Defaults to 0.
  1076. @item width_type
  1077. Set method to specify band-width of filter.
  1078. @table @option
  1079. @item h
  1080. Hz
  1081. @item q
  1082. Q-Factor
  1083. @item o
  1084. octave
  1085. @item s
  1086. slope
  1087. @end table
  1088. @item width, w
  1089. Specify the band-width of a filter in width_type units.
  1090. @end table
  1091. @section bandreject
  1092. Apply a two-pole Butterworth band-reject filter with central
  1093. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1094. The filter roll off at 6dB per octave (20dB per decade).
  1095. The filter accepts the following options:
  1096. @table @option
  1097. @item frequency, f
  1098. Set the filter's central frequency. Default is @code{3000}.
  1099. @item width_type
  1100. Set method to specify band-width of filter.
  1101. @table @option
  1102. @item h
  1103. Hz
  1104. @item q
  1105. Q-Factor
  1106. @item o
  1107. octave
  1108. @item s
  1109. slope
  1110. @end table
  1111. @item width, w
  1112. Specify the band-width of a filter in width_type units.
  1113. @end table
  1114. @section bass
  1115. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1116. shelving filter with a response similar to that of a standard
  1117. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1118. The filter accepts the following options:
  1119. @table @option
  1120. @item gain, g
  1121. Give the gain at 0 Hz. Its useful range is about -20
  1122. (for a large cut) to +20 (for a large boost).
  1123. Beware of clipping when using a positive gain.
  1124. @item frequency, f
  1125. Set the filter's central frequency and so can be used
  1126. to extend or reduce the frequency range to be boosted or cut.
  1127. The default value is @code{100} Hz.
  1128. @item width_type
  1129. Set method to specify band-width of filter.
  1130. @table @option
  1131. @item h
  1132. Hz
  1133. @item q
  1134. Q-Factor
  1135. @item o
  1136. octave
  1137. @item s
  1138. slope
  1139. @end table
  1140. @item width, w
  1141. Determine how steep is the filter's shelf transition.
  1142. @end table
  1143. @section biquad
  1144. Apply a biquad IIR filter with the given coefficients.
  1145. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1146. are the numerator and denominator coefficients respectively.
  1147. @section bs2b
  1148. Bauer stereo to binaural transformation, which improves headphone listening of
  1149. stereo audio records.
  1150. It accepts the following parameters:
  1151. @table @option
  1152. @item profile
  1153. Pre-defined crossfeed level.
  1154. @table @option
  1155. @item default
  1156. Default level (fcut=700, feed=50).
  1157. @item cmoy
  1158. Chu Moy circuit (fcut=700, feed=60).
  1159. @item jmeier
  1160. Jan Meier circuit (fcut=650, feed=95).
  1161. @end table
  1162. @item fcut
  1163. Cut frequency (in Hz).
  1164. @item feed
  1165. Feed level (in Hz).
  1166. @end table
  1167. @section channelmap
  1168. Remap input channels to new locations.
  1169. It accepts the following parameters:
  1170. @table @option
  1171. @item channel_layout
  1172. The channel layout of the output stream.
  1173. @item map
  1174. Map channels from input to output. The argument is a '|'-separated list of
  1175. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1176. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1177. channel (e.g. FL for front left) or its index in the input channel layout.
  1178. @var{out_channel} is the name of the output channel or its index in the output
  1179. channel layout. If @var{out_channel} is not given then it is implicitly an
  1180. index, starting with zero and increasing by one for each mapping.
  1181. @end table
  1182. If no mapping is present, the filter will implicitly map input channels to
  1183. output channels, preserving indices.
  1184. For example, assuming a 5.1+downmix input MOV file,
  1185. @example
  1186. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1187. @end example
  1188. will create an output WAV file tagged as stereo from the downmix channels of
  1189. the input.
  1190. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1191. @example
  1192. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1193. @end example
  1194. @section channelsplit
  1195. Split each channel from an input audio stream into a separate output stream.
  1196. It accepts the following parameters:
  1197. @table @option
  1198. @item channel_layout
  1199. The channel layout of the input stream. The default is "stereo".
  1200. @end table
  1201. For example, assuming a stereo input MP3 file,
  1202. @example
  1203. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1204. @end example
  1205. will create an output Matroska file with two audio streams, one containing only
  1206. the left channel and the other the right channel.
  1207. Split a 5.1 WAV file into per-channel files:
  1208. @example
  1209. ffmpeg -i in.wav -filter_complex
  1210. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1211. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1212. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1213. side_right.wav
  1214. @end example
  1215. @section chorus
  1216. Add a chorus effect to the audio.
  1217. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1218. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1219. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1220. The modulation depth defines the range the modulated delay is played before or after
  1221. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1222. sound tuned around the original one, like in a chorus where some vocals are slightly
  1223. off key.
  1224. It accepts the following parameters:
  1225. @table @option
  1226. @item in_gain
  1227. Set input gain. Default is 0.4.
  1228. @item out_gain
  1229. Set output gain. Default is 0.4.
  1230. @item delays
  1231. Set delays. A typical delay is around 40ms to 60ms.
  1232. @item decays
  1233. Set decays.
  1234. @item speeds
  1235. Set speeds.
  1236. @item depths
  1237. Set depths.
  1238. @end table
  1239. @subsection Examples
  1240. @itemize
  1241. @item
  1242. A single delay:
  1243. @example
  1244. chorus=0.7:0.9:55:0.4:0.25:2
  1245. @end example
  1246. @item
  1247. Two delays:
  1248. @example
  1249. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1250. @end example
  1251. @item
  1252. Fuller sounding chorus with three delays:
  1253. @example
  1254. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1255. @end example
  1256. @end itemize
  1257. @section compand
  1258. Compress or expand the audio's dynamic range.
  1259. It accepts the following parameters:
  1260. @table @option
  1261. @item attacks
  1262. @item decays
  1263. A list of times in seconds for each channel over which the instantaneous level
  1264. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1265. increase of volume and @var{decays} refers to decrease of volume. For most
  1266. situations, the attack time (response to the audio getting louder) should be
  1267. shorter than the decay time, because the human ear is more sensitive to sudden
  1268. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1269. a typical value for decay is 0.8 seconds.
  1270. If specified number of attacks & decays is lower than number of channels, the last
  1271. set attack/decay will be used for all remaining channels.
  1272. @item points
  1273. A list of points for the transfer function, specified in dB relative to the
  1274. maximum possible signal amplitude. Each key points list must be defined using
  1275. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1276. @code{x0/y0 x1/y1 x2/y2 ....}
  1277. The input values must be in strictly increasing order but the transfer function
  1278. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1279. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1280. function are @code{-70/-70|-60/-20}.
  1281. @item soft-knee
  1282. Set the curve radius in dB for all joints. It defaults to 0.01.
  1283. @item gain
  1284. Set the additional gain in dB to be applied at all points on the transfer
  1285. function. This allows for easy adjustment of the overall gain.
  1286. It defaults to 0.
  1287. @item volume
  1288. Set an initial volume, in dB, to be assumed for each channel when filtering
  1289. starts. This permits the user to supply a nominal level initially, so that, for
  1290. example, a very large gain is not applied to initial signal levels before the
  1291. companding has begun to operate. A typical value for audio which is initially
  1292. quiet is -90 dB. It defaults to 0.
  1293. @item delay
  1294. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1295. delayed before being fed to the volume adjuster. Specifying a delay
  1296. approximately equal to the attack/decay times allows the filter to effectively
  1297. operate in predictive rather than reactive mode. It defaults to 0.
  1298. @end table
  1299. @subsection Examples
  1300. @itemize
  1301. @item
  1302. Make music with both quiet and loud passages suitable for listening to in a
  1303. noisy environment:
  1304. @example
  1305. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1306. @end example
  1307. Another example for audio with whisper and explosion parts:
  1308. @example
  1309. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1310. @end example
  1311. @item
  1312. A noise gate for when the noise is at a lower level than the signal:
  1313. @example
  1314. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1315. @end example
  1316. @item
  1317. Here is another noise gate, this time for when the noise is at a higher level
  1318. than the signal (making it, in some ways, similar to squelch):
  1319. @example
  1320. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1321. @end example
  1322. @end itemize
  1323. @section compensationdelay
  1324. Compensation Delay Line is a metric based delay to compensate differing
  1325. positions of microphones or speakers.
  1326. For example, you have recorded guitar with two microphones placed in
  1327. different location. Because the front of sound wave has fixed speed in
  1328. normal conditions, the phasing of microphones can vary and depends on
  1329. their location and interposition. The best sound mix can be achieved when
  1330. these microphones are in phase (synchronized). Note that distance of
  1331. ~30 cm between microphones makes one microphone to capture signal in
  1332. antiphase to another microphone. That makes the final mix sounding moody.
  1333. This filter helps to solve phasing problems by adding different delays
  1334. to each microphone track and make them synchronized.
  1335. The best result can be reached when you take one track as base and
  1336. synchronize other tracks one by one with it.
  1337. Remember that synchronization/delay tolerance depends on sample rate, too.
  1338. Higher sample rates will give more tolerance.
  1339. It accepts the following parameters:
  1340. @table @option
  1341. @item mm
  1342. Set millimeters distance. This is compensation distance for fine tuning.
  1343. Default is 0.
  1344. @item cm
  1345. Set cm distance. This is compensation distance for tightening distance setup.
  1346. Default is 0.
  1347. @item m
  1348. Set meters distance. This is compensation distance for hard distance setup.
  1349. Default is 0.
  1350. @item dry
  1351. Set dry amount. Amount of unprocessed (dry) signal.
  1352. Default is 0.
  1353. @item wet
  1354. Set wet amount. Amount of processed (wet) signal.
  1355. Default is 1.
  1356. @item temp
  1357. Set temperature degree in Celsius. This is the temperature of the environment.
  1358. Default is 20.
  1359. @end table
  1360. @section dcshift
  1361. Apply a DC shift to the audio.
  1362. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1363. in the recording chain) from the audio. The effect of a DC offset is reduced
  1364. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1365. a signal has a DC offset.
  1366. @table @option
  1367. @item shift
  1368. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1369. the audio.
  1370. @item limitergain
  1371. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1372. used to prevent clipping.
  1373. @end table
  1374. @section dynaudnorm
  1375. Dynamic Audio Normalizer.
  1376. This filter applies a certain amount of gain to the input audio in order
  1377. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1378. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1379. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1380. This allows for applying extra gain to the "quiet" sections of the audio
  1381. while avoiding distortions or clipping the "loud" sections. In other words:
  1382. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1383. sections, in the sense that the volume of each section is brought to the
  1384. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1385. this goal *without* applying "dynamic range compressing". It will retain 100%
  1386. of the dynamic range *within* each section of the audio file.
  1387. @table @option
  1388. @item f
  1389. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1390. Default is 500 milliseconds.
  1391. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1392. referred to as frames. This is required, because a peak magnitude has no
  1393. meaning for just a single sample value. Instead, we need to determine the
  1394. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1395. normalizer would simply use the peak magnitude of the complete file, the
  1396. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1397. frame. The length of a frame is specified in milliseconds. By default, the
  1398. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1399. been found to give good results with most files.
  1400. Note that the exact frame length, in number of samples, will be determined
  1401. automatically, based on the sampling rate of the individual input audio file.
  1402. @item g
  1403. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1404. number. Default is 31.
  1405. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1406. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1407. is specified in frames, centered around the current frame. For the sake of
  1408. simplicity, this must be an odd number. Consequently, the default value of 31
  1409. takes into account the current frame, as well as the 15 preceding frames and
  1410. the 15 subsequent frames. Using a larger window results in a stronger
  1411. smoothing effect and thus in less gain variation, i.e. slower gain
  1412. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1413. effect and thus in more gain variation, i.e. faster gain adaptation.
  1414. In other words, the more you increase this value, the more the Dynamic Audio
  1415. Normalizer will behave like a "traditional" normalization filter. On the
  1416. contrary, the more you decrease this value, the more the Dynamic Audio
  1417. Normalizer will behave like a dynamic range compressor.
  1418. @item p
  1419. Set the target peak value. This specifies the highest permissible magnitude
  1420. level for the normalized audio input. This filter will try to approach the
  1421. target peak magnitude as closely as possible, but at the same time it also
  1422. makes sure that the normalized signal will never exceed the peak magnitude.
  1423. A frame's maximum local gain factor is imposed directly by the target peak
  1424. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1425. It is not recommended to go above this value.
  1426. @item m
  1427. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1428. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1429. factor for each input frame, i.e. the maximum gain factor that does not
  1430. result in clipping or distortion. The maximum gain factor is determined by
  1431. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1432. additionally bounds the frame's maximum gain factor by a predetermined
  1433. (global) maximum gain factor. This is done in order to avoid excessive gain
  1434. factors in "silent" or almost silent frames. By default, the maximum gain
  1435. factor is 10.0, For most inputs the default value should be sufficient and
  1436. it usually is not recommended to increase this value. Though, for input
  1437. with an extremely low overall volume level, it may be necessary to allow even
  1438. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1439. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1440. Instead, a "sigmoid" threshold function will be applied. This way, the
  1441. gain factors will smoothly approach the threshold value, but never exceed that
  1442. value.
  1443. @item r
  1444. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1445. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1446. This means that the maximum local gain factor for each frame is defined
  1447. (only) by the frame's highest magnitude sample. This way, the samples can
  1448. be amplified as much as possible without exceeding the maximum signal
  1449. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1450. Normalizer can also take into account the frame's root mean square,
  1451. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1452. determine the power of a time-varying signal. It is therefore considered
  1453. that the RMS is a better approximation of the "perceived loudness" than
  1454. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1455. frames to a constant RMS value, a uniform "perceived loudness" can be
  1456. established. If a target RMS value has been specified, a frame's local gain
  1457. factor is defined as the factor that would result in exactly that RMS value.
  1458. Note, however, that the maximum local gain factor is still restricted by the
  1459. frame's highest magnitude sample, in order to prevent clipping.
  1460. @item n
  1461. Enable channels coupling. By default is enabled.
  1462. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1463. amount. This means the same gain factor will be applied to all channels, i.e.
  1464. the maximum possible gain factor is determined by the "loudest" channel.
  1465. However, in some recordings, it may happen that the volume of the different
  1466. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1467. In this case, this option can be used to disable the channel coupling. This way,
  1468. the gain factor will be determined independently for each channel, depending
  1469. only on the individual channel's highest magnitude sample. This allows for
  1470. harmonizing the volume of the different channels.
  1471. @item c
  1472. Enable DC bias correction. By default is disabled.
  1473. An audio signal (in the time domain) is a sequence of sample values.
  1474. In the Dynamic Audio Normalizer these sample values are represented in the
  1475. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1476. audio signal, or "waveform", should be centered around the zero point.
  1477. That means if we calculate the mean value of all samples in a file, or in a
  1478. single frame, then the result should be 0.0 or at least very close to that
  1479. value. If, however, there is a significant deviation of the mean value from
  1480. 0.0, in either positive or negative direction, this is referred to as a
  1481. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1482. Audio Normalizer provides optional DC bias correction.
  1483. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1484. the mean value, or "DC correction" offset, of each input frame and subtract
  1485. that value from all of the frame's sample values which ensures those samples
  1486. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1487. boundaries, the DC correction offset values will be interpolated smoothly
  1488. between neighbouring frames.
  1489. @item b
  1490. Enable alternative boundary mode. By default is disabled.
  1491. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1492. around each frame. This includes the preceding frames as well as the
  1493. subsequent frames. However, for the "boundary" frames, located at the very
  1494. beginning and at the very end of the audio file, not all neighbouring
  1495. frames are available. In particular, for the first few frames in the audio
  1496. file, the preceding frames are not known. And, similarly, for the last few
  1497. frames in the audio file, the subsequent frames are not known. Thus, the
  1498. question arises which gain factors should be assumed for the missing frames
  1499. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1500. to deal with this situation. The default boundary mode assumes a gain factor
  1501. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1502. "fade out" at the beginning and at the end of the input, respectively.
  1503. @item s
  1504. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1505. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1506. compression. This means that signal peaks will not be pruned and thus the
  1507. full dynamic range will be retained within each local neighbourhood. However,
  1508. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1509. normalization algorithm with a more "traditional" compression.
  1510. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1511. (thresholding) function. If (and only if) the compression feature is enabled,
  1512. all input frames will be processed by a soft knee thresholding function prior
  1513. to the actual normalization process. Put simply, the thresholding function is
  1514. going to prune all samples whose magnitude exceeds a certain threshold value.
  1515. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1516. value. Instead, the threshold value will be adjusted for each individual
  1517. frame.
  1518. In general, smaller parameters result in stronger compression, and vice versa.
  1519. Values below 3.0 are not recommended, because audible distortion may appear.
  1520. @end table
  1521. @section earwax
  1522. Make audio easier to listen to on headphones.
  1523. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1524. so that when listened to on headphones the stereo image is moved from
  1525. inside your head (standard for headphones) to outside and in front of
  1526. the listener (standard for speakers).
  1527. Ported from SoX.
  1528. @section equalizer
  1529. Apply a two-pole peaking equalisation (EQ) filter. With this
  1530. filter, the signal-level at and around a selected frequency can
  1531. be increased or decreased, whilst (unlike bandpass and bandreject
  1532. filters) that at all other frequencies is unchanged.
  1533. In order to produce complex equalisation curves, this filter can
  1534. be given several times, each with a different central frequency.
  1535. The filter accepts the following options:
  1536. @table @option
  1537. @item frequency, f
  1538. Set the filter's central frequency in Hz.
  1539. @item width_type
  1540. Set method to specify band-width of filter.
  1541. @table @option
  1542. @item h
  1543. Hz
  1544. @item q
  1545. Q-Factor
  1546. @item o
  1547. octave
  1548. @item s
  1549. slope
  1550. @end table
  1551. @item width, w
  1552. Specify the band-width of a filter in width_type units.
  1553. @item gain, g
  1554. Set the required gain or attenuation in dB.
  1555. Beware of clipping when using a positive gain.
  1556. @end table
  1557. @subsection Examples
  1558. @itemize
  1559. @item
  1560. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1561. @example
  1562. equalizer=f=1000:width_type=h:width=200:g=-10
  1563. @end example
  1564. @item
  1565. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1566. @example
  1567. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1568. @end example
  1569. @end itemize
  1570. @section extrastereo
  1571. Linearly increases the difference between left and right channels which
  1572. adds some sort of "live" effect to playback.
  1573. The filter accepts the following option:
  1574. @table @option
  1575. @item m
  1576. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1577. (average of both channels), with 1.0 sound will be unchanged, with
  1578. -1.0 left and right channels will be swapped.
  1579. @item c
  1580. Enable clipping. By default is enabled.
  1581. @end table
  1582. @section flanger
  1583. Apply a flanging effect to the audio.
  1584. The filter accepts the following options:
  1585. @table @option
  1586. @item delay
  1587. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1588. @item depth
  1589. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1590. @item regen
  1591. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1592. Default value is 0.
  1593. @item width
  1594. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1595. Default value is 71.
  1596. @item speed
  1597. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1598. @item shape
  1599. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1600. Default value is @var{sinusoidal}.
  1601. @item phase
  1602. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1603. Default value is 25.
  1604. @item interp
  1605. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1606. Default is @var{linear}.
  1607. @end table
  1608. @section highpass
  1609. Apply a high-pass filter with 3dB point frequency.
  1610. The filter can be either single-pole, or double-pole (the default).
  1611. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1612. The filter accepts the following options:
  1613. @table @option
  1614. @item frequency, f
  1615. Set frequency in Hz. Default is 3000.
  1616. @item poles, p
  1617. Set number of poles. Default is 2.
  1618. @item width_type
  1619. Set method to specify band-width of filter.
  1620. @table @option
  1621. @item h
  1622. Hz
  1623. @item q
  1624. Q-Factor
  1625. @item o
  1626. octave
  1627. @item s
  1628. slope
  1629. @end table
  1630. @item width, w
  1631. Specify the band-width of a filter in width_type units.
  1632. Applies only to double-pole filter.
  1633. The default is 0.707q and gives a Butterworth response.
  1634. @end table
  1635. @section join
  1636. Join multiple input streams into one multi-channel stream.
  1637. It accepts the following parameters:
  1638. @table @option
  1639. @item inputs
  1640. The number of input streams. It defaults to 2.
  1641. @item channel_layout
  1642. The desired output channel layout. It defaults to stereo.
  1643. @item map
  1644. Map channels from inputs to output. The argument is a '|'-separated list of
  1645. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1646. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1647. can be either the name of the input channel (e.g. FL for front left) or its
  1648. index in the specified input stream. @var{out_channel} is the name of the output
  1649. channel.
  1650. @end table
  1651. The filter will attempt to guess the mappings when they are not specified
  1652. explicitly. It does so by first trying to find an unused matching input channel
  1653. and if that fails it picks the first unused input channel.
  1654. Join 3 inputs (with properly set channel layouts):
  1655. @example
  1656. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1657. @end example
  1658. Build a 5.1 output from 6 single-channel streams:
  1659. @example
  1660. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1661. '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'
  1662. out
  1663. @end example
  1664. @section ladspa
  1665. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1666. To enable compilation of this filter you need to configure FFmpeg with
  1667. @code{--enable-ladspa}.
  1668. @table @option
  1669. @item file, f
  1670. Specifies the name of LADSPA plugin library to load. If the environment
  1671. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1672. each one of the directories specified by the colon separated list in
  1673. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1674. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1675. @file{/usr/lib/ladspa/}.
  1676. @item plugin, p
  1677. Specifies the plugin within the library. Some libraries contain only
  1678. one plugin, but others contain many of them. If this is not set filter
  1679. will list all available plugins within the specified library.
  1680. @item controls, c
  1681. Set the '|' separated list of controls which are zero or more floating point
  1682. values that determine the behavior of the loaded plugin (for example delay,
  1683. threshold or gain).
  1684. Controls need to be defined using the following syntax:
  1685. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1686. @var{valuei} is the value set on the @var{i}-th control.
  1687. Alternatively they can be also defined using the following syntax:
  1688. @var{value0}|@var{value1}|@var{value2}|..., where
  1689. @var{valuei} is the value set on the @var{i}-th control.
  1690. If @option{controls} is set to @code{help}, all available controls and
  1691. their valid ranges are printed.
  1692. @item sample_rate, s
  1693. Specify the sample rate, default to 44100. Only used if plugin have
  1694. zero inputs.
  1695. @item nb_samples, n
  1696. Set the number of samples per channel per each output frame, default
  1697. is 1024. Only used if plugin have zero inputs.
  1698. @item duration, d
  1699. Set the minimum duration of the sourced audio. See
  1700. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1701. for the accepted syntax.
  1702. Note that the resulting duration may be greater than the specified duration,
  1703. as the generated audio is always cut at the end of a complete frame.
  1704. If not specified, or the expressed duration is negative, the audio is
  1705. supposed to be generated forever.
  1706. Only used if plugin have zero inputs.
  1707. @end table
  1708. @subsection Examples
  1709. @itemize
  1710. @item
  1711. List all available plugins within amp (LADSPA example plugin) library:
  1712. @example
  1713. ladspa=file=amp
  1714. @end example
  1715. @item
  1716. List all available controls and their valid ranges for @code{vcf_notch}
  1717. plugin from @code{VCF} library:
  1718. @example
  1719. ladspa=f=vcf:p=vcf_notch:c=help
  1720. @end example
  1721. @item
  1722. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1723. plugin library:
  1724. @example
  1725. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1726. @end example
  1727. @item
  1728. Add reverberation to the audio using TAP-plugins
  1729. (Tom's Audio Processing plugins):
  1730. @example
  1731. ladspa=file=tap_reverb:tap_reverb
  1732. @end example
  1733. @item
  1734. Generate white noise, with 0.2 amplitude:
  1735. @example
  1736. ladspa=file=cmt:noise_source_white:c=c0=.2
  1737. @end example
  1738. @item
  1739. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1740. @code{C* Audio Plugin Suite} (CAPS) library:
  1741. @example
  1742. ladspa=file=caps:Click:c=c1=20'
  1743. @end example
  1744. @item
  1745. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1746. @example
  1747. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1748. @end example
  1749. @item
  1750. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1751. @code{SWH Plugins} collection:
  1752. @example
  1753. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1754. @end example
  1755. @item
  1756. Attenuate low frequencies using Multiband EQ from Steve Harris
  1757. @code{SWH Plugins} collection:
  1758. @example
  1759. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1760. @end example
  1761. @end itemize
  1762. @subsection Commands
  1763. This filter supports the following commands:
  1764. @table @option
  1765. @item cN
  1766. Modify the @var{N}-th control value.
  1767. If the specified value is not valid, it is ignored and prior one is kept.
  1768. @end table
  1769. @section lowpass
  1770. Apply a low-pass filter with 3dB point frequency.
  1771. The filter can be either single-pole or double-pole (the default).
  1772. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1773. The filter accepts the following options:
  1774. @table @option
  1775. @item frequency, f
  1776. Set frequency in Hz. Default is 500.
  1777. @item poles, p
  1778. Set number of poles. Default is 2.
  1779. @item width_type
  1780. Set method to specify band-width of filter.
  1781. @table @option
  1782. @item h
  1783. Hz
  1784. @item q
  1785. Q-Factor
  1786. @item o
  1787. octave
  1788. @item s
  1789. slope
  1790. @end table
  1791. @item width, w
  1792. Specify the band-width of a filter in width_type units.
  1793. Applies only to double-pole filter.
  1794. The default is 0.707q and gives a Butterworth response.
  1795. @end table
  1796. @anchor{pan}
  1797. @section pan
  1798. Mix channels with specific gain levels. The filter accepts the output
  1799. channel layout followed by a set of channels definitions.
  1800. This filter is also designed to efficiently remap the channels of an audio
  1801. stream.
  1802. The filter accepts parameters of the form:
  1803. "@var{l}|@var{outdef}|@var{outdef}|..."
  1804. @table @option
  1805. @item l
  1806. output channel layout or number of channels
  1807. @item outdef
  1808. output channel specification, of the form:
  1809. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1810. @item out_name
  1811. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1812. number (c0, c1, etc.)
  1813. @item gain
  1814. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1815. @item in_name
  1816. input channel to use, see out_name for details; it is not possible to mix
  1817. named and numbered input channels
  1818. @end table
  1819. If the `=' in a channel specification is replaced by `<', then the gains for
  1820. that specification will be renormalized so that the total is 1, thus
  1821. avoiding clipping noise.
  1822. @subsection Mixing examples
  1823. For example, if you want to down-mix from stereo to mono, but with a bigger
  1824. factor for the left channel:
  1825. @example
  1826. pan=1c|c0=0.9*c0+0.1*c1
  1827. @end example
  1828. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1829. 7-channels surround:
  1830. @example
  1831. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1832. @end example
  1833. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1834. that should be preferred (see "-ac" option) unless you have very specific
  1835. needs.
  1836. @subsection Remapping examples
  1837. The channel remapping will be effective if, and only if:
  1838. @itemize
  1839. @item gain coefficients are zeroes or ones,
  1840. @item only one input per channel output,
  1841. @end itemize
  1842. If all these conditions are satisfied, the filter will notify the user ("Pure
  1843. channel mapping detected"), and use an optimized and lossless method to do the
  1844. remapping.
  1845. For example, if you have a 5.1 source and want a stereo audio stream by
  1846. dropping the extra channels:
  1847. @example
  1848. pan="stereo| c0=FL | c1=FR"
  1849. @end example
  1850. Given the same source, you can also switch front left and front right channels
  1851. and keep the input channel layout:
  1852. @example
  1853. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  1854. @end example
  1855. If the input is a stereo audio stream, you can mute the front left channel (and
  1856. still keep the stereo channel layout) with:
  1857. @example
  1858. pan="stereo|c1=c1"
  1859. @end example
  1860. Still with a stereo audio stream input, you can copy the right channel in both
  1861. front left and right:
  1862. @example
  1863. pan="stereo| c0=FR | c1=FR"
  1864. @end example
  1865. @section replaygain
  1866. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1867. outputs it unchanged.
  1868. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1869. @section resample
  1870. Convert the audio sample format, sample rate and channel layout. It is
  1871. not meant to be used directly.
  1872. @section rubberband
  1873. Apply time-stretching and pitch-shifting with librubberband.
  1874. The filter accepts the following options:
  1875. @table @option
  1876. @item tempo
  1877. Set tempo scale factor.
  1878. @item pitch
  1879. Set pitch scale factor.
  1880. @item transients
  1881. Set transients detector.
  1882. Possible values are:
  1883. @table @var
  1884. @item crisp
  1885. @item mixed
  1886. @item smooth
  1887. @end table
  1888. @item detector
  1889. Set detector.
  1890. Possible values are:
  1891. @table @var
  1892. @item compound
  1893. @item percussive
  1894. @item soft
  1895. @end table
  1896. @item phase
  1897. Set phase.
  1898. Possible values are:
  1899. @table @var
  1900. @item laminar
  1901. @item independent
  1902. @end table
  1903. @item window
  1904. Set processing window size.
  1905. Possible values are:
  1906. @table @var
  1907. @item standard
  1908. @item short
  1909. @item long
  1910. @end table
  1911. @item smoothing
  1912. Set smoothing.
  1913. Possible values are:
  1914. @table @var
  1915. @item off
  1916. @item on
  1917. @end table
  1918. @item formant
  1919. Enable formant preservation when shift pitching.
  1920. Possible values are:
  1921. @table @var
  1922. @item shifted
  1923. @item preserved
  1924. @end table
  1925. @item pitchq
  1926. Set pitch quality.
  1927. Possible values are:
  1928. @table @var
  1929. @item quality
  1930. @item speed
  1931. @item consistency
  1932. @end table
  1933. @item channels
  1934. Set channels.
  1935. Possible values are:
  1936. @table @var
  1937. @item apart
  1938. @item together
  1939. @end table
  1940. @end table
  1941. @section sidechaincompress
  1942. This filter acts like normal compressor but has the ability to compress
  1943. detected signal using second input signal.
  1944. It needs two input streams and returns one output stream.
  1945. First input stream will be processed depending on second stream signal.
  1946. The filtered signal then can be filtered with other filters in later stages of
  1947. processing. See @ref{pan} and @ref{amerge} filter.
  1948. The filter accepts the following options:
  1949. @table @option
  1950. @item threshold
  1951. If a signal of second stream raises above this level it will affect the gain
  1952. reduction of first stream.
  1953. By default is 0.125. Range is between 0.00097563 and 1.
  1954. @item ratio
  1955. Set a ratio about which the signal is reduced. 1:2 means that if the level
  1956. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  1957. Default is 2. Range is between 1 and 20.
  1958. @item attack
  1959. Amount of milliseconds the signal has to rise above the threshold before gain
  1960. reduction starts. Default is 20. Range is between 0.01 and 2000.
  1961. @item release
  1962. Amount of milliseconds the signal has to fall below the threshold before
  1963. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  1964. @item makeup
  1965. Set the amount by how much signal will be amplified after processing.
  1966. Default is 2. Range is from 1 and 64.
  1967. @item knee
  1968. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1969. Default is 2.82843. Range is between 1 and 8.
  1970. @item link
  1971. Choose if the @code{average} level between all channels of side-chain stream
  1972. or the louder(@code{maximum}) channel of side-chain stream affects the
  1973. reduction. Default is @code{average}.
  1974. @item detection
  1975. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  1976. of @code{rms}. Default is @code{rms} which is mainly smoother.
  1977. @item mix
  1978. How much to use compressed signal in output. Default is 1.
  1979. Range is between 0 and 1.
  1980. @end table
  1981. @subsection Examples
  1982. @itemize
  1983. @item
  1984. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  1985. depending on the signal of 2nd input and later compressed signal to be
  1986. merged with 2nd input:
  1987. @example
  1988. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  1989. @end example
  1990. @end itemize
  1991. @section silencedetect
  1992. Detect silence in an audio stream.
  1993. This filter logs a message when it detects that the input audio volume is less
  1994. or equal to a noise tolerance value for a duration greater or equal to the
  1995. minimum detected noise duration.
  1996. The printed times and duration are expressed in seconds.
  1997. The filter accepts the following options:
  1998. @table @option
  1999. @item duration, d
  2000. Set silence duration until notification (default is 2 seconds).
  2001. @item noise, n
  2002. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2003. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2004. @end table
  2005. @subsection Examples
  2006. @itemize
  2007. @item
  2008. Detect 5 seconds of silence with -50dB noise tolerance:
  2009. @example
  2010. silencedetect=n=-50dB:d=5
  2011. @end example
  2012. @item
  2013. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2014. tolerance in @file{silence.mp3}:
  2015. @example
  2016. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2017. @end example
  2018. @end itemize
  2019. @section silenceremove
  2020. Remove silence from the beginning, middle or end of the audio.
  2021. The filter accepts the following options:
  2022. @table @option
  2023. @item start_periods
  2024. This value is used to indicate if audio should be trimmed at beginning of
  2025. the audio. A value of zero indicates no silence should be trimmed from the
  2026. beginning. When specifying a non-zero value, it trims audio up until it
  2027. finds non-silence. Normally, when trimming silence from beginning of audio
  2028. the @var{start_periods} will be @code{1} but it can be increased to higher
  2029. values to trim all audio up to specific count of non-silence periods.
  2030. Default value is @code{0}.
  2031. @item start_duration
  2032. Specify the amount of time that non-silence must be detected before it stops
  2033. trimming audio. By increasing the duration, bursts of noises can be treated
  2034. as silence and trimmed off. Default value is @code{0}.
  2035. @item start_threshold
  2036. This indicates what sample value should be treated as silence. For digital
  2037. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2038. you may wish to increase the value to account for background noise.
  2039. Can be specified in dB (in case "dB" is appended to the specified value)
  2040. or amplitude ratio. Default value is @code{0}.
  2041. @item stop_periods
  2042. Set the count for trimming silence from the end of audio.
  2043. To remove silence from the middle of a file, specify a @var{stop_periods}
  2044. that is negative. This value is then treated as a positive value and is
  2045. used to indicate the effect should restart processing as specified by
  2046. @var{start_periods}, making it suitable for removing periods of silence
  2047. in the middle of the audio.
  2048. Default value is @code{0}.
  2049. @item stop_duration
  2050. Specify a duration of silence that must exist before audio is not copied any
  2051. more. By specifying a higher duration, silence that is wanted can be left in
  2052. the audio.
  2053. Default value is @code{0}.
  2054. @item stop_threshold
  2055. This is the same as @option{start_threshold} but for trimming silence from
  2056. the end of audio.
  2057. Can be specified in dB (in case "dB" is appended to the specified value)
  2058. or amplitude ratio. Default value is @code{0}.
  2059. @item leave_silence
  2060. This indicate that @var{stop_duration} length of audio should be left intact
  2061. at the beginning of each period of silence.
  2062. For example, if you want to remove long pauses between words but do not want
  2063. to remove the pauses completely. Default value is @code{0}.
  2064. @end table
  2065. @subsection Examples
  2066. @itemize
  2067. @item
  2068. The following example shows how this filter can be used to start a recording
  2069. that does not contain the delay at the start which usually occurs between
  2070. pressing the record button and the start of the performance:
  2071. @example
  2072. silenceremove=1:5:0.02
  2073. @end example
  2074. @end itemize
  2075. @section stereotools
  2076. This filter has some handy utilities to manage stereo signals, for converting
  2077. M/S stereo recordings to L/R signal while having control over the parameters
  2078. or spreading the stereo image of master track.
  2079. The filter accepts the following options:
  2080. @table @option
  2081. @item level_in
  2082. Set input level before filtering for both channels. Defaults is 1.
  2083. Allowed range is from 0.015625 to 64.
  2084. @item level_out
  2085. Set output level after filtering for both channels. Defaults is 1.
  2086. Allowed range is from 0.015625 to 64.
  2087. @item balance_in
  2088. Set input balance between both channels. Default is 0.
  2089. Allowed range is from -1 to 1.
  2090. @item balance_out
  2091. Set output balance between both channels. Default is 0.
  2092. Allowed range is from -1 to 1.
  2093. @item softclip
  2094. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2095. clipping. Disabled by default.
  2096. @item mutel
  2097. Mute the left channel. Disabled by default.
  2098. @item muter
  2099. Mute the right channel. Disabled by default.
  2100. @item phasel
  2101. Change the phase of the left channel. Disabled by default.
  2102. @item phaser
  2103. Change the phase of the right channel. Disabled by default.
  2104. @item mode
  2105. Set stereo mode. Available values are:
  2106. @table @samp
  2107. @item lr>lr
  2108. Left/Right to Left/Right, this is default.
  2109. @item lr>ms
  2110. Left/Right to Mid/Side.
  2111. @item ms>lr
  2112. Mid/Side to Left/Right.
  2113. @item lr>ll
  2114. Left/Right to Left/Left.
  2115. @item lr>rr
  2116. Left/Right to Right/Right.
  2117. @item lr>l+r
  2118. Left/Right to Left + Right.
  2119. @item lr>rl
  2120. Left/Right to Right/Left.
  2121. @end table
  2122. @item slev
  2123. Set level of side signal. Default is 1.
  2124. Allowed range is from 0.015625 to 64.
  2125. @item sbal
  2126. Set balance of side signal. Default is 0.
  2127. Allowed range is from -1 to 1.
  2128. @item mlev
  2129. Set level of the middle signal. Default is 1.
  2130. Allowed range is from 0.015625 to 64.
  2131. @item mpan
  2132. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2133. @item base
  2134. Set stereo base between mono and inversed channels. Default is 0.
  2135. Allowed range is from -1 to 1.
  2136. @item delay
  2137. Set delay in milliseconds how much to delay left from right channel and
  2138. vice versa. Default is 0. Allowed range is from -20 to 20.
  2139. @item sclevel
  2140. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2141. @item phase
  2142. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2143. @end table
  2144. @section stereowiden
  2145. This filter enhance the stereo effect by suppressing signal common to both
  2146. channels and by delaying the signal of left into right and vice versa,
  2147. thereby widening the stereo effect.
  2148. The filter accepts the following options:
  2149. @table @option
  2150. @item delay
  2151. Time in milliseconds of the delay of left signal into right and vice versa.
  2152. Default is 20 milliseconds.
  2153. @item feedback
  2154. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2155. effect of left signal in right output and vice versa which gives widening
  2156. effect. Default is 0.3.
  2157. @item crossfeed
  2158. Cross feed of left into right with inverted phase. This helps in suppressing
  2159. the mono. If the value is 1 it will cancel all the signal common to both
  2160. channels. Default is 0.3.
  2161. @item drymix
  2162. Set level of input signal of original channel. Default is 0.8.
  2163. @end table
  2164. @section treble
  2165. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2166. shelving filter with a response similar to that of a standard
  2167. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2168. The filter accepts the following options:
  2169. @table @option
  2170. @item gain, g
  2171. Give the gain at whichever is the lower of ~22 kHz and the
  2172. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2173. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2174. @item frequency, f
  2175. Set the filter's central frequency and so can be used
  2176. to extend or reduce the frequency range to be boosted or cut.
  2177. The default value is @code{3000} Hz.
  2178. @item width_type
  2179. Set method to specify band-width of filter.
  2180. @table @option
  2181. @item h
  2182. Hz
  2183. @item q
  2184. Q-Factor
  2185. @item o
  2186. octave
  2187. @item s
  2188. slope
  2189. @end table
  2190. @item width, w
  2191. Determine how steep is the filter's shelf transition.
  2192. @end table
  2193. @section tremolo
  2194. Sinusoidal amplitude modulation.
  2195. The filter accepts the following options:
  2196. @table @option
  2197. @item f
  2198. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2199. (20 Hz or lower) will result in a tremolo effect.
  2200. This filter may also be used as a ring modulator by specifying
  2201. a modulation frequency higher than 20 Hz.
  2202. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2203. @item d
  2204. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2205. Default value is 0.5.
  2206. @end table
  2207. @section vibrato
  2208. Sinusoidal phase modulation.
  2209. The filter accepts the following options:
  2210. @table @option
  2211. @item f
  2212. Modulation frequency in Hertz.
  2213. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2214. @item d
  2215. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2216. Default value is 0.5.
  2217. @end table
  2218. @section volume
  2219. Adjust the input audio volume.
  2220. It accepts the following parameters:
  2221. @table @option
  2222. @item volume
  2223. Set audio volume expression.
  2224. Output values are clipped to the maximum value.
  2225. The output audio volume is given by the relation:
  2226. @example
  2227. @var{output_volume} = @var{volume} * @var{input_volume}
  2228. @end example
  2229. The default value for @var{volume} is "1.0".
  2230. @item precision
  2231. This parameter represents the mathematical precision.
  2232. It determines which input sample formats will be allowed, which affects the
  2233. precision of the volume scaling.
  2234. @table @option
  2235. @item fixed
  2236. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2237. @item float
  2238. 32-bit floating-point; this limits input sample format to FLT. (default)
  2239. @item double
  2240. 64-bit floating-point; this limits input sample format to DBL.
  2241. @end table
  2242. @item replaygain
  2243. Choose the behaviour on encountering ReplayGain side data in input frames.
  2244. @table @option
  2245. @item drop
  2246. Remove ReplayGain side data, ignoring its contents (the default).
  2247. @item ignore
  2248. Ignore ReplayGain side data, but leave it in the frame.
  2249. @item track
  2250. Prefer the track gain, if present.
  2251. @item album
  2252. Prefer the album gain, if present.
  2253. @end table
  2254. @item replaygain_preamp
  2255. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2256. Default value for @var{replaygain_preamp} is 0.0.
  2257. @item eval
  2258. Set when the volume expression is evaluated.
  2259. It accepts the following values:
  2260. @table @samp
  2261. @item once
  2262. only evaluate expression once during the filter initialization, or
  2263. when the @samp{volume} command is sent
  2264. @item frame
  2265. evaluate expression for each incoming frame
  2266. @end table
  2267. Default value is @samp{once}.
  2268. @end table
  2269. The volume expression can contain the following parameters.
  2270. @table @option
  2271. @item n
  2272. frame number (starting at zero)
  2273. @item nb_channels
  2274. number of channels
  2275. @item nb_consumed_samples
  2276. number of samples consumed by the filter
  2277. @item nb_samples
  2278. number of samples in the current frame
  2279. @item pos
  2280. original frame position in the file
  2281. @item pts
  2282. frame PTS
  2283. @item sample_rate
  2284. sample rate
  2285. @item startpts
  2286. PTS at start of stream
  2287. @item startt
  2288. time at start of stream
  2289. @item t
  2290. frame time
  2291. @item tb
  2292. timestamp timebase
  2293. @item volume
  2294. last set volume value
  2295. @end table
  2296. Note that when @option{eval} is set to @samp{once} only the
  2297. @var{sample_rate} and @var{tb} variables are available, all other
  2298. variables will evaluate to NAN.
  2299. @subsection Commands
  2300. This filter supports the following commands:
  2301. @table @option
  2302. @item volume
  2303. Modify the volume expression.
  2304. The command accepts the same syntax of the corresponding option.
  2305. If the specified expression is not valid, it is kept at its current
  2306. value.
  2307. @item replaygain_noclip
  2308. Prevent clipping by limiting the gain applied.
  2309. Default value for @var{replaygain_noclip} is 1.
  2310. @end table
  2311. @subsection Examples
  2312. @itemize
  2313. @item
  2314. Halve the input audio volume:
  2315. @example
  2316. volume=volume=0.5
  2317. volume=volume=1/2
  2318. volume=volume=-6.0206dB
  2319. @end example
  2320. In all the above example the named key for @option{volume} can be
  2321. omitted, for example like in:
  2322. @example
  2323. volume=0.5
  2324. @end example
  2325. @item
  2326. Increase input audio power by 6 decibels using fixed-point precision:
  2327. @example
  2328. volume=volume=6dB:precision=fixed
  2329. @end example
  2330. @item
  2331. Fade volume after time 10 with an annihilation period of 5 seconds:
  2332. @example
  2333. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2334. @end example
  2335. @end itemize
  2336. @section volumedetect
  2337. Detect the volume of the input video.
  2338. The filter has no parameters. The input is not modified. Statistics about
  2339. the volume will be printed in the log when the input stream end is reached.
  2340. In particular it will show the mean volume (root mean square), maximum
  2341. volume (on a per-sample basis), and the beginning of a histogram of the
  2342. registered volume values (from the maximum value to a cumulated 1/1000 of
  2343. the samples).
  2344. All volumes are in decibels relative to the maximum PCM value.
  2345. @subsection Examples
  2346. Here is an excerpt of the output:
  2347. @example
  2348. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2349. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2350. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2351. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2352. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2353. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2354. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2355. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2356. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2357. @end example
  2358. It means that:
  2359. @itemize
  2360. @item
  2361. The mean square energy is approximately -27 dB, or 10^-2.7.
  2362. @item
  2363. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2364. @item
  2365. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2366. @end itemize
  2367. In other words, raising the volume by +4 dB does not cause any clipping,
  2368. raising it by +5 dB causes clipping for 6 samples, etc.
  2369. @c man end AUDIO FILTERS
  2370. @chapter Audio Sources
  2371. @c man begin AUDIO SOURCES
  2372. Below is a description of the currently available audio sources.
  2373. @section abuffer
  2374. Buffer audio frames, and make them available to the filter chain.
  2375. This source is mainly intended for a programmatic use, in particular
  2376. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2377. It accepts the following parameters:
  2378. @table @option
  2379. @item time_base
  2380. The timebase which will be used for timestamps of submitted frames. It must be
  2381. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2382. @item sample_rate
  2383. The sample rate of the incoming audio buffers.
  2384. @item sample_fmt
  2385. The sample format of the incoming audio buffers.
  2386. Either a sample format name or its corresponding integer representation from
  2387. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2388. @item channel_layout
  2389. The channel layout of the incoming audio buffers.
  2390. Either a channel layout name from channel_layout_map in
  2391. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2392. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2393. @item channels
  2394. The number of channels of the incoming audio buffers.
  2395. If both @var{channels} and @var{channel_layout} are specified, then they
  2396. must be consistent.
  2397. @end table
  2398. @subsection Examples
  2399. @example
  2400. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2401. @end example
  2402. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2403. Since the sample format with name "s16p" corresponds to the number
  2404. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2405. equivalent to:
  2406. @example
  2407. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2408. @end example
  2409. @section aevalsrc
  2410. Generate an audio signal specified by an expression.
  2411. This source accepts in input one or more expressions (one for each
  2412. channel), which are evaluated and used to generate a corresponding
  2413. audio signal.
  2414. This source accepts the following options:
  2415. @table @option
  2416. @item exprs
  2417. Set the '|'-separated expressions list for each separate channel. In case the
  2418. @option{channel_layout} option is not specified, the selected channel layout
  2419. depends on the number of provided expressions. Otherwise the last
  2420. specified expression is applied to the remaining output channels.
  2421. @item channel_layout, c
  2422. Set the channel layout. The number of channels in the specified layout
  2423. must be equal to the number of specified expressions.
  2424. @item duration, d
  2425. Set the minimum duration of the sourced audio. See
  2426. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2427. for the accepted syntax.
  2428. Note that the resulting duration may be greater than the specified
  2429. duration, as the generated audio is always cut at the end of a
  2430. complete frame.
  2431. If not specified, or the expressed duration is negative, the audio is
  2432. supposed to be generated forever.
  2433. @item nb_samples, n
  2434. Set the number of samples per channel per each output frame,
  2435. default to 1024.
  2436. @item sample_rate, s
  2437. Specify the sample rate, default to 44100.
  2438. @end table
  2439. Each expression in @var{exprs} can contain the following constants:
  2440. @table @option
  2441. @item n
  2442. number of the evaluated sample, starting from 0
  2443. @item t
  2444. time of the evaluated sample expressed in seconds, starting from 0
  2445. @item s
  2446. sample rate
  2447. @end table
  2448. @subsection Examples
  2449. @itemize
  2450. @item
  2451. Generate silence:
  2452. @example
  2453. aevalsrc=0
  2454. @end example
  2455. @item
  2456. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2457. 8000 Hz:
  2458. @example
  2459. aevalsrc="sin(440*2*PI*t):s=8000"
  2460. @end example
  2461. @item
  2462. Generate a two channels signal, specify the channel layout (Front
  2463. Center + Back Center) explicitly:
  2464. @example
  2465. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2466. @end example
  2467. @item
  2468. Generate white noise:
  2469. @example
  2470. aevalsrc="-2+random(0)"
  2471. @end example
  2472. @item
  2473. Generate an amplitude modulated signal:
  2474. @example
  2475. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2476. @end example
  2477. @item
  2478. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2479. @example
  2480. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2481. @end example
  2482. @end itemize
  2483. @section anullsrc
  2484. The null audio source, return unprocessed audio frames. It is mainly useful
  2485. as a template and to be employed in analysis / debugging tools, or as
  2486. the source for filters which ignore the input data (for example the sox
  2487. synth filter).
  2488. This source accepts the following options:
  2489. @table @option
  2490. @item channel_layout, cl
  2491. Specifies the channel layout, and can be either an integer or a string
  2492. representing a channel layout. The default value of @var{channel_layout}
  2493. is "stereo".
  2494. Check the channel_layout_map definition in
  2495. @file{libavutil/channel_layout.c} for the mapping between strings and
  2496. channel layout values.
  2497. @item sample_rate, r
  2498. Specifies the sample rate, and defaults to 44100.
  2499. @item nb_samples, n
  2500. Set the number of samples per requested frames.
  2501. @end table
  2502. @subsection Examples
  2503. @itemize
  2504. @item
  2505. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2506. @example
  2507. anullsrc=r=48000:cl=4
  2508. @end example
  2509. @item
  2510. Do the same operation with a more obvious syntax:
  2511. @example
  2512. anullsrc=r=48000:cl=mono
  2513. @end example
  2514. @end itemize
  2515. All the parameters need to be explicitly defined.
  2516. @section flite
  2517. Synthesize a voice utterance using the libflite library.
  2518. To enable compilation of this filter you need to configure FFmpeg with
  2519. @code{--enable-libflite}.
  2520. Note that the flite library is not thread-safe.
  2521. The filter accepts the following options:
  2522. @table @option
  2523. @item list_voices
  2524. If set to 1, list the names of the available voices and exit
  2525. immediately. Default value is 0.
  2526. @item nb_samples, n
  2527. Set the maximum number of samples per frame. Default value is 512.
  2528. @item textfile
  2529. Set the filename containing the text to speak.
  2530. @item text
  2531. Set the text to speak.
  2532. @item voice, v
  2533. Set the voice to use for the speech synthesis. Default value is
  2534. @code{kal}. See also the @var{list_voices} option.
  2535. @end table
  2536. @subsection Examples
  2537. @itemize
  2538. @item
  2539. Read from file @file{speech.txt}, and synthesize the text using the
  2540. standard flite voice:
  2541. @example
  2542. flite=textfile=speech.txt
  2543. @end example
  2544. @item
  2545. Read the specified text selecting the @code{slt} voice:
  2546. @example
  2547. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2548. @end example
  2549. @item
  2550. Input text to ffmpeg:
  2551. @example
  2552. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2553. @end example
  2554. @item
  2555. Make @file{ffplay} speak the specified text, using @code{flite} and
  2556. the @code{lavfi} device:
  2557. @example
  2558. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2559. @end example
  2560. @end itemize
  2561. For more information about libflite, check:
  2562. @url{http://www.speech.cs.cmu.edu/flite/}
  2563. @section anoisesrc
  2564. Generate a noise audio signal.
  2565. The filter accepts the following options:
  2566. @table @option
  2567. @item sample_rate, r
  2568. Specify the sample rate. Default value is 48000 Hz.
  2569. @item amplitude, a
  2570. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2571. is 1.0.
  2572. @item duration, d
  2573. Specify the duration of the generated audio stream. Not specifying this option
  2574. results in noise with an infinite length.
  2575. @item color, colour, c
  2576. Specify the color of noise. Available noise colors are white, pink, and brown.
  2577. Default color is white.
  2578. @item seed, s
  2579. Specify a value used to seed the PRNG.
  2580. @item nb_samples, n
  2581. Set the number of samples per each output frame, default is 1024.
  2582. @end table
  2583. @subsection Examples
  2584. @itemize
  2585. @item
  2586. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2587. @example
  2588. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2589. @end example
  2590. @end itemize
  2591. @section sine
  2592. Generate an audio signal made of a sine wave with amplitude 1/8.
  2593. The audio signal is bit-exact.
  2594. The filter accepts the following options:
  2595. @table @option
  2596. @item frequency, f
  2597. Set the carrier frequency. Default is 440 Hz.
  2598. @item beep_factor, b
  2599. Enable a periodic beep every second with frequency @var{beep_factor} times
  2600. the carrier frequency. Default is 0, meaning the beep is disabled.
  2601. @item sample_rate, r
  2602. Specify the sample rate, default is 44100.
  2603. @item duration, d
  2604. Specify the duration of the generated audio stream.
  2605. @item samples_per_frame
  2606. Set the number of samples per output frame.
  2607. The expression can contain the following constants:
  2608. @table @option
  2609. @item n
  2610. The (sequential) number of the output audio frame, starting from 0.
  2611. @item pts
  2612. The PTS (Presentation TimeStamp) of the output audio frame,
  2613. expressed in @var{TB} units.
  2614. @item t
  2615. The PTS of the output audio frame, expressed in seconds.
  2616. @item TB
  2617. The timebase of the output audio frames.
  2618. @end table
  2619. Default is @code{1024}.
  2620. @end table
  2621. @subsection Examples
  2622. @itemize
  2623. @item
  2624. Generate a simple 440 Hz sine wave:
  2625. @example
  2626. sine
  2627. @end example
  2628. @item
  2629. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2630. @example
  2631. sine=220:4:d=5
  2632. sine=f=220:b=4:d=5
  2633. sine=frequency=220:beep_factor=4:duration=5
  2634. @end example
  2635. @item
  2636. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2637. pattern:
  2638. @example
  2639. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2640. @end example
  2641. @end itemize
  2642. @c man end AUDIO SOURCES
  2643. @chapter Audio Sinks
  2644. @c man begin AUDIO SINKS
  2645. Below is a description of the currently available audio sinks.
  2646. @section abuffersink
  2647. Buffer audio frames, and make them available to the end of filter chain.
  2648. This sink is mainly intended for programmatic use, in particular
  2649. through the interface defined in @file{libavfilter/buffersink.h}
  2650. or the options system.
  2651. It accepts a pointer to an AVABufferSinkContext structure, which
  2652. defines the incoming buffers' formats, to be passed as the opaque
  2653. parameter to @code{avfilter_init_filter} for initialization.
  2654. @section anullsink
  2655. Null audio sink; do absolutely nothing with the input audio. It is
  2656. mainly useful as a template and for use in analysis / debugging
  2657. tools.
  2658. @c man end AUDIO SINKS
  2659. @chapter Video Filters
  2660. @c man begin VIDEO FILTERS
  2661. When you configure your FFmpeg build, you can disable any of the
  2662. existing filters using @code{--disable-filters}.
  2663. The configure output will show the video filters included in your
  2664. build.
  2665. Below is a description of the currently available video filters.
  2666. @section alphaextract
  2667. Extract the alpha component from the input as a grayscale video. This
  2668. is especially useful with the @var{alphamerge} filter.
  2669. @section alphamerge
  2670. Add or replace the alpha component of the primary input with the
  2671. grayscale value of a second input. This is intended for use with
  2672. @var{alphaextract} to allow the transmission or storage of frame
  2673. sequences that have alpha in a format that doesn't support an alpha
  2674. channel.
  2675. For example, to reconstruct full frames from a normal YUV-encoded video
  2676. and a separate video created with @var{alphaextract}, you might use:
  2677. @example
  2678. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2679. @end example
  2680. Since this filter is designed for reconstruction, it operates on frame
  2681. sequences without considering timestamps, and terminates when either
  2682. input reaches end of stream. This will cause problems if your encoding
  2683. pipeline drops frames. If you're trying to apply an image as an
  2684. overlay to a video stream, consider the @var{overlay} filter instead.
  2685. @section ass
  2686. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2687. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2688. Substation Alpha) subtitles files.
  2689. This filter accepts the following option in addition to the common options from
  2690. the @ref{subtitles} filter:
  2691. @table @option
  2692. @item shaping
  2693. Set the shaping engine
  2694. Available values are:
  2695. @table @samp
  2696. @item auto
  2697. The default libass shaping engine, which is the best available.
  2698. @item simple
  2699. Fast, font-agnostic shaper that can do only substitutions
  2700. @item complex
  2701. Slower shaper using OpenType for substitutions and positioning
  2702. @end table
  2703. The default is @code{auto}.
  2704. @end table
  2705. @section atadenoise
  2706. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  2707. The filter accepts the following options:
  2708. @table @option
  2709. @item 0a
  2710. Set threshold A for 1st plane. Default is 0.02.
  2711. Valid range is 0 to 0.3.
  2712. @item 0b
  2713. Set threshold B for 1st plane. Default is 0.04.
  2714. Valid range is 0 to 5.
  2715. @item 1a
  2716. Set threshold A for 2nd plane. Default is 0.02.
  2717. Valid range is 0 to 0.3.
  2718. @item 1b
  2719. Set threshold B for 2nd plane. Default is 0.04.
  2720. Valid range is 0 to 5.
  2721. @item 2a
  2722. Set threshold A for 3rd plane. Default is 0.02.
  2723. Valid range is 0 to 0.3.
  2724. @item 2b
  2725. Set threshold B for 3rd plane. Default is 0.04.
  2726. Valid range is 0 to 5.
  2727. Threshold A is designed to react on abrupt changes in the input signal and
  2728. threshold B is designed to react on continuous changes in the input signal.
  2729. @item s
  2730. Set number of frames filter will use for averaging. Default is 33. Must be odd
  2731. number in range [5, 129].
  2732. @end table
  2733. @section bbox
  2734. Compute the bounding box for the non-black pixels in the input frame
  2735. luminance plane.
  2736. This filter computes the bounding box containing all the pixels with a
  2737. luminance value greater than the minimum allowed value.
  2738. The parameters describing the bounding box are printed on the filter
  2739. log.
  2740. The filter accepts the following option:
  2741. @table @option
  2742. @item min_val
  2743. Set the minimal luminance value. Default is @code{16}.
  2744. @end table
  2745. @section blackdetect
  2746. Detect video intervals that are (almost) completely black. Can be
  2747. useful to detect chapter transitions, commercials, or invalid
  2748. recordings. Output lines contains the time for the start, end and
  2749. duration of the detected black interval expressed in seconds.
  2750. In order to display the output lines, you need to set the loglevel at
  2751. least to the AV_LOG_INFO value.
  2752. The filter accepts the following options:
  2753. @table @option
  2754. @item black_min_duration, d
  2755. Set the minimum detected black duration expressed in seconds. It must
  2756. be a non-negative floating point number.
  2757. Default value is 2.0.
  2758. @item picture_black_ratio_th, pic_th
  2759. Set the threshold for considering a picture "black".
  2760. Express the minimum value for the ratio:
  2761. @example
  2762. @var{nb_black_pixels} / @var{nb_pixels}
  2763. @end example
  2764. for which a picture is considered black.
  2765. Default value is 0.98.
  2766. @item pixel_black_th, pix_th
  2767. Set the threshold for considering a pixel "black".
  2768. The threshold expresses the maximum pixel luminance value for which a
  2769. pixel is considered "black". The provided value is scaled according to
  2770. the following equation:
  2771. @example
  2772. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  2773. @end example
  2774. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  2775. the input video format, the range is [0-255] for YUV full-range
  2776. formats and [16-235] for YUV non full-range formats.
  2777. Default value is 0.10.
  2778. @end table
  2779. The following example sets the maximum pixel threshold to the minimum
  2780. value, and detects only black intervals of 2 or more seconds:
  2781. @example
  2782. blackdetect=d=2:pix_th=0.00
  2783. @end example
  2784. @section blackframe
  2785. Detect frames that are (almost) completely black. Can be useful to
  2786. detect chapter transitions or commercials. Output lines consist of
  2787. the frame number of the detected frame, the percentage of blackness,
  2788. the position in the file if known or -1 and the timestamp in seconds.
  2789. In order to display the output lines, you need to set the loglevel at
  2790. least to the AV_LOG_INFO value.
  2791. It accepts the following parameters:
  2792. @table @option
  2793. @item amount
  2794. The percentage of the pixels that have to be below the threshold; it defaults to
  2795. @code{98}.
  2796. @item threshold, thresh
  2797. The threshold below which a pixel value is considered black; it defaults to
  2798. @code{32}.
  2799. @end table
  2800. @section blend, tblend
  2801. Blend two video frames into each other.
  2802. The @code{blend} filter takes two input streams and outputs one
  2803. stream, the first input is the "top" layer and second input is
  2804. "bottom" layer. Output terminates when shortest input terminates.
  2805. The @code{tblend} (time blend) filter takes two consecutive frames
  2806. from one single stream, and outputs the result obtained by blending
  2807. the new frame on top of the old frame.
  2808. A description of the accepted options follows.
  2809. @table @option
  2810. @item c0_mode
  2811. @item c1_mode
  2812. @item c2_mode
  2813. @item c3_mode
  2814. @item all_mode
  2815. Set blend mode for specific pixel component or all pixel components in case
  2816. of @var{all_mode}. Default value is @code{normal}.
  2817. Available values for component modes are:
  2818. @table @samp
  2819. @item addition
  2820. @item addition128
  2821. @item and
  2822. @item average
  2823. @item burn
  2824. @item darken
  2825. @item difference
  2826. @item difference128
  2827. @item divide
  2828. @item dodge
  2829. @item exclusion
  2830. @item glow
  2831. @item hardlight
  2832. @item hardmix
  2833. @item lighten
  2834. @item linearlight
  2835. @item multiply
  2836. @item negation
  2837. @item normal
  2838. @item or
  2839. @item overlay
  2840. @item phoenix
  2841. @item pinlight
  2842. @item reflect
  2843. @item screen
  2844. @item softlight
  2845. @item subtract
  2846. @item vividlight
  2847. @item xor
  2848. @end table
  2849. @item c0_opacity
  2850. @item c1_opacity
  2851. @item c2_opacity
  2852. @item c3_opacity
  2853. @item all_opacity
  2854. Set blend opacity for specific pixel component or all pixel components in case
  2855. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  2856. @item c0_expr
  2857. @item c1_expr
  2858. @item c2_expr
  2859. @item c3_expr
  2860. @item all_expr
  2861. Set blend expression for specific pixel component or all pixel components in case
  2862. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  2863. The expressions can use the following variables:
  2864. @table @option
  2865. @item N
  2866. The sequential number of the filtered frame, starting from @code{0}.
  2867. @item X
  2868. @item Y
  2869. the coordinates of the current sample
  2870. @item W
  2871. @item H
  2872. the width and height of currently filtered plane
  2873. @item SW
  2874. @item SH
  2875. Width and height scale depending on the currently filtered plane. It is the
  2876. ratio between the corresponding luma plane number of pixels and the current
  2877. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  2878. @code{0.5,0.5} for chroma planes.
  2879. @item T
  2880. Time of the current frame, expressed in seconds.
  2881. @item TOP, A
  2882. Value of pixel component at current location for first video frame (top layer).
  2883. @item BOTTOM, B
  2884. Value of pixel component at current location for second video frame (bottom layer).
  2885. @end table
  2886. @item shortest
  2887. Force termination when the shortest input terminates. Default is
  2888. @code{0}. This option is only defined for the @code{blend} filter.
  2889. @item repeatlast
  2890. Continue applying the last bottom frame after the end of the stream. A value of
  2891. @code{0} disable the filter after the last frame of the bottom layer is reached.
  2892. Default is @code{1}. This option is only defined for the @code{blend} filter.
  2893. @end table
  2894. @subsection Examples
  2895. @itemize
  2896. @item
  2897. Apply transition from bottom layer to top layer in first 10 seconds:
  2898. @example
  2899. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  2900. @end example
  2901. @item
  2902. Apply 1x1 checkerboard effect:
  2903. @example
  2904. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  2905. @end example
  2906. @item
  2907. Apply uncover left effect:
  2908. @example
  2909. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  2910. @end example
  2911. @item
  2912. Apply uncover down effect:
  2913. @example
  2914. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  2915. @end example
  2916. @item
  2917. Apply uncover up-left effect:
  2918. @example
  2919. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  2920. @end example
  2921. @item
  2922. Display differences between the current and the previous frame:
  2923. @example
  2924. tblend=all_mode=difference128
  2925. @end example
  2926. @end itemize
  2927. @section boxblur
  2928. Apply a boxblur algorithm to the input video.
  2929. It accepts the following parameters:
  2930. @table @option
  2931. @item luma_radius, lr
  2932. @item luma_power, lp
  2933. @item chroma_radius, cr
  2934. @item chroma_power, cp
  2935. @item alpha_radius, ar
  2936. @item alpha_power, ap
  2937. @end table
  2938. A description of the accepted options follows.
  2939. @table @option
  2940. @item luma_radius, lr
  2941. @item chroma_radius, cr
  2942. @item alpha_radius, ar
  2943. Set an expression for the box radius in pixels used for blurring the
  2944. corresponding input plane.
  2945. The radius value must be a non-negative number, and must not be
  2946. greater than the value of the expression @code{min(w,h)/2} for the
  2947. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  2948. planes.
  2949. Default value for @option{luma_radius} is "2". If not specified,
  2950. @option{chroma_radius} and @option{alpha_radius} default to the
  2951. corresponding value set for @option{luma_radius}.
  2952. The expressions can contain the following constants:
  2953. @table @option
  2954. @item w
  2955. @item h
  2956. The input width and height in pixels.
  2957. @item cw
  2958. @item ch
  2959. The input chroma image width and height in pixels.
  2960. @item hsub
  2961. @item vsub
  2962. The horizontal and vertical chroma subsample values. For example, for the
  2963. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  2964. @end table
  2965. @item luma_power, lp
  2966. @item chroma_power, cp
  2967. @item alpha_power, ap
  2968. Specify how many times the boxblur filter is applied to the
  2969. corresponding plane.
  2970. Default value for @option{luma_power} is 2. If not specified,
  2971. @option{chroma_power} and @option{alpha_power} default to the
  2972. corresponding value set for @option{luma_power}.
  2973. A value of 0 will disable the effect.
  2974. @end table
  2975. @subsection Examples
  2976. @itemize
  2977. @item
  2978. Apply a boxblur filter with the luma, chroma, and alpha radii
  2979. set to 2:
  2980. @example
  2981. boxblur=luma_radius=2:luma_power=1
  2982. boxblur=2:1
  2983. @end example
  2984. @item
  2985. Set the luma radius to 2, and alpha and chroma radius to 0:
  2986. @example
  2987. boxblur=2:1:cr=0:ar=0
  2988. @end example
  2989. @item
  2990. Set the luma and chroma radii to a fraction of the video dimension:
  2991. @example
  2992. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  2993. @end example
  2994. @end itemize
  2995. @section chromakey
  2996. YUV colorspace color/chroma keying.
  2997. The filter accepts the following options:
  2998. @table @option
  2999. @item color
  3000. The color which will be replaced with transparency.
  3001. @item similarity
  3002. Similarity percentage with the key color.
  3003. 0.01 matches only the exact key color, while 1.0 matches everything.
  3004. @item blend
  3005. Blend percentage.
  3006. 0.0 makes pixels either fully transparent, or not transparent at all.
  3007. Higher values result in semi-transparent pixels, with a higher transparency
  3008. the more similar the pixels color is to the key color.
  3009. @item yuv
  3010. Signals that the color passed is already in YUV instead of RGB.
  3011. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3012. This can be used to pass exact YUV values as hexadecimal numbers.
  3013. @end table
  3014. @subsection Examples
  3015. @itemize
  3016. @item
  3017. Make every green pixel in the input image transparent:
  3018. @example
  3019. ffmpeg -i input.png -vf chromakey=green out.png
  3020. @end example
  3021. @item
  3022. Overlay a greenscreen-video on top of a static black background.
  3023. @example
  3024. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  3025. @end example
  3026. @end itemize
  3027. @section codecview
  3028. Visualize information exported by some codecs.
  3029. Some codecs can export information through frames using side-data or other
  3030. means. For example, some MPEG based codecs export motion vectors through the
  3031. @var{export_mvs} flag in the codec @option{flags2} option.
  3032. The filter accepts the following option:
  3033. @table @option
  3034. @item mv
  3035. Set motion vectors to visualize.
  3036. Available flags for @var{mv} are:
  3037. @table @samp
  3038. @item pf
  3039. forward predicted MVs of P-frames
  3040. @item bf
  3041. forward predicted MVs of B-frames
  3042. @item bb
  3043. backward predicted MVs of B-frames
  3044. @end table
  3045. @end table
  3046. @subsection Examples
  3047. @itemize
  3048. @item
  3049. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3050. @example
  3051. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3052. @end example
  3053. @end itemize
  3054. @section colorbalance
  3055. Modify intensity of primary colors (red, green and blue) of input frames.
  3056. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3057. regions for the red-cyan, green-magenta or blue-yellow balance.
  3058. A positive adjustment value shifts the balance towards the primary color, a negative
  3059. value towards the complementary color.
  3060. The filter accepts the following options:
  3061. @table @option
  3062. @item rs
  3063. @item gs
  3064. @item bs
  3065. Adjust red, green and blue shadows (darkest pixels).
  3066. @item rm
  3067. @item gm
  3068. @item bm
  3069. Adjust red, green and blue midtones (medium pixels).
  3070. @item rh
  3071. @item gh
  3072. @item bh
  3073. Adjust red, green and blue highlights (brightest pixels).
  3074. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3075. @end table
  3076. @subsection Examples
  3077. @itemize
  3078. @item
  3079. Add red color cast to shadows:
  3080. @example
  3081. colorbalance=rs=.3
  3082. @end example
  3083. @end itemize
  3084. @section colorkey
  3085. RGB colorspace color keying.
  3086. The filter accepts the following options:
  3087. @table @option
  3088. @item color
  3089. The color which will be replaced with transparency.
  3090. @item similarity
  3091. Similarity percentage with the key color.
  3092. 0.01 matches only the exact key color, while 1.0 matches everything.
  3093. @item blend
  3094. Blend percentage.
  3095. 0.0 makes pixels either fully transparent, or not transparent at all.
  3096. Higher values result in semi-transparent pixels, with a higher transparency
  3097. the more similar the pixels color is to the key color.
  3098. @end table
  3099. @subsection Examples
  3100. @itemize
  3101. @item
  3102. Make every green pixel in the input image transparent:
  3103. @example
  3104. ffmpeg -i input.png -vf colorkey=green out.png
  3105. @end example
  3106. @item
  3107. Overlay a greenscreen-video on top of a static background image.
  3108. @example
  3109. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  3110. @end example
  3111. @end itemize
  3112. @section colorlevels
  3113. Adjust video input frames using levels.
  3114. The filter accepts the following options:
  3115. @table @option
  3116. @item rimin
  3117. @item gimin
  3118. @item bimin
  3119. @item aimin
  3120. Adjust red, green, blue and alpha input black point.
  3121. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3122. @item rimax
  3123. @item gimax
  3124. @item bimax
  3125. @item aimax
  3126. Adjust red, green, blue and alpha input white point.
  3127. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3128. Input levels are used to lighten highlights (bright tones), darken shadows
  3129. (dark tones), change the balance of bright and dark tones.
  3130. @item romin
  3131. @item gomin
  3132. @item bomin
  3133. @item aomin
  3134. Adjust red, green, blue and alpha output black point.
  3135. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3136. @item romax
  3137. @item gomax
  3138. @item bomax
  3139. @item aomax
  3140. Adjust red, green, blue and alpha output white point.
  3141. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3142. Output levels allows manual selection of a constrained output level range.
  3143. @end table
  3144. @subsection Examples
  3145. @itemize
  3146. @item
  3147. Make video output darker:
  3148. @example
  3149. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3150. @end example
  3151. @item
  3152. Increase contrast:
  3153. @example
  3154. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3155. @end example
  3156. @item
  3157. Make video output lighter:
  3158. @example
  3159. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3160. @end example
  3161. @item
  3162. Increase brightness:
  3163. @example
  3164. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3165. @end example
  3166. @end itemize
  3167. @section colorchannelmixer
  3168. Adjust video input frames by re-mixing color channels.
  3169. This filter modifies a color channel by adding the values associated to
  3170. the other channels of the same pixels. For example if the value to
  3171. modify is red, the output value will be:
  3172. @example
  3173. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3174. @end example
  3175. The filter accepts the following options:
  3176. @table @option
  3177. @item rr
  3178. @item rg
  3179. @item rb
  3180. @item ra
  3181. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3182. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3183. @item gr
  3184. @item gg
  3185. @item gb
  3186. @item ga
  3187. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3188. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3189. @item br
  3190. @item bg
  3191. @item bb
  3192. @item ba
  3193. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3194. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3195. @item ar
  3196. @item ag
  3197. @item ab
  3198. @item aa
  3199. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3200. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3201. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3202. @end table
  3203. @subsection Examples
  3204. @itemize
  3205. @item
  3206. Convert source to grayscale:
  3207. @example
  3208. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3209. @end example
  3210. @item
  3211. Simulate sepia tones:
  3212. @example
  3213. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3214. @end example
  3215. @end itemize
  3216. @section colormatrix
  3217. Convert color matrix.
  3218. The filter accepts the following options:
  3219. @table @option
  3220. @item src
  3221. @item dst
  3222. Specify the source and destination color matrix. Both values must be
  3223. specified.
  3224. The accepted values are:
  3225. @table @samp
  3226. @item bt709
  3227. BT.709
  3228. @item bt601
  3229. BT.601
  3230. @item smpte240m
  3231. SMPTE-240M
  3232. @item fcc
  3233. FCC
  3234. @end table
  3235. @end table
  3236. For example to convert from BT.601 to SMPTE-240M, use the command:
  3237. @example
  3238. colormatrix=bt601:smpte240m
  3239. @end example
  3240. @section copy
  3241. Copy the input source unchanged to the output. This is mainly useful for
  3242. testing purposes.
  3243. @section crop
  3244. Crop the input video to given dimensions.
  3245. It accepts the following parameters:
  3246. @table @option
  3247. @item w, out_w
  3248. The width of the output video. It defaults to @code{iw}.
  3249. This expression is evaluated only once during the filter
  3250. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3251. @item h, out_h
  3252. The height of the output video. It defaults to @code{ih}.
  3253. This expression is evaluated only once during the filter
  3254. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3255. @item x
  3256. The horizontal position, in the input video, of the left edge of the output
  3257. video. It defaults to @code{(in_w-out_w)/2}.
  3258. This expression is evaluated per-frame.
  3259. @item y
  3260. The vertical position, in the input video, of the top edge of the output video.
  3261. It defaults to @code{(in_h-out_h)/2}.
  3262. This expression is evaluated per-frame.
  3263. @item keep_aspect
  3264. If set to 1 will force the output display aspect ratio
  3265. to be the same of the input, by changing the output sample aspect
  3266. ratio. It defaults to 0.
  3267. @end table
  3268. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3269. expressions containing the following constants:
  3270. @table @option
  3271. @item x
  3272. @item y
  3273. The computed values for @var{x} and @var{y}. They are evaluated for
  3274. each new frame.
  3275. @item in_w
  3276. @item in_h
  3277. The input width and height.
  3278. @item iw
  3279. @item ih
  3280. These are the same as @var{in_w} and @var{in_h}.
  3281. @item out_w
  3282. @item out_h
  3283. The output (cropped) width and height.
  3284. @item ow
  3285. @item oh
  3286. These are the same as @var{out_w} and @var{out_h}.
  3287. @item a
  3288. same as @var{iw} / @var{ih}
  3289. @item sar
  3290. input sample aspect ratio
  3291. @item dar
  3292. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3293. @item hsub
  3294. @item vsub
  3295. horizontal and vertical chroma subsample values. For example for the
  3296. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3297. @item n
  3298. The number of the input frame, starting from 0.
  3299. @item pos
  3300. the position in the file of the input frame, NAN if unknown
  3301. @item t
  3302. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3303. @end table
  3304. The expression for @var{out_w} may depend on the value of @var{out_h},
  3305. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3306. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3307. evaluated after @var{out_w} and @var{out_h}.
  3308. The @var{x} and @var{y} parameters specify the expressions for the
  3309. position of the top-left corner of the output (non-cropped) area. They
  3310. are evaluated for each frame. If the evaluated value is not valid, it
  3311. is approximated to the nearest valid value.
  3312. The expression for @var{x} may depend on @var{y}, and the expression
  3313. for @var{y} may depend on @var{x}.
  3314. @subsection Examples
  3315. @itemize
  3316. @item
  3317. Crop area with size 100x100 at position (12,34).
  3318. @example
  3319. crop=100:100:12:34
  3320. @end example
  3321. Using named options, the example above becomes:
  3322. @example
  3323. crop=w=100:h=100:x=12:y=34
  3324. @end example
  3325. @item
  3326. Crop the central input area with size 100x100:
  3327. @example
  3328. crop=100:100
  3329. @end example
  3330. @item
  3331. Crop the central input area with size 2/3 of the input video:
  3332. @example
  3333. crop=2/3*in_w:2/3*in_h
  3334. @end example
  3335. @item
  3336. Crop the input video central square:
  3337. @example
  3338. crop=out_w=in_h
  3339. crop=in_h
  3340. @end example
  3341. @item
  3342. Delimit the rectangle with the top-left corner placed at position
  3343. 100:100 and the right-bottom corner corresponding to the right-bottom
  3344. corner of the input image.
  3345. @example
  3346. crop=in_w-100:in_h-100:100:100
  3347. @end example
  3348. @item
  3349. Crop 10 pixels from the left and right borders, and 20 pixels from
  3350. the top and bottom borders
  3351. @example
  3352. crop=in_w-2*10:in_h-2*20
  3353. @end example
  3354. @item
  3355. Keep only the bottom right quarter of the input image:
  3356. @example
  3357. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3358. @end example
  3359. @item
  3360. Crop height for getting Greek harmony:
  3361. @example
  3362. crop=in_w:1/PHI*in_w
  3363. @end example
  3364. @item
  3365. Apply trembling effect:
  3366. @example
  3367. 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)
  3368. @end example
  3369. @item
  3370. Apply erratic camera effect depending on timestamp:
  3371. @example
  3372. 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)"
  3373. @end example
  3374. @item
  3375. Set x depending on the value of y:
  3376. @example
  3377. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3378. @end example
  3379. @end itemize
  3380. @subsection Commands
  3381. This filter supports the following commands:
  3382. @table @option
  3383. @item w, out_w
  3384. @item h, out_h
  3385. @item x
  3386. @item y
  3387. Set width/height of the output video and the horizontal/vertical position
  3388. in the input video.
  3389. The command accepts the same syntax of the corresponding option.
  3390. If the specified expression is not valid, it is kept at its current
  3391. value.
  3392. @end table
  3393. @section cropdetect
  3394. Auto-detect the crop size.
  3395. It calculates the necessary cropping parameters and prints the
  3396. recommended parameters via the logging system. The detected dimensions
  3397. correspond to the non-black area of the input video.
  3398. It accepts the following parameters:
  3399. @table @option
  3400. @item limit
  3401. Set higher black value threshold, which can be optionally specified
  3402. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3403. value greater to the set value is considered non-black. It defaults to 24.
  3404. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3405. on the bitdepth of the pixel format.
  3406. @item round
  3407. The value which the width/height should be divisible by. It defaults to
  3408. 16. The offset is automatically adjusted to center the video. Use 2 to
  3409. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3410. encoding to most video codecs.
  3411. @item reset_count, reset
  3412. Set the counter that determines after how many frames cropdetect will
  3413. reset the previously detected largest video area and start over to
  3414. detect the current optimal crop area. Default value is 0.
  3415. This can be useful when channel logos distort the video area. 0
  3416. indicates 'never reset', and returns the largest area encountered during
  3417. playback.
  3418. @end table
  3419. @anchor{curves}
  3420. @section curves
  3421. Apply color adjustments using curves.
  3422. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3423. component (red, green and blue) has its values defined by @var{N} key points
  3424. tied from each other using a smooth curve. The x-axis represents the pixel
  3425. values from the input frame, and the y-axis the new pixel values to be set for
  3426. the output frame.
  3427. By default, a component curve is defined by the two points @var{(0;0)} and
  3428. @var{(1;1)}. This creates a straight line where each original pixel value is
  3429. "adjusted" to its own value, which means no change to the image.
  3430. The filter allows you to redefine these two points and add some more. A new
  3431. curve (using a natural cubic spline interpolation) will be define to pass
  3432. smoothly through all these new coordinates. The new defined points needs to be
  3433. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3434. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3435. the vector spaces, the values will be clipped accordingly.
  3436. If there is no key point defined in @code{x=0}, the filter will automatically
  3437. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3438. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3439. The filter accepts the following options:
  3440. @table @option
  3441. @item preset
  3442. Select one of the available color presets. This option can be used in addition
  3443. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3444. options takes priority on the preset values.
  3445. Available presets are:
  3446. @table @samp
  3447. @item none
  3448. @item color_negative
  3449. @item cross_process
  3450. @item darker
  3451. @item increase_contrast
  3452. @item lighter
  3453. @item linear_contrast
  3454. @item medium_contrast
  3455. @item negative
  3456. @item strong_contrast
  3457. @item vintage
  3458. @end table
  3459. Default is @code{none}.
  3460. @item master, m
  3461. Set the master key points. These points will define a second pass mapping. It
  3462. is sometimes called a "luminance" or "value" mapping. It can be used with
  3463. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3464. post-processing LUT.
  3465. @item red, r
  3466. Set the key points for the red component.
  3467. @item green, g
  3468. Set the key points for the green component.
  3469. @item blue, b
  3470. Set the key points for the blue component.
  3471. @item all
  3472. Set the key points for all components (not including master).
  3473. Can be used in addition to the other key points component
  3474. options. In this case, the unset component(s) will fallback on this
  3475. @option{all} setting.
  3476. @item psfile
  3477. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3478. @end table
  3479. To avoid some filtergraph syntax conflicts, each key points list need to be
  3480. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3481. @subsection Examples
  3482. @itemize
  3483. @item
  3484. Increase slightly the middle level of blue:
  3485. @example
  3486. curves=blue='0.5/0.58'
  3487. @end example
  3488. @item
  3489. Vintage effect:
  3490. @example
  3491. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3492. @end example
  3493. Here we obtain the following coordinates for each components:
  3494. @table @var
  3495. @item red
  3496. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3497. @item green
  3498. @code{(0;0) (0.50;0.48) (1;1)}
  3499. @item blue
  3500. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3501. @end table
  3502. @item
  3503. The previous example can also be achieved with the associated built-in preset:
  3504. @example
  3505. curves=preset=vintage
  3506. @end example
  3507. @item
  3508. Or simply:
  3509. @example
  3510. curves=vintage
  3511. @end example
  3512. @item
  3513. Use a Photoshop preset and redefine the points of the green component:
  3514. @example
  3515. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3516. @end example
  3517. @end itemize
  3518. @section dctdnoiz
  3519. Denoise frames using 2D DCT (frequency domain filtering).
  3520. This filter is not designed for real time.
  3521. The filter accepts the following options:
  3522. @table @option
  3523. @item sigma, s
  3524. Set the noise sigma constant.
  3525. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3526. coefficient (absolute value) below this threshold with be dropped.
  3527. If you need a more advanced filtering, see @option{expr}.
  3528. Default is @code{0}.
  3529. @item overlap
  3530. Set number overlapping pixels for each block. Since the filter can be slow, you
  3531. may want to reduce this value, at the cost of a less effective filter and the
  3532. risk of various artefacts.
  3533. If the overlapping value doesn't permit processing the whole input width or
  3534. height, a warning will be displayed and according borders won't be denoised.
  3535. Default value is @var{blocksize}-1, which is the best possible setting.
  3536. @item expr, e
  3537. Set the coefficient factor expression.
  3538. For each coefficient of a DCT block, this expression will be evaluated as a
  3539. multiplier value for the coefficient.
  3540. If this is option is set, the @option{sigma} option will be ignored.
  3541. The absolute value of the coefficient can be accessed through the @var{c}
  3542. variable.
  3543. @item n
  3544. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3545. @var{blocksize}, which is the width and height of the processed blocks.
  3546. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3547. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3548. on the speed processing. Also, a larger block size does not necessarily means a
  3549. better de-noising.
  3550. @end table
  3551. @subsection Examples
  3552. Apply a denoise with a @option{sigma} of @code{4.5}:
  3553. @example
  3554. dctdnoiz=4.5
  3555. @end example
  3556. The same operation can be achieved using the expression system:
  3557. @example
  3558. dctdnoiz=e='gte(c, 4.5*3)'
  3559. @end example
  3560. Violent denoise using a block size of @code{16x16}:
  3561. @example
  3562. dctdnoiz=15:n=4
  3563. @end example
  3564. @section deband
  3565. Remove banding artifacts from input video.
  3566. It works by replacing banded pixels with average value of referenced pixels.
  3567. The filter accepts the following options:
  3568. @table @option
  3569. @item 1thr
  3570. @item 2thr
  3571. @item 3thr
  3572. @item 4thr
  3573. Set banding detection threshold for each plane. Default is 0.02.
  3574. Valid range is 0.00003 to 0.5.
  3575. If difference between current pixel and reference pixel is less than threshold,
  3576. it will be considered as banded.
  3577. @item range, r
  3578. Banding detection range in pixels. Default is 16. If positive, random number
  3579. in range 0 to set value will be used. If negative, exact absolute value
  3580. will be used.
  3581. The range defines square of four pixels around current pixel.
  3582. @item direction, d
  3583. Set direction in radians from which four pixel will be compared. If positive,
  3584. random direction from 0 to set direction will be picked. If negative, exact of
  3585. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3586. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3587. column.
  3588. @item blur
  3589. If enabled, current pixel is compared with average value of all four
  3590. surrounding pixels. The default is enabled. If disabled current pixel is
  3591. compared with all four surrounding pixels. The pixel is considered banded
  3592. if only all four differences with surrounding pixels are less than threshold.
  3593. @end table
  3594. @anchor{decimate}
  3595. @section decimate
  3596. Drop duplicated frames at regular intervals.
  3597. The filter accepts the following options:
  3598. @table @option
  3599. @item cycle
  3600. Set the number of frames from which one will be dropped. Setting this to
  3601. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3602. Default is @code{5}.
  3603. @item dupthresh
  3604. Set the threshold for duplicate detection. If the difference metric for a frame
  3605. is less than or equal to this value, then it is declared as duplicate. Default
  3606. is @code{1.1}
  3607. @item scthresh
  3608. Set scene change threshold. Default is @code{15}.
  3609. @item blockx
  3610. @item blocky
  3611. Set the size of the x and y-axis blocks used during metric calculations.
  3612. Larger blocks give better noise suppression, but also give worse detection of
  3613. small movements. Must be a power of two. Default is @code{32}.
  3614. @item ppsrc
  3615. Mark main input as a pre-processed input and activate clean source input
  3616. stream. This allows the input to be pre-processed with various filters to help
  3617. the metrics calculation while keeping the frame selection lossless. When set to
  3618. @code{1}, the first stream is for the pre-processed input, and the second
  3619. stream is the clean source from where the kept frames are chosen. Default is
  3620. @code{0}.
  3621. @item chroma
  3622. Set whether or not chroma is considered in the metric calculations. Default is
  3623. @code{1}.
  3624. @end table
  3625. @section deflate
  3626. Apply deflate effect to the video.
  3627. This filter replaces the pixel by the local(3x3) average by taking into account
  3628. only values lower than the pixel.
  3629. It accepts the following options:
  3630. @table @option
  3631. @item threshold0
  3632. @item threshold1
  3633. @item threshold2
  3634. @item threshold3
  3635. Limit the maximum change for each plane, default is 65535.
  3636. If 0, plane will remain unchanged.
  3637. @end table
  3638. @section dejudder
  3639. Remove judder produced by partially interlaced telecined content.
  3640. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3641. source was partially telecined content then the output of @code{pullup,dejudder}
  3642. will have a variable frame rate. May change the recorded frame rate of the
  3643. container. Aside from that change, this filter will not affect constant frame
  3644. rate video.
  3645. The option available in this filter is:
  3646. @table @option
  3647. @item cycle
  3648. Specify the length of the window over which the judder repeats.
  3649. Accepts any integer greater than 1. Useful values are:
  3650. @table @samp
  3651. @item 4
  3652. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3653. @item 5
  3654. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3655. @item 20
  3656. If a mixture of the two.
  3657. @end table
  3658. The default is @samp{4}.
  3659. @end table
  3660. @section delogo
  3661. Suppress a TV station logo by a simple interpolation of the surrounding
  3662. pixels. Just set a rectangle covering the logo and watch it disappear
  3663. (and sometimes something even uglier appear - your mileage may vary).
  3664. It accepts the following parameters:
  3665. @table @option
  3666. @item x
  3667. @item y
  3668. Specify the top left corner coordinates of the logo. They must be
  3669. specified.
  3670. @item w
  3671. @item h
  3672. Specify the width and height of the logo to clear. They must be
  3673. specified.
  3674. @item band, t
  3675. Specify the thickness of the fuzzy edge of the rectangle (added to
  3676. @var{w} and @var{h}). The default value is 1. This option is
  3677. deprecated, setting higher values should no longer be necessary and
  3678. is not recommended.
  3679. @item show
  3680. When set to 1, a green rectangle is drawn on the screen to simplify
  3681. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3682. The default value is 0.
  3683. The rectangle is drawn on the outermost pixels which will be (partly)
  3684. replaced with interpolated values. The values of the next pixels
  3685. immediately outside this rectangle in each direction will be used to
  3686. compute the interpolated pixel values inside the rectangle.
  3687. @end table
  3688. @subsection Examples
  3689. @itemize
  3690. @item
  3691. Set a rectangle covering the area with top left corner coordinates 0,0
  3692. and size 100x77, and a band of size 10:
  3693. @example
  3694. delogo=x=0:y=0:w=100:h=77:band=10
  3695. @end example
  3696. @end itemize
  3697. @section deshake
  3698. Attempt to fix small changes in horizontal and/or vertical shift. This
  3699. filter helps remove camera shake from hand-holding a camera, bumping a
  3700. tripod, moving on a vehicle, etc.
  3701. The filter accepts the following options:
  3702. @table @option
  3703. @item x
  3704. @item y
  3705. @item w
  3706. @item h
  3707. Specify a rectangular area where to limit the search for motion
  3708. vectors.
  3709. If desired the search for motion vectors can be limited to a
  3710. rectangular area of the frame defined by its top left corner, width
  3711. and height. These parameters have the same meaning as the drawbox
  3712. filter which can be used to visualise the position of the bounding
  3713. box.
  3714. This is useful when simultaneous movement of subjects within the frame
  3715. might be confused for camera motion by the motion vector search.
  3716. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  3717. then the full frame is used. This allows later options to be set
  3718. without specifying the bounding box for the motion vector search.
  3719. Default - search the whole frame.
  3720. @item rx
  3721. @item ry
  3722. Specify the maximum extent of movement in x and y directions in the
  3723. range 0-64 pixels. Default 16.
  3724. @item edge
  3725. Specify how to generate pixels to fill blanks at the edge of the
  3726. frame. Available values are:
  3727. @table @samp
  3728. @item blank, 0
  3729. Fill zeroes at blank locations
  3730. @item original, 1
  3731. Original image at blank locations
  3732. @item clamp, 2
  3733. Extruded edge value at blank locations
  3734. @item mirror, 3
  3735. Mirrored edge at blank locations
  3736. @end table
  3737. Default value is @samp{mirror}.
  3738. @item blocksize
  3739. Specify the blocksize to use for motion search. Range 4-128 pixels,
  3740. default 8.
  3741. @item contrast
  3742. Specify the contrast threshold for blocks. Only blocks with more than
  3743. the specified contrast (difference between darkest and lightest
  3744. pixels) will be considered. Range 1-255, default 125.
  3745. @item search
  3746. Specify the search strategy. Available values are:
  3747. @table @samp
  3748. @item exhaustive, 0
  3749. Set exhaustive search
  3750. @item less, 1
  3751. Set less exhaustive search.
  3752. @end table
  3753. Default value is @samp{exhaustive}.
  3754. @item filename
  3755. If set then a detailed log of the motion search is written to the
  3756. specified file.
  3757. @item opencl
  3758. If set to 1, specify using OpenCL capabilities, only available if
  3759. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  3760. @end table
  3761. @section detelecine
  3762. Apply an exact inverse of the telecine operation. It requires a predefined
  3763. pattern specified using the pattern option which must be the same as that passed
  3764. to the telecine filter.
  3765. This filter accepts the following options:
  3766. @table @option
  3767. @item first_field
  3768. @table @samp
  3769. @item top, t
  3770. top field first
  3771. @item bottom, b
  3772. bottom field first
  3773. The default value is @code{top}.
  3774. @end table
  3775. @item pattern
  3776. A string of numbers representing the pulldown pattern you wish to apply.
  3777. The default value is @code{23}.
  3778. @item start_frame
  3779. A number representing position of the first frame with respect to the telecine
  3780. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  3781. @end table
  3782. @section dilation
  3783. Apply dilation effect to the video.
  3784. This filter replaces the pixel by the local(3x3) maximum.
  3785. It accepts the following options:
  3786. @table @option
  3787. @item threshold0
  3788. @item threshold1
  3789. @item threshold2
  3790. @item threshold3
  3791. Limit the maximum change for each plane, default is 65535.
  3792. If 0, plane will remain unchanged.
  3793. @item coordinates
  3794. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  3795. pixels are used.
  3796. Flags to local 3x3 coordinates maps like this:
  3797. 1 2 3
  3798. 4 5
  3799. 6 7 8
  3800. @end table
  3801. @section displace
  3802. Displace pixels as indicated by second and third input stream.
  3803. It takes three input streams and outputs one stream, the first input is the
  3804. source, and second and third input are displacement maps.
  3805. The second input specifies how much to displace pixels along the
  3806. x-axis, while the third input specifies how much to displace pixels
  3807. along the y-axis.
  3808. If one of displacement map streams terminates, last frame from that
  3809. displacement map will be used.
  3810. Note that once generated, displacements maps can be reused over and over again.
  3811. A description of the accepted options follows.
  3812. @table @option
  3813. @item edge
  3814. Set displace behavior for pixels that are out of range.
  3815. Available values are:
  3816. @table @samp
  3817. @item blank
  3818. Missing pixels are replaced by black pixels.
  3819. @item smear
  3820. Adjacent pixels will spread out to replace missing pixels.
  3821. @item wrap
  3822. Out of range pixels are wrapped so they point to pixels of other side.
  3823. @end table
  3824. Default is @samp{smear}.
  3825. @end table
  3826. @subsection Examples
  3827. @itemize
  3828. @item
  3829. Add ripple effect to rgb input of video size hd720:
  3830. @example
  3831. ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
  3832. @end example
  3833. @item
  3834. Add wave effect to rgb input of video size hd720:
  3835. @example
  3836. ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
  3837. @end example
  3838. @end itemize
  3839. @section drawbox
  3840. Draw a colored box on the input image.
  3841. It accepts the following parameters:
  3842. @table @option
  3843. @item x
  3844. @item y
  3845. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  3846. @item width, w
  3847. @item height, h
  3848. The expressions which specify the width and height of the box; if 0 they are interpreted as
  3849. the input width and height. It defaults to 0.
  3850. @item color, c
  3851. Specify the color of the box to write. For the general syntax of this option,
  3852. check the "Color" section in the ffmpeg-utils manual. If the special
  3853. value @code{invert} is used, the box edge color is the same as the
  3854. video with inverted luma.
  3855. @item thickness, t
  3856. The expression which sets the thickness of the box edge. Default value is @code{3}.
  3857. See below for the list of accepted constants.
  3858. @end table
  3859. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  3860. following constants:
  3861. @table @option
  3862. @item dar
  3863. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  3864. @item hsub
  3865. @item vsub
  3866. horizontal and vertical chroma subsample values. For example for the
  3867. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3868. @item in_h, ih
  3869. @item in_w, iw
  3870. The input width and height.
  3871. @item sar
  3872. The input sample aspect ratio.
  3873. @item x
  3874. @item y
  3875. The x and y offset coordinates where the box is drawn.
  3876. @item w
  3877. @item h
  3878. The width and height of the drawn box.
  3879. @item t
  3880. The thickness of the drawn box.
  3881. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  3882. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  3883. @end table
  3884. @subsection Examples
  3885. @itemize
  3886. @item
  3887. Draw a black box around the edge of the input image:
  3888. @example
  3889. drawbox
  3890. @end example
  3891. @item
  3892. Draw a box with color red and an opacity of 50%:
  3893. @example
  3894. drawbox=10:20:200:60:red@@0.5
  3895. @end example
  3896. The previous example can be specified as:
  3897. @example
  3898. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  3899. @end example
  3900. @item
  3901. Fill the box with pink color:
  3902. @example
  3903. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  3904. @end example
  3905. @item
  3906. Draw a 2-pixel red 2.40:1 mask:
  3907. @example
  3908. 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
  3909. @end example
  3910. @end itemize
  3911. @section drawgraph, adrawgraph
  3912. Draw a graph using input video or audio metadata.
  3913. It accepts the following parameters:
  3914. @table @option
  3915. @item m1
  3916. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  3917. @item fg1
  3918. Set 1st foreground color expression.
  3919. @item m2
  3920. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  3921. @item fg2
  3922. Set 2nd foreground color expression.
  3923. @item m3
  3924. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  3925. @item fg3
  3926. Set 3rd foreground color expression.
  3927. @item m4
  3928. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  3929. @item fg4
  3930. Set 4th foreground color expression.
  3931. @item min
  3932. Set minimal value of metadata value.
  3933. @item max
  3934. Set maximal value of metadata value.
  3935. @item bg
  3936. Set graph background color. Default is white.
  3937. @item mode
  3938. Set graph mode.
  3939. Available values for mode is:
  3940. @table @samp
  3941. @item bar
  3942. @item dot
  3943. @item line
  3944. @end table
  3945. Default is @code{line}.
  3946. @item slide
  3947. Set slide mode.
  3948. Available values for slide is:
  3949. @table @samp
  3950. @item frame
  3951. Draw new frame when right border is reached.
  3952. @item replace
  3953. Replace old columns with new ones.
  3954. @item scroll
  3955. Scroll from right to left.
  3956. @item rscroll
  3957. Scroll from left to right.
  3958. @end table
  3959. Default is @code{frame}.
  3960. @item size
  3961. Set size of graph video. For the syntax of this option, check the
  3962. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  3963. The default value is @code{900x256}.
  3964. The foreground color expressions can use the following variables:
  3965. @table @option
  3966. @item MIN
  3967. Minimal value of metadata value.
  3968. @item MAX
  3969. Maximal value of metadata value.
  3970. @item VAL
  3971. Current metadata key value.
  3972. @end table
  3973. The color is defined as 0xAABBGGRR.
  3974. @end table
  3975. Example using metadata from @ref{signalstats} filter:
  3976. @example
  3977. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  3978. @end example
  3979. Example using metadata from @ref{ebur128} filter:
  3980. @example
  3981. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  3982. @end example
  3983. @section drawgrid
  3984. Draw a grid on the input image.
  3985. It accepts the following parameters:
  3986. @table @option
  3987. @item x
  3988. @item y
  3989. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  3990. @item width, w
  3991. @item height, h
  3992. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  3993. input width and height, respectively, minus @code{thickness}, so image gets
  3994. framed. Default to 0.
  3995. @item color, c
  3996. Specify the color of the grid. For the general syntax of this option,
  3997. check the "Color" section in the ffmpeg-utils manual. If the special
  3998. value @code{invert} is used, the grid color is the same as the
  3999. video with inverted luma.
  4000. @item thickness, t
  4001. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4002. See below for the list of accepted constants.
  4003. @end table
  4004. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4005. following constants:
  4006. @table @option
  4007. @item dar
  4008. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4009. @item hsub
  4010. @item vsub
  4011. horizontal and vertical chroma subsample values. For example for the
  4012. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4013. @item in_h, ih
  4014. @item in_w, iw
  4015. The input grid cell width and height.
  4016. @item sar
  4017. The input sample aspect ratio.
  4018. @item x
  4019. @item y
  4020. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4021. @item w
  4022. @item h
  4023. The width and height of the drawn cell.
  4024. @item t
  4025. The thickness of the drawn cell.
  4026. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4027. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4028. @end table
  4029. @subsection Examples
  4030. @itemize
  4031. @item
  4032. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4033. @example
  4034. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4035. @end example
  4036. @item
  4037. Draw a white 3x3 grid with an opacity of 50%:
  4038. @example
  4039. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4040. @end example
  4041. @end itemize
  4042. @anchor{drawtext}
  4043. @section drawtext
  4044. Draw a text string or text from a specified file on top of a video, using the
  4045. libfreetype library.
  4046. To enable compilation of this filter, you need to configure FFmpeg with
  4047. @code{--enable-libfreetype}.
  4048. To enable default font fallback and the @var{font} option you need to
  4049. configure FFmpeg with @code{--enable-libfontconfig}.
  4050. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4051. @code{--enable-libfribidi}.
  4052. @subsection Syntax
  4053. It accepts the following parameters:
  4054. @table @option
  4055. @item box
  4056. Used to draw a box around text using the background color.
  4057. The value must be either 1 (enable) or 0 (disable).
  4058. The default value of @var{box} is 0.
  4059. @item boxborderw
  4060. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4061. The default value of @var{boxborderw} is 0.
  4062. @item boxcolor
  4063. The color to be used for drawing box around text. For the syntax of this
  4064. option, check the "Color" section in the ffmpeg-utils manual.
  4065. The default value of @var{boxcolor} is "white".
  4066. @item borderw
  4067. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4068. The default value of @var{borderw} is 0.
  4069. @item bordercolor
  4070. Set the color to be used for drawing border around text. For the syntax of this
  4071. option, check the "Color" section in the ffmpeg-utils manual.
  4072. The default value of @var{bordercolor} is "black".
  4073. @item expansion
  4074. Select how the @var{text} is expanded. Can be either @code{none},
  4075. @code{strftime} (deprecated) or
  4076. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4077. below for details.
  4078. @item fix_bounds
  4079. If true, check and fix text coords to avoid clipping.
  4080. @item fontcolor
  4081. The color to be used for drawing fonts. For the syntax of this option, check
  4082. the "Color" section in the ffmpeg-utils manual.
  4083. The default value of @var{fontcolor} is "black".
  4084. @item fontcolor_expr
  4085. String which is expanded the same way as @var{text} to obtain dynamic
  4086. @var{fontcolor} value. By default this option has empty value and is not
  4087. processed. When this option is set, it overrides @var{fontcolor} option.
  4088. @item font
  4089. The font family to be used for drawing text. By default Sans.
  4090. @item fontfile
  4091. The font file to be used for drawing text. The path must be included.
  4092. This parameter is mandatory if the fontconfig support is disabled.
  4093. @item draw
  4094. This option does not exist, please see the timeline system
  4095. @item alpha
  4096. Draw the text applying alpha blending. The value can
  4097. be either a number between 0.0 and 1.0
  4098. The expression accepts the same variables @var{x, y} do.
  4099. The default value is 1.
  4100. Please see fontcolor_expr
  4101. @item fontsize
  4102. The font size to be used for drawing text.
  4103. The default value of @var{fontsize} is 16.
  4104. @item text_shaping
  4105. If set to 1, attempt to shape the text (for example, reverse the order of
  4106. right-to-left text and join Arabic characters) before drawing it.
  4107. Otherwise, just draw the text exactly as given.
  4108. By default 1 (if supported).
  4109. @item ft_load_flags
  4110. The flags to be used for loading the fonts.
  4111. The flags map the corresponding flags supported by libfreetype, and are
  4112. a combination of the following values:
  4113. @table @var
  4114. @item default
  4115. @item no_scale
  4116. @item no_hinting
  4117. @item render
  4118. @item no_bitmap
  4119. @item vertical_layout
  4120. @item force_autohint
  4121. @item crop_bitmap
  4122. @item pedantic
  4123. @item ignore_global_advance_width
  4124. @item no_recurse
  4125. @item ignore_transform
  4126. @item monochrome
  4127. @item linear_design
  4128. @item no_autohint
  4129. @end table
  4130. Default value is "default".
  4131. For more information consult the documentation for the FT_LOAD_*
  4132. libfreetype flags.
  4133. @item shadowcolor
  4134. The color to be used for drawing a shadow behind the drawn text. For the
  4135. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4136. The default value of @var{shadowcolor} is "black".
  4137. @item shadowx
  4138. @item shadowy
  4139. The x and y offsets for the text shadow position with respect to the
  4140. position of the text. They can be either positive or negative
  4141. values. The default value for both is "0".
  4142. @item start_number
  4143. The starting frame number for the n/frame_num variable. The default value
  4144. is "0".
  4145. @item tabsize
  4146. The size in number of spaces to use for rendering the tab.
  4147. Default value is 4.
  4148. @item timecode
  4149. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4150. format. It can be used with or without text parameter. @var{timecode_rate}
  4151. option must be specified.
  4152. @item timecode_rate, rate, r
  4153. Set the timecode frame rate (timecode only).
  4154. @item text
  4155. The text string to be drawn. The text must be a sequence of UTF-8
  4156. encoded characters.
  4157. This parameter is mandatory if no file is specified with the parameter
  4158. @var{textfile}.
  4159. @item textfile
  4160. A text file containing text to be drawn. The text must be a sequence
  4161. of UTF-8 encoded characters.
  4162. This parameter is mandatory if no text string is specified with the
  4163. parameter @var{text}.
  4164. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4165. @item reload
  4166. If set to 1, the @var{textfile} will be reloaded before each frame.
  4167. Be sure to update it atomically, or it may be read partially, or even fail.
  4168. @item x
  4169. @item y
  4170. The expressions which specify the offsets where text will be drawn
  4171. within the video frame. They are relative to the top/left border of the
  4172. output image.
  4173. The default value of @var{x} and @var{y} is "0".
  4174. See below for the list of accepted constants and functions.
  4175. @end table
  4176. The parameters for @var{x} and @var{y} are expressions containing the
  4177. following constants and functions:
  4178. @table @option
  4179. @item dar
  4180. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4181. @item hsub
  4182. @item vsub
  4183. horizontal and vertical chroma subsample values. For example for the
  4184. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4185. @item line_h, lh
  4186. the height of each text line
  4187. @item main_h, h, H
  4188. the input height
  4189. @item main_w, w, W
  4190. the input width
  4191. @item max_glyph_a, ascent
  4192. the maximum distance from the baseline to the highest/upper grid
  4193. coordinate used to place a glyph outline point, for all the rendered
  4194. glyphs.
  4195. It is a positive value, due to the grid's orientation with the Y axis
  4196. upwards.
  4197. @item max_glyph_d, descent
  4198. the maximum distance from the baseline to the lowest grid coordinate
  4199. used to place a glyph outline point, for all the rendered glyphs.
  4200. This is a negative value, due to the grid's orientation, with the Y axis
  4201. upwards.
  4202. @item max_glyph_h
  4203. maximum glyph height, that is the maximum height for all the glyphs
  4204. contained in the rendered text, it is equivalent to @var{ascent} -
  4205. @var{descent}.
  4206. @item max_glyph_w
  4207. maximum glyph width, that is the maximum width for all the glyphs
  4208. contained in the rendered text
  4209. @item n
  4210. the number of input frame, starting from 0
  4211. @item rand(min, max)
  4212. return a random number included between @var{min} and @var{max}
  4213. @item sar
  4214. The input sample aspect ratio.
  4215. @item t
  4216. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4217. @item text_h, th
  4218. the height of the rendered text
  4219. @item text_w, tw
  4220. the width of the rendered text
  4221. @item x
  4222. @item y
  4223. the x and y offset coordinates where the text is drawn.
  4224. These parameters allow the @var{x} and @var{y} expressions to refer
  4225. each other, so you can for example specify @code{y=x/dar}.
  4226. @end table
  4227. @anchor{drawtext_expansion}
  4228. @subsection Text expansion
  4229. If @option{expansion} is set to @code{strftime},
  4230. the filter recognizes strftime() sequences in the provided text and
  4231. expands them accordingly. Check the documentation of strftime(). This
  4232. feature is deprecated.
  4233. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4234. If @option{expansion} is set to @code{normal} (which is the default),
  4235. the following expansion mechanism is used.
  4236. The backslash character @samp{\}, followed by any character, always expands to
  4237. the second character.
  4238. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4239. braces is a function name, possibly followed by arguments separated by ':'.
  4240. If the arguments contain special characters or delimiters (':' or '@}'),
  4241. they should be escaped.
  4242. Note that they probably must also be escaped as the value for the
  4243. @option{text} option in the filter argument string and as the filter
  4244. argument in the filtergraph description, and possibly also for the shell,
  4245. that makes up to four levels of escaping; using a text file avoids these
  4246. problems.
  4247. The following functions are available:
  4248. @table @command
  4249. @item expr, e
  4250. The expression evaluation result.
  4251. It must take one argument specifying the expression to be evaluated,
  4252. which accepts the same constants and functions as the @var{x} and
  4253. @var{y} values. Note that not all constants should be used, for
  4254. example the text size is not known when evaluating the expression, so
  4255. the constants @var{text_w} and @var{text_h} will have an undefined
  4256. value.
  4257. @item expr_int_format, eif
  4258. Evaluate the expression's value and output as formatted integer.
  4259. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4260. The second argument specifies the output format. Allowed values are @samp{x},
  4261. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4262. @code{printf} function.
  4263. The third parameter is optional and sets the number of positions taken by the output.
  4264. It can be used to add padding with zeros from the left.
  4265. @item gmtime
  4266. The time at which the filter is running, expressed in UTC.
  4267. It can accept an argument: a strftime() format string.
  4268. @item localtime
  4269. The time at which the filter is running, expressed in the local time zone.
  4270. It can accept an argument: a strftime() format string.
  4271. @item metadata
  4272. Frame metadata. It must take one argument specifying metadata key.
  4273. @item n, frame_num
  4274. The frame number, starting from 0.
  4275. @item pict_type
  4276. A 1 character description of the current picture type.
  4277. @item pts
  4278. The timestamp of the current frame.
  4279. It can take up to three arguments.
  4280. The first argument is the format of the timestamp; it defaults to @code{flt}
  4281. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4282. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4283. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4284. @code{localtime} stands for the timestamp of the frame formatted as
  4285. local time zone time.
  4286. The second argument is an offset added to the timestamp.
  4287. If the format is set to @code{localtime} or @code{gmtime},
  4288. a third argument may be supplied: a strftime() format string.
  4289. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4290. @end table
  4291. @subsection Examples
  4292. @itemize
  4293. @item
  4294. Draw "Test Text" with font FreeSerif, using the default values for the
  4295. optional parameters.
  4296. @example
  4297. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4298. @end example
  4299. @item
  4300. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4301. and y=50 (counting from the top-left corner of the screen), text is
  4302. yellow with a red box around it. Both the text and the box have an
  4303. opacity of 20%.
  4304. @example
  4305. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4306. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4307. @end example
  4308. Note that the double quotes are not necessary if spaces are not used
  4309. within the parameter list.
  4310. @item
  4311. Show the text at the center of the video frame:
  4312. @example
  4313. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  4314. @end example
  4315. @item
  4316. Show a text line sliding from right to left in the last row of the video
  4317. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4318. with no newlines.
  4319. @example
  4320. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4321. @end example
  4322. @item
  4323. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4324. @example
  4325. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4326. @end example
  4327. @item
  4328. Draw a single green letter "g", at the center of the input video.
  4329. The glyph baseline is placed at half screen height.
  4330. @example
  4331. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4332. @end example
  4333. @item
  4334. Show text for 1 second every 3 seconds:
  4335. @example
  4336. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4337. @end example
  4338. @item
  4339. Use fontconfig to set the font. Note that the colons need to be escaped.
  4340. @example
  4341. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4342. @end example
  4343. @item
  4344. Print the date of a real-time encoding (see strftime(3)):
  4345. @example
  4346. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4347. @end example
  4348. @item
  4349. Show text fading in and out (appearing/disappearing):
  4350. @example
  4351. #!/bin/sh
  4352. DS=1.0 # display start
  4353. DE=10.0 # display end
  4354. FID=1.5 # fade in duration
  4355. FOD=5 # fade out duration
  4356. ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
  4357. @end example
  4358. @end itemize
  4359. For more information about libfreetype, check:
  4360. @url{http://www.freetype.org/}.
  4361. For more information about fontconfig, check:
  4362. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4363. For more information about libfribidi, check:
  4364. @url{http://fribidi.org/}.
  4365. @section edgedetect
  4366. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4367. The filter accepts the following options:
  4368. @table @option
  4369. @item low
  4370. @item high
  4371. Set low and high threshold values used by the Canny thresholding
  4372. algorithm.
  4373. The high threshold selects the "strong" edge pixels, which are then
  4374. connected through 8-connectivity with the "weak" edge pixels selected
  4375. by the low threshold.
  4376. @var{low} and @var{high} threshold values must be chosen in the range
  4377. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4378. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4379. is @code{50/255}.
  4380. @item mode
  4381. Define the drawing mode.
  4382. @table @samp
  4383. @item wires
  4384. Draw white/gray wires on black background.
  4385. @item colormix
  4386. Mix the colors to create a paint/cartoon effect.
  4387. @end table
  4388. Default value is @var{wires}.
  4389. @end table
  4390. @subsection Examples
  4391. @itemize
  4392. @item
  4393. Standard edge detection with custom values for the hysteresis thresholding:
  4394. @example
  4395. edgedetect=low=0.1:high=0.4
  4396. @end example
  4397. @item
  4398. Painting effect without thresholding:
  4399. @example
  4400. edgedetect=mode=colormix:high=0
  4401. @end example
  4402. @end itemize
  4403. @section eq
  4404. Set brightness, contrast, saturation and approximate gamma adjustment.
  4405. The filter accepts the following options:
  4406. @table @option
  4407. @item contrast
  4408. Set the contrast expression. The value must be a float value in range
  4409. @code{-2.0} to @code{2.0}. The default value is "1".
  4410. @item brightness
  4411. Set the brightness expression. The value must be a float value in
  4412. range @code{-1.0} to @code{1.0}. The default value is "0".
  4413. @item saturation
  4414. Set the saturation expression. The value must be a float in
  4415. range @code{0.0} to @code{3.0}. The default value is "1".
  4416. @item gamma
  4417. Set the gamma expression. The value must be a float in range
  4418. @code{0.1} to @code{10.0}. The default value is "1".
  4419. @item gamma_r
  4420. Set the gamma expression for red. The value must be a float in
  4421. range @code{0.1} to @code{10.0}. The default value is "1".
  4422. @item gamma_g
  4423. Set the gamma expression for green. The value must be a float in range
  4424. @code{0.1} to @code{10.0}. The default value is "1".
  4425. @item gamma_b
  4426. Set the gamma expression for blue. The value must be a float in range
  4427. @code{0.1} to @code{10.0}. The default value is "1".
  4428. @item gamma_weight
  4429. Set the gamma weight expression. It can be used to reduce the effect
  4430. of a high gamma value on bright image areas, e.g. keep them from
  4431. getting overamplified and just plain white. The value must be a float
  4432. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4433. gamma correction all the way down while @code{1.0} leaves it at its
  4434. full strength. Default is "1".
  4435. @item eval
  4436. Set when the expressions for brightness, contrast, saturation and
  4437. gamma expressions are evaluated.
  4438. It accepts the following values:
  4439. @table @samp
  4440. @item init
  4441. only evaluate expressions once during the filter initialization or
  4442. when a command is processed
  4443. @item frame
  4444. evaluate expressions for each incoming frame
  4445. @end table
  4446. Default value is @samp{init}.
  4447. @end table
  4448. The expressions accept the following parameters:
  4449. @table @option
  4450. @item n
  4451. frame count of the input frame starting from 0
  4452. @item pos
  4453. byte position of the corresponding packet in the input file, NAN if
  4454. unspecified
  4455. @item r
  4456. frame rate of the input video, NAN if the input frame rate is unknown
  4457. @item t
  4458. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4459. @end table
  4460. @subsection Commands
  4461. The filter supports the following commands:
  4462. @table @option
  4463. @item contrast
  4464. Set the contrast expression.
  4465. @item brightness
  4466. Set the brightness expression.
  4467. @item saturation
  4468. Set the saturation expression.
  4469. @item gamma
  4470. Set the gamma expression.
  4471. @item gamma_r
  4472. Set the gamma_r expression.
  4473. @item gamma_g
  4474. Set gamma_g expression.
  4475. @item gamma_b
  4476. Set gamma_b expression.
  4477. @item gamma_weight
  4478. Set gamma_weight expression.
  4479. The command accepts the same syntax of the corresponding option.
  4480. If the specified expression is not valid, it is kept at its current
  4481. value.
  4482. @end table
  4483. @section erosion
  4484. Apply erosion effect to the video.
  4485. This filter replaces the pixel by the local(3x3) minimum.
  4486. It accepts the following options:
  4487. @table @option
  4488. @item threshold0
  4489. @item threshold1
  4490. @item threshold2
  4491. @item threshold3
  4492. Limit the maximum change for each plane, default is 65535.
  4493. If 0, plane will remain unchanged.
  4494. @item coordinates
  4495. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4496. pixels are used.
  4497. Flags to local 3x3 coordinates maps like this:
  4498. 1 2 3
  4499. 4 5
  4500. 6 7 8
  4501. @end table
  4502. @section extractplanes
  4503. Extract color channel components from input video stream into
  4504. separate grayscale video streams.
  4505. The filter accepts the following option:
  4506. @table @option
  4507. @item planes
  4508. Set plane(s) to extract.
  4509. Available values for planes are:
  4510. @table @samp
  4511. @item y
  4512. @item u
  4513. @item v
  4514. @item a
  4515. @item r
  4516. @item g
  4517. @item b
  4518. @end table
  4519. Choosing planes not available in the input will result in an error.
  4520. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4521. with @code{y}, @code{u}, @code{v} planes at same time.
  4522. @end table
  4523. @subsection Examples
  4524. @itemize
  4525. @item
  4526. Extract luma, u and v color channel component from input video frame
  4527. into 3 grayscale outputs:
  4528. @example
  4529. 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
  4530. @end example
  4531. @end itemize
  4532. @section elbg
  4533. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4534. For each input image, the filter will compute the optimal mapping from
  4535. the input to the output given the codebook length, that is the number
  4536. of distinct output colors.
  4537. This filter accepts the following options.
  4538. @table @option
  4539. @item codebook_length, l
  4540. Set codebook length. The value must be a positive integer, and
  4541. represents the number of distinct output colors. Default value is 256.
  4542. @item nb_steps, n
  4543. Set the maximum number of iterations to apply for computing the optimal
  4544. mapping. The higher the value the better the result and the higher the
  4545. computation time. Default value is 1.
  4546. @item seed, s
  4547. Set a random seed, must be an integer included between 0 and
  4548. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4549. will try to use a good random seed on a best effort basis.
  4550. @item pal8
  4551. Set pal8 output pixel format. This option does not work with codebook
  4552. length greater than 256.
  4553. @end table
  4554. @section fade
  4555. Apply a fade-in/out effect to the input video.
  4556. It accepts the following parameters:
  4557. @table @option
  4558. @item type, t
  4559. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4560. effect.
  4561. Default is @code{in}.
  4562. @item start_frame, s
  4563. Specify the number of the frame to start applying the fade
  4564. effect at. Default is 0.
  4565. @item nb_frames, n
  4566. The number of frames that the fade effect lasts. At the end of the
  4567. fade-in effect, the output video will have the same intensity as the input video.
  4568. At the end of the fade-out transition, the output video will be filled with the
  4569. selected @option{color}.
  4570. Default is 25.
  4571. @item alpha
  4572. If set to 1, fade only alpha channel, if one exists on the input.
  4573. Default value is 0.
  4574. @item start_time, st
  4575. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4576. effect. If both start_frame and start_time are specified, the fade will start at
  4577. whichever comes last. Default is 0.
  4578. @item duration, d
  4579. The number of seconds for which the fade effect has to last. At the end of the
  4580. fade-in effect the output video will have the same intensity as the input video,
  4581. at the end of the fade-out transition the output video will be filled with the
  4582. selected @option{color}.
  4583. If both duration and nb_frames are specified, duration is used. Default is 0
  4584. (nb_frames is used by default).
  4585. @item color, c
  4586. Specify the color of the fade. Default is "black".
  4587. @end table
  4588. @subsection Examples
  4589. @itemize
  4590. @item
  4591. Fade in the first 30 frames of video:
  4592. @example
  4593. fade=in:0:30
  4594. @end example
  4595. The command above is equivalent to:
  4596. @example
  4597. fade=t=in:s=0:n=30
  4598. @end example
  4599. @item
  4600. Fade out the last 45 frames of a 200-frame video:
  4601. @example
  4602. fade=out:155:45
  4603. fade=type=out:start_frame=155:nb_frames=45
  4604. @end example
  4605. @item
  4606. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4607. @example
  4608. fade=in:0:25, fade=out:975:25
  4609. @end example
  4610. @item
  4611. Make the first 5 frames yellow, then fade in from frame 5-24:
  4612. @example
  4613. fade=in:5:20:color=yellow
  4614. @end example
  4615. @item
  4616. Fade in alpha over first 25 frames of video:
  4617. @example
  4618. fade=in:0:25:alpha=1
  4619. @end example
  4620. @item
  4621. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4622. @example
  4623. fade=t=in:st=5.5:d=0.5
  4624. @end example
  4625. @end itemize
  4626. @section fftfilt
  4627. Apply arbitrary expressions to samples in frequency domain
  4628. @table @option
  4629. @item dc_Y
  4630. Adjust the dc value (gain) of the luma plane of the image. The filter
  4631. accepts an integer value in range @code{0} to @code{1000}. The default
  4632. value is set to @code{0}.
  4633. @item dc_U
  4634. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4635. filter accepts an integer value in range @code{0} to @code{1000}. The
  4636. default value is set to @code{0}.
  4637. @item dc_V
  4638. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4639. filter accepts an integer value in range @code{0} to @code{1000}. The
  4640. default value is set to @code{0}.
  4641. @item weight_Y
  4642. Set the frequency domain weight expression for the luma plane.
  4643. @item weight_U
  4644. Set the frequency domain weight expression for the 1st chroma plane.
  4645. @item weight_V
  4646. Set the frequency domain weight expression for the 2nd chroma plane.
  4647. The filter accepts the following variables:
  4648. @item X
  4649. @item Y
  4650. The coordinates of the current sample.
  4651. @item W
  4652. @item H
  4653. The width and height of the image.
  4654. @end table
  4655. @subsection Examples
  4656. @itemize
  4657. @item
  4658. High-pass:
  4659. @example
  4660. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4661. @end example
  4662. @item
  4663. Low-pass:
  4664. @example
  4665. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4666. @end example
  4667. @item
  4668. Sharpen:
  4669. @example
  4670. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4671. @end example
  4672. @end itemize
  4673. @section field
  4674. Extract a single field from an interlaced image using stride
  4675. arithmetic to avoid wasting CPU time. The output frames are marked as
  4676. non-interlaced.
  4677. The filter accepts the following options:
  4678. @table @option
  4679. @item type
  4680. Specify whether to extract the top (if the value is @code{0} or
  4681. @code{top}) or the bottom field (if the value is @code{1} or
  4682. @code{bottom}).
  4683. @end table
  4684. @section fieldmatch
  4685. Field matching filter for inverse telecine. It is meant to reconstruct the
  4686. progressive frames from a telecined stream. The filter does not drop duplicated
  4687. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  4688. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  4689. The separation of the field matching and the decimation is notably motivated by
  4690. the possibility of inserting a de-interlacing filter fallback between the two.
  4691. If the source has mixed telecined and real interlaced content,
  4692. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  4693. But these remaining combed frames will be marked as interlaced, and thus can be
  4694. de-interlaced by a later filter such as @ref{yadif} before decimation.
  4695. In addition to the various configuration options, @code{fieldmatch} can take an
  4696. optional second stream, activated through the @option{ppsrc} option. If
  4697. enabled, the frames reconstruction will be based on the fields and frames from
  4698. this second stream. This allows the first input to be pre-processed in order to
  4699. help the various algorithms of the filter, while keeping the output lossless
  4700. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  4701. or brightness/contrast adjustments can help.
  4702. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  4703. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  4704. which @code{fieldmatch} is based on. While the semantic and usage are very
  4705. close, some behaviour and options names can differ.
  4706. The @ref{decimate} filter currently only works for constant frame rate input.
  4707. If your input has mixed telecined (30fps) and progressive content with a lower
  4708. framerate like 24fps use the following filterchain to produce the necessary cfr
  4709. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  4710. The filter accepts the following options:
  4711. @table @option
  4712. @item order
  4713. Specify the assumed field order of the input stream. Available values are:
  4714. @table @samp
  4715. @item auto
  4716. Auto detect parity (use FFmpeg's internal parity value).
  4717. @item bff
  4718. Assume bottom field first.
  4719. @item tff
  4720. Assume top field first.
  4721. @end table
  4722. Note that it is sometimes recommended not to trust the parity announced by the
  4723. stream.
  4724. Default value is @var{auto}.
  4725. @item mode
  4726. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  4727. sense that it won't risk creating jerkiness due to duplicate frames when
  4728. possible, but if there are bad edits or blended fields it will end up
  4729. outputting combed frames when a good match might actually exist. On the other
  4730. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  4731. but will almost always find a good frame if there is one. The other values are
  4732. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  4733. jerkiness and creating duplicate frames versus finding good matches in sections
  4734. with bad edits, orphaned fields, blended fields, etc.
  4735. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  4736. Available values are:
  4737. @table @samp
  4738. @item pc
  4739. 2-way matching (p/c)
  4740. @item pc_n
  4741. 2-way matching, and trying 3rd match if still combed (p/c + n)
  4742. @item pc_u
  4743. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  4744. @item pc_n_ub
  4745. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  4746. still combed (p/c + n + u/b)
  4747. @item pcn
  4748. 3-way matching (p/c/n)
  4749. @item pcn_ub
  4750. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  4751. detected as combed (p/c/n + u/b)
  4752. @end table
  4753. The parenthesis at the end indicate the matches that would be used for that
  4754. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  4755. @var{top}).
  4756. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  4757. the slowest.
  4758. Default value is @var{pc_n}.
  4759. @item ppsrc
  4760. Mark the main input stream as a pre-processed input, and enable the secondary
  4761. input stream as the clean source to pick the fields from. See the filter
  4762. introduction for more details. It is similar to the @option{clip2} feature from
  4763. VFM/TFM.
  4764. Default value is @code{0} (disabled).
  4765. @item field
  4766. Set the field to match from. It is recommended to set this to the same value as
  4767. @option{order} unless you experience matching failures with that setting. In
  4768. certain circumstances changing the field that is used to match from can have a
  4769. large impact on matching performance. Available values are:
  4770. @table @samp
  4771. @item auto
  4772. Automatic (same value as @option{order}).
  4773. @item bottom
  4774. Match from the bottom field.
  4775. @item top
  4776. Match from the top field.
  4777. @end table
  4778. Default value is @var{auto}.
  4779. @item mchroma
  4780. Set whether or not chroma is included during the match comparisons. In most
  4781. cases it is recommended to leave this enabled. You should set this to @code{0}
  4782. only if your clip has bad chroma problems such as heavy rainbowing or other
  4783. artifacts. Setting this to @code{0} could also be used to speed things up at
  4784. the cost of some accuracy.
  4785. Default value is @code{1}.
  4786. @item y0
  4787. @item y1
  4788. These define an exclusion band which excludes the lines between @option{y0} and
  4789. @option{y1} from being included in the field matching decision. An exclusion
  4790. band can be used to ignore subtitles, a logo, or other things that may
  4791. interfere with the matching. @option{y0} sets the starting scan line and
  4792. @option{y1} sets the ending line; all lines in between @option{y0} and
  4793. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  4794. @option{y0} and @option{y1} to the same value will disable the feature.
  4795. @option{y0} and @option{y1} defaults to @code{0}.
  4796. @item scthresh
  4797. Set the scene change detection threshold as a percentage of maximum change on
  4798. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  4799. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  4800. @option{scthresh} is @code{[0.0, 100.0]}.
  4801. Default value is @code{12.0}.
  4802. @item combmatch
  4803. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  4804. account the combed scores of matches when deciding what match to use as the
  4805. final match. Available values are:
  4806. @table @samp
  4807. @item none
  4808. No final matching based on combed scores.
  4809. @item sc
  4810. Combed scores are only used when a scene change is detected.
  4811. @item full
  4812. Use combed scores all the time.
  4813. @end table
  4814. Default is @var{sc}.
  4815. @item combdbg
  4816. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  4817. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  4818. Available values are:
  4819. @table @samp
  4820. @item none
  4821. No forced calculation.
  4822. @item pcn
  4823. Force p/c/n calculations.
  4824. @item pcnub
  4825. Force p/c/n/u/b calculations.
  4826. @end table
  4827. Default value is @var{none}.
  4828. @item cthresh
  4829. This is the area combing threshold used for combed frame detection. This
  4830. essentially controls how "strong" or "visible" combing must be to be detected.
  4831. Larger values mean combing must be more visible and smaller values mean combing
  4832. can be less visible or strong and still be detected. Valid settings are from
  4833. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  4834. be detected as combed). This is basically a pixel difference value. A good
  4835. range is @code{[8, 12]}.
  4836. Default value is @code{9}.
  4837. @item chroma
  4838. Sets whether or not chroma is considered in the combed frame decision. Only
  4839. disable this if your source has chroma problems (rainbowing, etc.) that are
  4840. causing problems for the combed frame detection with chroma enabled. Actually,
  4841. using @option{chroma}=@var{0} is usually more reliable, except for the case
  4842. where there is chroma only combing in the source.
  4843. Default value is @code{0}.
  4844. @item blockx
  4845. @item blocky
  4846. Respectively set the x-axis and y-axis size of the window used during combed
  4847. frame detection. This has to do with the size of the area in which
  4848. @option{combpel} pixels are required to be detected as combed for a frame to be
  4849. declared combed. See the @option{combpel} parameter description for more info.
  4850. Possible values are any number that is a power of 2 starting at 4 and going up
  4851. to 512.
  4852. Default value is @code{16}.
  4853. @item combpel
  4854. The number of combed pixels inside any of the @option{blocky} by
  4855. @option{blockx} size blocks on the frame for the frame to be detected as
  4856. combed. While @option{cthresh} controls how "visible" the combing must be, this
  4857. setting controls "how much" combing there must be in any localized area (a
  4858. window defined by the @option{blockx} and @option{blocky} settings) on the
  4859. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  4860. which point no frames will ever be detected as combed). This setting is known
  4861. as @option{MI} in TFM/VFM vocabulary.
  4862. Default value is @code{80}.
  4863. @end table
  4864. @anchor{p/c/n/u/b meaning}
  4865. @subsection p/c/n/u/b meaning
  4866. @subsubsection p/c/n
  4867. We assume the following telecined stream:
  4868. @example
  4869. Top fields: 1 2 2 3 4
  4870. Bottom fields: 1 2 3 4 4
  4871. @end example
  4872. The numbers correspond to the progressive frame the fields relate to. Here, the
  4873. first two frames are progressive, the 3rd and 4th are combed, and so on.
  4874. When @code{fieldmatch} is configured to run a matching from bottom
  4875. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  4876. @example
  4877. Input stream:
  4878. T 1 2 2 3 4
  4879. B 1 2 3 4 4 <-- matching reference
  4880. Matches: c c n n c
  4881. Output stream:
  4882. T 1 2 3 4 4
  4883. B 1 2 3 4 4
  4884. @end example
  4885. As a result of the field matching, we can see that some frames get duplicated.
  4886. To perform a complete inverse telecine, you need to rely on a decimation filter
  4887. after this operation. See for instance the @ref{decimate} filter.
  4888. The same operation now matching from top fields (@option{field}=@var{top})
  4889. looks like this:
  4890. @example
  4891. Input stream:
  4892. T 1 2 2 3 4 <-- matching reference
  4893. B 1 2 3 4 4
  4894. Matches: c c p p c
  4895. Output stream:
  4896. T 1 2 2 3 4
  4897. B 1 2 2 3 4
  4898. @end example
  4899. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  4900. basically, they refer to the frame and field of the opposite parity:
  4901. @itemize
  4902. @item @var{p} matches the field of the opposite parity in the previous frame
  4903. @item @var{c} matches the field of the opposite parity in the current frame
  4904. @item @var{n} matches the field of the opposite parity in the next frame
  4905. @end itemize
  4906. @subsubsection u/b
  4907. The @var{u} and @var{b} matching are a bit special in the sense that they match
  4908. from the opposite parity flag. In the following examples, we assume that we are
  4909. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  4910. 'x' is placed above and below each matched fields.
  4911. With bottom matching (@option{field}=@var{bottom}):
  4912. @example
  4913. Match: c p n b u
  4914. x x x x x
  4915. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4916. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4917. x x x x x
  4918. Output frames:
  4919. 2 1 2 2 2
  4920. 2 2 2 1 3
  4921. @end example
  4922. With top matching (@option{field}=@var{top}):
  4923. @example
  4924. Match: c p n b u
  4925. x x x x x
  4926. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4927. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4928. x x x x x
  4929. Output frames:
  4930. 2 2 2 1 2
  4931. 2 1 3 2 2
  4932. @end example
  4933. @subsection Examples
  4934. Simple IVTC of a top field first telecined stream:
  4935. @example
  4936. fieldmatch=order=tff:combmatch=none, decimate
  4937. @end example
  4938. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  4939. @example
  4940. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  4941. @end example
  4942. @section fieldorder
  4943. Transform the field order of the input video.
  4944. It accepts the following parameters:
  4945. @table @option
  4946. @item order
  4947. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  4948. for bottom field first.
  4949. @end table
  4950. The default value is @samp{tff}.
  4951. The transformation is done by shifting the picture content up or down
  4952. by one line, and filling the remaining line with appropriate picture content.
  4953. This method is consistent with most broadcast field order converters.
  4954. If the input video is not flagged as being interlaced, or it is already
  4955. flagged as being of the required output field order, then this filter does
  4956. not alter the incoming video.
  4957. It is very useful when converting to or from PAL DV material,
  4958. which is bottom field first.
  4959. For example:
  4960. @example
  4961. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  4962. @end example
  4963. @section fifo, afifo
  4964. Buffer input images and send them when they are requested.
  4965. It is mainly useful when auto-inserted by the libavfilter
  4966. framework.
  4967. It does not take parameters.
  4968. @section find_rect
  4969. Find a rectangular object
  4970. It accepts the following options:
  4971. @table @option
  4972. @item object
  4973. Filepath of the object image, needs to be in gray8.
  4974. @item threshold
  4975. Detection threshold, default is 0.5.
  4976. @item mipmaps
  4977. Number of mipmaps, default is 3.
  4978. @item xmin, ymin, xmax, ymax
  4979. Specifies the rectangle in which to search.
  4980. @end table
  4981. @subsection Examples
  4982. @itemize
  4983. @item
  4984. Generate a representative palette of a given video using @command{ffmpeg}:
  4985. @example
  4986. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  4987. @end example
  4988. @end itemize
  4989. @section cover_rect
  4990. Cover a rectangular object
  4991. It accepts the following options:
  4992. @table @option
  4993. @item cover
  4994. Filepath of the optional cover image, needs to be in yuv420.
  4995. @item mode
  4996. Set covering mode.
  4997. It accepts the following values:
  4998. @table @samp
  4999. @item cover
  5000. cover it by the supplied image
  5001. @item blur
  5002. cover it by interpolating the surrounding pixels
  5003. @end table
  5004. Default value is @var{blur}.
  5005. @end table
  5006. @subsection Examples
  5007. @itemize
  5008. @item
  5009. Generate a representative palette of a given video using @command{ffmpeg}:
  5010. @example
  5011. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5012. @end example
  5013. @end itemize
  5014. @anchor{format}
  5015. @section format
  5016. Convert the input video to one of the specified pixel formats.
  5017. Libavfilter will try to pick one that is suitable as input to
  5018. the next filter.
  5019. It accepts the following parameters:
  5020. @table @option
  5021. @item pix_fmts
  5022. A '|'-separated list of pixel format names, such as
  5023. "pix_fmts=yuv420p|monow|rgb24".
  5024. @end table
  5025. @subsection Examples
  5026. @itemize
  5027. @item
  5028. Convert the input video to the @var{yuv420p} format
  5029. @example
  5030. format=pix_fmts=yuv420p
  5031. @end example
  5032. Convert the input video to any of the formats in the list
  5033. @example
  5034. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5035. @end example
  5036. @end itemize
  5037. @anchor{fps}
  5038. @section fps
  5039. Convert the video to specified constant frame rate by duplicating or dropping
  5040. frames as necessary.
  5041. It accepts the following parameters:
  5042. @table @option
  5043. @item fps
  5044. The desired output frame rate. The default is @code{25}.
  5045. @item round
  5046. Rounding method.
  5047. Possible values are:
  5048. @table @option
  5049. @item zero
  5050. zero round towards 0
  5051. @item inf
  5052. round away from 0
  5053. @item down
  5054. round towards -infinity
  5055. @item up
  5056. round towards +infinity
  5057. @item near
  5058. round to nearest
  5059. @end table
  5060. The default is @code{near}.
  5061. @item start_time
  5062. Assume the first PTS should be the given value, in seconds. This allows for
  5063. padding/trimming at the start of stream. By default, no assumption is made
  5064. about the first frame's expected PTS, so no padding or trimming is done.
  5065. For example, this could be set to 0 to pad the beginning with duplicates of
  5066. the first frame if a video stream starts after the audio stream or to trim any
  5067. frames with a negative PTS.
  5068. @end table
  5069. Alternatively, the options can be specified as a flat string:
  5070. @var{fps}[:@var{round}].
  5071. See also the @ref{setpts} filter.
  5072. @subsection Examples
  5073. @itemize
  5074. @item
  5075. A typical usage in order to set the fps to 25:
  5076. @example
  5077. fps=fps=25
  5078. @end example
  5079. @item
  5080. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5081. @example
  5082. fps=fps=film:round=near
  5083. @end example
  5084. @end itemize
  5085. @section framepack
  5086. Pack two different video streams into a stereoscopic video, setting proper
  5087. metadata on supported codecs. The two views should have the same size and
  5088. framerate and processing will stop when the shorter video ends. Please note
  5089. that you may conveniently adjust view properties with the @ref{scale} and
  5090. @ref{fps} filters.
  5091. It accepts the following parameters:
  5092. @table @option
  5093. @item format
  5094. The desired packing format. Supported values are:
  5095. @table @option
  5096. @item sbs
  5097. The views are next to each other (default).
  5098. @item tab
  5099. The views are on top of each other.
  5100. @item lines
  5101. The views are packed by line.
  5102. @item columns
  5103. The views are packed by column.
  5104. @item frameseq
  5105. The views are temporally interleaved.
  5106. @end table
  5107. @end table
  5108. Some examples:
  5109. @example
  5110. # Convert left and right views into a frame-sequential video
  5111. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5112. # Convert views into a side-by-side video with the same output resolution as the input
  5113. ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
  5114. @end example
  5115. @section framerate
  5116. Change the frame rate by interpolating new video output frames from the source
  5117. frames.
  5118. This filter is not designed to function correctly with interlaced media. If
  5119. you wish to change the frame rate of interlaced media then you are required
  5120. to deinterlace before this filter and re-interlace after this filter.
  5121. A description of the accepted options follows.
  5122. @table @option
  5123. @item fps
  5124. Specify the output frames per second. This option can also be specified
  5125. as a value alone. The default is @code{50}.
  5126. @item interp_start
  5127. Specify the start of a range where the output frame will be created as a
  5128. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5129. the default is @code{15}.
  5130. @item interp_end
  5131. Specify the end of a range where the output frame will be created as a
  5132. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5133. the default is @code{240}.
  5134. @item scene
  5135. Specify the level at which a scene change is detected as a value between
  5136. 0 and 100 to indicate a new scene; a low value reflects a low
  5137. probability for the current frame to introduce a new scene, while a higher
  5138. value means the current frame is more likely to be one.
  5139. The default is @code{7}.
  5140. @item flags
  5141. Specify flags influencing the filter process.
  5142. Available value for @var{flags} is:
  5143. @table @option
  5144. @item scene_change_detect, scd
  5145. Enable scene change detection using the value of the option @var{scene}.
  5146. This flag is enabled by default.
  5147. @end table
  5148. @end table
  5149. @section framestep
  5150. Select one frame every N-th frame.
  5151. This filter accepts the following option:
  5152. @table @option
  5153. @item step
  5154. Select frame after every @code{step} frames.
  5155. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5156. @end table
  5157. @anchor{frei0r}
  5158. @section frei0r
  5159. Apply a frei0r effect to the input video.
  5160. To enable the compilation of this filter, you need to install the frei0r
  5161. header and configure FFmpeg with @code{--enable-frei0r}.
  5162. It accepts the following parameters:
  5163. @table @option
  5164. @item filter_name
  5165. The name of the frei0r effect to load. If the environment variable
  5166. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5167. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5168. Otherwise, the standard frei0r paths are searched, in this order:
  5169. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5170. @file{/usr/lib/frei0r-1/}.
  5171. @item filter_params
  5172. A '|'-separated list of parameters to pass to the frei0r effect.
  5173. @end table
  5174. A frei0r effect parameter can be a boolean (its value is either
  5175. "y" or "n"), a double, a color (specified as
  5176. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5177. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5178. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5179. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5180. The number and types of parameters depend on the loaded effect. If an
  5181. effect parameter is not specified, the default value is set.
  5182. @subsection Examples
  5183. @itemize
  5184. @item
  5185. Apply the distort0r effect, setting the first two double parameters:
  5186. @example
  5187. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5188. @end example
  5189. @item
  5190. Apply the colordistance effect, taking a color as the first parameter:
  5191. @example
  5192. frei0r=colordistance:0.2/0.3/0.4
  5193. frei0r=colordistance:violet
  5194. frei0r=colordistance:0x112233
  5195. @end example
  5196. @item
  5197. Apply the perspective effect, specifying the top left and top right image
  5198. positions:
  5199. @example
  5200. frei0r=perspective:0.2/0.2|0.8/0.2
  5201. @end example
  5202. @end itemize
  5203. For more information, see
  5204. @url{http://frei0r.dyne.org}
  5205. @section fspp
  5206. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5207. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5208. processing filter, one of them is performed once per block, not per pixel.
  5209. This allows for much higher speed.
  5210. The filter accepts the following options:
  5211. @table @option
  5212. @item quality
  5213. Set quality. This option defines the number of levels for averaging. It accepts
  5214. an integer in the range 4-5. Default value is @code{4}.
  5215. @item qp
  5216. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5217. If not set, the filter will use the QP from the video stream (if available).
  5218. @item strength
  5219. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5220. more details but also more artifacts, while higher values make the image smoother
  5221. but also blurrier. Default value is @code{0} − PSNR optimal.
  5222. @item use_bframe_qp
  5223. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5224. option may cause flicker since the B-Frames have often larger QP. Default is
  5225. @code{0} (not enabled).
  5226. @end table
  5227. @section geq
  5228. The filter accepts the following options:
  5229. @table @option
  5230. @item lum_expr, lum
  5231. Set the luminance expression.
  5232. @item cb_expr, cb
  5233. Set the chrominance blue expression.
  5234. @item cr_expr, cr
  5235. Set the chrominance red expression.
  5236. @item alpha_expr, a
  5237. Set the alpha expression.
  5238. @item red_expr, r
  5239. Set the red expression.
  5240. @item green_expr, g
  5241. Set the green expression.
  5242. @item blue_expr, b
  5243. Set the blue expression.
  5244. @end table
  5245. The colorspace is selected according to the specified options. If one
  5246. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5247. options is specified, the filter will automatically select a YCbCr
  5248. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5249. @option{blue_expr} options is specified, it will select an RGB
  5250. colorspace.
  5251. If one of the chrominance expression is not defined, it falls back on the other
  5252. one. If no alpha expression is specified it will evaluate to opaque value.
  5253. If none of chrominance expressions are specified, they will evaluate
  5254. to the luminance expression.
  5255. The expressions can use the following variables and functions:
  5256. @table @option
  5257. @item N
  5258. The sequential number of the filtered frame, starting from @code{0}.
  5259. @item X
  5260. @item Y
  5261. The coordinates of the current sample.
  5262. @item W
  5263. @item H
  5264. The width and height of the image.
  5265. @item SW
  5266. @item SH
  5267. Width and height scale depending on the currently filtered plane. It is the
  5268. ratio between the corresponding luma plane number of pixels and the current
  5269. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5270. @code{0.5,0.5} for chroma planes.
  5271. @item T
  5272. Time of the current frame, expressed in seconds.
  5273. @item p(x, y)
  5274. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5275. plane.
  5276. @item lum(x, y)
  5277. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5278. plane.
  5279. @item cb(x, y)
  5280. Return the value of the pixel at location (@var{x},@var{y}) of the
  5281. blue-difference chroma plane. Return 0 if there is no such plane.
  5282. @item cr(x, y)
  5283. Return the value of the pixel at location (@var{x},@var{y}) of the
  5284. red-difference chroma plane. Return 0 if there is no such plane.
  5285. @item r(x, y)
  5286. @item g(x, y)
  5287. @item b(x, y)
  5288. Return the value of the pixel at location (@var{x},@var{y}) of the
  5289. red/green/blue component. Return 0 if there is no such component.
  5290. @item alpha(x, y)
  5291. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5292. plane. Return 0 if there is no such plane.
  5293. @end table
  5294. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5295. automatically clipped to the closer edge.
  5296. @subsection Examples
  5297. @itemize
  5298. @item
  5299. Flip the image horizontally:
  5300. @example
  5301. geq=p(W-X\,Y)
  5302. @end example
  5303. @item
  5304. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5305. wavelength of 100 pixels:
  5306. @example
  5307. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5308. @end example
  5309. @item
  5310. Generate a fancy enigmatic moving light:
  5311. @example
  5312. 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
  5313. @end example
  5314. @item
  5315. Generate a quick emboss effect:
  5316. @example
  5317. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5318. @end example
  5319. @item
  5320. Modify RGB components depending on pixel position:
  5321. @example
  5322. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5323. @end example
  5324. @item
  5325. Create a radial gradient that is the same size as the input (also see
  5326. the @ref{vignette} filter):
  5327. @example
  5328. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5329. @end example
  5330. @item
  5331. Create a linear gradient to use as a mask for another filter, then
  5332. compose with @ref{overlay}. In this example the video will gradually
  5333. become more blurry from the top to the bottom of the y-axis as defined
  5334. by the linear gradient:
  5335. @example
  5336. ffmpeg -i input.mp4 -filter_complex "geq=lum=255*(Y/H),format=gray[grad];[0:v]boxblur=4[blur];[blur][grad]alphamerge[alpha];[0:v][alpha]overlay" output.mp4
  5337. @end example
  5338. @end itemize
  5339. @section gradfun
  5340. Fix the banding artifacts that are sometimes introduced into nearly flat
  5341. regions by truncation to 8bit color depth.
  5342. Interpolate the gradients that should go where the bands are, and
  5343. dither them.
  5344. It is designed for playback only. Do not use it prior to
  5345. lossy compression, because compression tends to lose the dither and
  5346. bring back the bands.
  5347. It accepts the following parameters:
  5348. @table @option
  5349. @item strength
  5350. The maximum amount by which the filter will change any one pixel. This is also
  5351. the threshold for detecting nearly flat regions. Acceptable values range from
  5352. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5353. valid range.
  5354. @item radius
  5355. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5356. gradients, but also prevents the filter from modifying the pixels near detailed
  5357. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5358. values will be clipped to the valid range.
  5359. @end table
  5360. Alternatively, the options can be specified as a flat string:
  5361. @var{strength}[:@var{radius}]
  5362. @subsection Examples
  5363. @itemize
  5364. @item
  5365. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5366. @example
  5367. gradfun=3.5:8
  5368. @end example
  5369. @item
  5370. Specify radius, omitting the strength (which will fall-back to the default
  5371. value):
  5372. @example
  5373. gradfun=radius=8
  5374. @end example
  5375. @end itemize
  5376. @anchor{haldclut}
  5377. @section haldclut
  5378. Apply a Hald CLUT to a video stream.
  5379. First input is the video stream to process, and second one is the Hald CLUT.
  5380. The Hald CLUT input can be a simple picture or a complete video stream.
  5381. The filter accepts the following options:
  5382. @table @option
  5383. @item shortest
  5384. Force termination when the shortest input terminates. Default is @code{0}.
  5385. @item repeatlast
  5386. Continue applying the last CLUT after the end of the stream. A value of
  5387. @code{0} disable the filter after the last frame of the CLUT is reached.
  5388. Default is @code{1}.
  5389. @end table
  5390. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5391. filters share the same internals).
  5392. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5393. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5394. @subsection Workflow examples
  5395. @subsubsection Hald CLUT video stream
  5396. Generate an identity Hald CLUT stream altered with various effects:
  5397. @example
  5398. 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
  5399. @end example
  5400. Note: make sure you use a lossless codec.
  5401. Then use it with @code{haldclut} to apply it on some random stream:
  5402. @example
  5403. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5404. @end example
  5405. The Hald CLUT will be applied to the 10 first seconds (duration of
  5406. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5407. to the remaining frames of the @code{mandelbrot} stream.
  5408. @subsubsection Hald CLUT with preview
  5409. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5410. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5411. biggest possible square starting at the top left of the picture. The remaining
  5412. padding pixels (bottom or right) will be ignored. This area can be used to add
  5413. a preview of the Hald CLUT.
  5414. Typically, the following generated Hald CLUT will be supported by the
  5415. @code{haldclut} filter:
  5416. @example
  5417. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5418. pad=iw+320 [padded_clut];
  5419. smptebars=s=320x256, split [a][b];
  5420. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5421. [main][b] overlay=W-320" -frames:v 1 clut.png
  5422. @end example
  5423. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5424. bars are displayed on the right-top, and below the same color bars processed by
  5425. the color changes.
  5426. Then, the effect of this Hald CLUT can be visualized with:
  5427. @example
  5428. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5429. @end example
  5430. @section hflip
  5431. Flip the input video horizontally.
  5432. For example, to horizontally flip the input video with @command{ffmpeg}:
  5433. @example
  5434. ffmpeg -i in.avi -vf "hflip" out.avi
  5435. @end example
  5436. @section histeq
  5437. This filter applies a global color histogram equalization on a
  5438. per-frame basis.
  5439. It can be used to correct video that has a compressed range of pixel
  5440. intensities. The filter redistributes the pixel intensities to
  5441. equalize their distribution across the intensity range. It may be
  5442. viewed as an "automatically adjusting contrast filter". This filter is
  5443. useful only for correcting degraded or poorly captured source
  5444. video.
  5445. The filter accepts the following options:
  5446. @table @option
  5447. @item strength
  5448. Determine the amount of equalization to be applied. As the strength
  5449. is reduced, the distribution of pixel intensities more-and-more
  5450. approaches that of the input frame. The value must be a float number
  5451. in the range [0,1] and defaults to 0.200.
  5452. @item intensity
  5453. Set the maximum intensity that can generated and scale the output
  5454. values appropriately. The strength should be set as desired and then
  5455. the intensity can be limited if needed to avoid washing-out. The value
  5456. must be a float number in the range [0,1] and defaults to 0.210.
  5457. @item antibanding
  5458. Set the antibanding level. If enabled the filter will randomly vary
  5459. the luminance of output pixels by a small amount to avoid banding of
  5460. the histogram. Possible values are @code{none}, @code{weak} or
  5461. @code{strong}. It defaults to @code{none}.
  5462. @end table
  5463. @section histogram
  5464. Compute and draw a color distribution histogram for the input video.
  5465. The computed histogram is a representation of the color component
  5466. distribution in an image.
  5467. The filter accepts the following options:
  5468. @table @option
  5469. @item mode
  5470. Set histogram mode.
  5471. It accepts the following values:
  5472. @table @samp
  5473. @item levels
  5474. Standard histogram that displays the color components distribution in an
  5475. image. Displays color graph for each color component. Shows distribution of
  5476. the Y, U, V, A or R, G, B components, depending on input format, in the
  5477. current frame. Below each graph a color component scale meter is shown.
  5478. @item color
  5479. Displays chroma values (U/V color placement) in a two dimensional
  5480. graph (which is called a vectorscope). The brighter a pixel in the
  5481. vectorscope, the more pixels of the input frame correspond to that pixel
  5482. (i.e., more pixels have this chroma value). The V component is displayed on
  5483. the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost
  5484. side being V = 255. The U component is displayed on the vertical (Y) axis,
  5485. with the top representing U = 0 and the bottom representing U = 255.
  5486. The position of a white pixel in the graph corresponds to the chroma value of
  5487. a pixel of the input clip. The graph can therefore be used to read the hue
  5488. (color flavor) and the saturation (the dominance of the hue in the color). As
  5489. the hue of a color changes, it moves around the square. At the center of the
  5490. square the saturation is zero, which means that the corresponding pixel has no
  5491. color. If the amount of a specific color is increased (while leaving the other
  5492. colors unchanged) the saturation increases, and the indicator moves towards
  5493. the edge of the square.
  5494. @item color2
  5495. Chroma values in vectorscope, similar as @code{color} but actual chroma values
  5496. are displayed.
  5497. @item waveform
  5498. Per row/column color component graph. In row mode, the graph on the left side
  5499. represents color component value 0 and the right side represents value = 255.
  5500. In column mode, the top side represents color component value = 0 and bottom
  5501. side represents value = 255.
  5502. @end table
  5503. Default value is @code{levels}.
  5504. @item level_height
  5505. Set height of level in @code{levels}. Default value is @code{200}.
  5506. Allowed range is [50, 2048].
  5507. @item scale_height
  5508. Set height of color scale in @code{levels}. Default value is @code{12}.
  5509. Allowed range is [0, 40].
  5510. @item step
  5511. Set step for @code{waveform} mode. Smaller values are useful to find out how
  5512. many values of the same luminance are distributed across input rows/columns.
  5513. Default value is @code{10}. Allowed range is [1, 255].
  5514. @item waveform_mode
  5515. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  5516. Default is @code{row}.
  5517. @item waveform_mirror
  5518. Set mirroring mode for @code{waveform}. @code{0} means unmirrored, @code{1}
  5519. means mirrored. In mirrored mode, higher values will be represented on the left
  5520. side for @code{row} mode and at the top for @code{column} mode. Default is
  5521. @code{0} (unmirrored).
  5522. @item display_mode
  5523. Set display mode for @code{waveform} and @code{levels}.
  5524. It accepts the following values:
  5525. @table @samp
  5526. @item parade
  5527. Display separate graph for the color components side by side in
  5528. @code{row} waveform mode or one below the other in @code{column} waveform mode
  5529. for @code{waveform} histogram mode. For @code{levels} histogram mode,
  5530. per color component graphs are placed below each other.
  5531. Using this display mode in @code{waveform} histogram mode makes it easy to
  5532. spot color casts in the highlights and shadows of an image, by comparing the
  5533. contours of the top and the bottom graphs of each waveform. Since whites,
  5534. grays, and blacks are characterized by exactly equal amounts of red, green,
  5535. and blue, neutral areas of the picture should display three waveforms of
  5536. roughly equal width/height. If not, the correction is easy to perform by
  5537. making level adjustments the three waveforms.
  5538. @item overlay
  5539. Presents information identical to that in the @code{parade}, except
  5540. that the graphs representing color components are superimposed directly
  5541. over one another.
  5542. This display mode in @code{waveform} histogram mode makes it easier to spot
  5543. relative differences or similarities in overlapping areas of the color
  5544. components that are supposed to be identical, such as neutral whites, grays,
  5545. or blacks.
  5546. @end table
  5547. Default is @code{parade}.
  5548. @item levels_mode
  5549. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  5550. Default is @code{linear}.
  5551. @item components
  5552. Set what color components to display for mode @code{levels}.
  5553. Default is @code{7}.
  5554. @end table
  5555. @subsection Examples
  5556. @itemize
  5557. @item
  5558. Calculate and draw histogram:
  5559. @example
  5560. ffplay -i input -vf histogram
  5561. @end example
  5562. @end itemize
  5563. @anchor{hqdn3d}
  5564. @section hqdn3d
  5565. This is a high precision/quality 3d denoise filter. It aims to reduce
  5566. image noise, producing smooth images and making still images really
  5567. still. It should enhance compressibility.
  5568. It accepts the following optional parameters:
  5569. @table @option
  5570. @item luma_spatial
  5571. A non-negative floating point number which specifies spatial luma strength.
  5572. It defaults to 4.0.
  5573. @item chroma_spatial
  5574. A non-negative floating point number which specifies spatial chroma strength.
  5575. It defaults to 3.0*@var{luma_spatial}/4.0.
  5576. @item luma_tmp
  5577. A floating point number which specifies luma temporal strength. It defaults to
  5578. 6.0*@var{luma_spatial}/4.0.
  5579. @item chroma_tmp
  5580. A floating point number which specifies chroma temporal strength. It defaults to
  5581. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5582. @end table
  5583. @section hqx
  5584. Apply a high-quality magnification filter designed for pixel art. This filter
  5585. was originally created by Maxim Stepin.
  5586. It accepts the following option:
  5587. @table @option
  5588. @item n
  5589. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5590. @code{hq3x} and @code{4} for @code{hq4x}.
  5591. Default is @code{3}.
  5592. @end table
  5593. @section hstack
  5594. Stack input videos horizontally.
  5595. All streams must be of same pixel format and of same height.
  5596. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5597. to create same output.
  5598. The filter accept the following option:
  5599. @table @option
  5600. @item inputs
  5601. Set number of input streams. Default is 2.
  5602. @item shortest
  5603. If set to 1, force the output to terminate when the shortest input
  5604. terminates. Default value is 0.
  5605. @end table
  5606. @section hue
  5607. Modify the hue and/or the saturation of the input.
  5608. It accepts the following parameters:
  5609. @table @option
  5610. @item h
  5611. Specify the hue angle as a number of degrees. It accepts an expression,
  5612. and defaults to "0".
  5613. @item s
  5614. Specify the saturation in the [-10,10] range. It accepts an expression and
  5615. defaults to "1".
  5616. @item H
  5617. Specify the hue angle as a number of radians. It accepts an
  5618. expression, and defaults to "0".
  5619. @item b
  5620. Specify the brightness in the [-10,10] range. It accepts an expression and
  5621. defaults to "0".
  5622. @end table
  5623. @option{h} and @option{H} are mutually exclusive, and can't be
  5624. specified at the same time.
  5625. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5626. expressions containing the following constants:
  5627. @table @option
  5628. @item n
  5629. frame count of the input frame starting from 0
  5630. @item pts
  5631. presentation timestamp of the input frame expressed in time base units
  5632. @item r
  5633. frame rate of the input video, NAN if the input frame rate is unknown
  5634. @item t
  5635. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5636. @item tb
  5637. time base of the input video
  5638. @end table
  5639. @subsection Examples
  5640. @itemize
  5641. @item
  5642. Set the hue to 90 degrees and the saturation to 1.0:
  5643. @example
  5644. hue=h=90:s=1
  5645. @end example
  5646. @item
  5647. Same command but expressing the hue in radians:
  5648. @example
  5649. hue=H=PI/2:s=1
  5650. @end example
  5651. @item
  5652. Rotate hue and make the saturation swing between 0
  5653. and 2 over a period of 1 second:
  5654. @example
  5655. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5656. @end example
  5657. @item
  5658. Apply a 3 seconds saturation fade-in effect starting at 0:
  5659. @example
  5660. hue="s=min(t/3\,1)"
  5661. @end example
  5662. The general fade-in expression can be written as:
  5663. @example
  5664. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5665. @end example
  5666. @item
  5667. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5668. @example
  5669. hue="s=max(0\, min(1\, (8-t)/3))"
  5670. @end example
  5671. The general fade-out expression can be written as:
  5672. @example
  5673. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5674. @end example
  5675. @end itemize
  5676. @subsection Commands
  5677. This filter supports the following commands:
  5678. @table @option
  5679. @item b
  5680. @item s
  5681. @item h
  5682. @item H
  5683. Modify the hue and/or the saturation and/or brightness of the input video.
  5684. The command accepts the same syntax of the corresponding option.
  5685. If the specified expression is not valid, it is kept at its current
  5686. value.
  5687. @end table
  5688. @section idet
  5689. Detect video interlacing type.
  5690. This filter tries to detect if the input frames as interlaced, progressive,
  5691. top or bottom field first. It will also try and detect fields that are
  5692. repeated between adjacent frames (a sign of telecine).
  5693. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5694. Multiple frame detection incorporates the classification history of previous frames.
  5695. The filter will log these metadata values:
  5696. @table @option
  5697. @item single.current_frame
  5698. Detected type of current frame using single-frame detection. One of:
  5699. ``tff'' (top field first), ``bff'' (bottom field first),
  5700. ``progressive'', or ``undetermined''
  5701. @item single.tff
  5702. Cumulative number of frames detected as top field first using single-frame detection.
  5703. @item multiple.tff
  5704. Cumulative number of frames detected as top field first using multiple-frame detection.
  5705. @item single.bff
  5706. Cumulative number of frames detected as bottom field first using single-frame detection.
  5707. @item multiple.current_frame
  5708. Detected type of current frame using multiple-frame detection. One of:
  5709. ``tff'' (top field first), ``bff'' (bottom field first),
  5710. ``progressive'', or ``undetermined''
  5711. @item multiple.bff
  5712. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5713. @item single.progressive
  5714. Cumulative number of frames detected as progressive using single-frame detection.
  5715. @item multiple.progressive
  5716. Cumulative number of frames detected as progressive using multiple-frame detection.
  5717. @item single.undetermined
  5718. Cumulative number of frames that could not be classified using single-frame detection.
  5719. @item multiple.undetermined
  5720. Cumulative number of frames that could not be classified using multiple-frame detection.
  5721. @item repeated.current_frame
  5722. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5723. @item repeated.neither
  5724. Cumulative number of frames with no repeated field.
  5725. @item repeated.top
  5726. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5727. @item repeated.bottom
  5728. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5729. @end table
  5730. The filter accepts the following options:
  5731. @table @option
  5732. @item intl_thres
  5733. Set interlacing threshold.
  5734. @item prog_thres
  5735. Set progressive threshold.
  5736. @item repeat_thres
  5737. Threshold for repeated field detection.
  5738. @item half_life
  5739. Number of frames after which a given frame's contribution to the
  5740. statistics is halved (i.e., it contributes only 0.5 to it's
  5741. classification). The default of 0 means that all frames seen are given
  5742. full weight of 1.0 forever.
  5743. @item analyze_interlaced_flag
  5744. When this is not 0 then idet will use the specified number of frames to determine
  5745. if the interlaced flag is accurate, it will not count undetermined frames.
  5746. If the flag is found to be accurate it will be used without any further
  5747. computations, if it is found to be inaccurate it will be cleared without any
  5748. further computations. This allows inserting the idet filter as a low computational
  5749. method to clean up the interlaced flag
  5750. @end table
  5751. @section il
  5752. Deinterleave or interleave fields.
  5753. This filter allows one to process interlaced images fields without
  5754. deinterlacing them. Deinterleaving splits the input frame into 2
  5755. fields (so called half pictures). Odd lines are moved to the top
  5756. half of the output image, even lines to the bottom half.
  5757. You can process (filter) them independently and then re-interleave them.
  5758. The filter accepts the following options:
  5759. @table @option
  5760. @item luma_mode, l
  5761. @item chroma_mode, c
  5762. @item alpha_mode, a
  5763. Available values for @var{luma_mode}, @var{chroma_mode} and
  5764. @var{alpha_mode} are:
  5765. @table @samp
  5766. @item none
  5767. Do nothing.
  5768. @item deinterleave, d
  5769. Deinterleave fields, placing one above the other.
  5770. @item interleave, i
  5771. Interleave fields. Reverse the effect of deinterleaving.
  5772. @end table
  5773. Default value is @code{none}.
  5774. @item luma_swap, ls
  5775. @item chroma_swap, cs
  5776. @item alpha_swap, as
  5777. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  5778. @end table
  5779. @section inflate
  5780. Apply inflate effect to the video.
  5781. This filter replaces the pixel by the local(3x3) average by taking into account
  5782. only values higher than the pixel.
  5783. It accepts the following options:
  5784. @table @option
  5785. @item threshold0
  5786. @item threshold1
  5787. @item threshold2
  5788. @item threshold3
  5789. Limit the maximum change for each plane, default is 65535.
  5790. If 0, plane will remain unchanged.
  5791. @end table
  5792. @section interlace
  5793. Simple interlacing filter from progressive contents. This interleaves upper (or
  5794. lower) lines from odd frames with lower (or upper) lines from even frames,
  5795. halving the frame rate and preserving image height.
  5796. @example
  5797. Original Original New Frame
  5798. Frame 'j' Frame 'j+1' (tff)
  5799. ========== =========== ==================
  5800. Line 0 --------------------> Frame 'j' Line 0
  5801. Line 1 Line 1 ----> Frame 'j+1' Line 1
  5802. Line 2 ---------------------> Frame 'j' Line 2
  5803. Line 3 Line 3 ----> Frame 'j+1' Line 3
  5804. ... ... ...
  5805. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  5806. @end example
  5807. It accepts the following optional parameters:
  5808. @table @option
  5809. @item scan
  5810. This determines whether the interlaced frame is taken from the even
  5811. (tff - default) or odd (bff) lines of the progressive frame.
  5812. @item lowpass
  5813. Enable (default) or disable the vertical lowpass filter to avoid twitter
  5814. interlacing and reduce moire patterns.
  5815. @end table
  5816. @section kerndeint
  5817. Deinterlace input video by applying Donald Graft's adaptive kernel
  5818. deinterling. Work on interlaced parts of a video to produce
  5819. progressive frames.
  5820. The description of the accepted parameters follows.
  5821. @table @option
  5822. @item thresh
  5823. Set the threshold which affects the filter's tolerance when
  5824. determining if a pixel line must be processed. It must be an integer
  5825. in the range [0,255] and defaults to 10. A value of 0 will result in
  5826. applying the process on every pixels.
  5827. @item map
  5828. Paint pixels exceeding the threshold value to white if set to 1.
  5829. Default is 0.
  5830. @item order
  5831. Set the fields order. Swap fields if set to 1, leave fields alone if
  5832. 0. Default is 0.
  5833. @item sharp
  5834. Enable additional sharpening if set to 1. Default is 0.
  5835. @item twoway
  5836. Enable twoway sharpening if set to 1. Default is 0.
  5837. @end table
  5838. @subsection Examples
  5839. @itemize
  5840. @item
  5841. Apply default values:
  5842. @example
  5843. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  5844. @end example
  5845. @item
  5846. Enable additional sharpening:
  5847. @example
  5848. kerndeint=sharp=1
  5849. @end example
  5850. @item
  5851. Paint processed pixels in white:
  5852. @example
  5853. kerndeint=map=1
  5854. @end example
  5855. @end itemize
  5856. @section lenscorrection
  5857. Correct radial lens distortion
  5858. This filter can be used to correct for radial distortion as can result from the use
  5859. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  5860. one can use tools available for example as part of opencv or simply trial-and-error.
  5861. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  5862. and extract the k1 and k2 coefficients from the resulting matrix.
  5863. Note that effectively the same filter is available in the open-source tools Krita and
  5864. Digikam from the KDE project.
  5865. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  5866. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  5867. brightness distribution, so you may want to use both filters together in certain
  5868. cases, though you will have to take care of ordering, i.e. whether vignetting should
  5869. be applied before or after lens correction.
  5870. @subsection Options
  5871. The filter accepts the following options:
  5872. @table @option
  5873. @item cx
  5874. Relative x-coordinate of the focal point of the image, and thereby the center of the
  5875. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5876. width.
  5877. @item cy
  5878. Relative y-coordinate of the focal point of the image, and thereby the center of the
  5879. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5880. height.
  5881. @item k1
  5882. Coefficient of the quadratic correction term. 0.5 means no correction.
  5883. @item k2
  5884. Coefficient of the double quadratic correction term. 0.5 means no correction.
  5885. @end table
  5886. The formula that generates the correction is:
  5887. @var{r_src} = @var{r_tgt} * (1 + @var{k1} * (@var{r_tgt} / @var{r_0})^2 + @var{k2} * (@var{r_tgt} / @var{r_0})^4)
  5888. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  5889. distances from the focal point in the source and target images, respectively.
  5890. @anchor{lut3d}
  5891. @section lut3d
  5892. Apply a 3D LUT to an input video.
  5893. The filter accepts the following options:
  5894. @table @option
  5895. @item file
  5896. Set the 3D LUT file name.
  5897. Currently supported formats:
  5898. @table @samp
  5899. @item 3dl
  5900. AfterEffects
  5901. @item cube
  5902. Iridas
  5903. @item dat
  5904. DaVinci
  5905. @item m3d
  5906. Pandora
  5907. @end table
  5908. @item interp
  5909. Select interpolation mode.
  5910. Available values are:
  5911. @table @samp
  5912. @item nearest
  5913. Use values from the nearest defined point.
  5914. @item trilinear
  5915. Interpolate values using the 8 points defining a cube.
  5916. @item tetrahedral
  5917. Interpolate values using a tetrahedron.
  5918. @end table
  5919. @end table
  5920. @section lut, lutrgb, lutyuv
  5921. Compute a look-up table for binding each pixel component input value
  5922. to an output value, and apply it to the input video.
  5923. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  5924. to an RGB input video.
  5925. These filters accept the following parameters:
  5926. @table @option
  5927. @item c0
  5928. set first pixel component expression
  5929. @item c1
  5930. set second pixel component expression
  5931. @item c2
  5932. set third pixel component expression
  5933. @item c3
  5934. set fourth pixel component expression, corresponds to the alpha component
  5935. @item r
  5936. set red component expression
  5937. @item g
  5938. set green component expression
  5939. @item b
  5940. set blue component expression
  5941. @item a
  5942. alpha component expression
  5943. @item y
  5944. set Y/luminance component expression
  5945. @item u
  5946. set U/Cb component expression
  5947. @item v
  5948. set V/Cr component expression
  5949. @end table
  5950. Each of them specifies the expression to use for computing the lookup table for
  5951. the corresponding pixel component values.
  5952. The exact component associated to each of the @var{c*} options depends on the
  5953. format in input.
  5954. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  5955. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  5956. The expressions can contain the following constants and functions:
  5957. @table @option
  5958. @item w
  5959. @item h
  5960. The input width and height.
  5961. @item val
  5962. The input value for the pixel component.
  5963. @item clipval
  5964. The input value, clipped to the @var{minval}-@var{maxval} range.
  5965. @item maxval
  5966. The maximum value for the pixel component.
  5967. @item minval
  5968. The minimum value for the pixel component.
  5969. @item negval
  5970. The negated value for the pixel component value, clipped to the
  5971. @var{minval}-@var{maxval} range; it corresponds to the expression
  5972. "maxval-clipval+minval".
  5973. @item clip(val)
  5974. The computed value in @var{val}, clipped to the
  5975. @var{minval}-@var{maxval} range.
  5976. @item gammaval(gamma)
  5977. The computed gamma correction value of the pixel component value,
  5978. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  5979. expression
  5980. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  5981. @end table
  5982. All expressions default to "val".
  5983. @subsection Examples
  5984. @itemize
  5985. @item
  5986. Negate input video:
  5987. @example
  5988. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  5989. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  5990. @end example
  5991. The above is the same as:
  5992. @example
  5993. lutrgb="r=negval:g=negval:b=negval"
  5994. lutyuv="y=negval:u=negval:v=negval"
  5995. @end example
  5996. @item
  5997. Negate luminance:
  5998. @example
  5999. lutyuv=y=negval
  6000. @end example
  6001. @item
  6002. Remove chroma components, turning the video into a graytone image:
  6003. @example
  6004. lutyuv="u=128:v=128"
  6005. @end example
  6006. @item
  6007. Apply a luma burning effect:
  6008. @example
  6009. lutyuv="y=2*val"
  6010. @end example
  6011. @item
  6012. Remove green and blue components:
  6013. @example
  6014. lutrgb="g=0:b=0"
  6015. @end example
  6016. @item
  6017. Set a constant alpha channel value on input:
  6018. @example
  6019. format=rgba,lutrgb=a="maxval-minval/2"
  6020. @end example
  6021. @item
  6022. Correct luminance gamma by a factor of 0.5:
  6023. @example
  6024. lutyuv=y=gammaval(0.5)
  6025. @end example
  6026. @item
  6027. Discard least significant bits of luma:
  6028. @example
  6029. lutyuv=y='bitand(val, 128+64+32)'
  6030. @end example
  6031. @end itemize
  6032. @section maskedmerge
  6033. Merge the first input stream with the second input stream using per pixel
  6034. weights in the third input stream.
  6035. A value of 0 in the third stream pixel component means that pixel component
  6036. from first stream is returned unchanged, while maximum value (eg. 255 for
  6037. 8-bit videos) means that pixel component from second stream is returned
  6038. unchanged. Intermediate values define the amount of merging between both
  6039. input stream's pixel components.
  6040. This filter accepts the following options:
  6041. @table @option
  6042. @item planes
  6043. Set which planes will be processed as bitmap, unprocessed planes will be
  6044. copied from first stream.
  6045. By default value 0xf, all planes will be processed.
  6046. @end table
  6047. @section mcdeint
  6048. Apply motion-compensation deinterlacing.
  6049. It needs one field per frame as input and must thus be used together
  6050. with yadif=1/3 or equivalent.
  6051. This filter accepts the following options:
  6052. @table @option
  6053. @item mode
  6054. Set the deinterlacing mode.
  6055. It accepts one of the following values:
  6056. @table @samp
  6057. @item fast
  6058. @item medium
  6059. @item slow
  6060. use iterative motion estimation
  6061. @item extra_slow
  6062. like @samp{slow}, but use multiple reference frames.
  6063. @end table
  6064. Default value is @samp{fast}.
  6065. @item parity
  6066. Set the picture field parity assumed for the input video. It must be
  6067. one of the following values:
  6068. @table @samp
  6069. @item 0, tff
  6070. assume top field first
  6071. @item 1, bff
  6072. assume bottom field first
  6073. @end table
  6074. Default value is @samp{bff}.
  6075. @item qp
  6076. Set per-block quantization parameter (QP) used by the internal
  6077. encoder.
  6078. Higher values should result in a smoother motion vector field but less
  6079. optimal individual vectors. Default value is 1.
  6080. @end table
  6081. @section mergeplanes
  6082. Merge color channel components from several video streams.
  6083. The filter accepts up to 4 input streams, and merge selected input
  6084. planes to the output video.
  6085. This filter accepts the following options:
  6086. @table @option
  6087. @item mapping
  6088. Set input to output plane mapping. Default is @code{0}.
  6089. The mappings is specified as a bitmap. It should be specified as a
  6090. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6091. mapping for the first plane of the output stream. 'A' sets the number of
  6092. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6093. corresponding input to use (from 0 to 3). The rest of the mappings is
  6094. similar, 'Bb' describes the mapping for the output stream second
  6095. plane, 'Cc' describes the mapping for the output stream third plane and
  6096. 'Dd' describes the mapping for the output stream fourth plane.
  6097. @item format
  6098. Set output pixel format. Default is @code{yuva444p}.
  6099. @end table
  6100. @subsection Examples
  6101. @itemize
  6102. @item
  6103. Merge three gray video streams of same width and height into single video stream:
  6104. @example
  6105. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6106. @end example
  6107. @item
  6108. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6109. @example
  6110. [a0][a1]mergeplanes=0x00010210:yuva444p
  6111. @end example
  6112. @item
  6113. Swap Y and A plane in yuva444p stream:
  6114. @example
  6115. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6116. @end example
  6117. @item
  6118. Swap U and V plane in yuv420p stream:
  6119. @example
  6120. format=yuv420p,mergeplanes=0x000201:yuv420p
  6121. @end example
  6122. @item
  6123. Cast a rgb24 clip to yuv444p:
  6124. @example
  6125. format=rgb24,mergeplanes=0x000102:yuv444p
  6126. @end example
  6127. @end itemize
  6128. @section mpdecimate
  6129. Drop frames that do not differ greatly from the previous frame in
  6130. order to reduce frame rate.
  6131. The main use of this filter is for very-low-bitrate encoding
  6132. (e.g. streaming over dialup modem), but it could in theory be used for
  6133. fixing movies that were inverse-telecined incorrectly.
  6134. A description of the accepted options follows.
  6135. @table @option
  6136. @item max
  6137. Set the maximum number of consecutive frames which can be dropped (if
  6138. positive), or the minimum interval between dropped frames (if
  6139. negative). If the value is 0, the frame is dropped unregarding the
  6140. number of previous sequentially dropped frames.
  6141. Default value is 0.
  6142. @item hi
  6143. @item lo
  6144. @item frac
  6145. Set the dropping threshold values.
  6146. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6147. represent actual pixel value differences, so a threshold of 64
  6148. corresponds to 1 unit of difference for each pixel, or the same spread
  6149. out differently over the block.
  6150. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6151. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6152. meaning the whole image) differ by more than a threshold of @option{lo}.
  6153. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6154. 64*5, and default value for @option{frac} is 0.33.
  6155. @end table
  6156. @section negate
  6157. Negate input video.
  6158. It accepts an integer in input; if non-zero it negates the
  6159. alpha component (if available). The default value in input is 0.
  6160. @section noformat
  6161. Force libavfilter not to use any of the specified pixel formats for the
  6162. input to the next filter.
  6163. It accepts the following parameters:
  6164. @table @option
  6165. @item pix_fmts
  6166. A '|'-separated list of pixel format names, such as
  6167. apix_fmts=yuv420p|monow|rgb24".
  6168. @end table
  6169. @subsection Examples
  6170. @itemize
  6171. @item
  6172. Force libavfilter to use a format different from @var{yuv420p} for the
  6173. input to the vflip filter:
  6174. @example
  6175. noformat=pix_fmts=yuv420p,vflip
  6176. @end example
  6177. @item
  6178. Convert the input video to any of the formats not contained in the list:
  6179. @example
  6180. noformat=yuv420p|yuv444p|yuv410p
  6181. @end example
  6182. @end itemize
  6183. @section noise
  6184. Add noise on video input frame.
  6185. The filter accepts the following options:
  6186. @table @option
  6187. @item all_seed
  6188. @item c0_seed
  6189. @item c1_seed
  6190. @item c2_seed
  6191. @item c3_seed
  6192. Set noise seed for specific pixel component or all pixel components in case
  6193. of @var{all_seed}. Default value is @code{123457}.
  6194. @item all_strength, alls
  6195. @item c0_strength, c0s
  6196. @item c1_strength, c1s
  6197. @item c2_strength, c2s
  6198. @item c3_strength, c3s
  6199. Set noise strength for specific pixel component or all pixel components in case
  6200. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6201. @item all_flags, allf
  6202. @item c0_flags, c0f
  6203. @item c1_flags, c1f
  6204. @item c2_flags, c2f
  6205. @item c3_flags, c3f
  6206. Set pixel component flags or set flags for all components if @var{all_flags}.
  6207. Available values for component flags are:
  6208. @table @samp
  6209. @item a
  6210. averaged temporal noise (smoother)
  6211. @item p
  6212. mix random noise with a (semi)regular pattern
  6213. @item t
  6214. temporal noise (noise pattern changes between frames)
  6215. @item u
  6216. uniform noise (gaussian otherwise)
  6217. @end table
  6218. @end table
  6219. @subsection Examples
  6220. Add temporal and uniform noise to input video:
  6221. @example
  6222. noise=alls=20:allf=t+u
  6223. @end example
  6224. @section null
  6225. Pass the video source unchanged to the output.
  6226. @section ocr
  6227. Optical Character Recognition
  6228. This filter uses Tesseract for optical character recognition.
  6229. It accepts the following options:
  6230. @table @option
  6231. @item datapath
  6232. Set datapath to tesseract data. Default is to use whatever was
  6233. set at installation.
  6234. @item language
  6235. Set language, default is "eng".
  6236. @item whitelist
  6237. Set character whitelist.
  6238. @item blacklist
  6239. Set character blacklist.
  6240. @end table
  6241. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6242. @section ocv
  6243. Apply a video transform using libopencv.
  6244. To enable this filter, install the libopencv library and headers and
  6245. configure FFmpeg with @code{--enable-libopencv}.
  6246. It accepts the following parameters:
  6247. @table @option
  6248. @item filter_name
  6249. The name of the libopencv filter to apply.
  6250. @item filter_params
  6251. The parameters to pass to the libopencv filter. If not specified, the default
  6252. values are assumed.
  6253. @end table
  6254. Refer to the official libopencv documentation for more precise
  6255. information:
  6256. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6257. Several libopencv filters are supported; see the following subsections.
  6258. @anchor{dilate}
  6259. @subsection dilate
  6260. Dilate an image by using a specific structuring element.
  6261. It corresponds to the libopencv function @code{cvDilate}.
  6262. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6263. @var{struct_el} represents a structuring element, and has the syntax:
  6264. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6265. @var{cols} and @var{rows} represent the number of columns and rows of
  6266. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6267. point, and @var{shape} the shape for the structuring element. @var{shape}
  6268. must be "rect", "cross", "ellipse", or "custom".
  6269. If the value for @var{shape} is "custom", it must be followed by a
  6270. string of the form "=@var{filename}". The file with name
  6271. @var{filename} is assumed to represent a binary image, with each
  6272. printable character corresponding to a bright pixel. When a custom
  6273. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6274. or columns and rows of the read file are assumed instead.
  6275. The default value for @var{struct_el} is "3x3+0x0/rect".
  6276. @var{nb_iterations} specifies the number of times the transform is
  6277. applied to the image, and defaults to 1.
  6278. Some examples:
  6279. @example
  6280. # Use the default values
  6281. ocv=dilate
  6282. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6283. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6284. # Read the shape from the file diamond.shape, iterating two times.
  6285. # The file diamond.shape may contain a pattern of characters like this
  6286. # *
  6287. # ***
  6288. # *****
  6289. # ***
  6290. # *
  6291. # The specified columns and rows are ignored
  6292. # but the anchor point coordinates are not
  6293. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6294. @end example
  6295. @subsection erode
  6296. Erode an image by using a specific structuring element.
  6297. It corresponds to the libopencv function @code{cvErode}.
  6298. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6299. with the same syntax and semantics as the @ref{dilate} filter.
  6300. @subsection smooth
  6301. Smooth the input video.
  6302. The filter takes the following parameters:
  6303. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6304. @var{type} is the type of smooth filter to apply, and must be one of
  6305. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6306. or "bilateral". The default value is "gaussian".
  6307. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6308. depend on the smooth type. @var{param1} and
  6309. @var{param2} accept integer positive values or 0. @var{param3} and
  6310. @var{param4} accept floating point values.
  6311. The default value for @var{param1} is 3. The default value for the
  6312. other parameters is 0.
  6313. These parameters correspond to the parameters assigned to the
  6314. libopencv function @code{cvSmooth}.
  6315. @anchor{overlay}
  6316. @section overlay
  6317. Overlay one video on top of another.
  6318. It takes two inputs and has one output. The first input is the "main"
  6319. video on which the second input is overlaid.
  6320. It accepts the following parameters:
  6321. A description of the accepted options follows.
  6322. @table @option
  6323. @item x
  6324. @item y
  6325. Set the expression for the x and y coordinates of the overlaid video
  6326. on the main video. Default value is "0" for both expressions. In case
  6327. the expression is invalid, it is set to a huge value (meaning that the
  6328. overlay will not be displayed within the output visible area).
  6329. @item eof_action
  6330. The action to take when EOF is encountered on the secondary input; it accepts
  6331. one of the following values:
  6332. @table @option
  6333. @item repeat
  6334. Repeat the last frame (the default).
  6335. @item endall
  6336. End both streams.
  6337. @item pass
  6338. Pass the main input through.
  6339. @end table
  6340. @item eval
  6341. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6342. It accepts the following values:
  6343. @table @samp
  6344. @item init
  6345. only evaluate expressions once during the filter initialization or
  6346. when a command is processed
  6347. @item frame
  6348. evaluate expressions for each incoming frame
  6349. @end table
  6350. Default value is @samp{frame}.
  6351. @item shortest
  6352. If set to 1, force the output to terminate when the shortest input
  6353. terminates. Default value is 0.
  6354. @item format
  6355. Set the format for the output video.
  6356. It accepts the following values:
  6357. @table @samp
  6358. @item yuv420
  6359. force YUV420 output
  6360. @item yuv422
  6361. force YUV422 output
  6362. @item yuv444
  6363. force YUV444 output
  6364. @item rgb
  6365. force RGB output
  6366. @end table
  6367. Default value is @samp{yuv420}.
  6368. @item rgb @emph{(deprecated)}
  6369. If set to 1, force the filter to accept inputs in the RGB
  6370. color space. Default value is 0. This option is deprecated, use
  6371. @option{format} instead.
  6372. @item repeatlast
  6373. If set to 1, force the filter to draw the last overlay frame over the
  6374. main input until the end of the stream. A value of 0 disables this
  6375. behavior. Default value is 1.
  6376. @end table
  6377. The @option{x}, and @option{y} expressions can contain the following
  6378. parameters.
  6379. @table @option
  6380. @item main_w, W
  6381. @item main_h, H
  6382. The main input width and height.
  6383. @item overlay_w, w
  6384. @item overlay_h, h
  6385. The overlay input width and height.
  6386. @item x
  6387. @item y
  6388. The computed values for @var{x} and @var{y}. They are evaluated for
  6389. each new frame.
  6390. @item hsub
  6391. @item vsub
  6392. horizontal and vertical chroma subsample values of the output
  6393. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6394. @var{vsub} is 1.
  6395. @item n
  6396. the number of input frame, starting from 0
  6397. @item pos
  6398. the position in the file of the input frame, NAN if unknown
  6399. @item t
  6400. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6401. @end table
  6402. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6403. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6404. when @option{eval} is set to @samp{init}.
  6405. Be aware that frames are taken from each input video in timestamp
  6406. order, hence, if their initial timestamps differ, it is a good idea
  6407. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6408. have them begin in the same zero timestamp, as the example for
  6409. the @var{movie} filter does.
  6410. You can chain together more overlays but you should test the
  6411. efficiency of such approach.
  6412. @subsection Commands
  6413. This filter supports the following commands:
  6414. @table @option
  6415. @item x
  6416. @item y
  6417. Modify the x and y of the overlay input.
  6418. The command accepts the same syntax of the corresponding option.
  6419. If the specified expression is not valid, it is kept at its current
  6420. value.
  6421. @end table
  6422. @subsection Examples
  6423. @itemize
  6424. @item
  6425. Draw the overlay at 10 pixels from the bottom right corner of the main
  6426. video:
  6427. @example
  6428. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6429. @end example
  6430. Using named options the example above becomes:
  6431. @example
  6432. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6433. @end example
  6434. @item
  6435. Insert a transparent PNG logo in the bottom left corner of the input,
  6436. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6437. @example
  6438. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6439. @end example
  6440. @item
  6441. Insert 2 different transparent PNG logos (second logo on bottom
  6442. right corner) using the @command{ffmpeg} tool:
  6443. @example
  6444. 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
  6445. @end example
  6446. @item
  6447. Add a transparent color layer on top of the main video; @code{WxH}
  6448. must specify the size of the main input to the overlay filter:
  6449. @example
  6450. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6451. @end example
  6452. @item
  6453. Play an original video and a filtered version (here with the deshake
  6454. filter) side by side using the @command{ffplay} tool:
  6455. @example
  6456. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6457. @end example
  6458. The above command is the same as:
  6459. @example
  6460. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6461. @end example
  6462. @item
  6463. Make a sliding overlay appearing from the left to the right top part of the
  6464. screen starting since time 2:
  6465. @example
  6466. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6467. @end example
  6468. @item
  6469. Compose output by putting two input videos side to side:
  6470. @example
  6471. ffmpeg -i left.avi -i right.avi -filter_complex "
  6472. nullsrc=size=200x100 [background];
  6473. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6474. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6475. [background][left] overlay=shortest=1 [background+left];
  6476. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6477. "
  6478. @end example
  6479. @item
  6480. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6481. @example
  6482. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6483. -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
  6484. masked.avi
  6485. @end example
  6486. @item
  6487. Chain several overlays in cascade:
  6488. @example
  6489. nullsrc=s=200x200 [bg];
  6490. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6491. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6492. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6493. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6494. [in3] null, [mid2] overlay=100:100 [out0]
  6495. @end example
  6496. @end itemize
  6497. @section owdenoise
  6498. Apply Overcomplete Wavelet denoiser.
  6499. The filter accepts the following options:
  6500. @table @option
  6501. @item depth
  6502. Set depth.
  6503. Larger depth values will denoise lower frequency components more, but
  6504. slow down filtering.
  6505. Must be an int in the range 8-16, default is @code{8}.
  6506. @item luma_strength, ls
  6507. Set luma strength.
  6508. Must be a double value in the range 0-1000, default is @code{1.0}.
  6509. @item chroma_strength, cs
  6510. Set chroma strength.
  6511. Must be a double value in the range 0-1000, default is @code{1.0}.
  6512. @end table
  6513. @anchor{pad}
  6514. @section pad
  6515. Add paddings to the input image, and place the original input at the
  6516. provided @var{x}, @var{y} coordinates.
  6517. It accepts the following parameters:
  6518. @table @option
  6519. @item width, w
  6520. @item height, h
  6521. Specify an expression for the size of the output image with the
  6522. paddings added. If the value for @var{width} or @var{height} is 0, the
  6523. corresponding input size is used for the output.
  6524. The @var{width} expression can reference the value set by the
  6525. @var{height} expression, and vice versa.
  6526. The default value of @var{width} and @var{height} is 0.
  6527. @item x
  6528. @item y
  6529. Specify the offsets to place the input image at within the padded area,
  6530. with respect to the top/left border of the output image.
  6531. The @var{x} expression can reference the value set by the @var{y}
  6532. expression, and vice versa.
  6533. The default value of @var{x} and @var{y} is 0.
  6534. @item color
  6535. Specify the color of the padded area. For the syntax of this option,
  6536. check the "Color" section in the ffmpeg-utils manual.
  6537. The default value of @var{color} is "black".
  6538. @end table
  6539. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6540. options are expressions containing the following constants:
  6541. @table @option
  6542. @item in_w
  6543. @item in_h
  6544. The input video width and height.
  6545. @item iw
  6546. @item ih
  6547. These are the same as @var{in_w} and @var{in_h}.
  6548. @item out_w
  6549. @item out_h
  6550. The output width and height (the size of the padded area), as
  6551. specified by the @var{width} and @var{height} expressions.
  6552. @item ow
  6553. @item oh
  6554. These are the same as @var{out_w} and @var{out_h}.
  6555. @item x
  6556. @item y
  6557. The x and y offsets as specified by the @var{x} and @var{y}
  6558. expressions, or NAN if not yet specified.
  6559. @item a
  6560. same as @var{iw} / @var{ih}
  6561. @item sar
  6562. input sample aspect ratio
  6563. @item dar
  6564. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6565. @item hsub
  6566. @item vsub
  6567. The horizontal and vertical chroma subsample values. For example for the
  6568. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6569. @end table
  6570. @subsection Examples
  6571. @itemize
  6572. @item
  6573. Add paddings with the color "violet" to the input video. The output video
  6574. size is 640x480, and the top-left corner of the input video is placed at
  6575. column 0, row 40
  6576. @example
  6577. pad=640:480:0:40:violet
  6578. @end example
  6579. The example above is equivalent to the following command:
  6580. @example
  6581. pad=width=640:height=480:x=0:y=40:color=violet
  6582. @end example
  6583. @item
  6584. Pad the input to get an output with dimensions increased by 3/2,
  6585. and put the input video at the center of the padded area:
  6586. @example
  6587. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6588. @end example
  6589. @item
  6590. Pad the input to get a squared output with size equal to the maximum
  6591. value between the input width and height, and put the input video at
  6592. the center of the padded area:
  6593. @example
  6594. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6595. @end example
  6596. @item
  6597. Pad the input to get a final w/h ratio of 16:9:
  6598. @example
  6599. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6600. @end example
  6601. @item
  6602. In case of anamorphic video, in order to set the output display aspect
  6603. correctly, it is necessary to use @var{sar} in the expression,
  6604. according to the relation:
  6605. @example
  6606. (ih * X / ih) * sar = output_dar
  6607. X = output_dar / sar
  6608. @end example
  6609. Thus the previous example needs to be modified to:
  6610. @example
  6611. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6612. @end example
  6613. @item
  6614. Double the output size and put the input video in the bottom-right
  6615. corner of the output padded area:
  6616. @example
  6617. pad="2*iw:2*ih:ow-iw:oh-ih"
  6618. @end example
  6619. @end itemize
  6620. @anchor{palettegen}
  6621. @section palettegen
  6622. Generate one palette for a whole video stream.
  6623. It accepts the following options:
  6624. @table @option
  6625. @item max_colors
  6626. Set the maximum number of colors to quantize in the palette.
  6627. Note: the palette will still contain 256 colors; the unused palette entries
  6628. will be black.
  6629. @item reserve_transparent
  6630. Create a palette of 255 colors maximum and reserve the last one for
  6631. transparency. Reserving the transparency color is useful for GIF optimization.
  6632. If not set, the maximum of colors in the palette will be 256. You probably want
  6633. to disable this option for a standalone image.
  6634. Set by default.
  6635. @item stats_mode
  6636. Set statistics mode.
  6637. It accepts the following values:
  6638. @table @samp
  6639. @item full
  6640. Compute full frame histograms.
  6641. @item diff
  6642. Compute histograms only for the part that differs from previous frame. This
  6643. might be relevant to give more importance to the moving part of your input if
  6644. the background is static.
  6645. @end table
  6646. Default value is @var{full}.
  6647. @end table
  6648. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6649. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6650. color quantization of the palette. This information is also visible at
  6651. @var{info} logging level.
  6652. @subsection Examples
  6653. @itemize
  6654. @item
  6655. Generate a representative palette of a given video using @command{ffmpeg}:
  6656. @example
  6657. ffmpeg -i input.mkv -vf palettegen palette.png
  6658. @end example
  6659. @end itemize
  6660. @section paletteuse
  6661. Use a palette to downsample an input video stream.
  6662. The filter takes two inputs: one video stream and a palette. The palette must
  6663. be a 256 pixels image.
  6664. It accepts the following options:
  6665. @table @option
  6666. @item dither
  6667. Select dithering mode. Available algorithms are:
  6668. @table @samp
  6669. @item bayer
  6670. Ordered 8x8 bayer dithering (deterministic)
  6671. @item heckbert
  6672. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6673. Note: this dithering is sometimes considered "wrong" and is included as a
  6674. reference.
  6675. @item floyd_steinberg
  6676. Floyd and Steingberg dithering (error diffusion)
  6677. @item sierra2
  6678. Frankie Sierra dithering v2 (error diffusion)
  6679. @item sierra2_4a
  6680. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6681. @end table
  6682. Default is @var{sierra2_4a}.
  6683. @item bayer_scale
  6684. When @var{bayer} dithering is selected, this option defines the scale of the
  6685. pattern (how much the crosshatch pattern is visible). A low value means more
  6686. visible pattern for less banding, and higher value means less visible pattern
  6687. at the cost of more banding.
  6688. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6689. @item diff_mode
  6690. If set, define the zone to process
  6691. @table @samp
  6692. @item rectangle
  6693. Only the changing rectangle will be reprocessed. This is similar to GIF
  6694. cropping/offsetting compression mechanism. This option can be useful for speed
  6695. if only a part of the image is changing, and has use cases such as limiting the
  6696. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6697. moving scene (it leads to more deterministic output if the scene doesn't change
  6698. much, and as a result less moving noise and better GIF compression).
  6699. @end table
  6700. Default is @var{none}.
  6701. @end table
  6702. @subsection Examples
  6703. @itemize
  6704. @item
  6705. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6706. using @command{ffmpeg}:
  6707. @example
  6708. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6709. @end example
  6710. @end itemize
  6711. @section perspective
  6712. Correct perspective of video not recorded perpendicular to the screen.
  6713. A description of the accepted parameters follows.
  6714. @table @option
  6715. @item x0
  6716. @item y0
  6717. @item x1
  6718. @item y1
  6719. @item x2
  6720. @item y2
  6721. @item x3
  6722. @item y3
  6723. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6724. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6725. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6726. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6727. then the corners of the source will be sent to the specified coordinates.
  6728. The expressions can use the following variables:
  6729. @table @option
  6730. @item W
  6731. @item H
  6732. the width and height of video frame.
  6733. @end table
  6734. @item interpolation
  6735. Set interpolation for perspective correction.
  6736. It accepts the following values:
  6737. @table @samp
  6738. @item linear
  6739. @item cubic
  6740. @end table
  6741. Default value is @samp{linear}.
  6742. @item sense
  6743. Set interpretation of coordinate options.
  6744. It accepts the following values:
  6745. @table @samp
  6746. @item 0, source
  6747. Send point in the source specified by the given coordinates to
  6748. the corners of the destination.
  6749. @item 1, destination
  6750. Send the corners of the source to the point in the destination specified
  6751. by the given coordinates.
  6752. Default value is @samp{source}.
  6753. @end table
  6754. @end table
  6755. @section phase
  6756. Delay interlaced video by one field time so that the field order changes.
  6757. The intended use is to fix PAL movies that have been captured with the
  6758. opposite field order to the film-to-video transfer.
  6759. A description of the accepted parameters follows.
  6760. @table @option
  6761. @item mode
  6762. Set phase mode.
  6763. It accepts the following values:
  6764. @table @samp
  6765. @item t
  6766. Capture field order top-first, transfer bottom-first.
  6767. Filter will delay the bottom field.
  6768. @item b
  6769. Capture field order bottom-first, transfer top-first.
  6770. Filter will delay the top field.
  6771. @item p
  6772. Capture and transfer with the same field order. This mode only exists
  6773. for the documentation of the other options to refer to, but if you
  6774. actually select it, the filter will faithfully do nothing.
  6775. @item a
  6776. Capture field order determined automatically by field flags, transfer
  6777. opposite.
  6778. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  6779. basis using field flags. If no field information is available,
  6780. then this works just like @samp{u}.
  6781. @item u
  6782. Capture unknown or varying, transfer opposite.
  6783. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  6784. analyzing the images and selecting the alternative that produces best
  6785. match between the fields.
  6786. @item T
  6787. Capture top-first, transfer unknown or varying.
  6788. Filter selects among @samp{t} and @samp{p} using image analysis.
  6789. @item B
  6790. Capture bottom-first, transfer unknown or varying.
  6791. Filter selects among @samp{b} and @samp{p} using image analysis.
  6792. @item A
  6793. Capture determined by field flags, transfer unknown or varying.
  6794. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  6795. image analysis. If no field information is available, then this works just
  6796. like @samp{U}. This is the default mode.
  6797. @item U
  6798. Both capture and transfer unknown or varying.
  6799. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  6800. @end table
  6801. @end table
  6802. @section pixdesctest
  6803. Pixel format descriptor test filter, mainly useful for internal
  6804. testing. The output video should be equal to the input video.
  6805. For example:
  6806. @example
  6807. format=monow, pixdesctest
  6808. @end example
  6809. can be used to test the monowhite pixel format descriptor definition.
  6810. @section pp
  6811. Enable the specified chain of postprocessing subfilters using libpostproc. This
  6812. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  6813. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  6814. Each subfilter and some options have a short and a long name that can be used
  6815. interchangeably, i.e. dr/dering are the same.
  6816. The filters accept the following options:
  6817. @table @option
  6818. @item subfilters
  6819. Set postprocessing subfilters string.
  6820. @end table
  6821. All subfilters share common options to determine their scope:
  6822. @table @option
  6823. @item a/autoq
  6824. Honor the quality commands for this subfilter.
  6825. @item c/chrom
  6826. Do chrominance filtering, too (default).
  6827. @item y/nochrom
  6828. Do luminance filtering only (no chrominance).
  6829. @item n/noluma
  6830. Do chrominance filtering only (no luminance).
  6831. @end table
  6832. These options can be appended after the subfilter name, separated by a '|'.
  6833. Available subfilters are:
  6834. @table @option
  6835. @item hb/hdeblock[|difference[|flatness]]
  6836. Horizontal deblocking filter
  6837. @table @option
  6838. @item difference
  6839. Difference factor where higher values mean more deblocking (default: @code{32}).
  6840. @item flatness
  6841. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6842. @end table
  6843. @item vb/vdeblock[|difference[|flatness]]
  6844. Vertical deblocking filter
  6845. @table @option
  6846. @item difference
  6847. Difference factor where higher values mean more deblocking (default: @code{32}).
  6848. @item flatness
  6849. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6850. @end table
  6851. @item ha/hadeblock[|difference[|flatness]]
  6852. Accurate horizontal deblocking filter
  6853. @table @option
  6854. @item difference
  6855. Difference factor where higher values mean more deblocking (default: @code{32}).
  6856. @item flatness
  6857. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6858. @end table
  6859. @item va/vadeblock[|difference[|flatness]]
  6860. Accurate vertical deblocking filter
  6861. @table @option
  6862. @item difference
  6863. Difference factor where higher values mean more deblocking (default: @code{32}).
  6864. @item flatness
  6865. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6866. @end table
  6867. @end table
  6868. The horizontal and vertical deblocking filters share the difference and
  6869. flatness values so you cannot set different horizontal and vertical
  6870. thresholds.
  6871. @table @option
  6872. @item h1/x1hdeblock
  6873. Experimental horizontal deblocking filter
  6874. @item v1/x1vdeblock
  6875. Experimental vertical deblocking filter
  6876. @item dr/dering
  6877. Deringing filter
  6878. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  6879. @table @option
  6880. @item threshold1
  6881. larger -> stronger filtering
  6882. @item threshold2
  6883. larger -> stronger filtering
  6884. @item threshold3
  6885. larger -> stronger filtering
  6886. @end table
  6887. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  6888. @table @option
  6889. @item f/fullyrange
  6890. Stretch luminance to @code{0-255}.
  6891. @end table
  6892. @item lb/linblenddeint
  6893. Linear blend deinterlacing filter that deinterlaces the given block by
  6894. filtering all lines with a @code{(1 2 1)} filter.
  6895. @item li/linipoldeint
  6896. Linear interpolating deinterlacing filter that deinterlaces the given block by
  6897. linearly interpolating every second line.
  6898. @item ci/cubicipoldeint
  6899. Cubic interpolating deinterlacing filter deinterlaces the given block by
  6900. cubically interpolating every second line.
  6901. @item md/mediandeint
  6902. Median deinterlacing filter that deinterlaces the given block by applying a
  6903. median filter to every second line.
  6904. @item fd/ffmpegdeint
  6905. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  6906. second line with a @code{(-1 4 2 4 -1)} filter.
  6907. @item l5/lowpass5
  6908. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  6909. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  6910. @item fq/forceQuant[|quantizer]
  6911. Overrides the quantizer table from the input with the constant quantizer you
  6912. specify.
  6913. @table @option
  6914. @item quantizer
  6915. Quantizer to use
  6916. @end table
  6917. @item de/default
  6918. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  6919. @item fa/fast
  6920. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  6921. @item ac
  6922. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  6923. @end table
  6924. @subsection Examples
  6925. @itemize
  6926. @item
  6927. Apply horizontal and vertical deblocking, deringing and automatic
  6928. brightness/contrast:
  6929. @example
  6930. pp=hb/vb/dr/al
  6931. @end example
  6932. @item
  6933. Apply default filters without brightness/contrast correction:
  6934. @example
  6935. pp=de/-al
  6936. @end example
  6937. @item
  6938. Apply default filters and temporal denoiser:
  6939. @example
  6940. pp=default/tmpnoise|1|2|3
  6941. @end example
  6942. @item
  6943. Apply deblocking on luminance only, and switch vertical deblocking on or off
  6944. automatically depending on available CPU time:
  6945. @example
  6946. pp=hb|y/vb|a
  6947. @end example
  6948. @end itemize
  6949. @section pp7
  6950. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  6951. similar to spp = 6 with 7 point DCT, where only the center sample is
  6952. used after IDCT.
  6953. The filter accepts the following options:
  6954. @table @option
  6955. @item qp
  6956. Force a constant quantization parameter. It accepts an integer in range
  6957. 0 to 63. If not set, the filter will use the QP from the video stream
  6958. (if available).
  6959. @item mode
  6960. Set thresholding mode. Available modes are:
  6961. @table @samp
  6962. @item hard
  6963. Set hard thresholding.
  6964. @item soft
  6965. Set soft thresholding (better de-ringing effect, but likely blurrier).
  6966. @item medium
  6967. Set medium thresholding (good results, default).
  6968. @end table
  6969. @end table
  6970. @section psnr
  6971. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  6972. Ratio) between two input videos.
  6973. This filter takes in input two input videos, the first input is
  6974. considered the "main" source and is passed unchanged to the
  6975. output. The second input is used as a "reference" video for computing
  6976. the PSNR.
  6977. Both video inputs must have the same resolution and pixel format for
  6978. this filter to work correctly. Also it assumes that both inputs
  6979. have the same number of frames, which are compared one by one.
  6980. The obtained average PSNR is printed through the logging system.
  6981. The filter stores the accumulated MSE (mean squared error) of each
  6982. frame, and at the end of the processing it is averaged across all frames
  6983. equally, and the following formula is applied to obtain the PSNR:
  6984. @example
  6985. PSNR = 10*log10(MAX^2/MSE)
  6986. @end example
  6987. Where MAX is the average of the maximum values of each component of the
  6988. image.
  6989. The description of the accepted parameters follows.
  6990. @table @option
  6991. @item stats_file, f
  6992. If specified the filter will use the named file to save the PSNR of
  6993. each individual frame. When filename equals "-" the data is sent to
  6994. standard output.
  6995. @end table
  6996. The file printed if @var{stats_file} is selected, contains a sequence of
  6997. key/value pairs of the form @var{key}:@var{value} for each compared
  6998. couple of frames.
  6999. A description of each shown parameter follows:
  7000. @table @option
  7001. @item n
  7002. sequential number of the input frame, starting from 1
  7003. @item mse_avg
  7004. Mean Square Error pixel-by-pixel average difference of the compared
  7005. frames, averaged over all the image components.
  7006. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7007. Mean Square Error pixel-by-pixel average difference of the compared
  7008. frames for the component specified by the suffix.
  7009. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7010. Peak Signal to Noise ratio of the compared frames for the component
  7011. specified by the suffix.
  7012. @end table
  7013. For example:
  7014. @example
  7015. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7016. [main][ref] psnr="stats_file=stats.log" [out]
  7017. @end example
  7018. On this example the input file being processed is compared with the
  7019. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7020. is stored in @file{stats.log}.
  7021. @anchor{pullup}
  7022. @section pullup
  7023. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7024. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7025. content.
  7026. The pullup filter is designed to take advantage of future context in making
  7027. its decisions. This filter is stateless in the sense that it does not lock
  7028. onto a pattern to follow, but it instead looks forward to the following
  7029. fields in order to identify matches and rebuild progressive frames.
  7030. To produce content with an even framerate, insert the fps filter after
  7031. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7032. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7033. The filter accepts the following options:
  7034. @table @option
  7035. @item jl
  7036. @item jr
  7037. @item jt
  7038. @item jb
  7039. These options set the amount of "junk" to ignore at the left, right, top, and
  7040. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7041. while top and bottom are in units of 2 lines.
  7042. The default is 8 pixels on each side.
  7043. @item sb
  7044. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7045. filter generating an occasional mismatched frame, but it may also cause an
  7046. excessive number of frames to be dropped during high motion sequences.
  7047. Conversely, setting it to -1 will make filter match fields more easily.
  7048. This may help processing of video where there is slight blurring between
  7049. the fields, but may also cause there to be interlaced frames in the output.
  7050. Default value is @code{0}.
  7051. @item mp
  7052. Set the metric plane to use. It accepts the following values:
  7053. @table @samp
  7054. @item l
  7055. Use luma plane.
  7056. @item u
  7057. Use chroma blue plane.
  7058. @item v
  7059. Use chroma red plane.
  7060. @end table
  7061. This option may be set to use chroma plane instead of the default luma plane
  7062. for doing filter's computations. This may improve accuracy on very clean
  7063. source material, but more likely will decrease accuracy, especially if there
  7064. is chroma noise (rainbow effect) or any grayscale video.
  7065. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7066. load and make pullup usable in realtime on slow machines.
  7067. @end table
  7068. For best results (without duplicated frames in the output file) it is
  7069. necessary to change the output frame rate. For example, to inverse
  7070. telecine NTSC input:
  7071. @example
  7072. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7073. @end example
  7074. @section qp
  7075. Change video quantization parameters (QP).
  7076. The filter accepts the following option:
  7077. @table @option
  7078. @item qp
  7079. Set expression for quantization parameter.
  7080. @end table
  7081. The expression is evaluated through the eval API and can contain, among others,
  7082. the following constants:
  7083. @table @var
  7084. @item known
  7085. 1 if index is not 129, 0 otherwise.
  7086. @item qp
  7087. Sequentional index starting from -129 to 128.
  7088. @end table
  7089. @subsection Examples
  7090. @itemize
  7091. @item
  7092. Some equation like:
  7093. @example
  7094. qp=2+2*sin(PI*qp)
  7095. @end example
  7096. @end itemize
  7097. @section random
  7098. Flush video frames from internal cache of frames into a random order.
  7099. No frame is discarded.
  7100. Inspired by @ref{frei0r} nervous filter.
  7101. @table @option
  7102. @item frames
  7103. Set size in number of frames of internal cache, in range from @code{2} to
  7104. @code{512}. Default is @code{30}.
  7105. @item seed
  7106. Set seed for random number generator, must be an integer included between
  7107. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7108. less than @code{0}, the filter will try to use a good random seed on a
  7109. best effort basis.
  7110. @end table
  7111. @section removegrain
  7112. The removegrain filter is a spatial denoiser for progressive video.
  7113. @table @option
  7114. @item m0
  7115. Set mode for the first plane.
  7116. @item m1
  7117. Set mode for the second plane.
  7118. @item m2
  7119. Set mode for the third plane.
  7120. @item m3
  7121. Set mode for the fourth plane.
  7122. @end table
  7123. Range of mode is from 0 to 24. Description of each mode follows:
  7124. @table @var
  7125. @item 0
  7126. Leave input plane unchanged. Default.
  7127. @item 1
  7128. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7129. @item 2
  7130. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7131. @item 3
  7132. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7133. @item 4
  7134. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7135. This is equivalent to a median filter.
  7136. @item 5
  7137. Line-sensitive clipping giving the minimal change.
  7138. @item 6
  7139. Line-sensitive clipping, intermediate.
  7140. @item 7
  7141. Line-sensitive clipping, intermediate.
  7142. @item 8
  7143. Line-sensitive clipping, intermediate.
  7144. @item 9
  7145. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7146. @item 10
  7147. Replaces the target pixel with the closest neighbour.
  7148. @item 11
  7149. [1 2 1] horizontal and vertical kernel blur.
  7150. @item 12
  7151. Same as mode 11.
  7152. @item 13
  7153. Bob mode, interpolates top field from the line where the neighbours
  7154. pixels are the closest.
  7155. @item 14
  7156. Bob mode, interpolates bottom field from the line where the neighbours
  7157. pixels are the closest.
  7158. @item 15
  7159. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7160. interpolation formula.
  7161. @item 16
  7162. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7163. interpolation formula.
  7164. @item 17
  7165. Clips the pixel with the minimum and maximum of respectively the maximum and
  7166. minimum of each pair of opposite neighbour pixels.
  7167. @item 18
  7168. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7169. the current pixel is minimal.
  7170. @item 19
  7171. Replaces the pixel with the average of its 8 neighbours.
  7172. @item 20
  7173. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7174. @item 21
  7175. Clips pixels using the averages of opposite neighbour.
  7176. @item 22
  7177. Same as mode 21 but simpler and faster.
  7178. @item 23
  7179. Small edge and halo removal, but reputed useless.
  7180. @item 24
  7181. Similar as 23.
  7182. @end table
  7183. @section removelogo
  7184. Suppress a TV station logo, using an image file to determine which
  7185. pixels comprise the logo. It works by filling in the pixels that
  7186. comprise the logo with neighboring pixels.
  7187. The filter accepts the following options:
  7188. @table @option
  7189. @item filename, f
  7190. Set the filter bitmap file, which can be any image format supported by
  7191. libavformat. The width and height of the image file must match those of the
  7192. video stream being processed.
  7193. @end table
  7194. Pixels in the provided bitmap image with a value of zero are not
  7195. considered part of the logo, non-zero pixels are considered part of
  7196. the logo. If you use white (255) for the logo and black (0) for the
  7197. rest, you will be safe. For making the filter bitmap, it is
  7198. recommended to take a screen capture of a black frame with the logo
  7199. visible, and then using a threshold filter followed by the erode
  7200. filter once or twice.
  7201. If needed, little splotches can be fixed manually. Remember that if
  7202. logo pixels are not covered, the filter quality will be much
  7203. reduced. Marking too many pixels as part of the logo does not hurt as
  7204. much, but it will increase the amount of blurring needed to cover over
  7205. the image and will destroy more information than necessary, and extra
  7206. pixels will slow things down on a large logo.
  7207. @section repeatfields
  7208. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7209. fields based on its value.
  7210. @section reverse, areverse
  7211. Reverse a clip.
  7212. Warning: This filter requires memory to buffer the entire clip, so trimming
  7213. is suggested.
  7214. @subsection Examples
  7215. @itemize
  7216. @item
  7217. Take the first 5 seconds of a clip, and reverse it.
  7218. @example
  7219. trim=end=5,reverse
  7220. @end example
  7221. @end itemize
  7222. @section rotate
  7223. Rotate video by an arbitrary angle expressed in radians.
  7224. The filter accepts the following options:
  7225. A description of the optional parameters follows.
  7226. @table @option
  7227. @item angle, a
  7228. Set an expression for the angle by which to rotate the input video
  7229. clockwise, expressed as a number of radians. A negative value will
  7230. result in a counter-clockwise rotation. By default it is set to "0".
  7231. This expression is evaluated for each frame.
  7232. @item out_w, ow
  7233. Set the output width expression, default value is "iw".
  7234. This expression is evaluated just once during configuration.
  7235. @item out_h, oh
  7236. Set the output height expression, default value is "ih".
  7237. This expression is evaluated just once during configuration.
  7238. @item bilinear
  7239. Enable bilinear interpolation if set to 1, a value of 0 disables
  7240. it. Default value is 1.
  7241. @item fillcolor, c
  7242. Set the color used to fill the output area not covered by the rotated
  7243. image. For the general syntax of this option, check the "Color" section in the
  7244. ffmpeg-utils manual. If the special value "none" is selected then no
  7245. background is printed (useful for example if the background is never shown).
  7246. Default value is "black".
  7247. @end table
  7248. The expressions for the angle and the output size can contain the
  7249. following constants and functions:
  7250. @table @option
  7251. @item n
  7252. sequential number of the input frame, starting from 0. It is always NAN
  7253. before the first frame is filtered.
  7254. @item t
  7255. time in seconds of the input frame, it is set to 0 when the filter is
  7256. configured. It is always NAN before the first frame is filtered.
  7257. @item hsub
  7258. @item vsub
  7259. horizontal and vertical chroma subsample values. For example for the
  7260. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7261. @item in_w, iw
  7262. @item in_h, ih
  7263. the input video width and height
  7264. @item out_w, ow
  7265. @item out_h, oh
  7266. the output width and height, that is the size of the padded area as
  7267. specified by the @var{width} and @var{height} expressions
  7268. @item rotw(a)
  7269. @item roth(a)
  7270. the minimal width/height required for completely containing the input
  7271. video rotated by @var{a} radians.
  7272. These are only available when computing the @option{out_w} and
  7273. @option{out_h} expressions.
  7274. @end table
  7275. @subsection Examples
  7276. @itemize
  7277. @item
  7278. Rotate the input by PI/6 radians clockwise:
  7279. @example
  7280. rotate=PI/6
  7281. @end example
  7282. @item
  7283. Rotate the input by PI/6 radians counter-clockwise:
  7284. @example
  7285. rotate=-PI/6
  7286. @end example
  7287. @item
  7288. Rotate the input by 45 degrees clockwise:
  7289. @example
  7290. rotate=45*PI/180
  7291. @end example
  7292. @item
  7293. Apply a constant rotation with period T, starting from an angle of PI/3:
  7294. @example
  7295. rotate=PI/3+2*PI*t/T
  7296. @end example
  7297. @item
  7298. Make the input video rotation oscillating with a period of T
  7299. seconds and an amplitude of A radians:
  7300. @example
  7301. rotate=A*sin(2*PI/T*t)
  7302. @end example
  7303. @item
  7304. Rotate the video, output size is chosen so that the whole rotating
  7305. input video is always completely contained in the output:
  7306. @example
  7307. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7308. @end example
  7309. @item
  7310. Rotate the video, reduce the output size so that no background is ever
  7311. shown:
  7312. @example
  7313. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7314. @end example
  7315. @end itemize
  7316. @subsection Commands
  7317. The filter supports the following commands:
  7318. @table @option
  7319. @item a, angle
  7320. Set the angle expression.
  7321. The command accepts the same syntax of the corresponding option.
  7322. If the specified expression is not valid, it is kept at its current
  7323. value.
  7324. @end table
  7325. @section sab
  7326. Apply Shape Adaptive Blur.
  7327. The filter accepts the following options:
  7328. @table @option
  7329. @item luma_radius, lr
  7330. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7331. value is 1.0. A greater value will result in a more blurred image, and
  7332. in slower processing.
  7333. @item luma_pre_filter_radius, lpfr
  7334. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7335. value is 1.0.
  7336. @item luma_strength, ls
  7337. Set luma maximum difference between pixels to still be considered, must
  7338. be a value in the 0.1-100.0 range, default value is 1.0.
  7339. @item chroma_radius, cr
  7340. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7341. greater value will result in a more blurred image, and in slower
  7342. processing.
  7343. @item chroma_pre_filter_radius, cpfr
  7344. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7345. @item chroma_strength, cs
  7346. Set chroma maximum difference between pixels to still be considered,
  7347. must be a value in the 0.1-100.0 range.
  7348. @end table
  7349. Each chroma option value, if not explicitly specified, is set to the
  7350. corresponding luma option value.
  7351. @anchor{scale}
  7352. @section scale
  7353. Scale (resize) the input video, using the libswscale library.
  7354. The scale filter forces the output display aspect ratio to be the same
  7355. of the input, by changing the output sample aspect ratio.
  7356. If the input image format is different from the format requested by
  7357. the next filter, the scale filter will convert the input to the
  7358. requested format.
  7359. @subsection Options
  7360. The filter accepts the following options, or any of the options
  7361. supported by the libswscale scaler.
  7362. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7363. the complete list of scaler options.
  7364. @table @option
  7365. @item width, w
  7366. @item height, h
  7367. Set the output video dimension expression. Default value is the input
  7368. dimension.
  7369. If the value is 0, the input width is used for the output.
  7370. If one of the values is -1, the scale filter will use a value that
  7371. maintains the aspect ratio of the input image, calculated from the
  7372. other specified dimension. If both of them are -1, the input size is
  7373. used
  7374. If one of the values is -n with n > 1, the scale filter will also use a value
  7375. that maintains the aspect ratio of the input image, calculated from the other
  7376. specified dimension. After that it will, however, make sure that the calculated
  7377. dimension is divisible by n and adjust the value if necessary.
  7378. See below for the list of accepted constants for use in the dimension
  7379. expression.
  7380. @item interl
  7381. Set the interlacing mode. It accepts the following values:
  7382. @table @samp
  7383. @item 1
  7384. Force interlaced aware scaling.
  7385. @item 0
  7386. Do not apply interlaced scaling.
  7387. @item -1
  7388. Select interlaced aware scaling depending on whether the source frames
  7389. are flagged as interlaced or not.
  7390. @end table
  7391. Default value is @samp{0}.
  7392. @item flags
  7393. Set libswscale scaling flags. See
  7394. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7395. complete list of values. If not explicitly specified the filter applies
  7396. the default flags.
  7397. @item size, s
  7398. Set the video size. For the syntax of this option, check the
  7399. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7400. @item in_color_matrix
  7401. @item out_color_matrix
  7402. Set in/output YCbCr color space type.
  7403. This allows the autodetected value to be overridden as well as allows forcing
  7404. a specific value used for the output and encoder.
  7405. If not specified, the color space type depends on the pixel format.
  7406. Possible values:
  7407. @table @samp
  7408. @item auto
  7409. Choose automatically.
  7410. @item bt709
  7411. Format conforming to International Telecommunication Union (ITU)
  7412. Recommendation BT.709.
  7413. @item fcc
  7414. Set color space conforming to the United States Federal Communications
  7415. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7416. @item bt601
  7417. Set color space conforming to:
  7418. @itemize
  7419. @item
  7420. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7421. @item
  7422. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7423. @item
  7424. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7425. @end itemize
  7426. @item smpte240m
  7427. Set color space conforming to SMPTE ST 240:1999.
  7428. @end table
  7429. @item in_range
  7430. @item out_range
  7431. Set in/output YCbCr sample range.
  7432. This allows the autodetected value to be overridden as well as allows forcing
  7433. a specific value used for the output and encoder. If not specified, the
  7434. range depends on the pixel format. Possible values:
  7435. @table @samp
  7436. @item auto
  7437. Choose automatically.
  7438. @item jpeg/full/pc
  7439. Set full range (0-255 in case of 8-bit luma).
  7440. @item mpeg/tv
  7441. Set "MPEG" range (16-235 in case of 8-bit luma).
  7442. @end table
  7443. @item force_original_aspect_ratio
  7444. Enable decreasing or increasing output video width or height if necessary to
  7445. keep the original aspect ratio. Possible values:
  7446. @table @samp
  7447. @item disable
  7448. Scale the video as specified and disable this feature.
  7449. @item decrease
  7450. The output video dimensions will automatically be decreased if needed.
  7451. @item increase
  7452. The output video dimensions will automatically be increased if needed.
  7453. @end table
  7454. One useful instance of this option is that when you know a specific device's
  7455. maximum allowed resolution, you can use this to limit the output video to
  7456. that, while retaining the aspect ratio. For example, device A allows
  7457. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7458. decrease) and specifying 1280x720 to the command line makes the output
  7459. 1280x533.
  7460. Please note that this is a different thing than specifying -1 for @option{w}
  7461. or @option{h}, you still need to specify the output resolution for this option
  7462. to work.
  7463. @end table
  7464. The values of the @option{w} and @option{h} options are expressions
  7465. containing the following constants:
  7466. @table @var
  7467. @item in_w
  7468. @item in_h
  7469. The input width and height
  7470. @item iw
  7471. @item ih
  7472. These are the same as @var{in_w} and @var{in_h}.
  7473. @item out_w
  7474. @item out_h
  7475. The output (scaled) width and height
  7476. @item ow
  7477. @item oh
  7478. These are the same as @var{out_w} and @var{out_h}
  7479. @item a
  7480. The same as @var{iw} / @var{ih}
  7481. @item sar
  7482. input sample aspect ratio
  7483. @item dar
  7484. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7485. @item hsub
  7486. @item vsub
  7487. horizontal and vertical input chroma subsample values. For example for the
  7488. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7489. @item ohsub
  7490. @item ovsub
  7491. horizontal and vertical output chroma subsample values. For example for the
  7492. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7493. @end table
  7494. @subsection Examples
  7495. @itemize
  7496. @item
  7497. Scale the input video to a size of 200x100
  7498. @example
  7499. scale=w=200:h=100
  7500. @end example
  7501. This is equivalent to:
  7502. @example
  7503. scale=200:100
  7504. @end example
  7505. or:
  7506. @example
  7507. scale=200x100
  7508. @end example
  7509. @item
  7510. Specify a size abbreviation for the output size:
  7511. @example
  7512. scale=qcif
  7513. @end example
  7514. which can also be written as:
  7515. @example
  7516. scale=size=qcif
  7517. @end example
  7518. @item
  7519. Scale the input to 2x:
  7520. @example
  7521. scale=w=2*iw:h=2*ih
  7522. @end example
  7523. @item
  7524. The above is the same as:
  7525. @example
  7526. scale=2*in_w:2*in_h
  7527. @end example
  7528. @item
  7529. Scale the input to 2x with forced interlaced scaling:
  7530. @example
  7531. scale=2*iw:2*ih:interl=1
  7532. @end example
  7533. @item
  7534. Scale the input to half size:
  7535. @example
  7536. scale=w=iw/2:h=ih/2
  7537. @end example
  7538. @item
  7539. Increase the width, and set the height to the same size:
  7540. @example
  7541. scale=3/2*iw:ow
  7542. @end example
  7543. @item
  7544. Seek Greek harmony:
  7545. @example
  7546. scale=iw:1/PHI*iw
  7547. scale=ih*PHI:ih
  7548. @end example
  7549. @item
  7550. Increase the height, and set the width to 3/2 of the height:
  7551. @example
  7552. scale=w=3/2*oh:h=3/5*ih
  7553. @end example
  7554. @item
  7555. Increase the size, making the size a multiple of the chroma
  7556. subsample values:
  7557. @example
  7558. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7559. @end example
  7560. @item
  7561. Increase the width to a maximum of 500 pixels,
  7562. keeping the same aspect ratio as the input:
  7563. @example
  7564. scale=w='min(500\, iw*3/2):h=-1'
  7565. @end example
  7566. @end itemize
  7567. @subsection Commands
  7568. This filter supports the following commands:
  7569. @table @option
  7570. @item width, w
  7571. @item height, h
  7572. Set the output video dimension expression.
  7573. The command accepts the same syntax of the corresponding option.
  7574. If the specified expression is not valid, it is kept at its current
  7575. value.
  7576. @end table
  7577. @section scale2ref
  7578. Scale (resize) the input video, based on a reference video.
  7579. See the scale filter for available options, scale2ref supports the same but
  7580. uses the reference video instead of the main input as basis.
  7581. @subsection Examples
  7582. @itemize
  7583. @item
  7584. Scale a subtitle stream to match the main video in size before overlaying
  7585. @example
  7586. 'scale2ref[b][a];[a][b]overlay'
  7587. @end example
  7588. @end itemize
  7589. @section separatefields
  7590. The @code{separatefields} takes a frame-based video input and splits
  7591. each frame into its components fields, producing a new half height clip
  7592. with twice the frame rate and twice the frame count.
  7593. This filter use field-dominance information in frame to decide which
  7594. of each pair of fields to place first in the output.
  7595. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7596. @section setdar, setsar
  7597. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7598. output video.
  7599. This is done by changing the specified Sample (aka Pixel) Aspect
  7600. Ratio, according to the following equation:
  7601. @example
  7602. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7603. @end example
  7604. Keep in mind that the @code{setdar} filter does not modify the pixel
  7605. dimensions of the video frame. Also, the display aspect ratio set by
  7606. this filter may be changed by later filters in the filterchain,
  7607. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7608. applied.
  7609. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7610. the filter output video.
  7611. Note that as a consequence of the application of this filter, the
  7612. output display aspect ratio will change according to the equation
  7613. above.
  7614. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7615. filter may be changed by later filters in the filterchain, e.g. if
  7616. another "setsar" or a "setdar" filter is applied.
  7617. It accepts the following parameters:
  7618. @table @option
  7619. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7620. Set the aspect ratio used by the filter.
  7621. The parameter can be a floating point number string, an expression, or
  7622. a string of the form @var{num}:@var{den}, where @var{num} and
  7623. @var{den} are the numerator and denominator of the aspect ratio. If
  7624. the parameter is not specified, it is assumed the value "0".
  7625. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7626. should be escaped.
  7627. @item max
  7628. Set the maximum integer value to use for expressing numerator and
  7629. denominator when reducing the expressed aspect ratio to a rational.
  7630. Default value is @code{100}.
  7631. @end table
  7632. The parameter @var{sar} is an expression containing
  7633. the following constants:
  7634. @table @option
  7635. @item E, PI, PHI
  7636. These are approximated values for the mathematical constants e
  7637. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7638. @item w, h
  7639. The input width and height.
  7640. @item a
  7641. These are the same as @var{w} / @var{h}.
  7642. @item sar
  7643. The input sample aspect ratio.
  7644. @item dar
  7645. The input display aspect ratio. It is the same as
  7646. (@var{w} / @var{h}) * @var{sar}.
  7647. @item hsub, vsub
  7648. Horizontal and vertical chroma subsample values. For example, for the
  7649. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7650. @end table
  7651. @subsection Examples
  7652. @itemize
  7653. @item
  7654. To change the display aspect ratio to 16:9, specify one of the following:
  7655. @example
  7656. setdar=dar=1.77777
  7657. setdar=dar=16/9
  7658. setdar=dar=1.77777
  7659. @end example
  7660. @item
  7661. To change the sample aspect ratio to 10:11, specify:
  7662. @example
  7663. setsar=sar=10/11
  7664. @end example
  7665. @item
  7666. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7667. 1000 in the aspect ratio reduction, use the command:
  7668. @example
  7669. setdar=ratio=16/9:max=1000
  7670. @end example
  7671. @end itemize
  7672. @anchor{setfield}
  7673. @section setfield
  7674. Force field for the output video frame.
  7675. The @code{setfield} filter marks the interlace type field for the
  7676. output frames. It does not change the input frame, but only sets the
  7677. corresponding property, which affects how the frame is treated by
  7678. following filters (e.g. @code{fieldorder} or @code{yadif}).
  7679. The filter accepts the following options:
  7680. @table @option
  7681. @item mode
  7682. Available values are:
  7683. @table @samp
  7684. @item auto
  7685. Keep the same field property.
  7686. @item bff
  7687. Mark the frame as bottom-field-first.
  7688. @item tff
  7689. Mark the frame as top-field-first.
  7690. @item prog
  7691. Mark the frame as progressive.
  7692. @end table
  7693. @end table
  7694. @section showinfo
  7695. Show a line containing various information for each input video frame.
  7696. The input video is not modified.
  7697. The shown line contains a sequence of key/value pairs of the form
  7698. @var{key}:@var{value}.
  7699. The following values are shown in the output:
  7700. @table @option
  7701. @item n
  7702. The (sequential) number of the input frame, starting from 0.
  7703. @item pts
  7704. The Presentation TimeStamp of the input frame, expressed as a number of
  7705. time base units. The time base unit depends on the filter input pad.
  7706. @item pts_time
  7707. The Presentation TimeStamp of the input frame, expressed as a number of
  7708. seconds.
  7709. @item pos
  7710. The position of the frame in the input stream, or -1 if this information is
  7711. unavailable and/or meaningless (for example in case of synthetic video).
  7712. @item fmt
  7713. The pixel format name.
  7714. @item sar
  7715. The sample aspect ratio of the input frame, expressed in the form
  7716. @var{num}/@var{den}.
  7717. @item s
  7718. The size of the input frame. For the syntax of this option, check the
  7719. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7720. @item i
  7721. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  7722. for bottom field first).
  7723. @item iskey
  7724. This is 1 if the frame is a key frame, 0 otherwise.
  7725. @item type
  7726. The picture type of the input frame ("I" for an I-frame, "P" for a
  7727. P-frame, "B" for a B-frame, or "?" for an unknown type).
  7728. Also refer to the documentation of the @code{AVPictureType} enum and of
  7729. the @code{av_get_picture_type_char} function defined in
  7730. @file{libavutil/avutil.h}.
  7731. @item checksum
  7732. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  7733. @item plane_checksum
  7734. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  7735. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  7736. @end table
  7737. @section showpalette
  7738. Displays the 256 colors palette of each frame. This filter is only relevant for
  7739. @var{pal8} pixel format frames.
  7740. It accepts the following option:
  7741. @table @option
  7742. @item s
  7743. Set the size of the box used to represent one palette color entry. Default is
  7744. @code{30} (for a @code{30x30} pixel box).
  7745. @end table
  7746. @section shuffleframes
  7747. Reorder and/or duplicate video frames.
  7748. It accepts the following parameters:
  7749. @table @option
  7750. @item mapping
  7751. Set the destination indexes of input frames.
  7752. This is space or '|' separated list of indexes that maps input frames to output
  7753. frames. Number of indexes also sets maximal value that each index may have.
  7754. @end table
  7755. The first frame has the index 0. The default is to keep the input unchanged.
  7756. Swap second and third frame of every three frames of the input:
  7757. @example
  7758. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  7759. @end example
  7760. @section shuffleplanes
  7761. Reorder and/or duplicate video planes.
  7762. It accepts the following parameters:
  7763. @table @option
  7764. @item map0
  7765. The index of the input plane to be used as the first output plane.
  7766. @item map1
  7767. The index of the input plane to be used as the second output plane.
  7768. @item map2
  7769. The index of the input plane to be used as the third output plane.
  7770. @item map3
  7771. The index of the input plane to be used as the fourth output plane.
  7772. @end table
  7773. The first plane has the index 0. The default is to keep the input unchanged.
  7774. Swap the second and third planes of the input:
  7775. @example
  7776. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  7777. @end example
  7778. @anchor{signalstats}
  7779. @section signalstats
  7780. Evaluate various visual metrics that assist in determining issues associated
  7781. with the digitization of analog video media.
  7782. By default the filter will log these metadata values:
  7783. @table @option
  7784. @item YMIN
  7785. Display the minimal Y value contained within the input frame. Expressed in
  7786. range of [0-255].
  7787. @item YLOW
  7788. Display the Y value at the 10% percentile within the input frame. Expressed in
  7789. range of [0-255].
  7790. @item YAVG
  7791. Display the average Y value within the input frame. Expressed in range of
  7792. [0-255].
  7793. @item YHIGH
  7794. Display the Y value at the 90% percentile within the input frame. Expressed in
  7795. range of [0-255].
  7796. @item YMAX
  7797. Display the maximum Y value contained within the input frame. Expressed in
  7798. range of [0-255].
  7799. @item UMIN
  7800. Display the minimal U value contained within the input frame. Expressed in
  7801. range of [0-255].
  7802. @item ULOW
  7803. Display the U value at the 10% percentile within the input frame. Expressed in
  7804. range of [0-255].
  7805. @item UAVG
  7806. Display the average U value within the input frame. Expressed in range of
  7807. [0-255].
  7808. @item UHIGH
  7809. Display the U value at the 90% percentile within the input frame. Expressed in
  7810. range of [0-255].
  7811. @item UMAX
  7812. Display the maximum U value contained within the input frame. Expressed in
  7813. range of [0-255].
  7814. @item VMIN
  7815. Display the minimal V value contained within the input frame. Expressed in
  7816. range of [0-255].
  7817. @item VLOW
  7818. Display the V value at the 10% percentile within the input frame. Expressed in
  7819. range of [0-255].
  7820. @item VAVG
  7821. Display the average V value within the input frame. Expressed in range of
  7822. [0-255].
  7823. @item VHIGH
  7824. Display the V value at the 90% percentile within the input frame. Expressed in
  7825. range of [0-255].
  7826. @item VMAX
  7827. Display the maximum V value contained within the input frame. Expressed in
  7828. range of [0-255].
  7829. @item SATMIN
  7830. Display the minimal saturation value contained within the input frame.
  7831. Expressed in range of [0-~181.02].
  7832. @item SATLOW
  7833. Display the saturation value at the 10% percentile within the input frame.
  7834. Expressed in range of [0-~181.02].
  7835. @item SATAVG
  7836. Display the average saturation value within the input frame. Expressed in range
  7837. of [0-~181.02].
  7838. @item SATHIGH
  7839. Display the saturation value at the 90% percentile within the input frame.
  7840. Expressed in range of [0-~181.02].
  7841. @item SATMAX
  7842. Display the maximum saturation value contained within the input frame.
  7843. Expressed in range of [0-~181.02].
  7844. @item HUEMED
  7845. Display the median value for hue within the input frame. Expressed in range of
  7846. [0-360].
  7847. @item HUEAVG
  7848. Display the average value for hue within the input frame. Expressed in range of
  7849. [0-360].
  7850. @item YDIF
  7851. Display the average of sample value difference between all values of the Y
  7852. plane in the current frame and corresponding values of the previous input frame.
  7853. Expressed in range of [0-255].
  7854. @item UDIF
  7855. Display the average of sample value difference between all values of the U
  7856. plane in the current frame and corresponding values of the previous input frame.
  7857. Expressed in range of [0-255].
  7858. @item VDIF
  7859. Display the average of sample value difference between all values of the V
  7860. plane in the current frame and corresponding values of the previous input frame.
  7861. Expressed in range of [0-255].
  7862. @end table
  7863. The filter accepts the following options:
  7864. @table @option
  7865. @item stat
  7866. @item out
  7867. @option{stat} specify an additional form of image analysis.
  7868. @option{out} output video with the specified type of pixel highlighted.
  7869. Both options accept the following values:
  7870. @table @samp
  7871. @item tout
  7872. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  7873. unlike the neighboring pixels of the same field. Examples of temporal outliers
  7874. include the results of video dropouts, head clogs, or tape tracking issues.
  7875. @item vrep
  7876. Identify @var{vertical line repetition}. Vertical line repetition includes
  7877. similar rows of pixels within a frame. In born-digital video vertical line
  7878. repetition is common, but this pattern is uncommon in video digitized from an
  7879. analog source. When it occurs in video that results from the digitization of an
  7880. analog source it can indicate concealment from a dropout compensator.
  7881. @item brng
  7882. Identify pixels that fall outside of legal broadcast range.
  7883. @end table
  7884. @item color, c
  7885. Set the highlight color for the @option{out} option. The default color is
  7886. yellow.
  7887. @end table
  7888. @subsection Examples
  7889. @itemize
  7890. @item
  7891. Output data of various video metrics:
  7892. @example
  7893. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  7894. @end example
  7895. @item
  7896. Output specific data about the minimum and maximum values of the Y plane per frame:
  7897. @example
  7898. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  7899. @end example
  7900. @item
  7901. Playback video while highlighting pixels that are outside of broadcast range in red.
  7902. @example
  7903. ffplay example.mov -vf signalstats="out=brng:color=red"
  7904. @end example
  7905. @item
  7906. Playback video with signalstats metadata drawn over the frame.
  7907. @example
  7908. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  7909. @end example
  7910. The contents of signalstat_drawtext.txt used in the command are:
  7911. @example
  7912. time %@{pts:hms@}
  7913. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  7914. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  7915. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  7916. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  7917. @end example
  7918. @end itemize
  7919. @anchor{smartblur}
  7920. @section smartblur
  7921. Blur the input video without impacting the outlines.
  7922. It accepts the following options:
  7923. @table @option
  7924. @item luma_radius, lr
  7925. Set the luma radius. The option value must be a float number in
  7926. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7927. used to blur the image (slower if larger). Default value is 1.0.
  7928. @item luma_strength, ls
  7929. Set the luma strength. The option value must be a float number
  7930. in the range [-1.0,1.0] that configures the blurring. A value included
  7931. in [0.0,1.0] will blur the image whereas a value included in
  7932. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7933. @item luma_threshold, lt
  7934. Set the luma threshold used as a coefficient to determine
  7935. whether a pixel should be blurred or not. The option value must be an
  7936. integer in the range [-30,30]. A value of 0 will filter all the image,
  7937. a value included in [0,30] will filter flat areas and a value included
  7938. in [-30,0] will filter edges. Default value is 0.
  7939. @item chroma_radius, cr
  7940. Set the chroma radius. The option value must be a float number in
  7941. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7942. used to blur the image (slower if larger). Default value is 1.0.
  7943. @item chroma_strength, cs
  7944. Set the chroma strength. The option value must be a float number
  7945. in the range [-1.0,1.0] that configures the blurring. A value included
  7946. in [0.0,1.0] will blur the image whereas a value included in
  7947. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7948. @item chroma_threshold, ct
  7949. Set the chroma threshold used as a coefficient to determine
  7950. whether a pixel should be blurred or not. The option value must be an
  7951. integer in the range [-30,30]. A value of 0 will filter all the image,
  7952. a value included in [0,30] will filter flat areas and a value included
  7953. in [-30,0] will filter edges. Default value is 0.
  7954. @end table
  7955. If a chroma option is not explicitly set, the corresponding luma value
  7956. is set.
  7957. @section ssim
  7958. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  7959. This filter takes in input two input videos, the first input is
  7960. considered the "main" source and is passed unchanged to the
  7961. output. The second input is used as a "reference" video for computing
  7962. the SSIM.
  7963. Both video inputs must have the same resolution and pixel format for
  7964. this filter to work correctly. Also it assumes that both inputs
  7965. have the same number of frames, which are compared one by one.
  7966. The filter stores the calculated SSIM of each frame.
  7967. The description of the accepted parameters follows.
  7968. @table @option
  7969. @item stats_file, f
  7970. If specified the filter will use the named file to save the SSIM of
  7971. each individual frame. When filename equals "-" the data is sent to
  7972. standard output.
  7973. @end table
  7974. The file printed if @var{stats_file} is selected, contains a sequence of
  7975. key/value pairs of the form @var{key}:@var{value} for each compared
  7976. couple of frames.
  7977. A description of each shown parameter follows:
  7978. @table @option
  7979. @item n
  7980. sequential number of the input frame, starting from 1
  7981. @item Y, U, V, R, G, B
  7982. SSIM of the compared frames for the component specified by the suffix.
  7983. @item All
  7984. SSIM of the compared frames for the whole frame.
  7985. @item dB
  7986. Same as above but in dB representation.
  7987. @end table
  7988. For example:
  7989. @example
  7990. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7991. [main][ref] ssim="stats_file=stats.log" [out]
  7992. @end example
  7993. On this example the input file being processed is compared with the
  7994. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  7995. is stored in @file{stats.log}.
  7996. Another example with both psnr and ssim at same time:
  7997. @example
  7998. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  7999. @end example
  8000. @section stereo3d
  8001. Convert between different stereoscopic image formats.
  8002. The filters accept the following options:
  8003. @table @option
  8004. @item in
  8005. Set stereoscopic image format of input.
  8006. Available values for input image formats are:
  8007. @table @samp
  8008. @item sbsl
  8009. side by side parallel (left eye left, right eye right)
  8010. @item sbsr
  8011. side by side crosseye (right eye left, left eye right)
  8012. @item sbs2l
  8013. side by side parallel with half width resolution
  8014. (left eye left, right eye right)
  8015. @item sbs2r
  8016. side by side crosseye with half width resolution
  8017. (right eye left, left eye right)
  8018. @item abl
  8019. above-below (left eye above, right eye below)
  8020. @item abr
  8021. above-below (right eye above, left eye below)
  8022. @item ab2l
  8023. above-below with half height resolution
  8024. (left eye above, right eye below)
  8025. @item ab2r
  8026. above-below with half height resolution
  8027. (right eye above, left eye below)
  8028. @item al
  8029. alternating frames (left eye first, right eye second)
  8030. @item ar
  8031. alternating frames (right eye first, left eye second)
  8032. @item irl
  8033. interleaved rows (left eye has top row, right eye starts on next row)
  8034. @item irr
  8035. interleaved rows (right eye has top row, left eye starts on next row)
  8036. Default value is @samp{sbsl}.
  8037. @end table
  8038. @item out
  8039. Set stereoscopic image format of output.
  8040. Available values for output image formats are all the input formats as well as:
  8041. @table @samp
  8042. @item arbg
  8043. anaglyph red/blue gray
  8044. (red filter on left eye, blue filter on right eye)
  8045. @item argg
  8046. anaglyph red/green gray
  8047. (red filter on left eye, green filter on right eye)
  8048. @item arcg
  8049. anaglyph red/cyan gray
  8050. (red filter on left eye, cyan filter on right eye)
  8051. @item arch
  8052. anaglyph red/cyan half colored
  8053. (red filter on left eye, cyan filter on right eye)
  8054. @item arcc
  8055. anaglyph red/cyan color
  8056. (red filter on left eye, cyan filter on right eye)
  8057. @item arcd
  8058. anaglyph red/cyan color optimized with the least squares projection of dubois
  8059. (red filter on left eye, cyan filter on right eye)
  8060. @item agmg
  8061. anaglyph green/magenta gray
  8062. (green filter on left eye, magenta filter on right eye)
  8063. @item agmh
  8064. anaglyph green/magenta half colored
  8065. (green filter on left eye, magenta filter on right eye)
  8066. @item agmc
  8067. anaglyph green/magenta colored
  8068. (green filter on left eye, magenta filter on right eye)
  8069. @item agmd
  8070. anaglyph green/magenta color optimized with the least squares projection of dubois
  8071. (green filter on left eye, magenta filter on right eye)
  8072. @item aybg
  8073. anaglyph yellow/blue gray
  8074. (yellow filter on left eye, blue filter on right eye)
  8075. @item aybh
  8076. anaglyph yellow/blue half colored
  8077. (yellow filter on left eye, blue filter on right eye)
  8078. @item aybc
  8079. anaglyph yellow/blue colored
  8080. (yellow filter on left eye, blue filter on right eye)
  8081. @item aybd
  8082. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8083. (yellow filter on left eye, blue filter on right eye)
  8084. @item ml
  8085. mono output (left eye only)
  8086. @item mr
  8087. mono output (right eye only)
  8088. @item chl
  8089. checkerboard, left eye first
  8090. @item chr
  8091. checkerboard, right eye first
  8092. @item icl
  8093. interleaved columns, left eye first
  8094. @item icr
  8095. interleaved columns, right eye first
  8096. @end table
  8097. Default value is @samp{arcd}.
  8098. @end table
  8099. @subsection Examples
  8100. @itemize
  8101. @item
  8102. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  8103. @example
  8104. stereo3d=sbsl:aybd
  8105. @end example
  8106. @item
  8107. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  8108. @example
  8109. stereo3d=abl:sbsr
  8110. @end example
  8111. @end itemize
  8112. @anchor{spp}
  8113. @section spp
  8114. Apply a simple postprocessing filter that compresses and decompresses the image
  8115. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8116. and average the results.
  8117. The filter accepts the following options:
  8118. @table @option
  8119. @item quality
  8120. Set quality. This option defines the number of levels for averaging. It accepts
  8121. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8122. effect. A value of @code{6} means the higher quality. For each increment of
  8123. that value the speed drops by a factor of approximately 2. Default value is
  8124. @code{3}.
  8125. @item qp
  8126. Force a constant quantization parameter. If not set, the filter will use the QP
  8127. from the video stream (if available).
  8128. @item mode
  8129. Set thresholding mode. Available modes are:
  8130. @table @samp
  8131. @item hard
  8132. Set hard thresholding (default).
  8133. @item soft
  8134. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8135. @end table
  8136. @item use_bframe_qp
  8137. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8138. option may cause flicker since the B-Frames have often larger QP. Default is
  8139. @code{0} (not enabled).
  8140. @end table
  8141. @anchor{subtitles}
  8142. @section subtitles
  8143. Draw subtitles on top of input video using the libass library.
  8144. To enable compilation of this filter you need to configure FFmpeg with
  8145. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8146. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8147. Alpha) subtitles format.
  8148. The filter accepts the following options:
  8149. @table @option
  8150. @item filename, f
  8151. Set the filename of the subtitle file to read. It must be specified.
  8152. @item original_size
  8153. Specify the size of the original video, the video for which the ASS file
  8154. was composed. For the syntax of this option, check the
  8155. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8156. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8157. correctly scale the fonts if the aspect ratio has been changed.
  8158. @item fontsdir
  8159. Set a directory path containing fonts that can be used by the filter.
  8160. These fonts will be used in addition to whatever the font provider uses.
  8161. @item charenc
  8162. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8163. useful if not UTF-8.
  8164. @item stream_index, si
  8165. Set subtitles stream index. @code{subtitles} filter only.
  8166. @item force_style
  8167. Override default style or script info parameters of the subtitles. It accepts a
  8168. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8169. @end table
  8170. If the first key is not specified, it is assumed that the first value
  8171. specifies the @option{filename}.
  8172. For example, to render the file @file{sub.srt} on top of the input
  8173. video, use the command:
  8174. @example
  8175. subtitles=sub.srt
  8176. @end example
  8177. which is equivalent to:
  8178. @example
  8179. subtitles=filename=sub.srt
  8180. @end example
  8181. To render the default subtitles stream from file @file{video.mkv}, use:
  8182. @example
  8183. subtitles=video.mkv
  8184. @end example
  8185. To render the second subtitles stream from that file, use:
  8186. @example
  8187. subtitles=video.mkv:si=1
  8188. @end example
  8189. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8190. @code{DejaVu Serif}, use:
  8191. @example
  8192. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8193. @end example
  8194. @section super2xsai
  8195. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8196. Interpolate) pixel art scaling algorithm.
  8197. Useful for enlarging pixel art images without reducing sharpness.
  8198. @section swapuv
  8199. Swap U & V plane.
  8200. @section telecine
  8201. Apply telecine process to the video.
  8202. This filter accepts the following options:
  8203. @table @option
  8204. @item first_field
  8205. @table @samp
  8206. @item top, t
  8207. top field first
  8208. @item bottom, b
  8209. bottom field first
  8210. The default value is @code{top}.
  8211. @end table
  8212. @item pattern
  8213. A string of numbers representing the pulldown pattern you wish to apply.
  8214. The default value is @code{23}.
  8215. @end table
  8216. @example
  8217. Some typical patterns:
  8218. NTSC output (30i):
  8219. 27.5p: 32222
  8220. 24p: 23 (classic)
  8221. 24p: 2332 (preferred)
  8222. 20p: 33
  8223. 18p: 334
  8224. 16p: 3444
  8225. PAL output (25i):
  8226. 27.5p: 12222
  8227. 24p: 222222222223 ("Euro pulldown")
  8228. 16.67p: 33
  8229. 16p: 33333334
  8230. @end example
  8231. @section thumbnail
  8232. Select the most representative frame in a given sequence of consecutive frames.
  8233. The filter accepts the following options:
  8234. @table @option
  8235. @item n
  8236. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8237. will pick one of them, and then handle the next batch of @var{n} frames until
  8238. the end. Default is @code{100}.
  8239. @end table
  8240. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8241. value will result in a higher memory usage, so a high value is not recommended.
  8242. @subsection Examples
  8243. @itemize
  8244. @item
  8245. Extract one picture each 50 frames:
  8246. @example
  8247. thumbnail=50
  8248. @end example
  8249. @item
  8250. Complete example of a thumbnail creation with @command{ffmpeg}:
  8251. @example
  8252. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8253. @end example
  8254. @end itemize
  8255. @section tile
  8256. Tile several successive frames together.
  8257. The filter accepts the following options:
  8258. @table @option
  8259. @item layout
  8260. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8261. this option, check the
  8262. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8263. @item nb_frames
  8264. Set the maximum number of frames to render in the given area. It must be less
  8265. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8266. the area will be used.
  8267. @item margin
  8268. Set the outer border margin in pixels.
  8269. @item padding
  8270. Set the inner border thickness (i.e. the number of pixels between frames). For
  8271. more advanced padding options (such as having different values for the edges),
  8272. refer to the pad video filter.
  8273. @item color
  8274. Specify the color of the unused area. For the syntax of this option, check the
  8275. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8276. is "black".
  8277. @end table
  8278. @subsection Examples
  8279. @itemize
  8280. @item
  8281. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8282. @example
  8283. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8284. @end example
  8285. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8286. duplicating each output frame to accommodate the originally detected frame
  8287. rate.
  8288. @item
  8289. Display @code{5} pictures in an area of @code{3x2} frames,
  8290. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8291. mixed flat and named options:
  8292. @example
  8293. tile=3x2:nb_frames=5:padding=7:margin=2
  8294. @end example
  8295. @end itemize
  8296. @section tinterlace
  8297. Perform various types of temporal field interlacing.
  8298. Frames are counted starting from 1, so the first input frame is
  8299. considered odd.
  8300. The filter accepts the following options:
  8301. @table @option
  8302. @item mode
  8303. Specify the mode of the interlacing. This option can also be specified
  8304. as a value alone. See below for a list of values for this option.
  8305. Available values are:
  8306. @table @samp
  8307. @item merge, 0
  8308. Move odd frames into the upper field, even into the lower field,
  8309. generating a double height frame at half frame rate.
  8310. @example
  8311. ------> time
  8312. Input:
  8313. Frame 1 Frame 2 Frame 3 Frame 4
  8314. 11111 22222 33333 44444
  8315. 11111 22222 33333 44444
  8316. 11111 22222 33333 44444
  8317. 11111 22222 33333 44444
  8318. Output:
  8319. 11111 33333
  8320. 22222 44444
  8321. 11111 33333
  8322. 22222 44444
  8323. 11111 33333
  8324. 22222 44444
  8325. 11111 33333
  8326. 22222 44444
  8327. @end example
  8328. @item drop_odd, 1
  8329. Only output even frames, odd frames are dropped, generating a frame with
  8330. unchanged height at half frame rate.
  8331. @example
  8332. ------> time
  8333. Input:
  8334. Frame 1 Frame 2 Frame 3 Frame 4
  8335. 11111 22222 33333 44444
  8336. 11111 22222 33333 44444
  8337. 11111 22222 33333 44444
  8338. 11111 22222 33333 44444
  8339. Output:
  8340. 22222 44444
  8341. 22222 44444
  8342. 22222 44444
  8343. 22222 44444
  8344. @end example
  8345. @item drop_even, 2
  8346. Only output odd frames, even frames are dropped, generating a frame with
  8347. unchanged height at half frame rate.
  8348. @example
  8349. ------> time
  8350. Input:
  8351. Frame 1 Frame 2 Frame 3 Frame 4
  8352. 11111 22222 33333 44444
  8353. 11111 22222 33333 44444
  8354. 11111 22222 33333 44444
  8355. 11111 22222 33333 44444
  8356. Output:
  8357. 11111 33333
  8358. 11111 33333
  8359. 11111 33333
  8360. 11111 33333
  8361. @end example
  8362. @item pad, 3
  8363. Expand each frame to full height, but pad alternate lines with black,
  8364. generating a frame with double height at the same input frame rate.
  8365. @example
  8366. ------> time
  8367. Input:
  8368. Frame 1 Frame 2 Frame 3 Frame 4
  8369. 11111 22222 33333 44444
  8370. 11111 22222 33333 44444
  8371. 11111 22222 33333 44444
  8372. 11111 22222 33333 44444
  8373. Output:
  8374. 11111 ..... 33333 .....
  8375. ..... 22222 ..... 44444
  8376. 11111 ..... 33333 .....
  8377. ..... 22222 ..... 44444
  8378. 11111 ..... 33333 .....
  8379. ..... 22222 ..... 44444
  8380. 11111 ..... 33333 .....
  8381. ..... 22222 ..... 44444
  8382. @end example
  8383. @item interleave_top, 4
  8384. Interleave the upper field from odd frames with the lower field from
  8385. even frames, generating a frame with unchanged height at half frame rate.
  8386. @example
  8387. ------> time
  8388. Input:
  8389. Frame 1 Frame 2 Frame 3 Frame 4
  8390. 11111<- 22222 33333<- 44444
  8391. 11111 22222<- 33333 44444<-
  8392. 11111<- 22222 33333<- 44444
  8393. 11111 22222<- 33333 44444<-
  8394. Output:
  8395. 11111 33333
  8396. 22222 44444
  8397. 11111 33333
  8398. 22222 44444
  8399. @end example
  8400. @item interleave_bottom, 5
  8401. Interleave the lower field from odd frames with the upper field from
  8402. even frames, generating a frame with unchanged height at half frame rate.
  8403. @example
  8404. ------> time
  8405. Input:
  8406. Frame 1 Frame 2 Frame 3 Frame 4
  8407. 11111 22222<- 33333 44444<-
  8408. 11111<- 22222 33333<- 44444
  8409. 11111 22222<- 33333 44444<-
  8410. 11111<- 22222 33333<- 44444
  8411. Output:
  8412. 22222 44444
  8413. 11111 33333
  8414. 22222 44444
  8415. 11111 33333
  8416. @end example
  8417. @item interlacex2, 6
  8418. Double frame rate with unchanged height. Frames are inserted each
  8419. containing the second temporal field from the previous input frame and
  8420. the first temporal field from the next input frame. This mode relies on
  8421. the top_field_first flag. Useful for interlaced video displays with no
  8422. field synchronisation.
  8423. @example
  8424. ------> time
  8425. Input:
  8426. Frame 1 Frame 2 Frame 3 Frame 4
  8427. 11111 22222 33333 44444
  8428. 11111 22222 33333 44444
  8429. 11111 22222 33333 44444
  8430. 11111 22222 33333 44444
  8431. Output:
  8432. 11111 22222 22222 33333 33333 44444 44444
  8433. 11111 11111 22222 22222 33333 33333 44444
  8434. 11111 22222 22222 33333 33333 44444 44444
  8435. 11111 11111 22222 22222 33333 33333 44444
  8436. @end example
  8437. @item mergex2, 7
  8438. Move odd frames into the upper field, even into the lower field,
  8439. generating a double height frame at same frame rate.
  8440. @example
  8441. ------> time
  8442. Input:
  8443. Frame 1 Frame 2 Frame 3 Frame 4
  8444. 11111 22222 33333 44444
  8445. 11111 22222 33333 44444
  8446. 11111 22222 33333 44444
  8447. 11111 22222 33333 44444
  8448. Output:
  8449. 11111 33333 33333 55555
  8450. 22222 22222 44444 44444
  8451. 11111 33333 33333 55555
  8452. 22222 22222 44444 44444
  8453. 11111 33333 33333 55555
  8454. 22222 22222 44444 44444
  8455. 11111 33333 33333 55555
  8456. 22222 22222 44444 44444
  8457. @end example
  8458. @end table
  8459. Numeric values are deprecated but are accepted for backward
  8460. compatibility reasons.
  8461. Default mode is @code{merge}.
  8462. @item flags
  8463. Specify flags influencing the filter process.
  8464. Available value for @var{flags} is:
  8465. @table @option
  8466. @item low_pass_filter, vlfp
  8467. Enable vertical low-pass filtering in the filter.
  8468. Vertical low-pass filtering is required when creating an interlaced
  8469. destination from a progressive source which contains high-frequency
  8470. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8471. patterning.
  8472. Vertical low-pass filtering can only be enabled for @option{mode}
  8473. @var{interleave_top} and @var{interleave_bottom}.
  8474. @end table
  8475. @end table
  8476. @section transpose
  8477. Transpose rows with columns in the input video and optionally flip it.
  8478. It accepts the following parameters:
  8479. @table @option
  8480. @item dir
  8481. Specify the transposition direction.
  8482. Can assume the following values:
  8483. @table @samp
  8484. @item 0, 4, cclock_flip
  8485. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8486. @example
  8487. L.R L.l
  8488. . . -> . .
  8489. l.r R.r
  8490. @end example
  8491. @item 1, 5, clock
  8492. Rotate by 90 degrees clockwise, that is:
  8493. @example
  8494. L.R l.L
  8495. . . -> . .
  8496. l.r r.R
  8497. @end example
  8498. @item 2, 6, cclock
  8499. Rotate by 90 degrees counterclockwise, that is:
  8500. @example
  8501. L.R R.r
  8502. . . -> . .
  8503. l.r L.l
  8504. @end example
  8505. @item 3, 7, clock_flip
  8506. Rotate by 90 degrees clockwise and vertically flip, that is:
  8507. @example
  8508. L.R r.R
  8509. . . -> . .
  8510. l.r l.L
  8511. @end example
  8512. @end table
  8513. For values between 4-7, the transposition is only done if the input
  8514. video geometry is portrait and not landscape. These values are
  8515. deprecated, the @code{passthrough} option should be used instead.
  8516. Numerical values are deprecated, and should be dropped in favor of
  8517. symbolic constants.
  8518. @item passthrough
  8519. Do not apply the transposition if the input geometry matches the one
  8520. specified by the specified value. It accepts the following values:
  8521. @table @samp
  8522. @item none
  8523. Always apply transposition.
  8524. @item portrait
  8525. Preserve portrait geometry (when @var{height} >= @var{width}).
  8526. @item landscape
  8527. Preserve landscape geometry (when @var{width} >= @var{height}).
  8528. @end table
  8529. Default value is @code{none}.
  8530. @end table
  8531. For example to rotate by 90 degrees clockwise and preserve portrait
  8532. layout:
  8533. @example
  8534. transpose=dir=1:passthrough=portrait
  8535. @end example
  8536. The command above can also be specified as:
  8537. @example
  8538. transpose=1:portrait
  8539. @end example
  8540. @section trim
  8541. Trim the input so that the output contains one continuous subpart of the input.
  8542. It accepts the following parameters:
  8543. @table @option
  8544. @item start
  8545. Specify the time of the start of the kept section, i.e. the frame with the
  8546. timestamp @var{start} will be the first frame in the output.
  8547. @item end
  8548. Specify the time of the first frame that will be dropped, i.e. the frame
  8549. immediately preceding the one with the timestamp @var{end} will be the last
  8550. frame in the output.
  8551. @item start_pts
  8552. This is the same as @var{start}, except this option sets the start timestamp
  8553. in timebase units instead of seconds.
  8554. @item end_pts
  8555. This is the same as @var{end}, except this option sets the end timestamp
  8556. in timebase units instead of seconds.
  8557. @item duration
  8558. The maximum duration of the output in seconds.
  8559. @item start_frame
  8560. The number of the first frame that should be passed to the output.
  8561. @item end_frame
  8562. The number of the first frame that should be dropped.
  8563. @end table
  8564. @option{start}, @option{end}, and @option{duration} are expressed as time
  8565. duration specifications; see
  8566. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8567. for the accepted syntax.
  8568. Note that the first two sets of the start/end options and the @option{duration}
  8569. option look at the frame timestamp, while the _frame variants simply count the
  8570. frames that pass through the filter. Also note that this filter does not modify
  8571. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8572. setpts filter after the trim filter.
  8573. If multiple start or end options are set, this filter tries to be greedy and
  8574. keep all the frames that match at least one of the specified constraints. To keep
  8575. only the part that matches all the constraints at once, chain multiple trim
  8576. filters.
  8577. The defaults are such that all the input is kept. So it is possible to set e.g.
  8578. just the end values to keep everything before the specified time.
  8579. Examples:
  8580. @itemize
  8581. @item
  8582. Drop everything except the second minute of input:
  8583. @example
  8584. ffmpeg -i INPUT -vf trim=60:120
  8585. @end example
  8586. @item
  8587. Keep only the first second:
  8588. @example
  8589. ffmpeg -i INPUT -vf trim=duration=1
  8590. @end example
  8591. @end itemize
  8592. @anchor{unsharp}
  8593. @section unsharp
  8594. Sharpen or blur the input video.
  8595. It accepts the following parameters:
  8596. @table @option
  8597. @item luma_msize_x, lx
  8598. Set the luma matrix horizontal size. It must be an odd integer between
  8599. 3 and 63. The default value is 5.
  8600. @item luma_msize_y, ly
  8601. Set the luma matrix vertical size. It must be an odd integer between 3
  8602. and 63. The default value is 5.
  8603. @item luma_amount, la
  8604. Set the luma effect strength. It must be a floating point number, reasonable
  8605. values lay between -1.5 and 1.5.
  8606. Negative values will blur the input video, while positive values will
  8607. sharpen it, a value of zero will disable the effect.
  8608. Default value is 1.0.
  8609. @item chroma_msize_x, cx
  8610. Set the chroma matrix horizontal size. It must be an odd integer
  8611. between 3 and 63. The default value is 5.
  8612. @item chroma_msize_y, cy
  8613. Set the chroma matrix vertical size. It must be an odd integer
  8614. between 3 and 63. The default value is 5.
  8615. @item chroma_amount, ca
  8616. Set the chroma effect strength. It must be a floating point number, reasonable
  8617. values lay between -1.5 and 1.5.
  8618. Negative values will blur the input video, while positive values will
  8619. sharpen it, a value of zero will disable the effect.
  8620. Default value is 0.0.
  8621. @item opencl
  8622. If set to 1, specify using OpenCL capabilities, only available if
  8623. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8624. @end table
  8625. All parameters are optional and default to the equivalent of the
  8626. string '5:5:1.0:5:5:0.0'.
  8627. @subsection Examples
  8628. @itemize
  8629. @item
  8630. Apply strong luma sharpen effect:
  8631. @example
  8632. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8633. @end example
  8634. @item
  8635. Apply a strong blur of both luma and chroma parameters:
  8636. @example
  8637. unsharp=7:7:-2:7:7:-2
  8638. @end example
  8639. @end itemize
  8640. @section uspp
  8641. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  8642. the image at several (or - in the case of @option{quality} level @code{8} - all)
  8643. shifts and average the results.
  8644. The way this differs from the behavior of spp is that uspp actually encodes &
  8645. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  8646. DCT similar to MJPEG.
  8647. The filter accepts the following options:
  8648. @table @option
  8649. @item quality
  8650. Set quality. This option defines the number of levels for averaging. It accepts
  8651. an integer in the range 0-8. If set to @code{0}, the filter will have no
  8652. effect. A value of @code{8} means the higher quality. For each increment of
  8653. that value the speed drops by a factor of approximately 2. Default value is
  8654. @code{3}.
  8655. @item qp
  8656. Force a constant quantization parameter. If not set, the filter will use the QP
  8657. from the video stream (if available).
  8658. @end table
  8659. @section vectorscope
  8660. Display 2 color component values in the two dimensional graph (which is called
  8661. a vectorscope).
  8662. This filter accepts the following options:
  8663. @table @option
  8664. @item mode, m
  8665. Set vectorscope mode.
  8666. It accepts the following values:
  8667. @table @samp
  8668. @item gray
  8669. Gray values are displayed on graph, higher brightness means more pixels have
  8670. same component color value on location in graph. This is the default mode.
  8671. @item color
  8672. Gray values are displayed on graph. Surrounding pixels values which are not
  8673. present in video frame are drawn in gradient of 2 color components which are
  8674. set by option @code{x} and @code{y}.
  8675. @item color2
  8676. Actual color components values present in video frame are displayed on graph.
  8677. @item color3
  8678. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  8679. on graph increases value of another color component, which is luminance by
  8680. default values of @code{x} and @code{y}.
  8681. @item color4
  8682. Actual colors present in video frame are displayed on graph. If two different
  8683. colors map to same position on graph then color with higher value of component
  8684. not present in graph is picked.
  8685. @end table
  8686. @item x
  8687. Set which color component will be represented on X-axis. Default is @code{1}.
  8688. @item y
  8689. Set which color component will be represented on Y-axis. Default is @code{2}.
  8690. @item intensity, i
  8691. Set intensity, used by modes: gray, color and color3 for increasing brightness
  8692. of color component which represents frequency of (X, Y) location in graph.
  8693. @item envelope, e
  8694. @table @samp
  8695. @item none
  8696. No envelope, this is default.
  8697. @item instant
  8698. Instant envelope, even darkest single pixel will be clearly highlighted.
  8699. @item peak
  8700. Hold maximum and minimum values presented in graph over time. This way you
  8701. can still spot out of range values without constantly looking at vectorscope.
  8702. @item peak+instant
  8703. Peak and instant envelope combined together.
  8704. @end table
  8705. @end table
  8706. @anchor{vidstabdetect}
  8707. @section vidstabdetect
  8708. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  8709. @ref{vidstabtransform} for pass 2.
  8710. This filter generates a file with relative translation and rotation
  8711. transform information about subsequent frames, which is then used by
  8712. the @ref{vidstabtransform} filter.
  8713. To enable compilation of this filter you need to configure FFmpeg with
  8714. @code{--enable-libvidstab}.
  8715. This filter accepts the following options:
  8716. @table @option
  8717. @item result
  8718. Set the path to the file used to write the transforms information.
  8719. Default value is @file{transforms.trf}.
  8720. @item shakiness
  8721. Set how shaky the video is and how quick the camera is. It accepts an
  8722. integer in the range 1-10, a value of 1 means little shakiness, a
  8723. value of 10 means strong shakiness. Default value is 5.
  8724. @item accuracy
  8725. Set the accuracy of the detection process. It must be a value in the
  8726. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  8727. accuracy. Default value is 15.
  8728. @item stepsize
  8729. Set stepsize of the search process. The region around minimum is
  8730. scanned with 1 pixel resolution. Default value is 6.
  8731. @item mincontrast
  8732. Set minimum contrast. Below this value a local measurement field is
  8733. discarded. Must be a floating point value in the range 0-1. Default
  8734. value is 0.3.
  8735. @item tripod
  8736. Set reference frame number for tripod mode.
  8737. If enabled, the motion of the frames is compared to a reference frame
  8738. in the filtered stream, identified by the specified number. The idea
  8739. is to compensate all movements in a more-or-less static scene and keep
  8740. the camera view absolutely still.
  8741. If set to 0, it is disabled. The frames are counted starting from 1.
  8742. @item show
  8743. Show fields and transforms in the resulting frames. It accepts an
  8744. integer in the range 0-2. Default value is 0, which disables any
  8745. visualization.
  8746. @end table
  8747. @subsection Examples
  8748. @itemize
  8749. @item
  8750. Use default values:
  8751. @example
  8752. vidstabdetect
  8753. @end example
  8754. @item
  8755. Analyze strongly shaky movie and put the results in file
  8756. @file{mytransforms.trf}:
  8757. @example
  8758. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  8759. @end example
  8760. @item
  8761. Visualize the result of internal transformations in the resulting
  8762. video:
  8763. @example
  8764. vidstabdetect=show=1
  8765. @end example
  8766. @item
  8767. Analyze a video with medium shakiness using @command{ffmpeg}:
  8768. @example
  8769. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  8770. @end example
  8771. @end itemize
  8772. @anchor{vidstabtransform}
  8773. @section vidstabtransform
  8774. Video stabilization/deshaking: pass 2 of 2,
  8775. see @ref{vidstabdetect} for pass 1.
  8776. Read a file with transform information for each frame and
  8777. apply/compensate them. Together with the @ref{vidstabdetect}
  8778. filter this can be used to deshake videos. See also
  8779. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  8780. the @ref{unsharp} filter, see below.
  8781. To enable compilation of this filter you need to configure FFmpeg with
  8782. @code{--enable-libvidstab}.
  8783. @subsection Options
  8784. @table @option
  8785. @item input
  8786. Set path to the file used to read the transforms. Default value is
  8787. @file{transforms.trf}.
  8788. @item smoothing
  8789. Set the number of frames (value*2 + 1) used for lowpass filtering the
  8790. camera movements. Default value is 10.
  8791. For example a number of 10 means that 21 frames are used (10 in the
  8792. past and 10 in the future) to smoothen the motion in the video. A
  8793. larger value leads to a smoother video, but limits the acceleration of
  8794. the camera (pan/tilt movements). 0 is a special case where a static
  8795. camera is simulated.
  8796. @item optalgo
  8797. Set the camera path optimization algorithm.
  8798. Accepted values are:
  8799. @table @samp
  8800. @item gauss
  8801. gaussian kernel low-pass filter on camera motion (default)
  8802. @item avg
  8803. averaging on transformations
  8804. @end table
  8805. @item maxshift
  8806. Set maximal number of pixels to translate frames. Default value is -1,
  8807. meaning no limit.
  8808. @item maxangle
  8809. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  8810. value is -1, meaning no limit.
  8811. @item crop
  8812. Specify how to deal with borders that may be visible due to movement
  8813. compensation.
  8814. Available values are:
  8815. @table @samp
  8816. @item keep
  8817. keep image information from previous frame (default)
  8818. @item black
  8819. fill the border black
  8820. @end table
  8821. @item invert
  8822. Invert transforms if set to 1. Default value is 0.
  8823. @item relative
  8824. Consider transforms as relative to previous frame if set to 1,
  8825. absolute if set to 0. Default value is 0.
  8826. @item zoom
  8827. Set percentage to zoom. A positive value will result in a zoom-in
  8828. effect, a negative value in a zoom-out effect. Default value is 0 (no
  8829. zoom).
  8830. @item optzoom
  8831. Set optimal zooming to avoid borders.
  8832. Accepted values are:
  8833. @table @samp
  8834. @item 0
  8835. disabled
  8836. @item 1
  8837. optimal static zoom value is determined (only very strong movements
  8838. will lead to visible borders) (default)
  8839. @item 2
  8840. optimal adaptive zoom value is determined (no borders will be
  8841. visible), see @option{zoomspeed}
  8842. @end table
  8843. Note that the value given at zoom is added to the one calculated here.
  8844. @item zoomspeed
  8845. Set percent to zoom maximally each frame (enabled when
  8846. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  8847. 0.25.
  8848. @item interpol
  8849. Specify type of interpolation.
  8850. Available values are:
  8851. @table @samp
  8852. @item no
  8853. no interpolation
  8854. @item linear
  8855. linear only horizontal
  8856. @item bilinear
  8857. linear in both directions (default)
  8858. @item bicubic
  8859. cubic in both directions (slow)
  8860. @end table
  8861. @item tripod
  8862. Enable virtual tripod mode if set to 1, which is equivalent to
  8863. @code{relative=0:smoothing=0}. Default value is 0.
  8864. Use also @code{tripod} option of @ref{vidstabdetect}.
  8865. @item debug
  8866. Increase log verbosity if set to 1. Also the detected global motions
  8867. are written to the temporary file @file{global_motions.trf}. Default
  8868. value is 0.
  8869. @end table
  8870. @subsection Examples
  8871. @itemize
  8872. @item
  8873. Use @command{ffmpeg} for a typical stabilization with default values:
  8874. @example
  8875. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  8876. @end example
  8877. Note the use of the @ref{unsharp} filter which is always recommended.
  8878. @item
  8879. Zoom in a bit more and load transform data from a given file:
  8880. @example
  8881. vidstabtransform=zoom=5:input="mytransforms.trf"
  8882. @end example
  8883. @item
  8884. Smoothen the video even more:
  8885. @example
  8886. vidstabtransform=smoothing=30
  8887. @end example
  8888. @end itemize
  8889. @section vflip
  8890. Flip the input video vertically.
  8891. For example, to vertically flip a video with @command{ffmpeg}:
  8892. @example
  8893. ffmpeg -i in.avi -vf "vflip" out.avi
  8894. @end example
  8895. @anchor{vignette}
  8896. @section vignette
  8897. Make or reverse a natural vignetting effect.
  8898. The filter accepts the following options:
  8899. @table @option
  8900. @item angle, a
  8901. Set lens angle expression as a number of radians.
  8902. The value is clipped in the @code{[0,PI/2]} range.
  8903. Default value: @code{"PI/5"}
  8904. @item x0
  8905. @item y0
  8906. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  8907. by default.
  8908. @item mode
  8909. Set forward/backward mode.
  8910. Available modes are:
  8911. @table @samp
  8912. @item forward
  8913. The larger the distance from the central point, the darker the image becomes.
  8914. @item backward
  8915. The larger the distance from the central point, the brighter the image becomes.
  8916. This can be used to reverse a vignette effect, though there is no automatic
  8917. detection to extract the lens @option{angle} and other settings (yet). It can
  8918. also be used to create a burning effect.
  8919. @end table
  8920. Default value is @samp{forward}.
  8921. @item eval
  8922. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  8923. It accepts the following values:
  8924. @table @samp
  8925. @item init
  8926. Evaluate expressions only once during the filter initialization.
  8927. @item frame
  8928. Evaluate expressions for each incoming frame. This is way slower than the
  8929. @samp{init} mode since it requires all the scalers to be re-computed, but it
  8930. allows advanced dynamic expressions.
  8931. @end table
  8932. Default value is @samp{init}.
  8933. @item dither
  8934. Set dithering to reduce the circular banding effects. Default is @code{1}
  8935. (enabled).
  8936. @item aspect
  8937. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  8938. Setting this value to the SAR of the input will make a rectangular vignetting
  8939. following the dimensions of the video.
  8940. Default is @code{1/1}.
  8941. @end table
  8942. @subsection Expressions
  8943. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  8944. following parameters.
  8945. @table @option
  8946. @item w
  8947. @item h
  8948. input width and height
  8949. @item n
  8950. the number of input frame, starting from 0
  8951. @item pts
  8952. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  8953. @var{TB} units, NAN if undefined
  8954. @item r
  8955. frame rate of the input video, NAN if the input frame rate is unknown
  8956. @item t
  8957. the PTS (Presentation TimeStamp) of the filtered video frame,
  8958. expressed in seconds, NAN if undefined
  8959. @item tb
  8960. time base of the input video
  8961. @end table
  8962. @subsection Examples
  8963. @itemize
  8964. @item
  8965. Apply simple strong vignetting effect:
  8966. @example
  8967. vignette=PI/4
  8968. @end example
  8969. @item
  8970. Make a flickering vignetting:
  8971. @example
  8972. vignette='PI/4+random(1)*PI/50':eval=frame
  8973. @end example
  8974. @end itemize
  8975. @section vstack
  8976. Stack input videos vertically.
  8977. All streams must be of same pixel format and of same width.
  8978. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8979. to create same output.
  8980. The filter accept the following option:
  8981. @table @option
  8982. @item inputs
  8983. Set number of input streams. Default is 2.
  8984. @item shortest
  8985. If set to 1, force the output to terminate when the shortest input
  8986. terminates. Default value is 0.
  8987. @end table
  8988. @section w3fdif
  8989. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  8990. Deinterlacing Filter").
  8991. Based on the process described by Martin Weston for BBC R&D, and
  8992. implemented based on the de-interlace algorithm written by Jim
  8993. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  8994. uses filter coefficients calculated by BBC R&D.
  8995. There are two sets of filter coefficients, so called "simple":
  8996. and "complex". Which set of filter coefficients is used can
  8997. be set by passing an optional parameter:
  8998. @table @option
  8999. @item filter
  9000. Set the interlacing filter coefficients. Accepts one of the following values:
  9001. @table @samp
  9002. @item simple
  9003. Simple filter coefficient set.
  9004. @item complex
  9005. More-complex filter coefficient set.
  9006. @end table
  9007. Default value is @samp{complex}.
  9008. @item deint
  9009. Specify which frames to deinterlace. Accept one of the following values:
  9010. @table @samp
  9011. @item all
  9012. Deinterlace all frames,
  9013. @item interlaced
  9014. Only deinterlace frames marked as interlaced.
  9015. @end table
  9016. Default value is @samp{all}.
  9017. @end table
  9018. @section waveform
  9019. Video waveform monitor.
  9020. The waveform monitor plots color component intensity. By default luminance
  9021. only. Each column of the waveform corresponds to a column of pixels in the
  9022. source video.
  9023. It accepts the following options:
  9024. @table @option
  9025. @item mode, m
  9026. Can be either @code{row}, or @code{column}. Default is @code{column}.
  9027. In row mode, the graph on the left side represents color component value 0 and
  9028. the right side represents value = 255. In column mode, the top side represents
  9029. color component value = 0 and bottom side represents value = 255.
  9030. @item intensity, i
  9031. Set intensity. Smaller values are useful to find out how many values of the same
  9032. luminance are distributed across input rows/columns.
  9033. Default value is @code{0.04}. Allowed range is [0, 1].
  9034. @item mirror, r
  9035. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  9036. In mirrored mode, higher values will be represented on the left
  9037. side for @code{row} mode and at the top for @code{column} mode. Default is
  9038. @code{1} (mirrored).
  9039. @item display, d
  9040. Set display mode.
  9041. It accepts the following values:
  9042. @table @samp
  9043. @item overlay
  9044. Presents information identical to that in the @code{parade}, except
  9045. that the graphs representing color components are superimposed directly
  9046. over one another.
  9047. This display mode makes it easier to spot relative differences or similarities
  9048. in overlapping areas of the color components that are supposed to be identical,
  9049. such as neutral whites, grays, or blacks.
  9050. @item parade
  9051. Display separate graph for the color components side by side in
  9052. @code{row} mode or one below the other in @code{column} mode.
  9053. Using this display mode makes it easy to spot color casts in the highlights
  9054. and shadows of an image, by comparing the contours of the top and the bottom
  9055. graphs of each waveform. Since whites, grays, and blacks are characterized
  9056. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  9057. should display three waveforms of roughly equal width/height. If not, the
  9058. correction is easy to perform by making level adjustments the three waveforms.
  9059. @end table
  9060. Default is @code{parade}.
  9061. @item components, c
  9062. Set which color components to display. Default is 1, which means only luminance
  9063. or red color component if input is in RGB colorspace. If is set for example to
  9064. 7 it will display all 3 (if) available color components.
  9065. @item envelope, e
  9066. @table @samp
  9067. @item none
  9068. No envelope, this is default.
  9069. @item instant
  9070. Instant envelope, minimum and maximum values presented in graph will be easily
  9071. visible even with small @code{step} value.
  9072. @item peak
  9073. Hold minimum and maximum values presented in graph across time. This way you
  9074. can still spot out of range values without constantly looking at waveforms.
  9075. @item peak+instant
  9076. Peak and instant envelope combined together.
  9077. @end table
  9078. @item filter, f
  9079. @table @samp
  9080. @item lowpass
  9081. No filtering, this is default.
  9082. @item flat
  9083. Luma and chroma combined together.
  9084. @item aflat
  9085. Similar as above, but shows difference between blue and red chroma.
  9086. @item chroma
  9087. Displays only chroma.
  9088. @item achroma
  9089. Similar as above, but shows difference between blue and red chroma.
  9090. @item color
  9091. Displays actual color value on waveform.
  9092. @end table
  9093. @end table
  9094. @section xbr
  9095. Apply the xBR high-quality magnification filter which is designed for pixel
  9096. art. It follows a set of edge-detection rules, see
  9097. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  9098. It accepts the following option:
  9099. @table @option
  9100. @item n
  9101. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  9102. @code{3xBR} and @code{4} for @code{4xBR}.
  9103. Default is @code{3}.
  9104. @end table
  9105. @anchor{yadif}
  9106. @section yadif
  9107. Deinterlace the input video ("yadif" means "yet another deinterlacing
  9108. filter").
  9109. It accepts the following parameters:
  9110. @table @option
  9111. @item mode
  9112. The interlacing mode to adopt. It accepts one of the following values:
  9113. @table @option
  9114. @item 0, send_frame
  9115. Output one frame for each frame.
  9116. @item 1, send_field
  9117. Output one frame for each field.
  9118. @item 2, send_frame_nospatial
  9119. Like @code{send_frame}, but it skips the spatial interlacing check.
  9120. @item 3, send_field_nospatial
  9121. Like @code{send_field}, but it skips the spatial interlacing check.
  9122. @end table
  9123. The default value is @code{send_frame}.
  9124. @item parity
  9125. The picture field parity assumed for the input interlaced video. It accepts one
  9126. of the following values:
  9127. @table @option
  9128. @item 0, tff
  9129. Assume the top field is first.
  9130. @item 1, bff
  9131. Assume the bottom field is first.
  9132. @item -1, auto
  9133. Enable automatic detection of field parity.
  9134. @end table
  9135. The default value is @code{auto}.
  9136. If the interlacing is unknown or the decoder does not export this information,
  9137. top field first will be assumed.
  9138. @item deint
  9139. Specify which frames to deinterlace. Accept one of the following
  9140. values:
  9141. @table @option
  9142. @item 0, all
  9143. Deinterlace all frames.
  9144. @item 1, interlaced
  9145. Only deinterlace frames marked as interlaced.
  9146. @end table
  9147. The default value is @code{all}.
  9148. @end table
  9149. @section zoompan
  9150. Apply Zoom & Pan effect.
  9151. This filter accepts the following options:
  9152. @table @option
  9153. @item zoom, z
  9154. Set the zoom expression. Default is 1.
  9155. @item x
  9156. @item y
  9157. Set the x and y expression. Default is 0.
  9158. @item d
  9159. Set the duration expression in number of frames.
  9160. This sets for how many number of frames effect will last for
  9161. single input image.
  9162. @item s
  9163. Set the output image size, default is 'hd720'.
  9164. @end table
  9165. Each expression can contain the following constants:
  9166. @table @option
  9167. @item in_w, iw
  9168. Input width.
  9169. @item in_h, ih
  9170. Input height.
  9171. @item out_w, ow
  9172. Output width.
  9173. @item out_h, oh
  9174. Output height.
  9175. @item in
  9176. Input frame count.
  9177. @item on
  9178. Output frame count.
  9179. @item x
  9180. @item y
  9181. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9182. for current input frame.
  9183. @item px
  9184. @item py
  9185. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9186. not yet such frame (first input frame).
  9187. @item zoom
  9188. Last calculated zoom from 'z' expression for current input frame.
  9189. @item pzoom
  9190. Last calculated zoom of last output frame of previous input frame.
  9191. @item duration
  9192. Number of output frames for current input frame. Calculated from 'd' expression
  9193. for each input frame.
  9194. @item pduration
  9195. number of output frames created for previous input frame
  9196. @item a
  9197. Rational number: input width / input height
  9198. @item sar
  9199. sample aspect ratio
  9200. @item dar
  9201. display aspect ratio
  9202. @end table
  9203. @subsection Examples
  9204. @itemize
  9205. @item
  9206. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9207. @example
  9208. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360
  9209. @end example
  9210. @item
  9211. Zoom-in up to 1.5 and pan always at center of picture:
  9212. @example
  9213. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9214. @end example
  9215. @end itemize
  9216. @section zscale
  9217. Scale (resize) the input video, using the z.lib library:
  9218. https://github.com/sekrit-twc/zimg.
  9219. The zscale filter forces the output display aspect ratio to be the same
  9220. as the input, by changing the output sample aspect ratio.
  9221. If the input image format is different from the format requested by
  9222. the next filter, the zscale filter will convert the input to the
  9223. requested format.
  9224. @subsection Options
  9225. The filter accepts the following options.
  9226. @table @option
  9227. @item width, w
  9228. @item height, h
  9229. Set the output video dimension expression. Default value is the input
  9230. dimension.
  9231. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9232. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9233. If one of the values is -1, the zscale filter will use a value that
  9234. maintains the aspect ratio of the input image, calculated from the
  9235. other specified dimension. If both of them are -1, the input size is
  9236. used
  9237. If one of the values is -n with n > 1, the zscale filter will also use a value
  9238. that maintains the aspect ratio of the input image, calculated from the other
  9239. specified dimension. After that it will, however, make sure that the calculated
  9240. dimension is divisible by n and adjust the value if necessary.
  9241. See below for the list of accepted constants for use in the dimension
  9242. expression.
  9243. @item size, s
  9244. Set the video size. For the syntax of this option, check the
  9245. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9246. @item dither, d
  9247. Set the dither type.
  9248. Possible values are:
  9249. @table @var
  9250. @item none
  9251. @item ordered
  9252. @item random
  9253. @item error_diffusion
  9254. @end table
  9255. Default is none.
  9256. @item filter, f
  9257. Set the resize filter type.
  9258. Possible values are:
  9259. @table @var
  9260. @item point
  9261. @item bilinear
  9262. @item bicubic
  9263. @item spline16
  9264. @item spline36
  9265. @item lanczos
  9266. @end table
  9267. Default is bilinear.
  9268. @item range, r
  9269. Set the color range.
  9270. Possible values are:
  9271. @table @var
  9272. @item input
  9273. @item limited
  9274. @item full
  9275. @end table
  9276. Default is same as input.
  9277. @item primaries, p
  9278. Set the color primaries.
  9279. Possible values are:
  9280. @table @var
  9281. @item input
  9282. @item 709
  9283. @item unspecified
  9284. @item 170m
  9285. @item 240m
  9286. @item 2020
  9287. @end table
  9288. Default is same as input.
  9289. @item transfer, t
  9290. Set the transfer characteristics.
  9291. Possible values are:
  9292. @table @var
  9293. @item input
  9294. @item 709
  9295. @item unspecified
  9296. @item 601
  9297. @item linear
  9298. @item 2020_10
  9299. @item 2020_12
  9300. @end table
  9301. Default is same as input.
  9302. @item matrix, m
  9303. Set the colorspace matrix.
  9304. Possible value are:
  9305. @table @var
  9306. @item input
  9307. @item 709
  9308. @item unspecified
  9309. @item 470bg
  9310. @item 170m
  9311. @item 2020_ncl
  9312. @item 2020_cl
  9313. @end table
  9314. Default is same as input.
  9315. @end table
  9316. The values of the @option{w} and @option{h} options are expressions
  9317. containing the following constants:
  9318. @table @var
  9319. @item in_w
  9320. @item in_h
  9321. The input width and height
  9322. @item iw
  9323. @item ih
  9324. These are the same as @var{in_w} and @var{in_h}.
  9325. @item out_w
  9326. @item out_h
  9327. The output (scaled) width and height
  9328. @item ow
  9329. @item oh
  9330. These are the same as @var{out_w} and @var{out_h}
  9331. @item a
  9332. The same as @var{iw} / @var{ih}
  9333. @item sar
  9334. input sample aspect ratio
  9335. @item dar
  9336. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9337. @item hsub
  9338. @item vsub
  9339. horizontal and vertical input chroma subsample values. For example for the
  9340. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9341. @item ohsub
  9342. @item ovsub
  9343. horizontal and vertical output chroma subsample values. For example for the
  9344. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9345. @end table
  9346. @table @option
  9347. @end table
  9348. @c man end VIDEO FILTERS
  9349. @chapter Video Sources
  9350. @c man begin VIDEO SOURCES
  9351. Below is a description of the currently available video sources.
  9352. @section buffer
  9353. Buffer video frames, and make them available to the filter chain.
  9354. This source is mainly intended for a programmatic use, in particular
  9355. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9356. It accepts the following parameters:
  9357. @table @option
  9358. @item video_size
  9359. Specify the size (width and height) of the buffered video frames. For the
  9360. syntax of this option, check the
  9361. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9362. @item width
  9363. The input video width.
  9364. @item height
  9365. The input video height.
  9366. @item pix_fmt
  9367. A string representing the pixel format of the buffered video frames.
  9368. It may be a number corresponding to a pixel format, or a pixel format
  9369. name.
  9370. @item time_base
  9371. Specify the timebase assumed by the timestamps of the buffered frames.
  9372. @item frame_rate
  9373. Specify the frame rate expected for the video stream.
  9374. @item pixel_aspect, sar
  9375. The sample (pixel) aspect ratio of the input video.
  9376. @item sws_param
  9377. Specify the optional parameters to be used for the scale filter which
  9378. is automatically inserted when an input change is detected in the
  9379. input size or format.
  9380. @end table
  9381. For example:
  9382. @example
  9383. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9384. @end example
  9385. will instruct the source to accept video frames with size 320x240 and
  9386. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9387. square pixels (1:1 sample aspect ratio).
  9388. Since the pixel format with name "yuv410p" corresponds to the number 6
  9389. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9390. this example corresponds to:
  9391. @example
  9392. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9393. @end example
  9394. Alternatively, the options can be specified as a flat string, but this
  9395. syntax is deprecated:
  9396. @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}]
  9397. @section cellauto
  9398. Create a pattern generated by an elementary cellular automaton.
  9399. The initial state of the cellular automaton can be defined through the
  9400. @option{filename}, and @option{pattern} options. If such options are
  9401. not specified an initial state is created randomly.
  9402. At each new frame a new row in the video is filled with the result of
  9403. the cellular automaton next generation. The behavior when the whole
  9404. frame is filled is defined by the @option{scroll} option.
  9405. This source accepts the following options:
  9406. @table @option
  9407. @item filename, f
  9408. Read the initial cellular automaton state, i.e. the starting row, from
  9409. the specified file.
  9410. In the file, each non-whitespace character is considered an alive
  9411. cell, a newline will terminate the row, and further characters in the
  9412. file will be ignored.
  9413. @item pattern, p
  9414. Read the initial cellular automaton state, i.e. the starting row, from
  9415. the specified string.
  9416. Each non-whitespace character in the string is considered an alive
  9417. cell, a newline will terminate the row, and further characters in the
  9418. string will be ignored.
  9419. @item rate, r
  9420. Set the video rate, that is the number of frames generated per second.
  9421. Default is 25.
  9422. @item random_fill_ratio, ratio
  9423. Set the random fill ratio for the initial cellular automaton row. It
  9424. is a floating point number value ranging from 0 to 1, defaults to
  9425. 1/PHI.
  9426. This option is ignored when a file or a pattern is specified.
  9427. @item random_seed, seed
  9428. Set the seed for filling randomly the initial row, must be an integer
  9429. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9430. set to -1, the filter will try to use a good random seed on a best
  9431. effort basis.
  9432. @item rule
  9433. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9434. Default value is 110.
  9435. @item size, s
  9436. Set the size of the output video. For the syntax of this option, check the
  9437. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9438. If @option{filename} or @option{pattern} is specified, the size is set
  9439. by default to the width of the specified initial state row, and the
  9440. height is set to @var{width} * PHI.
  9441. If @option{size} is set, it must contain the width of the specified
  9442. pattern string, and the specified pattern will be centered in the
  9443. larger row.
  9444. If a filename or a pattern string is not specified, the size value
  9445. defaults to "320x518" (used for a randomly generated initial state).
  9446. @item scroll
  9447. If set to 1, scroll the output upward when all the rows in the output
  9448. have been already filled. If set to 0, the new generated row will be
  9449. written over the top row just after the bottom row is filled.
  9450. Defaults to 1.
  9451. @item start_full, full
  9452. If set to 1, completely fill the output with generated rows before
  9453. outputting the first frame.
  9454. This is the default behavior, for disabling set the value to 0.
  9455. @item stitch
  9456. If set to 1, stitch the left and right row edges together.
  9457. This is the default behavior, for disabling set the value to 0.
  9458. @end table
  9459. @subsection Examples
  9460. @itemize
  9461. @item
  9462. Read the initial state from @file{pattern}, and specify an output of
  9463. size 200x400.
  9464. @example
  9465. cellauto=f=pattern:s=200x400
  9466. @end example
  9467. @item
  9468. Generate a random initial row with a width of 200 cells, with a fill
  9469. ratio of 2/3:
  9470. @example
  9471. cellauto=ratio=2/3:s=200x200
  9472. @end example
  9473. @item
  9474. Create a pattern generated by rule 18 starting by a single alive cell
  9475. centered on an initial row with width 100:
  9476. @example
  9477. cellauto=p=@@:s=100x400:full=0:rule=18
  9478. @end example
  9479. @item
  9480. Specify a more elaborated initial pattern:
  9481. @example
  9482. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9483. @end example
  9484. @end itemize
  9485. @section mandelbrot
  9486. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9487. point specified with @var{start_x} and @var{start_y}.
  9488. This source accepts the following options:
  9489. @table @option
  9490. @item end_pts
  9491. Set the terminal pts value. Default value is 400.
  9492. @item end_scale
  9493. Set the terminal scale value.
  9494. Must be a floating point value. Default value is 0.3.
  9495. @item inner
  9496. Set the inner coloring mode, that is the algorithm used to draw the
  9497. Mandelbrot fractal internal region.
  9498. It shall assume one of the following values:
  9499. @table @option
  9500. @item black
  9501. Set black mode.
  9502. @item convergence
  9503. Show time until convergence.
  9504. @item mincol
  9505. Set color based on point closest to the origin of the iterations.
  9506. @item period
  9507. Set period mode.
  9508. @end table
  9509. Default value is @var{mincol}.
  9510. @item bailout
  9511. Set the bailout value. Default value is 10.0.
  9512. @item maxiter
  9513. Set the maximum of iterations performed by the rendering
  9514. algorithm. Default value is 7189.
  9515. @item outer
  9516. Set outer coloring mode.
  9517. It shall assume one of following values:
  9518. @table @option
  9519. @item iteration_count
  9520. Set iteration cound mode.
  9521. @item normalized_iteration_count
  9522. set normalized iteration count mode.
  9523. @end table
  9524. Default value is @var{normalized_iteration_count}.
  9525. @item rate, r
  9526. Set frame rate, expressed as number of frames per second. Default
  9527. value is "25".
  9528. @item size, s
  9529. Set frame size. For the syntax of this option, check the "Video
  9530. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9531. @item start_scale
  9532. Set the initial scale value. Default value is 3.0.
  9533. @item start_x
  9534. Set the initial x position. Must be a floating point value between
  9535. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9536. @item start_y
  9537. Set the initial y position. Must be a floating point value between
  9538. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9539. @end table
  9540. @section mptestsrc
  9541. Generate various test patterns, as generated by the MPlayer test filter.
  9542. The size of the generated video is fixed, and is 256x256.
  9543. This source is useful in particular for testing encoding features.
  9544. This source accepts the following options:
  9545. @table @option
  9546. @item rate, r
  9547. Specify the frame rate of the sourced video, as the number of frames
  9548. generated per second. It has to be a string in the format
  9549. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9550. number or a valid video frame rate abbreviation. The default value is
  9551. "25".
  9552. @item duration, d
  9553. Set the duration of the sourced video. See
  9554. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9555. for the accepted syntax.
  9556. If not specified, or the expressed duration is negative, the video is
  9557. supposed to be generated forever.
  9558. @item test, t
  9559. Set the number or the name of the test to perform. Supported tests are:
  9560. @table @option
  9561. @item dc_luma
  9562. @item dc_chroma
  9563. @item freq_luma
  9564. @item freq_chroma
  9565. @item amp_luma
  9566. @item amp_chroma
  9567. @item cbp
  9568. @item mv
  9569. @item ring1
  9570. @item ring2
  9571. @item all
  9572. @end table
  9573. Default value is "all", which will cycle through the list of all tests.
  9574. @end table
  9575. Some examples:
  9576. @example
  9577. mptestsrc=t=dc_luma
  9578. @end example
  9579. will generate a "dc_luma" test pattern.
  9580. @section frei0r_src
  9581. Provide a frei0r source.
  9582. To enable compilation of this filter you need to install the frei0r
  9583. header and configure FFmpeg with @code{--enable-frei0r}.
  9584. This source accepts the following parameters:
  9585. @table @option
  9586. @item size
  9587. The size of the video to generate. For the syntax of this option, check the
  9588. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9589. @item framerate
  9590. The framerate of the generated video. It may be a string of the form
  9591. @var{num}/@var{den} or a frame rate abbreviation.
  9592. @item filter_name
  9593. The name to the frei0r source to load. For more information regarding frei0r and
  9594. how to set the parameters, read the @ref{frei0r} section in the video filters
  9595. documentation.
  9596. @item filter_params
  9597. A '|'-separated list of parameters to pass to the frei0r source.
  9598. @end table
  9599. For example, to generate a frei0r partik0l source with size 200x200
  9600. and frame rate 10 which is overlaid on the overlay filter main input:
  9601. @example
  9602. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9603. @end example
  9604. @section life
  9605. Generate a life pattern.
  9606. This source is based on a generalization of John Conway's life game.
  9607. The sourced input represents a life grid, each pixel represents a cell
  9608. which can be in one of two possible states, alive or dead. Every cell
  9609. interacts with its eight neighbours, which are the cells that are
  9610. horizontally, vertically, or diagonally adjacent.
  9611. At each interaction the grid evolves according to the adopted rule,
  9612. which specifies the number of neighbor alive cells which will make a
  9613. cell stay alive or born. The @option{rule} option allows one to specify
  9614. the rule to adopt.
  9615. This source accepts the following options:
  9616. @table @option
  9617. @item filename, f
  9618. Set the file from which to read the initial grid state. In the file,
  9619. each non-whitespace character is considered an alive cell, and newline
  9620. is used to delimit the end of each row.
  9621. If this option is not specified, the initial grid is generated
  9622. randomly.
  9623. @item rate, r
  9624. Set the video rate, that is the number of frames generated per second.
  9625. Default is 25.
  9626. @item random_fill_ratio, ratio
  9627. Set the random fill ratio for the initial random grid. It is a
  9628. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9629. It is ignored when a file is specified.
  9630. @item random_seed, seed
  9631. Set the seed for filling the initial random grid, must be an integer
  9632. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9633. set to -1, the filter will try to use a good random seed on a best
  9634. effort basis.
  9635. @item rule
  9636. Set the life rule.
  9637. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  9638. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  9639. @var{NS} specifies the number of alive neighbor cells which make a
  9640. live cell stay alive, and @var{NB} the number of alive neighbor cells
  9641. which make a dead cell to become alive (i.e. to "born").
  9642. "s" and "b" can be used in place of "S" and "B", respectively.
  9643. Alternatively a rule can be specified by an 18-bits integer. The 9
  9644. high order bits are used to encode the next cell state if it is alive
  9645. for each number of neighbor alive cells, the low order bits specify
  9646. the rule for "borning" new cells. Higher order bits encode for an
  9647. higher number of neighbor cells.
  9648. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  9649. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  9650. Default value is "S23/B3", which is the original Conway's game of life
  9651. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  9652. cells, and will born a new cell if there are three alive cells around
  9653. a dead cell.
  9654. @item size, s
  9655. Set the size of the output video. For the syntax of this option, check the
  9656. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9657. If @option{filename} is specified, the size is set by default to the
  9658. same size of the input file. If @option{size} is set, it must contain
  9659. the size specified in the input file, and the initial grid defined in
  9660. that file is centered in the larger resulting area.
  9661. If a filename is not specified, the size value defaults to "320x240"
  9662. (used for a randomly generated initial grid).
  9663. @item stitch
  9664. If set to 1, stitch the left and right grid edges together, and the
  9665. top and bottom edges also. Defaults to 1.
  9666. @item mold
  9667. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  9668. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  9669. value from 0 to 255.
  9670. @item life_color
  9671. Set the color of living (or new born) cells.
  9672. @item death_color
  9673. Set the color of dead cells. If @option{mold} is set, this is the first color
  9674. used to represent a dead cell.
  9675. @item mold_color
  9676. Set mold color, for definitely dead and moldy cells.
  9677. For the syntax of these 3 color options, check the "Color" section in the
  9678. ffmpeg-utils manual.
  9679. @end table
  9680. @subsection Examples
  9681. @itemize
  9682. @item
  9683. Read a grid from @file{pattern}, and center it on a grid of size
  9684. 300x300 pixels:
  9685. @example
  9686. life=f=pattern:s=300x300
  9687. @end example
  9688. @item
  9689. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  9690. @example
  9691. life=ratio=2/3:s=200x200
  9692. @end example
  9693. @item
  9694. Specify a custom rule for evolving a randomly generated grid:
  9695. @example
  9696. life=rule=S14/B34
  9697. @end example
  9698. @item
  9699. Full example with slow death effect (mold) using @command{ffplay}:
  9700. @example
  9701. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  9702. @end example
  9703. @end itemize
  9704. @anchor{allrgb}
  9705. @anchor{allyuv}
  9706. @anchor{color}
  9707. @anchor{haldclutsrc}
  9708. @anchor{nullsrc}
  9709. @anchor{rgbtestsrc}
  9710. @anchor{smptebars}
  9711. @anchor{smptehdbars}
  9712. @anchor{testsrc}
  9713. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  9714. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  9715. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  9716. The @code{color} source provides an uniformly colored input.
  9717. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  9718. @ref{haldclut} filter.
  9719. The @code{nullsrc} source returns unprocessed video frames. It is
  9720. mainly useful to be employed in analysis / debugging tools, or as the
  9721. source for filters which ignore the input data.
  9722. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  9723. detecting RGB vs BGR issues. You should see a red, green and blue
  9724. stripe from top to bottom.
  9725. The @code{smptebars} source generates a color bars pattern, based on
  9726. the SMPTE Engineering Guideline EG 1-1990.
  9727. The @code{smptehdbars} source generates a color bars pattern, based on
  9728. the SMPTE RP 219-2002.
  9729. The @code{testsrc} source generates a test video pattern, showing a
  9730. color pattern, a scrolling gradient and a timestamp. This is mainly
  9731. intended for testing purposes.
  9732. The sources accept the following parameters:
  9733. @table @option
  9734. @item color, c
  9735. Specify the color of the source, only available in the @code{color}
  9736. source. For the syntax of this option, check the "Color" section in the
  9737. ffmpeg-utils manual.
  9738. @item level
  9739. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  9740. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  9741. pixels to be used as identity matrix for 3D lookup tables. Each component is
  9742. coded on a @code{1/(N*N)} scale.
  9743. @item size, s
  9744. Specify the size of the sourced video. For the syntax of this option, check the
  9745. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9746. The default value is @code{320x240}.
  9747. This option is not available with the @code{haldclutsrc} filter.
  9748. @item rate, r
  9749. Specify the frame rate of the sourced video, as the number of frames
  9750. generated per second. It has to be a string in the format
  9751. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9752. number or a valid video frame rate abbreviation. The default value is
  9753. "25".
  9754. @item sar
  9755. Set the sample aspect ratio of the sourced video.
  9756. @item duration, d
  9757. Set the duration of the sourced video. See
  9758. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9759. for the accepted syntax.
  9760. If not specified, or the expressed duration is negative, the video is
  9761. supposed to be generated forever.
  9762. @item decimals, n
  9763. Set the number of decimals to show in the timestamp, only available in the
  9764. @code{testsrc} source.
  9765. The displayed timestamp value will correspond to the original
  9766. timestamp value multiplied by the power of 10 of the specified
  9767. value. Default value is 0.
  9768. @end table
  9769. For example the following:
  9770. @example
  9771. testsrc=duration=5.3:size=qcif:rate=10
  9772. @end example
  9773. will generate a video with a duration of 5.3 seconds, with size
  9774. 176x144 and a frame rate of 10 frames per second.
  9775. The following graph description will generate a red source
  9776. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  9777. frames per second.
  9778. @example
  9779. color=c=red@@0.2:s=qcif:r=10
  9780. @end example
  9781. If the input content is to be ignored, @code{nullsrc} can be used. The
  9782. following command generates noise in the luminance plane by employing
  9783. the @code{geq} filter:
  9784. @example
  9785. nullsrc=s=256x256, geq=random(1)*255:128:128
  9786. @end example
  9787. @subsection Commands
  9788. The @code{color} source supports the following commands:
  9789. @table @option
  9790. @item c, color
  9791. Set the color of the created image. Accepts the same syntax of the
  9792. corresponding @option{color} option.
  9793. @end table
  9794. @c man end VIDEO SOURCES
  9795. @chapter Video Sinks
  9796. @c man begin VIDEO SINKS
  9797. Below is a description of the currently available video sinks.
  9798. @section buffersink
  9799. Buffer video frames, and make them available to the end of the filter
  9800. graph.
  9801. This sink is mainly intended for programmatic use, in particular
  9802. through the interface defined in @file{libavfilter/buffersink.h}
  9803. or the options system.
  9804. It accepts a pointer to an AVBufferSinkContext structure, which
  9805. defines the incoming buffers' formats, to be passed as the opaque
  9806. parameter to @code{avfilter_init_filter} for initialization.
  9807. @section nullsink
  9808. Null video sink: do absolutely nothing with the input video. It is
  9809. mainly useful as a template and for use in analysis / debugging
  9810. tools.
  9811. @c man end VIDEO SINKS
  9812. @chapter Multimedia Filters
  9813. @c man begin MULTIMEDIA FILTERS
  9814. Below is a description of the currently available multimedia filters.
  9815. @section aphasemeter
  9816. Convert input audio to a video output, displaying the audio phase.
  9817. The filter accepts the following options:
  9818. @table @option
  9819. @item rate, r
  9820. Set the output frame rate. Default value is @code{25}.
  9821. @item size, s
  9822. Set the video size for the output. For the syntax of this option, check the
  9823. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9824. Default value is @code{800x400}.
  9825. @item rc
  9826. @item gc
  9827. @item bc
  9828. Specify the red, green, blue contrast. Default values are @code{2},
  9829. @code{7} and @code{1}.
  9830. Allowed range is @code{[0, 255]}.
  9831. @item mpc
  9832. Set color which will be used for drawing median phase. If color is
  9833. @code{none} which is default, no median phase value will be drawn.
  9834. @end table
  9835. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  9836. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  9837. The @code{-1} means left and right channels are completely out of phase and
  9838. @code{1} means channels are in phase.
  9839. @section avectorscope
  9840. Convert input audio to a video output, representing the audio vector
  9841. scope.
  9842. The filter is used to measure the difference between channels of stereo
  9843. audio stream. A monoaural signal, consisting of identical left and right
  9844. signal, results in straight vertical line. Any stereo separation is visible
  9845. as a deviation from this line, creating a Lissajous figure.
  9846. If the straight (or deviation from it) but horizontal line appears this
  9847. indicates that the left and right channels are out of phase.
  9848. The filter accepts the following options:
  9849. @table @option
  9850. @item mode, m
  9851. Set the vectorscope mode.
  9852. Available values are:
  9853. @table @samp
  9854. @item lissajous
  9855. Lissajous rotated by 45 degrees.
  9856. @item lissajous_xy
  9857. Same as above but not rotated.
  9858. @item polar
  9859. Shape resembling half of circle.
  9860. @end table
  9861. Default value is @samp{lissajous}.
  9862. @item size, s
  9863. Set the video size for the output. For the syntax of this option, check the
  9864. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9865. Default value is @code{400x400}.
  9866. @item rate, r
  9867. Set the output frame rate. Default value is @code{25}.
  9868. @item rc
  9869. @item gc
  9870. @item bc
  9871. @item ac
  9872. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  9873. @code{160}, @code{80} and @code{255}.
  9874. Allowed range is @code{[0, 255]}.
  9875. @item rf
  9876. @item gf
  9877. @item bf
  9878. @item af
  9879. Specify the red, green, blue and alpha fade. Default values are @code{15},
  9880. @code{10}, @code{5} and @code{5}.
  9881. Allowed range is @code{[0, 255]}.
  9882. @item zoom
  9883. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  9884. @end table
  9885. @subsection Examples
  9886. @itemize
  9887. @item
  9888. Complete example using @command{ffplay}:
  9889. @example
  9890. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  9891. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  9892. @end example
  9893. @end itemize
  9894. @section concat
  9895. Concatenate audio and video streams, joining them together one after the
  9896. other.
  9897. The filter works on segments of synchronized video and audio streams. All
  9898. segments must have the same number of streams of each type, and that will
  9899. also be the number of streams at output.
  9900. The filter accepts the following options:
  9901. @table @option
  9902. @item n
  9903. Set the number of segments. Default is 2.
  9904. @item v
  9905. Set the number of output video streams, that is also the number of video
  9906. streams in each segment. Default is 1.
  9907. @item a
  9908. Set the number of output audio streams, that is also the number of audio
  9909. streams in each segment. Default is 0.
  9910. @item unsafe
  9911. Activate unsafe mode: do not fail if segments have a different format.
  9912. @end table
  9913. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  9914. @var{a} audio outputs.
  9915. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  9916. segment, in the same order as the outputs, then the inputs for the second
  9917. segment, etc.
  9918. Related streams do not always have exactly the same duration, for various
  9919. reasons including codec frame size or sloppy authoring. For that reason,
  9920. related synchronized streams (e.g. a video and its audio track) should be
  9921. concatenated at once. The concat filter will use the duration of the longest
  9922. stream in each segment (except the last one), and if necessary pad shorter
  9923. audio streams with silence.
  9924. For this filter to work correctly, all segments must start at timestamp 0.
  9925. All corresponding streams must have the same parameters in all segments; the
  9926. filtering system will automatically select a common pixel format for video
  9927. streams, and a common sample format, sample rate and channel layout for
  9928. audio streams, but other settings, such as resolution, must be converted
  9929. explicitly by the user.
  9930. Different frame rates are acceptable but will result in variable frame rate
  9931. at output; be sure to configure the output file to handle it.
  9932. @subsection Examples
  9933. @itemize
  9934. @item
  9935. Concatenate an opening, an episode and an ending, all in bilingual version
  9936. (video in stream 0, audio in streams 1 and 2):
  9937. @example
  9938. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  9939. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  9940. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  9941. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  9942. @end example
  9943. @item
  9944. Concatenate two parts, handling audio and video separately, using the
  9945. (a)movie sources, and adjusting the resolution:
  9946. @example
  9947. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  9948. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  9949. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  9950. @end example
  9951. Note that a desync will happen at the stitch if the audio and video streams
  9952. do not have exactly the same duration in the first file.
  9953. @end itemize
  9954. @anchor{ebur128}
  9955. @section ebur128
  9956. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  9957. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  9958. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  9959. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  9960. The filter also has a video output (see the @var{video} option) with a real
  9961. time graph to observe the loudness evolution. The graphic contains the logged
  9962. message mentioned above, so it is not printed anymore when this option is set,
  9963. unless the verbose logging is set. The main graphing area contains the
  9964. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  9965. the momentary loudness (400 milliseconds).
  9966. More information about the Loudness Recommendation EBU R128 on
  9967. @url{http://tech.ebu.ch/loudness}.
  9968. The filter accepts the following options:
  9969. @table @option
  9970. @item video
  9971. Activate the video output. The audio stream is passed unchanged whether this
  9972. option is set or no. The video stream will be the first output stream if
  9973. activated. Default is @code{0}.
  9974. @item size
  9975. Set the video size. This option is for video only. For the syntax of this
  9976. option, check the
  9977. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9978. Default and minimum resolution is @code{640x480}.
  9979. @item meter
  9980. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  9981. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  9982. other integer value between this range is allowed.
  9983. @item metadata
  9984. Set metadata injection. If set to @code{1}, the audio input will be segmented
  9985. into 100ms output frames, each of them containing various loudness information
  9986. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  9987. Default is @code{0}.
  9988. @item framelog
  9989. Force the frame logging level.
  9990. Available values are:
  9991. @table @samp
  9992. @item info
  9993. information logging level
  9994. @item verbose
  9995. verbose logging level
  9996. @end table
  9997. By default, the logging level is set to @var{info}. If the @option{video} or
  9998. the @option{metadata} options are set, it switches to @var{verbose}.
  9999. @item peak
  10000. Set peak mode(s).
  10001. Available modes can be cumulated (the option is a @code{flag} type). Possible
  10002. values are:
  10003. @table @samp
  10004. @item none
  10005. Disable any peak mode (default).
  10006. @item sample
  10007. Enable sample-peak mode.
  10008. Simple peak mode looking for the higher sample value. It logs a message
  10009. for sample-peak (identified by @code{SPK}).
  10010. @item true
  10011. Enable true-peak mode.
  10012. If enabled, the peak lookup is done on an over-sampled version of the input
  10013. stream for better peak accuracy. It logs a message for true-peak.
  10014. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  10015. This mode requires a build with @code{libswresample}.
  10016. @end table
  10017. @item dualmono
  10018. Treat mono input files as "dual mono". If a mono file is intended for playback
  10019. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  10020. If set to @code{true}, this option will compensate for this effect.
  10021. Multi-channel input files are not affected by this option.
  10022. @item panlaw
  10023. Set a specific pan law to be used for the measurement of dual mono files.
  10024. This parameter is optional, and has a default value of -3.01dB.
  10025. @end table
  10026. @subsection Examples
  10027. @itemize
  10028. @item
  10029. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  10030. @example
  10031. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  10032. @end example
  10033. @item
  10034. Run an analysis with @command{ffmpeg}:
  10035. @example
  10036. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  10037. @end example
  10038. @end itemize
  10039. @section interleave, ainterleave
  10040. Temporally interleave frames from several inputs.
  10041. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  10042. These filters read frames from several inputs and send the oldest
  10043. queued frame to the output.
  10044. Input streams must have a well defined, monotonically increasing frame
  10045. timestamp values.
  10046. In order to submit one frame to output, these filters need to enqueue
  10047. at least one frame for each input, so they cannot work in case one
  10048. input is not yet terminated and will not receive incoming frames.
  10049. For example consider the case when one input is a @code{select} filter
  10050. which always drop input frames. The @code{interleave} filter will keep
  10051. reading from that input, but it will never be able to send new frames
  10052. to output until the input will send an end-of-stream signal.
  10053. Also, depending on inputs synchronization, the filters will drop
  10054. frames in case one input receives more frames than the other ones, and
  10055. the queue is already filled.
  10056. These filters accept the following options:
  10057. @table @option
  10058. @item nb_inputs, n
  10059. Set the number of different inputs, it is 2 by default.
  10060. @end table
  10061. @subsection Examples
  10062. @itemize
  10063. @item
  10064. Interleave frames belonging to different streams using @command{ffmpeg}:
  10065. @example
  10066. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  10067. @end example
  10068. @item
  10069. Add flickering blur effect:
  10070. @example
  10071. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  10072. @end example
  10073. @end itemize
  10074. @section perms, aperms
  10075. Set read/write permissions for the output frames.
  10076. These filters are mainly aimed at developers to test direct path in the
  10077. following filter in the filtergraph.
  10078. The filters accept the following options:
  10079. @table @option
  10080. @item mode
  10081. Select the permissions mode.
  10082. It accepts the following values:
  10083. @table @samp
  10084. @item none
  10085. Do nothing. This is the default.
  10086. @item ro
  10087. Set all the output frames read-only.
  10088. @item rw
  10089. Set all the output frames directly writable.
  10090. @item toggle
  10091. Make the frame read-only if writable, and writable if read-only.
  10092. @item random
  10093. Set each output frame read-only or writable randomly.
  10094. @end table
  10095. @item seed
  10096. Set the seed for the @var{random} mode, must be an integer included between
  10097. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10098. @code{-1}, the filter will try to use a good random seed on a best effort
  10099. basis.
  10100. @end table
  10101. Note: in case of auto-inserted filter between the permission filter and the
  10102. following one, the permission might not be received as expected in that
  10103. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  10104. perms/aperms filter can avoid this problem.
  10105. @section realtime, arealtime
  10106. Slow down filtering to match real time approximatively.
  10107. These filters will pause the filtering for a variable amount of time to
  10108. match the output rate with the input timestamps.
  10109. They are similar to the @option{re} option to @code{ffmpeg}.
  10110. They accept the following options:
  10111. @table @option
  10112. @item limit
  10113. Time limit for the pauses. Any pause longer than that will be considered
  10114. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10115. @end table
  10116. @section select, aselect
  10117. Select frames to pass in output.
  10118. This filter accepts the following options:
  10119. @table @option
  10120. @item expr, e
  10121. Set expression, which is evaluated for each input frame.
  10122. If the expression is evaluated to zero, the frame is discarded.
  10123. If the evaluation result is negative or NaN, the frame is sent to the
  10124. first output; otherwise it is sent to the output with index
  10125. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10126. For example a value of @code{1.2} corresponds to the output with index
  10127. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10128. @item outputs, n
  10129. Set the number of outputs. The output to which to send the selected
  10130. frame is based on the result of the evaluation. Default value is 1.
  10131. @end table
  10132. The expression can contain the following constants:
  10133. @table @option
  10134. @item n
  10135. The (sequential) number of the filtered frame, starting from 0.
  10136. @item selected_n
  10137. The (sequential) number of the selected frame, starting from 0.
  10138. @item prev_selected_n
  10139. The sequential number of the last selected frame. It's NAN if undefined.
  10140. @item TB
  10141. The timebase of the input timestamps.
  10142. @item pts
  10143. The PTS (Presentation TimeStamp) of the filtered video frame,
  10144. expressed in @var{TB} units. It's NAN if undefined.
  10145. @item t
  10146. The PTS of the filtered video frame,
  10147. expressed in seconds. It's NAN if undefined.
  10148. @item prev_pts
  10149. The PTS of the previously filtered video frame. It's NAN if undefined.
  10150. @item prev_selected_pts
  10151. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10152. @item prev_selected_t
  10153. The PTS of the last previously selected video frame. It's NAN if undefined.
  10154. @item start_pts
  10155. The PTS of the first video frame in the video. It's NAN if undefined.
  10156. @item start_t
  10157. The time of the first video frame in the video. It's NAN if undefined.
  10158. @item pict_type @emph{(video only)}
  10159. The type of the filtered frame. It can assume one of the following
  10160. values:
  10161. @table @option
  10162. @item I
  10163. @item P
  10164. @item B
  10165. @item S
  10166. @item SI
  10167. @item SP
  10168. @item BI
  10169. @end table
  10170. @item interlace_type @emph{(video only)}
  10171. The frame interlace type. It can assume one of the following values:
  10172. @table @option
  10173. @item PROGRESSIVE
  10174. The frame is progressive (not interlaced).
  10175. @item TOPFIRST
  10176. The frame is top-field-first.
  10177. @item BOTTOMFIRST
  10178. The frame is bottom-field-first.
  10179. @end table
  10180. @item consumed_sample_n @emph{(audio only)}
  10181. the number of selected samples before the current frame
  10182. @item samples_n @emph{(audio only)}
  10183. the number of samples in the current frame
  10184. @item sample_rate @emph{(audio only)}
  10185. the input sample rate
  10186. @item key
  10187. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  10188. @item pos
  10189. the position in the file of the filtered frame, -1 if the information
  10190. is not available (e.g. for synthetic video)
  10191. @item scene @emph{(video only)}
  10192. value between 0 and 1 to indicate a new scene; a low value reflects a low
  10193. probability for the current frame to introduce a new scene, while a higher
  10194. value means the current frame is more likely to be one (see the example below)
  10195. @item concatdec_select
  10196. The concat demuxer can select only part of a concat input file by setting an
  10197. inpoint and an outpoint, but the output packets may not be entirely contained
  10198. in the selected interval. By using this variable, it is possible to skip frames
  10199. generated by the concat demuxer which are not exactly contained in the selected
  10200. interval.
  10201. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  10202. and the @var{lavf.concat.duration} packet metadata values which are also
  10203. present in the decoded frames.
  10204. The @var{concatdec_select} variable is -1 if the frame pts is at least
  10205. start_time and either the duration metadata is missing or the frame pts is less
  10206. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  10207. missing.
  10208. That basically means that an input frame is selected if its pts is within the
  10209. interval set by the concat demuxer.
  10210. @end table
  10211. The default value of the select expression is "1".
  10212. @subsection Examples
  10213. @itemize
  10214. @item
  10215. Select all frames in input:
  10216. @example
  10217. select
  10218. @end example
  10219. The example above is the same as:
  10220. @example
  10221. select=1
  10222. @end example
  10223. @item
  10224. Skip all frames:
  10225. @example
  10226. select=0
  10227. @end example
  10228. @item
  10229. Select only I-frames:
  10230. @example
  10231. select='eq(pict_type\,I)'
  10232. @end example
  10233. @item
  10234. Select one frame every 100:
  10235. @example
  10236. select='not(mod(n\,100))'
  10237. @end example
  10238. @item
  10239. Select only frames contained in the 10-20 time interval:
  10240. @example
  10241. select=between(t\,10\,20)
  10242. @end example
  10243. @item
  10244. Select only I frames contained in the 10-20 time interval:
  10245. @example
  10246. select=between(t\,10\,20)*eq(pict_type\,I)
  10247. @end example
  10248. @item
  10249. Select frames with a minimum distance of 10 seconds:
  10250. @example
  10251. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  10252. @end example
  10253. @item
  10254. Use aselect to select only audio frames with samples number > 100:
  10255. @example
  10256. aselect='gt(samples_n\,100)'
  10257. @end example
  10258. @item
  10259. Create a mosaic of the first scenes:
  10260. @example
  10261. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  10262. @end example
  10263. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  10264. choice.
  10265. @item
  10266. Send even and odd frames to separate outputs, and compose them:
  10267. @example
  10268. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  10269. @end example
  10270. @item
  10271. Select useful frames from an ffconcat file which is using inpoints and
  10272. outpoints but where the source files are not intra frame only.
  10273. @example
  10274. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  10275. @end example
  10276. @end itemize
  10277. @section selectivecolor
  10278. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10279. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10280. by the "purity" of the color (that is, how saturated it already is).
  10281. This filter is similar to the Adobe Photoshop Selective Color tool.
  10282. The filter accepts the following options:
  10283. @table @option
  10284. @item correction_method
  10285. Select color correction method.
  10286. Available values are:
  10287. @table @samp
  10288. @item absolute
  10289. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10290. component value).
  10291. @item relative
  10292. Specified adjustments are relative to the original component value.
  10293. @end table
  10294. Default is @code{absolute}.
  10295. @item reds
  10296. Adjustments for red pixels (pixels where the red component is the maximum)
  10297. @item yellows
  10298. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10299. @item greens
  10300. Adjustments for green pixels (pixels where the green component is the maximum)
  10301. @item cyans
  10302. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10303. @item blues
  10304. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10305. @item magentas
  10306. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10307. @item whites
  10308. Adjustments for white pixels (pixels where all components are greater than 128)
  10309. @item neutrals
  10310. Adjustments for all pixels except pure black and pure white
  10311. @item blacks
  10312. Adjustments for black pixels (pixels where all components are lesser than 128)
  10313. @item psfile
  10314. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10315. @end table
  10316. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10317. 4 space separated floating point adjustment values in the [-1,1] range,
  10318. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10319. pixels of its range.
  10320. @subsection Examples
  10321. @itemize
  10322. @item
  10323. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10324. increase magenta by 27% in blue areas:
  10325. @example
  10326. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10327. @end example
  10328. @item
  10329. Use a Photoshop selective color preset:
  10330. @example
  10331. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10332. @end example
  10333. @end itemize
  10334. @section sendcmd, asendcmd
  10335. Send commands to filters in the filtergraph.
  10336. These filters read commands to be sent to other filters in the
  10337. filtergraph.
  10338. @code{sendcmd} must be inserted between two video filters,
  10339. @code{asendcmd} must be inserted between two audio filters, but apart
  10340. from that they act the same way.
  10341. The specification of commands can be provided in the filter arguments
  10342. with the @var{commands} option, or in a file specified by the
  10343. @var{filename} option.
  10344. These filters accept the following options:
  10345. @table @option
  10346. @item commands, c
  10347. Set the commands to be read and sent to the other filters.
  10348. @item filename, f
  10349. Set the filename of the commands to be read and sent to the other
  10350. filters.
  10351. @end table
  10352. @subsection Commands syntax
  10353. A commands description consists of a sequence of interval
  10354. specifications, comprising a list of commands to be executed when a
  10355. particular event related to that interval occurs. The occurring event
  10356. is typically the current frame time entering or leaving a given time
  10357. interval.
  10358. An interval is specified by the following syntax:
  10359. @example
  10360. @var{START}[-@var{END}] @var{COMMANDS};
  10361. @end example
  10362. The time interval is specified by the @var{START} and @var{END} times.
  10363. @var{END} is optional and defaults to the maximum time.
  10364. The current frame time is considered within the specified interval if
  10365. it is included in the interval [@var{START}, @var{END}), that is when
  10366. the time is greater or equal to @var{START} and is lesser than
  10367. @var{END}.
  10368. @var{COMMANDS} consists of a sequence of one or more command
  10369. specifications, separated by ",", relating to that interval. The
  10370. syntax of a command specification is given by:
  10371. @example
  10372. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10373. @end example
  10374. @var{FLAGS} is optional and specifies the type of events relating to
  10375. the time interval which enable sending the specified command, and must
  10376. be a non-null sequence of identifier flags separated by "+" or "|" and
  10377. enclosed between "[" and "]".
  10378. The following flags are recognized:
  10379. @table @option
  10380. @item enter
  10381. The command is sent when the current frame timestamp enters the
  10382. specified interval. In other words, the command is sent when the
  10383. previous frame timestamp was not in the given interval, and the
  10384. current is.
  10385. @item leave
  10386. The command is sent when the current frame timestamp leaves the
  10387. specified interval. In other words, the command is sent when the
  10388. previous frame timestamp was in the given interval, and the
  10389. current is not.
  10390. @end table
  10391. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10392. assumed.
  10393. @var{TARGET} specifies the target of the command, usually the name of
  10394. the filter class or a specific filter instance name.
  10395. @var{COMMAND} specifies the name of the command for the target filter.
  10396. @var{ARG} is optional and specifies the optional list of argument for
  10397. the given @var{COMMAND}.
  10398. Between one interval specification and another, whitespaces, or
  10399. sequences of characters starting with @code{#} until the end of line,
  10400. are ignored and can be used to annotate comments.
  10401. A simplified BNF description of the commands specification syntax
  10402. follows:
  10403. @example
  10404. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10405. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10406. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10407. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10408. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10409. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10410. @end example
  10411. @subsection Examples
  10412. @itemize
  10413. @item
  10414. Specify audio tempo change at second 4:
  10415. @example
  10416. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10417. @end example
  10418. @item
  10419. Specify a list of drawtext and hue commands in a file.
  10420. @example
  10421. # show text in the interval 5-10
  10422. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10423. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10424. # desaturate the image in the interval 15-20
  10425. 15.0-20.0 [enter] hue s 0,
  10426. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10427. [leave] hue s 1,
  10428. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10429. # apply an exponential saturation fade-out effect, starting from time 25
  10430. 25 [enter] hue s exp(25-t)
  10431. @end example
  10432. A filtergraph allowing to read and process the above command list
  10433. stored in a file @file{test.cmd}, can be specified with:
  10434. @example
  10435. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10436. @end example
  10437. @end itemize
  10438. @anchor{setpts}
  10439. @section setpts, asetpts
  10440. Change the PTS (presentation timestamp) of the input frames.
  10441. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10442. This filter accepts the following options:
  10443. @table @option
  10444. @item expr
  10445. The expression which is evaluated for each frame to construct its timestamp.
  10446. @end table
  10447. The expression is evaluated through the eval API and can contain the following
  10448. constants:
  10449. @table @option
  10450. @item FRAME_RATE
  10451. frame rate, only defined for constant frame-rate video
  10452. @item PTS
  10453. The presentation timestamp in input
  10454. @item N
  10455. The count of the input frame for video or the number of consumed samples,
  10456. not including the current frame for audio, starting from 0.
  10457. @item NB_CONSUMED_SAMPLES
  10458. The number of consumed samples, not including the current frame (only
  10459. audio)
  10460. @item NB_SAMPLES, S
  10461. The number of samples in the current frame (only audio)
  10462. @item SAMPLE_RATE, SR
  10463. The audio sample rate.
  10464. @item STARTPTS
  10465. The PTS of the first frame.
  10466. @item STARTT
  10467. the time in seconds of the first frame
  10468. @item INTERLACED
  10469. State whether the current frame is interlaced.
  10470. @item T
  10471. the time in seconds of the current frame
  10472. @item POS
  10473. original position in the file of the frame, or undefined if undefined
  10474. for the current frame
  10475. @item PREV_INPTS
  10476. The previous input PTS.
  10477. @item PREV_INT
  10478. previous input time in seconds
  10479. @item PREV_OUTPTS
  10480. The previous output PTS.
  10481. @item PREV_OUTT
  10482. previous output time in seconds
  10483. @item RTCTIME
  10484. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10485. instead.
  10486. @item RTCSTART
  10487. The wallclock (RTC) time at the start of the movie in microseconds.
  10488. @item TB
  10489. The timebase of the input timestamps.
  10490. @end table
  10491. @subsection Examples
  10492. @itemize
  10493. @item
  10494. Start counting PTS from zero
  10495. @example
  10496. setpts=PTS-STARTPTS
  10497. @end example
  10498. @item
  10499. Apply fast motion effect:
  10500. @example
  10501. setpts=0.5*PTS
  10502. @end example
  10503. @item
  10504. Apply slow motion effect:
  10505. @example
  10506. setpts=2.0*PTS
  10507. @end example
  10508. @item
  10509. Set fixed rate of 25 frames per second:
  10510. @example
  10511. setpts=N/(25*TB)
  10512. @end example
  10513. @item
  10514. Set fixed rate 25 fps with some jitter:
  10515. @example
  10516. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10517. @end example
  10518. @item
  10519. Apply an offset of 10 seconds to the input PTS:
  10520. @example
  10521. setpts=PTS+10/TB
  10522. @end example
  10523. @item
  10524. Generate timestamps from a "live source" and rebase onto the current timebase:
  10525. @example
  10526. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10527. @end example
  10528. @item
  10529. Generate timestamps by counting samples:
  10530. @example
  10531. asetpts=N/SR/TB
  10532. @end example
  10533. @end itemize
  10534. @section settb, asettb
  10535. Set the timebase to use for the output frames timestamps.
  10536. It is mainly useful for testing timebase configuration.
  10537. It accepts the following parameters:
  10538. @table @option
  10539. @item expr, tb
  10540. The expression which is evaluated into the output timebase.
  10541. @end table
  10542. The value for @option{tb} is an arithmetic expression representing a
  10543. rational. The expression can contain the constants "AVTB" (the default
  10544. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10545. audio only). Default value is "intb".
  10546. @subsection Examples
  10547. @itemize
  10548. @item
  10549. Set the timebase to 1/25:
  10550. @example
  10551. settb=expr=1/25
  10552. @end example
  10553. @item
  10554. Set the timebase to 1/10:
  10555. @example
  10556. settb=expr=0.1
  10557. @end example
  10558. @item
  10559. Set the timebase to 1001/1000:
  10560. @example
  10561. settb=1+0.001
  10562. @end example
  10563. @item
  10564. Set the timebase to 2*intb:
  10565. @example
  10566. settb=2*intb
  10567. @end example
  10568. @item
  10569. Set the default timebase value:
  10570. @example
  10571. settb=AVTB
  10572. @end example
  10573. @end itemize
  10574. @section showcqt
  10575. Convert input audio to a video output representing frequency spectrum
  10576. logarithmically using Brown-Puckette constant Q transform algorithm with
  10577. direct frequency domain coefficient calculation (but the transform itself
  10578. is not really constant Q, instead the Q factor is actually variable/clamped),
  10579. with musical tone scale, from E0 to D#10.
  10580. The filter accepts the following options:
  10581. @table @option
  10582. @item size, s
  10583. Specify the video size for the output. It must be even. For the syntax of this option,
  10584. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10585. Default value is @code{1920x1080}.
  10586. @item fps, rate, r
  10587. Set the output frame rate. Default value is @code{25}.
  10588. @item bar_h
  10589. Set the bargraph height. It must be even. Default value is @code{-1} which
  10590. computes the bargraph height automatically.
  10591. @item axis_h
  10592. Set the axis height. It must be even. Default value is @code{-1} which computes
  10593. the axis height automatically.
  10594. @item sono_h
  10595. Set the sonogram height. It must be even. Default value is @code{-1} which
  10596. computes the sonogram height automatically.
  10597. @item fullhd
  10598. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  10599. instead. Default value is @code{1}.
  10600. @item sono_v, volume
  10601. Specify the sonogram volume expression. It can contain variables:
  10602. @table @option
  10603. @item bar_v
  10604. the @var{bar_v} evaluated expression
  10605. @item frequency, freq, f
  10606. the frequency where it is evaluated
  10607. @item timeclamp, tc
  10608. the value of @var{timeclamp} option
  10609. @end table
  10610. and functions:
  10611. @table @option
  10612. @item a_weighting(f)
  10613. A-weighting of equal loudness
  10614. @item b_weighting(f)
  10615. B-weighting of equal loudness
  10616. @item c_weighting(f)
  10617. C-weighting of equal loudness.
  10618. @end table
  10619. Default value is @code{16}.
  10620. @item bar_v, volume2
  10621. Specify the bargraph volume expression. It can contain variables:
  10622. @table @option
  10623. @item sono_v
  10624. the @var{sono_v} evaluated expression
  10625. @item frequency, freq, f
  10626. the frequency where it is evaluated
  10627. @item timeclamp, tc
  10628. the value of @var{timeclamp} option
  10629. @end table
  10630. and functions:
  10631. @table @option
  10632. @item a_weighting(f)
  10633. A-weighting of equal loudness
  10634. @item b_weighting(f)
  10635. B-weighting of equal loudness
  10636. @item c_weighting(f)
  10637. C-weighting of equal loudness.
  10638. @end table
  10639. Default value is @code{sono_v}.
  10640. @item sono_g, gamma
  10641. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  10642. higher gamma makes the spectrum having more range. Default value is @code{3}.
  10643. Acceptable range is @code{[1, 7]}.
  10644. @item bar_g, gamma2
  10645. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  10646. @code{[1, 7]}.
  10647. @item timeclamp, tc
  10648. Specify the transform timeclamp. At low frequency, there is trade-off between
  10649. accuracy in time domain and frequency domain. If timeclamp is lower,
  10650. event in time domain is represented more accurately (such as fast bass drum),
  10651. otherwise event in frequency domain is represented more accurately
  10652. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  10653. @item basefreq
  10654. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  10655. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  10656. @item endfreq
  10657. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  10658. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  10659. @item coeffclamp
  10660. This option is deprecated and ignored.
  10661. @item tlength
  10662. Specify the transform length in time domain. Use this option to control accuracy
  10663. trade-off between time domain and frequency domain at every frequency sample.
  10664. It can contain variables:
  10665. @table @option
  10666. @item frequency, freq, f
  10667. the frequency where it is evaluated
  10668. @item timeclamp, tc
  10669. the value of @var{timeclamp} option.
  10670. @end table
  10671. Default value is @code{384*tc/(384+tc*f)}.
  10672. @item count
  10673. Specify the transform count for every video frame. Default value is @code{6}.
  10674. Acceptable range is @code{[1, 30]}.
  10675. @item fcount
  10676. Specify the transform count for every single pixel. Default value is @code{0},
  10677. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  10678. @item fontfile
  10679. Specify font file for use with freetype to draw the axis. If not specified,
  10680. use embedded font. Note that drawing with font file or embedded font is not
  10681. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  10682. option instead.
  10683. @item fontcolor
  10684. Specify font color expression. This is arithmetic expression that should return
  10685. integer value 0xRRGGBB. It can contain variables:
  10686. @table @option
  10687. @item frequency, freq, f
  10688. the frequency where it is evaluated
  10689. @item timeclamp, tc
  10690. the value of @var{timeclamp} option
  10691. @end table
  10692. and functions:
  10693. @table @option
  10694. @item midi(f)
  10695. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  10696. @item r(x), g(x), b(x)
  10697. red, green, and blue value of intensity x.
  10698. @end table
  10699. Default value is @code{st(0, (midi(f)-59.5)/12);
  10700. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  10701. r(1-ld(1)) + b(ld(1))}.
  10702. @item axisfile
  10703. Specify image file to draw the axis. This option override @var{fontfile} and
  10704. @var{fontcolor} option.
  10705. @item axis, text
  10706. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  10707. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  10708. Default value is @code{1}.
  10709. @end table
  10710. @subsection Examples
  10711. @itemize
  10712. @item
  10713. Playing audio while showing the spectrum:
  10714. @example
  10715. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  10716. @end example
  10717. @item
  10718. Same as above, but with frame rate 30 fps:
  10719. @example
  10720. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  10721. @end example
  10722. @item
  10723. Playing at 1280x720:
  10724. @example
  10725. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  10726. @end example
  10727. @item
  10728. Disable sonogram display:
  10729. @example
  10730. sono_h=0
  10731. @end example
  10732. @item
  10733. A1 and its harmonics: A1, A2, (near)E3, A3:
  10734. @example
  10735. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  10736. asplit[a][out1]; [a] showcqt [out0]'
  10737. @end example
  10738. @item
  10739. Same as above, but with more accuracy in frequency domain:
  10740. @example
  10741. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  10742. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  10743. @end example
  10744. @item
  10745. Custom volume:
  10746. @example
  10747. bar_v=10:sono_v=bar_v*a_weighting(f)
  10748. @end example
  10749. @item
  10750. Custom gamma, now spectrum is linear to the amplitude.
  10751. @example
  10752. bar_g=2:sono_g=2
  10753. @end example
  10754. @item
  10755. Custom tlength equation:
  10756. @example
  10757. tc=0.33:tlength='st(0,0.17); 384*tc / (384 / ld(0) + tc*f /(1-ld(0))) + 384*tc / (tc*f / ld(0) + 384 /(1-ld(0)))'
  10758. @end example
  10759. @item
  10760. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  10761. @example
  10762. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  10763. @end example
  10764. @item
  10765. Custom frequency range with custom axis using image file:
  10766. @example
  10767. axisfile=myaxis.png:basefreq=40:endfreq=10000
  10768. @end example
  10769. @end itemize
  10770. @section showfreqs
  10771. Convert input audio to video output representing the audio power spectrum.
  10772. Audio amplitude is on Y-axis while frequency is on X-axis.
  10773. The filter accepts the following options:
  10774. @table @option
  10775. @item size, s
  10776. Specify size of video. For the syntax of this option, check the
  10777. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10778. Default is @code{1024x512}.
  10779. @item mode
  10780. Set display mode.
  10781. This set how each frequency bin will be represented.
  10782. It accepts the following values:
  10783. @table @samp
  10784. @item line
  10785. @item bar
  10786. @item dot
  10787. @end table
  10788. Default is @code{bar}.
  10789. @item ascale
  10790. Set amplitude scale.
  10791. It accepts the following values:
  10792. @table @samp
  10793. @item lin
  10794. Linear scale.
  10795. @item sqrt
  10796. Square root scale.
  10797. @item cbrt
  10798. Cubic root scale.
  10799. @item log
  10800. Logarithmic scale.
  10801. @end table
  10802. Default is @code{log}.
  10803. @item fscale
  10804. Set frequency scale.
  10805. It accepts the following values:
  10806. @table @samp
  10807. @item lin
  10808. Linear scale.
  10809. @item log
  10810. Logarithmic scale.
  10811. @item rlog
  10812. Reverse logarithmic scale.
  10813. @end table
  10814. Default is @code{lin}.
  10815. @item win_size
  10816. Set window size.
  10817. It accepts the following values:
  10818. @table @samp
  10819. @item w16
  10820. @item w32
  10821. @item w64
  10822. @item w128
  10823. @item w256
  10824. @item w512
  10825. @item w1024
  10826. @item w2048
  10827. @item w4096
  10828. @item w8192
  10829. @item w16384
  10830. @item w32768
  10831. @item w65536
  10832. @end table
  10833. Default is @code{w2048}
  10834. @item win_func
  10835. Set windowing function.
  10836. It accepts the following values:
  10837. @table @samp
  10838. @item rect
  10839. @item bartlett
  10840. @item hanning
  10841. @item hamming
  10842. @item blackman
  10843. @item welch
  10844. @item flattop
  10845. @item bharris
  10846. @item bnuttall
  10847. @item bhann
  10848. @item sine
  10849. @item nuttall
  10850. @item lanczos
  10851. @item gauss
  10852. @end table
  10853. Default is @code{hanning}.
  10854. @item overlap
  10855. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  10856. which means optimal overlap for selected window function will be picked.
  10857. @item averaging
  10858. Set time averaging. Setting this to 0 will display current maximal peaks.
  10859. Default is @code{1}, which means time averaging is disabled.
  10860. @item colors
  10861. Specify list of colors separated by space or by '|' which will be used to
  10862. draw channel frequencies. Unrecognized or missing colors will be replaced
  10863. by white color.
  10864. @end table
  10865. @section showspectrum
  10866. Convert input audio to a video output, representing the audio frequency
  10867. spectrum.
  10868. The filter accepts the following options:
  10869. @table @option
  10870. @item size, s
  10871. Specify the video size for the output. For the syntax of this option, check the
  10872. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10873. Default value is @code{640x512}.
  10874. @item slide
  10875. Specify how the spectrum should slide along the window.
  10876. It accepts the following values:
  10877. @table @samp
  10878. @item replace
  10879. the samples start again on the left when they reach the right
  10880. @item scroll
  10881. the samples scroll from right to left
  10882. @item fullframe
  10883. frames are only produced when the samples reach the right
  10884. @end table
  10885. Default value is @code{replace}.
  10886. @item mode
  10887. Specify display mode.
  10888. It accepts the following values:
  10889. @table @samp
  10890. @item combined
  10891. all channels are displayed in the same row
  10892. @item separate
  10893. all channels are displayed in separate rows
  10894. @end table
  10895. Default value is @samp{combined}.
  10896. @item color
  10897. Specify display color mode.
  10898. It accepts the following values:
  10899. @table @samp
  10900. @item channel
  10901. each channel is displayed in a separate color
  10902. @item intensity
  10903. each channel is is displayed using the same color scheme
  10904. @end table
  10905. Default value is @samp{channel}.
  10906. @item scale
  10907. Specify scale used for calculating intensity color values.
  10908. It accepts the following values:
  10909. @table @samp
  10910. @item lin
  10911. linear
  10912. @item sqrt
  10913. square root, default
  10914. @item cbrt
  10915. cubic root
  10916. @item log
  10917. logarithmic
  10918. @end table
  10919. Default value is @samp{sqrt}.
  10920. @item saturation
  10921. Set saturation modifier for displayed colors. Negative values provide
  10922. alternative color scheme. @code{0} is no saturation at all.
  10923. Saturation must be in [-10.0, 10.0] range.
  10924. Default value is @code{1}.
  10925. @item win_func
  10926. Set window function.
  10927. It accepts the following values:
  10928. @table @samp
  10929. @item none
  10930. No samples pre-processing (do not expect this to be faster)
  10931. @item hann
  10932. Hann window
  10933. @item hamming
  10934. Hamming window
  10935. @item blackman
  10936. Blackman window
  10937. @end table
  10938. Default value is @code{hann}.
  10939. @end table
  10940. The usage is very similar to the showwaves filter; see the examples in that
  10941. section.
  10942. @subsection Examples
  10943. @itemize
  10944. @item
  10945. Large window with logarithmic color scaling:
  10946. @example
  10947. showspectrum=s=1280x480:scale=log
  10948. @end example
  10949. @item
  10950. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  10951. @example
  10952. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10953. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  10954. @end example
  10955. @end itemize
  10956. @section showvolume
  10957. Convert input audio volume to a video output.
  10958. The filter accepts the following options:
  10959. @table @option
  10960. @item rate, r
  10961. Set video rate.
  10962. @item b
  10963. Set border width, allowed range is [0, 5]. Default is 1.
  10964. @item w
  10965. Set channel width, allowed range is [80, 1080]. Default is 400.
  10966. @item h
  10967. Set channel height, allowed range is [1, 100]. Default is 20.
  10968. @item f
  10969. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  10970. @item c
  10971. Set volume color expression.
  10972. The expression can use the following variables:
  10973. @table @option
  10974. @item VOLUME
  10975. Current max volume of channel in dB.
  10976. @item CHANNEL
  10977. Current channel number, starting from 0.
  10978. @end table
  10979. @item t
  10980. If set, displays channel names. Default is enabled.
  10981. @item v
  10982. If set, displays volume values. Default is enabled.
  10983. @end table
  10984. @section showwaves
  10985. Convert input audio to a video output, representing the samples waves.
  10986. The filter accepts the following options:
  10987. @table @option
  10988. @item size, s
  10989. Specify the video size for the output. For the syntax of this option, check the
  10990. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10991. Default value is @code{600x240}.
  10992. @item mode
  10993. Set display mode.
  10994. Available values are:
  10995. @table @samp
  10996. @item point
  10997. Draw a point for each sample.
  10998. @item line
  10999. Draw a vertical line for each sample.
  11000. @item p2p
  11001. Draw a point for each sample and a line between them.
  11002. @item cline
  11003. Draw a centered vertical line for each sample.
  11004. @end table
  11005. Default value is @code{point}.
  11006. @item n
  11007. Set the number of samples which are printed on the same column. A
  11008. larger value will decrease the frame rate. Must be a positive
  11009. integer. This option can be set only if the value for @var{rate}
  11010. is not explicitly specified.
  11011. @item rate, r
  11012. Set the (approximate) output frame rate. This is done by setting the
  11013. option @var{n}. Default value is "25".
  11014. @item split_channels
  11015. Set if channels should be drawn separately or overlap. Default value is 0.
  11016. @end table
  11017. @subsection Examples
  11018. @itemize
  11019. @item
  11020. Output the input file audio and the corresponding video representation
  11021. at the same time:
  11022. @example
  11023. amovie=a.mp3,asplit[out0],showwaves[out1]
  11024. @end example
  11025. @item
  11026. Create a synthetic signal and show it with showwaves, forcing a
  11027. frame rate of 30 frames per second:
  11028. @example
  11029. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  11030. @end example
  11031. @end itemize
  11032. @section showwavespic
  11033. Convert input audio to a single video frame, representing the samples waves.
  11034. The filter accepts the following options:
  11035. @table @option
  11036. @item size, s
  11037. Specify the video size for the output. For the syntax of this option, check the
  11038. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11039. Default value is @code{600x240}.
  11040. @item split_channels
  11041. Set if channels should be drawn separately or overlap. Default value is 0.
  11042. @end table
  11043. @subsection Examples
  11044. @itemize
  11045. @item
  11046. Extract a channel split representation of the wave form of a whole audio track
  11047. in a 1024x800 picture using @command{ffmpeg}:
  11048. @example
  11049. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  11050. @end example
  11051. @end itemize
  11052. @section split, asplit
  11053. Split input into several identical outputs.
  11054. @code{asplit} works with audio input, @code{split} with video.
  11055. The filter accepts a single parameter which specifies the number of outputs. If
  11056. unspecified, it defaults to 2.
  11057. @subsection Examples
  11058. @itemize
  11059. @item
  11060. Create two separate outputs from the same input:
  11061. @example
  11062. [in] split [out0][out1]
  11063. @end example
  11064. @item
  11065. To create 3 or more outputs, you need to specify the number of
  11066. outputs, like in:
  11067. @example
  11068. [in] asplit=3 [out0][out1][out2]
  11069. @end example
  11070. @item
  11071. Create two separate outputs from the same input, one cropped and
  11072. one padded:
  11073. @example
  11074. [in] split [splitout1][splitout2];
  11075. [splitout1] crop=100:100:0:0 [cropout];
  11076. [splitout2] pad=200:200:100:100 [padout];
  11077. @end example
  11078. @item
  11079. Create 5 copies of the input audio with @command{ffmpeg}:
  11080. @example
  11081. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  11082. @end example
  11083. @end itemize
  11084. @section zmq, azmq
  11085. Receive commands sent through a libzmq client, and forward them to
  11086. filters in the filtergraph.
  11087. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  11088. must be inserted between two video filters, @code{azmq} between two
  11089. audio filters.
  11090. To enable these filters you need to install the libzmq library and
  11091. headers and configure FFmpeg with @code{--enable-libzmq}.
  11092. For more information about libzmq see:
  11093. @url{http://www.zeromq.org/}
  11094. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  11095. receives messages sent through a network interface defined by the
  11096. @option{bind_address} option.
  11097. The received message must be in the form:
  11098. @example
  11099. @var{TARGET} @var{COMMAND} [@var{ARG}]
  11100. @end example
  11101. @var{TARGET} specifies the target of the command, usually the name of
  11102. the filter class or a specific filter instance name.
  11103. @var{COMMAND} specifies the name of the command for the target filter.
  11104. @var{ARG} is optional and specifies the optional argument list for the
  11105. given @var{COMMAND}.
  11106. Upon reception, the message is processed and the corresponding command
  11107. is injected into the filtergraph. Depending on the result, the filter
  11108. will send a reply to the client, adopting the format:
  11109. @example
  11110. @var{ERROR_CODE} @var{ERROR_REASON}
  11111. @var{MESSAGE}
  11112. @end example
  11113. @var{MESSAGE} is optional.
  11114. @subsection Examples
  11115. Look at @file{tools/zmqsend} for an example of a zmq client which can
  11116. be used to send commands processed by these filters.
  11117. Consider the following filtergraph generated by @command{ffplay}
  11118. @example
  11119. ffplay -dumpgraph 1 -f lavfi "
  11120. color=s=100x100:c=red [l];
  11121. color=s=100x100:c=blue [r];
  11122. nullsrc=s=200x100, zmq [bg];
  11123. [bg][l] overlay [bg+l];
  11124. [bg+l][r] overlay=x=100 "
  11125. @end example
  11126. To change the color of the left side of the video, the following
  11127. command can be used:
  11128. @example
  11129. echo Parsed_color_0 c yellow | tools/zmqsend
  11130. @end example
  11131. To change the right side:
  11132. @example
  11133. echo Parsed_color_1 c pink | tools/zmqsend
  11134. @end example
  11135. @c man end MULTIMEDIA FILTERS
  11136. @chapter Multimedia Sources
  11137. @c man begin MULTIMEDIA SOURCES
  11138. Below is a description of the currently available multimedia sources.
  11139. @section amovie
  11140. This is the same as @ref{movie} source, except it selects an audio
  11141. stream by default.
  11142. @anchor{movie}
  11143. @section movie
  11144. Read audio and/or video stream(s) from a movie container.
  11145. It accepts the following parameters:
  11146. @table @option
  11147. @item filename
  11148. The name of the resource to read (not necessarily a file; it can also be a
  11149. device or a stream accessed through some protocol).
  11150. @item format_name, f
  11151. Specifies the format assumed for the movie to read, and can be either
  11152. the name of a container or an input device. If not specified, the
  11153. format is guessed from @var{movie_name} or by probing.
  11154. @item seek_point, sp
  11155. Specifies the seek point in seconds. The frames will be output
  11156. starting from this seek point. The parameter is evaluated with
  11157. @code{av_strtod}, so the numerical value may be suffixed by an IS
  11158. postfix. The default value is "0".
  11159. @item streams, s
  11160. Specifies the streams to read. Several streams can be specified,
  11161. separated by "+". The source will then have as many outputs, in the
  11162. same order. The syntax is explained in the ``Stream specifiers''
  11163. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  11164. respectively the default (best suited) video and audio stream. Default
  11165. is "dv", or "da" if the filter is called as "amovie".
  11166. @item stream_index, si
  11167. Specifies the index of the video stream to read. If the value is -1,
  11168. the most suitable video stream will be automatically selected. The default
  11169. value is "-1". Deprecated. If the filter is called "amovie", it will select
  11170. audio instead of video.
  11171. @item loop
  11172. Specifies how many times to read the stream in sequence.
  11173. If the value is less than 1, the stream will be read again and again.
  11174. Default value is "1".
  11175. Note that when the movie is looped the source timestamps are not
  11176. changed, so it will generate non monotonically increasing timestamps.
  11177. @end table
  11178. It allows overlaying a second video on top of the main input of
  11179. a filtergraph, as shown in this graph:
  11180. @example
  11181. input -----------> deltapts0 --> overlay --> output
  11182. ^
  11183. |
  11184. movie --> scale--> deltapts1 -------+
  11185. @end example
  11186. @subsection Examples
  11187. @itemize
  11188. @item
  11189. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  11190. on top of the input labelled "in":
  11191. @example
  11192. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11193. [in] setpts=PTS-STARTPTS [main];
  11194. [main][over] overlay=16:16 [out]
  11195. @end example
  11196. @item
  11197. Read from a video4linux2 device, and overlay it on top of the input
  11198. labelled "in":
  11199. @example
  11200. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11201. [in] setpts=PTS-STARTPTS [main];
  11202. [main][over] overlay=16:16 [out]
  11203. @end example
  11204. @item
  11205. Read the first video stream and the audio stream with id 0x81 from
  11206. dvd.vob; the video is connected to the pad named "video" and the audio is
  11207. connected to the pad named "audio":
  11208. @example
  11209. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  11210. @end example
  11211. @end itemize
  11212. @c man end MULTIMEDIA SOURCES