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.

17971 lines
479KB

  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 level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section acrusher
  353. Reduce audio bit resolution.
  354. This filter is bit crusher with enhanced functionality. A bit crusher
  355. is used to audibly reduce number of bits an audio signal is sampled
  356. with. This doesn't change the bit depth at all, it just produces the
  357. effect. Material reduced in bit depth sounds more harsh and "digital".
  358. This filter is able to even round to continuous values instead of discrete
  359. bit depths.
  360. Additionally it has a D/C offset which results in different crushing of
  361. the lower and the upper half of the signal.
  362. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  363. Another feature of this filter is the logarithmic mode.
  364. This setting switches from linear distances between bits to logarithmic ones.
  365. The result is a much more "natural" sounding crusher which doesn't gate low
  366. signals for example. The human ear has a logarithmic perception, too
  367. so this kind of crushing is much more pleasant.
  368. Logarithmic crushing is also able to get anti-aliased.
  369. The filter accepts the following options:
  370. @table @option
  371. @item level_in
  372. Set level in.
  373. @item level_out
  374. Set level out.
  375. @item bits
  376. Set bit reduction.
  377. @item mix
  378. Set mixing amount.
  379. @item mode
  380. Can be linear: @code{lin} or logarithmic: @code{log}.
  381. @item dc
  382. Set DC.
  383. @item aa
  384. Set anti-aliasing.
  385. @item samples
  386. Set sample reduction.
  387. @item lfo
  388. Enable LFO. By default disabled.
  389. @item lforange
  390. Set LFO range.
  391. @item lforate
  392. Set LFO rate.
  393. @end table
  394. @section adelay
  395. Delay one or more audio channels.
  396. Samples in delayed channel are filled with silence.
  397. The filter accepts the following option:
  398. @table @option
  399. @item delays
  400. Set list of delays in milliseconds for each channel separated by '|'.
  401. At least one delay greater than 0 should be provided.
  402. Unused delays will be silently ignored. If number of given delays is
  403. smaller than number of channels all remaining channels will not be delayed.
  404. If you want to delay exact number of samples, append 'S' to number.
  405. @end table
  406. @subsection Examples
  407. @itemize
  408. @item
  409. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  410. the second channel (and any other channels that may be present) unchanged.
  411. @example
  412. adelay=1500|0|500
  413. @end example
  414. @item
  415. Delay second channel by 500 samples, the third channel by 700 samples and leave
  416. the first channel (and any other channels that may be present) unchanged.
  417. @example
  418. adelay=0|500S|700S
  419. @end example
  420. @end itemize
  421. @section aecho
  422. Apply echoing to the input audio.
  423. Echoes are reflected sound and can occur naturally amongst mountains
  424. (and sometimes large buildings) when talking or shouting; digital echo
  425. effects emulate this behaviour and are often used to help fill out the
  426. sound of a single instrument or vocal. The time difference between the
  427. original signal and the reflection is the @code{delay}, and the
  428. loudness of the reflected signal is the @code{decay}.
  429. Multiple echoes can have different delays and decays.
  430. A description of the accepted parameters follows.
  431. @table @option
  432. @item in_gain
  433. Set input gain of reflected signal. Default is @code{0.6}.
  434. @item out_gain
  435. Set output gain of reflected signal. Default is @code{0.3}.
  436. @item delays
  437. Set list of time intervals in milliseconds between original signal and reflections
  438. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  439. Default is @code{1000}.
  440. @item decays
  441. Set list of loudnesses of reflected signals separated by '|'.
  442. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  443. Default is @code{0.5}.
  444. @end table
  445. @subsection Examples
  446. @itemize
  447. @item
  448. Make it sound as if there are twice as many instruments as are actually playing:
  449. @example
  450. aecho=0.8:0.88:60:0.4
  451. @end example
  452. @item
  453. If delay is very short, then it sound like a (metallic) robot playing music:
  454. @example
  455. aecho=0.8:0.88:6:0.4
  456. @end example
  457. @item
  458. A longer delay will sound like an open air concert in the mountains:
  459. @example
  460. aecho=0.8:0.9:1000:0.3
  461. @end example
  462. @item
  463. Same as above but with one more mountain:
  464. @example
  465. aecho=0.8:0.9:1000|1800:0.3|0.25
  466. @end example
  467. @end itemize
  468. @section aemphasis
  469. Audio emphasis filter creates or restores material directly taken from LPs or
  470. emphased CDs with different filter curves. E.g. to store music on vinyl the
  471. signal has to be altered by a filter first to even out the disadvantages of
  472. this recording medium.
  473. Once the material is played back the inverse filter has to be applied to
  474. restore the distortion of the frequency response.
  475. The filter accepts the following options:
  476. @table @option
  477. @item level_in
  478. Set input gain.
  479. @item level_out
  480. Set output gain.
  481. @item mode
  482. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  483. use @code{production} mode. Default is @code{reproduction} mode.
  484. @item type
  485. Set filter type. Selects medium. Can be one of the following:
  486. @table @option
  487. @item col
  488. select Columbia.
  489. @item emi
  490. select EMI.
  491. @item bsi
  492. select BSI (78RPM).
  493. @item riaa
  494. select RIAA.
  495. @item cd
  496. select Compact Disc (CD).
  497. @item 50fm
  498. select 50µs (FM).
  499. @item 75fm
  500. select 75µs (FM).
  501. @item 50kf
  502. select 50µs (FM-KF).
  503. @item 75kf
  504. select 75µs (FM-KF).
  505. @end table
  506. @end table
  507. @section aeval
  508. Modify an audio signal according to the specified expressions.
  509. This filter accepts one or more expressions (one for each channel),
  510. which are evaluated and used to modify a corresponding audio signal.
  511. It accepts the following parameters:
  512. @table @option
  513. @item exprs
  514. Set the '|'-separated expressions list for each separate channel. If
  515. the number of input channels is greater than the number of
  516. expressions, the last specified expression is used for the remaining
  517. output channels.
  518. @item channel_layout, c
  519. Set output channel layout. If not specified, the channel layout is
  520. specified by the number of expressions. If set to @samp{same}, it will
  521. use by default the same input channel layout.
  522. @end table
  523. Each expression in @var{exprs} can contain the following constants and functions:
  524. @table @option
  525. @item ch
  526. channel number of the current expression
  527. @item n
  528. number of the evaluated sample, starting from 0
  529. @item s
  530. sample rate
  531. @item t
  532. time of the evaluated sample expressed in seconds
  533. @item nb_in_channels
  534. @item nb_out_channels
  535. input and output number of channels
  536. @item val(CH)
  537. the value of input channel with number @var{CH}
  538. @end table
  539. Note: this filter is slow. For faster processing you should use a
  540. dedicated filter.
  541. @subsection Examples
  542. @itemize
  543. @item
  544. Half volume:
  545. @example
  546. aeval=val(ch)/2:c=same
  547. @end example
  548. @item
  549. Invert phase of the second channel:
  550. @example
  551. aeval=val(0)|-val(1)
  552. @end example
  553. @end itemize
  554. @anchor{afade}
  555. @section afade
  556. Apply fade-in/out effect to input audio.
  557. A description of the accepted parameters follows.
  558. @table @option
  559. @item type, t
  560. Specify the effect type, can be either @code{in} for fade-in, or
  561. @code{out} for a fade-out effect. Default is @code{in}.
  562. @item start_sample, ss
  563. Specify the number of the start sample for starting to apply the fade
  564. effect. Default is 0.
  565. @item nb_samples, ns
  566. Specify the number of samples for which the fade effect has to last. At
  567. the end of the fade-in effect the output audio will have the same
  568. volume as the input audio, at the end of the fade-out transition
  569. the output audio will be silence. Default is 44100.
  570. @item start_time, st
  571. Specify the start time of the fade effect. Default is 0.
  572. The value must be specified as a time duration; see
  573. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  574. for the accepted syntax.
  575. If set this option is used instead of @var{start_sample}.
  576. @item duration, d
  577. Specify the duration of the fade effect. See
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. At the end of the fade-in effect the output audio will have the same
  581. volume as the input audio, at the end of the fade-out transition
  582. the output audio will be silence.
  583. By default the duration is determined by @var{nb_samples}.
  584. If set this option is used instead of @var{nb_samples}.
  585. @item curve
  586. Set curve for fade transition.
  587. It accepts the following values:
  588. @table @option
  589. @item tri
  590. select triangular, linear slope (default)
  591. @item qsin
  592. select quarter of sine wave
  593. @item hsin
  594. select half of sine wave
  595. @item esin
  596. select exponential sine wave
  597. @item log
  598. select logarithmic
  599. @item ipar
  600. select inverted parabola
  601. @item qua
  602. select quadratic
  603. @item cub
  604. select cubic
  605. @item squ
  606. select square root
  607. @item cbr
  608. select cubic root
  609. @item par
  610. select parabola
  611. @item exp
  612. select exponential
  613. @item iqsin
  614. select inverted quarter of sine wave
  615. @item ihsin
  616. select inverted half of sine wave
  617. @item dese
  618. select double-exponential seat
  619. @item desi
  620. select double-exponential sigmoid
  621. @end table
  622. @end table
  623. @subsection Examples
  624. @itemize
  625. @item
  626. Fade in first 15 seconds of audio:
  627. @example
  628. afade=t=in:ss=0:d=15
  629. @end example
  630. @item
  631. Fade out last 25 seconds of a 900 seconds audio:
  632. @example
  633. afade=t=out:st=875:d=25
  634. @end example
  635. @end itemize
  636. @section afftfilt
  637. Apply arbitrary expressions to samples in frequency domain.
  638. @table @option
  639. @item real
  640. Set frequency domain real expression for each separate channel separated
  641. by '|'. Default is "1".
  642. If the number of input channels is greater than the number of
  643. expressions, the last specified expression is used for the remaining
  644. output channels.
  645. @item imag
  646. Set frequency domain imaginary expression for each separate channel
  647. separated by '|'. If not set, @var{real} option is used.
  648. Each expression in @var{real} and @var{imag} can contain the following
  649. constants:
  650. @table @option
  651. @item sr
  652. sample rate
  653. @item b
  654. current frequency bin number
  655. @item nb
  656. number of available bins
  657. @item ch
  658. channel number of the current expression
  659. @item chs
  660. number of channels
  661. @item pts
  662. current frame pts
  663. @end table
  664. @item win_size
  665. Set window size.
  666. It accepts the following values:
  667. @table @samp
  668. @item w16
  669. @item w32
  670. @item w64
  671. @item w128
  672. @item w256
  673. @item w512
  674. @item w1024
  675. @item w2048
  676. @item w4096
  677. @item w8192
  678. @item w16384
  679. @item w32768
  680. @item w65536
  681. @end table
  682. Default is @code{w4096}
  683. @item win_func
  684. Set window function. Default is @code{hann}.
  685. @item overlap
  686. Set window overlap. If set to 1, the recommended overlap for selected
  687. window function will be picked. Default is @code{0.75}.
  688. @end table
  689. @subsection Examples
  690. @itemize
  691. @item
  692. Leave almost only low frequencies in audio:
  693. @example
  694. afftfilt="1-clip((b/nb)*b,0,1)"
  695. @end example
  696. @end itemize
  697. @anchor{aformat}
  698. @section aformat
  699. Set output format constraints for the input audio. The framework will
  700. negotiate the most appropriate format to minimize conversions.
  701. It accepts the following parameters:
  702. @table @option
  703. @item sample_fmts
  704. A '|'-separated list of requested sample formats.
  705. @item sample_rates
  706. A '|'-separated list of requested sample rates.
  707. @item channel_layouts
  708. A '|'-separated list of requested channel layouts.
  709. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the required syntax.
  711. @end table
  712. If a parameter is omitted, all values are allowed.
  713. Force the output to either unsigned 8-bit or signed 16-bit stereo
  714. @example
  715. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  716. @end example
  717. @section agate
  718. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  719. processing reduces disturbing noise between useful signals.
  720. Gating is done by detecting the volume below a chosen level @var{threshold}
  721. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  722. floor is set via @var{range}. Because an exact manipulation of the signal
  723. would cause distortion of the waveform the reduction can be levelled over
  724. time. This is done by setting @var{attack} and @var{release}.
  725. @var{attack} determines how long the signal has to fall below the threshold
  726. before any reduction will occur and @var{release} sets the time the signal
  727. has to rise above the threshold to reduce the reduction again.
  728. Shorter signals than the chosen attack time will be left untouched.
  729. @table @option
  730. @item level_in
  731. Set input level before filtering.
  732. Default is 1. Allowed range is from 0.015625 to 64.
  733. @item range
  734. Set the level of gain reduction when the signal is below the threshold.
  735. Default is 0.06125. Allowed range is from 0 to 1.
  736. @item threshold
  737. If a signal rises above this level the gain reduction is released.
  738. Default is 0.125. Allowed range is from 0 to 1.
  739. @item ratio
  740. Set a ratio by which the signal is reduced.
  741. Default is 2. Allowed range is from 1 to 9000.
  742. @item attack
  743. Amount of milliseconds the signal has to rise above the threshold before gain
  744. reduction stops.
  745. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  746. @item release
  747. Amount of milliseconds the signal has to fall below the threshold before the
  748. reduction is increased again. Default is 250 milliseconds.
  749. Allowed range is from 0.01 to 9000.
  750. @item makeup
  751. Set amount of amplification of signal after processing.
  752. Default is 1. Allowed range is from 1 to 64.
  753. @item knee
  754. Curve the sharp knee around the threshold to enter gain reduction more softly.
  755. Default is 2.828427125. Allowed range is from 1 to 8.
  756. @item detection
  757. Choose if exact signal should be taken for detection or an RMS like one.
  758. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  759. @item link
  760. Choose if the average level between all channels or the louder channel affects
  761. the reduction.
  762. Default is @code{average}. Can be @code{average} or @code{maximum}.
  763. @end table
  764. @section alimiter
  765. The limiter prevents an input signal from rising over a desired threshold.
  766. This limiter uses lookahead technology to prevent your signal from distorting.
  767. It means that there is a small delay after the signal is processed. Keep in mind
  768. that the delay it produces is the attack time you set.
  769. The filter accepts the following options:
  770. @table @option
  771. @item level_in
  772. Set input gain. Default is 1.
  773. @item level_out
  774. Set output gain. Default is 1.
  775. @item limit
  776. Don't let signals above this level pass the limiter. Default is 1.
  777. @item attack
  778. The limiter will reach its attenuation level in this amount of time in
  779. milliseconds. Default is 5 milliseconds.
  780. @item release
  781. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  782. Default is 50 milliseconds.
  783. @item asc
  784. When gain reduction is always needed ASC takes care of releasing to an
  785. average reduction level rather than reaching a reduction of 0 in the release
  786. time.
  787. @item asc_level
  788. Select how much the release time is affected by ASC, 0 means nearly no changes
  789. in release time while 1 produces higher release times.
  790. @item level
  791. Auto level output signal. Default is enabled.
  792. This normalizes audio back to 0dB if enabled.
  793. @end table
  794. Depending on picked setting it is recommended to upsample input 2x or 4x times
  795. with @ref{aresample} before applying this filter.
  796. @section allpass
  797. Apply a two-pole all-pass filter with central frequency (in Hz)
  798. @var{frequency}, and filter-width @var{width}.
  799. An all-pass filter changes the audio's frequency to phase relationship
  800. without changing its frequency to amplitude relationship.
  801. The filter accepts the following options:
  802. @table @option
  803. @item frequency, f
  804. Set frequency in Hz.
  805. @item width_type
  806. Set method to specify band-width of filter.
  807. @table @option
  808. @item h
  809. Hz
  810. @item q
  811. Q-Factor
  812. @item o
  813. octave
  814. @item s
  815. slope
  816. @end table
  817. @item width, w
  818. Specify the band-width of a filter in width_type units.
  819. @end table
  820. @section aloop
  821. Loop audio samples.
  822. The filter accepts the following options:
  823. @table @option
  824. @item loop
  825. Set the number of loops.
  826. @item size
  827. Set maximal number of samples.
  828. @item start
  829. Set first sample of loop.
  830. @end table
  831. @anchor{amerge}
  832. @section amerge
  833. Merge two or more audio streams into a single multi-channel stream.
  834. The filter accepts the following options:
  835. @table @option
  836. @item inputs
  837. Set the number of inputs. Default is 2.
  838. @end table
  839. If the channel layouts of the inputs are disjoint, and therefore compatible,
  840. the channel layout of the output will be set accordingly and the channels
  841. will be reordered as necessary. If the channel layouts of the inputs are not
  842. disjoint, the output will have all the channels of the first input then all
  843. the channels of the second input, in that order, and the channel layout of
  844. the output will be the default value corresponding to the total number of
  845. channels.
  846. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  847. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  848. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  849. first input, b1 is the first channel of the second input).
  850. On the other hand, if both input are in stereo, the output channels will be
  851. in the default order: a1, a2, b1, b2, and the channel layout will be
  852. arbitrarily set to 4.0, which may or may not be the expected value.
  853. All inputs must have the same sample rate, and format.
  854. If inputs do not have the same duration, the output will stop with the
  855. shortest.
  856. @subsection Examples
  857. @itemize
  858. @item
  859. Merge two mono files into a stereo stream:
  860. @example
  861. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  862. @end example
  863. @item
  864. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  865. @example
  866. 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
  867. @end example
  868. @end itemize
  869. @section amix
  870. Mixes multiple audio inputs into a single output.
  871. Note that this filter only supports float samples (the @var{amerge}
  872. and @var{pan} audio filters support many formats). If the @var{amix}
  873. input has integer samples then @ref{aresample} will be automatically
  874. inserted to perform the conversion to float samples.
  875. For example
  876. @example
  877. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  878. @end example
  879. will mix 3 input audio streams to a single output with the same duration as the
  880. first input and a dropout transition time of 3 seconds.
  881. It accepts the following parameters:
  882. @table @option
  883. @item inputs
  884. The number of inputs. If unspecified, it defaults to 2.
  885. @item duration
  886. How to determine the end-of-stream.
  887. @table @option
  888. @item longest
  889. The duration of the longest input. (default)
  890. @item shortest
  891. The duration of the shortest input.
  892. @item first
  893. The duration of the first input.
  894. @end table
  895. @item dropout_transition
  896. The transition time, in seconds, for volume renormalization when an input
  897. stream ends. The default value is 2 seconds.
  898. @end table
  899. @section anequalizer
  900. High-order parametric multiband equalizer for each channel.
  901. It accepts the following parameters:
  902. @table @option
  903. @item params
  904. This option string is in format:
  905. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  906. Each equalizer band is separated by '|'.
  907. @table @option
  908. @item chn
  909. Set channel number to which equalization will be applied.
  910. If input doesn't have that channel the entry is ignored.
  911. @item f
  912. Set central frequency for band.
  913. If input doesn't have that frequency the entry is ignored.
  914. @item w
  915. Set band width in hertz.
  916. @item g
  917. Set band gain in dB.
  918. @item t
  919. Set filter type for band, optional, can be:
  920. @table @samp
  921. @item 0
  922. Butterworth, this is default.
  923. @item 1
  924. Chebyshev type 1.
  925. @item 2
  926. Chebyshev type 2.
  927. @end table
  928. @end table
  929. @item curves
  930. With this option activated frequency response of anequalizer is displayed
  931. in video stream.
  932. @item size
  933. Set video stream size. Only useful if curves option is activated.
  934. @item mgain
  935. Set max gain that will be displayed. Only useful if curves option is activated.
  936. Setting this to a reasonable value makes it possible to display gain which is derived from
  937. neighbour bands which are too close to each other and thus produce higher gain
  938. when both are activated.
  939. @item fscale
  940. Set frequency scale used to draw frequency response in video output.
  941. Can be linear or logarithmic. Default is logarithmic.
  942. @item colors
  943. Set color for each channel curve which is going to be displayed in video stream.
  944. This is list of color names separated by space or by '|'.
  945. Unrecognised or missing colors will be replaced by white color.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  951. for first 2 channels using Chebyshev type 1 filter:
  952. @example
  953. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  954. @end example
  955. @end itemize
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item change
  960. Alter existing filter parameters.
  961. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  962. @var{fN} is existing filter number, starting from 0, if no such filter is available
  963. error is returned.
  964. @var{freq} set new frequency parameter.
  965. @var{width} set new width parameter in herz.
  966. @var{gain} set new gain parameter in dB.
  967. Full filter invocation with asendcmd may look like this:
  968. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  969. @end table
  970. @section anull
  971. Pass the audio source unchanged to the output.
  972. @section apad
  973. Pad the end of an audio stream with silence.
  974. This can be used together with @command{ffmpeg} @option{-shortest} to
  975. extend audio streams to the same length as the video stream.
  976. A description of the accepted options follows.
  977. @table @option
  978. @item packet_size
  979. Set silence packet size. Default value is 4096.
  980. @item pad_len
  981. Set the number of samples of silence to add to the end. After the
  982. value is reached, the stream is terminated. This option is mutually
  983. exclusive with @option{whole_len}.
  984. @item whole_len
  985. Set the minimum total number of samples in the output audio stream. If
  986. the value is longer than the input audio length, silence is added to
  987. the end, until the value is reached. This option is mutually exclusive
  988. with @option{pad_len}.
  989. @end table
  990. If neither the @option{pad_len} nor the @option{whole_len} option is
  991. set, the filter will add silence to the end of the input stream
  992. indefinitely.
  993. @subsection Examples
  994. @itemize
  995. @item
  996. Add 1024 samples of silence to the end of the input:
  997. @example
  998. apad=pad_len=1024
  999. @end example
  1000. @item
  1001. Make sure the audio output will contain at least 10000 samples, pad
  1002. the input with silence if required:
  1003. @example
  1004. apad=whole_len=10000
  1005. @end example
  1006. @item
  1007. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1008. video stream will always result the shortest and will be converted
  1009. until the end in the output file when using the @option{shortest}
  1010. option:
  1011. @example
  1012. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1013. @end example
  1014. @end itemize
  1015. @section aphaser
  1016. Add a phasing effect to the input audio.
  1017. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1018. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1019. A description of the accepted parameters follows.
  1020. @table @option
  1021. @item in_gain
  1022. Set input gain. Default is 0.4.
  1023. @item out_gain
  1024. Set output gain. Default is 0.74
  1025. @item delay
  1026. Set delay in milliseconds. Default is 3.0.
  1027. @item decay
  1028. Set decay. Default is 0.4.
  1029. @item speed
  1030. Set modulation speed in Hz. Default is 0.5.
  1031. @item type
  1032. Set modulation type. Default is triangular.
  1033. It accepts the following values:
  1034. @table @samp
  1035. @item triangular, t
  1036. @item sinusoidal, s
  1037. @end table
  1038. @end table
  1039. @section apulsator
  1040. Audio pulsator is something between an autopanner and a tremolo.
  1041. But it can produce funny stereo effects as well. Pulsator changes the volume
  1042. of the left and right channel based on a LFO (low frequency oscillator) with
  1043. different waveforms and shifted phases.
  1044. This filter have the ability to define an offset between left and right
  1045. channel. An offset of 0 means that both LFO shapes match each other.
  1046. The left and right channel are altered equally - a conventional tremolo.
  1047. An offset of 50% means that the shape of the right channel is exactly shifted
  1048. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1049. an autopanner. At 1 both curves match again. Every setting in between moves the
  1050. phase shift gapless between all stages and produces some "bypassing" sounds with
  1051. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1052. the 0.5) the faster the signal passes from the left to the right speaker.
  1053. The filter accepts the following options:
  1054. @table @option
  1055. @item level_in
  1056. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1057. @item level_out
  1058. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1059. @item mode
  1060. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1061. sawup or sawdown. Default is sine.
  1062. @item amount
  1063. Set modulation. Define how much of original signal is affected by the LFO.
  1064. @item offset_l
  1065. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1066. @item offset_r
  1067. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1068. @item width
  1069. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1070. @item timing
  1071. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1072. @item bpm
  1073. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1074. is set to bpm.
  1075. @item ms
  1076. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1077. is set to ms.
  1078. @item hz
  1079. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1080. if timing is set to hz.
  1081. @end table
  1082. @anchor{aresample}
  1083. @section aresample
  1084. Resample the input audio to the specified parameters, using the
  1085. libswresample library. If none are specified then the filter will
  1086. automatically convert between its input and output.
  1087. This filter is also able to stretch/squeeze the audio data to make it match
  1088. the timestamps or to inject silence / cut out audio to make it match the
  1089. timestamps, do a combination of both or do neither.
  1090. The filter accepts the syntax
  1091. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1092. expresses a sample rate and @var{resampler_options} is a list of
  1093. @var{key}=@var{value} pairs, separated by ":". See the
  1094. ffmpeg-resampler manual for the complete list of supported options.
  1095. @subsection Examples
  1096. @itemize
  1097. @item
  1098. Resample the input audio to 44100Hz:
  1099. @example
  1100. aresample=44100
  1101. @end example
  1102. @item
  1103. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1104. samples per second compensation:
  1105. @example
  1106. aresample=async=1000
  1107. @end example
  1108. @end itemize
  1109. @section areverse
  1110. Reverse an audio clip.
  1111. Warning: This filter requires memory to buffer the entire clip, so trimming
  1112. is suggested.
  1113. @subsection Examples
  1114. @itemize
  1115. @item
  1116. Take the first 5 seconds of a clip, and reverse it.
  1117. @example
  1118. atrim=end=5,areverse
  1119. @end example
  1120. @end itemize
  1121. @section asetnsamples
  1122. Set the number of samples per each output audio frame.
  1123. The last output packet may contain a different number of samples, as
  1124. the filter will flush all the remaining samples when the input audio
  1125. signals its end.
  1126. The filter accepts the following options:
  1127. @table @option
  1128. @item nb_out_samples, n
  1129. Set the number of frames per each output audio frame. The number is
  1130. intended as the number of samples @emph{per each channel}.
  1131. Default value is 1024.
  1132. @item pad, p
  1133. If set to 1, the filter will pad the last audio frame with zeroes, so
  1134. that the last frame will contain the same number of samples as the
  1135. previous ones. Default value is 1.
  1136. @end table
  1137. For example, to set the number of per-frame samples to 1234 and
  1138. disable padding for the last frame, use:
  1139. @example
  1140. asetnsamples=n=1234:p=0
  1141. @end example
  1142. @section asetrate
  1143. Set the sample rate without altering the PCM data.
  1144. This will result in a change of speed and pitch.
  1145. The filter accepts the following options:
  1146. @table @option
  1147. @item sample_rate, r
  1148. Set the output sample rate. Default is 44100 Hz.
  1149. @end table
  1150. @section ashowinfo
  1151. Show a line containing various information for each input audio frame.
  1152. The input audio is not modified.
  1153. The shown line contains a sequence of key/value pairs of the form
  1154. @var{key}:@var{value}.
  1155. The following values are shown in the output:
  1156. @table @option
  1157. @item n
  1158. The (sequential) number of the input frame, starting from 0.
  1159. @item pts
  1160. The presentation timestamp of the input frame, in time base units; the time base
  1161. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1162. @item pts_time
  1163. The presentation timestamp of the input frame in seconds.
  1164. @item pos
  1165. position of the frame in the input stream, -1 if this information in
  1166. unavailable and/or meaningless (for example in case of synthetic audio)
  1167. @item fmt
  1168. The sample format.
  1169. @item chlayout
  1170. The channel layout.
  1171. @item rate
  1172. The sample rate for the audio frame.
  1173. @item nb_samples
  1174. The number of samples (per channel) in the frame.
  1175. @item checksum
  1176. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1177. audio, the data is treated as if all the planes were concatenated.
  1178. @item plane_checksums
  1179. A list of Adler-32 checksums for each data plane.
  1180. @end table
  1181. @anchor{astats}
  1182. @section astats
  1183. Display time domain statistical information about the audio channels.
  1184. Statistics are calculated and displayed for each audio channel and,
  1185. where applicable, an overall figure is also given.
  1186. It accepts the following option:
  1187. @table @option
  1188. @item length
  1189. Short window length in seconds, used for peak and trough RMS measurement.
  1190. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1191. @item metadata
  1192. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1193. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1194. disabled.
  1195. Available keys for each channel are:
  1196. DC_offset
  1197. Min_level
  1198. Max_level
  1199. Min_difference
  1200. Max_difference
  1201. Mean_difference
  1202. Peak_level
  1203. RMS_peak
  1204. RMS_trough
  1205. Crest_factor
  1206. Flat_factor
  1207. Peak_count
  1208. Bit_depth
  1209. and for Overall:
  1210. DC_offset
  1211. Min_level
  1212. Max_level
  1213. Min_difference
  1214. Max_difference
  1215. Mean_difference
  1216. Peak_level
  1217. RMS_level
  1218. RMS_peak
  1219. RMS_trough
  1220. Flat_factor
  1221. Peak_count
  1222. Bit_depth
  1223. Number_of_samples
  1224. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1225. this @code{lavfi.astats.Overall.Peak_count}.
  1226. For description what each key means read below.
  1227. @item reset
  1228. Set number of frame after which stats are going to be recalculated.
  1229. Default is disabled.
  1230. @end table
  1231. A description of each shown parameter follows:
  1232. @table @option
  1233. @item DC offset
  1234. Mean amplitude displacement from zero.
  1235. @item Min level
  1236. Minimal sample level.
  1237. @item Max level
  1238. Maximal sample level.
  1239. @item Min difference
  1240. Minimal difference between two consecutive samples.
  1241. @item Max difference
  1242. Maximal difference between two consecutive samples.
  1243. @item Mean difference
  1244. Mean difference between two consecutive samples.
  1245. The average of each difference between two consecutive samples.
  1246. @item Peak level dB
  1247. @item RMS level dB
  1248. Standard peak and RMS level measured in dBFS.
  1249. @item RMS peak dB
  1250. @item RMS trough dB
  1251. Peak and trough values for RMS level measured over a short window.
  1252. @item Crest factor
  1253. Standard ratio of peak to RMS level (note: not in dB).
  1254. @item Flat factor
  1255. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1256. (i.e. either @var{Min level} or @var{Max level}).
  1257. @item Peak count
  1258. Number of occasions (not the number of samples) that the signal attained either
  1259. @var{Min level} or @var{Max level}.
  1260. @item Bit depth
  1261. Overall bit depth of audio. Number of bits used for each sample.
  1262. @end table
  1263. @section asyncts
  1264. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1265. dropping samples/adding silence when needed.
  1266. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1267. It accepts the following parameters:
  1268. @table @option
  1269. @item compensate
  1270. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1271. by default. When disabled, time gaps are covered with silence.
  1272. @item min_delta
  1273. The minimum difference between timestamps and audio data (in seconds) to trigger
  1274. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1275. sync with this filter, try setting this parameter to 0.
  1276. @item max_comp
  1277. The maximum compensation in samples per second. Only relevant with compensate=1.
  1278. The default value is 500.
  1279. @item first_pts
  1280. Assume that the first PTS should be this value. The time base is 1 / sample
  1281. rate. This allows for padding/trimming at the start of the stream. By default,
  1282. no assumption is made about the first frame's expected PTS, so no padding or
  1283. trimming is done. For example, this could be set to 0 to pad the beginning with
  1284. silence if an audio stream starts after the video stream or to trim any samples
  1285. with a negative PTS due to encoder delay.
  1286. @end table
  1287. @section atempo
  1288. Adjust audio tempo.
  1289. The filter accepts exactly one parameter, the audio tempo. If not
  1290. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1291. be in the [0.5, 2.0] range.
  1292. @subsection Examples
  1293. @itemize
  1294. @item
  1295. Slow down audio to 80% tempo:
  1296. @example
  1297. atempo=0.8
  1298. @end example
  1299. @item
  1300. To speed up audio to 125% tempo:
  1301. @example
  1302. atempo=1.25
  1303. @end example
  1304. @end itemize
  1305. @section atrim
  1306. Trim the input so that the output contains one continuous subpart of the input.
  1307. It accepts the following parameters:
  1308. @table @option
  1309. @item start
  1310. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1311. sample with the timestamp @var{start} will be the first sample in the output.
  1312. @item end
  1313. Specify time of the first audio sample that will be dropped, i.e. the
  1314. audio sample immediately preceding the one with the timestamp @var{end} will be
  1315. the last sample in the output.
  1316. @item start_pts
  1317. Same as @var{start}, except this option sets the start timestamp in samples
  1318. instead of seconds.
  1319. @item end_pts
  1320. Same as @var{end}, except this option sets the end timestamp in samples instead
  1321. of seconds.
  1322. @item duration
  1323. The maximum duration of the output in seconds.
  1324. @item start_sample
  1325. The number of the first sample that should be output.
  1326. @item end_sample
  1327. The number of the first sample that should be dropped.
  1328. @end table
  1329. @option{start}, @option{end}, and @option{duration} are expressed as time
  1330. duration specifications; see
  1331. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1332. Note that the first two sets of the start/end options and the @option{duration}
  1333. option look at the frame timestamp, while the _sample options simply count the
  1334. samples that pass through the filter. So start/end_pts and start/end_sample will
  1335. give different results when the timestamps are wrong, inexact or do not start at
  1336. zero. Also note that this filter does not modify the timestamps. If you wish
  1337. to have the output timestamps start at zero, insert the asetpts filter after the
  1338. atrim filter.
  1339. If multiple start or end options are set, this filter tries to be greedy and
  1340. keep all samples that match at least one of the specified constraints. To keep
  1341. only the part that matches all the constraints at once, chain multiple atrim
  1342. filters.
  1343. The defaults are such that all the input is kept. So it is possible to set e.g.
  1344. just the end values to keep everything before the specified time.
  1345. Examples:
  1346. @itemize
  1347. @item
  1348. Drop everything except the second minute of input:
  1349. @example
  1350. ffmpeg -i INPUT -af atrim=60:120
  1351. @end example
  1352. @item
  1353. Keep only the first 1000 samples:
  1354. @example
  1355. ffmpeg -i INPUT -af atrim=end_sample=1000
  1356. @end example
  1357. @end itemize
  1358. @section bandpass
  1359. Apply a two-pole Butterworth band-pass filter with central
  1360. frequency @var{frequency}, and (3dB-point) band-width width.
  1361. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1362. instead of the default: constant 0dB peak gain.
  1363. The filter roll off at 6dB per octave (20dB per decade).
  1364. The filter accepts the following options:
  1365. @table @option
  1366. @item frequency, f
  1367. Set the filter's central frequency. Default is @code{3000}.
  1368. @item csg
  1369. Constant skirt gain if set to 1. Defaults to 0.
  1370. @item width_type
  1371. Set method to specify band-width of filter.
  1372. @table @option
  1373. @item h
  1374. Hz
  1375. @item q
  1376. Q-Factor
  1377. @item o
  1378. octave
  1379. @item s
  1380. slope
  1381. @end table
  1382. @item width, w
  1383. Specify the band-width of a filter in width_type units.
  1384. @end table
  1385. @section bandreject
  1386. Apply a two-pole Butterworth band-reject filter with central
  1387. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1388. The filter roll off at 6dB per octave (20dB per decade).
  1389. The filter accepts the following options:
  1390. @table @option
  1391. @item frequency, f
  1392. Set the filter's central frequency. Default is @code{3000}.
  1393. @item width_type
  1394. Set method to specify band-width of filter.
  1395. @table @option
  1396. @item h
  1397. Hz
  1398. @item q
  1399. Q-Factor
  1400. @item o
  1401. octave
  1402. @item s
  1403. slope
  1404. @end table
  1405. @item width, w
  1406. Specify the band-width of a filter in width_type units.
  1407. @end table
  1408. @section bass
  1409. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1410. shelving filter with a response similar to that of a standard
  1411. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item gain, g
  1415. Give the gain at 0 Hz. Its useful range is about -20
  1416. (for a large cut) to +20 (for a large boost).
  1417. Beware of clipping when using a positive gain.
  1418. @item frequency, f
  1419. Set the filter's central frequency and so can be used
  1420. to extend or reduce the frequency range to be boosted or cut.
  1421. The default value is @code{100} Hz.
  1422. @item width_type
  1423. Set method to specify band-width of filter.
  1424. @table @option
  1425. @item h
  1426. Hz
  1427. @item q
  1428. Q-Factor
  1429. @item o
  1430. octave
  1431. @item s
  1432. slope
  1433. @end table
  1434. @item width, w
  1435. Determine how steep is the filter's shelf transition.
  1436. @end table
  1437. @section biquad
  1438. Apply a biquad IIR filter with the given coefficients.
  1439. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1440. are the numerator and denominator coefficients respectively.
  1441. @section bs2b
  1442. Bauer stereo to binaural transformation, which improves headphone listening of
  1443. stereo audio records.
  1444. It accepts the following parameters:
  1445. @table @option
  1446. @item profile
  1447. Pre-defined crossfeed level.
  1448. @table @option
  1449. @item default
  1450. Default level (fcut=700, feed=50).
  1451. @item cmoy
  1452. Chu Moy circuit (fcut=700, feed=60).
  1453. @item jmeier
  1454. Jan Meier circuit (fcut=650, feed=95).
  1455. @end table
  1456. @item fcut
  1457. Cut frequency (in Hz).
  1458. @item feed
  1459. Feed level (in Hz).
  1460. @end table
  1461. @section channelmap
  1462. Remap input channels to new locations.
  1463. It accepts the following parameters:
  1464. @table @option
  1465. @item channel_layout
  1466. The channel layout of the output stream.
  1467. @item map
  1468. Map channels from input to output. The argument is a '|'-separated list of
  1469. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1470. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1471. channel (e.g. FL for front left) or its index in the input channel layout.
  1472. @var{out_channel} is the name of the output channel or its index in the output
  1473. channel layout. If @var{out_channel} is not given then it is implicitly an
  1474. index, starting with zero and increasing by one for each mapping.
  1475. @end table
  1476. If no mapping is present, the filter will implicitly map input channels to
  1477. output channels, preserving indices.
  1478. For example, assuming a 5.1+downmix input MOV file,
  1479. @example
  1480. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1481. @end example
  1482. will create an output WAV file tagged as stereo from the downmix channels of
  1483. the input.
  1484. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1485. @example
  1486. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1487. @end example
  1488. @section channelsplit
  1489. Split each channel from an input audio stream into a separate output stream.
  1490. It accepts the following parameters:
  1491. @table @option
  1492. @item channel_layout
  1493. The channel layout of the input stream. The default is "stereo".
  1494. @end table
  1495. For example, assuming a stereo input MP3 file,
  1496. @example
  1497. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1498. @end example
  1499. will create an output Matroska file with two audio streams, one containing only
  1500. the left channel and the other the right channel.
  1501. Split a 5.1 WAV file into per-channel files:
  1502. @example
  1503. ffmpeg -i in.wav -filter_complex
  1504. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1505. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1506. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1507. side_right.wav
  1508. @end example
  1509. @section chorus
  1510. Add a chorus effect to the audio.
  1511. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1512. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1513. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1514. The modulation depth defines the range the modulated delay is played before or after
  1515. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1516. sound tuned around the original one, like in a chorus where some vocals are slightly
  1517. off key.
  1518. It accepts the following parameters:
  1519. @table @option
  1520. @item in_gain
  1521. Set input gain. Default is 0.4.
  1522. @item out_gain
  1523. Set output gain. Default is 0.4.
  1524. @item delays
  1525. Set delays. A typical delay is around 40ms to 60ms.
  1526. @item decays
  1527. Set decays.
  1528. @item speeds
  1529. Set speeds.
  1530. @item depths
  1531. Set depths.
  1532. @end table
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. A single delay:
  1537. @example
  1538. chorus=0.7:0.9:55:0.4:0.25:2
  1539. @end example
  1540. @item
  1541. Two delays:
  1542. @example
  1543. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1544. @end example
  1545. @item
  1546. Fuller sounding chorus with three delays:
  1547. @example
  1548. 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
  1549. @end example
  1550. @end itemize
  1551. @section compand
  1552. Compress or expand the audio's dynamic range.
  1553. It accepts the following parameters:
  1554. @table @option
  1555. @item attacks
  1556. @item decays
  1557. A list of times in seconds for each channel over which the instantaneous level
  1558. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1559. increase of volume and @var{decays} refers to decrease of volume. For most
  1560. situations, the attack time (response to the audio getting louder) should be
  1561. shorter than the decay time, because the human ear is more sensitive to sudden
  1562. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1563. a typical value for decay is 0.8 seconds.
  1564. If specified number of attacks & decays is lower than number of channels, the last
  1565. set attack/decay will be used for all remaining channels.
  1566. @item points
  1567. A list of points for the transfer function, specified in dB relative to the
  1568. maximum possible signal amplitude. Each key points list must be defined using
  1569. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1570. @code{x0/y0 x1/y1 x2/y2 ....}
  1571. The input values must be in strictly increasing order but the transfer function
  1572. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1573. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1574. function are @code{-70/-70|-60/-20}.
  1575. @item soft-knee
  1576. Set the curve radius in dB for all joints. It defaults to 0.01.
  1577. @item gain
  1578. Set the additional gain in dB to be applied at all points on the transfer
  1579. function. This allows for easy adjustment of the overall gain.
  1580. It defaults to 0.
  1581. @item volume
  1582. Set an initial volume, in dB, to be assumed for each channel when filtering
  1583. starts. This permits the user to supply a nominal level initially, so that, for
  1584. example, a very large gain is not applied to initial signal levels before the
  1585. companding has begun to operate. A typical value for audio which is initially
  1586. quiet is -90 dB. It defaults to 0.
  1587. @item delay
  1588. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1589. delayed before being fed to the volume adjuster. Specifying a delay
  1590. approximately equal to the attack/decay times allows the filter to effectively
  1591. operate in predictive rather than reactive mode. It defaults to 0.
  1592. @end table
  1593. @subsection Examples
  1594. @itemize
  1595. @item
  1596. Make music with both quiet and loud passages suitable for listening to in a
  1597. noisy environment:
  1598. @example
  1599. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1600. @end example
  1601. Another example for audio with whisper and explosion parts:
  1602. @example
  1603. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1604. @end example
  1605. @item
  1606. A noise gate for when the noise is at a lower level than the signal:
  1607. @example
  1608. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1609. @end example
  1610. @item
  1611. Here is another noise gate, this time for when the noise is at a higher level
  1612. than the signal (making it, in some ways, similar to squelch):
  1613. @example
  1614. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1615. @end example
  1616. @item
  1617. 2:1 compression starting at -6dB:
  1618. @example
  1619. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1620. @end example
  1621. @item
  1622. 2:1 compression starting at -9dB:
  1623. @example
  1624. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1625. @end example
  1626. @item
  1627. 2:1 compression starting at -12dB:
  1628. @example
  1629. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1630. @end example
  1631. @item
  1632. 2:1 compression starting at -18dB:
  1633. @example
  1634. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1635. @end example
  1636. @item
  1637. 3:1 compression starting at -15dB:
  1638. @example
  1639. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1640. @end example
  1641. @item
  1642. Compressor/Gate:
  1643. @example
  1644. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1645. @end example
  1646. @item
  1647. Expander:
  1648. @example
  1649. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1650. @end example
  1651. @item
  1652. Hard limiter at -6dB:
  1653. @example
  1654. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1655. @end example
  1656. @item
  1657. Hard limiter at -12dB:
  1658. @example
  1659. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1660. @end example
  1661. @item
  1662. Hard noise gate at -35 dB:
  1663. @example
  1664. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1665. @end example
  1666. @item
  1667. Soft limiter:
  1668. @example
  1669. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1670. @end example
  1671. @end itemize
  1672. @section compensationdelay
  1673. Compensation Delay Line is a metric based delay to compensate differing
  1674. positions of microphones or speakers.
  1675. For example, you have recorded guitar with two microphones placed in
  1676. different location. Because the front of sound wave has fixed speed in
  1677. normal conditions, the phasing of microphones can vary and depends on
  1678. their location and interposition. The best sound mix can be achieved when
  1679. these microphones are in phase (synchronized). Note that distance of
  1680. ~30 cm between microphones makes one microphone to capture signal in
  1681. antiphase to another microphone. That makes the final mix sounding moody.
  1682. This filter helps to solve phasing problems by adding different delays
  1683. to each microphone track and make them synchronized.
  1684. The best result can be reached when you take one track as base and
  1685. synchronize other tracks one by one with it.
  1686. Remember that synchronization/delay tolerance depends on sample rate, too.
  1687. Higher sample rates will give more tolerance.
  1688. It accepts the following parameters:
  1689. @table @option
  1690. @item mm
  1691. Set millimeters distance. This is compensation distance for fine tuning.
  1692. Default is 0.
  1693. @item cm
  1694. Set cm distance. This is compensation distance for tightening distance setup.
  1695. Default is 0.
  1696. @item m
  1697. Set meters distance. This is compensation distance for hard distance setup.
  1698. Default is 0.
  1699. @item dry
  1700. Set dry amount. Amount of unprocessed (dry) signal.
  1701. Default is 0.
  1702. @item wet
  1703. Set wet amount. Amount of processed (wet) signal.
  1704. Default is 1.
  1705. @item temp
  1706. Set temperature degree in Celsius. This is the temperature of the environment.
  1707. Default is 20.
  1708. @end table
  1709. @section crystalizer
  1710. Simple algorithm to expand audio dynamic range.
  1711. The filter accepts the following options:
  1712. @table @option
  1713. @item i
  1714. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1715. (unchanged sound) to 10.0 (maximum effect).
  1716. @item c
  1717. Enable clipping. By default is enabled.
  1718. @end table
  1719. @section dcshift
  1720. Apply a DC shift to the audio.
  1721. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1722. in the recording chain) from the audio. The effect of a DC offset is reduced
  1723. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1724. a signal has a DC offset.
  1725. @table @option
  1726. @item shift
  1727. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1728. the audio.
  1729. @item limitergain
  1730. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1731. used to prevent clipping.
  1732. @end table
  1733. @section dynaudnorm
  1734. Dynamic Audio Normalizer.
  1735. This filter applies a certain amount of gain to the input audio in order
  1736. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1737. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1738. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1739. This allows for applying extra gain to the "quiet" sections of the audio
  1740. while avoiding distortions or clipping the "loud" sections. In other words:
  1741. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1742. sections, in the sense that the volume of each section is brought to the
  1743. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1744. this goal *without* applying "dynamic range compressing". It will retain 100%
  1745. of the dynamic range *within* each section of the audio file.
  1746. @table @option
  1747. @item f
  1748. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1749. Default is 500 milliseconds.
  1750. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1751. referred to as frames. This is required, because a peak magnitude has no
  1752. meaning for just a single sample value. Instead, we need to determine the
  1753. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1754. normalizer would simply use the peak magnitude of the complete file, the
  1755. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1756. frame. The length of a frame is specified in milliseconds. By default, the
  1757. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1758. been found to give good results with most files.
  1759. Note that the exact frame length, in number of samples, will be determined
  1760. automatically, based on the sampling rate of the individual input audio file.
  1761. @item g
  1762. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1763. number. Default is 31.
  1764. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1765. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1766. is specified in frames, centered around the current frame. For the sake of
  1767. simplicity, this must be an odd number. Consequently, the default value of 31
  1768. takes into account the current frame, as well as the 15 preceding frames and
  1769. the 15 subsequent frames. Using a larger window results in a stronger
  1770. smoothing effect and thus in less gain variation, i.e. slower gain
  1771. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1772. effect and thus in more gain variation, i.e. faster gain adaptation.
  1773. In other words, the more you increase this value, the more the Dynamic Audio
  1774. Normalizer will behave like a "traditional" normalization filter. On the
  1775. contrary, the more you decrease this value, the more the Dynamic Audio
  1776. Normalizer will behave like a dynamic range compressor.
  1777. @item p
  1778. Set the target peak value. This specifies the highest permissible magnitude
  1779. level for the normalized audio input. This filter will try to approach the
  1780. target peak magnitude as closely as possible, but at the same time it also
  1781. makes sure that the normalized signal will never exceed the peak magnitude.
  1782. A frame's maximum local gain factor is imposed directly by the target peak
  1783. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1784. It is not recommended to go above this value.
  1785. @item m
  1786. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1787. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1788. factor for each input frame, i.e. the maximum gain factor that does not
  1789. result in clipping or distortion. The maximum gain factor is determined by
  1790. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1791. additionally bounds the frame's maximum gain factor by a predetermined
  1792. (global) maximum gain factor. This is done in order to avoid excessive gain
  1793. factors in "silent" or almost silent frames. By default, the maximum gain
  1794. factor is 10.0, For most inputs the default value should be sufficient and
  1795. it usually is not recommended to increase this value. Though, for input
  1796. with an extremely low overall volume level, it may be necessary to allow even
  1797. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1798. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1799. Instead, a "sigmoid" threshold function will be applied. This way, the
  1800. gain factors will smoothly approach the threshold value, but never exceed that
  1801. value.
  1802. @item r
  1803. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1804. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1805. This means that the maximum local gain factor for each frame is defined
  1806. (only) by the frame's highest magnitude sample. This way, the samples can
  1807. be amplified as much as possible without exceeding the maximum signal
  1808. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1809. Normalizer can also take into account the frame's root mean square,
  1810. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1811. determine the power of a time-varying signal. It is therefore considered
  1812. that the RMS is a better approximation of the "perceived loudness" than
  1813. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1814. frames to a constant RMS value, a uniform "perceived loudness" can be
  1815. established. If a target RMS value has been specified, a frame's local gain
  1816. factor is defined as the factor that would result in exactly that RMS value.
  1817. Note, however, that the maximum local gain factor is still restricted by the
  1818. frame's highest magnitude sample, in order to prevent clipping.
  1819. @item n
  1820. Enable channels coupling. By default is enabled.
  1821. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1822. amount. This means the same gain factor will be applied to all channels, i.e.
  1823. the maximum possible gain factor is determined by the "loudest" channel.
  1824. However, in some recordings, it may happen that the volume of the different
  1825. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1826. In this case, this option can be used to disable the channel coupling. This way,
  1827. the gain factor will be determined independently for each channel, depending
  1828. only on the individual channel's highest magnitude sample. This allows for
  1829. harmonizing the volume of the different channels.
  1830. @item c
  1831. Enable DC bias correction. By default is disabled.
  1832. An audio signal (in the time domain) is a sequence of sample values.
  1833. In the Dynamic Audio Normalizer these sample values are represented in the
  1834. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1835. audio signal, or "waveform", should be centered around the zero point.
  1836. That means if we calculate the mean value of all samples in a file, or in a
  1837. single frame, then the result should be 0.0 or at least very close to that
  1838. value. If, however, there is a significant deviation of the mean value from
  1839. 0.0, in either positive or negative direction, this is referred to as a
  1840. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1841. Audio Normalizer provides optional DC bias correction.
  1842. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1843. the mean value, or "DC correction" offset, of each input frame and subtract
  1844. that value from all of the frame's sample values which ensures those samples
  1845. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1846. boundaries, the DC correction offset values will be interpolated smoothly
  1847. between neighbouring frames.
  1848. @item b
  1849. Enable alternative boundary mode. By default is disabled.
  1850. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1851. around each frame. This includes the preceding frames as well as the
  1852. subsequent frames. However, for the "boundary" frames, located at the very
  1853. beginning and at the very end of the audio file, not all neighbouring
  1854. frames are available. In particular, for the first few frames in the audio
  1855. file, the preceding frames are not known. And, similarly, for the last few
  1856. frames in the audio file, the subsequent frames are not known. Thus, the
  1857. question arises which gain factors should be assumed for the missing frames
  1858. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1859. to deal with this situation. The default boundary mode assumes a gain factor
  1860. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1861. "fade out" at the beginning and at the end of the input, respectively.
  1862. @item s
  1863. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1864. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1865. compression. This means that signal peaks will not be pruned and thus the
  1866. full dynamic range will be retained within each local neighbourhood. However,
  1867. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1868. normalization algorithm with a more "traditional" compression.
  1869. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1870. (thresholding) function. If (and only if) the compression feature is enabled,
  1871. all input frames will be processed by a soft knee thresholding function prior
  1872. to the actual normalization process. Put simply, the thresholding function is
  1873. going to prune all samples whose magnitude exceeds a certain threshold value.
  1874. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1875. value. Instead, the threshold value will be adjusted for each individual
  1876. frame.
  1877. In general, smaller parameters result in stronger compression, and vice versa.
  1878. Values below 3.0 are not recommended, because audible distortion may appear.
  1879. @end table
  1880. @section earwax
  1881. Make audio easier to listen to on headphones.
  1882. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1883. so that when listened to on headphones the stereo image is moved from
  1884. inside your head (standard for headphones) to outside and in front of
  1885. the listener (standard for speakers).
  1886. Ported from SoX.
  1887. @section equalizer
  1888. Apply a two-pole peaking equalisation (EQ) filter. With this
  1889. filter, the signal-level at and around a selected frequency can
  1890. be increased or decreased, whilst (unlike bandpass and bandreject
  1891. filters) that at all other frequencies is unchanged.
  1892. In order to produce complex equalisation curves, this filter can
  1893. be given several times, each with a different central frequency.
  1894. The filter accepts the following options:
  1895. @table @option
  1896. @item frequency, f
  1897. Set the filter's central frequency in Hz.
  1898. @item width_type
  1899. Set method to specify band-width of filter.
  1900. @table @option
  1901. @item h
  1902. Hz
  1903. @item q
  1904. Q-Factor
  1905. @item o
  1906. octave
  1907. @item s
  1908. slope
  1909. @end table
  1910. @item width, w
  1911. Specify the band-width of a filter in width_type units.
  1912. @item gain, g
  1913. Set the required gain or attenuation in dB.
  1914. Beware of clipping when using a positive gain.
  1915. @end table
  1916. @subsection Examples
  1917. @itemize
  1918. @item
  1919. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1920. @example
  1921. equalizer=f=1000:width_type=h:width=200:g=-10
  1922. @end example
  1923. @item
  1924. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1925. @example
  1926. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1927. @end example
  1928. @end itemize
  1929. @section extrastereo
  1930. Linearly increases the difference between left and right channels which
  1931. adds some sort of "live" effect to playback.
  1932. The filter accepts the following options:
  1933. @table @option
  1934. @item m
  1935. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1936. (average of both channels), with 1.0 sound will be unchanged, with
  1937. -1.0 left and right channels will be swapped.
  1938. @item c
  1939. Enable clipping. By default is enabled.
  1940. @end table
  1941. @section firequalizer
  1942. Apply FIR Equalization using arbitrary frequency response.
  1943. The filter accepts the following option:
  1944. @table @option
  1945. @item gain
  1946. Set gain curve equation (in dB). The expression can contain variables:
  1947. @table @option
  1948. @item f
  1949. the evaluated frequency
  1950. @item sr
  1951. sample rate
  1952. @item ch
  1953. channel number, set to 0 when multichannels evaluation is disabled
  1954. @item chid
  1955. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1956. multichannels evaluation is disabled
  1957. @item chs
  1958. number of channels
  1959. @item chlayout
  1960. channel_layout, see libavutil/channel_layout.h
  1961. @end table
  1962. and functions:
  1963. @table @option
  1964. @item gain_interpolate(f)
  1965. interpolate gain on frequency f based on gain_entry
  1966. @item cubic_interpolate(f)
  1967. same as gain_interpolate, but smoother
  1968. @end table
  1969. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1970. @item gain_entry
  1971. Set gain entry for gain_interpolate function. The expression can
  1972. contain functions:
  1973. @table @option
  1974. @item entry(f, g)
  1975. store gain entry at frequency f with value g
  1976. @end table
  1977. This option is also available as command.
  1978. @item delay
  1979. Set filter delay in seconds. Higher value means more accurate.
  1980. Default is @code{0.01}.
  1981. @item accuracy
  1982. Set filter accuracy in Hz. Lower value means more accurate.
  1983. Default is @code{5}.
  1984. @item wfunc
  1985. Set window function. Acceptable values are:
  1986. @table @option
  1987. @item rectangular
  1988. rectangular window, useful when gain curve is already smooth
  1989. @item hann
  1990. hann window (default)
  1991. @item hamming
  1992. hamming window
  1993. @item blackman
  1994. blackman window
  1995. @item nuttall3
  1996. 3-terms continuous 1st derivative nuttall window
  1997. @item mnuttall3
  1998. minimum 3-terms discontinuous nuttall window
  1999. @item nuttall
  2000. 4-terms continuous 1st derivative nuttall window
  2001. @item bnuttall
  2002. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2003. @item bharris
  2004. blackman-harris window
  2005. @item tukey
  2006. tukey window
  2007. @end table
  2008. @item fixed
  2009. If enabled, use fixed number of audio samples. This improves speed when
  2010. filtering with large delay. Default is disabled.
  2011. @item multi
  2012. Enable multichannels evaluation on gain. Default is disabled.
  2013. @item zero_phase
  2014. Enable zero phase mode by subtracting timestamp to compensate delay.
  2015. Default is disabled.
  2016. @item scale
  2017. Set scale used by gain. Acceptable values are:
  2018. @table @option
  2019. @item linlin
  2020. linear frequency, linear gain
  2021. @item linlog
  2022. linear frequency, logarithmic (in dB) gain (default)
  2023. @item loglin
  2024. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2025. @item loglog
  2026. logarithmic frequency, logarithmic gain
  2027. @end table
  2028. @item dumpfile
  2029. Set file for dumping, suitable for gnuplot.
  2030. @item dumpscale
  2031. Set scale for dumpfile. Acceptable values are same with scale option.
  2032. Default is linlog.
  2033. @item fft2
  2034. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2035. Default is disabled.
  2036. @end table
  2037. @subsection Examples
  2038. @itemize
  2039. @item
  2040. lowpass at 1000 Hz:
  2041. @example
  2042. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2043. @end example
  2044. @item
  2045. lowpass at 1000 Hz with gain_entry:
  2046. @example
  2047. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2048. @end example
  2049. @item
  2050. custom equalization:
  2051. @example
  2052. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2053. @end example
  2054. @item
  2055. higher delay with zero phase to compensate delay:
  2056. @example
  2057. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2058. @end example
  2059. @item
  2060. lowpass on left channel, highpass on right channel:
  2061. @example
  2062. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2063. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2064. @end example
  2065. @end itemize
  2066. @section flanger
  2067. Apply a flanging effect to the audio.
  2068. The filter accepts the following options:
  2069. @table @option
  2070. @item delay
  2071. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2072. @item depth
  2073. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2074. @item regen
  2075. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2076. Default value is 0.
  2077. @item width
  2078. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2079. Default value is 71.
  2080. @item speed
  2081. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2082. @item shape
  2083. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2084. Default value is @var{sinusoidal}.
  2085. @item phase
  2086. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2087. Default value is 25.
  2088. @item interp
  2089. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2090. Default is @var{linear}.
  2091. @end table
  2092. @section hdcd
  2093. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2094. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2095. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2096. of HDCD, and detects the Transient Filter flag.
  2097. @example
  2098. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2099. @end example
  2100. When using the filter with wav, note the default encoding for wav is 16-bit,
  2101. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2102. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2103. @example
  2104. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2105. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2106. @end example
  2107. The filter accepts the following options:
  2108. @table @option
  2109. @item disable_autoconvert
  2110. Disable any automatic format conversion or resampling in the filter graph.
  2111. @item process_stereo
  2112. Process the stereo channels together. If target_gain does not match between
  2113. channels, consider it invalid and use the last valid target_gain.
  2114. @item cdt_ms
  2115. Set the code detect timer period in ms.
  2116. @item force_pe
  2117. Always extend peaks above -3dBFS even if PE isn't signaled.
  2118. @item analyze_mode
  2119. Replace audio with a solid tone and adjust the amplitude to signal some
  2120. specific aspect of the decoding process. The output file can be loaded in
  2121. an audio editor alongside the original to aid analysis.
  2122. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2123. Modes are:
  2124. @table @samp
  2125. @item 0, off
  2126. Disabled
  2127. @item 1, lle
  2128. Gain adjustment level at each sample
  2129. @item 2, pe
  2130. Samples where peak extend occurs
  2131. @item 3, cdt
  2132. Samples where the code detect timer is active
  2133. @item 4, tgm
  2134. Samples where the target gain does not match between channels
  2135. @end table
  2136. @end table
  2137. @section highpass
  2138. Apply a high-pass filter with 3dB point frequency.
  2139. The filter can be either single-pole, or double-pole (the default).
  2140. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2141. The filter accepts the following options:
  2142. @table @option
  2143. @item frequency, f
  2144. Set frequency in Hz. Default is 3000.
  2145. @item poles, p
  2146. Set number of poles. Default is 2.
  2147. @item width_type
  2148. Set method to specify band-width of filter.
  2149. @table @option
  2150. @item h
  2151. Hz
  2152. @item q
  2153. Q-Factor
  2154. @item o
  2155. octave
  2156. @item s
  2157. slope
  2158. @end table
  2159. @item width, w
  2160. Specify the band-width of a filter in width_type units.
  2161. Applies only to double-pole filter.
  2162. The default is 0.707q and gives a Butterworth response.
  2163. @end table
  2164. @section join
  2165. Join multiple input streams into one multi-channel stream.
  2166. It accepts the following parameters:
  2167. @table @option
  2168. @item inputs
  2169. The number of input streams. It defaults to 2.
  2170. @item channel_layout
  2171. The desired output channel layout. It defaults to stereo.
  2172. @item map
  2173. Map channels from inputs to output. The argument is a '|'-separated list of
  2174. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2175. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2176. can be either the name of the input channel (e.g. FL for front left) or its
  2177. index in the specified input stream. @var{out_channel} is the name of the output
  2178. channel.
  2179. @end table
  2180. The filter will attempt to guess the mappings when they are not specified
  2181. explicitly. It does so by first trying to find an unused matching input channel
  2182. and if that fails it picks the first unused input channel.
  2183. Join 3 inputs (with properly set channel layouts):
  2184. @example
  2185. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2186. @end example
  2187. Build a 5.1 output from 6 single-channel streams:
  2188. @example
  2189. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2190. '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'
  2191. out
  2192. @end example
  2193. @section ladspa
  2194. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2195. To enable compilation of this filter you need to configure FFmpeg with
  2196. @code{--enable-ladspa}.
  2197. @table @option
  2198. @item file, f
  2199. Specifies the name of LADSPA plugin library to load. If the environment
  2200. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2201. each one of the directories specified by the colon separated list in
  2202. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2203. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2204. @file{/usr/lib/ladspa/}.
  2205. @item plugin, p
  2206. Specifies the plugin within the library. Some libraries contain only
  2207. one plugin, but others contain many of them. If this is not set filter
  2208. will list all available plugins within the specified library.
  2209. @item controls, c
  2210. Set the '|' separated list of controls which are zero or more floating point
  2211. values that determine the behavior of the loaded plugin (for example delay,
  2212. threshold or gain).
  2213. Controls need to be defined using the following syntax:
  2214. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2215. @var{valuei} is the value set on the @var{i}-th control.
  2216. Alternatively they can be also defined using the following syntax:
  2217. @var{value0}|@var{value1}|@var{value2}|..., where
  2218. @var{valuei} is the value set on the @var{i}-th control.
  2219. If @option{controls} is set to @code{help}, all available controls and
  2220. their valid ranges are printed.
  2221. @item sample_rate, s
  2222. Specify the sample rate, default to 44100. Only used if plugin have
  2223. zero inputs.
  2224. @item nb_samples, n
  2225. Set the number of samples per channel per each output frame, default
  2226. is 1024. Only used if plugin have zero inputs.
  2227. @item duration, d
  2228. Set the minimum duration of the sourced audio. See
  2229. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2230. for the accepted syntax.
  2231. Note that the resulting duration may be greater than the specified duration,
  2232. as the generated audio is always cut at the end of a complete frame.
  2233. If not specified, or the expressed duration is negative, the audio is
  2234. supposed to be generated forever.
  2235. Only used if plugin have zero inputs.
  2236. @end table
  2237. @subsection Examples
  2238. @itemize
  2239. @item
  2240. List all available plugins within amp (LADSPA example plugin) library:
  2241. @example
  2242. ladspa=file=amp
  2243. @end example
  2244. @item
  2245. List all available controls and their valid ranges for @code{vcf_notch}
  2246. plugin from @code{VCF} library:
  2247. @example
  2248. ladspa=f=vcf:p=vcf_notch:c=help
  2249. @end example
  2250. @item
  2251. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2252. plugin library:
  2253. @example
  2254. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2255. @end example
  2256. @item
  2257. Add reverberation to the audio using TAP-plugins
  2258. (Tom's Audio Processing plugins):
  2259. @example
  2260. ladspa=file=tap_reverb:tap_reverb
  2261. @end example
  2262. @item
  2263. Generate white noise, with 0.2 amplitude:
  2264. @example
  2265. ladspa=file=cmt:noise_source_white:c=c0=.2
  2266. @end example
  2267. @item
  2268. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2269. @code{C* Audio Plugin Suite} (CAPS) library:
  2270. @example
  2271. ladspa=file=caps:Click:c=c1=20'
  2272. @end example
  2273. @item
  2274. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2275. @example
  2276. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2277. @end example
  2278. @item
  2279. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2280. @code{SWH Plugins} collection:
  2281. @example
  2282. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2283. @end example
  2284. @item
  2285. Attenuate low frequencies using Multiband EQ from Steve Harris
  2286. @code{SWH Plugins} collection:
  2287. @example
  2288. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2289. @end example
  2290. @end itemize
  2291. @subsection Commands
  2292. This filter supports the following commands:
  2293. @table @option
  2294. @item cN
  2295. Modify the @var{N}-th control value.
  2296. If the specified value is not valid, it is ignored and prior one is kept.
  2297. @end table
  2298. @section loudnorm
  2299. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2300. Support for both single pass (livestreams, files) and double pass (files) modes.
  2301. This algorithm can target IL, LRA, and maximum true peak.
  2302. To enable compilation of this filter you need to configure FFmpeg with
  2303. @code{--enable-libebur128}.
  2304. The filter accepts the following options:
  2305. @table @option
  2306. @item I, i
  2307. Set integrated loudness target.
  2308. Range is -70.0 - -5.0. Default value is -24.0.
  2309. @item LRA, lra
  2310. Set loudness range target.
  2311. Range is 1.0 - 20.0. Default value is 7.0.
  2312. @item TP, tp
  2313. Set maximum true peak.
  2314. Range is -9.0 - +0.0. Default value is -2.0.
  2315. @item measured_I, measured_i
  2316. Measured IL of input file.
  2317. Range is -99.0 - +0.0.
  2318. @item measured_LRA, measured_lra
  2319. Measured LRA of input file.
  2320. Range is 0.0 - 99.0.
  2321. @item measured_TP, measured_tp
  2322. Measured true peak of input file.
  2323. Range is -99.0 - +99.0.
  2324. @item measured_thresh
  2325. Measured threshold of input file.
  2326. Range is -99.0 - +0.0.
  2327. @item offset
  2328. Set offset gain. Gain is applied before the true-peak limiter.
  2329. Range is -99.0 - +99.0. Default is +0.0.
  2330. @item linear
  2331. Normalize linearly if possible.
  2332. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2333. to be specified in order to use this mode.
  2334. Options are true or false. Default is true.
  2335. @item dual_mono
  2336. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2337. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2338. If set to @code{true}, this option will compensate for this effect.
  2339. Multi-channel input files are not affected by this option.
  2340. Options are true or false. Default is false.
  2341. @item print_format
  2342. Set print format for stats. Options are summary, json, or none.
  2343. Default value is none.
  2344. @end table
  2345. @section lowpass
  2346. Apply a low-pass filter with 3dB point frequency.
  2347. The filter can be either single-pole or double-pole (the default).
  2348. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2349. The filter accepts the following options:
  2350. @table @option
  2351. @item frequency, f
  2352. Set frequency in Hz. Default is 500.
  2353. @item poles, p
  2354. Set number of poles. Default is 2.
  2355. @item width_type
  2356. Set method to specify band-width of filter.
  2357. @table @option
  2358. @item h
  2359. Hz
  2360. @item q
  2361. Q-Factor
  2362. @item o
  2363. octave
  2364. @item s
  2365. slope
  2366. @end table
  2367. @item width, w
  2368. Specify the band-width of a filter in width_type units.
  2369. Applies only to double-pole filter.
  2370. The default is 0.707q and gives a Butterworth response.
  2371. @end table
  2372. @anchor{pan}
  2373. @section pan
  2374. Mix channels with specific gain levels. The filter accepts the output
  2375. channel layout followed by a set of channels definitions.
  2376. This filter is also designed to efficiently remap the channels of an audio
  2377. stream.
  2378. The filter accepts parameters of the form:
  2379. "@var{l}|@var{outdef}|@var{outdef}|..."
  2380. @table @option
  2381. @item l
  2382. output channel layout or number of channels
  2383. @item outdef
  2384. output channel specification, of the form:
  2385. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2386. @item out_name
  2387. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2388. number (c0, c1, etc.)
  2389. @item gain
  2390. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2391. @item in_name
  2392. input channel to use, see out_name for details; it is not possible to mix
  2393. named and numbered input channels
  2394. @end table
  2395. If the `=' in a channel specification is replaced by `<', then the gains for
  2396. that specification will be renormalized so that the total is 1, thus
  2397. avoiding clipping noise.
  2398. @subsection Mixing examples
  2399. For example, if you want to down-mix from stereo to mono, but with a bigger
  2400. factor for the left channel:
  2401. @example
  2402. pan=1c|c0=0.9*c0+0.1*c1
  2403. @end example
  2404. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2405. 7-channels surround:
  2406. @example
  2407. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2408. @end example
  2409. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2410. that should be preferred (see "-ac" option) unless you have very specific
  2411. needs.
  2412. @subsection Remapping examples
  2413. The channel remapping will be effective if, and only if:
  2414. @itemize
  2415. @item gain coefficients are zeroes or ones,
  2416. @item only one input per channel output,
  2417. @end itemize
  2418. If all these conditions are satisfied, the filter will notify the user ("Pure
  2419. channel mapping detected"), and use an optimized and lossless method to do the
  2420. remapping.
  2421. For example, if you have a 5.1 source and want a stereo audio stream by
  2422. dropping the extra channels:
  2423. @example
  2424. pan="stereo| c0=FL | c1=FR"
  2425. @end example
  2426. Given the same source, you can also switch front left and front right channels
  2427. and keep the input channel layout:
  2428. @example
  2429. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2430. @end example
  2431. If the input is a stereo audio stream, you can mute the front left channel (and
  2432. still keep the stereo channel layout) with:
  2433. @example
  2434. pan="stereo|c1=c1"
  2435. @end example
  2436. Still with a stereo audio stream input, you can copy the right channel in both
  2437. front left and right:
  2438. @example
  2439. pan="stereo| c0=FR | c1=FR"
  2440. @end example
  2441. @section replaygain
  2442. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2443. outputs it unchanged.
  2444. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2445. @section resample
  2446. Convert the audio sample format, sample rate and channel layout. It is
  2447. not meant to be used directly.
  2448. @section rubberband
  2449. Apply time-stretching and pitch-shifting with librubberband.
  2450. The filter accepts the following options:
  2451. @table @option
  2452. @item tempo
  2453. Set tempo scale factor.
  2454. @item pitch
  2455. Set pitch scale factor.
  2456. @item transients
  2457. Set transients detector.
  2458. Possible values are:
  2459. @table @var
  2460. @item crisp
  2461. @item mixed
  2462. @item smooth
  2463. @end table
  2464. @item detector
  2465. Set detector.
  2466. Possible values are:
  2467. @table @var
  2468. @item compound
  2469. @item percussive
  2470. @item soft
  2471. @end table
  2472. @item phase
  2473. Set phase.
  2474. Possible values are:
  2475. @table @var
  2476. @item laminar
  2477. @item independent
  2478. @end table
  2479. @item window
  2480. Set processing window size.
  2481. Possible values are:
  2482. @table @var
  2483. @item standard
  2484. @item short
  2485. @item long
  2486. @end table
  2487. @item smoothing
  2488. Set smoothing.
  2489. Possible values are:
  2490. @table @var
  2491. @item off
  2492. @item on
  2493. @end table
  2494. @item formant
  2495. Enable formant preservation when shift pitching.
  2496. Possible values are:
  2497. @table @var
  2498. @item shifted
  2499. @item preserved
  2500. @end table
  2501. @item pitchq
  2502. Set pitch quality.
  2503. Possible values are:
  2504. @table @var
  2505. @item quality
  2506. @item speed
  2507. @item consistency
  2508. @end table
  2509. @item channels
  2510. Set channels.
  2511. Possible values are:
  2512. @table @var
  2513. @item apart
  2514. @item together
  2515. @end table
  2516. @end table
  2517. @section sidechaincompress
  2518. This filter acts like normal compressor but has the ability to compress
  2519. detected signal using second input signal.
  2520. It needs two input streams and returns one output stream.
  2521. First input stream will be processed depending on second stream signal.
  2522. The filtered signal then can be filtered with other filters in later stages of
  2523. processing. See @ref{pan} and @ref{amerge} filter.
  2524. The filter accepts the following options:
  2525. @table @option
  2526. @item level_in
  2527. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2528. @item threshold
  2529. If a signal of second stream raises above this level it will affect the gain
  2530. reduction of first stream.
  2531. By default is 0.125. Range is between 0.00097563 and 1.
  2532. @item ratio
  2533. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2534. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2535. Default is 2. Range is between 1 and 20.
  2536. @item attack
  2537. Amount of milliseconds the signal has to rise above the threshold before gain
  2538. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2539. @item release
  2540. Amount of milliseconds the signal has to fall below the threshold before
  2541. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2542. @item makeup
  2543. Set the amount by how much signal will be amplified after processing.
  2544. Default is 2. Range is from 1 and 64.
  2545. @item knee
  2546. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2547. Default is 2.82843. Range is between 1 and 8.
  2548. @item link
  2549. Choose if the @code{average} level between all channels of side-chain stream
  2550. or the louder(@code{maximum}) channel of side-chain stream affects the
  2551. reduction. Default is @code{average}.
  2552. @item detection
  2553. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2554. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2555. @item level_sc
  2556. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2557. @item mix
  2558. How much to use compressed signal in output. Default is 1.
  2559. Range is between 0 and 1.
  2560. @end table
  2561. @subsection Examples
  2562. @itemize
  2563. @item
  2564. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2565. depending on the signal of 2nd input and later compressed signal to be
  2566. merged with 2nd input:
  2567. @example
  2568. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2569. @end example
  2570. @end itemize
  2571. @section sidechaingate
  2572. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2573. filter the detected signal before sending it to the gain reduction stage.
  2574. Normally a gate uses the full range signal to detect a level above the
  2575. threshold.
  2576. For example: If you cut all lower frequencies from your sidechain signal
  2577. the gate will decrease the volume of your track only if not enough highs
  2578. appear. With this technique you are able to reduce the resonation of a
  2579. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2580. guitar.
  2581. It needs two input streams and returns one output stream.
  2582. First input stream will be processed depending on second stream signal.
  2583. The filter accepts the following options:
  2584. @table @option
  2585. @item level_in
  2586. Set input level before filtering.
  2587. Default is 1. Allowed range is from 0.015625 to 64.
  2588. @item range
  2589. Set the level of gain reduction when the signal is below the threshold.
  2590. Default is 0.06125. Allowed range is from 0 to 1.
  2591. @item threshold
  2592. If a signal rises above this level the gain reduction is released.
  2593. Default is 0.125. Allowed range is from 0 to 1.
  2594. @item ratio
  2595. Set a ratio about which the signal is reduced.
  2596. Default is 2. Allowed range is from 1 to 9000.
  2597. @item attack
  2598. Amount of milliseconds the signal has to rise above the threshold before gain
  2599. reduction stops.
  2600. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2601. @item release
  2602. Amount of milliseconds the signal has to fall below the threshold before the
  2603. reduction is increased again. Default is 250 milliseconds.
  2604. Allowed range is from 0.01 to 9000.
  2605. @item makeup
  2606. Set amount of amplification of signal after processing.
  2607. Default is 1. Allowed range is from 1 to 64.
  2608. @item knee
  2609. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2610. Default is 2.828427125. Allowed range is from 1 to 8.
  2611. @item detection
  2612. Choose if exact signal should be taken for detection or an RMS like one.
  2613. Default is rms. Can be peak or rms.
  2614. @item link
  2615. Choose if the average level between all channels or the louder channel affects
  2616. the reduction.
  2617. Default is average. Can be average or maximum.
  2618. @item level_sc
  2619. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2620. @end table
  2621. @section silencedetect
  2622. Detect silence in an audio stream.
  2623. This filter logs a message when it detects that the input audio volume is less
  2624. or equal to a noise tolerance value for a duration greater or equal to the
  2625. minimum detected noise duration.
  2626. The printed times and duration are expressed in seconds.
  2627. The filter accepts the following options:
  2628. @table @option
  2629. @item duration, d
  2630. Set silence duration until notification (default is 2 seconds).
  2631. @item noise, n
  2632. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2633. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2634. @end table
  2635. @subsection Examples
  2636. @itemize
  2637. @item
  2638. Detect 5 seconds of silence with -50dB noise tolerance:
  2639. @example
  2640. silencedetect=n=-50dB:d=5
  2641. @end example
  2642. @item
  2643. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2644. tolerance in @file{silence.mp3}:
  2645. @example
  2646. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2647. @end example
  2648. @end itemize
  2649. @section silenceremove
  2650. Remove silence from the beginning, middle or end of the audio.
  2651. The filter accepts the following options:
  2652. @table @option
  2653. @item start_periods
  2654. This value is used to indicate if audio should be trimmed at beginning of
  2655. the audio. A value of zero indicates no silence should be trimmed from the
  2656. beginning. When specifying a non-zero value, it trims audio up until it
  2657. finds non-silence. Normally, when trimming silence from beginning of audio
  2658. the @var{start_periods} will be @code{1} but it can be increased to higher
  2659. values to trim all audio up to specific count of non-silence periods.
  2660. Default value is @code{0}.
  2661. @item start_duration
  2662. Specify the amount of time that non-silence must be detected before it stops
  2663. trimming audio. By increasing the duration, bursts of noises can be treated
  2664. as silence and trimmed off. Default value is @code{0}.
  2665. @item start_threshold
  2666. This indicates what sample value should be treated as silence. For digital
  2667. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2668. you may wish to increase the value to account for background noise.
  2669. Can be specified in dB (in case "dB" is appended to the specified value)
  2670. or amplitude ratio. Default value is @code{0}.
  2671. @item stop_periods
  2672. Set the count for trimming silence from the end of audio.
  2673. To remove silence from the middle of a file, specify a @var{stop_periods}
  2674. that is negative. This value is then treated as a positive value and is
  2675. used to indicate the effect should restart processing as specified by
  2676. @var{start_periods}, making it suitable for removing periods of silence
  2677. in the middle of the audio.
  2678. Default value is @code{0}.
  2679. @item stop_duration
  2680. Specify a duration of silence that must exist before audio is not copied any
  2681. more. By specifying a higher duration, silence that is wanted can be left in
  2682. the audio.
  2683. Default value is @code{0}.
  2684. @item stop_threshold
  2685. This is the same as @option{start_threshold} but for trimming silence from
  2686. the end of audio.
  2687. Can be specified in dB (in case "dB" is appended to the specified value)
  2688. or amplitude ratio. Default value is @code{0}.
  2689. @item leave_silence
  2690. This indicates that @var{stop_duration} length of audio should be left intact
  2691. at the beginning of each period of silence.
  2692. For example, if you want to remove long pauses between words but do not want
  2693. to remove the pauses completely. Default value is @code{0}.
  2694. @item detection
  2695. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2696. and works better with digital silence which is exactly 0.
  2697. Default value is @code{rms}.
  2698. @item window
  2699. Set ratio used to calculate size of window for detecting silence.
  2700. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2701. @end table
  2702. @subsection Examples
  2703. @itemize
  2704. @item
  2705. The following example shows how this filter can be used to start a recording
  2706. that does not contain the delay at the start which usually occurs between
  2707. pressing the record button and the start of the performance:
  2708. @example
  2709. silenceremove=1:5:0.02
  2710. @end example
  2711. @item
  2712. Trim all silence encountered from beginning to end where there is more than 1
  2713. second of silence in audio:
  2714. @example
  2715. silenceremove=0:0:0:-1:1:-90dB
  2716. @end example
  2717. @end itemize
  2718. @section sofalizer
  2719. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2720. loudspeakers around the user for binaural listening via headphones (audio
  2721. formats up to 9 channels supported).
  2722. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2723. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2724. Austrian Academy of Sciences.
  2725. To enable compilation of this filter you need to configure FFmpeg with
  2726. @code{--enable-netcdf}.
  2727. The filter accepts the following options:
  2728. @table @option
  2729. @item sofa
  2730. Set the SOFA file used for rendering.
  2731. @item gain
  2732. Set gain applied to audio. Value is in dB. Default is 0.
  2733. @item rotation
  2734. Set rotation of virtual loudspeakers in deg. Default is 0.
  2735. @item elevation
  2736. Set elevation of virtual speakers in deg. Default is 0.
  2737. @item radius
  2738. Set distance in meters between loudspeakers and the listener with near-field
  2739. HRTFs. Default is 1.
  2740. @item type
  2741. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2742. processing audio in time domain which is slow.
  2743. @var{freq} is processing audio in frequency domain which is fast.
  2744. Default is @var{freq}.
  2745. @item speakers
  2746. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2747. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2748. Each virtual loudspeaker is described with short channel name following with
  2749. azimuth and elevation in degreees.
  2750. Each virtual loudspeaker description is separated by '|'.
  2751. For example to override front left and front right channel positions use:
  2752. 'speakers=FL 45 15|FR 345 15'.
  2753. Descriptions with unrecognised channel names are ignored.
  2754. @end table
  2755. @subsection Examples
  2756. @itemize
  2757. @item
  2758. Using ClubFritz6 sofa file:
  2759. @example
  2760. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2761. @end example
  2762. @item
  2763. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2764. @example
  2765. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2766. @end example
  2767. @item
  2768. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2769. and also with custom gain:
  2770. @example
  2771. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2772. @end example
  2773. @end itemize
  2774. @section stereotools
  2775. This filter has some handy utilities to manage stereo signals, for converting
  2776. M/S stereo recordings to L/R signal while having control over the parameters
  2777. or spreading the stereo image of master track.
  2778. The filter accepts the following options:
  2779. @table @option
  2780. @item level_in
  2781. Set input level before filtering for both channels. Defaults is 1.
  2782. Allowed range is from 0.015625 to 64.
  2783. @item level_out
  2784. Set output level after filtering for both channels. Defaults is 1.
  2785. Allowed range is from 0.015625 to 64.
  2786. @item balance_in
  2787. Set input balance between both channels. Default is 0.
  2788. Allowed range is from -1 to 1.
  2789. @item balance_out
  2790. Set output balance between both channels. Default is 0.
  2791. Allowed range is from -1 to 1.
  2792. @item softclip
  2793. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2794. clipping. Disabled by default.
  2795. @item mutel
  2796. Mute the left channel. Disabled by default.
  2797. @item muter
  2798. Mute the right channel. Disabled by default.
  2799. @item phasel
  2800. Change the phase of the left channel. Disabled by default.
  2801. @item phaser
  2802. Change the phase of the right channel. Disabled by default.
  2803. @item mode
  2804. Set stereo mode. Available values are:
  2805. @table @samp
  2806. @item lr>lr
  2807. Left/Right to Left/Right, this is default.
  2808. @item lr>ms
  2809. Left/Right to Mid/Side.
  2810. @item ms>lr
  2811. Mid/Side to Left/Right.
  2812. @item lr>ll
  2813. Left/Right to Left/Left.
  2814. @item lr>rr
  2815. Left/Right to Right/Right.
  2816. @item lr>l+r
  2817. Left/Right to Left + Right.
  2818. @item lr>rl
  2819. Left/Right to Right/Left.
  2820. @end table
  2821. @item slev
  2822. Set level of side signal. Default is 1.
  2823. Allowed range is from 0.015625 to 64.
  2824. @item sbal
  2825. Set balance of side signal. Default is 0.
  2826. Allowed range is from -1 to 1.
  2827. @item mlev
  2828. Set level of the middle signal. Default is 1.
  2829. Allowed range is from 0.015625 to 64.
  2830. @item mpan
  2831. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2832. @item base
  2833. Set stereo base between mono and inversed channels. Default is 0.
  2834. Allowed range is from -1 to 1.
  2835. @item delay
  2836. Set delay in milliseconds how much to delay left from right channel and
  2837. vice versa. Default is 0. Allowed range is from -20 to 20.
  2838. @item sclevel
  2839. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2840. @item phase
  2841. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2842. @end table
  2843. @subsection Examples
  2844. @itemize
  2845. @item
  2846. Apply karaoke like effect:
  2847. @example
  2848. stereotools=mlev=0.015625
  2849. @end example
  2850. @item
  2851. Convert M/S signal to L/R:
  2852. @example
  2853. "stereotools=mode=ms>lr"
  2854. @end example
  2855. @end itemize
  2856. @section stereowiden
  2857. This filter enhance the stereo effect by suppressing signal common to both
  2858. channels and by delaying the signal of left into right and vice versa,
  2859. thereby widening the stereo effect.
  2860. The filter accepts the following options:
  2861. @table @option
  2862. @item delay
  2863. Time in milliseconds of the delay of left signal into right and vice versa.
  2864. Default is 20 milliseconds.
  2865. @item feedback
  2866. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2867. effect of left signal in right output and vice versa which gives widening
  2868. effect. Default is 0.3.
  2869. @item crossfeed
  2870. Cross feed of left into right with inverted phase. This helps in suppressing
  2871. the mono. If the value is 1 it will cancel all the signal common to both
  2872. channels. Default is 0.3.
  2873. @item drymix
  2874. Set level of input signal of original channel. Default is 0.8.
  2875. @end table
  2876. @section treble
  2877. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2878. shelving filter with a response similar to that of a standard
  2879. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2880. The filter accepts the following options:
  2881. @table @option
  2882. @item gain, g
  2883. Give the gain at whichever is the lower of ~22 kHz and the
  2884. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2885. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2886. @item frequency, f
  2887. Set the filter's central frequency and so can be used
  2888. to extend or reduce the frequency range to be boosted or cut.
  2889. The default value is @code{3000} Hz.
  2890. @item width_type
  2891. Set method to specify band-width of filter.
  2892. @table @option
  2893. @item h
  2894. Hz
  2895. @item q
  2896. Q-Factor
  2897. @item o
  2898. octave
  2899. @item s
  2900. slope
  2901. @end table
  2902. @item width, w
  2903. Determine how steep is the filter's shelf transition.
  2904. @end table
  2905. @section tremolo
  2906. Sinusoidal amplitude modulation.
  2907. The filter accepts the following options:
  2908. @table @option
  2909. @item f
  2910. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2911. (20 Hz or lower) will result in a tremolo effect.
  2912. This filter may also be used as a ring modulator by specifying
  2913. a modulation frequency higher than 20 Hz.
  2914. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2915. @item d
  2916. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2917. Default value is 0.5.
  2918. @end table
  2919. @section vibrato
  2920. Sinusoidal phase modulation.
  2921. The filter accepts the following options:
  2922. @table @option
  2923. @item f
  2924. Modulation frequency in Hertz.
  2925. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2926. @item d
  2927. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2928. Default value is 0.5.
  2929. @end table
  2930. @section volume
  2931. Adjust the input audio volume.
  2932. It accepts the following parameters:
  2933. @table @option
  2934. @item volume
  2935. Set audio volume expression.
  2936. Output values are clipped to the maximum value.
  2937. The output audio volume is given by the relation:
  2938. @example
  2939. @var{output_volume} = @var{volume} * @var{input_volume}
  2940. @end example
  2941. The default value for @var{volume} is "1.0".
  2942. @item precision
  2943. This parameter represents the mathematical precision.
  2944. It determines which input sample formats will be allowed, which affects the
  2945. precision of the volume scaling.
  2946. @table @option
  2947. @item fixed
  2948. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2949. @item float
  2950. 32-bit floating-point; this limits input sample format to FLT. (default)
  2951. @item double
  2952. 64-bit floating-point; this limits input sample format to DBL.
  2953. @end table
  2954. @item replaygain
  2955. Choose the behaviour on encountering ReplayGain side data in input frames.
  2956. @table @option
  2957. @item drop
  2958. Remove ReplayGain side data, ignoring its contents (the default).
  2959. @item ignore
  2960. Ignore ReplayGain side data, but leave it in the frame.
  2961. @item track
  2962. Prefer the track gain, if present.
  2963. @item album
  2964. Prefer the album gain, if present.
  2965. @end table
  2966. @item replaygain_preamp
  2967. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2968. Default value for @var{replaygain_preamp} is 0.0.
  2969. @item eval
  2970. Set when the volume expression is evaluated.
  2971. It accepts the following values:
  2972. @table @samp
  2973. @item once
  2974. only evaluate expression once during the filter initialization, or
  2975. when the @samp{volume} command is sent
  2976. @item frame
  2977. evaluate expression for each incoming frame
  2978. @end table
  2979. Default value is @samp{once}.
  2980. @end table
  2981. The volume expression can contain the following parameters.
  2982. @table @option
  2983. @item n
  2984. frame number (starting at zero)
  2985. @item nb_channels
  2986. number of channels
  2987. @item nb_consumed_samples
  2988. number of samples consumed by the filter
  2989. @item nb_samples
  2990. number of samples in the current frame
  2991. @item pos
  2992. original frame position in the file
  2993. @item pts
  2994. frame PTS
  2995. @item sample_rate
  2996. sample rate
  2997. @item startpts
  2998. PTS at start of stream
  2999. @item startt
  3000. time at start of stream
  3001. @item t
  3002. frame time
  3003. @item tb
  3004. timestamp timebase
  3005. @item volume
  3006. last set volume value
  3007. @end table
  3008. Note that when @option{eval} is set to @samp{once} only the
  3009. @var{sample_rate} and @var{tb} variables are available, all other
  3010. variables will evaluate to NAN.
  3011. @subsection Commands
  3012. This filter supports the following commands:
  3013. @table @option
  3014. @item volume
  3015. Modify the volume expression.
  3016. The command accepts the same syntax of the corresponding option.
  3017. If the specified expression is not valid, it is kept at its current
  3018. value.
  3019. @item replaygain_noclip
  3020. Prevent clipping by limiting the gain applied.
  3021. Default value for @var{replaygain_noclip} is 1.
  3022. @end table
  3023. @subsection Examples
  3024. @itemize
  3025. @item
  3026. Halve the input audio volume:
  3027. @example
  3028. volume=volume=0.5
  3029. volume=volume=1/2
  3030. volume=volume=-6.0206dB
  3031. @end example
  3032. In all the above example the named key for @option{volume} can be
  3033. omitted, for example like in:
  3034. @example
  3035. volume=0.5
  3036. @end example
  3037. @item
  3038. Increase input audio power by 6 decibels using fixed-point precision:
  3039. @example
  3040. volume=volume=6dB:precision=fixed
  3041. @end example
  3042. @item
  3043. Fade volume after time 10 with an annihilation period of 5 seconds:
  3044. @example
  3045. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3046. @end example
  3047. @end itemize
  3048. @section volumedetect
  3049. Detect the volume of the input video.
  3050. The filter has no parameters. The input is not modified. Statistics about
  3051. the volume will be printed in the log when the input stream end is reached.
  3052. In particular it will show the mean volume (root mean square), maximum
  3053. volume (on a per-sample basis), and the beginning of a histogram of the
  3054. registered volume values (from the maximum value to a cumulated 1/1000 of
  3055. the samples).
  3056. All volumes are in decibels relative to the maximum PCM value.
  3057. @subsection Examples
  3058. Here is an excerpt of the output:
  3059. @example
  3060. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3061. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3062. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3063. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3064. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3065. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3066. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3067. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3068. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3069. @end example
  3070. It means that:
  3071. @itemize
  3072. @item
  3073. The mean square energy is approximately -27 dB, or 10^-2.7.
  3074. @item
  3075. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3076. @item
  3077. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3078. @end itemize
  3079. In other words, raising the volume by +4 dB does not cause any clipping,
  3080. raising it by +5 dB causes clipping for 6 samples, etc.
  3081. @c man end AUDIO FILTERS
  3082. @chapter Audio Sources
  3083. @c man begin AUDIO SOURCES
  3084. Below is a description of the currently available audio sources.
  3085. @section abuffer
  3086. Buffer audio frames, and make them available to the filter chain.
  3087. This source is mainly intended for a programmatic use, in particular
  3088. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3089. It accepts the following parameters:
  3090. @table @option
  3091. @item time_base
  3092. The timebase which will be used for timestamps of submitted frames. It must be
  3093. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3094. @item sample_rate
  3095. The sample rate of the incoming audio buffers.
  3096. @item sample_fmt
  3097. The sample format of the incoming audio buffers.
  3098. Either a sample format name or its corresponding integer representation from
  3099. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3100. @item channel_layout
  3101. The channel layout of the incoming audio buffers.
  3102. Either a channel layout name from channel_layout_map in
  3103. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3104. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3105. @item channels
  3106. The number of channels of the incoming audio buffers.
  3107. If both @var{channels} and @var{channel_layout} are specified, then they
  3108. must be consistent.
  3109. @end table
  3110. @subsection Examples
  3111. @example
  3112. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3113. @end example
  3114. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3115. Since the sample format with name "s16p" corresponds to the number
  3116. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3117. equivalent to:
  3118. @example
  3119. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3120. @end example
  3121. @section aevalsrc
  3122. Generate an audio signal specified by an expression.
  3123. This source accepts in input one or more expressions (one for each
  3124. channel), which are evaluated and used to generate a corresponding
  3125. audio signal.
  3126. This source accepts the following options:
  3127. @table @option
  3128. @item exprs
  3129. Set the '|'-separated expressions list for each separate channel. In case the
  3130. @option{channel_layout} option is not specified, the selected channel layout
  3131. depends on the number of provided expressions. Otherwise the last
  3132. specified expression is applied to the remaining output channels.
  3133. @item channel_layout, c
  3134. Set the channel layout. The number of channels in the specified layout
  3135. must be equal to the number of specified expressions.
  3136. @item duration, d
  3137. Set the minimum duration of the sourced audio. See
  3138. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3139. for the accepted syntax.
  3140. Note that the resulting duration may be greater than the specified
  3141. duration, as the generated audio is always cut at the end of a
  3142. complete frame.
  3143. If not specified, or the expressed duration is negative, the audio is
  3144. supposed to be generated forever.
  3145. @item nb_samples, n
  3146. Set the number of samples per channel per each output frame,
  3147. default to 1024.
  3148. @item sample_rate, s
  3149. Specify the sample rate, default to 44100.
  3150. @end table
  3151. Each expression in @var{exprs} can contain the following constants:
  3152. @table @option
  3153. @item n
  3154. number of the evaluated sample, starting from 0
  3155. @item t
  3156. time of the evaluated sample expressed in seconds, starting from 0
  3157. @item s
  3158. sample rate
  3159. @end table
  3160. @subsection Examples
  3161. @itemize
  3162. @item
  3163. Generate silence:
  3164. @example
  3165. aevalsrc=0
  3166. @end example
  3167. @item
  3168. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3169. 8000 Hz:
  3170. @example
  3171. aevalsrc="sin(440*2*PI*t):s=8000"
  3172. @end example
  3173. @item
  3174. Generate a two channels signal, specify the channel layout (Front
  3175. Center + Back Center) explicitly:
  3176. @example
  3177. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3178. @end example
  3179. @item
  3180. Generate white noise:
  3181. @example
  3182. aevalsrc="-2+random(0)"
  3183. @end example
  3184. @item
  3185. Generate an amplitude modulated signal:
  3186. @example
  3187. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3188. @end example
  3189. @item
  3190. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3191. @example
  3192. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3193. @end example
  3194. @end itemize
  3195. @section anullsrc
  3196. The null audio source, return unprocessed audio frames. It is mainly useful
  3197. as a template and to be employed in analysis / debugging tools, or as
  3198. the source for filters which ignore the input data (for example the sox
  3199. synth filter).
  3200. This source accepts the following options:
  3201. @table @option
  3202. @item channel_layout, cl
  3203. Specifies the channel layout, and can be either an integer or a string
  3204. representing a channel layout. The default value of @var{channel_layout}
  3205. is "stereo".
  3206. Check the channel_layout_map definition in
  3207. @file{libavutil/channel_layout.c} for the mapping between strings and
  3208. channel layout values.
  3209. @item sample_rate, r
  3210. Specifies the sample rate, and defaults to 44100.
  3211. @item nb_samples, n
  3212. Set the number of samples per requested frames.
  3213. @end table
  3214. @subsection Examples
  3215. @itemize
  3216. @item
  3217. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3218. @example
  3219. anullsrc=r=48000:cl=4
  3220. @end example
  3221. @item
  3222. Do the same operation with a more obvious syntax:
  3223. @example
  3224. anullsrc=r=48000:cl=mono
  3225. @end example
  3226. @end itemize
  3227. All the parameters need to be explicitly defined.
  3228. @section flite
  3229. Synthesize a voice utterance using the libflite library.
  3230. To enable compilation of this filter you need to configure FFmpeg with
  3231. @code{--enable-libflite}.
  3232. Note that the flite library is not thread-safe.
  3233. The filter accepts the following options:
  3234. @table @option
  3235. @item list_voices
  3236. If set to 1, list the names of the available voices and exit
  3237. immediately. Default value is 0.
  3238. @item nb_samples, n
  3239. Set the maximum number of samples per frame. Default value is 512.
  3240. @item textfile
  3241. Set the filename containing the text to speak.
  3242. @item text
  3243. Set the text to speak.
  3244. @item voice, v
  3245. Set the voice to use for the speech synthesis. Default value is
  3246. @code{kal}. See also the @var{list_voices} option.
  3247. @end table
  3248. @subsection Examples
  3249. @itemize
  3250. @item
  3251. Read from file @file{speech.txt}, and synthesize the text using the
  3252. standard flite voice:
  3253. @example
  3254. flite=textfile=speech.txt
  3255. @end example
  3256. @item
  3257. Read the specified text selecting the @code{slt} voice:
  3258. @example
  3259. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3260. @end example
  3261. @item
  3262. Input text to ffmpeg:
  3263. @example
  3264. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3265. @end example
  3266. @item
  3267. Make @file{ffplay} speak the specified text, using @code{flite} and
  3268. the @code{lavfi} device:
  3269. @example
  3270. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3271. @end example
  3272. @end itemize
  3273. For more information about libflite, check:
  3274. @url{http://www.speech.cs.cmu.edu/flite/}
  3275. @section anoisesrc
  3276. Generate a noise audio signal.
  3277. The filter accepts the following options:
  3278. @table @option
  3279. @item sample_rate, r
  3280. Specify the sample rate. Default value is 48000 Hz.
  3281. @item amplitude, a
  3282. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3283. is 1.0.
  3284. @item duration, d
  3285. Specify the duration of the generated audio stream. Not specifying this option
  3286. results in noise with an infinite length.
  3287. @item color, colour, c
  3288. Specify the color of noise. Available noise colors are white, pink, and brown.
  3289. Default color is white.
  3290. @item seed, s
  3291. Specify a value used to seed the PRNG.
  3292. @item nb_samples, n
  3293. Set the number of samples per each output frame, default is 1024.
  3294. @end table
  3295. @subsection Examples
  3296. @itemize
  3297. @item
  3298. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3299. @example
  3300. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3301. @end example
  3302. @end itemize
  3303. @section sine
  3304. Generate an audio signal made of a sine wave with amplitude 1/8.
  3305. The audio signal is bit-exact.
  3306. The filter accepts the following options:
  3307. @table @option
  3308. @item frequency, f
  3309. Set the carrier frequency. Default is 440 Hz.
  3310. @item beep_factor, b
  3311. Enable a periodic beep every second with frequency @var{beep_factor} times
  3312. the carrier frequency. Default is 0, meaning the beep is disabled.
  3313. @item sample_rate, r
  3314. Specify the sample rate, default is 44100.
  3315. @item duration, d
  3316. Specify the duration of the generated audio stream.
  3317. @item samples_per_frame
  3318. Set the number of samples per output frame.
  3319. The expression can contain the following constants:
  3320. @table @option
  3321. @item n
  3322. The (sequential) number of the output audio frame, starting from 0.
  3323. @item pts
  3324. The PTS (Presentation TimeStamp) of the output audio frame,
  3325. expressed in @var{TB} units.
  3326. @item t
  3327. The PTS of the output audio frame, expressed in seconds.
  3328. @item TB
  3329. The timebase of the output audio frames.
  3330. @end table
  3331. Default is @code{1024}.
  3332. @end table
  3333. @subsection Examples
  3334. @itemize
  3335. @item
  3336. Generate a simple 440 Hz sine wave:
  3337. @example
  3338. sine
  3339. @end example
  3340. @item
  3341. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3342. @example
  3343. sine=220:4:d=5
  3344. sine=f=220:b=4:d=5
  3345. sine=frequency=220:beep_factor=4:duration=5
  3346. @end example
  3347. @item
  3348. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3349. pattern:
  3350. @example
  3351. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3352. @end example
  3353. @end itemize
  3354. @c man end AUDIO SOURCES
  3355. @chapter Audio Sinks
  3356. @c man begin AUDIO SINKS
  3357. Below is a description of the currently available audio sinks.
  3358. @section abuffersink
  3359. Buffer audio frames, and make them available to the end of filter chain.
  3360. This sink is mainly intended for programmatic use, in particular
  3361. through the interface defined in @file{libavfilter/buffersink.h}
  3362. or the options system.
  3363. It accepts a pointer to an AVABufferSinkContext structure, which
  3364. defines the incoming buffers' formats, to be passed as the opaque
  3365. parameter to @code{avfilter_init_filter} for initialization.
  3366. @section anullsink
  3367. Null audio sink; do absolutely nothing with the input audio. It is
  3368. mainly useful as a template and for use in analysis / debugging
  3369. tools.
  3370. @c man end AUDIO SINKS
  3371. @chapter Video Filters
  3372. @c man begin VIDEO FILTERS
  3373. When you configure your FFmpeg build, you can disable any of the
  3374. existing filters using @code{--disable-filters}.
  3375. The configure output will show the video filters included in your
  3376. build.
  3377. Below is a description of the currently available video filters.
  3378. @section alphaextract
  3379. Extract the alpha component from the input as a grayscale video. This
  3380. is especially useful with the @var{alphamerge} filter.
  3381. @section alphamerge
  3382. Add or replace the alpha component of the primary input with the
  3383. grayscale value of a second input. This is intended for use with
  3384. @var{alphaextract} to allow the transmission or storage of frame
  3385. sequences that have alpha in a format that doesn't support an alpha
  3386. channel.
  3387. For example, to reconstruct full frames from a normal YUV-encoded video
  3388. and a separate video created with @var{alphaextract}, you might use:
  3389. @example
  3390. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3391. @end example
  3392. Since this filter is designed for reconstruction, it operates on frame
  3393. sequences without considering timestamps, and terminates when either
  3394. input reaches end of stream. This will cause problems if your encoding
  3395. pipeline drops frames. If you're trying to apply an image as an
  3396. overlay to a video stream, consider the @var{overlay} filter instead.
  3397. @section ass
  3398. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3399. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3400. Substation Alpha) subtitles files.
  3401. This filter accepts the following option in addition to the common options from
  3402. the @ref{subtitles} filter:
  3403. @table @option
  3404. @item shaping
  3405. Set the shaping engine
  3406. Available values are:
  3407. @table @samp
  3408. @item auto
  3409. The default libass shaping engine, which is the best available.
  3410. @item simple
  3411. Fast, font-agnostic shaper that can do only substitutions
  3412. @item complex
  3413. Slower shaper using OpenType for substitutions and positioning
  3414. @end table
  3415. The default is @code{auto}.
  3416. @end table
  3417. @section atadenoise
  3418. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3419. The filter accepts the following options:
  3420. @table @option
  3421. @item 0a
  3422. Set threshold A for 1st plane. Default is 0.02.
  3423. Valid range is 0 to 0.3.
  3424. @item 0b
  3425. Set threshold B for 1st plane. Default is 0.04.
  3426. Valid range is 0 to 5.
  3427. @item 1a
  3428. Set threshold A for 2nd plane. Default is 0.02.
  3429. Valid range is 0 to 0.3.
  3430. @item 1b
  3431. Set threshold B for 2nd plane. Default is 0.04.
  3432. Valid range is 0 to 5.
  3433. @item 2a
  3434. Set threshold A for 3rd plane. Default is 0.02.
  3435. Valid range is 0 to 0.3.
  3436. @item 2b
  3437. Set threshold B for 3rd plane. Default is 0.04.
  3438. Valid range is 0 to 5.
  3439. Threshold A is designed to react on abrupt changes in the input signal and
  3440. threshold B is designed to react on continuous changes in the input signal.
  3441. @item s
  3442. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3443. number in range [5, 129].
  3444. @item p
  3445. Set what planes of frame filter will use for averaging. Default is all.
  3446. @end table
  3447. @section avgblur
  3448. Apply average blur filter.
  3449. The filter accepts the following options:
  3450. @table @option
  3451. @item sizeX
  3452. Set horizontal kernel size.
  3453. @item planes
  3454. Set which planes to filter. By default all planes are filtered.
  3455. @item sizeY
  3456. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3457. Default is @code{0}.
  3458. @end table
  3459. @section bbox
  3460. Compute the bounding box for the non-black pixels in the input frame
  3461. luminance plane.
  3462. This filter computes the bounding box containing all the pixels with a
  3463. luminance value greater than the minimum allowed value.
  3464. The parameters describing the bounding box are printed on the filter
  3465. log.
  3466. The filter accepts the following option:
  3467. @table @option
  3468. @item min_val
  3469. Set the minimal luminance value. Default is @code{16}.
  3470. @end table
  3471. @section bitplanenoise
  3472. Show and measure bit plane noise.
  3473. The filter accepts the following options:
  3474. @table @option
  3475. @item bitplane
  3476. Set which plane to analyze. Default is @code{1}.
  3477. @item filter
  3478. Filter out noisy pixels from @code{bitplane} set above.
  3479. Default is disabled.
  3480. @end table
  3481. @section blackdetect
  3482. Detect video intervals that are (almost) completely black. Can be
  3483. useful to detect chapter transitions, commercials, or invalid
  3484. recordings. Output lines contains the time for the start, end and
  3485. duration of the detected black interval expressed in seconds.
  3486. In order to display the output lines, you need to set the loglevel at
  3487. least to the AV_LOG_INFO value.
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item black_min_duration, d
  3491. Set the minimum detected black duration expressed in seconds. It must
  3492. be a non-negative floating point number.
  3493. Default value is 2.0.
  3494. @item picture_black_ratio_th, pic_th
  3495. Set the threshold for considering a picture "black".
  3496. Express the minimum value for the ratio:
  3497. @example
  3498. @var{nb_black_pixels} / @var{nb_pixels}
  3499. @end example
  3500. for which a picture is considered black.
  3501. Default value is 0.98.
  3502. @item pixel_black_th, pix_th
  3503. Set the threshold for considering a pixel "black".
  3504. The threshold expresses the maximum pixel luminance value for which a
  3505. pixel is considered "black". The provided value is scaled according to
  3506. the following equation:
  3507. @example
  3508. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3509. @end example
  3510. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3511. the input video format, the range is [0-255] for YUV full-range
  3512. formats and [16-235] for YUV non full-range formats.
  3513. Default value is 0.10.
  3514. @end table
  3515. The following example sets the maximum pixel threshold to the minimum
  3516. value, and detects only black intervals of 2 or more seconds:
  3517. @example
  3518. blackdetect=d=2:pix_th=0.00
  3519. @end example
  3520. @section blackframe
  3521. Detect frames that are (almost) completely black. Can be useful to
  3522. detect chapter transitions or commercials. Output lines consist of
  3523. the frame number of the detected frame, the percentage of blackness,
  3524. the position in the file if known or -1 and the timestamp in seconds.
  3525. In order to display the output lines, you need to set the loglevel at
  3526. least to the AV_LOG_INFO value.
  3527. It accepts the following parameters:
  3528. @table @option
  3529. @item amount
  3530. The percentage of the pixels that have to be below the threshold; it defaults to
  3531. @code{98}.
  3532. @item threshold, thresh
  3533. The threshold below which a pixel value is considered black; it defaults to
  3534. @code{32}.
  3535. @end table
  3536. @section blend, tblend
  3537. Blend two video frames into each other.
  3538. The @code{blend} filter takes two input streams and outputs one
  3539. stream, the first input is the "top" layer and second input is
  3540. "bottom" layer. By default, the output terminates when the longest input terminates.
  3541. The @code{tblend} (time blend) filter takes two consecutive frames
  3542. from one single stream, and outputs the result obtained by blending
  3543. the new frame on top of the old frame.
  3544. A description of the accepted options follows.
  3545. @table @option
  3546. @item c0_mode
  3547. @item c1_mode
  3548. @item c2_mode
  3549. @item c3_mode
  3550. @item all_mode
  3551. Set blend mode for specific pixel component or all pixel components in case
  3552. of @var{all_mode}. Default value is @code{normal}.
  3553. Available values for component modes are:
  3554. @table @samp
  3555. @item addition
  3556. @item addition128
  3557. @item and
  3558. @item average
  3559. @item burn
  3560. @item darken
  3561. @item difference
  3562. @item difference128
  3563. @item divide
  3564. @item dodge
  3565. @item freeze
  3566. @item exclusion
  3567. @item glow
  3568. @item hardlight
  3569. @item hardmix
  3570. @item heat
  3571. @item lighten
  3572. @item linearlight
  3573. @item multiply
  3574. @item multiply128
  3575. @item negation
  3576. @item normal
  3577. @item or
  3578. @item overlay
  3579. @item phoenix
  3580. @item pinlight
  3581. @item reflect
  3582. @item screen
  3583. @item softlight
  3584. @item subtract
  3585. @item vividlight
  3586. @item xor
  3587. @end table
  3588. @item c0_opacity
  3589. @item c1_opacity
  3590. @item c2_opacity
  3591. @item c3_opacity
  3592. @item all_opacity
  3593. Set blend opacity for specific pixel component or all pixel components in case
  3594. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3595. @item c0_expr
  3596. @item c1_expr
  3597. @item c2_expr
  3598. @item c3_expr
  3599. @item all_expr
  3600. Set blend expression for specific pixel component or all pixel components in case
  3601. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3602. The expressions can use the following variables:
  3603. @table @option
  3604. @item N
  3605. The sequential number of the filtered frame, starting from @code{0}.
  3606. @item X
  3607. @item Y
  3608. the coordinates of the current sample
  3609. @item W
  3610. @item H
  3611. the width and height of currently filtered plane
  3612. @item SW
  3613. @item SH
  3614. Width and height scale depending on the currently filtered plane. It is the
  3615. ratio between the corresponding luma plane number of pixels and the current
  3616. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3617. @code{0.5,0.5} for chroma planes.
  3618. @item T
  3619. Time of the current frame, expressed in seconds.
  3620. @item TOP, A
  3621. Value of pixel component at current location for first video frame (top layer).
  3622. @item BOTTOM, B
  3623. Value of pixel component at current location for second video frame (bottom layer).
  3624. @end table
  3625. @item shortest
  3626. Force termination when the shortest input terminates. Default is
  3627. @code{0}. This option is only defined for the @code{blend} filter.
  3628. @item repeatlast
  3629. Continue applying the last bottom frame after the end of the stream. A value of
  3630. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3631. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3632. @end table
  3633. @subsection Examples
  3634. @itemize
  3635. @item
  3636. Apply transition from bottom layer to top layer in first 10 seconds:
  3637. @example
  3638. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3639. @end example
  3640. @item
  3641. Apply 1x1 checkerboard effect:
  3642. @example
  3643. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3644. @end example
  3645. @item
  3646. Apply uncover left effect:
  3647. @example
  3648. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3649. @end example
  3650. @item
  3651. Apply uncover down effect:
  3652. @example
  3653. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3654. @end example
  3655. @item
  3656. Apply uncover up-left effect:
  3657. @example
  3658. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3659. @end example
  3660. @item
  3661. Split diagonally video and shows top and bottom layer on each side:
  3662. @example
  3663. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3664. @end example
  3665. @item
  3666. Display differences between the current and the previous frame:
  3667. @example
  3668. tblend=all_mode=difference128
  3669. @end example
  3670. @end itemize
  3671. @section boxblur
  3672. Apply a boxblur algorithm to the input video.
  3673. It accepts the following parameters:
  3674. @table @option
  3675. @item luma_radius, lr
  3676. @item luma_power, lp
  3677. @item chroma_radius, cr
  3678. @item chroma_power, cp
  3679. @item alpha_radius, ar
  3680. @item alpha_power, ap
  3681. @end table
  3682. A description of the accepted options follows.
  3683. @table @option
  3684. @item luma_radius, lr
  3685. @item chroma_radius, cr
  3686. @item alpha_radius, ar
  3687. Set an expression for the box radius in pixels used for blurring the
  3688. corresponding input plane.
  3689. The radius value must be a non-negative number, and must not be
  3690. greater than the value of the expression @code{min(w,h)/2} for the
  3691. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3692. planes.
  3693. Default value for @option{luma_radius} is "2". If not specified,
  3694. @option{chroma_radius} and @option{alpha_radius} default to the
  3695. corresponding value set for @option{luma_radius}.
  3696. The expressions can contain the following constants:
  3697. @table @option
  3698. @item w
  3699. @item h
  3700. The input width and height in pixels.
  3701. @item cw
  3702. @item ch
  3703. The input chroma image width and height in pixels.
  3704. @item hsub
  3705. @item vsub
  3706. The horizontal and vertical chroma subsample values. For example, for the
  3707. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3708. @end table
  3709. @item luma_power, lp
  3710. @item chroma_power, cp
  3711. @item alpha_power, ap
  3712. Specify how many times the boxblur filter is applied to the
  3713. corresponding plane.
  3714. Default value for @option{luma_power} is 2. If not specified,
  3715. @option{chroma_power} and @option{alpha_power} default to the
  3716. corresponding value set for @option{luma_power}.
  3717. A value of 0 will disable the effect.
  3718. @end table
  3719. @subsection Examples
  3720. @itemize
  3721. @item
  3722. Apply a boxblur filter with the luma, chroma, and alpha radii
  3723. set to 2:
  3724. @example
  3725. boxblur=luma_radius=2:luma_power=1
  3726. boxblur=2:1
  3727. @end example
  3728. @item
  3729. Set the luma radius to 2, and alpha and chroma radius to 0:
  3730. @example
  3731. boxblur=2:1:cr=0:ar=0
  3732. @end example
  3733. @item
  3734. Set the luma and chroma radii to a fraction of the video dimension:
  3735. @example
  3736. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3737. @end example
  3738. @end itemize
  3739. @section bwdif
  3740. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3741. Deinterlacing Filter").
  3742. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3743. interpolation algorithms.
  3744. It accepts the following parameters:
  3745. @table @option
  3746. @item mode
  3747. The interlacing mode to adopt. It accepts one of the following values:
  3748. @table @option
  3749. @item 0, send_frame
  3750. Output one frame for each frame.
  3751. @item 1, send_field
  3752. Output one frame for each field.
  3753. @end table
  3754. The default value is @code{send_field}.
  3755. @item parity
  3756. The picture field parity assumed for the input interlaced video. It accepts one
  3757. of the following values:
  3758. @table @option
  3759. @item 0, tff
  3760. Assume the top field is first.
  3761. @item 1, bff
  3762. Assume the bottom field is first.
  3763. @item -1, auto
  3764. Enable automatic detection of field parity.
  3765. @end table
  3766. The default value is @code{auto}.
  3767. If the interlacing is unknown or the decoder does not export this information,
  3768. top field first will be assumed.
  3769. @item deint
  3770. Specify which frames to deinterlace. Accept one of the following
  3771. values:
  3772. @table @option
  3773. @item 0, all
  3774. Deinterlace all frames.
  3775. @item 1, interlaced
  3776. Only deinterlace frames marked as interlaced.
  3777. @end table
  3778. The default value is @code{all}.
  3779. @end table
  3780. @section chromakey
  3781. YUV colorspace color/chroma keying.
  3782. The filter accepts the following options:
  3783. @table @option
  3784. @item color
  3785. The color which will be replaced with transparency.
  3786. @item similarity
  3787. Similarity percentage with the key color.
  3788. 0.01 matches only the exact key color, while 1.0 matches everything.
  3789. @item blend
  3790. Blend percentage.
  3791. 0.0 makes pixels either fully transparent, or not transparent at all.
  3792. Higher values result in semi-transparent pixels, with a higher transparency
  3793. the more similar the pixels color is to the key color.
  3794. @item yuv
  3795. Signals that the color passed is already in YUV instead of RGB.
  3796. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3797. This can be used to pass exact YUV values as hexadecimal numbers.
  3798. @end table
  3799. @subsection Examples
  3800. @itemize
  3801. @item
  3802. Make every green pixel in the input image transparent:
  3803. @example
  3804. ffmpeg -i input.png -vf chromakey=green out.png
  3805. @end example
  3806. @item
  3807. Overlay a greenscreen-video on top of a static black background.
  3808. @example
  3809. 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
  3810. @end example
  3811. @end itemize
  3812. @section ciescope
  3813. Display CIE color diagram with pixels overlaid onto it.
  3814. The filter accepts the following options:
  3815. @table @option
  3816. @item system
  3817. Set color system.
  3818. @table @samp
  3819. @item ntsc, 470m
  3820. @item ebu, 470bg
  3821. @item smpte
  3822. @item 240m
  3823. @item apple
  3824. @item widergb
  3825. @item cie1931
  3826. @item rec709, hdtv
  3827. @item uhdtv, rec2020
  3828. @end table
  3829. @item cie
  3830. Set CIE system.
  3831. @table @samp
  3832. @item xyy
  3833. @item ucs
  3834. @item luv
  3835. @end table
  3836. @item gamuts
  3837. Set what gamuts to draw.
  3838. See @code{system} option for available values.
  3839. @item size, s
  3840. Set ciescope size, by default set to 512.
  3841. @item intensity, i
  3842. Set intensity used to map input pixel values to CIE diagram.
  3843. @item contrast
  3844. Set contrast used to draw tongue colors that are out of active color system gamut.
  3845. @item corrgamma
  3846. Correct gamma displayed on scope, by default enabled.
  3847. @item showwhite
  3848. Show white point on CIE diagram, by default disabled.
  3849. @item gamma
  3850. Set input gamma. Used only with XYZ input color space.
  3851. @end table
  3852. @section codecview
  3853. Visualize information exported by some codecs.
  3854. Some codecs can export information through frames using side-data or other
  3855. means. For example, some MPEG based codecs export motion vectors through the
  3856. @var{export_mvs} flag in the codec @option{flags2} option.
  3857. The filter accepts the following option:
  3858. @table @option
  3859. @item mv
  3860. Set motion vectors to visualize.
  3861. Available flags for @var{mv} are:
  3862. @table @samp
  3863. @item pf
  3864. forward predicted MVs of P-frames
  3865. @item bf
  3866. forward predicted MVs of B-frames
  3867. @item bb
  3868. backward predicted MVs of B-frames
  3869. @end table
  3870. @item qp
  3871. Display quantization parameters using the chroma planes.
  3872. @item mv_type, mvt
  3873. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3874. Available flags for @var{mv_type} are:
  3875. @table @samp
  3876. @item fp
  3877. forward predicted MVs
  3878. @item bp
  3879. backward predicted MVs
  3880. @end table
  3881. @item frame_type, ft
  3882. Set frame type to visualize motion vectors of.
  3883. Available flags for @var{frame_type} are:
  3884. @table @samp
  3885. @item if
  3886. intra-coded frames (I-frames)
  3887. @item pf
  3888. predicted frames (P-frames)
  3889. @item bf
  3890. bi-directionally predicted frames (B-frames)
  3891. @end table
  3892. @end table
  3893. @subsection Examples
  3894. @itemize
  3895. @item
  3896. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3897. @example
  3898. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3899. @end example
  3900. @item
  3901. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3902. @example
  3903. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3904. @end example
  3905. @end itemize
  3906. @section colorbalance
  3907. Modify intensity of primary colors (red, green and blue) of input frames.
  3908. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3909. regions for the red-cyan, green-magenta or blue-yellow balance.
  3910. A positive adjustment value shifts the balance towards the primary color, a negative
  3911. value towards the complementary color.
  3912. The filter accepts the following options:
  3913. @table @option
  3914. @item rs
  3915. @item gs
  3916. @item bs
  3917. Adjust red, green and blue shadows (darkest pixels).
  3918. @item rm
  3919. @item gm
  3920. @item bm
  3921. Adjust red, green and blue midtones (medium pixels).
  3922. @item rh
  3923. @item gh
  3924. @item bh
  3925. Adjust red, green and blue highlights (brightest pixels).
  3926. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3927. @end table
  3928. @subsection Examples
  3929. @itemize
  3930. @item
  3931. Add red color cast to shadows:
  3932. @example
  3933. colorbalance=rs=.3
  3934. @end example
  3935. @end itemize
  3936. @section colorkey
  3937. RGB colorspace color keying.
  3938. The filter accepts the following options:
  3939. @table @option
  3940. @item color
  3941. The color which will be replaced with transparency.
  3942. @item similarity
  3943. Similarity percentage with the key color.
  3944. 0.01 matches only the exact key color, while 1.0 matches everything.
  3945. @item blend
  3946. Blend percentage.
  3947. 0.0 makes pixels either fully transparent, or not transparent at all.
  3948. Higher values result in semi-transparent pixels, with a higher transparency
  3949. the more similar the pixels color is to the key color.
  3950. @end table
  3951. @subsection Examples
  3952. @itemize
  3953. @item
  3954. Make every green pixel in the input image transparent:
  3955. @example
  3956. ffmpeg -i input.png -vf colorkey=green out.png
  3957. @end example
  3958. @item
  3959. Overlay a greenscreen-video on top of a static background image.
  3960. @example
  3961. 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
  3962. @end example
  3963. @end itemize
  3964. @section colorlevels
  3965. Adjust video input frames using levels.
  3966. The filter accepts the following options:
  3967. @table @option
  3968. @item rimin
  3969. @item gimin
  3970. @item bimin
  3971. @item aimin
  3972. Adjust red, green, blue and alpha input black point.
  3973. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3974. @item rimax
  3975. @item gimax
  3976. @item bimax
  3977. @item aimax
  3978. Adjust red, green, blue and alpha input white point.
  3979. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3980. Input levels are used to lighten highlights (bright tones), darken shadows
  3981. (dark tones), change the balance of bright and dark tones.
  3982. @item romin
  3983. @item gomin
  3984. @item bomin
  3985. @item aomin
  3986. Adjust red, green, blue and alpha output black point.
  3987. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3988. @item romax
  3989. @item gomax
  3990. @item bomax
  3991. @item aomax
  3992. Adjust red, green, blue and alpha output white point.
  3993. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3994. Output levels allows manual selection of a constrained output level range.
  3995. @end table
  3996. @subsection Examples
  3997. @itemize
  3998. @item
  3999. Make video output darker:
  4000. @example
  4001. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4002. @end example
  4003. @item
  4004. Increase contrast:
  4005. @example
  4006. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4007. @end example
  4008. @item
  4009. Make video output lighter:
  4010. @example
  4011. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4012. @end example
  4013. @item
  4014. Increase brightness:
  4015. @example
  4016. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4017. @end example
  4018. @end itemize
  4019. @section colorchannelmixer
  4020. Adjust video input frames by re-mixing color channels.
  4021. This filter modifies a color channel by adding the values associated to
  4022. the other channels of the same pixels. For example if the value to
  4023. modify is red, the output value will be:
  4024. @example
  4025. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4026. @end example
  4027. The filter accepts the following options:
  4028. @table @option
  4029. @item rr
  4030. @item rg
  4031. @item rb
  4032. @item ra
  4033. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4034. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4035. @item gr
  4036. @item gg
  4037. @item gb
  4038. @item ga
  4039. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4040. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4041. @item br
  4042. @item bg
  4043. @item bb
  4044. @item ba
  4045. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4046. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4047. @item ar
  4048. @item ag
  4049. @item ab
  4050. @item aa
  4051. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4052. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4053. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4054. @end table
  4055. @subsection Examples
  4056. @itemize
  4057. @item
  4058. Convert source to grayscale:
  4059. @example
  4060. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4061. @end example
  4062. @item
  4063. Simulate sepia tones:
  4064. @example
  4065. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4066. @end example
  4067. @end itemize
  4068. @section colormatrix
  4069. Convert color matrix.
  4070. The filter accepts the following options:
  4071. @table @option
  4072. @item src
  4073. @item dst
  4074. Specify the source and destination color matrix. Both values must be
  4075. specified.
  4076. The accepted values are:
  4077. @table @samp
  4078. @item bt709
  4079. BT.709
  4080. @item bt601
  4081. BT.601
  4082. @item smpte240m
  4083. SMPTE-240M
  4084. @item fcc
  4085. FCC
  4086. @item bt2020
  4087. BT.2020
  4088. @end table
  4089. @end table
  4090. For example to convert from BT.601 to SMPTE-240M, use the command:
  4091. @example
  4092. colormatrix=bt601:smpte240m
  4093. @end example
  4094. @section colorspace
  4095. Convert colorspace, transfer characteristics or color primaries.
  4096. The filter accepts the following options:
  4097. @table @option
  4098. @anchor{all}
  4099. @item all
  4100. Specify all color properties at once.
  4101. The accepted values are:
  4102. @table @samp
  4103. @item bt470m
  4104. BT.470M
  4105. @item bt470bg
  4106. BT.470BG
  4107. @item bt601-6-525
  4108. BT.601-6 525
  4109. @item bt601-6-625
  4110. BT.601-6 625
  4111. @item bt709
  4112. BT.709
  4113. @item smpte170m
  4114. SMPTE-170M
  4115. @item smpte240m
  4116. SMPTE-240M
  4117. @item bt2020
  4118. BT.2020
  4119. @end table
  4120. @anchor{space}
  4121. @item space
  4122. Specify output colorspace.
  4123. The accepted values are:
  4124. @table @samp
  4125. @item bt709
  4126. BT.709
  4127. @item fcc
  4128. FCC
  4129. @item bt470bg
  4130. BT.470BG or BT.601-6 625
  4131. @item smpte170m
  4132. SMPTE-170M or BT.601-6 525
  4133. @item smpte240m
  4134. SMPTE-240M
  4135. @item bt2020ncl
  4136. BT.2020 with non-constant luminance
  4137. @end table
  4138. @anchor{trc}
  4139. @item trc
  4140. Specify output transfer characteristics.
  4141. The accepted values are:
  4142. @table @samp
  4143. @item bt709
  4144. BT.709
  4145. @item gamma22
  4146. Constant gamma of 2.2
  4147. @item gamma28
  4148. Constant gamma of 2.8
  4149. @item smpte170m
  4150. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4151. @item smpte240m
  4152. SMPTE-240M
  4153. @item bt2020-10
  4154. BT.2020 for 10-bits content
  4155. @item bt2020-12
  4156. BT.2020 for 12-bits content
  4157. @end table
  4158. @anchor{primaries}
  4159. @item primaries
  4160. Specify output color primaries.
  4161. The accepted values are:
  4162. @table @samp
  4163. @item bt709
  4164. BT.709
  4165. @item bt470m
  4166. BT.470M
  4167. @item bt470bg
  4168. BT.470BG or BT.601-6 625
  4169. @item smpte170m
  4170. SMPTE-170M or BT.601-6 525
  4171. @item smpte240m
  4172. SMPTE-240M
  4173. @item bt2020
  4174. BT.2020
  4175. @end table
  4176. @anchor{range}
  4177. @item range
  4178. Specify output color range.
  4179. The accepted values are:
  4180. @table @samp
  4181. @item mpeg
  4182. MPEG (restricted) range
  4183. @item jpeg
  4184. JPEG (full) range
  4185. @end table
  4186. @item format
  4187. Specify output color format.
  4188. The accepted values are:
  4189. @table @samp
  4190. @item yuv420p
  4191. YUV 4:2:0 planar 8-bits
  4192. @item yuv420p10
  4193. YUV 4:2:0 planar 10-bits
  4194. @item yuv420p12
  4195. YUV 4:2:0 planar 12-bits
  4196. @item yuv422p
  4197. YUV 4:2:2 planar 8-bits
  4198. @item yuv422p10
  4199. YUV 4:2:2 planar 10-bits
  4200. @item yuv422p12
  4201. YUV 4:2:2 planar 12-bits
  4202. @item yuv444p
  4203. YUV 4:4:4 planar 8-bits
  4204. @item yuv444p10
  4205. YUV 4:4:4 planar 10-bits
  4206. @item yuv444p12
  4207. YUV 4:4:4 planar 12-bits
  4208. @end table
  4209. @item fast
  4210. Do a fast conversion, which skips gamma/primary correction. This will take
  4211. significantly less CPU, but will be mathematically incorrect. To get output
  4212. compatible with that produced by the colormatrix filter, use fast=1.
  4213. @item dither
  4214. Specify dithering mode.
  4215. The accepted values are:
  4216. @table @samp
  4217. @item none
  4218. No dithering
  4219. @item fsb
  4220. Floyd-Steinberg dithering
  4221. @end table
  4222. @item wpadapt
  4223. Whitepoint adaptation mode.
  4224. The accepted values are:
  4225. @table @samp
  4226. @item bradford
  4227. Bradford whitepoint adaptation
  4228. @item vonkries
  4229. von Kries whitepoint adaptation
  4230. @item identity
  4231. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4232. @end table
  4233. @item iall
  4234. Override all input properties at once. Same accepted values as @ref{all}.
  4235. @item ispace
  4236. Override input colorspace. Same accepted values as @ref{space}.
  4237. @item iprimaries
  4238. Override input color primaries. Same accepted values as @ref{primaries}.
  4239. @item itrc
  4240. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4241. @item irange
  4242. Override input color range. Same accepted values as @ref{range}.
  4243. @end table
  4244. The filter converts the transfer characteristics, color space and color
  4245. primaries to the specified user values. The output value, if not specified,
  4246. is set to a default value based on the "all" property. If that property is
  4247. also not specified, the filter will log an error. The output color range and
  4248. format default to the same value as the input color range and format. The
  4249. input transfer characteristics, color space, color primaries and color range
  4250. should be set on the input data. If any of these are missing, the filter will
  4251. log an error and no conversion will take place.
  4252. For example to convert the input to SMPTE-240M, use the command:
  4253. @example
  4254. colorspace=smpte240m
  4255. @end example
  4256. @section convolution
  4257. Apply convolution 3x3 or 5x5 filter.
  4258. The filter accepts the following options:
  4259. @table @option
  4260. @item 0m
  4261. @item 1m
  4262. @item 2m
  4263. @item 3m
  4264. Set matrix for each plane.
  4265. Matrix is sequence of 9 or 25 signed integers.
  4266. @item 0rdiv
  4267. @item 1rdiv
  4268. @item 2rdiv
  4269. @item 3rdiv
  4270. Set multiplier for calculated value for each plane.
  4271. @item 0bias
  4272. @item 1bias
  4273. @item 2bias
  4274. @item 3bias
  4275. Set bias for each plane. This value is added to the result of the multiplication.
  4276. Useful for making the overall image brighter or darker. Default is 0.0.
  4277. @end table
  4278. @subsection Examples
  4279. @itemize
  4280. @item
  4281. Apply sharpen:
  4282. @example
  4283. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  4284. @end example
  4285. @item
  4286. Apply blur:
  4287. @example
  4288. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  4289. @end example
  4290. @item
  4291. Apply edge enhance:
  4292. @example
  4293. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  4294. @end example
  4295. @item
  4296. Apply edge detect:
  4297. @example
  4298. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  4299. @end example
  4300. @item
  4301. Apply emboss:
  4302. @example
  4303. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  4304. @end example
  4305. @end itemize
  4306. @section copy
  4307. Copy the input source unchanged to the output. This is mainly useful for
  4308. testing purposes.
  4309. @anchor{coreimage}
  4310. @section coreimage
  4311. Video filtering on GPU using Apple's CoreImage API on OSX.
  4312. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4313. processed by video hardware. However, software-based OpenGL implementations
  4314. exist which means there is no guarantee for hardware processing. It depends on
  4315. the respective OSX.
  4316. There are many filters and image generators provided by Apple that come with a
  4317. large variety of options. The filter has to be referenced by its name along
  4318. with its options.
  4319. The coreimage filter accepts the following options:
  4320. @table @option
  4321. @item list_filters
  4322. List all available filters and generators along with all their respective
  4323. options as well as possible minimum and maximum values along with the default
  4324. values.
  4325. @example
  4326. list_filters=true
  4327. @end example
  4328. @item filter
  4329. Specify all filters by their respective name and options.
  4330. Use @var{list_filters} to determine all valid filter names and options.
  4331. Numerical options are specified by a float value and are automatically clamped
  4332. to their respective value range. Vector and color options have to be specified
  4333. by a list of space separated float values. Character escaping has to be done.
  4334. A special option name @code{default} is available to use default options for a
  4335. filter.
  4336. It is required to specify either @code{default} or at least one of the filter options.
  4337. All omitted options are used with their default values.
  4338. The syntax of the filter string is as follows:
  4339. @example
  4340. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4341. @end example
  4342. @item output_rect
  4343. Specify a rectangle where the output of the filter chain is copied into the
  4344. input image. It is given by a list of space separated float values:
  4345. @example
  4346. output_rect=x\ y\ width\ height
  4347. @end example
  4348. If not given, the output rectangle equals the dimensions of the input image.
  4349. The output rectangle is automatically cropped at the borders of the input
  4350. image. Negative values are valid for each component.
  4351. @example
  4352. output_rect=25\ 25\ 100\ 100
  4353. @end example
  4354. @end table
  4355. Several filters can be chained for successive processing without GPU-HOST
  4356. transfers allowing for fast processing of complex filter chains.
  4357. Currently, only filters with zero (generators) or exactly one (filters) input
  4358. image and one output image are supported. Also, transition filters are not yet
  4359. usable as intended.
  4360. Some filters generate output images with additional padding depending on the
  4361. respective filter kernel. The padding is automatically removed to ensure the
  4362. filter output has the same size as the input image.
  4363. For image generators, the size of the output image is determined by the
  4364. previous output image of the filter chain or the input image of the whole
  4365. filterchain, respectively. The generators do not use the pixel information of
  4366. this image to generate their output. However, the generated output is
  4367. blended onto this image, resulting in partial or complete coverage of the
  4368. output image.
  4369. The @ref{coreimagesrc} video source can be used for generating input images
  4370. which are directly fed into the filter chain. By using it, providing input
  4371. images by another video source or an input video is not required.
  4372. @subsection Examples
  4373. @itemize
  4374. @item
  4375. List all filters available:
  4376. @example
  4377. coreimage=list_filters=true
  4378. @end example
  4379. @item
  4380. Use the CIBoxBlur filter with default options to blur an image:
  4381. @example
  4382. coreimage=filter=CIBoxBlur@@default
  4383. @end example
  4384. @item
  4385. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4386. its center at 100x100 and a radius of 50 pixels:
  4387. @example
  4388. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4389. @end example
  4390. @item
  4391. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4392. given as complete and escaped command-line for Apple's standard bash shell:
  4393. @example
  4394. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4395. @end example
  4396. @end itemize
  4397. @section crop
  4398. Crop the input video to given dimensions.
  4399. It accepts the following parameters:
  4400. @table @option
  4401. @item w, out_w
  4402. The width of the output video. It defaults to @code{iw}.
  4403. This expression is evaluated only once during the filter
  4404. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4405. @item h, out_h
  4406. The height of the output video. It defaults to @code{ih}.
  4407. This expression is evaluated only once during the filter
  4408. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4409. @item x
  4410. The horizontal position, in the input video, of the left edge of the output
  4411. video. It defaults to @code{(in_w-out_w)/2}.
  4412. This expression is evaluated per-frame.
  4413. @item y
  4414. The vertical position, in the input video, of the top edge of the output video.
  4415. It defaults to @code{(in_h-out_h)/2}.
  4416. This expression is evaluated per-frame.
  4417. @item keep_aspect
  4418. If set to 1 will force the output display aspect ratio
  4419. to be the same of the input, by changing the output sample aspect
  4420. ratio. It defaults to 0.
  4421. @item exact
  4422. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4423. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4424. It defaults to 0.
  4425. @end table
  4426. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4427. expressions containing the following constants:
  4428. @table @option
  4429. @item x
  4430. @item y
  4431. The computed values for @var{x} and @var{y}. They are evaluated for
  4432. each new frame.
  4433. @item in_w
  4434. @item in_h
  4435. The input width and height.
  4436. @item iw
  4437. @item ih
  4438. These are the same as @var{in_w} and @var{in_h}.
  4439. @item out_w
  4440. @item out_h
  4441. The output (cropped) width and height.
  4442. @item ow
  4443. @item oh
  4444. These are the same as @var{out_w} and @var{out_h}.
  4445. @item a
  4446. same as @var{iw} / @var{ih}
  4447. @item sar
  4448. input sample aspect ratio
  4449. @item dar
  4450. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4451. @item hsub
  4452. @item vsub
  4453. horizontal and vertical chroma subsample values. For example for the
  4454. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4455. @item n
  4456. The number of the input frame, starting from 0.
  4457. @item pos
  4458. the position in the file of the input frame, NAN if unknown
  4459. @item t
  4460. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4461. @end table
  4462. The expression for @var{out_w} may depend on the value of @var{out_h},
  4463. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4464. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4465. evaluated after @var{out_w} and @var{out_h}.
  4466. The @var{x} and @var{y} parameters specify the expressions for the
  4467. position of the top-left corner of the output (non-cropped) area. They
  4468. are evaluated for each frame. If the evaluated value is not valid, it
  4469. is approximated to the nearest valid value.
  4470. The expression for @var{x} may depend on @var{y}, and the expression
  4471. for @var{y} may depend on @var{x}.
  4472. @subsection Examples
  4473. @itemize
  4474. @item
  4475. Crop area with size 100x100 at position (12,34).
  4476. @example
  4477. crop=100:100:12:34
  4478. @end example
  4479. Using named options, the example above becomes:
  4480. @example
  4481. crop=w=100:h=100:x=12:y=34
  4482. @end example
  4483. @item
  4484. Crop the central input area with size 100x100:
  4485. @example
  4486. crop=100:100
  4487. @end example
  4488. @item
  4489. Crop the central input area with size 2/3 of the input video:
  4490. @example
  4491. crop=2/3*in_w:2/3*in_h
  4492. @end example
  4493. @item
  4494. Crop the input video central square:
  4495. @example
  4496. crop=out_w=in_h
  4497. crop=in_h
  4498. @end example
  4499. @item
  4500. Delimit the rectangle with the top-left corner placed at position
  4501. 100:100 and the right-bottom corner corresponding to the right-bottom
  4502. corner of the input image.
  4503. @example
  4504. crop=in_w-100:in_h-100:100:100
  4505. @end example
  4506. @item
  4507. Crop 10 pixels from the left and right borders, and 20 pixels from
  4508. the top and bottom borders
  4509. @example
  4510. crop=in_w-2*10:in_h-2*20
  4511. @end example
  4512. @item
  4513. Keep only the bottom right quarter of the input image:
  4514. @example
  4515. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4516. @end example
  4517. @item
  4518. Crop height for getting Greek harmony:
  4519. @example
  4520. crop=in_w:1/PHI*in_w
  4521. @end example
  4522. @item
  4523. Apply trembling effect:
  4524. @example
  4525. 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)
  4526. @end example
  4527. @item
  4528. Apply erratic camera effect depending on timestamp:
  4529. @example
  4530. 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)"
  4531. @end example
  4532. @item
  4533. Set x depending on the value of y:
  4534. @example
  4535. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4536. @end example
  4537. @end itemize
  4538. @subsection Commands
  4539. This filter supports the following commands:
  4540. @table @option
  4541. @item w, out_w
  4542. @item h, out_h
  4543. @item x
  4544. @item y
  4545. Set width/height of the output video and the horizontal/vertical position
  4546. in the input video.
  4547. The command accepts the same syntax of the corresponding option.
  4548. If the specified expression is not valid, it is kept at its current
  4549. value.
  4550. @end table
  4551. @section cropdetect
  4552. Auto-detect the crop size.
  4553. It calculates the necessary cropping parameters and prints the
  4554. recommended parameters via the logging system. The detected dimensions
  4555. correspond to the non-black area of the input video.
  4556. It accepts the following parameters:
  4557. @table @option
  4558. @item limit
  4559. Set higher black value threshold, which can be optionally specified
  4560. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4561. value greater to the set value is considered non-black. It defaults to 24.
  4562. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4563. on the bitdepth of the pixel format.
  4564. @item round
  4565. The value which the width/height should be divisible by. It defaults to
  4566. 16. The offset is automatically adjusted to center the video. Use 2 to
  4567. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4568. encoding to most video codecs.
  4569. @item reset_count, reset
  4570. Set the counter that determines after how many frames cropdetect will
  4571. reset the previously detected largest video area and start over to
  4572. detect the current optimal crop area. Default value is 0.
  4573. This can be useful when channel logos distort the video area. 0
  4574. indicates 'never reset', and returns the largest area encountered during
  4575. playback.
  4576. @end table
  4577. @anchor{curves}
  4578. @section curves
  4579. Apply color adjustments using curves.
  4580. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4581. component (red, green and blue) has its values defined by @var{N} key points
  4582. tied from each other using a smooth curve. The x-axis represents the pixel
  4583. values from the input frame, and the y-axis the new pixel values to be set for
  4584. the output frame.
  4585. By default, a component curve is defined by the two points @var{(0;0)} and
  4586. @var{(1;1)}. This creates a straight line where each original pixel value is
  4587. "adjusted" to its own value, which means no change to the image.
  4588. The filter allows you to redefine these two points and add some more. A new
  4589. curve (using a natural cubic spline interpolation) will be define to pass
  4590. smoothly through all these new coordinates. The new defined points needs to be
  4591. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4592. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4593. the vector spaces, the values will be clipped accordingly.
  4594. The filter accepts the following options:
  4595. @table @option
  4596. @item preset
  4597. Select one of the available color presets. This option can be used in addition
  4598. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4599. options takes priority on the preset values.
  4600. Available presets are:
  4601. @table @samp
  4602. @item none
  4603. @item color_negative
  4604. @item cross_process
  4605. @item darker
  4606. @item increase_contrast
  4607. @item lighter
  4608. @item linear_contrast
  4609. @item medium_contrast
  4610. @item negative
  4611. @item strong_contrast
  4612. @item vintage
  4613. @end table
  4614. Default is @code{none}.
  4615. @item master, m
  4616. Set the master key points. These points will define a second pass mapping. It
  4617. is sometimes called a "luminance" or "value" mapping. It can be used with
  4618. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4619. post-processing LUT.
  4620. @item red, r
  4621. Set the key points for the red component.
  4622. @item green, g
  4623. Set the key points for the green component.
  4624. @item blue, b
  4625. Set the key points for the blue component.
  4626. @item all
  4627. Set the key points for all components (not including master).
  4628. Can be used in addition to the other key points component
  4629. options. In this case, the unset component(s) will fallback on this
  4630. @option{all} setting.
  4631. @item psfile
  4632. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4633. @item plot
  4634. Save Gnuplot script of the curves in specified file.
  4635. @end table
  4636. To avoid some filtergraph syntax conflicts, each key points list need to be
  4637. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4638. @subsection Examples
  4639. @itemize
  4640. @item
  4641. Increase slightly the middle level of blue:
  4642. @example
  4643. curves=blue='0/0 0.5/0.58 1/1'
  4644. @end example
  4645. @item
  4646. Vintage effect:
  4647. @example
  4648. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  4649. @end example
  4650. Here we obtain the following coordinates for each components:
  4651. @table @var
  4652. @item red
  4653. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4654. @item green
  4655. @code{(0;0) (0.50;0.48) (1;1)}
  4656. @item blue
  4657. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4658. @end table
  4659. @item
  4660. The previous example can also be achieved with the associated built-in preset:
  4661. @example
  4662. curves=preset=vintage
  4663. @end example
  4664. @item
  4665. Or simply:
  4666. @example
  4667. curves=vintage
  4668. @end example
  4669. @item
  4670. Use a Photoshop preset and redefine the points of the green component:
  4671. @example
  4672. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4673. @end example
  4674. @item
  4675. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4676. and @command{gnuplot}:
  4677. @example
  4678. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4679. gnuplot -p /tmp/curves.plt
  4680. @end example
  4681. @end itemize
  4682. @section datascope
  4683. Video data analysis filter.
  4684. This filter shows hexadecimal pixel values of part of video.
  4685. The filter accepts the following options:
  4686. @table @option
  4687. @item size, s
  4688. Set output video size.
  4689. @item x
  4690. Set x offset from where to pick pixels.
  4691. @item y
  4692. Set y offset from where to pick pixels.
  4693. @item mode
  4694. Set scope mode, can be one of the following:
  4695. @table @samp
  4696. @item mono
  4697. Draw hexadecimal pixel values with white color on black background.
  4698. @item color
  4699. Draw hexadecimal pixel values with input video pixel color on black
  4700. background.
  4701. @item color2
  4702. Draw hexadecimal pixel values on color background picked from input video,
  4703. the text color is picked in such way so its always visible.
  4704. @end table
  4705. @item axis
  4706. Draw rows and columns numbers on left and top of video.
  4707. @item opacity
  4708. Set background opacity.
  4709. @end table
  4710. @section dctdnoiz
  4711. Denoise frames using 2D DCT (frequency domain filtering).
  4712. This filter is not designed for real time.
  4713. The filter accepts the following options:
  4714. @table @option
  4715. @item sigma, s
  4716. Set the noise sigma constant.
  4717. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4718. coefficient (absolute value) below this threshold with be dropped.
  4719. If you need a more advanced filtering, see @option{expr}.
  4720. Default is @code{0}.
  4721. @item overlap
  4722. Set number overlapping pixels for each block. Since the filter can be slow, you
  4723. may want to reduce this value, at the cost of a less effective filter and the
  4724. risk of various artefacts.
  4725. If the overlapping value doesn't permit processing the whole input width or
  4726. height, a warning will be displayed and according borders won't be denoised.
  4727. Default value is @var{blocksize}-1, which is the best possible setting.
  4728. @item expr, e
  4729. Set the coefficient factor expression.
  4730. For each coefficient of a DCT block, this expression will be evaluated as a
  4731. multiplier value for the coefficient.
  4732. If this is option is set, the @option{sigma} option will be ignored.
  4733. The absolute value of the coefficient can be accessed through the @var{c}
  4734. variable.
  4735. @item n
  4736. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4737. @var{blocksize}, which is the width and height of the processed blocks.
  4738. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4739. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4740. on the speed processing. Also, a larger block size does not necessarily means a
  4741. better de-noising.
  4742. @end table
  4743. @subsection Examples
  4744. Apply a denoise with a @option{sigma} of @code{4.5}:
  4745. @example
  4746. dctdnoiz=4.5
  4747. @end example
  4748. The same operation can be achieved using the expression system:
  4749. @example
  4750. dctdnoiz=e='gte(c, 4.5*3)'
  4751. @end example
  4752. Violent denoise using a block size of @code{16x16}:
  4753. @example
  4754. dctdnoiz=15:n=4
  4755. @end example
  4756. @section deband
  4757. Remove banding artifacts from input video.
  4758. It works by replacing banded pixels with average value of referenced pixels.
  4759. The filter accepts the following options:
  4760. @table @option
  4761. @item 1thr
  4762. @item 2thr
  4763. @item 3thr
  4764. @item 4thr
  4765. Set banding detection threshold for each plane. Default is 0.02.
  4766. Valid range is 0.00003 to 0.5.
  4767. If difference between current pixel and reference pixel is less than threshold,
  4768. it will be considered as banded.
  4769. @item range, r
  4770. Banding detection range in pixels. Default is 16. If positive, random number
  4771. in range 0 to set value will be used. If negative, exact absolute value
  4772. will be used.
  4773. The range defines square of four pixels around current pixel.
  4774. @item direction, d
  4775. Set direction in radians from which four pixel will be compared. If positive,
  4776. random direction from 0 to set direction will be picked. If negative, exact of
  4777. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4778. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4779. column.
  4780. @item blur
  4781. If enabled, current pixel is compared with average value of all four
  4782. surrounding pixels. The default is enabled. If disabled current pixel is
  4783. compared with all four surrounding pixels. The pixel is considered banded
  4784. if only all four differences with surrounding pixels are less than threshold.
  4785. @end table
  4786. @anchor{decimate}
  4787. @section decimate
  4788. Drop duplicated frames at regular intervals.
  4789. The filter accepts the following options:
  4790. @table @option
  4791. @item cycle
  4792. Set the number of frames from which one will be dropped. Setting this to
  4793. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4794. Default is @code{5}.
  4795. @item dupthresh
  4796. Set the threshold for duplicate detection. If the difference metric for a frame
  4797. is less than or equal to this value, then it is declared as duplicate. Default
  4798. is @code{1.1}
  4799. @item scthresh
  4800. Set scene change threshold. Default is @code{15}.
  4801. @item blockx
  4802. @item blocky
  4803. Set the size of the x and y-axis blocks used during metric calculations.
  4804. Larger blocks give better noise suppression, but also give worse detection of
  4805. small movements. Must be a power of two. Default is @code{32}.
  4806. @item ppsrc
  4807. Mark main input as a pre-processed input and activate clean source input
  4808. stream. This allows the input to be pre-processed with various filters to help
  4809. the metrics calculation while keeping the frame selection lossless. When set to
  4810. @code{1}, the first stream is for the pre-processed input, and the second
  4811. stream is the clean source from where the kept frames are chosen. Default is
  4812. @code{0}.
  4813. @item chroma
  4814. Set whether or not chroma is considered in the metric calculations. Default is
  4815. @code{1}.
  4816. @end table
  4817. @section deflate
  4818. Apply deflate effect to the video.
  4819. This filter replaces the pixel by the local(3x3) average by taking into account
  4820. only values lower than the pixel.
  4821. It accepts the following options:
  4822. @table @option
  4823. @item threshold0
  4824. @item threshold1
  4825. @item threshold2
  4826. @item threshold3
  4827. Limit the maximum change for each plane, default is 65535.
  4828. If 0, plane will remain unchanged.
  4829. @end table
  4830. @section dejudder
  4831. Remove judder produced by partially interlaced telecined content.
  4832. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4833. source was partially telecined content then the output of @code{pullup,dejudder}
  4834. will have a variable frame rate. May change the recorded frame rate of the
  4835. container. Aside from that change, this filter will not affect constant frame
  4836. rate video.
  4837. The option available in this filter is:
  4838. @table @option
  4839. @item cycle
  4840. Specify the length of the window over which the judder repeats.
  4841. Accepts any integer greater than 1. Useful values are:
  4842. @table @samp
  4843. @item 4
  4844. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4845. @item 5
  4846. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4847. @item 20
  4848. If a mixture of the two.
  4849. @end table
  4850. The default is @samp{4}.
  4851. @end table
  4852. @section delogo
  4853. Suppress a TV station logo by a simple interpolation of the surrounding
  4854. pixels. Just set a rectangle covering the logo and watch it disappear
  4855. (and sometimes something even uglier appear - your mileage may vary).
  4856. It accepts the following parameters:
  4857. @table @option
  4858. @item x
  4859. @item y
  4860. Specify the top left corner coordinates of the logo. They must be
  4861. specified.
  4862. @item w
  4863. @item h
  4864. Specify the width and height of the logo to clear. They must be
  4865. specified.
  4866. @item band, t
  4867. Specify the thickness of the fuzzy edge of the rectangle (added to
  4868. @var{w} and @var{h}). The default value is 1. This option is
  4869. deprecated, setting higher values should no longer be necessary and
  4870. is not recommended.
  4871. @item show
  4872. When set to 1, a green rectangle is drawn on the screen to simplify
  4873. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4874. The default value is 0.
  4875. The rectangle is drawn on the outermost pixels which will be (partly)
  4876. replaced with interpolated values. The values of the next pixels
  4877. immediately outside this rectangle in each direction will be used to
  4878. compute the interpolated pixel values inside the rectangle.
  4879. @end table
  4880. @subsection Examples
  4881. @itemize
  4882. @item
  4883. Set a rectangle covering the area with top left corner coordinates 0,0
  4884. and size 100x77, and a band of size 10:
  4885. @example
  4886. delogo=x=0:y=0:w=100:h=77:band=10
  4887. @end example
  4888. @end itemize
  4889. @section deshake
  4890. Attempt to fix small changes in horizontal and/or vertical shift. This
  4891. filter helps remove camera shake from hand-holding a camera, bumping a
  4892. tripod, moving on a vehicle, etc.
  4893. The filter accepts the following options:
  4894. @table @option
  4895. @item x
  4896. @item y
  4897. @item w
  4898. @item h
  4899. Specify a rectangular area where to limit the search for motion
  4900. vectors.
  4901. If desired the search for motion vectors can be limited to a
  4902. rectangular area of the frame defined by its top left corner, width
  4903. and height. These parameters have the same meaning as the drawbox
  4904. filter which can be used to visualise the position of the bounding
  4905. box.
  4906. This is useful when simultaneous movement of subjects within the frame
  4907. might be confused for camera motion by the motion vector search.
  4908. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4909. then the full frame is used. This allows later options to be set
  4910. without specifying the bounding box for the motion vector search.
  4911. Default - search the whole frame.
  4912. @item rx
  4913. @item ry
  4914. Specify the maximum extent of movement in x and y directions in the
  4915. range 0-64 pixels. Default 16.
  4916. @item edge
  4917. Specify how to generate pixels to fill blanks at the edge of the
  4918. frame. Available values are:
  4919. @table @samp
  4920. @item blank, 0
  4921. Fill zeroes at blank locations
  4922. @item original, 1
  4923. Original image at blank locations
  4924. @item clamp, 2
  4925. Extruded edge value at blank locations
  4926. @item mirror, 3
  4927. Mirrored edge at blank locations
  4928. @end table
  4929. Default value is @samp{mirror}.
  4930. @item blocksize
  4931. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4932. default 8.
  4933. @item contrast
  4934. Specify the contrast threshold for blocks. Only blocks with more than
  4935. the specified contrast (difference between darkest and lightest
  4936. pixels) will be considered. Range 1-255, default 125.
  4937. @item search
  4938. Specify the search strategy. Available values are:
  4939. @table @samp
  4940. @item exhaustive, 0
  4941. Set exhaustive search
  4942. @item less, 1
  4943. Set less exhaustive search.
  4944. @end table
  4945. Default value is @samp{exhaustive}.
  4946. @item filename
  4947. If set then a detailed log of the motion search is written to the
  4948. specified file.
  4949. @item opencl
  4950. If set to 1, specify using OpenCL capabilities, only available if
  4951. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4952. @end table
  4953. @section detelecine
  4954. Apply an exact inverse of the telecine operation. It requires a predefined
  4955. pattern specified using the pattern option which must be the same as that passed
  4956. to the telecine filter.
  4957. This filter accepts the following options:
  4958. @table @option
  4959. @item first_field
  4960. @table @samp
  4961. @item top, t
  4962. top field first
  4963. @item bottom, b
  4964. bottom field first
  4965. The default value is @code{top}.
  4966. @end table
  4967. @item pattern
  4968. A string of numbers representing the pulldown pattern you wish to apply.
  4969. The default value is @code{23}.
  4970. @item start_frame
  4971. A number representing position of the first frame with respect to the telecine
  4972. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4973. @end table
  4974. @section dilation
  4975. Apply dilation effect to the video.
  4976. This filter replaces the pixel by the local(3x3) maximum.
  4977. It accepts the following options:
  4978. @table @option
  4979. @item threshold0
  4980. @item threshold1
  4981. @item threshold2
  4982. @item threshold3
  4983. Limit the maximum change for each plane, default is 65535.
  4984. If 0, plane will remain unchanged.
  4985. @item coordinates
  4986. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4987. pixels are used.
  4988. Flags to local 3x3 coordinates maps like this:
  4989. 1 2 3
  4990. 4 5
  4991. 6 7 8
  4992. @end table
  4993. @section displace
  4994. Displace pixels as indicated by second and third input stream.
  4995. It takes three input streams and outputs one stream, the first input is the
  4996. source, and second and third input are displacement maps.
  4997. The second input specifies how much to displace pixels along the
  4998. x-axis, while the third input specifies how much to displace pixels
  4999. along the y-axis.
  5000. If one of displacement map streams terminates, last frame from that
  5001. displacement map will be used.
  5002. Note that once generated, displacements maps can be reused over and over again.
  5003. A description of the accepted options follows.
  5004. @table @option
  5005. @item edge
  5006. Set displace behavior for pixels that are out of range.
  5007. Available values are:
  5008. @table @samp
  5009. @item blank
  5010. Missing pixels are replaced by black pixels.
  5011. @item smear
  5012. Adjacent pixels will spread out to replace missing pixels.
  5013. @item wrap
  5014. Out of range pixels are wrapped so they point to pixels of other side.
  5015. @end table
  5016. Default is @samp{smear}.
  5017. @end table
  5018. @subsection Examples
  5019. @itemize
  5020. @item
  5021. Add ripple effect to rgb input of video size hd720:
  5022. @example
  5023. 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
  5024. @end example
  5025. @item
  5026. Add wave effect to rgb input of video size hd720:
  5027. @example
  5028. 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
  5029. @end example
  5030. @end itemize
  5031. @section drawbox
  5032. Draw a colored box on the input image.
  5033. It accepts the following parameters:
  5034. @table @option
  5035. @item x
  5036. @item y
  5037. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5038. @item width, w
  5039. @item height, h
  5040. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5041. the input width and height. It defaults to 0.
  5042. @item color, c
  5043. Specify the color of the box to write. For the general syntax of this option,
  5044. check the "Color" section in the ffmpeg-utils manual. If the special
  5045. value @code{invert} is used, the box edge color is the same as the
  5046. video with inverted luma.
  5047. @item thickness, t
  5048. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5049. See below for the list of accepted constants.
  5050. @end table
  5051. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5052. following constants:
  5053. @table @option
  5054. @item dar
  5055. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5056. @item hsub
  5057. @item vsub
  5058. horizontal and vertical chroma subsample values. For example for the
  5059. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5060. @item in_h, ih
  5061. @item in_w, iw
  5062. The input width and height.
  5063. @item sar
  5064. The input sample aspect ratio.
  5065. @item x
  5066. @item y
  5067. The x and y offset coordinates where the box is drawn.
  5068. @item w
  5069. @item h
  5070. The width and height of the drawn box.
  5071. @item t
  5072. The thickness of the drawn box.
  5073. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5074. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5075. @end table
  5076. @subsection Examples
  5077. @itemize
  5078. @item
  5079. Draw a black box around the edge of the input image:
  5080. @example
  5081. drawbox
  5082. @end example
  5083. @item
  5084. Draw a box with color red and an opacity of 50%:
  5085. @example
  5086. drawbox=10:20:200:60:red@@0.5
  5087. @end example
  5088. The previous example can be specified as:
  5089. @example
  5090. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5091. @end example
  5092. @item
  5093. Fill the box with pink color:
  5094. @example
  5095. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5096. @end example
  5097. @item
  5098. Draw a 2-pixel red 2.40:1 mask:
  5099. @example
  5100. 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
  5101. @end example
  5102. @end itemize
  5103. @section drawgrid
  5104. Draw a grid on the input image.
  5105. It accepts the following parameters:
  5106. @table @option
  5107. @item x
  5108. @item y
  5109. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5110. @item width, w
  5111. @item height, h
  5112. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5113. input width and height, respectively, minus @code{thickness}, so image gets
  5114. framed. Default to 0.
  5115. @item color, c
  5116. Specify the color of the grid. For the general syntax of this option,
  5117. check the "Color" section in the ffmpeg-utils manual. If the special
  5118. value @code{invert} is used, the grid color is the same as the
  5119. video with inverted luma.
  5120. @item thickness, t
  5121. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5122. See below for the list of accepted constants.
  5123. @end table
  5124. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5125. following constants:
  5126. @table @option
  5127. @item dar
  5128. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5129. @item hsub
  5130. @item vsub
  5131. horizontal and vertical chroma subsample values. For example for the
  5132. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5133. @item in_h, ih
  5134. @item in_w, iw
  5135. The input grid cell width and height.
  5136. @item sar
  5137. The input sample aspect ratio.
  5138. @item x
  5139. @item y
  5140. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5141. @item w
  5142. @item h
  5143. The width and height of the drawn cell.
  5144. @item t
  5145. The thickness of the drawn cell.
  5146. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5147. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5148. @end table
  5149. @subsection Examples
  5150. @itemize
  5151. @item
  5152. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5153. @example
  5154. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5155. @end example
  5156. @item
  5157. Draw a white 3x3 grid with an opacity of 50%:
  5158. @example
  5159. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5160. @end example
  5161. @end itemize
  5162. @anchor{drawtext}
  5163. @section drawtext
  5164. Draw a text string or text from a specified file on top of a video, using the
  5165. libfreetype library.
  5166. To enable compilation of this filter, you need to configure FFmpeg with
  5167. @code{--enable-libfreetype}.
  5168. To enable default font fallback and the @var{font} option you need to
  5169. configure FFmpeg with @code{--enable-libfontconfig}.
  5170. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5171. @code{--enable-libfribidi}.
  5172. @subsection Syntax
  5173. It accepts the following parameters:
  5174. @table @option
  5175. @item box
  5176. Used to draw a box around text using the background color.
  5177. The value must be either 1 (enable) or 0 (disable).
  5178. The default value of @var{box} is 0.
  5179. @item boxborderw
  5180. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5181. The default value of @var{boxborderw} is 0.
  5182. @item boxcolor
  5183. The color to be used for drawing box around text. For the syntax of this
  5184. option, check the "Color" section in the ffmpeg-utils manual.
  5185. The default value of @var{boxcolor} is "white".
  5186. @item borderw
  5187. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5188. The default value of @var{borderw} is 0.
  5189. @item bordercolor
  5190. Set the color to be used for drawing border around text. For the syntax of this
  5191. option, check the "Color" section in the ffmpeg-utils manual.
  5192. The default value of @var{bordercolor} is "black".
  5193. @item expansion
  5194. Select how the @var{text} is expanded. Can be either @code{none},
  5195. @code{strftime} (deprecated) or
  5196. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5197. below for details.
  5198. @item fix_bounds
  5199. If true, check and fix text coords to avoid clipping.
  5200. @item fontcolor
  5201. The color to be used for drawing fonts. For the syntax of this option, check
  5202. the "Color" section in the ffmpeg-utils manual.
  5203. The default value of @var{fontcolor} is "black".
  5204. @item fontcolor_expr
  5205. String which is expanded the same way as @var{text} to obtain dynamic
  5206. @var{fontcolor} value. By default this option has empty value and is not
  5207. processed. When this option is set, it overrides @var{fontcolor} option.
  5208. @item font
  5209. The font family to be used for drawing text. By default Sans.
  5210. @item fontfile
  5211. The font file to be used for drawing text. The path must be included.
  5212. This parameter is mandatory if the fontconfig support is disabled.
  5213. @item draw
  5214. This option does not exist, please see the timeline system
  5215. @item alpha
  5216. Draw the text applying alpha blending. The value can
  5217. be a number between 0.0 and 1.0.
  5218. The expression accepts the same variables @var{x, y} as well.
  5219. The default value is 1.
  5220. Please see @var{fontcolor_expr}.
  5221. @item fontsize
  5222. The font size to be used for drawing text.
  5223. The default value of @var{fontsize} is 16.
  5224. @item text_shaping
  5225. If set to 1, attempt to shape the text (for example, reverse the order of
  5226. right-to-left text and join Arabic characters) before drawing it.
  5227. Otherwise, just draw the text exactly as given.
  5228. By default 1 (if supported).
  5229. @item ft_load_flags
  5230. The flags to be used for loading the fonts.
  5231. The flags map the corresponding flags supported by libfreetype, and are
  5232. a combination of the following values:
  5233. @table @var
  5234. @item default
  5235. @item no_scale
  5236. @item no_hinting
  5237. @item render
  5238. @item no_bitmap
  5239. @item vertical_layout
  5240. @item force_autohint
  5241. @item crop_bitmap
  5242. @item pedantic
  5243. @item ignore_global_advance_width
  5244. @item no_recurse
  5245. @item ignore_transform
  5246. @item monochrome
  5247. @item linear_design
  5248. @item no_autohint
  5249. @end table
  5250. Default value is "default".
  5251. For more information consult the documentation for the FT_LOAD_*
  5252. libfreetype flags.
  5253. @item shadowcolor
  5254. The color to be used for drawing a shadow behind the drawn text. For the
  5255. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5256. The default value of @var{shadowcolor} is "black".
  5257. @item shadowx
  5258. @item shadowy
  5259. The x and y offsets for the text shadow position with respect to the
  5260. position of the text. They can be either positive or negative
  5261. values. The default value for both is "0".
  5262. @item start_number
  5263. The starting frame number for the n/frame_num variable. The default value
  5264. is "0".
  5265. @item tabsize
  5266. The size in number of spaces to use for rendering the tab.
  5267. Default value is 4.
  5268. @item timecode
  5269. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5270. format. It can be used with or without text parameter. @var{timecode_rate}
  5271. option must be specified.
  5272. @item timecode_rate, rate, r
  5273. Set the timecode frame rate (timecode only).
  5274. @item text
  5275. The text string to be drawn. The text must be a sequence of UTF-8
  5276. encoded characters.
  5277. This parameter is mandatory if no file is specified with the parameter
  5278. @var{textfile}.
  5279. @item textfile
  5280. A text file containing text to be drawn. The text must be a sequence
  5281. of UTF-8 encoded characters.
  5282. This parameter is mandatory if no text string is specified with the
  5283. parameter @var{text}.
  5284. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5285. @item reload
  5286. If set to 1, the @var{textfile} will be reloaded before each frame.
  5287. Be sure to update it atomically, or it may be read partially, or even fail.
  5288. @item x
  5289. @item y
  5290. The expressions which specify the offsets where text will be drawn
  5291. within the video frame. They are relative to the top/left border of the
  5292. output image.
  5293. The default value of @var{x} and @var{y} is "0".
  5294. See below for the list of accepted constants and functions.
  5295. @end table
  5296. The parameters for @var{x} and @var{y} are expressions containing the
  5297. following constants and functions:
  5298. @table @option
  5299. @item dar
  5300. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5301. @item hsub
  5302. @item vsub
  5303. horizontal and vertical chroma subsample values. For example for the
  5304. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5305. @item line_h, lh
  5306. the height of each text line
  5307. @item main_h, h, H
  5308. the input height
  5309. @item main_w, w, W
  5310. the input width
  5311. @item max_glyph_a, ascent
  5312. the maximum distance from the baseline to the highest/upper grid
  5313. coordinate used to place a glyph outline point, for all the rendered
  5314. glyphs.
  5315. It is a positive value, due to the grid's orientation with the Y axis
  5316. upwards.
  5317. @item max_glyph_d, descent
  5318. the maximum distance from the baseline to the lowest grid coordinate
  5319. used to place a glyph outline point, for all the rendered glyphs.
  5320. This is a negative value, due to the grid's orientation, with the Y axis
  5321. upwards.
  5322. @item max_glyph_h
  5323. maximum glyph height, that is the maximum height for all the glyphs
  5324. contained in the rendered text, it is equivalent to @var{ascent} -
  5325. @var{descent}.
  5326. @item max_glyph_w
  5327. maximum glyph width, that is the maximum width for all the glyphs
  5328. contained in the rendered text
  5329. @item n
  5330. the number of input frame, starting from 0
  5331. @item rand(min, max)
  5332. return a random number included between @var{min} and @var{max}
  5333. @item sar
  5334. The input sample aspect ratio.
  5335. @item t
  5336. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5337. @item text_h, th
  5338. the height of the rendered text
  5339. @item text_w, tw
  5340. the width of the rendered text
  5341. @item x
  5342. @item y
  5343. the x and y offset coordinates where the text is drawn.
  5344. These parameters allow the @var{x} and @var{y} expressions to refer
  5345. each other, so you can for example specify @code{y=x/dar}.
  5346. @end table
  5347. @anchor{drawtext_expansion}
  5348. @subsection Text expansion
  5349. If @option{expansion} is set to @code{strftime},
  5350. the filter recognizes strftime() sequences in the provided text and
  5351. expands them accordingly. Check the documentation of strftime(). This
  5352. feature is deprecated.
  5353. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5354. If @option{expansion} is set to @code{normal} (which is the default),
  5355. the following expansion mechanism is used.
  5356. The backslash character @samp{\}, followed by any character, always expands to
  5357. the second character.
  5358. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5359. braces is a function name, possibly followed by arguments separated by ':'.
  5360. If the arguments contain special characters or delimiters (':' or '@}'),
  5361. they should be escaped.
  5362. Note that they probably must also be escaped as the value for the
  5363. @option{text} option in the filter argument string and as the filter
  5364. argument in the filtergraph description, and possibly also for the shell,
  5365. that makes up to four levels of escaping; using a text file avoids these
  5366. problems.
  5367. The following functions are available:
  5368. @table @command
  5369. @item expr, e
  5370. The expression evaluation result.
  5371. It must take one argument specifying the expression to be evaluated,
  5372. which accepts the same constants and functions as the @var{x} and
  5373. @var{y} values. Note that not all constants should be used, for
  5374. example the text size is not known when evaluating the expression, so
  5375. the constants @var{text_w} and @var{text_h} will have an undefined
  5376. value.
  5377. @item expr_int_format, eif
  5378. Evaluate the expression's value and output as formatted integer.
  5379. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5380. The second argument specifies the output format. Allowed values are @samp{x},
  5381. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5382. @code{printf} function.
  5383. The third parameter is optional and sets the number of positions taken by the output.
  5384. It can be used to add padding with zeros from the left.
  5385. @item gmtime
  5386. The time at which the filter is running, expressed in UTC.
  5387. It can accept an argument: a strftime() format string.
  5388. @item localtime
  5389. The time at which the filter is running, expressed in the local time zone.
  5390. It can accept an argument: a strftime() format string.
  5391. @item metadata
  5392. Frame metadata. Takes one or two arguments.
  5393. The first argument is mandatory and specifies the metadata key.
  5394. The second argument is optional and specifies a default value, used when the
  5395. metadata key is not found or empty.
  5396. @item n, frame_num
  5397. The frame number, starting from 0.
  5398. @item pict_type
  5399. A 1 character description of the current picture type.
  5400. @item pts
  5401. The timestamp of the current frame.
  5402. It can take up to three arguments.
  5403. The first argument is the format of the timestamp; it defaults to @code{flt}
  5404. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5405. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5406. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5407. @code{localtime} stands for the timestamp of the frame formatted as
  5408. local time zone time.
  5409. The second argument is an offset added to the timestamp.
  5410. If the format is set to @code{localtime} or @code{gmtime},
  5411. a third argument may be supplied: a strftime() format string.
  5412. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5413. @end table
  5414. @subsection Examples
  5415. @itemize
  5416. @item
  5417. Draw "Test Text" with font FreeSerif, using the default values for the
  5418. optional parameters.
  5419. @example
  5420. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5421. @end example
  5422. @item
  5423. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5424. and y=50 (counting from the top-left corner of the screen), text is
  5425. yellow with a red box around it. Both the text and the box have an
  5426. opacity of 20%.
  5427. @example
  5428. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5429. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5430. @end example
  5431. Note that the double quotes are not necessary if spaces are not used
  5432. within the parameter list.
  5433. @item
  5434. Show the text at the center of the video frame:
  5435. @example
  5436. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5437. @end example
  5438. @item
  5439. Show the text at a random position, switching to a new position every 30 seconds:
  5440. @example
  5441. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  5442. @end example
  5443. @item
  5444. Show a text line sliding from right to left in the last row of the video
  5445. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5446. with no newlines.
  5447. @example
  5448. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5449. @end example
  5450. @item
  5451. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5452. @example
  5453. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5454. @end example
  5455. @item
  5456. Draw a single green letter "g", at the center of the input video.
  5457. The glyph baseline is placed at half screen height.
  5458. @example
  5459. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5460. @end example
  5461. @item
  5462. Show text for 1 second every 3 seconds:
  5463. @example
  5464. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5465. @end example
  5466. @item
  5467. Use fontconfig to set the font. Note that the colons need to be escaped.
  5468. @example
  5469. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5470. @end example
  5471. @item
  5472. Print the date of a real-time encoding (see strftime(3)):
  5473. @example
  5474. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5475. @end example
  5476. @item
  5477. Show text fading in and out (appearing/disappearing):
  5478. @example
  5479. #!/bin/sh
  5480. DS=1.0 # display start
  5481. DE=10.0 # display end
  5482. FID=1.5 # fade in duration
  5483. FOD=5 # fade out duration
  5484. 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 @}"
  5485. @end example
  5486. @end itemize
  5487. For more information about libfreetype, check:
  5488. @url{http://www.freetype.org/}.
  5489. For more information about fontconfig, check:
  5490. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5491. For more information about libfribidi, check:
  5492. @url{http://fribidi.org/}.
  5493. @section edgedetect
  5494. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5495. The filter accepts the following options:
  5496. @table @option
  5497. @item low
  5498. @item high
  5499. Set low and high threshold values used by the Canny thresholding
  5500. algorithm.
  5501. The high threshold selects the "strong" edge pixels, which are then
  5502. connected through 8-connectivity with the "weak" edge pixels selected
  5503. by the low threshold.
  5504. @var{low} and @var{high} threshold values must be chosen in the range
  5505. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5506. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5507. is @code{50/255}.
  5508. @item mode
  5509. Define the drawing mode.
  5510. @table @samp
  5511. @item wires
  5512. Draw white/gray wires on black background.
  5513. @item colormix
  5514. Mix the colors to create a paint/cartoon effect.
  5515. @end table
  5516. Default value is @var{wires}.
  5517. @end table
  5518. @subsection Examples
  5519. @itemize
  5520. @item
  5521. Standard edge detection with custom values for the hysteresis thresholding:
  5522. @example
  5523. edgedetect=low=0.1:high=0.4
  5524. @end example
  5525. @item
  5526. Painting effect without thresholding:
  5527. @example
  5528. edgedetect=mode=colormix:high=0
  5529. @end example
  5530. @end itemize
  5531. @section eq
  5532. Set brightness, contrast, saturation and approximate gamma adjustment.
  5533. The filter accepts the following options:
  5534. @table @option
  5535. @item contrast
  5536. Set the contrast expression. The value must be a float value in range
  5537. @code{-2.0} to @code{2.0}. The default value is "1".
  5538. @item brightness
  5539. Set the brightness expression. The value must be a float value in
  5540. range @code{-1.0} to @code{1.0}. The default value is "0".
  5541. @item saturation
  5542. Set the saturation expression. The value must be a float in
  5543. range @code{0.0} to @code{3.0}. The default value is "1".
  5544. @item gamma
  5545. Set the gamma expression. The value must be a float in range
  5546. @code{0.1} to @code{10.0}. The default value is "1".
  5547. @item gamma_r
  5548. Set the gamma expression for red. The value must be a float in
  5549. range @code{0.1} to @code{10.0}. The default value is "1".
  5550. @item gamma_g
  5551. Set the gamma expression for green. The value must be a float in range
  5552. @code{0.1} to @code{10.0}. The default value is "1".
  5553. @item gamma_b
  5554. Set the gamma expression for blue. The value must be a float in range
  5555. @code{0.1} to @code{10.0}. The default value is "1".
  5556. @item gamma_weight
  5557. Set the gamma weight expression. It can be used to reduce the effect
  5558. of a high gamma value on bright image areas, e.g. keep them from
  5559. getting overamplified and just plain white. The value must be a float
  5560. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5561. gamma correction all the way down while @code{1.0} leaves it at its
  5562. full strength. Default is "1".
  5563. @item eval
  5564. Set when the expressions for brightness, contrast, saturation and
  5565. gamma expressions are evaluated.
  5566. It accepts the following values:
  5567. @table @samp
  5568. @item init
  5569. only evaluate expressions once during the filter initialization or
  5570. when a command is processed
  5571. @item frame
  5572. evaluate expressions for each incoming frame
  5573. @end table
  5574. Default value is @samp{init}.
  5575. @end table
  5576. The expressions accept the following parameters:
  5577. @table @option
  5578. @item n
  5579. frame count of the input frame starting from 0
  5580. @item pos
  5581. byte position of the corresponding packet in the input file, NAN if
  5582. unspecified
  5583. @item r
  5584. frame rate of the input video, NAN if the input frame rate is unknown
  5585. @item t
  5586. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5587. @end table
  5588. @subsection Commands
  5589. The filter supports the following commands:
  5590. @table @option
  5591. @item contrast
  5592. Set the contrast expression.
  5593. @item brightness
  5594. Set the brightness expression.
  5595. @item saturation
  5596. Set the saturation expression.
  5597. @item gamma
  5598. Set the gamma expression.
  5599. @item gamma_r
  5600. Set the gamma_r expression.
  5601. @item gamma_g
  5602. Set gamma_g expression.
  5603. @item gamma_b
  5604. Set gamma_b expression.
  5605. @item gamma_weight
  5606. Set gamma_weight expression.
  5607. The command accepts the same syntax of the corresponding option.
  5608. If the specified expression is not valid, it is kept at its current
  5609. value.
  5610. @end table
  5611. @section erosion
  5612. Apply erosion effect to the video.
  5613. This filter replaces the pixel by the local(3x3) minimum.
  5614. It accepts the following options:
  5615. @table @option
  5616. @item threshold0
  5617. @item threshold1
  5618. @item threshold2
  5619. @item threshold3
  5620. Limit the maximum change for each plane, default is 65535.
  5621. If 0, plane will remain unchanged.
  5622. @item coordinates
  5623. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5624. pixels are used.
  5625. Flags to local 3x3 coordinates maps like this:
  5626. 1 2 3
  5627. 4 5
  5628. 6 7 8
  5629. @end table
  5630. @section extractplanes
  5631. Extract color channel components from input video stream into
  5632. separate grayscale video streams.
  5633. The filter accepts the following option:
  5634. @table @option
  5635. @item planes
  5636. Set plane(s) to extract.
  5637. Available values for planes are:
  5638. @table @samp
  5639. @item y
  5640. @item u
  5641. @item v
  5642. @item a
  5643. @item r
  5644. @item g
  5645. @item b
  5646. @end table
  5647. Choosing planes not available in the input will result in an error.
  5648. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5649. with @code{y}, @code{u}, @code{v} planes at same time.
  5650. @end table
  5651. @subsection Examples
  5652. @itemize
  5653. @item
  5654. Extract luma, u and v color channel component from input video frame
  5655. into 3 grayscale outputs:
  5656. @example
  5657. 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
  5658. @end example
  5659. @end itemize
  5660. @section elbg
  5661. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5662. For each input image, the filter will compute the optimal mapping from
  5663. the input to the output given the codebook length, that is the number
  5664. of distinct output colors.
  5665. This filter accepts the following options.
  5666. @table @option
  5667. @item codebook_length, l
  5668. Set codebook length. The value must be a positive integer, and
  5669. represents the number of distinct output colors. Default value is 256.
  5670. @item nb_steps, n
  5671. Set the maximum number of iterations to apply for computing the optimal
  5672. mapping. The higher the value the better the result and the higher the
  5673. computation time. Default value is 1.
  5674. @item seed, s
  5675. Set a random seed, must be an integer included between 0 and
  5676. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5677. will try to use a good random seed on a best effort basis.
  5678. @item pal8
  5679. Set pal8 output pixel format. This option does not work with codebook
  5680. length greater than 256.
  5681. @end table
  5682. @section fade
  5683. Apply a fade-in/out effect to the input video.
  5684. It accepts the following parameters:
  5685. @table @option
  5686. @item type, t
  5687. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5688. effect.
  5689. Default is @code{in}.
  5690. @item start_frame, s
  5691. Specify the number of the frame to start applying the fade
  5692. effect at. Default is 0.
  5693. @item nb_frames, n
  5694. The number of frames that the fade effect lasts. At the end of the
  5695. fade-in effect, the output video will have the same intensity as the input video.
  5696. At the end of the fade-out transition, the output video will be filled with the
  5697. selected @option{color}.
  5698. Default is 25.
  5699. @item alpha
  5700. If set to 1, fade only alpha channel, if one exists on the input.
  5701. Default value is 0.
  5702. @item start_time, st
  5703. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5704. effect. If both start_frame and start_time are specified, the fade will start at
  5705. whichever comes last. Default is 0.
  5706. @item duration, d
  5707. The number of seconds for which the fade effect has to last. At the end of the
  5708. fade-in effect the output video will have the same intensity as the input video,
  5709. at the end of the fade-out transition the output video will be filled with the
  5710. selected @option{color}.
  5711. If both duration and nb_frames are specified, duration is used. Default is 0
  5712. (nb_frames is used by default).
  5713. @item color, c
  5714. Specify the color of the fade. Default is "black".
  5715. @end table
  5716. @subsection Examples
  5717. @itemize
  5718. @item
  5719. Fade in the first 30 frames of video:
  5720. @example
  5721. fade=in:0:30
  5722. @end example
  5723. The command above is equivalent to:
  5724. @example
  5725. fade=t=in:s=0:n=30
  5726. @end example
  5727. @item
  5728. Fade out the last 45 frames of a 200-frame video:
  5729. @example
  5730. fade=out:155:45
  5731. fade=type=out:start_frame=155:nb_frames=45
  5732. @end example
  5733. @item
  5734. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5735. @example
  5736. fade=in:0:25, fade=out:975:25
  5737. @end example
  5738. @item
  5739. Make the first 5 frames yellow, then fade in from frame 5-24:
  5740. @example
  5741. fade=in:5:20:color=yellow
  5742. @end example
  5743. @item
  5744. Fade in alpha over first 25 frames of video:
  5745. @example
  5746. fade=in:0:25:alpha=1
  5747. @end example
  5748. @item
  5749. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5750. @example
  5751. fade=t=in:st=5.5:d=0.5
  5752. @end example
  5753. @end itemize
  5754. @section fftfilt
  5755. Apply arbitrary expressions to samples in frequency domain
  5756. @table @option
  5757. @item dc_Y
  5758. Adjust the dc value (gain) of the luma plane of the image. The filter
  5759. accepts an integer value in range @code{0} to @code{1000}. The default
  5760. value is set to @code{0}.
  5761. @item dc_U
  5762. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5763. filter accepts an integer value in range @code{0} to @code{1000}. The
  5764. default value is set to @code{0}.
  5765. @item dc_V
  5766. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5767. filter accepts an integer value in range @code{0} to @code{1000}. The
  5768. default value is set to @code{0}.
  5769. @item weight_Y
  5770. Set the frequency domain weight expression for the luma plane.
  5771. @item weight_U
  5772. Set the frequency domain weight expression for the 1st chroma plane.
  5773. @item weight_V
  5774. Set the frequency domain weight expression for the 2nd chroma plane.
  5775. The filter accepts the following variables:
  5776. @item X
  5777. @item Y
  5778. The coordinates of the current sample.
  5779. @item W
  5780. @item H
  5781. The width and height of the image.
  5782. @end table
  5783. @subsection Examples
  5784. @itemize
  5785. @item
  5786. High-pass:
  5787. @example
  5788. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5789. @end example
  5790. @item
  5791. Low-pass:
  5792. @example
  5793. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5794. @end example
  5795. @item
  5796. Sharpen:
  5797. @example
  5798. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5799. @end example
  5800. @item
  5801. Blur:
  5802. @example
  5803. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5804. @end example
  5805. @end itemize
  5806. @section field
  5807. Extract a single field from an interlaced image using stride
  5808. arithmetic to avoid wasting CPU time. The output frames are marked as
  5809. non-interlaced.
  5810. The filter accepts the following options:
  5811. @table @option
  5812. @item type
  5813. Specify whether to extract the top (if the value is @code{0} or
  5814. @code{top}) or the bottom field (if the value is @code{1} or
  5815. @code{bottom}).
  5816. @end table
  5817. @section fieldhint
  5818. Create new frames by copying the top and bottom fields from surrounding frames
  5819. supplied as numbers by the hint file.
  5820. @table @option
  5821. @item hint
  5822. Set file containing hints: absolute/relative frame numbers.
  5823. There must be one line for each frame in a clip. Each line must contain two
  5824. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5825. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5826. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5827. for @code{relative} mode. First number tells from which frame to pick up top
  5828. field and second number tells from which frame to pick up bottom field.
  5829. If optionally followed by @code{+} output frame will be marked as interlaced,
  5830. else if followed by @code{-} output frame will be marked as progressive, else
  5831. it will be marked same as input frame.
  5832. If line starts with @code{#} or @code{;} that line is skipped.
  5833. @item mode
  5834. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5835. @end table
  5836. Example of first several lines of @code{hint} file for @code{relative} mode:
  5837. @example
  5838. 0,0 - # first frame
  5839. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5840. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5841. 1,0 -
  5842. 0,0 -
  5843. 0,0 -
  5844. 1,0 -
  5845. 1,0 -
  5846. 1,0 -
  5847. 0,0 -
  5848. 0,0 -
  5849. 1,0 -
  5850. 1,0 -
  5851. 1,0 -
  5852. 0,0 -
  5853. @end example
  5854. @section fieldmatch
  5855. Field matching filter for inverse telecine. It is meant to reconstruct the
  5856. progressive frames from a telecined stream. The filter does not drop duplicated
  5857. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5858. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5859. The separation of the field matching and the decimation is notably motivated by
  5860. the possibility of inserting a de-interlacing filter fallback between the two.
  5861. If the source has mixed telecined and real interlaced content,
  5862. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5863. But these remaining combed frames will be marked as interlaced, and thus can be
  5864. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5865. In addition to the various configuration options, @code{fieldmatch} can take an
  5866. optional second stream, activated through the @option{ppsrc} option. If
  5867. enabled, the frames reconstruction will be based on the fields and frames from
  5868. this second stream. This allows the first input to be pre-processed in order to
  5869. help the various algorithms of the filter, while keeping the output lossless
  5870. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5871. or brightness/contrast adjustments can help.
  5872. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5873. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5874. which @code{fieldmatch} is based on. While the semantic and usage are very
  5875. close, some behaviour and options names can differ.
  5876. The @ref{decimate} filter currently only works for constant frame rate input.
  5877. If your input has mixed telecined (30fps) and progressive content with a lower
  5878. framerate like 24fps use the following filterchain to produce the necessary cfr
  5879. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5880. The filter accepts the following options:
  5881. @table @option
  5882. @item order
  5883. Specify the assumed field order of the input stream. Available values are:
  5884. @table @samp
  5885. @item auto
  5886. Auto detect parity (use FFmpeg's internal parity value).
  5887. @item bff
  5888. Assume bottom field first.
  5889. @item tff
  5890. Assume top field first.
  5891. @end table
  5892. Note that it is sometimes recommended not to trust the parity announced by the
  5893. stream.
  5894. Default value is @var{auto}.
  5895. @item mode
  5896. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5897. sense that it won't risk creating jerkiness due to duplicate frames when
  5898. possible, but if there are bad edits or blended fields it will end up
  5899. outputting combed frames when a good match might actually exist. On the other
  5900. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5901. but will almost always find a good frame if there is one. The other values are
  5902. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5903. jerkiness and creating duplicate frames versus finding good matches in sections
  5904. with bad edits, orphaned fields, blended fields, etc.
  5905. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5906. Available values are:
  5907. @table @samp
  5908. @item pc
  5909. 2-way matching (p/c)
  5910. @item pc_n
  5911. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5912. @item pc_u
  5913. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5914. @item pc_n_ub
  5915. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5916. still combed (p/c + n + u/b)
  5917. @item pcn
  5918. 3-way matching (p/c/n)
  5919. @item pcn_ub
  5920. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5921. detected as combed (p/c/n + u/b)
  5922. @end table
  5923. The parenthesis at the end indicate the matches that would be used for that
  5924. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5925. @var{top}).
  5926. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5927. the slowest.
  5928. Default value is @var{pc_n}.
  5929. @item ppsrc
  5930. Mark the main input stream as a pre-processed input, and enable the secondary
  5931. input stream as the clean source to pick the fields from. See the filter
  5932. introduction for more details. It is similar to the @option{clip2} feature from
  5933. VFM/TFM.
  5934. Default value is @code{0} (disabled).
  5935. @item field
  5936. Set the field to match from. It is recommended to set this to the same value as
  5937. @option{order} unless you experience matching failures with that setting. In
  5938. certain circumstances changing the field that is used to match from can have a
  5939. large impact on matching performance. Available values are:
  5940. @table @samp
  5941. @item auto
  5942. Automatic (same value as @option{order}).
  5943. @item bottom
  5944. Match from the bottom field.
  5945. @item top
  5946. Match from the top field.
  5947. @end table
  5948. Default value is @var{auto}.
  5949. @item mchroma
  5950. Set whether or not chroma is included during the match comparisons. In most
  5951. cases it is recommended to leave this enabled. You should set this to @code{0}
  5952. only if your clip has bad chroma problems such as heavy rainbowing or other
  5953. artifacts. Setting this to @code{0} could also be used to speed things up at
  5954. the cost of some accuracy.
  5955. Default value is @code{1}.
  5956. @item y0
  5957. @item y1
  5958. These define an exclusion band which excludes the lines between @option{y0} and
  5959. @option{y1} from being included in the field matching decision. An exclusion
  5960. band can be used to ignore subtitles, a logo, or other things that may
  5961. interfere with the matching. @option{y0} sets the starting scan line and
  5962. @option{y1} sets the ending line; all lines in between @option{y0} and
  5963. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5964. @option{y0} and @option{y1} to the same value will disable the feature.
  5965. @option{y0} and @option{y1} defaults to @code{0}.
  5966. @item scthresh
  5967. Set the scene change detection threshold as a percentage of maximum change on
  5968. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5969. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5970. @option{scthresh} is @code{[0.0, 100.0]}.
  5971. Default value is @code{12.0}.
  5972. @item combmatch
  5973. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5974. account the combed scores of matches when deciding what match to use as the
  5975. final match. Available values are:
  5976. @table @samp
  5977. @item none
  5978. No final matching based on combed scores.
  5979. @item sc
  5980. Combed scores are only used when a scene change is detected.
  5981. @item full
  5982. Use combed scores all the time.
  5983. @end table
  5984. Default is @var{sc}.
  5985. @item combdbg
  5986. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5987. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5988. Available values are:
  5989. @table @samp
  5990. @item none
  5991. No forced calculation.
  5992. @item pcn
  5993. Force p/c/n calculations.
  5994. @item pcnub
  5995. Force p/c/n/u/b calculations.
  5996. @end table
  5997. Default value is @var{none}.
  5998. @item cthresh
  5999. This is the area combing threshold used for combed frame detection. This
  6000. essentially controls how "strong" or "visible" combing must be to be detected.
  6001. Larger values mean combing must be more visible and smaller values mean combing
  6002. can be less visible or strong and still be detected. Valid settings are from
  6003. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6004. be detected as combed). This is basically a pixel difference value. A good
  6005. range is @code{[8, 12]}.
  6006. Default value is @code{9}.
  6007. @item chroma
  6008. Sets whether or not chroma is considered in the combed frame decision. Only
  6009. disable this if your source has chroma problems (rainbowing, etc.) that are
  6010. causing problems for the combed frame detection with chroma enabled. Actually,
  6011. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6012. where there is chroma only combing in the source.
  6013. Default value is @code{0}.
  6014. @item blockx
  6015. @item blocky
  6016. Respectively set the x-axis and y-axis size of the window used during combed
  6017. frame detection. This has to do with the size of the area in which
  6018. @option{combpel} pixels are required to be detected as combed for a frame to be
  6019. declared combed. See the @option{combpel} parameter description for more info.
  6020. Possible values are any number that is a power of 2 starting at 4 and going up
  6021. to 512.
  6022. Default value is @code{16}.
  6023. @item combpel
  6024. The number of combed pixels inside any of the @option{blocky} by
  6025. @option{blockx} size blocks on the frame for the frame to be detected as
  6026. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6027. setting controls "how much" combing there must be in any localized area (a
  6028. window defined by the @option{blockx} and @option{blocky} settings) on the
  6029. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6030. which point no frames will ever be detected as combed). This setting is known
  6031. as @option{MI} in TFM/VFM vocabulary.
  6032. Default value is @code{80}.
  6033. @end table
  6034. @anchor{p/c/n/u/b meaning}
  6035. @subsection p/c/n/u/b meaning
  6036. @subsubsection p/c/n
  6037. We assume the following telecined stream:
  6038. @example
  6039. Top fields: 1 2 2 3 4
  6040. Bottom fields: 1 2 3 4 4
  6041. @end example
  6042. The numbers correspond to the progressive frame the fields relate to. Here, the
  6043. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6044. When @code{fieldmatch} is configured to run a matching from bottom
  6045. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6046. @example
  6047. Input stream:
  6048. T 1 2 2 3 4
  6049. B 1 2 3 4 4 <-- matching reference
  6050. Matches: c c n n c
  6051. Output stream:
  6052. T 1 2 3 4 4
  6053. B 1 2 3 4 4
  6054. @end example
  6055. As a result of the field matching, we can see that some frames get duplicated.
  6056. To perform a complete inverse telecine, you need to rely on a decimation filter
  6057. after this operation. See for instance the @ref{decimate} filter.
  6058. The same operation now matching from top fields (@option{field}=@var{top})
  6059. looks like this:
  6060. @example
  6061. Input stream:
  6062. T 1 2 2 3 4 <-- matching reference
  6063. B 1 2 3 4 4
  6064. Matches: c c p p c
  6065. Output stream:
  6066. T 1 2 2 3 4
  6067. B 1 2 2 3 4
  6068. @end example
  6069. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6070. basically, they refer to the frame and field of the opposite parity:
  6071. @itemize
  6072. @item @var{p} matches the field of the opposite parity in the previous frame
  6073. @item @var{c} matches the field of the opposite parity in the current frame
  6074. @item @var{n} matches the field of the opposite parity in the next frame
  6075. @end itemize
  6076. @subsubsection u/b
  6077. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6078. from the opposite parity flag. In the following examples, we assume that we are
  6079. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6080. 'x' is placed above and below each matched fields.
  6081. With bottom matching (@option{field}=@var{bottom}):
  6082. @example
  6083. Match: c p n b u
  6084. x x x x x
  6085. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6086. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6087. x x x x x
  6088. Output frames:
  6089. 2 1 2 2 2
  6090. 2 2 2 1 3
  6091. @end example
  6092. With top matching (@option{field}=@var{top}):
  6093. @example
  6094. Match: c p n b u
  6095. x x x x x
  6096. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6097. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6098. x x x x x
  6099. Output frames:
  6100. 2 2 2 1 2
  6101. 2 1 3 2 2
  6102. @end example
  6103. @subsection Examples
  6104. Simple IVTC of a top field first telecined stream:
  6105. @example
  6106. fieldmatch=order=tff:combmatch=none, decimate
  6107. @end example
  6108. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6109. @example
  6110. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6111. @end example
  6112. @section fieldorder
  6113. Transform the field order of the input video.
  6114. It accepts the following parameters:
  6115. @table @option
  6116. @item order
  6117. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6118. for bottom field first.
  6119. @end table
  6120. The default value is @samp{tff}.
  6121. The transformation is done by shifting the picture content up or down
  6122. by one line, and filling the remaining line with appropriate picture content.
  6123. This method is consistent with most broadcast field order converters.
  6124. If the input video is not flagged as being interlaced, or it is already
  6125. flagged as being of the required output field order, then this filter does
  6126. not alter the incoming video.
  6127. It is very useful when converting to or from PAL DV material,
  6128. which is bottom field first.
  6129. For example:
  6130. @example
  6131. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6132. @end example
  6133. @section fifo, afifo
  6134. Buffer input images and send them when they are requested.
  6135. It is mainly useful when auto-inserted by the libavfilter
  6136. framework.
  6137. It does not take parameters.
  6138. @section find_rect
  6139. Find a rectangular object
  6140. It accepts the following options:
  6141. @table @option
  6142. @item object
  6143. Filepath of the object image, needs to be in gray8.
  6144. @item threshold
  6145. Detection threshold, default is 0.5.
  6146. @item mipmaps
  6147. Number of mipmaps, default is 3.
  6148. @item xmin, ymin, xmax, ymax
  6149. Specifies the rectangle in which to search.
  6150. @end table
  6151. @subsection Examples
  6152. @itemize
  6153. @item
  6154. Generate a representative palette of a given video using @command{ffmpeg}:
  6155. @example
  6156. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6157. @end example
  6158. @end itemize
  6159. @section cover_rect
  6160. Cover a rectangular object
  6161. It accepts the following options:
  6162. @table @option
  6163. @item cover
  6164. Filepath of the optional cover image, needs to be in yuv420.
  6165. @item mode
  6166. Set covering mode.
  6167. It accepts the following values:
  6168. @table @samp
  6169. @item cover
  6170. cover it by the supplied image
  6171. @item blur
  6172. cover it by interpolating the surrounding pixels
  6173. @end table
  6174. Default value is @var{blur}.
  6175. @end table
  6176. @subsection Examples
  6177. @itemize
  6178. @item
  6179. Generate a representative palette of a given video using @command{ffmpeg}:
  6180. @example
  6181. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6182. @end example
  6183. @end itemize
  6184. @anchor{format}
  6185. @section format
  6186. Convert the input video to one of the specified pixel formats.
  6187. Libavfilter will try to pick one that is suitable as input to
  6188. the next filter.
  6189. It accepts the following parameters:
  6190. @table @option
  6191. @item pix_fmts
  6192. A '|'-separated list of pixel format names, such as
  6193. "pix_fmts=yuv420p|monow|rgb24".
  6194. @end table
  6195. @subsection Examples
  6196. @itemize
  6197. @item
  6198. Convert the input video to the @var{yuv420p} format
  6199. @example
  6200. format=pix_fmts=yuv420p
  6201. @end example
  6202. Convert the input video to any of the formats in the list
  6203. @example
  6204. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6205. @end example
  6206. @end itemize
  6207. @anchor{fps}
  6208. @section fps
  6209. Convert the video to specified constant frame rate by duplicating or dropping
  6210. frames as necessary.
  6211. It accepts the following parameters:
  6212. @table @option
  6213. @item fps
  6214. The desired output frame rate. The default is @code{25}.
  6215. @item round
  6216. Rounding method.
  6217. Possible values are:
  6218. @table @option
  6219. @item zero
  6220. zero round towards 0
  6221. @item inf
  6222. round away from 0
  6223. @item down
  6224. round towards -infinity
  6225. @item up
  6226. round towards +infinity
  6227. @item near
  6228. round to nearest
  6229. @end table
  6230. The default is @code{near}.
  6231. @item start_time
  6232. Assume the first PTS should be the given value, in seconds. This allows for
  6233. padding/trimming at the start of stream. By default, no assumption is made
  6234. about the first frame's expected PTS, so no padding or trimming is done.
  6235. For example, this could be set to 0 to pad the beginning with duplicates of
  6236. the first frame if a video stream starts after the audio stream or to trim any
  6237. frames with a negative PTS.
  6238. @end table
  6239. Alternatively, the options can be specified as a flat string:
  6240. @var{fps}[:@var{round}].
  6241. See also the @ref{setpts} filter.
  6242. @subsection Examples
  6243. @itemize
  6244. @item
  6245. A typical usage in order to set the fps to 25:
  6246. @example
  6247. fps=fps=25
  6248. @end example
  6249. @item
  6250. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6251. @example
  6252. fps=fps=film:round=near
  6253. @end example
  6254. @end itemize
  6255. @section framepack
  6256. Pack two different video streams into a stereoscopic video, setting proper
  6257. metadata on supported codecs. The two views should have the same size and
  6258. framerate and processing will stop when the shorter video ends. Please note
  6259. that you may conveniently adjust view properties with the @ref{scale} and
  6260. @ref{fps} filters.
  6261. It accepts the following parameters:
  6262. @table @option
  6263. @item format
  6264. The desired packing format. Supported values are:
  6265. @table @option
  6266. @item sbs
  6267. The views are next to each other (default).
  6268. @item tab
  6269. The views are on top of each other.
  6270. @item lines
  6271. The views are packed by line.
  6272. @item columns
  6273. The views are packed by column.
  6274. @item frameseq
  6275. The views are temporally interleaved.
  6276. @end table
  6277. @end table
  6278. Some examples:
  6279. @example
  6280. # Convert left and right views into a frame-sequential video
  6281. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6282. # Convert views into a side-by-side video with the same output resolution as the input
  6283. 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
  6284. @end example
  6285. @section framerate
  6286. Change the frame rate by interpolating new video output frames from the source
  6287. frames.
  6288. This filter is not designed to function correctly with interlaced media. If
  6289. you wish to change the frame rate of interlaced media then you are required
  6290. to deinterlace before this filter and re-interlace after this filter.
  6291. A description of the accepted options follows.
  6292. @table @option
  6293. @item fps
  6294. Specify the output frames per second. This option can also be specified
  6295. as a value alone. The default is @code{50}.
  6296. @item interp_start
  6297. Specify the start of a range where the output frame will be created as a
  6298. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6299. the default is @code{15}.
  6300. @item interp_end
  6301. Specify the end of a range where the output frame will be created as a
  6302. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6303. the default is @code{240}.
  6304. @item scene
  6305. Specify the level at which a scene change is detected as a value between
  6306. 0 and 100 to indicate a new scene; a low value reflects a low
  6307. probability for the current frame to introduce a new scene, while a higher
  6308. value means the current frame is more likely to be one.
  6309. The default is @code{7}.
  6310. @item flags
  6311. Specify flags influencing the filter process.
  6312. Available value for @var{flags} is:
  6313. @table @option
  6314. @item scene_change_detect, scd
  6315. Enable scene change detection using the value of the option @var{scene}.
  6316. This flag is enabled by default.
  6317. @end table
  6318. @end table
  6319. @section framestep
  6320. Select one frame every N-th frame.
  6321. This filter accepts the following option:
  6322. @table @option
  6323. @item step
  6324. Select frame after every @code{step} frames.
  6325. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6326. @end table
  6327. @anchor{frei0r}
  6328. @section frei0r
  6329. Apply a frei0r effect to the input video.
  6330. To enable the compilation of this filter, you need to install the frei0r
  6331. header and configure FFmpeg with @code{--enable-frei0r}.
  6332. It accepts the following parameters:
  6333. @table @option
  6334. @item filter_name
  6335. The name of the frei0r effect to load. If the environment variable
  6336. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6337. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6338. Otherwise, the standard frei0r paths are searched, in this order:
  6339. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6340. @file{/usr/lib/frei0r-1/}.
  6341. @item filter_params
  6342. A '|'-separated list of parameters to pass to the frei0r effect.
  6343. @end table
  6344. A frei0r effect parameter can be a boolean (its value is either
  6345. "y" or "n"), a double, a color (specified as
  6346. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6347. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6348. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6349. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6350. The number and types of parameters depend on the loaded effect. If an
  6351. effect parameter is not specified, the default value is set.
  6352. @subsection Examples
  6353. @itemize
  6354. @item
  6355. Apply the distort0r effect, setting the first two double parameters:
  6356. @example
  6357. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6358. @end example
  6359. @item
  6360. Apply the colordistance effect, taking a color as the first parameter:
  6361. @example
  6362. frei0r=colordistance:0.2/0.3/0.4
  6363. frei0r=colordistance:violet
  6364. frei0r=colordistance:0x112233
  6365. @end example
  6366. @item
  6367. Apply the perspective effect, specifying the top left and top right image
  6368. positions:
  6369. @example
  6370. frei0r=perspective:0.2/0.2|0.8/0.2
  6371. @end example
  6372. @end itemize
  6373. For more information, see
  6374. @url{http://frei0r.dyne.org}
  6375. @section fspp
  6376. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6377. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6378. processing filter, one of them is performed once per block, not per pixel.
  6379. This allows for much higher speed.
  6380. The filter accepts the following options:
  6381. @table @option
  6382. @item quality
  6383. Set quality. This option defines the number of levels for averaging. It accepts
  6384. an integer in the range 4-5. Default value is @code{4}.
  6385. @item qp
  6386. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6387. If not set, the filter will use the QP from the video stream (if available).
  6388. @item strength
  6389. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6390. more details but also more artifacts, while higher values make the image smoother
  6391. but also blurrier. Default value is @code{0} − PSNR optimal.
  6392. @item use_bframe_qp
  6393. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6394. option may cause flicker since the B-Frames have often larger QP. Default is
  6395. @code{0} (not enabled).
  6396. @end table
  6397. @section gblur
  6398. Apply Gaussian blur filter.
  6399. The filter accepts the following options:
  6400. @table @option
  6401. @item sigma
  6402. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6403. @item steps
  6404. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6405. @item planes
  6406. Set which planes to filter. By default all planes are filtered.
  6407. @item sigmaV
  6408. Set vertical sigma, if negative it will be same as @code{sigma}.
  6409. Default is @code{-1}.
  6410. @end table
  6411. @section geq
  6412. The filter accepts the following options:
  6413. @table @option
  6414. @item lum_expr, lum
  6415. Set the luminance expression.
  6416. @item cb_expr, cb
  6417. Set the chrominance blue expression.
  6418. @item cr_expr, cr
  6419. Set the chrominance red expression.
  6420. @item alpha_expr, a
  6421. Set the alpha expression.
  6422. @item red_expr, r
  6423. Set the red expression.
  6424. @item green_expr, g
  6425. Set the green expression.
  6426. @item blue_expr, b
  6427. Set the blue expression.
  6428. @end table
  6429. The colorspace is selected according to the specified options. If one
  6430. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6431. options is specified, the filter will automatically select a YCbCr
  6432. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6433. @option{blue_expr} options is specified, it will select an RGB
  6434. colorspace.
  6435. If one of the chrominance expression is not defined, it falls back on the other
  6436. one. If no alpha expression is specified it will evaluate to opaque value.
  6437. If none of chrominance expressions are specified, they will evaluate
  6438. to the luminance expression.
  6439. The expressions can use the following variables and functions:
  6440. @table @option
  6441. @item N
  6442. The sequential number of the filtered frame, starting from @code{0}.
  6443. @item X
  6444. @item Y
  6445. The coordinates of the current sample.
  6446. @item W
  6447. @item H
  6448. The width and height of the image.
  6449. @item SW
  6450. @item SH
  6451. Width and height scale depending on the currently filtered plane. It is the
  6452. ratio between the corresponding luma plane number of pixels and the current
  6453. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6454. @code{0.5,0.5} for chroma planes.
  6455. @item T
  6456. Time of the current frame, expressed in seconds.
  6457. @item p(x, y)
  6458. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6459. plane.
  6460. @item lum(x, y)
  6461. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6462. plane.
  6463. @item cb(x, y)
  6464. Return the value of the pixel at location (@var{x},@var{y}) of the
  6465. blue-difference chroma plane. Return 0 if there is no such plane.
  6466. @item cr(x, y)
  6467. Return the value of the pixel at location (@var{x},@var{y}) of the
  6468. red-difference chroma plane. Return 0 if there is no such plane.
  6469. @item r(x, y)
  6470. @item g(x, y)
  6471. @item b(x, y)
  6472. Return the value of the pixel at location (@var{x},@var{y}) of the
  6473. red/green/blue component. Return 0 if there is no such component.
  6474. @item alpha(x, y)
  6475. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6476. plane. Return 0 if there is no such plane.
  6477. @end table
  6478. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6479. automatically clipped to the closer edge.
  6480. @subsection Examples
  6481. @itemize
  6482. @item
  6483. Flip the image horizontally:
  6484. @example
  6485. geq=p(W-X\,Y)
  6486. @end example
  6487. @item
  6488. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6489. wavelength of 100 pixels:
  6490. @example
  6491. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6492. @end example
  6493. @item
  6494. Generate a fancy enigmatic moving light:
  6495. @example
  6496. 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
  6497. @end example
  6498. @item
  6499. Generate a quick emboss effect:
  6500. @example
  6501. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6502. @end example
  6503. @item
  6504. Modify RGB components depending on pixel position:
  6505. @example
  6506. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6507. @end example
  6508. @item
  6509. Create a radial gradient that is the same size as the input (also see
  6510. the @ref{vignette} filter):
  6511. @example
  6512. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6513. @end example
  6514. @end itemize
  6515. @section gradfun
  6516. Fix the banding artifacts that are sometimes introduced into nearly flat
  6517. regions by truncation to 8-bit color depth.
  6518. Interpolate the gradients that should go where the bands are, and
  6519. dither them.
  6520. It is designed for playback only. Do not use it prior to
  6521. lossy compression, because compression tends to lose the dither and
  6522. bring back the bands.
  6523. It accepts the following parameters:
  6524. @table @option
  6525. @item strength
  6526. The maximum amount by which the filter will change any one pixel. This is also
  6527. the threshold for detecting nearly flat regions. Acceptable values range from
  6528. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6529. valid range.
  6530. @item radius
  6531. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6532. gradients, but also prevents the filter from modifying the pixels near detailed
  6533. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6534. values will be clipped to the valid range.
  6535. @end table
  6536. Alternatively, the options can be specified as a flat string:
  6537. @var{strength}[:@var{radius}]
  6538. @subsection Examples
  6539. @itemize
  6540. @item
  6541. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6542. @example
  6543. gradfun=3.5:8
  6544. @end example
  6545. @item
  6546. Specify radius, omitting the strength (which will fall-back to the default
  6547. value):
  6548. @example
  6549. gradfun=radius=8
  6550. @end example
  6551. @end itemize
  6552. @anchor{haldclut}
  6553. @section haldclut
  6554. Apply a Hald CLUT to a video stream.
  6555. First input is the video stream to process, and second one is the Hald CLUT.
  6556. The Hald CLUT input can be a simple picture or a complete video stream.
  6557. The filter accepts the following options:
  6558. @table @option
  6559. @item shortest
  6560. Force termination when the shortest input terminates. Default is @code{0}.
  6561. @item repeatlast
  6562. Continue applying the last CLUT after the end of the stream. A value of
  6563. @code{0} disable the filter after the last frame of the CLUT is reached.
  6564. Default is @code{1}.
  6565. @end table
  6566. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6567. filters share the same internals).
  6568. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6569. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6570. @subsection Workflow examples
  6571. @subsubsection Hald CLUT video stream
  6572. Generate an identity Hald CLUT stream altered with various effects:
  6573. @example
  6574. 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
  6575. @end example
  6576. Note: make sure you use a lossless codec.
  6577. Then use it with @code{haldclut} to apply it on some random stream:
  6578. @example
  6579. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6580. @end example
  6581. The Hald CLUT will be applied to the 10 first seconds (duration of
  6582. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6583. to the remaining frames of the @code{mandelbrot} stream.
  6584. @subsubsection Hald CLUT with preview
  6585. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6586. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6587. biggest possible square starting at the top left of the picture. The remaining
  6588. padding pixels (bottom or right) will be ignored. This area can be used to add
  6589. a preview of the Hald CLUT.
  6590. Typically, the following generated Hald CLUT will be supported by the
  6591. @code{haldclut} filter:
  6592. @example
  6593. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6594. pad=iw+320 [padded_clut];
  6595. smptebars=s=320x256, split [a][b];
  6596. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6597. [main][b] overlay=W-320" -frames:v 1 clut.png
  6598. @end example
  6599. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6600. bars are displayed on the right-top, and below the same color bars processed by
  6601. the color changes.
  6602. Then, the effect of this Hald CLUT can be visualized with:
  6603. @example
  6604. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6605. @end example
  6606. @section hflip
  6607. Flip the input video horizontally.
  6608. For example, to horizontally flip the input video with @command{ffmpeg}:
  6609. @example
  6610. ffmpeg -i in.avi -vf "hflip" out.avi
  6611. @end example
  6612. @section histeq
  6613. This filter applies a global color histogram equalization on a
  6614. per-frame basis.
  6615. It can be used to correct video that has a compressed range of pixel
  6616. intensities. The filter redistributes the pixel intensities to
  6617. equalize their distribution across the intensity range. It may be
  6618. viewed as an "automatically adjusting contrast filter". This filter is
  6619. useful only for correcting degraded or poorly captured source
  6620. video.
  6621. The filter accepts the following options:
  6622. @table @option
  6623. @item strength
  6624. Determine the amount of equalization to be applied. As the strength
  6625. is reduced, the distribution of pixel intensities more-and-more
  6626. approaches that of the input frame. The value must be a float number
  6627. in the range [0,1] and defaults to 0.200.
  6628. @item intensity
  6629. Set the maximum intensity that can generated and scale the output
  6630. values appropriately. The strength should be set as desired and then
  6631. the intensity can be limited if needed to avoid washing-out. The value
  6632. must be a float number in the range [0,1] and defaults to 0.210.
  6633. @item antibanding
  6634. Set the antibanding level. If enabled the filter will randomly vary
  6635. the luminance of output pixels by a small amount to avoid banding of
  6636. the histogram. Possible values are @code{none}, @code{weak} or
  6637. @code{strong}. It defaults to @code{none}.
  6638. @end table
  6639. @section histogram
  6640. Compute and draw a color distribution histogram for the input video.
  6641. The computed histogram is a representation of the color component
  6642. distribution in an image.
  6643. Standard histogram displays the color components distribution in an image.
  6644. Displays color graph for each color component. Shows distribution of
  6645. the Y, U, V, A or R, G, B components, depending on input format, in the
  6646. current frame. Below each graph a color component scale meter is shown.
  6647. The filter accepts the following options:
  6648. @table @option
  6649. @item level_height
  6650. Set height of level. Default value is @code{200}.
  6651. Allowed range is [50, 2048].
  6652. @item scale_height
  6653. Set height of color scale. Default value is @code{12}.
  6654. Allowed range is [0, 40].
  6655. @item display_mode
  6656. Set display mode.
  6657. It accepts the following values:
  6658. @table @samp
  6659. @item parade
  6660. Per color component graphs are placed below each other.
  6661. @item overlay
  6662. Presents information identical to that in the @code{parade}, except
  6663. that the graphs representing color components are superimposed directly
  6664. over one another.
  6665. @end table
  6666. Default is @code{parade}.
  6667. @item levels_mode
  6668. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6669. Default is @code{linear}.
  6670. @item components
  6671. Set what color components to display.
  6672. Default is @code{7}.
  6673. @item fgopacity
  6674. Set foreground opacity. Default is @code{0.7}.
  6675. @item bgopacity
  6676. Set background opacity. Default is @code{0.5}.
  6677. @end table
  6678. @subsection Examples
  6679. @itemize
  6680. @item
  6681. Calculate and draw histogram:
  6682. @example
  6683. ffplay -i input -vf histogram
  6684. @end example
  6685. @end itemize
  6686. @anchor{hqdn3d}
  6687. @section hqdn3d
  6688. This is a high precision/quality 3d denoise filter. It aims to reduce
  6689. image noise, producing smooth images and making still images really
  6690. still. It should enhance compressibility.
  6691. It accepts the following optional parameters:
  6692. @table @option
  6693. @item luma_spatial
  6694. A non-negative floating point number which specifies spatial luma strength.
  6695. It defaults to 4.0.
  6696. @item chroma_spatial
  6697. A non-negative floating point number which specifies spatial chroma strength.
  6698. It defaults to 3.0*@var{luma_spatial}/4.0.
  6699. @item luma_tmp
  6700. A floating point number which specifies luma temporal strength. It defaults to
  6701. 6.0*@var{luma_spatial}/4.0.
  6702. @item chroma_tmp
  6703. A floating point number which specifies chroma temporal strength. It defaults to
  6704. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6705. @end table
  6706. @anchor{hwupload_cuda}
  6707. @section hwupload_cuda
  6708. Upload system memory frames to a CUDA device.
  6709. It accepts the following optional parameters:
  6710. @table @option
  6711. @item device
  6712. The number of the CUDA device to use
  6713. @end table
  6714. @section hqx
  6715. Apply a high-quality magnification filter designed for pixel art. This filter
  6716. was originally created by Maxim Stepin.
  6717. It accepts the following option:
  6718. @table @option
  6719. @item n
  6720. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6721. @code{hq3x} and @code{4} for @code{hq4x}.
  6722. Default is @code{3}.
  6723. @end table
  6724. @section hstack
  6725. Stack input videos horizontally.
  6726. All streams must be of same pixel format and of same height.
  6727. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6728. to create same output.
  6729. The filter accept the following option:
  6730. @table @option
  6731. @item inputs
  6732. Set number of input streams. Default is 2.
  6733. @item shortest
  6734. If set to 1, force the output to terminate when the shortest input
  6735. terminates. Default value is 0.
  6736. @end table
  6737. @section hue
  6738. Modify the hue and/or the saturation of the input.
  6739. It accepts the following parameters:
  6740. @table @option
  6741. @item h
  6742. Specify the hue angle as a number of degrees. It accepts an expression,
  6743. and defaults to "0".
  6744. @item s
  6745. Specify the saturation in the [-10,10] range. It accepts an expression and
  6746. defaults to "1".
  6747. @item H
  6748. Specify the hue angle as a number of radians. It accepts an
  6749. expression, and defaults to "0".
  6750. @item b
  6751. Specify the brightness in the [-10,10] range. It accepts an expression and
  6752. defaults to "0".
  6753. @end table
  6754. @option{h} and @option{H} are mutually exclusive, and can't be
  6755. specified at the same time.
  6756. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6757. expressions containing the following constants:
  6758. @table @option
  6759. @item n
  6760. frame count of the input frame starting from 0
  6761. @item pts
  6762. presentation timestamp of the input frame expressed in time base units
  6763. @item r
  6764. frame rate of the input video, NAN if the input frame rate is unknown
  6765. @item t
  6766. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6767. @item tb
  6768. time base of the input video
  6769. @end table
  6770. @subsection Examples
  6771. @itemize
  6772. @item
  6773. Set the hue to 90 degrees and the saturation to 1.0:
  6774. @example
  6775. hue=h=90:s=1
  6776. @end example
  6777. @item
  6778. Same command but expressing the hue in radians:
  6779. @example
  6780. hue=H=PI/2:s=1
  6781. @end example
  6782. @item
  6783. Rotate hue and make the saturation swing between 0
  6784. and 2 over a period of 1 second:
  6785. @example
  6786. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6787. @end example
  6788. @item
  6789. Apply a 3 seconds saturation fade-in effect starting at 0:
  6790. @example
  6791. hue="s=min(t/3\,1)"
  6792. @end example
  6793. The general fade-in expression can be written as:
  6794. @example
  6795. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6796. @end example
  6797. @item
  6798. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6799. @example
  6800. hue="s=max(0\, min(1\, (8-t)/3))"
  6801. @end example
  6802. The general fade-out expression can be written as:
  6803. @example
  6804. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6805. @end example
  6806. @end itemize
  6807. @subsection Commands
  6808. This filter supports the following commands:
  6809. @table @option
  6810. @item b
  6811. @item s
  6812. @item h
  6813. @item H
  6814. Modify the hue and/or the saturation and/or brightness of the input video.
  6815. The command accepts the same syntax of the corresponding option.
  6816. If the specified expression is not valid, it is kept at its current
  6817. value.
  6818. @end table
  6819. @section hysteresis
  6820. Grow first stream into second stream by connecting components.
  6821. This makes it possible to build more robust edge masks.
  6822. This filter accepts the following options:
  6823. @table @option
  6824. @item planes
  6825. Set which planes will be processed as bitmap, unprocessed planes will be
  6826. copied from first stream.
  6827. By default value 0xf, all planes will be processed.
  6828. @item threshold
  6829. Set threshold which is used in filtering. If pixel component value is higher than
  6830. this value filter algorithm for connecting components is activated.
  6831. By default value is 0.
  6832. @end table
  6833. @section idet
  6834. Detect video interlacing type.
  6835. This filter tries to detect if the input frames are interlaced, progressive,
  6836. top or bottom field first. It will also try to detect fields that are
  6837. repeated between adjacent frames (a sign of telecine).
  6838. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6839. Multiple frame detection incorporates the classification history of previous frames.
  6840. The filter will log these metadata values:
  6841. @table @option
  6842. @item single.current_frame
  6843. Detected type of current frame using single-frame detection. One of:
  6844. ``tff'' (top field first), ``bff'' (bottom field first),
  6845. ``progressive'', or ``undetermined''
  6846. @item single.tff
  6847. Cumulative number of frames detected as top field first using single-frame detection.
  6848. @item multiple.tff
  6849. Cumulative number of frames detected as top field first using multiple-frame detection.
  6850. @item single.bff
  6851. Cumulative number of frames detected as bottom field first using single-frame detection.
  6852. @item multiple.current_frame
  6853. Detected type of current frame using multiple-frame detection. One of:
  6854. ``tff'' (top field first), ``bff'' (bottom field first),
  6855. ``progressive'', or ``undetermined''
  6856. @item multiple.bff
  6857. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6858. @item single.progressive
  6859. Cumulative number of frames detected as progressive using single-frame detection.
  6860. @item multiple.progressive
  6861. Cumulative number of frames detected as progressive using multiple-frame detection.
  6862. @item single.undetermined
  6863. Cumulative number of frames that could not be classified using single-frame detection.
  6864. @item multiple.undetermined
  6865. Cumulative number of frames that could not be classified using multiple-frame detection.
  6866. @item repeated.current_frame
  6867. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6868. @item repeated.neither
  6869. Cumulative number of frames with no repeated field.
  6870. @item repeated.top
  6871. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6872. @item repeated.bottom
  6873. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6874. @end table
  6875. The filter accepts the following options:
  6876. @table @option
  6877. @item intl_thres
  6878. Set interlacing threshold.
  6879. @item prog_thres
  6880. Set progressive threshold.
  6881. @item rep_thres
  6882. Threshold for repeated field detection.
  6883. @item half_life
  6884. Number of frames after which a given frame's contribution to the
  6885. statistics is halved (i.e., it contributes only 0.5 to its
  6886. classification). The default of 0 means that all frames seen are given
  6887. full weight of 1.0 forever.
  6888. @item analyze_interlaced_flag
  6889. When this is not 0 then idet will use the specified number of frames to determine
  6890. if the interlaced flag is accurate, it will not count undetermined frames.
  6891. If the flag is found to be accurate it will be used without any further
  6892. computations, if it is found to be inaccurate it will be cleared without any
  6893. further computations. This allows inserting the idet filter as a low computational
  6894. method to clean up the interlaced flag
  6895. @end table
  6896. @section il
  6897. Deinterleave or interleave fields.
  6898. This filter allows one to process interlaced images fields without
  6899. deinterlacing them. Deinterleaving splits the input frame into 2
  6900. fields (so called half pictures). Odd lines are moved to the top
  6901. half of the output image, even lines to the bottom half.
  6902. You can process (filter) them independently and then re-interleave them.
  6903. The filter accepts the following options:
  6904. @table @option
  6905. @item luma_mode, l
  6906. @item chroma_mode, c
  6907. @item alpha_mode, a
  6908. Available values for @var{luma_mode}, @var{chroma_mode} and
  6909. @var{alpha_mode} are:
  6910. @table @samp
  6911. @item none
  6912. Do nothing.
  6913. @item deinterleave, d
  6914. Deinterleave fields, placing one above the other.
  6915. @item interleave, i
  6916. Interleave fields. Reverse the effect of deinterleaving.
  6917. @end table
  6918. Default value is @code{none}.
  6919. @item luma_swap, ls
  6920. @item chroma_swap, cs
  6921. @item alpha_swap, as
  6922. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6923. @end table
  6924. @section inflate
  6925. Apply inflate effect to the video.
  6926. This filter replaces the pixel by the local(3x3) average by taking into account
  6927. only values higher than the pixel.
  6928. It accepts the following options:
  6929. @table @option
  6930. @item threshold0
  6931. @item threshold1
  6932. @item threshold2
  6933. @item threshold3
  6934. Limit the maximum change for each plane, default is 65535.
  6935. If 0, plane will remain unchanged.
  6936. @end table
  6937. @section interlace
  6938. Simple interlacing filter from progressive contents. This interleaves upper (or
  6939. lower) lines from odd frames with lower (or upper) lines from even frames,
  6940. halving the frame rate and preserving image height.
  6941. @example
  6942. Original Original New Frame
  6943. Frame 'j' Frame 'j+1' (tff)
  6944. ========== =========== ==================
  6945. Line 0 --------------------> Frame 'j' Line 0
  6946. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6947. Line 2 ---------------------> Frame 'j' Line 2
  6948. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6949. ... ... ...
  6950. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6951. @end example
  6952. It accepts the following optional parameters:
  6953. @table @option
  6954. @item scan
  6955. This determines whether the interlaced frame is taken from the even
  6956. (tff - default) or odd (bff) lines of the progressive frame.
  6957. @item lowpass
  6958. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6959. interlacing and reduce moire patterns.
  6960. @end table
  6961. @section kerndeint
  6962. Deinterlace input video by applying Donald Graft's adaptive kernel
  6963. deinterling. Work on interlaced parts of a video to produce
  6964. progressive frames.
  6965. The description of the accepted parameters follows.
  6966. @table @option
  6967. @item thresh
  6968. Set the threshold which affects the filter's tolerance when
  6969. determining if a pixel line must be processed. It must be an integer
  6970. in the range [0,255] and defaults to 10. A value of 0 will result in
  6971. applying the process on every pixels.
  6972. @item map
  6973. Paint pixels exceeding the threshold value to white if set to 1.
  6974. Default is 0.
  6975. @item order
  6976. Set the fields order. Swap fields if set to 1, leave fields alone if
  6977. 0. Default is 0.
  6978. @item sharp
  6979. Enable additional sharpening if set to 1. Default is 0.
  6980. @item twoway
  6981. Enable twoway sharpening if set to 1. Default is 0.
  6982. @end table
  6983. @subsection Examples
  6984. @itemize
  6985. @item
  6986. Apply default values:
  6987. @example
  6988. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6989. @end example
  6990. @item
  6991. Enable additional sharpening:
  6992. @example
  6993. kerndeint=sharp=1
  6994. @end example
  6995. @item
  6996. Paint processed pixels in white:
  6997. @example
  6998. kerndeint=map=1
  6999. @end example
  7000. @end itemize
  7001. @section lenscorrection
  7002. Correct radial lens distortion
  7003. This filter can be used to correct for radial distortion as can result from the use
  7004. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7005. one can use tools available for example as part of opencv or simply trial-and-error.
  7006. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7007. and extract the k1 and k2 coefficients from the resulting matrix.
  7008. Note that effectively the same filter is available in the open-source tools Krita and
  7009. Digikam from the KDE project.
  7010. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7011. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7012. brightness distribution, so you may want to use both filters together in certain
  7013. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7014. be applied before or after lens correction.
  7015. @subsection Options
  7016. The filter accepts the following options:
  7017. @table @option
  7018. @item cx
  7019. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7020. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7021. width.
  7022. @item cy
  7023. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7024. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7025. height.
  7026. @item k1
  7027. Coefficient of the quadratic correction term. 0.5 means no correction.
  7028. @item k2
  7029. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7030. @end table
  7031. The formula that generates the correction is:
  7032. @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)
  7033. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7034. distances from the focal point in the source and target images, respectively.
  7035. @section loop
  7036. Loop video frames.
  7037. The filter accepts the following options:
  7038. @table @option
  7039. @item loop
  7040. Set the number of loops.
  7041. @item size
  7042. Set maximal size in number of frames.
  7043. @item start
  7044. Set first frame of loop.
  7045. @end table
  7046. @anchor{lut3d}
  7047. @section lut3d
  7048. Apply a 3D LUT to an input video.
  7049. The filter accepts the following options:
  7050. @table @option
  7051. @item file
  7052. Set the 3D LUT file name.
  7053. Currently supported formats:
  7054. @table @samp
  7055. @item 3dl
  7056. AfterEffects
  7057. @item cube
  7058. Iridas
  7059. @item dat
  7060. DaVinci
  7061. @item m3d
  7062. Pandora
  7063. @end table
  7064. @item interp
  7065. Select interpolation mode.
  7066. Available values are:
  7067. @table @samp
  7068. @item nearest
  7069. Use values from the nearest defined point.
  7070. @item trilinear
  7071. Interpolate values using the 8 points defining a cube.
  7072. @item tetrahedral
  7073. Interpolate values using a tetrahedron.
  7074. @end table
  7075. @end table
  7076. @section lut, lutrgb, lutyuv
  7077. Compute a look-up table for binding each pixel component input value
  7078. to an output value, and apply it to the input video.
  7079. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7080. to an RGB input video.
  7081. These filters accept the following parameters:
  7082. @table @option
  7083. @item c0
  7084. set first pixel component expression
  7085. @item c1
  7086. set second pixel component expression
  7087. @item c2
  7088. set third pixel component expression
  7089. @item c3
  7090. set fourth pixel component expression, corresponds to the alpha component
  7091. @item r
  7092. set red component expression
  7093. @item g
  7094. set green component expression
  7095. @item b
  7096. set blue component expression
  7097. @item a
  7098. alpha component expression
  7099. @item y
  7100. set Y/luminance component expression
  7101. @item u
  7102. set U/Cb component expression
  7103. @item v
  7104. set V/Cr component expression
  7105. @end table
  7106. Each of them specifies the expression to use for computing the lookup table for
  7107. the corresponding pixel component values.
  7108. The exact component associated to each of the @var{c*} options depends on the
  7109. format in input.
  7110. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7111. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7112. The expressions can contain the following constants and functions:
  7113. @table @option
  7114. @item w
  7115. @item h
  7116. The input width and height.
  7117. @item val
  7118. The input value for the pixel component.
  7119. @item clipval
  7120. The input value, clipped to the @var{minval}-@var{maxval} range.
  7121. @item maxval
  7122. The maximum value for the pixel component.
  7123. @item minval
  7124. The minimum value for the pixel component.
  7125. @item negval
  7126. The negated value for the pixel component value, clipped to the
  7127. @var{minval}-@var{maxval} range; it corresponds to the expression
  7128. "maxval-clipval+minval".
  7129. @item clip(val)
  7130. The computed value in @var{val}, clipped to the
  7131. @var{minval}-@var{maxval} range.
  7132. @item gammaval(gamma)
  7133. The computed gamma correction value of the pixel component value,
  7134. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7135. expression
  7136. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7137. @end table
  7138. All expressions default to "val".
  7139. @subsection Examples
  7140. @itemize
  7141. @item
  7142. Negate input video:
  7143. @example
  7144. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7145. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7146. @end example
  7147. The above is the same as:
  7148. @example
  7149. lutrgb="r=negval:g=negval:b=negval"
  7150. lutyuv="y=negval:u=negval:v=negval"
  7151. @end example
  7152. @item
  7153. Negate luminance:
  7154. @example
  7155. lutyuv=y=negval
  7156. @end example
  7157. @item
  7158. Remove chroma components, turning the video into a graytone image:
  7159. @example
  7160. lutyuv="u=128:v=128"
  7161. @end example
  7162. @item
  7163. Apply a luma burning effect:
  7164. @example
  7165. lutyuv="y=2*val"
  7166. @end example
  7167. @item
  7168. Remove green and blue components:
  7169. @example
  7170. lutrgb="g=0:b=0"
  7171. @end example
  7172. @item
  7173. Set a constant alpha channel value on input:
  7174. @example
  7175. format=rgba,lutrgb=a="maxval-minval/2"
  7176. @end example
  7177. @item
  7178. Correct luminance gamma by a factor of 0.5:
  7179. @example
  7180. lutyuv=y=gammaval(0.5)
  7181. @end example
  7182. @item
  7183. Discard least significant bits of luma:
  7184. @example
  7185. lutyuv=y='bitand(val, 128+64+32)'
  7186. @end example
  7187. @item
  7188. Technicolor like effect:
  7189. @example
  7190. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7191. @end example
  7192. @end itemize
  7193. @section lut2
  7194. Compute and apply a lookup table from two video inputs.
  7195. This filter accepts the following parameters:
  7196. @table @option
  7197. @item c0
  7198. set first pixel component expression
  7199. @item c1
  7200. set second pixel component expression
  7201. @item c2
  7202. set third pixel component expression
  7203. @item c3
  7204. set fourth pixel component expression, corresponds to the alpha component
  7205. @end table
  7206. Each of them specifies the expression to use for computing the lookup table for
  7207. the corresponding pixel component values.
  7208. The exact component associated to each of the @var{c*} options depends on the
  7209. format in inputs.
  7210. The expressions can contain the following constants:
  7211. @table @option
  7212. @item w
  7213. @item h
  7214. The input width and height.
  7215. @item x
  7216. The first input value for the pixel component.
  7217. @item y
  7218. The second input value for the pixel component.
  7219. @item bdx
  7220. The first input video bit depth.
  7221. @item bdy
  7222. The second input video bit depth.
  7223. @end table
  7224. All expressions default to "x".
  7225. @subsection Examples
  7226. @itemize
  7227. @item
  7228. Highlight differences between two RGB video streams:
  7229. @example
  7230. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  7231. @end example
  7232. @item
  7233. Highlight differences between two YUV video streams:
  7234. @example
  7235. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  7236. @end example
  7237. @end itemize
  7238. @section maskedclamp
  7239. Clamp the first input stream with the second input and third input stream.
  7240. Returns the value of first stream to be between second input
  7241. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7242. This filter accepts the following options:
  7243. @table @option
  7244. @item undershoot
  7245. Default value is @code{0}.
  7246. @item overshoot
  7247. Default value is @code{0}.
  7248. @item planes
  7249. Set which planes will be processed as bitmap, unprocessed planes will be
  7250. copied from first stream.
  7251. By default value 0xf, all planes will be processed.
  7252. @end table
  7253. @section maskedmerge
  7254. Merge the first input stream with the second input stream using per pixel
  7255. weights in the third input stream.
  7256. A value of 0 in the third stream pixel component means that pixel component
  7257. from first stream is returned unchanged, while maximum value (eg. 255 for
  7258. 8-bit videos) means that pixel component from second stream is returned
  7259. unchanged. Intermediate values define the amount of merging between both
  7260. input stream's pixel components.
  7261. This filter accepts the following options:
  7262. @table @option
  7263. @item planes
  7264. Set which planes will be processed as bitmap, unprocessed planes will be
  7265. copied from first stream.
  7266. By default value 0xf, all planes will be processed.
  7267. @end table
  7268. @section mcdeint
  7269. Apply motion-compensation deinterlacing.
  7270. It needs one field per frame as input and must thus be used together
  7271. with yadif=1/3 or equivalent.
  7272. This filter accepts the following options:
  7273. @table @option
  7274. @item mode
  7275. Set the deinterlacing mode.
  7276. It accepts one of the following values:
  7277. @table @samp
  7278. @item fast
  7279. @item medium
  7280. @item slow
  7281. use iterative motion estimation
  7282. @item extra_slow
  7283. like @samp{slow}, but use multiple reference frames.
  7284. @end table
  7285. Default value is @samp{fast}.
  7286. @item parity
  7287. Set the picture field parity assumed for the input video. It must be
  7288. one of the following values:
  7289. @table @samp
  7290. @item 0, tff
  7291. assume top field first
  7292. @item 1, bff
  7293. assume bottom field first
  7294. @end table
  7295. Default value is @samp{bff}.
  7296. @item qp
  7297. Set per-block quantization parameter (QP) used by the internal
  7298. encoder.
  7299. Higher values should result in a smoother motion vector field but less
  7300. optimal individual vectors. Default value is 1.
  7301. @end table
  7302. @section mergeplanes
  7303. Merge color channel components from several video streams.
  7304. The filter accepts up to 4 input streams, and merge selected input
  7305. planes to the output video.
  7306. This filter accepts the following options:
  7307. @table @option
  7308. @item mapping
  7309. Set input to output plane mapping. Default is @code{0}.
  7310. The mappings is specified as a bitmap. It should be specified as a
  7311. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7312. mapping for the first plane of the output stream. 'A' sets the number of
  7313. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7314. corresponding input to use (from 0 to 3). The rest of the mappings is
  7315. similar, 'Bb' describes the mapping for the output stream second
  7316. plane, 'Cc' describes the mapping for the output stream third plane and
  7317. 'Dd' describes the mapping for the output stream fourth plane.
  7318. @item format
  7319. Set output pixel format. Default is @code{yuva444p}.
  7320. @end table
  7321. @subsection Examples
  7322. @itemize
  7323. @item
  7324. Merge three gray video streams of same width and height into single video stream:
  7325. @example
  7326. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7327. @end example
  7328. @item
  7329. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7330. @example
  7331. [a0][a1]mergeplanes=0x00010210:yuva444p
  7332. @end example
  7333. @item
  7334. Swap Y and A plane in yuva444p stream:
  7335. @example
  7336. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7337. @end example
  7338. @item
  7339. Swap U and V plane in yuv420p stream:
  7340. @example
  7341. format=yuv420p,mergeplanes=0x000201:yuv420p
  7342. @end example
  7343. @item
  7344. Cast a rgb24 clip to yuv444p:
  7345. @example
  7346. format=rgb24,mergeplanes=0x000102:yuv444p
  7347. @end example
  7348. @end itemize
  7349. @section mestimate
  7350. Estimate and export motion vectors using block matching algorithms.
  7351. Motion vectors are stored in frame side data to be used by other filters.
  7352. This filter accepts the following options:
  7353. @table @option
  7354. @item method
  7355. Specify the motion estimation method. Accepts one of the following values:
  7356. @table @samp
  7357. @item esa
  7358. Exhaustive search algorithm.
  7359. @item tss
  7360. Three step search algorithm.
  7361. @item tdls
  7362. Two dimensional logarithmic search algorithm.
  7363. @item ntss
  7364. New three step search algorithm.
  7365. @item fss
  7366. Four step search algorithm.
  7367. @item ds
  7368. Diamond search algorithm.
  7369. @item hexbs
  7370. Hexagon-based search algorithm.
  7371. @item epzs
  7372. Enhanced predictive zonal search algorithm.
  7373. @item umh
  7374. Uneven multi-hexagon search algorithm.
  7375. @end table
  7376. Default value is @samp{esa}.
  7377. @item mb_size
  7378. Macroblock size. Default @code{16}.
  7379. @item search_param
  7380. Search parameter. Default @code{7}.
  7381. @end table
  7382. @section minterpolate
  7383. Convert the video to specified frame rate using motion interpolation.
  7384. This filter accepts the following options:
  7385. @table @option
  7386. @item fps
  7387. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  7388. @item mi_mode
  7389. Motion interpolation mode. Following values are accepted:
  7390. @table @samp
  7391. @item dup
  7392. Duplicate previous or next frame for interpolating new ones.
  7393. @item blend
  7394. Blend source frames. Interpolated frame is mean of previous and next frames.
  7395. @item mci
  7396. Motion compensated interpolation. Following options are effective when this mode is selected:
  7397. @table @samp
  7398. @item mc_mode
  7399. Motion compensation mode. Following values are accepted:
  7400. @table @samp
  7401. @item obmc
  7402. Overlapped block motion compensation.
  7403. @item aobmc
  7404. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7405. @end table
  7406. Default mode is @samp{obmc}.
  7407. @item me_mode
  7408. Motion estimation mode. Following values are accepted:
  7409. @table @samp
  7410. @item bidir
  7411. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7412. @item bilat
  7413. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7414. @end table
  7415. Default mode is @samp{bilat}.
  7416. @item me
  7417. The algorithm to be used for motion estimation. Following values are accepted:
  7418. @table @samp
  7419. @item esa
  7420. Exhaustive search algorithm.
  7421. @item tss
  7422. Three step search algorithm.
  7423. @item tdls
  7424. Two dimensional logarithmic search algorithm.
  7425. @item ntss
  7426. New three step search algorithm.
  7427. @item fss
  7428. Four step search algorithm.
  7429. @item ds
  7430. Diamond search algorithm.
  7431. @item hexbs
  7432. Hexagon-based search algorithm.
  7433. @item epzs
  7434. Enhanced predictive zonal search algorithm.
  7435. @item umh
  7436. Uneven multi-hexagon search algorithm.
  7437. @end table
  7438. Default algorithm is @samp{epzs}.
  7439. @item mb_size
  7440. Macroblock size. Default @code{16}.
  7441. @item search_param
  7442. Motion estimation search parameter. Default @code{32}.
  7443. @item vsmbc
  7444. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  7445. @end table
  7446. @end table
  7447. @item scd
  7448. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  7449. @table @samp
  7450. @item none
  7451. Disable scene change detection.
  7452. @item fdiff
  7453. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7454. @end table
  7455. Default method is @samp{fdiff}.
  7456. @item scd_threshold
  7457. Scene change detection threshold. Default is @code{5.0}.
  7458. @end table
  7459. @section mpdecimate
  7460. Drop frames that do not differ greatly from the previous frame in
  7461. order to reduce frame rate.
  7462. The main use of this filter is for very-low-bitrate encoding
  7463. (e.g. streaming over dialup modem), but it could in theory be used for
  7464. fixing movies that were inverse-telecined incorrectly.
  7465. A description of the accepted options follows.
  7466. @table @option
  7467. @item max
  7468. Set the maximum number of consecutive frames which can be dropped (if
  7469. positive), or the minimum interval between dropped frames (if
  7470. negative). If the value is 0, the frame is dropped unregarding the
  7471. number of previous sequentially dropped frames.
  7472. Default value is 0.
  7473. @item hi
  7474. @item lo
  7475. @item frac
  7476. Set the dropping threshold values.
  7477. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7478. represent actual pixel value differences, so a threshold of 64
  7479. corresponds to 1 unit of difference for each pixel, or the same spread
  7480. out differently over the block.
  7481. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7482. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7483. meaning the whole image) differ by more than a threshold of @option{lo}.
  7484. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7485. 64*5, and default value for @option{frac} is 0.33.
  7486. @end table
  7487. @section negate
  7488. Negate input video.
  7489. It accepts an integer in input; if non-zero it negates the
  7490. alpha component (if available). The default value in input is 0.
  7491. @section nlmeans
  7492. Denoise frames using Non-Local Means algorithm.
  7493. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7494. context similarity is defined by comparing their surrounding patches of size
  7495. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7496. around the pixel.
  7497. Note that the research area defines centers for patches, which means some
  7498. patches will be made of pixels outside that research area.
  7499. The filter accepts the following options.
  7500. @table @option
  7501. @item s
  7502. Set denoising strength.
  7503. @item p
  7504. Set patch size.
  7505. @item pc
  7506. Same as @option{p} but for chroma planes.
  7507. The default value is @var{0} and means automatic.
  7508. @item r
  7509. Set research size.
  7510. @item rc
  7511. Same as @option{r} but for chroma planes.
  7512. The default value is @var{0} and means automatic.
  7513. @end table
  7514. @section nnedi
  7515. Deinterlace video using neural network edge directed interpolation.
  7516. This filter accepts the following options:
  7517. @table @option
  7518. @item weights
  7519. Mandatory option, without binary file filter can not work.
  7520. Currently file can be found here:
  7521. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7522. @item deint
  7523. Set which frames to deinterlace, by default it is @code{all}.
  7524. Can be @code{all} or @code{interlaced}.
  7525. @item field
  7526. Set mode of operation.
  7527. Can be one of the following:
  7528. @table @samp
  7529. @item af
  7530. Use frame flags, both fields.
  7531. @item a
  7532. Use frame flags, single field.
  7533. @item t
  7534. Use top field only.
  7535. @item b
  7536. Use bottom field only.
  7537. @item tf
  7538. Use both fields, top first.
  7539. @item bf
  7540. Use both fields, bottom first.
  7541. @end table
  7542. @item planes
  7543. Set which planes to process, by default filter process all frames.
  7544. @item nsize
  7545. Set size of local neighborhood around each pixel, used by the predictor neural
  7546. network.
  7547. Can be one of the following:
  7548. @table @samp
  7549. @item s8x6
  7550. @item s16x6
  7551. @item s32x6
  7552. @item s48x6
  7553. @item s8x4
  7554. @item s16x4
  7555. @item s32x4
  7556. @end table
  7557. @item nns
  7558. Set the number of neurons in predicctor neural network.
  7559. Can be one of the following:
  7560. @table @samp
  7561. @item n16
  7562. @item n32
  7563. @item n64
  7564. @item n128
  7565. @item n256
  7566. @end table
  7567. @item qual
  7568. Controls the number of different neural network predictions that are blended
  7569. together to compute the final output value. Can be @code{fast}, default or
  7570. @code{slow}.
  7571. @item etype
  7572. Set which set of weights to use in the predictor.
  7573. Can be one of the following:
  7574. @table @samp
  7575. @item a
  7576. weights trained to minimize absolute error
  7577. @item s
  7578. weights trained to minimize squared error
  7579. @end table
  7580. @item pscrn
  7581. Controls whether or not the prescreener neural network is used to decide
  7582. which pixels should be processed by the predictor neural network and which
  7583. can be handled by simple cubic interpolation.
  7584. The prescreener is trained to know whether cubic interpolation will be
  7585. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7586. The computational complexity of the prescreener nn is much less than that of
  7587. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7588. using the prescreener generally results in much faster processing.
  7589. The prescreener is pretty accurate, so the difference between using it and not
  7590. using it is almost always unnoticeable.
  7591. Can be one of the following:
  7592. @table @samp
  7593. @item none
  7594. @item original
  7595. @item new
  7596. @end table
  7597. Default is @code{new}.
  7598. @item fapprox
  7599. Set various debugging flags.
  7600. @end table
  7601. @section noformat
  7602. Force libavfilter not to use any of the specified pixel formats for the
  7603. input to the next filter.
  7604. It accepts the following parameters:
  7605. @table @option
  7606. @item pix_fmts
  7607. A '|'-separated list of pixel format names, such as
  7608. apix_fmts=yuv420p|monow|rgb24".
  7609. @end table
  7610. @subsection Examples
  7611. @itemize
  7612. @item
  7613. Force libavfilter to use a format different from @var{yuv420p} for the
  7614. input to the vflip filter:
  7615. @example
  7616. noformat=pix_fmts=yuv420p,vflip
  7617. @end example
  7618. @item
  7619. Convert the input video to any of the formats not contained in the list:
  7620. @example
  7621. noformat=yuv420p|yuv444p|yuv410p
  7622. @end example
  7623. @end itemize
  7624. @section noise
  7625. Add noise on video input frame.
  7626. The filter accepts the following options:
  7627. @table @option
  7628. @item all_seed
  7629. @item c0_seed
  7630. @item c1_seed
  7631. @item c2_seed
  7632. @item c3_seed
  7633. Set noise seed for specific pixel component or all pixel components in case
  7634. of @var{all_seed}. Default value is @code{123457}.
  7635. @item all_strength, alls
  7636. @item c0_strength, c0s
  7637. @item c1_strength, c1s
  7638. @item c2_strength, c2s
  7639. @item c3_strength, c3s
  7640. Set noise strength for specific pixel component or all pixel components in case
  7641. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7642. @item all_flags, allf
  7643. @item c0_flags, c0f
  7644. @item c1_flags, c1f
  7645. @item c2_flags, c2f
  7646. @item c3_flags, c3f
  7647. Set pixel component flags or set flags for all components if @var{all_flags}.
  7648. Available values for component flags are:
  7649. @table @samp
  7650. @item a
  7651. averaged temporal noise (smoother)
  7652. @item p
  7653. mix random noise with a (semi)regular pattern
  7654. @item t
  7655. temporal noise (noise pattern changes between frames)
  7656. @item u
  7657. uniform noise (gaussian otherwise)
  7658. @end table
  7659. @end table
  7660. @subsection Examples
  7661. Add temporal and uniform noise to input video:
  7662. @example
  7663. noise=alls=20:allf=t+u
  7664. @end example
  7665. @section null
  7666. Pass the video source unchanged to the output.
  7667. @section ocr
  7668. Optical Character Recognition
  7669. This filter uses Tesseract for optical character recognition.
  7670. It accepts the following options:
  7671. @table @option
  7672. @item datapath
  7673. Set datapath to tesseract data. Default is to use whatever was
  7674. set at installation.
  7675. @item language
  7676. Set language, default is "eng".
  7677. @item whitelist
  7678. Set character whitelist.
  7679. @item blacklist
  7680. Set character blacklist.
  7681. @end table
  7682. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7683. @section ocv
  7684. Apply a video transform using libopencv.
  7685. To enable this filter, install the libopencv library and headers and
  7686. configure FFmpeg with @code{--enable-libopencv}.
  7687. It accepts the following parameters:
  7688. @table @option
  7689. @item filter_name
  7690. The name of the libopencv filter to apply.
  7691. @item filter_params
  7692. The parameters to pass to the libopencv filter. If not specified, the default
  7693. values are assumed.
  7694. @end table
  7695. Refer to the official libopencv documentation for more precise
  7696. information:
  7697. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7698. Several libopencv filters are supported; see the following subsections.
  7699. @anchor{dilate}
  7700. @subsection dilate
  7701. Dilate an image by using a specific structuring element.
  7702. It corresponds to the libopencv function @code{cvDilate}.
  7703. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7704. @var{struct_el} represents a structuring element, and has the syntax:
  7705. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7706. @var{cols} and @var{rows} represent the number of columns and rows of
  7707. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7708. point, and @var{shape} the shape for the structuring element. @var{shape}
  7709. must be "rect", "cross", "ellipse", or "custom".
  7710. If the value for @var{shape} is "custom", it must be followed by a
  7711. string of the form "=@var{filename}". The file with name
  7712. @var{filename} is assumed to represent a binary image, with each
  7713. printable character corresponding to a bright pixel. When a custom
  7714. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7715. or columns and rows of the read file are assumed instead.
  7716. The default value for @var{struct_el} is "3x3+0x0/rect".
  7717. @var{nb_iterations} specifies the number of times the transform is
  7718. applied to the image, and defaults to 1.
  7719. Some examples:
  7720. @example
  7721. # Use the default values
  7722. ocv=dilate
  7723. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7724. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7725. # Read the shape from the file diamond.shape, iterating two times.
  7726. # The file diamond.shape may contain a pattern of characters like this
  7727. # *
  7728. # ***
  7729. # *****
  7730. # ***
  7731. # *
  7732. # The specified columns and rows are ignored
  7733. # but the anchor point coordinates are not
  7734. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7735. @end example
  7736. @subsection erode
  7737. Erode an image by using a specific structuring element.
  7738. It corresponds to the libopencv function @code{cvErode}.
  7739. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7740. with the same syntax and semantics as the @ref{dilate} filter.
  7741. @subsection smooth
  7742. Smooth the input video.
  7743. The filter takes the following parameters:
  7744. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7745. @var{type} is the type of smooth filter to apply, and must be one of
  7746. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7747. or "bilateral". The default value is "gaussian".
  7748. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7749. depend on the smooth type. @var{param1} and
  7750. @var{param2} accept integer positive values or 0. @var{param3} and
  7751. @var{param4} accept floating point values.
  7752. The default value for @var{param1} is 3. The default value for the
  7753. other parameters is 0.
  7754. These parameters correspond to the parameters assigned to the
  7755. libopencv function @code{cvSmooth}.
  7756. @anchor{overlay}
  7757. @section overlay
  7758. Overlay one video on top of another.
  7759. It takes two inputs and has one output. The first input is the "main"
  7760. video on which the second input is overlaid.
  7761. It accepts the following parameters:
  7762. A description of the accepted options follows.
  7763. @table @option
  7764. @item x
  7765. @item y
  7766. Set the expression for the x and y coordinates of the overlaid video
  7767. on the main video. Default value is "0" for both expressions. In case
  7768. the expression is invalid, it is set to a huge value (meaning that the
  7769. overlay will not be displayed within the output visible area).
  7770. @item eof_action
  7771. The action to take when EOF is encountered on the secondary input; it accepts
  7772. one of the following values:
  7773. @table @option
  7774. @item repeat
  7775. Repeat the last frame (the default).
  7776. @item endall
  7777. End both streams.
  7778. @item pass
  7779. Pass the main input through.
  7780. @end table
  7781. @item eval
  7782. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7783. It accepts the following values:
  7784. @table @samp
  7785. @item init
  7786. only evaluate expressions once during the filter initialization or
  7787. when a command is processed
  7788. @item frame
  7789. evaluate expressions for each incoming frame
  7790. @end table
  7791. Default value is @samp{frame}.
  7792. @item shortest
  7793. If set to 1, force the output to terminate when the shortest input
  7794. terminates. Default value is 0.
  7795. @item format
  7796. Set the format for the output video.
  7797. It accepts the following values:
  7798. @table @samp
  7799. @item yuv420
  7800. force YUV420 output
  7801. @item yuv422
  7802. force YUV422 output
  7803. @item yuv444
  7804. force YUV444 output
  7805. @item rgb
  7806. force RGB output
  7807. @end table
  7808. Default value is @samp{yuv420}.
  7809. @item rgb @emph{(deprecated)}
  7810. If set to 1, force the filter to accept inputs in the RGB
  7811. color space. Default value is 0. This option is deprecated, use
  7812. @option{format} instead.
  7813. @item repeatlast
  7814. If set to 1, force the filter to draw the last overlay frame over the
  7815. main input until the end of the stream. A value of 0 disables this
  7816. behavior. Default value is 1.
  7817. @end table
  7818. The @option{x}, and @option{y} expressions can contain the following
  7819. parameters.
  7820. @table @option
  7821. @item main_w, W
  7822. @item main_h, H
  7823. The main input width and height.
  7824. @item overlay_w, w
  7825. @item overlay_h, h
  7826. The overlay input width and height.
  7827. @item x
  7828. @item y
  7829. The computed values for @var{x} and @var{y}. They are evaluated for
  7830. each new frame.
  7831. @item hsub
  7832. @item vsub
  7833. horizontal and vertical chroma subsample values of the output
  7834. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7835. @var{vsub} is 1.
  7836. @item n
  7837. the number of input frame, starting from 0
  7838. @item pos
  7839. the position in the file of the input frame, NAN if unknown
  7840. @item t
  7841. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7842. @end table
  7843. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7844. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7845. when @option{eval} is set to @samp{init}.
  7846. Be aware that frames are taken from each input video in timestamp
  7847. order, hence, if their initial timestamps differ, it is a good idea
  7848. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7849. have them begin in the same zero timestamp, as the example for
  7850. the @var{movie} filter does.
  7851. You can chain together more overlays but you should test the
  7852. efficiency of such approach.
  7853. @subsection Commands
  7854. This filter supports the following commands:
  7855. @table @option
  7856. @item x
  7857. @item y
  7858. Modify the x and y of the overlay input.
  7859. The command accepts the same syntax of the corresponding option.
  7860. If the specified expression is not valid, it is kept at its current
  7861. value.
  7862. @end table
  7863. @subsection Examples
  7864. @itemize
  7865. @item
  7866. Draw the overlay at 10 pixels from the bottom right corner of the main
  7867. video:
  7868. @example
  7869. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7870. @end example
  7871. Using named options the example above becomes:
  7872. @example
  7873. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7874. @end example
  7875. @item
  7876. Insert a transparent PNG logo in the bottom left corner of the input,
  7877. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7878. @example
  7879. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7880. @end example
  7881. @item
  7882. Insert 2 different transparent PNG logos (second logo on bottom
  7883. right corner) using the @command{ffmpeg} tool:
  7884. @example
  7885. 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
  7886. @end example
  7887. @item
  7888. Add a transparent color layer on top of the main video; @code{WxH}
  7889. must specify the size of the main input to the overlay filter:
  7890. @example
  7891. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7892. @end example
  7893. @item
  7894. Play an original video and a filtered version (here with the deshake
  7895. filter) side by side using the @command{ffplay} tool:
  7896. @example
  7897. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7898. @end example
  7899. The above command is the same as:
  7900. @example
  7901. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7902. @end example
  7903. @item
  7904. Make a sliding overlay appearing from the left to the right top part of the
  7905. screen starting since time 2:
  7906. @example
  7907. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7908. @end example
  7909. @item
  7910. Compose output by putting two input videos side to side:
  7911. @example
  7912. ffmpeg -i left.avi -i right.avi -filter_complex "
  7913. nullsrc=size=200x100 [background];
  7914. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7915. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7916. [background][left] overlay=shortest=1 [background+left];
  7917. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7918. "
  7919. @end example
  7920. @item
  7921. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7922. @example
  7923. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7924. -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]'
  7925. masked.avi
  7926. @end example
  7927. @item
  7928. Chain several overlays in cascade:
  7929. @example
  7930. nullsrc=s=200x200 [bg];
  7931. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7932. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7933. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7934. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7935. [in3] null, [mid2] overlay=100:100 [out0]
  7936. @end example
  7937. @end itemize
  7938. @section owdenoise
  7939. Apply Overcomplete Wavelet denoiser.
  7940. The filter accepts the following options:
  7941. @table @option
  7942. @item depth
  7943. Set depth.
  7944. Larger depth values will denoise lower frequency components more, but
  7945. slow down filtering.
  7946. Must be an int in the range 8-16, default is @code{8}.
  7947. @item luma_strength, ls
  7948. Set luma strength.
  7949. Must be a double value in the range 0-1000, default is @code{1.0}.
  7950. @item chroma_strength, cs
  7951. Set chroma strength.
  7952. Must be a double value in the range 0-1000, default is @code{1.0}.
  7953. @end table
  7954. @anchor{pad}
  7955. @section pad
  7956. Add paddings to the input image, and place the original input at the
  7957. provided @var{x}, @var{y} coordinates.
  7958. It accepts the following parameters:
  7959. @table @option
  7960. @item width, w
  7961. @item height, h
  7962. Specify an expression for the size of the output image with the
  7963. paddings added. If the value for @var{width} or @var{height} is 0, the
  7964. corresponding input size is used for the output.
  7965. The @var{width} expression can reference the value set by the
  7966. @var{height} expression, and vice versa.
  7967. The default value of @var{width} and @var{height} is 0.
  7968. @item x
  7969. @item y
  7970. Specify the offsets to place the input image at within the padded area,
  7971. with respect to the top/left border of the output image.
  7972. The @var{x} expression can reference the value set by the @var{y}
  7973. expression, and vice versa.
  7974. The default value of @var{x} and @var{y} is 0.
  7975. @item color
  7976. Specify the color of the padded area. For the syntax of this option,
  7977. check the "Color" section in the ffmpeg-utils manual.
  7978. The default value of @var{color} is "black".
  7979. @end table
  7980. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7981. options are expressions containing the following constants:
  7982. @table @option
  7983. @item in_w
  7984. @item in_h
  7985. The input video width and height.
  7986. @item iw
  7987. @item ih
  7988. These are the same as @var{in_w} and @var{in_h}.
  7989. @item out_w
  7990. @item out_h
  7991. The output width and height (the size of the padded area), as
  7992. specified by the @var{width} and @var{height} expressions.
  7993. @item ow
  7994. @item oh
  7995. These are the same as @var{out_w} and @var{out_h}.
  7996. @item x
  7997. @item y
  7998. The x and y offsets as specified by the @var{x} and @var{y}
  7999. expressions, or NAN if not yet specified.
  8000. @item a
  8001. same as @var{iw} / @var{ih}
  8002. @item sar
  8003. input sample aspect ratio
  8004. @item dar
  8005. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8006. @item hsub
  8007. @item vsub
  8008. The horizontal and vertical chroma subsample values. For example for the
  8009. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8010. @end table
  8011. @subsection Examples
  8012. @itemize
  8013. @item
  8014. Add paddings with the color "violet" to the input video. The output video
  8015. size is 640x480, and the top-left corner of the input video is placed at
  8016. column 0, row 40
  8017. @example
  8018. pad=640:480:0:40:violet
  8019. @end example
  8020. The example above is equivalent to the following command:
  8021. @example
  8022. pad=width=640:height=480:x=0:y=40:color=violet
  8023. @end example
  8024. @item
  8025. Pad the input to get an output with dimensions increased by 3/2,
  8026. and put the input video at the center of the padded area:
  8027. @example
  8028. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8029. @end example
  8030. @item
  8031. Pad the input to get a squared output with size equal to the maximum
  8032. value between the input width and height, and put the input video at
  8033. the center of the padded area:
  8034. @example
  8035. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8036. @end example
  8037. @item
  8038. Pad the input to get a final w/h ratio of 16:9:
  8039. @example
  8040. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8041. @end example
  8042. @item
  8043. In case of anamorphic video, in order to set the output display aspect
  8044. correctly, it is necessary to use @var{sar} in the expression,
  8045. according to the relation:
  8046. @example
  8047. (ih * X / ih) * sar = output_dar
  8048. X = output_dar / sar
  8049. @end example
  8050. Thus the previous example needs to be modified to:
  8051. @example
  8052. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8053. @end example
  8054. @item
  8055. Double the output size and put the input video in the bottom-right
  8056. corner of the output padded area:
  8057. @example
  8058. pad="2*iw:2*ih:ow-iw:oh-ih"
  8059. @end example
  8060. @end itemize
  8061. @anchor{palettegen}
  8062. @section palettegen
  8063. Generate one palette for a whole video stream.
  8064. It accepts the following options:
  8065. @table @option
  8066. @item max_colors
  8067. Set the maximum number of colors to quantize in the palette.
  8068. Note: the palette will still contain 256 colors; the unused palette entries
  8069. will be black.
  8070. @item reserve_transparent
  8071. Create a palette of 255 colors maximum and reserve the last one for
  8072. transparency. Reserving the transparency color is useful for GIF optimization.
  8073. If not set, the maximum of colors in the palette will be 256. You probably want
  8074. to disable this option for a standalone image.
  8075. Set by default.
  8076. @item stats_mode
  8077. Set statistics mode.
  8078. It accepts the following values:
  8079. @table @samp
  8080. @item full
  8081. Compute full frame histograms.
  8082. @item diff
  8083. Compute histograms only for the part that differs from previous frame. This
  8084. might be relevant to give more importance to the moving part of your input if
  8085. the background is static.
  8086. @item single
  8087. Compute new histogram for each frame.
  8088. @end table
  8089. Default value is @var{full}.
  8090. @end table
  8091. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8092. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8093. color quantization of the palette. This information is also visible at
  8094. @var{info} logging level.
  8095. @subsection Examples
  8096. @itemize
  8097. @item
  8098. Generate a representative palette of a given video using @command{ffmpeg}:
  8099. @example
  8100. ffmpeg -i input.mkv -vf palettegen palette.png
  8101. @end example
  8102. @end itemize
  8103. @section paletteuse
  8104. Use a palette to downsample an input video stream.
  8105. The filter takes two inputs: one video stream and a palette. The palette must
  8106. be a 256 pixels image.
  8107. It accepts the following options:
  8108. @table @option
  8109. @item dither
  8110. Select dithering mode. Available algorithms are:
  8111. @table @samp
  8112. @item bayer
  8113. Ordered 8x8 bayer dithering (deterministic)
  8114. @item heckbert
  8115. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8116. Note: this dithering is sometimes considered "wrong" and is included as a
  8117. reference.
  8118. @item floyd_steinberg
  8119. Floyd and Steingberg dithering (error diffusion)
  8120. @item sierra2
  8121. Frankie Sierra dithering v2 (error diffusion)
  8122. @item sierra2_4a
  8123. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8124. @end table
  8125. Default is @var{sierra2_4a}.
  8126. @item bayer_scale
  8127. When @var{bayer} dithering is selected, this option defines the scale of the
  8128. pattern (how much the crosshatch pattern is visible). A low value means more
  8129. visible pattern for less banding, and higher value means less visible pattern
  8130. at the cost of more banding.
  8131. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8132. @item diff_mode
  8133. If set, define the zone to process
  8134. @table @samp
  8135. @item rectangle
  8136. Only the changing rectangle will be reprocessed. This is similar to GIF
  8137. cropping/offsetting compression mechanism. This option can be useful for speed
  8138. if only a part of the image is changing, and has use cases such as limiting the
  8139. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8140. moving scene (it leads to more deterministic output if the scene doesn't change
  8141. much, and as a result less moving noise and better GIF compression).
  8142. @end table
  8143. Default is @var{none}.
  8144. @item new
  8145. Take new palette for each output frame.
  8146. @end table
  8147. @subsection Examples
  8148. @itemize
  8149. @item
  8150. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8151. using @command{ffmpeg}:
  8152. @example
  8153. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8154. @end example
  8155. @end itemize
  8156. @section perspective
  8157. Correct perspective of video not recorded perpendicular to the screen.
  8158. A description of the accepted parameters follows.
  8159. @table @option
  8160. @item x0
  8161. @item y0
  8162. @item x1
  8163. @item y1
  8164. @item x2
  8165. @item y2
  8166. @item x3
  8167. @item y3
  8168. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8169. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8170. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8171. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8172. then the corners of the source will be sent to the specified coordinates.
  8173. The expressions can use the following variables:
  8174. @table @option
  8175. @item W
  8176. @item H
  8177. the width and height of video frame.
  8178. @item in
  8179. Input frame count.
  8180. @item on
  8181. Output frame count.
  8182. @end table
  8183. @item interpolation
  8184. Set interpolation for perspective correction.
  8185. It accepts the following values:
  8186. @table @samp
  8187. @item linear
  8188. @item cubic
  8189. @end table
  8190. Default value is @samp{linear}.
  8191. @item sense
  8192. Set interpretation of coordinate options.
  8193. It accepts the following values:
  8194. @table @samp
  8195. @item 0, source
  8196. Send point in the source specified by the given coordinates to
  8197. the corners of the destination.
  8198. @item 1, destination
  8199. Send the corners of the source to the point in the destination specified
  8200. by the given coordinates.
  8201. Default value is @samp{source}.
  8202. @end table
  8203. @item eval
  8204. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8205. It accepts the following values:
  8206. @table @samp
  8207. @item init
  8208. only evaluate expressions once during the filter initialization or
  8209. when a command is processed
  8210. @item frame
  8211. evaluate expressions for each incoming frame
  8212. @end table
  8213. Default value is @samp{init}.
  8214. @end table
  8215. @section phase
  8216. Delay interlaced video by one field time so that the field order changes.
  8217. The intended use is to fix PAL movies that have been captured with the
  8218. opposite field order to the film-to-video transfer.
  8219. A description of the accepted parameters follows.
  8220. @table @option
  8221. @item mode
  8222. Set phase mode.
  8223. It accepts the following values:
  8224. @table @samp
  8225. @item t
  8226. Capture field order top-first, transfer bottom-first.
  8227. Filter will delay the bottom field.
  8228. @item b
  8229. Capture field order bottom-first, transfer top-first.
  8230. Filter will delay the top field.
  8231. @item p
  8232. Capture and transfer with the same field order. This mode only exists
  8233. for the documentation of the other options to refer to, but if you
  8234. actually select it, the filter will faithfully do nothing.
  8235. @item a
  8236. Capture field order determined automatically by field flags, transfer
  8237. opposite.
  8238. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8239. basis using field flags. If no field information is available,
  8240. then this works just like @samp{u}.
  8241. @item u
  8242. Capture unknown or varying, transfer opposite.
  8243. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8244. analyzing the images and selecting the alternative that produces best
  8245. match between the fields.
  8246. @item T
  8247. Capture top-first, transfer unknown or varying.
  8248. Filter selects among @samp{t} and @samp{p} using image analysis.
  8249. @item B
  8250. Capture bottom-first, transfer unknown or varying.
  8251. Filter selects among @samp{b} and @samp{p} using image analysis.
  8252. @item A
  8253. Capture determined by field flags, transfer unknown or varying.
  8254. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8255. image analysis. If no field information is available, then this works just
  8256. like @samp{U}. This is the default mode.
  8257. @item U
  8258. Both capture and transfer unknown or varying.
  8259. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8260. @end table
  8261. @end table
  8262. @section pixdesctest
  8263. Pixel format descriptor test filter, mainly useful for internal
  8264. testing. The output video should be equal to the input video.
  8265. For example:
  8266. @example
  8267. format=monow, pixdesctest
  8268. @end example
  8269. can be used to test the monowhite pixel format descriptor definition.
  8270. @section pp
  8271. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8272. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8273. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8274. Each subfilter and some options have a short and a long name that can be used
  8275. interchangeably, i.e. dr/dering are the same.
  8276. The filters accept the following options:
  8277. @table @option
  8278. @item subfilters
  8279. Set postprocessing subfilters string.
  8280. @end table
  8281. All subfilters share common options to determine their scope:
  8282. @table @option
  8283. @item a/autoq
  8284. Honor the quality commands for this subfilter.
  8285. @item c/chrom
  8286. Do chrominance filtering, too (default).
  8287. @item y/nochrom
  8288. Do luminance filtering only (no chrominance).
  8289. @item n/noluma
  8290. Do chrominance filtering only (no luminance).
  8291. @end table
  8292. These options can be appended after the subfilter name, separated by a '|'.
  8293. Available subfilters are:
  8294. @table @option
  8295. @item hb/hdeblock[|difference[|flatness]]
  8296. Horizontal deblocking filter
  8297. @table @option
  8298. @item difference
  8299. Difference factor where higher values mean more deblocking (default: @code{32}).
  8300. @item flatness
  8301. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8302. @end table
  8303. @item vb/vdeblock[|difference[|flatness]]
  8304. Vertical deblocking filter
  8305. @table @option
  8306. @item difference
  8307. Difference factor where higher values mean more deblocking (default: @code{32}).
  8308. @item flatness
  8309. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8310. @end table
  8311. @item ha/hadeblock[|difference[|flatness]]
  8312. Accurate horizontal deblocking filter
  8313. @table @option
  8314. @item difference
  8315. Difference factor where higher values mean more deblocking (default: @code{32}).
  8316. @item flatness
  8317. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8318. @end table
  8319. @item va/vadeblock[|difference[|flatness]]
  8320. Accurate vertical deblocking filter
  8321. @table @option
  8322. @item difference
  8323. Difference factor where higher values mean more deblocking (default: @code{32}).
  8324. @item flatness
  8325. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8326. @end table
  8327. @end table
  8328. The horizontal and vertical deblocking filters share the difference and
  8329. flatness values so you cannot set different horizontal and vertical
  8330. thresholds.
  8331. @table @option
  8332. @item h1/x1hdeblock
  8333. Experimental horizontal deblocking filter
  8334. @item v1/x1vdeblock
  8335. Experimental vertical deblocking filter
  8336. @item dr/dering
  8337. Deringing filter
  8338. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8339. @table @option
  8340. @item threshold1
  8341. larger -> stronger filtering
  8342. @item threshold2
  8343. larger -> stronger filtering
  8344. @item threshold3
  8345. larger -> stronger filtering
  8346. @end table
  8347. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8348. @table @option
  8349. @item f/fullyrange
  8350. Stretch luminance to @code{0-255}.
  8351. @end table
  8352. @item lb/linblenddeint
  8353. Linear blend deinterlacing filter that deinterlaces the given block by
  8354. filtering all lines with a @code{(1 2 1)} filter.
  8355. @item li/linipoldeint
  8356. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8357. linearly interpolating every second line.
  8358. @item ci/cubicipoldeint
  8359. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8360. cubically interpolating every second line.
  8361. @item md/mediandeint
  8362. Median deinterlacing filter that deinterlaces the given block by applying a
  8363. median filter to every second line.
  8364. @item fd/ffmpegdeint
  8365. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8366. second line with a @code{(-1 4 2 4 -1)} filter.
  8367. @item l5/lowpass5
  8368. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8369. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8370. @item fq/forceQuant[|quantizer]
  8371. Overrides the quantizer table from the input with the constant quantizer you
  8372. specify.
  8373. @table @option
  8374. @item quantizer
  8375. Quantizer to use
  8376. @end table
  8377. @item de/default
  8378. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8379. @item fa/fast
  8380. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8381. @item ac
  8382. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8383. @end table
  8384. @subsection Examples
  8385. @itemize
  8386. @item
  8387. Apply horizontal and vertical deblocking, deringing and automatic
  8388. brightness/contrast:
  8389. @example
  8390. pp=hb/vb/dr/al
  8391. @end example
  8392. @item
  8393. Apply default filters without brightness/contrast correction:
  8394. @example
  8395. pp=de/-al
  8396. @end example
  8397. @item
  8398. Apply default filters and temporal denoiser:
  8399. @example
  8400. pp=default/tmpnoise|1|2|3
  8401. @end example
  8402. @item
  8403. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8404. automatically depending on available CPU time:
  8405. @example
  8406. pp=hb|y/vb|a
  8407. @end example
  8408. @end itemize
  8409. @section pp7
  8410. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8411. similar to spp = 6 with 7 point DCT, where only the center sample is
  8412. used after IDCT.
  8413. The filter accepts the following options:
  8414. @table @option
  8415. @item qp
  8416. Force a constant quantization parameter. It accepts an integer in range
  8417. 0 to 63. If not set, the filter will use the QP from the video stream
  8418. (if available).
  8419. @item mode
  8420. Set thresholding mode. Available modes are:
  8421. @table @samp
  8422. @item hard
  8423. Set hard thresholding.
  8424. @item soft
  8425. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8426. @item medium
  8427. Set medium thresholding (good results, default).
  8428. @end table
  8429. @end table
  8430. @section prewitt
  8431. Apply prewitt operator to input video stream.
  8432. The filter accepts the following option:
  8433. @table @option
  8434. @item planes
  8435. Set which planes will be processed, unprocessed planes will be copied.
  8436. By default value 0xf, all planes will be processed.
  8437. @item scale
  8438. Set value which will be multiplied with filtered result.
  8439. @item delta
  8440. Set value which will be added to filtered result.
  8441. @end table
  8442. @section psnr
  8443. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8444. Ratio) between two input videos.
  8445. This filter takes in input two input videos, the first input is
  8446. considered the "main" source and is passed unchanged to the
  8447. output. The second input is used as a "reference" video for computing
  8448. the PSNR.
  8449. Both video inputs must have the same resolution and pixel format for
  8450. this filter to work correctly. Also it assumes that both inputs
  8451. have the same number of frames, which are compared one by one.
  8452. The obtained average PSNR is printed through the logging system.
  8453. The filter stores the accumulated MSE (mean squared error) of each
  8454. frame, and at the end of the processing it is averaged across all frames
  8455. equally, and the following formula is applied to obtain the PSNR:
  8456. @example
  8457. PSNR = 10*log10(MAX^2/MSE)
  8458. @end example
  8459. Where MAX is the average of the maximum values of each component of the
  8460. image.
  8461. The description of the accepted parameters follows.
  8462. @table @option
  8463. @item stats_file, f
  8464. If specified the filter will use the named file to save the PSNR of
  8465. each individual frame. When filename equals "-" the data is sent to
  8466. standard output.
  8467. @item stats_version
  8468. Specifies which version of the stats file format to use. Details of
  8469. each format are written below.
  8470. Default value is 1.
  8471. @item stats_add_max
  8472. Determines whether the max value is output to the stats log.
  8473. Default value is 0.
  8474. Requires stats_version >= 2. If this is set and stats_version < 2,
  8475. the filter will return an error.
  8476. @end table
  8477. The file printed if @var{stats_file} is selected, contains a sequence of
  8478. key/value pairs of the form @var{key}:@var{value} for each compared
  8479. couple of frames.
  8480. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8481. the list of per-frame-pair stats, with key value pairs following the frame
  8482. format with the following parameters:
  8483. @table @option
  8484. @item psnr_log_version
  8485. The version of the log file format. Will match @var{stats_version}.
  8486. @item fields
  8487. A comma separated list of the per-frame-pair parameters included in
  8488. the log.
  8489. @end table
  8490. A description of each shown per-frame-pair parameter follows:
  8491. @table @option
  8492. @item n
  8493. sequential number of the input frame, starting from 1
  8494. @item mse_avg
  8495. Mean Square Error pixel-by-pixel average difference of the compared
  8496. frames, averaged over all the image components.
  8497. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8498. Mean Square Error pixel-by-pixel average difference of the compared
  8499. frames for the component specified by the suffix.
  8500. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8501. Peak Signal to Noise ratio of the compared frames for the component
  8502. specified by the suffix.
  8503. @item max_avg, max_y, max_u, max_v
  8504. Maximum allowed value for each channel, and average over all
  8505. channels.
  8506. @end table
  8507. For example:
  8508. @example
  8509. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8510. [main][ref] psnr="stats_file=stats.log" [out]
  8511. @end example
  8512. On this example the input file being processed is compared with the
  8513. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8514. is stored in @file{stats.log}.
  8515. @anchor{pullup}
  8516. @section pullup
  8517. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8518. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8519. content.
  8520. The pullup filter is designed to take advantage of future context in making
  8521. its decisions. This filter is stateless in the sense that it does not lock
  8522. onto a pattern to follow, but it instead looks forward to the following
  8523. fields in order to identify matches and rebuild progressive frames.
  8524. To produce content with an even framerate, insert the fps filter after
  8525. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8526. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8527. The filter accepts the following options:
  8528. @table @option
  8529. @item jl
  8530. @item jr
  8531. @item jt
  8532. @item jb
  8533. These options set the amount of "junk" to ignore at the left, right, top, and
  8534. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8535. while top and bottom are in units of 2 lines.
  8536. The default is 8 pixels on each side.
  8537. @item sb
  8538. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8539. filter generating an occasional mismatched frame, but it may also cause an
  8540. excessive number of frames to be dropped during high motion sequences.
  8541. Conversely, setting it to -1 will make filter match fields more easily.
  8542. This may help processing of video where there is slight blurring between
  8543. the fields, but may also cause there to be interlaced frames in the output.
  8544. Default value is @code{0}.
  8545. @item mp
  8546. Set the metric plane to use. It accepts the following values:
  8547. @table @samp
  8548. @item l
  8549. Use luma plane.
  8550. @item u
  8551. Use chroma blue plane.
  8552. @item v
  8553. Use chroma red plane.
  8554. @end table
  8555. This option may be set to use chroma plane instead of the default luma plane
  8556. for doing filter's computations. This may improve accuracy on very clean
  8557. source material, but more likely will decrease accuracy, especially if there
  8558. is chroma noise (rainbow effect) or any grayscale video.
  8559. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8560. load and make pullup usable in realtime on slow machines.
  8561. @end table
  8562. For best results (without duplicated frames in the output file) it is
  8563. necessary to change the output frame rate. For example, to inverse
  8564. telecine NTSC input:
  8565. @example
  8566. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8567. @end example
  8568. @section qp
  8569. Change video quantization parameters (QP).
  8570. The filter accepts the following option:
  8571. @table @option
  8572. @item qp
  8573. Set expression for quantization parameter.
  8574. @end table
  8575. The expression is evaluated through the eval API and can contain, among others,
  8576. the following constants:
  8577. @table @var
  8578. @item known
  8579. 1 if index is not 129, 0 otherwise.
  8580. @item qp
  8581. Sequentional index starting from -129 to 128.
  8582. @end table
  8583. @subsection Examples
  8584. @itemize
  8585. @item
  8586. Some equation like:
  8587. @example
  8588. qp=2+2*sin(PI*qp)
  8589. @end example
  8590. @end itemize
  8591. @section random
  8592. Flush video frames from internal cache of frames into a random order.
  8593. No frame is discarded.
  8594. Inspired by @ref{frei0r} nervous filter.
  8595. @table @option
  8596. @item frames
  8597. Set size in number of frames of internal cache, in range from @code{2} to
  8598. @code{512}. Default is @code{30}.
  8599. @item seed
  8600. Set seed for random number generator, must be an integer included between
  8601. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8602. less than @code{0}, the filter will try to use a good random seed on a
  8603. best effort basis.
  8604. @end table
  8605. @section readvitc
  8606. Read vertical interval timecode (VITC) information from the top lines of a
  8607. video frame.
  8608. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8609. timecode value, if a valid timecode has been detected. Further metadata key
  8610. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8611. timecode data has been found or not.
  8612. This filter accepts the following options:
  8613. @table @option
  8614. @item scan_max
  8615. Set the maximum number of lines to scan for VITC data. If the value is set to
  8616. @code{-1} the full video frame is scanned. Default is @code{45}.
  8617. @item thr_b
  8618. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8619. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8620. @item thr_w
  8621. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8622. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8623. @end table
  8624. @subsection Examples
  8625. @itemize
  8626. @item
  8627. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8628. draw @code{--:--:--:--} as a placeholder:
  8629. @example
  8630. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8631. @end example
  8632. @end itemize
  8633. @section remap
  8634. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8635. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8636. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8637. value for pixel will be used for destination pixel.
  8638. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8639. will have Xmap/Ymap video stream dimensions.
  8640. Xmap and Ymap input video streams are 16bit depth, single channel.
  8641. @section removegrain
  8642. The removegrain filter is a spatial denoiser for progressive video.
  8643. @table @option
  8644. @item m0
  8645. Set mode for the first plane.
  8646. @item m1
  8647. Set mode for the second plane.
  8648. @item m2
  8649. Set mode for the third plane.
  8650. @item m3
  8651. Set mode for the fourth plane.
  8652. @end table
  8653. Range of mode is from 0 to 24. Description of each mode follows:
  8654. @table @var
  8655. @item 0
  8656. Leave input plane unchanged. Default.
  8657. @item 1
  8658. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8659. @item 2
  8660. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8661. @item 3
  8662. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8663. @item 4
  8664. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8665. This is equivalent to a median filter.
  8666. @item 5
  8667. Line-sensitive clipping giving the minimal change.
  8668. @item 6
  8669. Line-sensitive clipping, intermediate.
  8670. @item 7
  8671. Line-sensitive clipping, intermediate.
  8672. @item 8
  8673. Line-sensitive clipping, intermediate.
  8674. @item 9
  8675. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8676. @item 10
  8677. Replaces the target pixel with the closest neighbour.
  8678. @item 11
  8679. [1 2 1] horizontal and vertical kernel blur.
  8680. @item 12
  8681. Same as mode 11.
  8682. @item 13
  8683. Bob mode, interpolates top field from the line where the neighbours
  8684. pixels are the closest.
  8685. @item 14
  8686. Bob mode, interpolates bottom field from the line where the neighbours
  8687. pixels are the closest.
  8688. @item 15
  8689. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8690. interpolation formula.
  8691. @item 16
  8692. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8693. interpolation formula.
  8694. @item 17
  8695. Clips the pixel with the minimum and maximum of respectively the maximum and
  8696. minimum of each pair of opposite neighbour pixels.
  8697. @item 18
  8698. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8699. the current pixel is minimal.
  8700. @item 19
  8701. Replaces the pixel with the average of its 8 neighbours.
  8702. @item 20
  8703. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8704. @item 21
  8705. Clips pixels using the averages of opposite neighbour.
  8706. @item 22
  8707. Same as mode 21 but simpler and faster.
  8708. @item 23
  8709. Small edge and halo removal, but reputed useless.
  8710. @item 24
  8711. Similar as 23.
  8712. @end table
  8713. @section removelogo
  8714. Suppress a TV station logo, using an image file to determine which
  8715. pixels comprise the logo. It works by filling in the pixels that
  8716. comprise the logo with neighboring pixels.
  8717. The filter accepts the following options:
  8718. @table @option
  8719. @item filename, f
  8720. Set the filter bitmap file, which can be any image format supported by
  8721. libavformat. The width and height of the image file must match those of the
  8722. video stream being processed.
  8723. @end table
  8724. Pixels in the provided bitmap image with a value of zero are not
  8725. considered part of the logo, non-zero pixels are considered part of
  8726. the logo. If you use white (255) for the logo and black (0) for the
  8727. rest, you will be safe. For making the filter bitmap, it is
  8728. recommended to take a screen capture of a black frame with the logo
  8729. visible, and then using a threshold filter followed by the erode
  8730. filter once or twice.
  8731. If needed, little splotches can be fixed manually. Remember that if
  8732. logo pixels are not covered, the filter quality will be much
  8733. reduced. Marking too many pixels as part of the logo does not hurt as
  8734. much, but it will increase the amount of blurring needed to cover over
  8735. the image and will destroy more information than necessary, and extra
  8736. pixels will slow things down on a large logo.
  8737. @section repeatfields
  8738. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8739. fields based on its value.
  8740. @section reverse
  8741. Reverse a video clip.
  8742. Warning: This filter requires memory to buffer the entire clip, so trimming
  8743. is suggested.
  8744. @subsection Examples
  8745. @itemize
  8746. @item
  8747. Take the first 5 seconds of a clip, and reverse it.
  8748. @example
  8749. trim=end=5,reverse
  8750. @end example
  8751. @end itemize
  8752. @section rotate
  8753. Rotate video by an arbitrary angle expressed in radians.
  8754. The filter accepts the following options:
  8755. A description of the optional parameters follows.
  8756. @table @option
  8757. @item angle, a
  8758. Set an expression for the angle by which to rotate the input video
  8759. clockwise, expressed as a number of radians. A negative value will
  8760. result in a counter-clockwise rotation. By default it is set to "0".
  8761. This expression is evaluated for each frame.
  8762. @item out_w, ow
  8763. Set the output width expression, default value is "iw".
  8764. This expression is evaluated just once during configuration.
  8765. @item out_h, oh
  8766. Set the output height expression, default value is "ih".
  8767. This expression is evaluated just once during configuration.
  8768. @item bilinear
  8769. Enable bilinear interpolation if set to 1, a value of 0 disables
  8770. it. Default value is 1.
  8771. @item fillcolor, c
  8772. Set the color used to fill the output area not covered by the rotated
  8773. image. For the general syntax of this option, check the "Color" section in the
  8774. ffmpeg-utils manual. If the special value "none" is selected then no
  8775. background is printed (useful for example if the background is never shown).
  8776. Default value is "black".
  8777. @end table
  8778. The expressions for the angle and the output size can contain the
  8779. following constants and functions:
  8780. @table @option
  8781. @item n
  8782. sequential number of the input frame, starting from 0. It is always NAN
  8783. before the first frame is filtered.
  8784. @item t
  8785. time in seconds of the input frame, it is set to 0 when the filter is
  8786. configured. It is always NAN before the first frame is filtered.
  8787. @item hsub
  8788. @item vsub
  8789. horizontal and vertical chroma subsample values. For example for the
  8790. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8791. @item in_w, iw
  8792. @item in_h, ih
  8793. the input video width and height
  8794. @item out_w, ow
  8795. @item out_h, oh
  8796. the output width and height, that is the size of the padded area as
  8797. specified by the @var{width} and @var{height} expressions
  8798. @item rotw(a)
  8799. @item roth(a)
  8800. the minimal width/height required for completely containing the input
  8801. video rotated by @var{a} radians.
  8802. These are only available when computing the @option{out_w} and
  8803. @option{out_h} expressions.
  8804. @end table
  8805. @subsection Examples
  8806. @itemize
  8807. @item
  8808. Rotate the input by PI/6 radians clockwise:
  8809. @example
  8810. rotate=PI/6
  8811. @end example
  8812. @item
  8813. Rotate the input by PI/6 radians counter-clockwise:
  8814. @example
  8815. rotate=-PI/6
  8816. @end example
  8817. @item
  8818. Rotate the input by 45 degrees clockwise:
  8819. @example
  8820. rotate=45*PI/180
  8821. @end example
  8822. @item
  8823. Apply a constant rotation with period T, starting from an angle of PI/3:
  8824. @example
  8825. rotate=PI/3+2*PI*t/T
  8826. @end example
  8827. @item
  8828. Make the input video rotation oscillating with a period of T
  8829. seconds and an amplitude of A radians:
  8830. @example
  8831. rotate=A*sin(2*PI/T*t)
  8832. @end example
  8833. @item
  8834. Rotate the video, output size is chosen so that the whole rotating
  8835. input video is always completely contained in the output:
  8836. @example
  8837. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8838. @end example
  8839. @item
  8840. Rotate the video, reduce the output size so that no background is ever
  8841. shown:
  8842. @example
  8843. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8844. @end example
  8845. @end itemize
  8846. @subsection Commands
  8847. The filter supports the following commands:
  8848. @table @option
  8849. @item a, angle
  8850. Set the angle expression.
  8851. The command accepts the same syntax of the corresponding option.
  8852. If the specified expression is not valid, it is kept at its current
  8853. value.
  8854. @end table
  8855. @section sab
  8856. Apply Shape Adaptive Blur.
  8857. The filter accepts the following options:
  8858. @table @option
  8859. @item luma_radius, lr
  8860. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8861. value is 1.0. A greater value will result in a more blurred image, and
  8862. in slower processing.
  8863. @item luma_pre_filter_radius, lpfr
  8864. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8865. value is 1.0.
  8866. @item luma_strength, ls
  8867. Set luma maximum difference between pixels to still be considered, must
  8868. be a value in the 0.1-100.0 range, default value is 1.0.
  8869. @item chroma_radius, cr
  8870. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8871. greater value will result in a more blurred image, and in slower
  8872. processing.
  8873. @item chroma_pre_filter_radius, cpfr
  8874. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  8875. @item chroma_strength, cs
  8876. Set chroma maximum difference between pixels to still be considered,
  8877. must be a value in the -0.9-100.0 range.
  8878. @end table
  8879. Each chroma option value, if not explicitly specified, is set to the
  8880. corresponding luma option value.
  8881. @anchor{scale}
  8882. @section scale
  8883. Scale (resize) the input video, using the libswscale library.
  8884. The scale filter forces the output display aspect ratio to be the same
  8885. of the input, by changing the output sample aspect ratio.
  8886. If the input image format is different from the format requested by
  8887. the next filter, the scale filter will convert the input to the
  8888. requested format.
  8889. @subsection Options
  8890. The filter accepts the following options, or any of the options
  8891. supported by the libswscale scaler.
  8892. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8893. the complete list of scaler options.
  8894. @table @option
  8895. @item width, w
  8896. @item height, h
  8897. Set the output video dimension expression. Default value is the input
  8898. dimension.
  8899. If the value is 0, the input width is used for the output.
  8900. If one of the values is -1, the scale filter will use a value that
  8901. maintains the aspect ratio of the input image, calculated from the
  8902. other specified dimension. If both of them are -1, the input size is
  8903. used
  8904. If one of the values is -n with n > 1, the scale filter will also use a value
  8905. that maintains the aspect ratio of the input image, calculated from the other
  8906. specified dimension. After that it will, however, make sure that the calculated
  8907. dimension is divisible by n and adjust the value if necessary.
  8908. See below for the list of accepted constants for use in the dimension
  8909. expression.
  8910. @item eval
  8911. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8912. @table @samp
  8913. @item init
  8914. Only evaluate expressions once during the filter initialization or when a command is processed.
  8915. @item frame
  8916. Evaluate expressions for each incoming frame.
  8917. @end table
  8918. Default value is @samp{init}.
  8919. @item interl
  8920. Set the interlacing mode. It accepts the following values:
  8921. @table @samp
  8922. @item 1
  8923. Force interlaced aware scaling.
  8924. @item 0
  8925. Do not apply interlaced scaling.
  8926. @item -1
  8927. Select interlaced aware scaling depending on whether the source frames
  8928. are flagged as interlaced or not.
  8929. @end table
  8930. Default value is @samp{0}.
  8931. @item flags
  8932. Set libswscale scaling flags. See
  8933. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8934. complete list of values. If not explicitly specified the filter applies
  8935. the default flags.
  8936. @item param0, param1
  8937. Set libswscale input parameters for scaling algorithms that need them. See
  8938. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8939. complete documentation. If not explicitly specified the filter applies
  8940. empty parameters.
  8941. @item size, s
  8942. Set the video size. For the syntax of this option, check the
  8943. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8944. @item in_color_matrix
  8945. @item out_color_matrix
  8946. Set in/output YCbCr color space type.
  8947. This allows the autodetected value to be overridden as well as allows forcing
  8948. a specific value used for the output and encoder.
  8949. If not specified, the color space type depends on the pixel format.
  8950. Possible values:
  8951. @table @samp
  8952. @item auto
  8953. Choose automatically.
  8954. @item bt709
  8955. Format conforming to International Telecommunication Union (ITU)
  8956. Recommendation BT.709.
  8957. @item fcc
  8958. Set color space conforming to the United States Federal Communications
  8959. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8960. @item bt601
  8961. Set color space conforming to:
  8962. @itemize
  8963. @item
  8964. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8965. @item
  8966. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8967. @item
  8968. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8969. @end itemize
  8970. @item smpte240m
  8971. Set color space conforming to SMPTE ST 240:1999.
  8972. @end table
  8973. @item in_range
  8974. @item out_range
  8975. Set in/output YCbCr sample range.
  8976. This allows the autodetected value to be overridden as well as allows forcing
  8977. a specific value used for the output and encoder. If not specified, the
  8978. range depends on the pixel format. Possible values:
  8979. @table @samp
  8980. @item auto
  8981. Choose automatically.
  8982. @item jpeg/full/pc
  8983. Set full range (0-255 in case of 8-bit luma).
  8984. @item mpeg/tv
  8985. Set "MPEG" range (16-235 in case of 8-bit luma).
  8986. @end table
  8987. @item force_original_aspect_ratio
  8988. Enable decreasing or increasing output video width or height if necessary to
  8989. keep the original aspect ratio. Possible values:
  8990. @table @samp
  8991. @item disable
  8992. Scale the video as specified and disable this feature.
  8993. @item decrease
  8994. The output video dimensions will automatically be decreased if needed.
  8995. @item increase
  8996. The output video dimensions will automatically be increased if needed.
  8997. @end table
  8998. One useful instance of this option is that when you know a specific device's
  8999. maximum allowed resolution, you can use this to limit the output video to
  9000. that, while retaining the aspect ratio. For example, device A allows
  9001. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9002. decrease) and specifying 1280x720 to the command line makes the output
  9003. 1280x533.
  9004. Please note that this is a different thing than specifying -1 for @option{w}
  9005. or @option{h}, you still need to specify the output resolution for this option
  9006. to work.
  9007. @end table
  9008. The values of the @option{w} and @option{h} options are expressions
  9009. containing the following constants:
  9010. @table @var
  9011. @item in_w
  9012. @item in_h
  9013. The input width and height
  9014. @item iw
  9015. @item ih
  9016. These are the same as @var{in_w} and @var{in_h}.
  9017. @item out_w
  9018. @item out_h
  9019. The output (scaled) width and height
  9020. @item ow
  9021. @item oh
  9022. These are the same as @var{out_w} and @var{out_h}
  9023. @item a
  9024. The same as @var{iw} / @var{ih}
  9025. @item sar
  9026. input sample aspect ratio
  9027. @item dar
  9028. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9029. @item hsub
  9030. @item vsub
  9031. horizontal and vertical input chroma subsample values. For example for the
  9032. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9033. @item ohsub
  9034. @item ovsub
  9035. horizontal and vertical output chroma subsample values. For example for the
  9036. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9037. @end table
  9038. @subsection Examples
  9039. @itemize
  9040. @item
  9041. Scale the input video to a size of 200x100
  9042. @example
  9043. scale=w=200:h=100
  9044. @end example
  9045. This is equivalent to:
  9046. @example
  9047. scale=200:100
  9048. @end example
  9049. or:
  9050. @example
  9051. scale=200x100
  9052. @end example
  9053. @item
  9054. Specify a size abbreviation for the output size:
  9055. @example
  9056. scale=qcif
  9057. @end example
  9058. which can also be written as:
  9059. @example
  9060. scale=size=qcif
  9061. @end example
  9062. @item
  9063. Scale the input to 2x:
  9064. @example
  9065. scale=w=2*iw:h=2*ih
  9066. @end example
  9067. @item
  9068. The above is the same as:
  9069. @example
  9070. scale=2*in_w:2*in_h
  9071. @end example
  9072. @item
  9073. Scale the input to 2x with forced interlaced scaling:
  9074. @example
  9075. scale=2*iw:2*ih:interl=1
  9076. @end example
  9077. @item
  9078. Scale the input to half size:
  9079. @example
  9080. scale=w=iw/2:h=ih/2
  9081. @end example
  9082. @item
  9083. Increase the width, and set the height to the same size:
  9084. @example
  9085. scale=3/2*iw:ow
  9086. @end example
  9087. @item
  9088. Seek Greek harmony:
  9089. @example
  9090. scale=iw:1/PHI*iw
  9091. scale=ih*PHI:ih
  9092. @end example
  9093. @item
  9094. Increase the height, and set the width to 3/2 of the height:
  9095. @example
  9096. scale=w=3/2*oh:h=3/5*ih
  9097. @end example
  9098. @item
  9099. Increase the size, making the size a multiple of the chroma
  9100. subsample values:
  9101. @example
  9102. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9103. @end example
  9104. @item
  9105. Increase the width to a maximum of 500 pixels,
  9106. keeping the same aspect ratio as the input:
  9107. @example
  9108. scale=w='min(500\, iw*3/2):h=-1'
  9109. @end example
  9110. @end itemize
  9111. @subsection Commands
  9112. This filter supports the following commands:
  9113. @table @option
  9114. @item width, w
  9115. @item height, h
  9116. Set the output video dimension expression.
  9117. The command accepts the same syntax of the corresponding option.
  9118. If the specified expression is not valid, it is kept at its current
  9119. value.
  9120. @end table
  9121. @section scale_npp
  9122. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9123. format conversion on CUDA video frames. Setting the output width and height
  9124. works in the same way as for the @var{scale} filter.
  9125. The following additional options are accepted:
  9126. @table @option
  9127. @item format
  9128. The pixel format of the output CUDA frames. If set to the string "same" (the
  9129. default), the input format will be kept. Note that automatic format negotiation
  9130. and conversion is not yet supported for hardware frames
  9131. @item interp_algo
  9132. The interpolation algorithm used for resizing. One of the following:
  9133. @table @option
  9134. @item nn
  9135. Nearest neighbour.
  9136. @item linear
  9137. @item cubic
  9138. @item cubic2p_bspline
  9139. 2-parameter cubic (B=1, C=0)
  9140. @item cubic2p_catmullrom
  9141. 2-parameter cubic (B=0, C=1/2)
  9142. @item cubic2p_b05c03
  9143. 2-parameter cubic (B=1/2, C=3/10)
  9144. @item super
  9145. Supersampling
  9146. @item lanczos
  9147. @end table
  9148. @end table
  9149. @section scale2ref
  9150. Scale (resize) the input video, based on a reference video.
  9151. See the scale filter for available options, scale2ref supports the same but
  9152. uses the reference video instead of the main input as basis.
  9153. @subsection Examples
  9154. @itemize
  9155. @item
  9156. Scale a subtitle stream to match the main video in size before overlaying
  9157. @example
  9158. 'scale2ref[b][a];[a][b]overlay'
  9159. @end example
  9160. @end itemize
  9161. @anchor{selectivecolor}
  9162. @section selectivecolor
  9163. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9164. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9165. by the "purity" of the color (that is, how saturated it already is).
  9166. This filter is similar to the Adobe Photoshop Selective Color tool.
  9167. The filter accepts the following options:
  9168. @table @option
  9169. @item correction_method
  9170. Select color correction method.
  9171. Available values are:
  9172. @table @samp
  9173. @item absolute
  9174. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9175. component value).
  9176. @item relative
  9177. Specified adjustments are relative to the original component value.
  9178. @end table
  9179. Default is @code{absolute}.
  9180. @item reds
  9181. Adjustments for red pixels (pixels where the red component is the maximum)
  9182. @item yellows
  9183. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9184. @item greens
  9185. Adjustments for green pixels (pixels where the green component is the maximum)
  9186. @item cyans
  9187. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9188. @item blues
  9189. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9190. @item magentas
  9191. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9192. @item whites
  9193. Adjustments for white pixels (pixels where all components are greater than 128)
  9194. @item neutrals
  9195. Adjustments for all pixels except pure black and pure white
  9196. @item blacks
  9197. Adjustments for black pixels (pixels where all components are lesser than 128)
  9198. @item psfile
  9199. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9200. @end table
  9201. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9202. 4 space separated floating point adjustment values in the [-1,1] range,
  9203. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9204. pixels of its range.
  9205. @subsection Examples
  9206. @itemize
  9207. @item
  9208. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9209. increase magenta by 27% in blue areas:
  9210. @example
  9211. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9212. @end example
  9213. @item
  9214. Use a Photoshop selective color preset:
  9215. @example
  9216. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9217. @end example
  9218. @end itemize
  9219. @anchor{separatefields}
  9220. @section separatefields
  9221. The @code{separatefields} takes a frame-based video input and splits
  9222. each frame into its components fields, producing a new half height clip
  9223. with twice the frame rate and twice the frame count.
  9224. This filter use field-dominance information in frame to decide which
  9225. of each pair of fields to place first in the output.
  9226. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9227. @section setdar, setsar
  9228. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9229. output video.
  9230. This is done by changing the specified Sample (aka Pixel) Aspect
  9231. Ratio, according to the following equation:
  9232. @example
  9233. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9234. @end example
  9235. Keep in mind that the @code{setdar} filter does not modify the pixel
  9236. dimensions of the video frame. Also, the display aspect ratio set by
  9237. this filter may be changed by later filters in the filterchain,
  9238. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9239. applied.
  9240. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9241. the filter output video.
  9242. Note that as a consequence of the application of this filter, the
  9243. output display aspect ratio will change according to the equation
  9244. above.
  9245. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9246. filter may be changed by later filters in the filterchain, e.g. if
  9247. another "setsar" or a "setdar" filter is applied.
  9248. It accepts the following parameters:
  9249. @table @option
  9250. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9251. Set the aspect ratio used by the filter.
  9252. The parameter can be a floating point number string, an expression, or
  9253. a string of the form @var{num}:@var{den}, where @var{num} and
  9254. @var{den} are the numerator and denominator of the aspect ratio. If
  9255. the parameter is not specified, it is assumed the value "0".
  9256. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9257. should be escaped.
  9258. @item max
  9259. Set the maximum integer value to use for expressing numerator and
  9260. denominator when reducing the expressed aspect ratio to a rational.
  9261. Default value is @code{100}.
  9262. @end table
  9263. The parameter @var{sar} is an expression containing
  9264. the following constants:
  9265. @table @option
  9266. @item E, PI, PHI
  9267. These are approximated values for the mathematical constants e
  9268. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9269. @item w, h
  9270. The input width and height.
  9271. @item a
  9272. These are the same as @var{w} / @var{h}.
  9273. @item sar
  9274. The input sample aspect ratio.
  9275. @item dar
  9276. The input display aspect ratio. It is the same as
  9277. (@var{w} / @var{h}) * @var{sar}.
  9278. @item hsub, vsub
  9279. Horizontal and vertical chroma subsample values. For example, for the
  9280. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9281. @end table
  9282. @subsection Examples
  9283. @itemize
  9284. @item
  9285. To change the display aspect ratio to 16:9, specify one of the following:
  9286. @example
  9287. setdar=dar=1.77777
  9288. setdar=dar=16/9
  9289. @end example
  9290. @item
  9291. To change the sample aspect ratio to 10:11, specify:
  9292. @example
  9293. setsar=sar=10/11
  9294. @end example
  9295. @item
  9296. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9297. 1000 in the aspect ratio reduction, use the command:
  9298. @example
  9299. setdar=ratio=16/9:max=1000
  9300. @end example
  9301. @end itemize
  9302. @anchor{setfield}
  9303. @section setfield
  9304. Force field for the output video frame.
  9305. The @code{setfield} filter marks the interlace type field for the
  9306. output frames. It does not change the input frame, but only sets the
  9307. corresponding property, which affects how the frame is treated by
  9308. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9309. The filter accepts the following options:
  9310. @table @option
  9311. @item mode
  9312. Available values are:
  9313. @table @samp
  9314. @item auto
  9315. Keep the same field property.
  9316. @item bff
  9317. Mark the frame as bottom-field-first.
  9318. @item tff
  9319. Mark the frame as top-field-first.
  9320. @item prog
  9321. Mark the frame as progressive.
  9322. @end table
  9323. @end table
  9324. @section showinfo
  9325. Show a line containing various information for each input video frame.
  9326. The input video is not modified.
  9327. The shown line contains a sequence of key/value pairs of the form
  9328. @var{key}:@var{value}.
  9329. The following values are shown in the output:
  9330. @table @option
  9331. @item n
  9332. The (sequential) number of the input frame, starting from 0.
  9333. @item pts
  9334. The Presentation TimeStamp of the input frame, expressed as a number of
  9335. time base units. The time base unit depends on the filter input pad.
  9336. @item pts_time
  9337. The Presentation TimeStamp of the input frame, expressed as a number of
  9338. seconds.
  9339. @item pos
  9340. The position of the frame in the input stream, or -1 if this information is
  9341. unavailable and/or meaningless (for example in case of synthetic video).
  9342. @item fmt
  9343. The pixel format name.
  9344. @item sar
  9345. The sample aspect ratio of the input frame, expressed in the form
  9346. @var{num}/@var{den}.
  9347. @item s
  9348. The size of the input frame. For the syntax of this option, check the
  9349. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9350. @item i
  9351. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9352. for bottom field first).
  9353. @item iskey
  9354. This is 1 if the frame is a key frame, 0 otherwise.
  9355. @item type
  9356. The picture type of the input frame ("I" for an I-frame, "P" for a
  9357. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9358. Also refer to the documentation of the @code{AVPictureType} enum and of
  9359. the @code{av_get_picture_type_char} function defined in
  9360. @file{libavutil/avutil.h}.
  9361. @item checksum
  9362. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9363. @item plane_checksum
  9364. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9365. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9366. @end table
  9367. @section showpalette
  9368. Displays the 256 colors palette of each frame. This filter is only relevant for
  9369. @var{pal8} pixel format frames.
  9370. It accepts the following option:
  9371. @table @option
  9372. @item s
  9373. Set the size of the box used to represent one palette color entry. Default is
  9374. @code{30} (for a @code{30x30} pixel box).
  9375. @end table
  9376. @section shuffleframes
  9377. Reorder and/or duplicate video frames.
  9378. It accepts the following parameters:
  9379. @table @option
  9380. @item mapping
  9381. Set the destination indexes of input frames.
  9382. This is space or '|' separated list of indexes that maps input frames to output
  9383. frames. Number of indexes also sets maximal value that each index may have.
  9384. @end table
  9385. The first frame has the index 0. The default is to keep the input unchanged.
  9386. @subsection Examples
  9387. @itemize
  9388. @item
  9389. Swap second and third frame of every three frames of the input:
  9390. @example
  9391. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9392. @end example
  9393. @item
  9394. Swap 10th and 1st frame of every ten frames of the input:
  9395. @example
  9396. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9397. @end example
  9398. @end itemize
  9399. @section shuffleplanes
  9400. Reorder and/or duplicate video planes.
  9401. It accepts the following parameters:
  9402. @table @option
  9403. @item map0
  9404. The index of the input plane to be used as the first output plane.
  9405. @item map1
  9406. The index of the input plane to be used as the second output plane.
  9407. @item map2
  9408. The index of the input plane to be used as the third output plane.
  9409. @item map3
  9410. The index of the input plane to be used as the fourth output plane.
  9411. @end table
  9412. The first plane has the index 0. The default is to keep the input unchanged.
  9413. @subsection Examples
  9414. @itemize
  9415. @item
  9416. Swap the second and third planes of the input:
  9417. @example
  9418. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9419. @end example
  9420. @end itemize
  9421. @anchor{signalstats}
  9422. @section signalstats
  9423. Evaluate various visual metrics that assist in determining issues associated
  9424. with the digitization of analog video media.
  9425. By default the filter will log these metadata values:
  9426. @table @option
  9427. @item YMIN
  9428. Display the minimal Y value contained within the input frame. Expressed in
  9429. range of [0-255].
  9430. @item YLOW
  9431. Display the Y value at the 10% percentile within the input frame. Expressed in
  9432. range of [0-255].
  9433. @item YAVG
  9434. Display the average Y value within the input frame. Expressed in range of
  9435. [0-255].
  9436. @item YHIGH
  9437. Display the Y value at the 90% percentile within the input frame. Expressed in
  9438. range of [0-255].
  9439. @item YMAX
  9440. Display the maximum Y value contained within the input frame. Expressed in
  9441. range of [0-255].
  9442. @item UMIN
  9443. Display the minimal U value contained within the input frame. Expressed in
  9444. range of [0-255].
  9445. @item ULOW
  9446. Display the U value at the 10% percentile within the input frame. Expressed in
  9447. range of [0-255].
  9448. @item UAVG
  9449. Display the average U value within the input frame. Expressed in range of
  9450. [0-255].
  9451. @item UHIGH
  9452. Display the U value at the 90% percentile within the input frame. Expressed in
  9453. range of [0-255].
  9454. @item UMAX
  9455. Display the maximum U value contained within the input frame. Expressed in
  9456. range of [0-255].
  9457. @item VMIN
  9458. Display the minimal V value contained within the input frame. Expressed in
  9459. range of [0-255].
  9460. @item VLOW
  9461. Display the V value at the 10% percentile within the input frame. Expressed in
  9462. range of [0-255].
  9463. @item VAVG
  9464. Display the average V value within the input frame. Expressed in range of
  9465. [0-255].
  9466. @item VHIGH
  9467. Display the V value at the 90% percentile within the input frame. Expressed in
  9468. range of [0-255].
  9469. @item VMAX
  9470. Display the maximum V value contained within the input frame. Expressed in
  9471. range of [0-255].
  9472. @item SATMIN
  9473. Display the minimal saturation value contained within the input frame.
  9474. Expressed in range of [0-~181.02].
  9475. @item SATLOW
  9476. Display the saturation value at the 10% percentile within the input frame.
  9477. Expressed in range of [0-~181.02].
  9478. @item SATAVG
  9479. Display the average saturation value within the input frame. Expressed in range
  9480. of [0-~181.02].
  9481. @item SATHIGH
  9482. Display the saturation value at the 90% percentile within the input frame.
  9483. Expressed in range of [0-~181.02].
  9484. @item SATMAX
  9485. Display the maximum saturation value contained within the input frame.
  9486. Expressed in range of [0-~181.02].
  9487. @item HUEMED
  9488. Display the median value for hue within the input frame. Expressed in range of
  9489. [0-360].
  9490. @item HUEAVG
  9491. Display the average value for hue within the input frame. Expressed in range of
  9492. [0-360].
  9493. @item YDIF
  9494. Display the average of sample value difference between all values of the Y
  9495. plane in the current frame and corresponding values of the previous input frame.
  9496. Expressed in range of [0-255].
  9497. @item UDIF
  9498. Display the average of sample value difference between all values of the U
  9499. plane in the current frame and corresponding values of the previous input frame.
  9500. Expressed in range of [0-255].
  9501. @item VDIF
  9502. Display the average of sample value difference between all values of the V
  9503. plane in the current frame and corresponding values of the previous input frame.
  9504. Expressed in range of [0-255].
  9505. @item YBITDEPTH
  9506. Display bit depth of Y plane in current frame.
  9507. Expressed in range of [0-16].
  9508. @item UBITDEPTH
  9509. Display bit depth of U plane in current frame.
  9510. Expressed in range of [0-16].
  9511. @item VBITDEPTH
  9512. Display bit depth of V plane in current frame.
  9513. Expressed in range of [0-16].
  9514. @end table
  9515. The filter accepts the following options:
  9516. @table @option
  9517. @item stat
  9518. @item out
  9519. @option{stat} specify an additional form of image analysis.
  9520. @option{out} output video with the specified type of pixel highlighted.
  9521. Both options accept the following values:
  9522. @table @samp
  9523. @item tout
  9524. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9525. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9526. include the results of video dropouts, head clogs, or tape tracking issues.
  9527. @item vrep
  9528. Identify @var{vertical line repetition}. Vertical line repetition includes
  9529. similar rows of pixels within a frame. In born-digital video vertical line
  9530. repetition is common, but this pattern is uncommon in video digitized from an
  9531. analog source. When it occurs in video that results from the digitization of an
  9532. analog source it can indicate concealment from a dropout compensator.
  9533. @item brng
  9534. Identify pixels that fall outside of legal broadcast range.
  9535. @end table
  9536. @item color, c
  9537. Set the highlight color for the @option{out} option. The default color is
  9538. yellow.
  9539. @end table
  9540. @subsection Examples
  9541. @itemize
  9542. @item
  9543. Output data of various video metrics:
  9544. @example
  9545. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9546. @end example
  9547. @item
  9548. Output specific data about the minimum and maximum values of the Y plane per frame:
  9549. @example
  9550. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9551. @end example
  9552. @item
  9553. Playback video while highlighting pixels that are outside of broadcast range in red.
  9554. @example
  9555. ffplay example.mov -vf signalstats="out=brng:color=red"
  9556. @end example
  9557. @item
  9558. Playback video with signalstats metadata drawn over the frame.
  9559. @example
  9560. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9561. @end example
  9562. The contents of signalstat_drawtext.txt used in the command are:
  9563. @example
  9564. time %@{pts:hms@}
  9565. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9566. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9567. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9568. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9569. @end example
  9570. @end itemize
  9571. @anchor{smartblur}
  9572. @section smartblur
  9573. Blur the input video without impacting the outlines.
  9574. It accepts the following options:
  9575. @table @option
  9576. @item luma_radius, lr
  9577. Set the luma radius. The option value must be a float number in
  9578. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9579. used to blur the image (slower if larger). Default value is 1.0.
  9580. @item luma_strength, ls
  9581. Set the luma strength. The option value must be a float number
  9582. in the range [-1.0,1.0] that configures the blurring. A value included
  9583. in [0.0,1.0] will blur the image whereas a value included in
  9584. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9585. @item luma_threshold, lt
  9586. Set the luma threshold used as a coefficient to determine
  9587. whether a pixel should be blurred or not. The option value must be an
  9588. integer in the range [-30,30]. A value of 0 will filter all the image,
  9589. a value included in [0,30] will filter flat areas and a value included
  9590. in [-30,0] will filter edges. Default value is 0.
  9591. @item chroma_radius, cr
  9592. Set the chroma radius. The option value must be a float number in
  9593. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9594. used to blur the image (slower if larger). Default value is 1.0.
  9595. @item chroma_strength, cs
  9596. Set the chroma strength. The option value must be a float number
  9597. in the range [-1.0,1.0] that configures the blurring. A value included
  9598. in [0.0,1.0] will blur the image whereas a value included in
  9599. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9600. @item chroma_threshold, ct
  9601. Set the chroma threshold used as a coefficient to determine
  9602. whether a pixel should be blurred or not. The option value must be an
  9603. integer in the range [-30,30]. A value of 0 will filter all the image,
  9604. a value included in [0,30] will filter flat areas and a value included
  9605. in [-30,0] will filter edges. Default value is 0.
  9606. @end table
  9607. If a chroma option is not explicitly set, the corresponding luma value
  9608. is set.
  9609. @section ssim
  9610. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9611. This filter takes in input two input videos, the first input is
  9612. considered the "main" source and is passed unchanged to the
  9613. output. The second input is used as a "reference" video for computing
  9614. the SSIM.
  9615. Both video inputs must have the same resolution and pixel format for
  9616. this filter to work correctly. Also it assumes that both inputs
  9617. have the same number of frames, which are compared one by one.
  9618. The filter stores the calculated SSIM of each frame.
  9619. The description of the accepted parameters follows.
  9620. @table @option
  9621. @item stats_file, f
  9622. If specified the filter will use the named file to save the SSIM of
  9623. each individual frame. When filename equals "-" the data is sent to
  9624. standard output.
  9625. @end table
  9626. The file printed if @var{stats_file} is selected, contains a sequence of
  9627. key/value pairs of the form @var{key}:@var{value} for each compared
  9628. couple of frames.
  9629. A description of each shown parameter follows:
  9630. @table @option
  9631. @item n
  9632. sequential number of the input frame, starting from 1
  9633. @item Y, U, V, R, G, B
  9634. SSIM of the compared frames for the component specified by the suffix.
  9635. @item All
  9636. SSIM of the compared frames for the whole frame.
  9637. @item dB
  9638. Same as above but in dB representation.
  9639. @end table
  9640. For example:
  9641. @example
  9642. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9643. [main][ref] ssim="stats_file=stats.log" [out]
  9644. @end example
  9645. On this example the input file being processed is compared with the
  9646. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9647. is stored in @file{stats.log}.
  9648. Another example with both psnr and ssim at same time:
  9649. @example
  9650. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9651. @end example
  9652. @section stereo3d
  9653. Convert between different stereoscopic image formats.
  9654. The filters accept the following options:
  9655. @table @option
  9656. @item in
  9657. Set stereoscopic image format of input.
  9658. Available values for input image formats are:
  9659. @table @samp
  9660. @item sbsl
  9661. side by side parallel (left eye left, right eye right)
  9662. @item sbsr
  9663. side by side crosseye (right eye left, left eye right)
  9664. @item sbs2l
  9665. side by side parallel with half width resolution
  9666. (left eye left, right eye right)
  9667. @item sbs2r
  9668. side by side crosseye with half width resolution
  9669. (right eye left, left eye right)
  9670. @item abl
  9671. above-below (left eye above, right eye below)
  9672. @item abr
  9673. above-below (right eye above, left eye below)
  9674. @item ab2l
  9675. above-below with half height resolution
  9676. (left eye above, right eye below)
  9677. @item ab2r
  9678. above-below with half height resolution
  9679. (right eye above, left eye below)
  9680. @item al
  9681. alternating frames (left eye first, right eye second)
  9682. @item ar
  9683. alternating frames (right eye first, left eye second)
  9684. @item irl
  9685. interleaved rows (left eye has top row, right eye starts on next row)
  9686. @item irr
  9687. interleaved rows (right eye has top row, left eye starts on next row)
  9688. @item icl
  9689. interleaved columns, left eye first
  9690. @item icr
  9691. interleaved columns, right eye first
  9692. Default value is @samp{sbsl}.
  9693. @end table
  9694. @item out
  9695. Set stereoscopic image format of output.
  9696. @table @samp
  9697. @item sbsl
  9698. side by side parallel (left eye left, right eye right)
  9699. @item sbsr
  9700. side by side crosseye (right eye left, left eye right)
  9701. @item sbs2l
  9702. side by side parallel with half width resolution
  9703. (left eye left, right eye right)
  9704. @item sbs2r
  9705. side by side crosseye with half width resolution
  9706. (right eye left, left eye right)
  9707. @item abl
  9708. above-below (left eye above, right eye below)
  9709. @item abr
  9710. above-below (right eye above, left eye below)
  9711. @item ab2l
  9712. above-below with half height resolution
  9713. (left eye above, right eye below)
  9714. @item ab2r
  9715. above-below with half height resolution
  9716. (right eye above, left eye below)
  9717. @item al
  9718. alternating frames (left eye first, right eye second)
  9719. @item ar
  9720. alternating frames (right eye first, left eye second)
  9721. @item irl
  9722. interleaved rows (left eye has top row, right eye starts on next row)
  9723. @item irr
  9724. interleaved rows (right eye has top row, left eye starts on next row)
  9725. @item arbg
  9726. anaglyph red/blue gray
  9727. (red filter on left eye, blue filter on right eye)
  9728. @item argg
  9729. anaglyph red/green gray
  9730. (red filter on left eye, green filter on right eye)
  9731. @item arcg
  9732. anaglyph red/cyan gray
  9733. (red filter on left eye, cyan filter on right eye)
  9734. @item arch
  9735. anaglyph red/cyan half colored
  9736. (red filter on left eye, cyan filter on right eye)
  9737. @item arcc
  9738. anaglyph red/cyan color
  9739. (red filter on left eye, cyan filter on right eye)
  9740. @item arcd
  9741. anaglyph red/cyan color optimized with the least squares projection of dubois
  9742. (red filter on left eye, cyan filter on right eye)
  9743. @item agmg
  9744. anaglyph green/magenta gray
  9745. (green filter on left eye, magenta filter on right eye)
  9746. @item agmh
  9747. anaglyph green/magenta half colored
  9748. (green filter on left eye, magenta filter on right eye)
  9749. @item agmc
  9750. anaglyph green/magenta colored
  9751. (green filter on left eye, magenta filter on right eye)
  9752. @item agmd
  9753. anaglyph green/magenta color optimized with the least squares projection of dubois
  9754. (green filter on left eye, magenta filter on right eye)
  9755. @item aybg
  9756. anaglyph yellow/blue gray
  9757. (yellow filter on left eye, blue filter on right eye)
  9758. @item aybh
  9759. anaglyph yellow/blue half colored
  9760. (yellow filter on left eye, blue filter on right eye)
  9761. @item aybc
  9762. anaglyph yellow/blue colored
  9763. (yellow filter on left eye, blue filter on right eye)
  9764. @item aybd
  9765. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9766. (yellow filter on left eye, blue filter on right eye)
  9767. @item ml
  9768. mono output (left eye only)
  9769. @item mr
  9770. mono output (right eye only)
  9771. @item chl
  9772. checkerboard, left eye first
  9773. @item chr
  9774. checkerboard, right eye first
  9775. @item icl
  9776. interleaved columns, left eye first
  9777. @item icr
  9778. interleaved columns, right eye first
  9779. @item hdmi
  9780. HDMI frame pack
  9781. @end table
  9782. Default value is @samp{arcd}.
  9783. @end table
  9784. @subsection Examples
  9785. @itemize
  9786. @item
  9787. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9788. @example
  9789. stereo3d=sbsl:aybd
  9790. @end example
  9791. @item
  9792. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9793. @example
  9794. stereo3d=abl:sbsr
  9795. @end example
  9796. @end itemize
  9797. @section streamselect, astreamselect
  9798. Select video or audio streams.
  9799. The filter accepts the following options:
  9800. @table @option
  9801. @item inputs
  9802. Set number of inputs. Default is 2.
  9803. @item map
  9804. Set input indexes to remap to outputs.
  9805. @end table
  9806. @subsection Commands
  9807. The @code{streamselect} and @code{astreamselect} filter supports the following
  9808. commands:
  9809. @table @option
  9810. @item map
  9811. Set input indexes to remap to outputs.
  9812. @end table
  9813. @subsection Examples
  9814. @itemize
  9815. @item
  9816. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9817. @example
  9818. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9819. @end example
  9820. @item
  9821. Same as above, but for audio:
  9822. @example
  9823. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9824. @end example
  9825. @end itemize
  9826. @section sobel
  9827. Apply sobel operator to input video stream.
  9828. The filter accepts the following option:
  9829. @table @option
  9830. @item planes
  9831. Set which planes will be processed, unprocessed planes will be copied.
  9832. By default value 0xf, all planes will be processed.
  9833. @item scale
  9834. Set value which will be multiplied with filtered result.
  9835. @item delta
  9836. Set value which will be added to filtered result.
  9837. @end table
  9838. @anchor{spp}
  9839. @section spp
  9840. Apply a simple postprocessing filter that compresses and decompresses the image
  9841. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9842. and average the results.
  9843. The filter accepts the following options:
  9844. @table @option
  9845. @item quality
  9846. Set quality. This option defines the number of levels for averaging. It accepts
  9847. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9848. effect. A value of @code{6} means the higher quality. For each increment of
  9849. that value the speed drops by a factor of approximately 2. Default value is
  9850. @code{3}.
  9851. @item qp
  9852. Force a constant quantization parameter. If not set, the filter will use the QP
  9853. from the video stream (if available).
  9854. @item mode
  9855. Set thresholding mode. Available modes are:
  9856. @table @samp
  9857. @item hard
  9858. Set hard thresholding (default).
  9859. @item soft
  9860. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9861. @end table
  9862. @item use_bframe_qp
  9863. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9864. option may cause flicker since the B-Frames have often larger QP. Default is
  9865. @code{0} (not enabled).
  9866. @end table
  9867. @anchor{subtitles}
  9868. @section subtitles
  9869. Draw subtitles on top of input video using the libass library.
  9870. To enable compilation of this filter you need to configure FFmpeg with
  9871. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9872. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9873. Alpha) subtitles format.
  9874. The filter accepts the following options:
  9875. @table @option
  9876. @item filename, f
  9877. Set the filename of the subtitle file to read. It must be specified.
  9878. @item original_size
  9879. Specify the size of the original video, the video for which the ASS file
  9880. was composed. For the syntax of this option, check the
  9881. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9882. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9883. correctly scale the fonts if the aspect ratio has been changed.
  9884. @item fontsdir
  9885. Set a directory path containing fonts that can be used by the filter.
  9886. These fonts will be used in addition to whatever the font provider uses.
  9887. @item charenc
  9888. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9889. useful if not UTF-8.
  9890. @item stream_index, si
  9891. Set subtitles stream index. @code{subtitles} filter only.
  9892. @item force_style
  9893. Override default style or script info parameters of the subtitles. It accepts a
  9894. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9895. @end table
  9896. If the first key is not specified, it is assumed that the first value
  9897. specifies the @option{filename}.
  9898. For example, to render the file @file{sub.srt} on top of the input
  9899. video, use the command:
  9900. @example
  9901. subtitles=sub.srt
  9902. @end example
  9903. which is equivalent to:
  9904. @example
  9905. subtitles=filename=sub.srt
  9906. @end example
  9907. To render the default subtitles stream from file @file{video.mkv}, use:
  9908. @example
  9909. subtitles=video.mkv
  9910. @end example
  9911. To render the second subtitles stream from that file, use:
  9912. @example
  9913. subtitles=video.mkv:si=1
  9914. @end example
  9915. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9916. @code{DejaVu Serif}, use:
  9917. @example
  9918. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9919. @end example
  9920. @section super2xsai
  9921. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9922. Interpolate) pixel art scaling algorithm.
  9923. Useful for enlarging pixel art images without reducing sharpness.
  9924. @section swaprect
  9925. Swap two rectangular objects in video.
  9926. This filter accepts the following options:
  9927. @table @option
  9928. @item w
  9929. Set object width.
  9930. @item h
  9931. Set object height.
  9932. @item x1
  9933. Set 1st rect x coordinate.
  9934. @item y1
  9935. Set 1st rect y coordinate.
  9936. @item x2
  9937. Set 2nd rect x coordinate.
  9938. @item y2
  9939. Set 2nd rect y coordinate.
  9940. All expressions are evaluated once for each frame.
  9941. @end table
  9942. The all options are expressions containing the following constants:
  9943. @table @option
  9944. @item w
  9945. @item h
  9946. The input width and height.
  9947. @item a
  9948. same as @var{w} / @var{h}
  9949. @item sar
  9950. input sample aspect ratio
  9951. @item dar
  9952. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9953. @item n
  9954. The number of the input frame, starting from 0.
  9955. @item t
  9956. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9957. @item pos
  9958. the position in the file of the input frame, NAN if unknown
  9959. @end table
  9960. @section swapuv
  9961. Swap U & V plane.
  9962. @section telecine
  9963. Apply telecine process to the video.
  9964. This filter accepts the following options:
  9965. @table @option
  9966. @item first_field
  9967. @table @samp
  9968. @item top, t
  9969. top field first
  9970. @item bottom, b
  9971. bottom field first
  9972. The default value is @code{top}.
  9973. @end table
  9974. @item pattern
  9975. A string of numbers representing the pulldown pattern you wish to apply.
  9976. The default value is @code{23}.
  9977. @end table
  9978. @example
  9979. Some typical patterns:
  9980. NTSC output (30i):
  9981. 27.5p: 32222
  9982. 24p: 23 (classic)
  9983. 24p: 2332 (preferred)
  9984. 20p: 33
  9985. 18p: 334
  9986. 16p: 3444
  9987. PAL output (25i):
  9988. 27.5p: 12222
  9989. 24p: 222222222223 ("Euro pulldown")
  9990. 16.67p: 33
  9991. 16p: 33333334
  9992. @end example
  9993. @section thumbnail
  9994. Select the most representative frame in a given sequence of consecutive frames.
  9995. The filter accepts the following options:
  9996. @table @option
  9997. @item n
  9998. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9999. will pick one of them, and then handle the next batch of @var{n} frames until
  10000. the end. Default is @code{100}.
  10001. @end table
  10002. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10003. value will result in a higher memory usage, so a high value is not recommended.
  10004. @subsection Examples
  10005. @itemize
  10006. @item
  10007. Extract one picture each 50 frames:
  10008. @example
  10009. thumbnail=50
  10010. @end example
  10011. @item
  10012. Complete example of a thumbnail creation with @command{ffmpeg}:
  10013. @example
  10014. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10015. @end example
  10016. @end itemize
  10017. @section tile
  10018. Tile several successive frames together.
  10019. The filter accepts the following options:
  10020. @table @option
  10021. @item layout
  10022. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10023. this option, check the
  10024. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10025. @item nb_frames
  10026. Set the maximum number of frames to render in the given area. It must be less
  10027. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10028. the area will be used.
  10029. @item margin
  10030. Set the outer border margin in pixels.
  10031. @item padding
  10032. Set the inner border thickness (i.e. the number of pixels between frames). For
  10033. more advanced padding options (such as having different values for the edges),
  10034. refer to the pad video filter.
  10035. @item color
  10036. Specify the color of the unused area. For the syntax of this option, check the
  10037. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10038. is "black".
  10039. @end table
  10040. @subsection Examples
  10041. @itemize
  10042. @item
  10043. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10044. @example
  10045. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10046. @end example
  10047. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10048. duplicating each output frame to accommodate the originally detected frame
  10049. rate.
  10050. @item
  10051. Display @code{5} pictures in an area of @code{3x2} frames,
  10052. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10053. mixed flat and named options:
  10054. @example
  10055. tile=3x2:nb_frames=5:padding=7:margin=2
  10056. @end example
  10057. @end itemize
  10058. @section tinterlace
  10059. Perform various types of temporal field interlacing.
  10060. Frames are counted starting from 1, so the first input frame is
  10061. considered odd.
  10062. The filter accepts the following options:
  10063. @table @option
  10064. @item mode
  10065. Specify the mode of the interlacing. This option can also be specified
  10066. as a value alone. See below for a list of values for this option.
  10067. Available values are:
  10068. @table @samp
  10069. @item merge, 0
  10070. Move odd frames into the upper field, even into the lower field,
  10071. generating a double height frame at half frame rate.
  10072. @example
  10073. ------> time
  10074. Input:
  10075. Frame 1 Frame 2 Frame 3 Frame 4
  10076. 11111 22222 33333 44444
  10077. 11111 22222 33333 44444
  10078. 11111 22222 33333 44444
  10079. 11111 22222 33333 44444
  10080. Output:
  10081. 11111 33333
  10082. 22222 44444
  10083. 11111 33333
  10084. 22222 44444
  10085. 11111 33333
  10086. 22222 44444
  10087. 11111 33333
  10088. 22222 44444
  10089. @end example
  10090. @item drop_even, 1
  10091. Only output odd frames, even frames are dropped, generating a frame with
  10092. unchanged height at half frame rate.
  10093. @example
  10094. ------> time
  10095. Input:
  10096. Frame 1 Frame 2 Frame 3 Frame 4
  10097. 11111 22222 33333 44444
  10098. 11111 22222 33333 44444
  10099. 11111 22222 33333 44444
  10100. 11111 22222 33333 44444
  10101. Output:
  10102. 11111 33333
  10103. 11111 33333
  10104. 11111 33333
  10105. 11111 33333
  10106. @end example
  10107. @item drop_odd, 2
  10108. Only output even frames, odd frames are dropped, generating a frame with
  10109. unchanged height at half frame rate.
  10110. @example
  10111. ------> time
  10112. Input:
  10113. Frame 1 Frame 2 Frame 3 Frame 4
  10114. 11111 22222 33333 44444
  10115. 11111 22222 33333 44444
  10116. 11111 22222 33333 44444
  10117. 11111 22222 33333 44444
  10118. Output:
  10119. 22222 44444
  10120. 22222 44444
  10121. 22222 44444
  10122. 22222 44444
  10123. @end example
  10124. @item pad, 3
  10125. Expand each frame to full height, but pad alternate lines with black,
  10126. generating a frame with double height at the same input frame rate.
  10127. @example
  10128. ------> time
  10129. Input:
  10130. Frame 1 Frame 2 Frame 3 Frame 4
  10131. 11111 22222 33333 44444
  10132. 11111 22222 33333 44444
  10133. 11111 22222 33333 44444
  10134. 11111 22222 33333 44444
  10135. Output:
  10136. 11111 ..... 33333 .....
  10137. ..... 22222 ..... 44444
  10138. 11111 ..... 33333 .....
  10139. ..... 22222 ..... 44444
  10140. 11111 ..... 33333 .....
  10141. ..... 22222 ..... 44444
  10142. 11111 ..... 33333 .....
  10143. ..... 22222 ..... 44444
  10144. @end example
  10145. @item interleave_top, 4
  10146. Interleave the upper field from odd frames with the lower field from
  10147. even frames, generating a frame with unchanged height at half frame rate.
  10148. @example
  10149. ------> time
  10150. Input:
  10151. Frame 1 Frame 2 Frame 3 Frame 4
  10152. 11111<- 22222 33333<- 44444
  10153. 11111 22222<- 33333 44444<-
  10154. 11111<- 22222 33333<- 44444
  10155. 11111 22222<- 33333 44444<-
  10156. Output:
  10157. 11111 33333
  10158. 22222 44444
  10159. 11111 33333
  10160. 22222 44444
  10161. @end example
  10162. @item interleave_bottom, 5
  10163. Interleave the lower field from odd frames with the upper field from
  10164. even frames, generating a frame with unchanged height at half frame rate.
  10165. @example
  10166. ------> time
  10167. Input:
  10168. Frame 1 Frame 2 Frame 3 Frame 4
  10169. 11111 22222<- 33333 44444<-
  10170. 11111<- 22222 33333<- 44444
  10171. 11111 22222<- 33333 44444<-
  10172. 11111<- 22222 33333<- 44444
  10173. Output:
  10174. 22222 44444
  10175. 11111 33333
  10176. 22222 44444
  10177. 11111 33333
  10178. @end example
  10179. @item interlacex2, 6
  10180. Double frame rate with unchanged height. Frames are inserted each
  10181. containing the second temporal field from the previous input frame and
  10182. the first temporal field from the next input frame. This mode relies on
  10183. the top_field_first flag. Useful for interlaced video displays with no
  10184. field synchronisation.
  10185. @example
  10186. ------> time
  10187. Input:
  10188. Frame 1 Frame 2 Frame 3 Frame 4
  10189. 11111 22222 33333 44444
  10190. 11111 22222 33333 44444
  10191. 11111 22222 33333 44444
  10192. 11111 22222 33333 44444
  10193. Output:
  10194. 11111 22222 22222 33333 33333 44444 44444
  10195. 11111 11111 22222 22222 33333 33333 44444
  10196. 11111 22222 22222 33333 33333 44444 44444
  10197. 11111 11111 22222 22222 33333 33333 44444
  10198. @end example
  10199. @item mergex2, 7
  10200. Move odd frames into the upper field, even into the lower field,
  10201. generating a double height frame at same frame rate.
  10202. @example
  10203. ------> time
  10204. Input:
  10205. Frame 1 Frame 2 Frame 3 Frame 4
  10206. 11111 22222 33333 44444
  10207. 11111 22222 33333 44444
  10208. 11111 22222 33333 44444
  10209. 11111 22222 33333 44444
  10210. Output:
  10211. 11111 33333 33333 55555
  10212. 22222 22222 44444 44444
  10213. 11111 33333 33333 55555
  10214. 22222 22222 44444 44444
  10215. 11111 33333 33333 55555
  10216. 22222 22222 44444 44444
  10217. 11111 33333 33333 55555
  10218. 22222 22222 44444 44444
  10219. @end example
  10220. @end table
  10221. Numeric values are deprecated but are accepted for backward
  10222. compatibility reasons.
  10223. Default mode is @code{merge}.
  10224. @item flags
  10225. Specify flags influencing the filter process.
  10226. Available value for @var{flags} is:
  10227. @table @option
  10228. @item low_pass_filter, vlfp
  10229. Enable vertical low-pass filtering in the filter.
  10230. Vertical low-pass filtering is required when creating an interlaced
  10231. destination from a progressive source which contains high-frequency
  10232. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10233. patterning.
  10234. Vertical low-pass filtering can only be enabled for @option{mode}
  10235. @var{interleave_top} and @var{interleave_bottom}.
  10236. @end table
  10237. @end table
  10238. @section transpose
  10239. Transpose rows with columns in the input video and optionally flip it.
  10240. It accepts the following parameters:
  10241. @table @option
  10242. @item dir
  10243. Specify the transposition direction.
  10244. Can assume the following values:
  10245. @table @samp
  10246. @item 0, 4, cclock_flip
  10247. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10248. @example
  10249. L.R L.l
  10250. . . -> . .
  10251. l.r R.r
  10252. @end example
  10253. @item 1, 5, clock
  10254. Rotate by 90 degrees clockwise, that is:
  10255. @example
  10256. L.R l.L
  10257. . . -> . .
  10258. l.r r.R
  10259. @end example
  10260. @item 2, 6, cclock
  10261. Rotate by 90 degrees counterclockwise, that is:
  10262. @example
  10263. L.R R.r
  10264. . . -> . .
  10265. l.r L.l
  10266. @end example
  10267. @item 3, 7, clock_flip
  10268. Rotate by 90 degrees clockwise and vertically flip, that is:
  10269. @example
  10270. L.R r.R
  10271. . . -> . .
  10272. l.r l.L
  10273. @end example
  10274. @end table
  10275. For values between 4-7, the transposition is only done if the input
  10276. video geometry is portrait and not landscape. These values are
  10277. deprecated, the @code{passthrough} option should be used instead.
  10278. Numerical values are deprecated, and should be dropped in favor of
  10279. symbolic constants.
  10280. @item passthrough
  10281. Do not apply the transposition if the input geometry matches the one
  10282. specified by the specified value. It accepts the following values:
  10283. @table @samp
  10284. @item none
  10285. Always apply transposition.
  10286. @item portrait
  10287. Preserve portrait geometry (when @var{height} >= @var{width}).
  10288. @item landscape
  10289. Preserve landscape geometry (when @var{width} >= @var{height}).
  10290. @end table
  10291. Default value is @code{none}.
  10292. @end table
  10293. For example to rotate by 90 degrees clockwise and preserve portrait
  10294. layout:
  10295. @example
  10296. transpose=dir=1:passthrough=portrait
  10297. @end example
  10298. The command above can also be specified as:
  10299. @example
  10300. transpose=1:portrait
  10301. @end example
  10302. @section trim
  10303. Trim the input so that the output contains one continuous subpart of the input.
  10304. It accepts the following parameters:
  10305. @table @option
  10306. @item start
  10307. Specify the time of the start of the kept section, i.e. the frame with the
  10308. timestamp @var{start} will be the first frame in the output.
  10309. @item end
  10310. Specify the time of the first frame that will be dropped, i.e. the frame
  10311. immediately preceding the one with the timestamp @var{end} will be the last
  10312. frame in the output.
  10313. @item start_pts
  10314. This is the same as @var{start}, except this option sets the start timestamp
  10315. in timebase units instead of seconds.
  10316. @item end_pts
  10317. This is the same as @var{end}, except this option sets the end timestamp
  10318. in timebase units instead of seconds.
  10319. @item duration
  10320. The maximum duration of the output in seconds.
  10321. @item start_frame
  10322. The number of the first frame that should be passed to the output.
  10323. @item end_frame
  10324. The number of the first frame that should be dropped.
  10325. @end table
  10326. @option{start}, @option{end}, and @option{duration} are expressed as time
  10327. duration specifications; see
  10328. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10329. for the accepted syntax.
  10330. Note that the first two sets of the start/end options and the @option{duration}
  10331. option look at the frame timestamp, while the _frame variants simply count the
  10332. frames that pass through the filter. Also note that this filter does not modify
  10333. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10334. setpts filter after the trim filter.
  10335. If multiple start or end options are set, this filter tries to be greedy and
  10336. keep all the frames that match at least one of the specified constraints. To keep
  10337. only the part that matches all the constraints at once, chain multiple trim
  10338. filters.
  10339. The defaults are such that all the input is kept. So it is possible to set e.g.
  10340. just the end values to keep everything before the specified time.
  10341. Examples:
  10342. @itemize
  10343. @item
  10344. Drop everything except the second minute of input:
  10345. @example
  10346. ffmpeg -i INPUT -vf trim=60:120
  10347. @end example
  10348. @item
  10349. Keep only the first second:
  10350. @example
  10351. ffmpeg -i INPUT -vf trim=duration=1
  10352. @end example
  10353. @end itemize
  10354. @anchor{unsharp}
  10355. @section unsharp
  10356. Sharpen or blur the input video.
  10357. It accepts the following parameters:
  10358. @table @option
  10359. @item luma_msize_x, lx
  10360. Set the luma matrix horizontal size. It must be an odd integer between
  10361. 3 and 23. The default value is 5.
  10362. @item luma_msize_y, ly
  10363. Set the luma matrix vertical size. It must be an odd integer between 3
  10364. and 23. The default value is 5.
  10365. @item luma_amount, la
  10366. Set the luma effect strength. It must be a floating point number, reasonable
  10367. values lay between -1.5 and 1.5.
  10368. Negative values will blur the input video, while positive values will
  10369. sharpen it, a value of zero will disable the effect.
  10370. Default value is 1.0.
  10371. @item chroma_msize_x, cx
  10372. Set the chroma matrix horizontal size. It must be an odd integer
  10373. between 3 and 23. The default value is 5.
  10374. @item chroma_msize_y, cy
  10375. Set the chroma matrix vertical size. It must be an odd integer
  10376. between 3 and 23. The default value is 5.
  10377. @item chroma_amount, ca
  10378. Set the chroma effect strength. It must be a floating point number, reasonable
  10379. values lay between -1.5 and 1.5.
  10380. Negative values will blur the input video, while positive values will
  10381. sharpen it, a value of zero will disable the effect.
  10382. Default value is 0.0.
  10383. @item opencl
  10384. If set to 1, specify using OpenCL capabilities, only available if
  10385. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10386. @end table
  10387. All parameters are optional and default to the equivalent of the
  10388. string '5:5:1.0:5:5:0.0'.
  10389. @subsection Examples
  10390. @itemize
  10391. @item
  10392. Apply strong luma sharpen effect:
  10393. @example
  10394. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10395. @end example
  10396. @item
  10397. Apply a strong blur of both luma and chroma parameters:
  10398. @example
  10399. unsharp=7:7:-2:7:7:-2
  10400. @end example
  10401. @end itemize
  10402. @section uspp
  10403. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10404. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10405. shifts and average the results.
  10406. The way this differs from the behavior of spp is that uspp actually encodes &
  10407. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10408. DCT similar to MJPEG.
  10409. The filter accepts the following options:
  10410. @table @option
  10411. @item quality
  10412. Set quality. This option defines the number of levels for averaging. It accepts
  10413. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10414. effect. A value of @code{8} means the higher quality. For each increment of
  10415. that value the speed drops by a factor of approximately 2. Default value is
  10416. @code{3}.
  10417. @item qp
  10418. Force a constant quantization parameter. If not set, the filter will use the QP
  10419. from the video stream (if available).
  10420. @end table
  10421. @section vaguedenoiser
  10422. Apply a wavelet based denoiser.
  10423. It transforms each frame from the video input into the wavelet domain,
  10424. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10425. the obtained coefficients. It does an inverse wavelet transform after.
  10426. Due to wavelet properties, it should give a nice smoothed result, and
  10427. reduced noise, without blurring picture features.
  10428. This filter accepts the following options:
  10429. @table @option
  10430. @item threshold
  10431. The filtering strength. The higher, the more filtered the video will be.
  10432. Hard thresholding can use a higher threshold than soft thresholding
  10433. before the video looks overfiltered.
  10434. @item method
  10435. The filtering method the filter will use.
  10436. It accepts the following values:
  10437. @table @samp
  10438. @item hard
  10439. All values under the threshold will be zeroed.
  10440. @item soft
  10441. All values under the threshold will be zeroed. All values above will be
  10442. reduced by the threshold.
  10443. @item garrote
  10444. Scales or nullifies coefficients - intermediary between (more) soft and
  10445. (less) hard thresholding.
  10446. @end table
  10447. @item nsteps
  10448. Number of times, the wavelet will decompose the picture. Picture can't
  10449. be decomposed beyond a particular point (typically, 8 for a 640x480
  10450. frame - as 2^9 = 512 > 480)
  10451. @item percent
  10452. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10453. @item planes
  10454. A list of the planes to process. By default all planes are processed.
  10455. @end table
  10456. @section vectorscope
  10457. Display 2 color component values in the two dimensional graph (which is called
  10458. a vectorscope).
  10459. This filter accepts the following options:
  10460. @table @option
  10461. @item mode, m
  10462. Set vectorscope mode.
  10463. It accepts the following values:
  10464. @table @samp
  10465. @item gray
  10466. Gray values are displayed on graph, higher brightness means more pixels have
  10467. same component color value on location in graph. This is the default mode.
  10468. @item color
  10469. Gray values are displayed on graph. Surrounding pixels values which are not
  10470. present in video frame are drawn in gradient of 2 color components which are
  10471. set by option @code{x} and @code{y}. The 3rd color component is static.
  10472. @item color2
  10473. Actual color components values present in video frame are displayed on graph.
  10474. @item color3
  10475. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10476. on graph increases value of another color component, which is luminance by
  10477. default values of @code{x} and @code{y}.
  10478. @item color4
  10479. Actual colors present in video frame are displayed on graph. If two different
  10480. colors map to same position on graph then color with higher value of component
  10481. not present in graph is picked.
  10482. @item color5
  10483. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10484. component picked from radial gradient.
  10485. @end table
  10486. @item x
  10487. Set which color component will be represented on X-axis. Default is @code{1}.
  10488. @item y
  10489. Set which color component will be represented on Y-axis. Default is @code{2}.
  10490. @item intensity, i
  10491. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10492. of color component which represents frequency of (X, Y) location in graph.
  10493. @item envelope, e
  10494. @table @samp
  10495. @item none
  10496. No envelope, this is default.
  10497. @item instant
  10498. Instant envelope, even darkest single pixel will be clearly highlighted.
  10499. @item peak
  10500. Hold maximum and minimum values presented in graph over time. This way you
  10501. can still spot out of range values without constantly looking at vectorscope.
  10502. @item peak+instant
  10503. Peak and instant envelope combined together.
  10504. @end table
  10505. @item graticule, g
  10506. Set what kind of graticule to draw.
  10507. @table @samp
  10508. @item none
  10509. @item green
  10510. @item color
  10511. @end table
  10512. @item opacity, o
  10513. Set graticule opacity.
  10514. @item flags, f
  10515. Set graticule flags.
  10516. @table @samp
  10517. @item white
  10518. Draw graticule for white point.
  10519. @item black
  10520. Draw graticule for black point.
  10521. @item name
  10522. Draw color points short names.
  10523. @end table
  10524. @item bgopacity, b
  10525. Set background opacity.
  10526. @item lthreshold, l
  10527. Set low threshold for color component not represented on X or Y axis.
  10528. Values lower than this value will be ignored. Default is 0.
  10529. Note this value is multiplied with actual max possible value one pixel component
  10530. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10531. is 0.1 * 255 = 25.
  10532. @item hthreshold, h
  10533. Set high threshold for color component not represented on X or Y axis.
  10534. Values higher than this value will be ignored. Default is 1.
  10535. Note this value is multiplied with actual max possible value one pixel component
  10536. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10537. is 0.9 * 255 = 230.
  10538. @item colorspace, c
  10539. Set what kind of colorspace to use when drawing graticule.
  10540. @table @samp
  10541. @item auto
  10542. @item 601
  10543. @item 709
  10544. @end table
  10545. Default is auto.
  10546. @end table
  10547. @anchor{vidstabdetect}
  10548. @section vidstabdetect
  10549. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10550. @ref{vidstabtransform} for pass 2.
  10551. This filter generates a file with relative translation and rotation
  10552. transform information about subsequent frames, which is then used by
  10553. the @ref{vidstabtransform} filter.
  10554. To enable compilation of this filter you need to configure FFmpeg with
  10555. @code{--enable-libvidstab}.
  10556. This filter accepts the following options:
  10557. @table @option
  10558. @item result
  10559. Set the path to the file used to write the transforms information.
  10560. Default value is @file{transforms.trf}.
  10561. @item shakiness
  10562. Set how shaky the video is and how quick the camera is. It accepts an
  10563. integer in the range 1-10, a value of 1 means little shakiness, a
  10564. value of 10 means strong shakiness. Default value is 5.
  10565. @item accuracy
  10566. Set the accuracy of the detection process. It must be a value in the
  10567. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10568. accuracy. Default value is 15.
  10569. @item stepsize
  10570. Set stepsize of the search process. The region around minimum is
  10571. scanned with 1 pixel resolution. Default value is 6.
  10572. @item mincontrast
  10573. Set minimum contrast. Below this value a local measurement field is
  10574. discarded. Must be a floating point value in the range 0-1. Default
  10575. value is 0.3.
  10576. @item tripod
  10577. Set reference frame number for tripod mode.
  10578. If enabled, the motion of the frames is compared to a reference frame
  10579. in the filtered stream, identified by the specified number. The idea
  10580. is to compensate all movements in a more-or-less static scene and keep
  10581. the camera view absolutely still.
  10582. If set to 0, it is disabled. The frames are counted starting from 1.
  10583. @item show
  10584. Show fields and transforms in the resulting frames. It accepts an
  10585. integer in the range 0-2. Default value is 0, which disables any
  10586. visualization.
  10587. @end table
  10588. @subsection Examples
  10589. @itemize
  10590. @item
  10591. Use default values:
  10592. @example
  10593. vidstabdetect
  10594. @end example
  10595. @item
  10596. Analyze strongly shaky movie and put the results in file
  10597. @file{mytransforms.trf}:
  10598. @example
  10599. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10600. @end example
  10601. @item
  10602. Visualize the result of internal transformations in the resulting
  10603. video:
  10604. @example
  10605. vidstabdetect=show=1
  10606. @end example
  10607. @item
  10608. Analyze a video with medium shakiness using @command{ffmpeg}:
  10609. @example
  10610. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10611. @end example
  10612. @end itemize
  10613. @anchor{vidstabtransform}
  10614. @section vidstabtransform
  10615. Video stabilization/deshaking: pass 2 of 2,
  10616. see @ref{vidstabdetect} for pass 1.
  10617. Read a file with transform information for each frame and
  10618. apply/compensate them. Together with the @ref{vidstabdetect}
  10619. filter this can be used to deshake videos. See also
  10620. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10621. the @ref{unsharp} filter, see below.
  10622. To enable compilation of this filter you need to configure FFmpeg with
  10623. @code{--enable-libvidstab}.
  10624. @subsection Options
  10625. @table @option
  10626. @item input
  10627. Set path to the file used to read the transforms. Default value is
  10628. @file{transforms.trf}.
  10629. @item smoothing
  10630. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10631. camera movements. Default value is 10.
  10632. For example a number of 10 means that 21 frames are used (10 in the
  10633. past and 10 in the future) to smoothen the motion in the video. A
  10634. larger value leads to a smoother video, but limits the acceleration of
  10635. the camera (pan/tilt movements). 0 is a special case where a static
  10636. camera is simulated.
  10637. @item optalgo
  10638. Set the camera path optimization algorithm.
  10639. Accepted values are:
  10640. @table @samp
  10641. @item gauss
  10642. gaussian kernel low-pass filter on camera motion (default)
  10643. @item avg
  10644. averaging on transformations
  10645. @end table
  10646. @item maxshift
  10647. Set maximal number of pixels to translate frames. Default value is -1,
  10648. meaning no limit.
  10649. @item maxangle
  10650. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10651. value is -1, meaning no limit.
  10652. @item crop
  10653. Specify how to deal with borders that may be visible due to movement
  10654. compensation.
  10655. Available values are:
  10656. @table @samp
  10657. @item keep
  10658. keep image information from previous frame (default)
  10659. @item black
  10660. fill the border black
  10661. @end table
  10662. @item invert
  10663. Invert transforms if set to 1. Default value is 0.
  10664. @item relative
  10665. Consider transforms as relative to previous frame if set to 1,
  10666. absolute if set to 0. Default value is 0.
  10667. @item zoom
  10668. Set percentage to zoom. A positive value will result in a zoom-in
  10669. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10670. zoom).
  10671. @item optzoom
  10672. Set optimal zooming to avoid borders.
  10673. Accepted values are:
  10674. @table @samp
  10675. @item 0
  10676. disabled
  10677. @item 1
  10678. optimal static zoom value is determined (only very strong movements
  10679. will lead to visible borders) (default)
  10680. @item 2
  10681. optimal adaptive zoom value is determined (no borders will be
  10682. visible), see @option{zoomspeed}
  10683. @end table
  10684. Note that the value given at zoom is added to the one calculated here.
  10685. @item zoomspeed
  10686. Set percent to zoom maximally each frame (enabled when
  10687. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10688. 0.25.
  10689. @item interpol
  10690. Specify type of interpolation.
  10691. Available values are:
  10692. @table @samp
  10693. @item no
  10694. no interpolation
  10695. @item linear
  10696. linear only horizontal
  10697. @item bilinear
  10698. linear in both directions (default)
  10699. @item bicubic
  10700. cubic in both directions (slow)
  10701. @end table
  10702. @item tripod
  10703. Enable virtual tripod mode if set to 1, which is equivalent to
  10704. @code{relative=0:smoothing=0}. Default value is 0.
  10705. Use also @code{tripod} option of @ref{vidstabdetect}.
  10706. @item debug
  10707. Increase log verbosity if set to 1. Also the detected global motions
  10708. are written to the temporary file @file{global_motions.trf}. Default
  10709. value is 0.
  10710. @end table
  10711. @subsection Examples
  10712. @itemize
  10713. @item
  10714. Use @command{ffmpeg} for a typical stabilization with default values:
  10715. @example
  10716. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10717. @end example
  10718. Note the use of the @ref{unsharp} filter which is always recommended.
  10719. @item
  10720. Zoom in a bit more and load transform data from a given file:
  10721. @example
  10722. vidstabtransform=zoom=5:input="mytransforms.trf"
  10723. @end example
  10724. @item
  10725. Smoothen the video even more:
  10726. @example
  10727. vidstabtransform=smoothing=30
  10728. @end example
  10729. @end itemize
  10730. @section vflip
  10731. Flip the input video vertically.
  10732. For example, to vertically flip a video with @command{ffmpeg}:
  10733. @example
  10734. ffmpeg -i in.avi -vf "vflip" out.avi
  10735. @end example
  10736. @anchor{vignette}
  10737. @section vignette
  10738. Make or reverse a natural vignetting effect.
  10739. The filter accepts the following options:
  10740. @table @option
  10741. @item angle, a
  10742. Set lens angle expression as a number of radians.
  10743. The value is clipped in the @code{[0,PI/2]} range.
  10744. Default value: @code{"PI/5"}
  10745. @item x0
  10746. @item y0
  10747. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10748. by default.
  10749. @item mode
  10750. Set forward/backward mode.
  10751. Available modes are:
  10752. @table @samp
  10753. @item forward
  10754. The larger the distance from the central point, the darker the image becomes.
  10755. @item backward
  10756. The larger the distance from the central point, the brighter the image becomes.
  10757. This can be used to reverse a vignette effect, though there is no automatic
  10758. detection to extract the lens @option{angle} and other settings (yet). It can
  10759. also be used to create a burning effect.
  10760. @end table
  10761. Default value is @samp{forward}.
  10762. @item eval
  10763. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10764. It accepts the following values:
  10765. @table @samp
  10766. @item init
  10767. Evaluate expressions only once during the filter initialization.
  10768. @item frame
  10769. Evaluate expressions for each incoming frame. This is way slower than the
  10770. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10771. allows advanced dynamic expressions.
  10772. @end table
  10773. Default value is @samp{init}.
  10774. @item dither
  10775. Set dithering to reduce the circular banding effects. Default is @code{1}
  10776. (enabled).
  10777. @item aspect
  10778. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10779. Setting this value to the SAR of the input will make a rectangular vignetting
  10780. following the dimensions of the video.
  10781. Default is @code{1/1}.
  10782. @end table
  10783. @subsection Expressions
  10784. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10785. following parameters.
  10786. @table @option
  10787. @item w
  10788. @item h
  10789. input width and height
  10790. @item n
  10791. the number of input frame, starting from 0
  10792. @item pts
  10793. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10794. @var{TB} units, NAN if undefined
  10795. @item r
  10796. frame rate of the input video, NAN if the input frame rate is unknown
  10797. @item t
  10798. the PTS (Presentation TimeStamp) of the filtered video frame,
  10799. expressed in seconds, NAN if undefined
  10800. @item tb
  10801. time base of the input video
  10802. @end table
  10803. @subsection Examples
  10804. @itemize
  10805. @item
  10806. Apply simple strong vignetting effect:
  10807. @example
  10808. vignette=PI/4
  10809. @end example
  10810. @item
  10811. Make a flickering vignetting:
  10812. @example
  10813. vignette='PI/4+random(1)*PI/50':eval=frame
  10814. @end example
  10815. @end itemize
  10816. @section vstack
  10817. Stack input videos vertically.
  10818. All streams must be of same pixel format and of same width.
  10819. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10820. to create same output.
  10821. The filter accept the following option:
  10822. @table @option
  10823. @item inputs
  10824. Set number of input streams. Default is 2.
  10825. @item shortest
  10826. If set to 1, force the output to terminate when the shortest input
  10827. terminates. Default value is 0.
  10828. @end table
  10829. @section w3fdif
  10830. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10831. Deinterlacing Filter").
  10832. Based on the process described by Martin Weston for BBC R&D, and
  10833. implemented based on the de-interlace algorithm written by Jim
  10834. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10835. uses filter coefficients calculated by BBC R&D.
  10836. There are two sets of filter coefficients, so called "simple":
  10837. and "complex". Which set of filter coefficients is used can
  10838. be set by passing an optional parameter:
  10839. @table @option
  10840. @item filter
  10841. Set the interlacing filter coefficients. Accepts one of the following values:
  10842. @table @samp
  10843. @item simple
  10844. Simple filter coefficient set.
  10845. @item complex
  10846. More-complex filter coefficient set.
  10847. @end table
  10848. Default value is @samp{complex}.
  10849. @item deint
  10850. Specify which frames to deinterlace. Accept one of the following values:
  10851. @table @samp
  10852. @item all
  10853. Deinterlace all frames,
  10854. @item interlaced
  10855. Only deinterlace frames marked as interlaced.
  10856. @end table
  10857. Default value is @samp{all}.
  10858. @end table
  10859. @section waveform
  10860. Video waveform monitor.
  10861. The waveform monitor plots color component intensity. By default luminance
  10862. only. Each column of the waveform corresponds to a column of pixels in the
  10863. source video.
  10864. It accepts the following options:
  10865. @table @option
  10866. @item mode, m
  10867. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10868. In row mode, the graph on the left side represents color component value 0 and
  10869. the right side represents value = 255. In column mode, the top side represents
  10870. color component value = 0 and bottom side represents value = 255.
  10871. @item intensity, i
  10872. Set intensity. Smaller values are useful to find out how many values of the same
  10873. luminance are distributed across input rows/columns.
  10874. Default value is @code{0.04}. Allowed range is [0, 1].
  10875. @item mirror, r
  10876. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10877. In mirrored mode, higher values will be represented on the left
  10878. side for @code{row} mode and at the top for @code{column} mode. Default is
  10879. @code{1} (mirrored).
  10880. @item display, d
  10881. Set display mode.
  10882. It accepts the following values:
  10883. @table @samp
  10884. @item overlay
  10885. Presents information identical to that in the @code{parade}, except
  10886. that the graphs representing color components are superimposed directly
  10887. over one another.
  10888. This display mode makes it easier to spot relative differences or similarities
  10889. in overlapping areas of the color components that are supposed to be identical,
  10890. such as neutral whites, grays, or blacks.
  10891. @item stack
  10892. Display separate graph for the color components side by side in
  10893. @code{row} mode or one below the other in @code{column} mode.
  10894. @item parade
  10895. Display separate graph for the color components side by side in
  10896. @code{column} mode or one below the other in @code{row} mode.
  10897. Using this display mode makes it easy to spot color casts in the highlights
  10898. and shadows of an image, by comparing the contours of the top and the bottom
  10899. graphs of each waveform. Since whites, grays, and blacks are characterized
  10900. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10901. should display three waveforms of roughly equal width/height. If not, the
  10902. correction is easy to perform by making level adjustments the three waveforms.
  10903. @end table
  10904. Default is @code{stack}.
  10905. @item components, c
  10906. Set which color components to display. Default is 1, which means only luminance
  10907. or red color component if input is in RGB colorspace. If is set for example to
  10908. 7 it will display all 3 (if) available color components.
  10909. @item envelope, e
  10910. @table @samp
  10911. @item none
  10912. No envelope, this is default.
  10913. @item instant
  10914. Instant envelope, minimum and maximum values presented in graph will be easily
  10915. visible even with small @code{step} value.
  10916. @item peak
  10917. Hold minimum and maximum values presented in graph across time. This way you
  10918. can still spot out of range values without constantly looking at waveforms.
  10919. @item peak+instant
  10920. Peak and instant envelope combined together.
  10921. @end table
  10922. @item filter, f
  10923. @table @samp
  10924. @item lowpass
  10925. No filtering, this is default.
  10926. @item flat
  10927. Luma and chroma combined together.
  10928. @item aflat
  10929. Similar as above, but shows difference between blue and red chroma.
  10930. @item chroma
  10931. Displays only chroma.
  10932. @item color
  10933. Displays actual color value on waveform.
  10934. @item acolor
  10935. Similar as above, but with luma showing frequency of chroma values.
  10936. @end table
  10937. @item graticule, g
  10938. Set which graticule to display.
  10939. @table @samp
  10940. @item none
  10941. Do not display graticule.
  10942. @item green
  10943. Display green graticule showing legal broadcast ranges.
  10944. @end table
  10945. @item opacity, o
  10946. Set graticule opacity.
  10947. @item flags, fl
  10948. Set graticule flags.
  10949. @table @samp
  10950. @item numbers
  10951. Draw numbers above lines. By default enabled.
  10952. @item dots
  10953. Draw dots instead of lines.
  10954. @end table
  10955. @item scale, s
  10956. Set scale used for displaying graticule.
  10957. @table @samp
  10958. @item digital
  10959. @item millivolts
  10960. @item ire
  10961. @end table
  10962. Default is digital.
  10963. @item bgopacity, b
  10964. Set background opacity.
  10965. @end table
  10966. @section weave
  10967. The @code{weave} takes a field-based video input and join
  10968. each two sequential fields into single frame, producing a new double
  10969. height clip with half the frame rate and half the frame count.
  10970. It accepts the following option:
  10971. @table @option
  10972. @item first_field
  10973. Set first field. Available values are:
  10974. @table @samp
  10975. @item top, t
  10976. Set the frame as top-field-first.
  10977. @item bottom, b
  10978. Set the frame as bottom-field-first.
  10979. @end table
  10980. @end table
  10981. @subsection Examples
  10982. @itemize
  10983. @item
  10984. Interlace video using @ref{select} and @ref{separatefields} filter:
  10985. @example
  10986. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  10987. @end example
  10988. @end itemize
  10989. @section xbr
  10990. Apply the xBR high-quality magnification filter which is designed for pixel
  10991. art. It follows a set of edge-detection rules, see
  10992. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10993. It accepts the following option:
  10994. @table @option
  10995. @item n
  10996. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10997. @code{3xBR} and @code{4} for @code{4xBR}.
  10998. Default is @code{3}.
  10999. @end table
  11000. @anchor{yadif}
  11001. @section yadif
  11002. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11003. filter").
  11004. It accepts the following parameters:
  11005. @table @option
  11006. @item mode
  11007. The interlacing mode to adopt. It accepts one of the following values:
  11008. @table @option
  11009. @item 0, send_frame
  11010. Output one frame for each frame.
  11011. @item 1, send_field
  11012. Output one frame for each field.
  11013. @item 2, send_frame_nospatial
  11014. Like @code{send_frame}, but it skips the spatial interlacing check.
  11015. @item 3, send_field_nospatial
  11016. Like @code{send_field}, but it skips the spatial interlacing check.
  11017. @end table
  11018. The default value is @code{send_frame}.
  11019. @item parity
  11020. The picture field parity assumed for the input interlaced video. It accepts one
  11021. of the following values:
  11022. @table @option
  11023. @item 0, tff
  11024. Assume the top field is first.
  11025. @item 1, bff
  11026. Assume the bottom field is first.
  11027. @item -1, auto
  11028. Enable automatic detection of field parity.
  11029. @end table
  11030. The default value is @code{auto}.
  11031. If the interlacing is unknown or the decoder does not export this information,
  11032. top field first will be assumed.
  11033. @item deint
  11034. Specify which frames to deinterlace. Accept one of the following
  11035. values:
  11036. @table @option
  11037. @item 0, all
  11038. Deinterlace all frames.
  11039. @item 1, interlaced
  11040. Only deinterlace frames marked as interlaced.
  11041. @end table
  11042. The default value is @code{all}.
  11043. @end table
  11044. @section zoompan
  11045. Apply Zoom & Pan effect.
  11046. This filter accepts the following options:
  11047. @table @option
  11048. @item zoom, z
  11049. Set the zoom expression. Default is 1.
  11050. @item x
  11051. @item y
  11052. Set the x and y expression. Default is 0.
  11053. @item d
  11054. Set the duration expression in number of frames.
  11055. This sets for how many number of frames effect will last for
  11056. single input image.
  11057. @item s
  11058. Set the output image size, default is 'hd720'.
  11059. @item fps
  11060. Set the output frame rate, default is '25'.
  11061. @end table
  11062. Each expression can contain the following constants:
  11063. @table @option
  11064. @item in_w, iw
  11065. Input width.
  11066. @item in_h, ih
  11067. Input height.
  11068. @item out_w, ow
  11069. Output width.
  11070. @item out_h, oh
  11071. Output height.
  11072. @item in
  11073. Input frame count.
  11074. @item on
  11075. Output frame count.
  11076. @item x
  11077. @item y
  11078. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11079. for current input frame.
  11080. @item px
  11081. @item py
  11082. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11083. not yet such frame (first input frame).
  11084. @item zoom
  11085. Last calculated zoom from 'z' expression for current input frame.
  11086. @item pzoom
  11087. Last calculated zoom of last output frame of previous input frame.
  11088. @item duration
  11089. Number of output frames for current input frame. Calculated from 'd' expression
  11090. for each input frame.
  11091. @item pduration
  11092. number of output frames created for previous input frame
  11093. @item a
  11094. Rational number: input width / input height
  11095. @item sar
  11096. sample aspect ratio
  11097. @item dar
  11098. display aspect ratio
  11099. @end table
  11100. @subsection Examples
  11101. @itemize
  11102. @item
  11103. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11104. @example
  11105. 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
  11106. @end example
  11107. @item
  11108. Zoom-in up to 1.5 and pan always at center of picture:
  11109. @example
  11110. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11111. @end example
  11112. @item
  11113. Same as above but without pausing:
  11114. @example
  11115. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11116. @end example
  11117. @end itemize
  11118. @section zscale
  11119. Scale (resize) the input video, using the z.lib library:
  11120. https://github.com/sekrit-twc/zimg.
  11121. The zscale filter forces the output display aspect ratio to be the same
  11122. as the input, by changing the output sample aspect ratio.
  11123. If the input image format is different from the format requested by
  11124. the next filter, the zscale filter will convert the input to the
  11125. requested format.
  11126. @subsection Options
  11127. The filter accepts the following options.
  11128. @table @option
  11129. @item width, w
  11130. @item height, h
  11131. Set the output video dimension expression. Default value is the input
  11132. dimension.
  11133. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11134. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11135. If one of the values is -1, the zscale filter will use a value that
  11136. maintains the aspect ratio of the input image, calculated from the
  11137. other specified dimension. If both of them are -1, the input size is
  11138. used
  11139. If one of the values is -n with n > 1, the zscale filter will also use a value
  11140. that maintains the aspect ratio of the input image, calculated from the other
  11141. specified dimension. After that it will, however, make sure that the calculated
  11142. dimension is divisible by n and adjust the value if necessary.
  11143. See below for the list of accepted constants for use in the dimension
  11144. expression.
  11145. @item size, s
  11146. Set the video size. For the syntax of this option, check the
  11147. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11148. @item dither, d
  11149. Set the dither type.
  11150. Possible values are:
  11151. @table @var
  11152. @item none
  11153. @item ordered
  11154. @item random
  11155. @item error_diffusion
  11156. @end table
  11157. Default is none.
  11158. @item filter, f
  11159. Set the resize filter type.
  11160. Possible values are:
  11161. @table @var
  11162. @item point
  11163. @item bilinear
  11164. @item bicubic
  11165. @item spline16
  11166. @item spline36
  11167. @item lanczos
  11168. @end table
  11169. Default is bilinear.
  11170. @item range, r
  11171. Set the color range.
  11172. Possible values are:
  11173. @table @var
  11174. @item input
  11175. @item limited
  11176. @item full
  11177. @end table
  11178. Default is same as input.
  11179. @item primaries, p
  11180. Set the color primaries.
  11181. Possible values are:
  11182. @table @var
  11183. @item input
  11184. @item 709
  11185. @item unspecified
  11186. @item 170m
  11187. @item 240m
  11188. @item 2020
  11189. @end table
  11190. Default is same as input.
  11191. @item transfer, t
  11192. Set the transfer characteristics.
  11193. Possible values are:
  11194. @table @var
  11195. @item input
  11196. @item 709
  11197. @item unspecified
  11198. @item 601
  11199. @item linear
  11200. @item 2020_10
  11201. @item 2020_12
  11202. @end table
  11203. Default is same as input.
  11204. @item matrix, m
  11205. Set the colorspace matrix.
  11206. Possible value are:
  11207. @table @var
  11208. @item input
  11209. @item 709
  11210. @item unspecified
  11211. @item 470bg
  11212. @item 170m
  11213. @item 2020_ncl
  11214. @item 2020_cl
  11215. @end table
  11216. Default is same as input.
  11217. @item rangein, rin
  11218. Set the input color range.
  11219. Possible values are:
  11220. @table @var
  11221. @item input
  11222. @item limited
  11223. @item full
  11224. @end table
  11225. Default is same as input.
  11226. @item primariesin, pin
  11227. Set the input color primaries.
  11228. Possible values are:
  11229. @table @var
  11230. @item input
  11231. @item 709
  11232. @item unspecified
  11233. @item 170m
  11234. @item 240m
  11235. @item 2020
  11236. @end table
  11237. Default is same as input.
  11238. @item transferin, tin
  11239. Set the input transfer characteristics.
  11240. Possible values are:
  11241. @table @var
  11242. @item input
  11243. @item 709
  11244. @item unspecified
  11245. @item 601
  11246. @item linear
  11247. @item 2020_10
  11248. @item 2020_12
  11249. @end table
  11250. Default is same as input.
  11251. @item matrixin, min
  11252. Set the input colorspace matrix.
  11253. Possible value are:
  11254. @table @var
  11255. @item input
  11256. @item 709
  11257. @item unspecified
  11258. @item 470bg
  11259. @item 170m
  11260. @item 2020_ncl
  11261. @item 2020_cl
  11262. @end table
  11263. @item chromal, c
  11264. Set the output chroma location.
  11265. Possible values are:
  11266. @table @var
  11267. @item input
  11268. @item left
  11269. @item center
  11270. @item topleft
  11271. @item top
  11272. @item bottomleft
  11273. @item bottom
  11274. @end table
  11275. @item chromalin, cin
  11276. Set the input chroma location.
  11277. Possible values are:
  11278. @table @var
  11279. @item input
  11280. @item left
  11281. @item center
  11282. @item topleft
  11283. @item top
  11284. @item bottomleft
  11285. @item bottom
  11286. @end table
  11287. @end table
  11288. The values of the @option{w} and @option{h} options are expressions
  11289. containing the following constants:
  11290. @table @var
  11291. @item in_w
  11292. @item in_h
  11293. The input width and height
  11294. @item iw
  11295. @item ih
  11296. These are the same as @var{in_w} and @var{in_h}.
  11297. @item out_w
  11298. @item out_h
  11299. The output (scaled) width and height
  11300. @item ow
  11301. @item oh
  11302. These are the same as @var{out_w} and @var{out_h}
  11303. @item a
  11304. The same as @var{iw} / @var{ih}
  11305. @item sar
  11306. input sample aspect ratio
  11307. @item dar
  11308. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11309. @item hsub
  11310. @item vsub
  11311. horizontal and vertical input chroma subsample values. For example for the
  11312. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11313. @item ohsub
  11314. @item ovsub
  11315. horizontal and vertical output chroma subsample values. For example for the
  11316. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11317. @end table
  11318. @table @option
  11319. @end table
  11320. @c man end VIDEO FILTERS
  11321. @chapter Video Sources
  11322. @c man begin VIDEO SOURCES
  11323. Below is a description of the currently available video sources.
  11324. @section buffer
  11325. Buffer video frames, and make them available to the filter chain.
  11326. This source is mainly intended for a programmatic use, in particular
  11327. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11328. It accepts the following parameters:
  11329. @table @option
  11330. @item video_size
  11331. Specify the size (width and height) of the buffered video frames. For the
  11332. syntax of this option, check the
  11333. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11334. @item width
  11335. The input video width.
  11336. @item height
  11337. The input video height.
  11338. @item pix_fmt
  11339. A string representing the pixel format of the buffered video frames.
  11340. It may be a number corresponding to a pixel format, or a pixel format
  11341. name.
  11342. @item time_base
  11343. Specify the timebase assumed by the timestamps of the buffered frames.
  11344. @item frame_rate
  11345. Specify the frame rate expected for the video stream.
  11346. @item pixel_aspect, sar
  11347. The sample (pixel) aspect ratio of the input video.
  11348. @item sws_param
  11349. Specify the optional parameters to be used for the scale filter which
  11350. is automatically inserted when an input change is detected in the
  11351. input size or format.
  11352. @item hw_frames_ctx
  11353. When using a hardware pixel format, this should be a reference to an
  11354. AVHWFramesContext describing input frames.
  11355. @end table
  11356. For example:
  11357. @example
  11358. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11359. @end example
  11360. will instruct the source to accept video frames with size 320x240 and
  11361. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11362. square pixels (1:1 sample aspect ratio).
  11363. Since the pixel format with name "yuv410p" corresponds to the number 6
  11364. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11365. this example corresponds to:
  11366. @example
  11367. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11368. @end example
  11369. Alternatively, the options can be specified as a flat string, but this
  11370. syntax is deprecated:
  11371. @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}]
  11372. @section cellauto
  11373. Create a pattern generated by an elementary cellular automaton.
  11374. The initial state of the cellular automaton can be defined through the
  11375. @option{filename} and @option{pattern} options. If such options are
  11376. not specified an initial state is created randomly.
  11377. At each new frame a new row in the video is filled with the result of
  11378. the cellular automaton next generation. The behavior when the whole
  11379. frame is filled is defined by the @option{scroll} option.
  11380. This source accepts the following options:
  11381. @table @option
  11382. @item filename, f
  11383. Read the initial cellular automaton state, i.e. the starting row, from
  11384. the specified file.
  11385. In the file, each non-whitespace character is considered an alive
  11386. cell, a newline will terminate the row, and further characters in the
  11387. file will be ignored.
  11388. @item pattern, p
  11389. Read the initial cellular automaton state, i.e. the starting row, from
  11390. the specified string.
  11391. Each non-whitespace character in the string is considered an alive
  11392. cell, a newline will terminate the row, and further characters in the
  11393. string will be ignored.
  11394. @item rate, r
  11395. Set the video rate, that is the number of frames generated per second.
  11396. Default is 25.
  11397. @item random_fill_ratio, ratio
  11398. Set the random fill ratio for the initial cellular automaton row. It
  11399. is a floating point number value ranging from 0 to 1, defaults to
  11400. 1/PHI.
  11401. This option is ignored when a file or a pattern is specified.
  11402. @item random_seed, seed
  11403. Set the seed for filling randomly the initial row, must be an integer
  11404. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11405. set to -1, the filter will try to use a good random seed on a best
  11406. effort basis.
  11407. @item rule
  11408. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11409. Default value is 110.
  11410. @item size, s
  11411. Set the size of the output video. For the syntax of this option, check the
  11412. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11413. If @option{filename} or @option{pattern} is specified, the size is set
  11414. by default to the width of the specified initial state row, and the
  11415. height is set to @var{width} * PHI.
  11416. If @option{size} is set, it must contain the width of the specified
  11417. pattern string, and the specified pattern will be centered in the
  11418. larger row.
  11419. If a filename or a pattern string is not specified, the size value
  11420. defaults to "320x518" (used for a randomly generated initial state).
  11421. @item scroll
  11422. If set to 1, scroll the output upward when all the rows in the output
  11423. have been already filled. If set to 0, the new generated row will be
  11424. written over the top row just after the bottom row is filled.
  11425. Defaults to 1.
  11426. @item start_full, full
  11427. If set to 1, completely fill the output with generated rows before
  11428. outputting the first frame.
  11429. This is the default behavior, for disabling set the value to 0.
  11430. @item stitch
  11431. If set to 1, stitch the left and right row edges together.
  11432. This is the default behavior, for disabling set the value to 0.
  11433. @end table
  11434. @subsection Examples
  11435. @itemize
  11436. @item
  11437. Read the initial state from @file{pattern}, and specify an output of
  11438. size 200x400.
  11439. @example
  11440. cellauto=f=pattern:s=200x400
  11441. @end example
  11442. @item
  11443. Generate a random initial row with a width of 200 cells, with a fill
  11444. ratio of 2/3:
  11445. @example
  11446. cellauto=ratio=2/3:s=200x200
  11447. @end example
  11448. @item
  11449. Create a pattern generated by rule 18 starting by a single alive cell
  11450. centered on an initial row with width 100:
  11451. @example
  11452. cellauto=p=@@:s=100x400:full=0:rule=18
  11453. @end example
  11454. @item
  11455. Specify a more elaborated initial pattern:
  11456. @example
  11457. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11458. @end example
  11459. @end itemize
  11460. @anchor{coreimagesrc}
  11461. @section coreimagesrc
  11462. Video source generated on GPU using Apple's CoreImage API on OSX.
  11463. This video source is a specialized version of the @ref{coreimage} video filter.
  11464. Use a core image generator at the beginning of the applied filterchain to
  11465. generate the content.
  11466. The coreimagesrc video source accepts the following options:
  11467. @table @option
  11468. @item list_generators
  11469. List all available generators along with all their respective options as well as
  11470. possible minimum and maximum values along with the default values.
  11471. @example
  11472. list_generators=true
  11473. @end example
  11474. @item size, s
  11475. Specify the size of the sourced video. For the syntax of this option, check the
  11476. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11477. The default value is @code{320x240}.
  11478. @item rate, r
  11479. Specify the frame rate of the sourced video, as the number of frames
  11480. generated per second. It has to be a string in the format
  11481. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11482. number or a valid video frame rate abbreviation. The default value is
  11483. "25".
  11484. @item sar
  11485. Set the sample aspect ratio of the sourced video.
  11486. @item duration, d
  11487. Set the duration of the sourced video. See
  11488. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11489. for the accepted syntax.
  11490. If not specified, or the expressed duration is negative, the video is
  11491. supposed to be generated forever.
  11492. @end table
  11493. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11494. A complete filterchain can be used for further processing of the
  11495. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11496. and examples for details.
  11497. @subsection Examples
  11498. @itemize
  11499. @item
  11500. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11501. given as complete and escaped command-line for Apple's standard bash shell:
  11502. @example
  11503. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11504. @end example
  11505. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11506. need for a nullsrc video source.
  11507. @end itemize
  11508. @section mandelbrot
  11509. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11510. point specified with @var{start_x} and @var{start_y}.
  11511. This source accepts the following options:
  11512. @table @option
  11513. @item end_pts
  11514. Set the terminal pts value. Default value is 400.
  11515. @item end_scale
  11516. Set the terminal scale value.
  11517. Must be a floating point value. Default value is 0.3.
  11518. @item inner
  11519. Set the inner coloring mode, that is the algorithm used to draw the
  11520. Mandelbrot fractal internal region.
  11521. It shall assume one of the following values:
  11522. @table @option
  11523. @item black
  11524. Set black mode.
  11525. @item convergence
  11526. Show time until convergence.
  11527. @item mincol
  11528. Set color based on point closest to the origin of the iterations.
  11529. @item period
  11530. Set period mode.
  11531. @end table
  11532. Default value is @var{mincol}.
  11533. @item bailout
  11534. Set the bailout value. Default value is 10.0.
  11535. @item maxiter
  11536. Set the maximum of iterations performed by the rendering
  11537. algorithm. Default value is 7189.
  11538. @item outer
  11539. Set outer coloring mode.
  11540. It shall assume one of following values:
  11541. @table @option
  11542. @item iteration_count
  11543. Set iteration cound mode.
  11544. @item normalized_iteration_count
  11545. set normalized iteration count mode.
  11546. @end table
  11547. Default value is @var{normalized_iteration_count}.
  11548. @item rate, r
  11549. Set frame rate, expressed as number of frames per second. Default
  11550. value is "25".
  11551. @item size, s
  11552. Set frame size. For the syntax of this option, check the "Video
  11553. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11554. @item start_scale
  11555. Set the initial scale value. Default value is 3.0.
  11556. @item start_x
  11557. Set the initial x position. Must be a floating point value between
  11558. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11559. @item start_y
  11560. Set the initial y position. Must be a floating point value between
  11561. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11562. @end table
  11563. @section mptestsrc
  11564. Generate various test patterns, as generated by the MPlayer test filter.
  11565. The size of the generated video is fixed, and is 256x256.
  11566. This source is useful in particular for testing encoding features.
  11567. This source accepts the following options:
  11568. @table @option
  11569. @item rate, r
  11570. Specify the frame rate of the sourced video, as the number of frames
  11571. generated per second. It has to be a string in the format
  11572. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11573. number or a valid video frame rate abbreviation. The default value is
  11574. "25".
  11575. @item duration, d
  11576. Set the duration of the sourced video. See
  11577. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11578. for the accepted syntax.
  11579. If not specified, or the expressed duration is negative, the video is
  11580. supposed to be generated forever.
  11581. @item test, t
  11582. Set the number or the name of the test to perform. Supported tests are:
  11583. @table @option
  11584. @item dc_luma
  11585. @item dc_chroma
  11586. @item freq_luma
  11587. @item freq_chroma
  11588. @item amp_luma
  11589. @item amp_chroma
  11590. @item cbp
  11591. @item mv
  11592. @item ring1
  11593. @item ring2
  11594. @item all
  11595. @end table
  11596. Default value is "all", which will cycle through the list of all tests.
  11597. @end table
  11598. Some examples:
  11599. @example
  11600. mptestsrc=t=dc_luma
  11601. @end example
  11602. will generate a "dc_luma" test pattern.
  11603. @section frei0r_src
  11604. Provide a frei0r source.
  11605. To enable compilation of this filter you need to install the frei0r
  11606. header and configure FFmpeg with @code{--enable-frei0r}.
  11607. This source accepts the following parameters:
  11608. @table @option
  11609. @item size
  11610. The size of the video to generate. For the syntax of this option, check the
  11611. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11612. @item framerate
  11613. The framerate of the generated video. It may be a string of the form
  11614. @var{num}/@var{den} or a frame rate abbreviation.
  11615. @item filter_name
  11616. The name to the frei0r source to load. For more information regarding frei0r and
  11617. how to set the parameters, read the @ref{frei0r} section in the video filters
  11618. documentation.
  11619. @item filter_params
  11620. A '|'-separated list of parameters to pass to the frei0r source.
  11621. @end table
  11622. For example, to generate a frei0r partik0l source with size 200x200
  11623. and frame rate 10 which is overlaid on the overlay filter main input:
  11624. @example
  11625. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11626. @end example
  11627. @section life
  11628. Generate a life pattern.
  11629. This source is based on a generalization of John Conway's life game.
  11630. The sourced input represents a life grid, each pixel represents a cell
  11631. which can be in one of two possible states, alive or dead. Every cell
  11632. interacts with its eight neighbours, which are the cells that are
  11633. horizontally, vertically, or diagonally adjacent.
  11634. At each interaction the grid evolves according to the adopted rule,
  11635. which specifies the number of neighbor alive cells which will make a
  11636. cell stay alive or born. The @option{rule} option allows one to specify
  11637. the rule to adopt.
  11638. This source accepts the following options:
  11639. @table @option
  11640. @item filename, f
  11641. Set the file from which to read the initial grid state. In the file,
  11642. each non-whitespace character is considered an alive cell, and newline
  11643. is used to delimit the end of each row.
  11644. If this option is not specified, the initial grid is generated
  11645. randomly.
  11646. @item rate, r
  11647. Set the video rate, that is the number of frames generated per second.
  11648. Default is 25.
  11649. @item random_fill_ratio, ratio
  11650. Set the random fill ratio for the initial random grid. It is a
  11651. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11652. It is ignored when a file is specified.
  11653. @item random_seed, seed
  11654. Set the seed for filling the initial random grid, must be an integer
  11655. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11656. set to -1, the filter will try to use a good random seed on a best
  11657. effort basis.
  11658. @item rule
  11659. Set the life rule.
  11660. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11661. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11662. @var{NS} specifies the number of alive neighbor cells which make a
  11663. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11664. which make a dead cell to become alive (i.e. to "born").
  11665. "s" and "b" can be used in place of "S" and "B", respectively.
  11666. Alternatively a rule can be specified by an 18-bits integer. The 9
  11667. high order bits are used to encode the next cell state if it is alive
  11668. for each number of neighbor alive cells, the low order bits specify
  11669. the rule for "borning" new cells. Higher order bits encode for an
  11670. higher number of neighbor cells.
  11671. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11672. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11673. Default value is "S23/B3", which is the original Conway's game of life
  11674. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11675. cells, and will born a new cell if there are three alive cells around
  11676. a dead cell.
  11677. @item size, s
  11678. Set the size of the output video. For the syntax of this option, check the
  11679. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11680. If @option{filename} is specified, the size is set by default to the
  11681. same size of the input file. If @option{size} is set, it must contain
  11682. the size specified in the input file, and the initial grid defined in
  11683. that file is centered in the larger resulting area.
  11684. If a filename is not specified, the size value defaults to "320x240"
  11685. (used for a randomly generated initial grid).
  11686. @item stitch
  11687. If set to 1, stitch the left and right grid edges together, and the
  11688. top and bottom edges also. Defaults to 1.
  11689. @item mold
  11690. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11691. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11692. value from 0 to 255.
  11693. @item life_color
  11694. Set the color of living (or new born) cells.
  11695. @item death_color
  11696. Set the color of dead cells. If @option{mold} is set, this is the first color
  11697. used to represent a dead cell.
  11698. @item mold_color
  11699. Set mold color, for definitely dead and moldy cells.
  11700. For the syntax of these 3 color options, check the "Color" section in the
  11701. ffmpeg-utils manual.
  11702. @end table
  11703. @subsection Examples
  11704. @itemize
  11705. @item
  11706. Read a grid from @file{pattern}, and center it on a grid of size
  11707. 300x300 pixels:
  11708. @example
  11709. life=f=pattern:s=300x300
  11710. @end example
  11711. @item
  11712. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11713. @example
  11714. life=ratio=2/3:s=200x200
  11715. @end example
  11716. @item
  11717. Specify a custom rule for evolving a randomly generated grid:
  11718. @example
  11719. life=rule=S14/B34
  11720. @end example
  11721. @item
  11722. Full example with slow death effect (mold) using @command{ffplay}:
  11723. @example
  11724. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11725. @end example
  11726. @end itemize
  11727. @anchor{allrgb}
  11728. @anchor{allyuv}
  11729. @anchor{color}
  11730. @anchor{haldclutsrc}
  11731. @anchor{nullsrc}
  11732. @anchor{rgbtestsrc}
  11733. @anchor{smptebars}
  11734. @anchor{smptehdbars}
  11735. @anchor{testsrc}
  11736. @anchor{testsrc2}
  11737. @anchor{yuvtestsrc}
  11738. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  11739. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11740. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11741. The @code{color} source provides an uniformly colored input.
  11742. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11743. @ref{haldclut} filter.
  11744. The @code{nullsrc} source returns unprocessed video frames. It is
  11745. mainly useful to be employed in analysis / debugging tools, or as the
  11746. source for filters which ignore the input data.
  11747. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11748. detecting RGB vs BGR issues. You should see a red, green and blue
  11749. stripe from top to bottom.
  11750. The @code{smptebars} source generates a color bars pattern, based on
  11751. the SMPTE Engineering Guideline EG 1-1990.
  11752. The @code{smptehdbars} source generates a color bars pattern, based on
  11753. the SMPTE RP 219-2002.
  11754. The @code{testsrc} source generates a test video pattern, showing a
  11755. color pattern, a scrolling gradient and a timestamp. This is mainly
  11756. intended for testing purposes.
  11757. The @code{testsrc2} source is similar to testsrc, but supports more
  11758. pixel formats instead of just @code{rgb24}. This allows using it as an
  11759. input for other tests without requiring a format conversion.
  11760. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  11761. see a y, cb and cr stripe from top to bottom.
  11762. The sources accept the following parameters:
  11763. @table @option
  11764. @item color, c
  11765. Specify the color of the source, only available in the @code{color}
  11766. source. For the syntax of this option, check the "Color" section in the
  11767. ffmpeg-utils manual.
  11768. @item level
  11769. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11770. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11771. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11772. coded on a @code{1/(N*N)} scale.
  11773. @item size, s
  11774. Specify the size of the sourced video. For the syntax of this option, check the
  11775. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11776. The default value is @code{320x240}.
  11777. This option is not available with the @code{haldclutsrc} filter.
  11778. @item rate, r
  11779. Specify the frame rate of the sourced video, as the number of frames
  11780. generated per second. It has to be a string in the format
  11781. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11782. number or a valid video frame rate abbreviation. The default value is
  11783. "25".
  11784. @item sar
  11785. Set the sample aspect ratio of the sourced video.
  11786. @item duration, d
  11787. Set the duration of the sourced video. See
  11788. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11789. for the accepted syntax.
  11790. If not specified, or the expressed duration is negative, the video is
  11791. supposed to be generated forever.
  11792. @item decimals, n
  11793. Set the number of decimals to show in the timestamp, only available in the
  11794. @code{testsrc} source.
  11795. The displayed timestamp value will correspond to the original
  11796. timestamp value multiplied by the power of 10 of the specified
  11797. value. Default value is 0.
  11798. @end table
  11799. For example the following:
  11800. @example
  11801. testsrc=duration=5.3:size=qcif:rate=10
  11802. @end example
  11803. will generate a video with a duration of 5.3 seconds, with size
  11804. 176x144 and a frame rate of 10 frames per second.
  11805. The following graph description will generate a red source
  11806. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11807. frames per second.
  11808. @example
  11809. color=c=red@@0.2:s=qcif:r=10
  11810. @end example
  11811. If the input content is to be ignored, @code{nullsrc} can be used. The
  11812. following command generates noise in the luminance plane by employing
  11813. the @code{geq} filter:
  11814. @example
  11815. nullsrc=s=256x256, geq=random(1)*255:128:128
  11816. @end example
  11817. @subsection Commands
  11818. The @code{color} source supports the following commands:
  11819. @table @option
  11820. @item c, color
  11821. Set the color of the created image. Accepts the same syntax of the
  11822. corresponding @option{color} option.
  11823. @end table
  11824. @c man end VIDEO SOURCES
  11825. @chapter Video Sinks
  11826. @c man begin VIDEO SINKS
  11827. Below is a description of the currently available video sinks.
  11828. @section buffersink
  11829. Buffer video frames, and make them available to the end of the filter
  11830. graph.
  11831. This sink is mainly intended for programmatic use, in particular
  11832. through the interface defined in @file{libavfilter/buffersink.h}
  11833. or the options system.
  11834. It accepts a pointer to an AVBufferSinkContext structure, which
  11835. defines the incoming buffers' formats, to be passed as the opaque
  11836. parameter to @code{avfilter_init_filter} for initialization.
  11837. @section nullsink
  11838. Null video sink: do absolutely nothing with the input video. It is
  11839. mainly useful as a template and for use in analysis / debugging
  11840. tools.
  11841. @c man end VIDEO SINKS
  11842. @chapter Multimedia Filters
  11843. @c man begin MULTIMEDIA FILTERS
  11844. Below is a description of the currently available multimedia filters.
  11845. @section ahistogram
  11846. Convert input audio to a video output, displaying the volume histogram.
  11847. The filter accepts the following options:
  11848. @table @option
  11849. @item dmode
  11850. Specify how histogram is calculated.
  11851. It accepts the following values:
  11852. @table @samp
  11853. @item single
  11854. Use single histogram for all channels.
  11855. @item separate
  11856. Use separate histogram for each channel.
  11857. @end table
  11858. Default is @code{single}.
  11859. @item rate, r
  11860. Set frame rate, expressed as number of frames per second. Default
  11861. value is "25".
  11862. @item size, s
  11863. Specify the video size for the output. For the syntax of this option, check the
  11864. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11865. Default value is @code{hd720}.
  11866. @item scale
  11867. Set display scale.
  11868. It accepts the following values:
  11869. @table @samp
  11870. @item log
  11871. logarithmic
  11872. @item sqrt
  11873. square root
  11874. @item cbrt
  11875. cubic root
  11876. @item lin
  11877. linear
  11878. @item rlog
  11879. reverse logarithmic
  11880. @end table
  11881. Default is @code{log}.
  11882. @item ascale
  11883. Set amplitude scale.
  11884. It accepts the following values:
  11885. @table @samp
  11886. @item log
  11887. logarithmic
  11888. @item lin
  11889. linear
  11890. @end table
  11891. Default is @code{log}.
  11892. @item acount
  11893. Set how much frames to accumulate in histogram.
  11894. Defauls is 1. Setting this to -1 accumulates all frames.
  11895. @item rheight
  11896. Set histogram ratio of window height.
  11897. @item slide
  11898. Set sonogram sliding.
  11899. It accepts the following values:
  11900. @table @samp
  11901. @item replace
  11902. replace old rows with new ones.
  11903. @item scroll
  11904. scroll from top to bottom.
  11905. @end table
  11906. Default is @code{replace}.
  11907. @end table
  11908. @section aphasemeter
  11909. Convert input audio to a video output, displaying the audio phase.
  11910. The filter accepts the following options:
  11911. @table @option
  11912. @item rate, r
  11913. Set the output frame rate. Default value is @code{25}.
  11914. @item size, s
  11915. Set the video size for the output. For the syntax of this option, check the
  11916. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11917. Default value is @code{800x400}.
  11918. @item rc
  11919. @item gc
  11920. @item bc
  11921. Specify the red, green, blue contrast. Default values are @code{2},
  11922. @code{7} and @code{1}.
  11923. Allowed range is @code{[0, 255]}.
  11924. @item mpc
  11925. Set color which will be used for drawing median phase. If color is
  11926. @code{none} which is default, no median phase value will be drawn.
  11927. @end table
  11928. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11929. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11930. The @code{-1} means left and right channels are completely out of phase and
  11931. @code{1} means channels are in phase.
  11932. @section avectorscope
  11933. Convert input audio to a video output, representing the audio vector
  11934. scope.
  11935. The filter is used to measure the difference between channels of stereo
  11936. audio stream. A monoaural signal, consisting of identical left and right
  11937. signal, results in straight vertical line. Any stereo separation is visible
  11938. as a deviation from this line, creating a Lissajous figure.
  11939. If the straight (or deviation from it) but horizontal line appears this
  11940. indicates that the left and right channels are out of phase.
  11941. The filter accepts the following options:
  11942. @table @option
  11943. @item mode, m
  11944. Set the vectorscope mode.
  11945. Available values are:
  11946. @table @samp
  11947. @item lissajous
  11948. Lissajous rotated by 45 degrees.
  11949. @item lissajous_xy
  11950. Same as above but not rotated.
  11951. @item polar
  11952. Shape resembling half of circle.
  11953. @end table
  11954. Default value is @samp{lissajous}.
  11955. @item size, s
  11956. Set the video size for the output. For the syntax of this option, check the
  11957. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11958. Default value is @code{400x400}.
  11959. @item rate, r
  11960. Set the output frame rate. Default value is @code{25}.
  11961. @item rc
  11962. @item gc
  11963. @item bc
  11964. @item ac
  11965. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11966. @code{160}, @code{80} and @code{255}.
  11967. Allowed range is @code{[0, 255]}.
  11968. @item rf
  11969. @item gf
  11970. @item bf
  11971. @item af
  11972. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11973. @code{10}, @code{5} and @code{5}.
  11974. Allowed range is @code{[0, 255]}.
  11975. @item zoom
  11976. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11977. @item draw
  11978. Set the vectorscope drawing mode.
  11979. Available values are:
  11980. @table @samp
  11981. @item dot
  11982. Draw dot for each sample.
  11983. @item line
  11984. Draw line between previous and current sample.
  11985. @end table
  11986. Default value is @samp{dot}.
  11987. @item scale
  11988. Specify amplitude scale of audio samples.
  11989. Available values are:
  11990. @table @samp
  11991. @item lin
  11992. Linear.
  11993. @item sqrt
  11994. Square root.
  11995. @item cbrt
  11996. Cubic root.
  11997. @item log
  11998. Logarithmic.
  11999. @end table
  12000. @end table
  12001. @subsection Examples
  12002. @itemize
  12003. @item
  12004. Complete example using @command{ffplay}:
  12005. @example
  12006. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12007. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12008. @end example
  12009. @end itemize
  12010. @section bench, abench
  12011. Benchmark part of a filtergraph.
  12012. The filter accepts the following options:
  12013. @table @option
  12014. @item action
  12015. Start or stop a timer.
  12016. Available values are:
  12017. @table @samp
  12018. @item start
  12019. Get the current time, set it as frame metadata (using the key
  12020. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12021. @item stop
  12022. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12023. the input frame metadata to get the time difference. Time difference, average,
  12024. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12025. @code{min}) are then printed. The timestamps are expressed in seconds.
  12026. @end table
  12027. @end table
  12028. @subsection Examples
  12029. @itemize
  12030. @item
  12031. Benchmark @ref{selectivecolor} filter:
  12032. @example
  12033. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12034. @end example
  12035. @end itemize
  12036. @section concat
  12037. Concatenate audio and video streams, joining them together one after the
  12038. other.
  12039. The filter works on segments of synchronized video and audio streams. All
  12040. segments must have the same number of streams of each type, and that will
  12041. also be the number of streams at output.
  12042. The filter accepts the following options:
  12043. @table @option
  12044. @item n
  12045. Set the number of segments. Default is 2.
  12046. @item v
  12047. Set the number of output video streams, that is also the number of video
  12048. streams in each segment. Default is 1.
  12049. @item a
  12050. Set the number of output audio streams, that is also the number of audio
  12051. streams in each segment. Default is 0.
  12052. @item unsafe
  12053. Activate unsafe mode: do not fail if segments have a different format.
  12054. @end table
  12055. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12056. @var{a} audio outputs.
  12057. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12058. segment, in the same order as the outputs, then the inputs for the second
  12059. segment, etc.
  12060. Related streams do not always have exactly the same duration, for various
  12061. reasons including codec frame size or sloppy authoring. For that reason,
  12062. related synchronized streams (e.g. a video and its audio track) should be
  12063. concatenated at once. The concat filter will use the duration of the longest
  12064. stream in each segment (except the last one), and if necessary pad shorter
  12065. audio streams with silence.
  12066. For this filter to work correctly, all segments must start at timestamp 0.
  12067. All corresponding streams must have the same parameters in all segments; the
  12068. filtering system will automatically select a common pixel format for video
  12069. streams, and a common sample format, sample rate and channel layout for
  12070. audio streams, but other settings, such as resolution, must be converted
  12071. explicitly by the user.
  12072. Different frame rates are acceptable but will result in variable frame rate
  12073. at output; be sure to configure the output file to handle it.
  12074. @subsection Examples
  12075. @itemize
  12076. @item
  12077. Concatenate an opening, an episode and an ending, all in bilingual version
  12078. (video in stream 0, audio in streams 1 and 2):
  12079. @example
  12080. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12081. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12082. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12083. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12084. @end example
  12085. @item
  12086. Concatenate two parts, handling audio and video separately, using the
  12087. (a)movie sources, and adjusting the resolution:
  12088. @example
  12089. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12090. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12091. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12092. @end example
  12093. Note that a desync will happen at the stitch if the audio and video streams
  12094. do not have exactly the same duration in the first file.
  12095. @end itemize
  12096. @section drawgraph, adrawgraph
  12097. Draw a graph using input video or audio metadata.
  12098. It accepts the following parameters:
  12099. @table @option
  12100. @item m1
  12101. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12102. @item fg1
  12103. Set 1st foreground color expression.
  12104. @item m2
  12105. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12106. @item fg2
  12107. Set 2nd foreground color expression.
  12108. @item m3
  12109. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12110. @item fg3
  12111. Set 3rd foreground color expression.
  12112. @item m4
  12113. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12114. @item fg4
  12115. Set 4th foreground color expression.
  12116. @item min
  12117. Set minimal value of metadata value.
  12118. @item max
  12119. Set maximal value of metadata value.
  12120. @item bg
  12121. Set graph background color. Default is white.
  12122. @item mode
  12123. Set graph mode.
  12124. Available values for mode is:
  12125. @table @samp
  12126. @item bar
  12127. @item dot
  12128. @item line
  12129. @end table
  12130. Default is @code{line}.
  12131. @item slide
  12132. Set slide mode.
  12133. Available values for slide is:
  12134. @table @samp
  12135. @item frame
  12136. Draw new frame when right border is reached.
  12137. @item replace
  12138. Replace old columns with new ones.
  12139. @item scroll
  12140. Scroll from right to left.
  12141. @item rscroll
  12142. Scroll from left to right.
  12143. @item picture
  12144. Draw single picture.
  12145. @end table
  12146. Default is @code{frame}.
  12147. @item size
  12148. Set size of graph video. For the syntax of this option, check the
  12149. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12150. The default value is @code{900x256}.
  12151. The foreground color expressions can use the following variables:
  12152. @table @option
  12153. @item MIN
  12154. Minimal value of metadata value.
  12155. @item MAX
  12156. Maximal value of metadata value.
  12157. @item VAL
  12158. Current metadata key value.
  12159. @end table
  12160. The color is defined as 0xAABBGGRR.
  12161. @end table
  12162. Example using metadata from @ref{signalstats} filter:
  12163. @example
  12164. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12165. @end example
  12166. Example using metadata from @ref{ebur128} filter:
  12167. @example
  12168. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12169. @end example
  12170. @anchor{ebur128}
  12171. @section ebur128
  12172. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12173. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12174. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12175. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12176. The filter also has a video output (see the @var{video} option) with a real
  12177. time graph to observe the loudness evolution. The graphic contains the logged
  12178. message mentioned above, so it is not printed anymore when this option is set,
  12179. unless the verbose logging is set. The main graphing area contains the
  12180. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12181. the momentary loudness (400 milliseconds).
  12182. More information about the Loudness Recommendation EBU R128 on
  12183. @url{http://tech.ebu.ch/loudness}.
  12184. The filter accepts the following options:
  12185. @table @option
  12186. @item video
  12187. Activate the video output. The audio stream is passed unchanged whether this
  12188. option is set or no. The video stream will be the first output stream if
  12189. activated. Default is @code{0}.
  12190. @item size
  12191. Set the video size. This option is for video only. For the syntax of this
  12192. option, check the
  12193. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12194. Default and minimum resolution is @code{640x480}.
  12195. @item meter
  12196. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12197. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12198. other integer value between this range is allowed.
  12199. @item metadata
  12200. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12201. into 100ms output frames, each of them containing various loudness information
  12202. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12203. Default is @code{0}.
  12204. @item framelog
  12205. Force the frame logging level.
  12206. Available values are:
  12207. @table @samp
  12208. @item info
  12209. information logging level
  12210. @item verbose
  12211. verbose logging level
  12212. @end table
  12213. By default, the logging level is set to @var{info}. If the @option{video} or
  12214. the @option{metadata} options are set, it switches to @var{verbose}.
  12215. @item peak
  12216. Set peak mode(s).
  12217. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12218. values are:
  12219. @table @samp
  12220. @item none
  12221. Disable any peak mode (default).
  12222. @item sample
  12223. Enable sample-peak mode.
  12224. Simple peak mode looking for the higher sample value. It logs a message
  12225. for sample-peak (identified by @code{SPK}).
  12226. @item true
  12227. Enable true-peak mode.
  12228. If enabled, the peak lookup is done on an over-sampled version of the input
  12229. stream for better peak accuracy. It logs a message for true-peak.
  12230. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12231. This mode requires a build with @code{libswresample}.
  12232. @end table
  12233. @item dualmono
  12234. Treat mono input files as "dual mono". If a mono file is intended for playback
  12235. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12236. If set to @code{true}, this option will compensate for this effect.
  12237. Multi-channel input files are not affected by this option.
  12238. @item panlaw
  12239. Set a specific pan law to be used for the measurement of dual mono files.
  12240. This parameter is optional, and has a default value of -3.01dB.
  12241. @end table
  12242. @subsection Examples
  12243. @itemize
  12244. @item
  12245. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12246. @example
  12247. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12248. @end example
  12249. @item
  12250. Run an analysis with @command{ffmpeg}:
  12251. @example
  12252. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12253. @end example
  12254. @end itemize
  12255. @section interleave, ainterleave
  12256. Temporally interleave frames from several inputs.
  12257. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12258. These filters read frames from several inputs and send the oldest
  12259. queued frame to the output.
  12260. Input streams must have well defined, monotonically increasing frame
  12261. timestamp values.
  12262. In order to submit one frame to output, these filters need to enqueue
  12263. at least one frame for each input, so they cannot work in case one
  12264. input is not yet terminated and will not receive incoming frames.
  12265. For example consider the case when one input is a @code{select} filter
  12266. which always drops input frames. The @code{interleave} filter will keep
  12267. reading from that input, but it will never be able to send new frames
  12268. to output until the input sends an end-of-stream signal.
  12269. Also, depending on inputs synchronization, the filters will drop
  12270. frames in case one input receives more frames than the other ones, and
  12271. the queue is already filled.
  12272. These filters accept the following options:
  12273. @table @option
  12274. @item nb_inputs, n
  12275. Set the number of different inputs, it is 2 by default.
  12276. @end table
  12277. @subsection Examples
  12278. @itemize
  12279. @item
  12280. Interleave frames belonging to different streams using @command{ffmpeg}:
  12281. @example
  12282. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12283. @end example
  12284. @item
  12285. Add flickering blur effect:
  12286. @example
  12287. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12288. @end example
  12289. @end itemize
  12290. @section metadata, ametadata
  12291. Manipulate frame metadata.
  12292. This filter accepts the following options:
  12293. @table @option
  12294. @item mode
  12295. Set mode of operation of the filter.
  12296. Can be one of the following:
  12297. @table @samp
  12298. @item select
  12299. If both @code{value} and @code{key} is set, select frames
  12300. which have such metadata. If only @code{key} is set, select
  12301. every frame that has such key in metadata.
  12302. @item add
  12303. Add new metadata @code{key} and @code{value}. If key is already available
  12304. do nothing.
  12305. @item modify
  12306. Modify value of already present key.
  12307. @item delete
  12308. If @code{value} is set, delete only keys that have such value.
  12309. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12310. the frame.
  12311. @item print
  12312. Print key and its value if metadata was found. If @code{key} is not set print all
  12313. metadata values available in frame.
  12314. @end table
  12315. @item key
  12316. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12317. @item value
  12318. Set metadata value which will be used. This option is mandatory for
  12319. @code{modify} and @code{add} mode.
  12320. @item function
  12321. Which function to use when comparing metadata value and @code{value}.
  12322. Can be one of following:
  12323. @table @samp
  12324. @item same_str
  12325. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12326. @item starts_with
  12327. Values are interpreted as strings, returns true if metadata value starts with
  12328. the @code{value} option string.
  12329. @item less
  12330. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12331. @item equal
  12332. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12333. @item greater
  12334. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12335. @item expr
  12336. Values are interpreted as floats, returns true if expression from option @code{expr}
  12337. evaluates to true.
  12338. @end table
  12339. @item expr
  12340. Set expression which is used when @code{function} is set to @code{expr}.
  12341. The expression is evaluated through the eval API and can contain the following
  12342. constants:
  12343. @table @option
  12344. @item VALUE1
  12345. Float representation of @code{value} from metadata key.
  12346. @item VALUE2
  12347. Float representation of @code{value} as supplied by user in @code{value} option.
  12348. @item file
  12349. If specified in @code{print} mode, output is written to the named file. Instead of
  12350. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12351. for standard output. If @code{file} option is not set, output is written to the log
  12352. with AV_LOG_INFO loglevel.
  12353. @end table
  12354. @end table
  12355. @subsection Examples
  12356. @itemize
  12357. @item
  12358. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12359. between 0 and 1.
  12360. @example
  12361. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12362. @end example
  12363. @item
  12364. Print silencedetect output to file @file{metadata.txt}.
  12365. @example
  12366. silencedetect,ametadata=mode=print:file=metadata.txt
  12367. @end example
  12368. @item
  12369. Direct all metadata to a pipe with file descriptor 4.
  12370. @example
  12371. metadata=mode=print:file='pipe\:4'
  12372. @end example
  12373. @end itemize
  12374. @section perms, aperms
  12375. Set read/write permissions for the output frames.
  12376. These filters are mainly aimed at developers to test direct path in the
  12377. following filter in the filtergraph.
  12378. The filters accept the following options:
  12379. @table @option
  12380. @item mode
  12381. Select the permissions mode.
  12382. It accepts the following values:
  12383. @table @samp
  12384. @item none
  12385. Do nothing. This is the default.
  12386. @item ro
  12387. Set all the output frames read-only.
  12388. @item rw
  12389. Set all the output frames directly writable.
  12390. @item toggle
  12391. Make the frame read-only if writable, and writable if read-only.
  12392. @item random
  12393. Set each output frame read-only or writable randomly.
  12394. @end table
  12395. @item seed
  12396. Set the seed for the @var{random} mode, must be an integer included between
  12397. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12398. @code{-1}, the filter will try to use a good random seed on a best effort
  12399. basis.
  12400. @end table
  12401. Note: in case of auto-inserted filter between the permission filter and the
  12402. following one, the permission might not be received as expected in that
  12403. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12404. perms/aperms filter can avoid this problem.
  12405. @section realtime, arealtime
  12406. Slow down filtering to match real time approximatively.
  12407. These filters will pause the filtering for a variable amount of time to
  12408. match the output rate with the input timestamps.
  12409. They are similar to the @option{re} option to @code{ffmpeg}.
  12410. They accept the following options:
  12411. @table @option
  12412. @item limit
  12413. Time limit for the pauses. Any pause longer than that will be considered
  12414. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12415. @end table
  12416. @anchor{select}
  12417. @section select, aselect
  12418. Select frames to pass in output.
  12419. This filter accepts the following options:
  12420. @table @option
  12421. @item expr, e
  12422. Set expression, which is evaluated for each input frame.
  12423. If the expression is evaluated to zero, the frame is discarded.
  12424. If the evaluation result is negative or NaN, the frame is sent to the
  12425. first output; otherwise it is sent to the output with index
  12426. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12427. For example a value of @code{1.2} corresponds to the output with index
  12428. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12429. @item outputs, n
  12430. Set the number of outputs. The output to which to send the selected
  12431. frame is based on the result of the evaluation. Default value is 1.
  12432. @end table
  12433. The expression can contain the following constants:
  12434. @table @option
  12435. @item n
  12436. The (sequential) number of the filtered frame, starting from 0.
  12437. @item selected_n
  12438. The (sequential) number of the selected frame, starting from 0.
  12439. @item prev_selected_n
  12440. The sequential number of the last selected frame. It's NAN if undefined.
  12441. @item TB
  12442. The timebase of the input timestamps.
  12443. @item pts
  12444. The PTS (Presentation TimeStamp) of the filtered video frame,
  12445. expressed in @var{TB} units. It's NAN if undefined.
  12446. @item t
  12447. The PTS of the filtered video frame,
  12448. expressed in seconds. It's NAN if undefined.
  12449. @item prev_pts
  12450. The PTS of the previously filtered video frame. It's NAN if undefined.
  12451. @item prev_selected_pts
  12452. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12453. @item prev_selected_t
  12454. The PTS of the last previously selected video frame. It's NAN if undefined.
  12455. @item start_pts
  12456. The PTS of the first video frame in the video. It's NAN if undefined.
  12457. @item start_t
  12458. The time of the first video frame in the video. It's NAN if undefined.
  12459. @item pict_type @emph{(video only)}
  12460. The type of the filtered frame. It can assume one of the following
  12461. values:
  12462. @table @option
  12463. @item I
  12464. @item P
  12465. @item B
  12466. @item S
  12467. @item SI
  12468. @item SP
  12469. @item BI
  12470. @end table
  12471. @item interlace_type @emph{(video only)}
  12472. The frame interlace type. It can assume one of the following values:
  12473. @table @option
  12474. @item PROGRESSIVE
  12475. The frame is progressive (not interlaced).
  12476. @item TOPFIRST
  12477. The frame is top-field-first.
  12478. @item BOTTOMFIRST
  12479. The frame is bottom-field-first.
  12480. @end table
  12481. @item consumed_sample_n @emph{(audio only)}
  12482. the number of selected samples before the current frame
  12483. @item samples_n @emph{(audio only)}
  12484. the number of samples in the current frame
  12485. @item sample_rate @emph{(audio only)}
  12486. the input sample rate
  12487. @item key
  12488. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12489. @item pos
  12490. the position in the file of the filtered frame, -1 if the information
  12491. is not available (e.g. for synthetic video)
  12492. @item scene @emph{(video only)}
  12493. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12494. probability for the current frame to introduce a new scene, while a higher
  12495. value means the current frame is more likely to be one (see the example below)
  12496. @item concatdec_select
  12497. The concat demuxer can select only part of a concat input file by setting an
  12498. inpoint and an outpoint, but the output packets may not be entirely contained
  12499. in the selected interval. By using this variable, it is possible to skip frames
  12500. generated by the concat demuxer which are not exactly contained in the selected
  12501. interval.
  12502. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12503. and the @var{lavf.concat.duration} packet metadata values which are also
  12504. present in the decoded frames.
  12505. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12506. start_time and either the duration metadata is missing or the frame pts is less
  12507. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12508. missing.
  12509. That basically means that an input frame is selected if its pts is within the
  12510. interval set by the concat demuxer.
  12511. @end table
  12512. The default value of the select expression is "1".
  12513. @subsection Examples
  12514. @itemize
  12515. @item
  12516. Select all frames in input:
  12517. @example
  12518. select
  12519. @end example
  12520. The example above is the same as:
  12521. @example
  12522. select=1
  12523. @end example
  12524. @item
  12525. Skip all frames:
  12526. @example
  12527. select=0
  12528. @end example
  12529. @item
  12530. Select only I-frames:
  12531. @example
  12532. select='eq(pict_type\,I)'
  12533. @end example
  12534. @item
  12535. Select one frame every 100:
  12536. @example
  12537. select='not(mod(n\,100))'
  12538. @end example
  12539. @item
  12540. Select only frames contained in the 10-20 time interval:
  12541. @example
  12542. select=between(t\,10\,20)
  12543. @end example
  12544. @item
  12545. Select only I-frames contained in the 10-20 time interval:
  12546. @example
  12547. select=between(t\,10\,20)*eq(pict_type\,I)
  12548. @end example
  12549. @item
  12550. Select frames with a minimum distance of 10 seconds:
  12551. @example
  12552. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12553. @end example
  12554. @item
  12555. Use aselect to select only audio frames with samples number > 100:
  12556. @example
  12557. aselect='gt(samples_n\,100)'
  12558. @end example
  12559. @item
  12560. Create a mosaic of the first scenes:
  12561. @example
  12562. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12563. @end example
  12564. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12565. choice.
  12566. @item
  12567. Send even and odd frames to separate outputs, and compose them:
  12568. @example
  12569. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12570. @end example
  12571. @item
  12572. Select useful frames from an ffconcat file which is using inpoints and
  12573. outpoints but where the source files are not intra frame only.
  12574. @example
  12575. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12576. @end example
  12577. @end itemize
  12578. @section sendcmd, asendcmd
  12579. Send commands to filters in the filtergraph.
  12580. These filters read commands to be sent to other filters in the
  12581. filtergraph.
  12582. @code{sendcmd} must be inserted between two video filters,
  12583. @code{asendcmd} must be inserted between two audio filters, but apart
  12584. from that they act the same way.
  12585. The specification of commands can be provided in the filter arguments
  12586. with the @var{commands} option, or in a file specified by the
  12587. @var{filename} option.
  12588. These filters accept the following options:
  12589. @table @option
  12590. @item commands, c
  12591. Set the commands to be read and sent to the other filters.
  12592. @item filename, f
  12593. Set the filename of the commands to be read and sent to the other
  12594. filters.
  12595. @end table
  12596. @subsection Commands syntax
  12597. A commands description consists of a sequence of interval
  12598. specifications, comprising a list of commands to be executed when a
  12599. particular event related to that interval occurs. The occurring event
  12600. is typically the current frame time entering or leaving a given time
  12601. interval.
  12602. An interval is specified by the following syntax:
  12603. @example
  12604. @var{START}[-@var{END}] @var{COMMANDS};
  12605. @end example
  12606. The time interval is specified by the @var{START} and @var{END} times.
  12607. @var{END} is optional and defaults to the maximum time.
  12608. The current frame time is considered within the specified interval if
  12609. it is included in the interval [@var{START}, @var{END}), that is when
  12610. the time is greater or equal to @var{START} and is lesser than
  12611. @var{END}.
  12612. @var{COMMANDS} consists of a sequence of one or more command
  12613. specifications, separated by ",", relating to that interval. The
  12614. syntax of a command specification is given by:
  12615. @example
  12616. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12617. @end example
  12618. @var{FLAGS} is optional and specifies the type of events relating to
  12619. the time interval which enable sending the specified command, and must
  12620. be a non-null sequence of identifier flags separated by "+" or "|" and
  12621. enclosed between "[" and "]".
  12622. The following flags are recognized:
  12623. @table @option
  12624. @item enter
  12625. The command is sent when the current frame timestamp enters the
  12626. specified interval. In other words, the command is sent when the
  12627. previous frame timestamp was not in the given interval, and the
  12628. current is.
  12629. @item leave
  12630. The command is sent when the current frame timestamp leaves the
  12631. specified interval. In other words, the command is sent when the
  12632. previous frame timestamp was in the given interval, and the
  12633. current is not.
  12634. @end table
  12635. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12636. assumed.
  12637. @var{TARGET} specifies the target of the command, usually the name of
  12638. the filter class or a specific filter instance name.
  12639. @var{COMMAND} specifies the name of the command for the target filter.
  12640. @var{ARG} is optional and specifies the optional list of argument for
  12641. the given @var{COMMAND}.
  12642. Between one interval specification and another, whitespaces, or
  12643. sequences of characters starting with @code{#} until the end of line,
  12644. are ignored and can be used to annotate comments.
  12645. A simplified BNF description of the commands specification syntax
  12646. follows:
  12647. @example
  12648. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12649. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12650. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12651. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12652. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12653. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12654. @end example
  12655. @subsection Examples
  12656. @itemize
  12657. @item
  12658. Specify audio tempo change at second 4:
  12659. @example
  12660. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12661. @end example
  12662. @item
  12663. Specify a list of drawtext and hue commands in a file.
  12664. @example
  12665. # show text in the interval 5-10
  12666. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12667. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12668. # desaturate the image in the interval 15-20
  12669. 15.0-20.0 [enter] hue s 0,
  12670. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12671. [leave] hue s 1,
  12672. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12673. # apply an exponential saturation fade-out effect, starting from time 25
  12674. 25 [enter] hue s exp(25-t)
  12675. @end example
  12676. A filtergraph allowing to read and process the above command list
  12677. stored in a file @file{test.cmd}, can be specified with:
  12678. @example
  12679. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12680. @end example
  12681. @end itemize
  12682. @anchor{setpts}
  12683. @section setpts, asetpts
  12684. Change the PTS (presentation timestamp) of the input frames.
  12685. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12686. This filter accepts the following options:
  12687. @table @option
  12688. @item expr
  12689. The expression which is evaluated for each frame to construct its timestamp.
  12690. @end table
  12691. The expression is evaluated through the eval API and can contain the following
  12692. constants:
  12693. @table @option
  12694. @item FRAME_RATE
  12695. frame rate, only defined for constant frame-rate video
  12696. @item PTS
  12697. The presentation timestamp in input
  12698. @item N
  12699. The count of the input frame for video or the number of consumed samples,
  12700. not including the current frame for audio, starting from 0.
  12701. @item NB_CONSUMED_SAMPLES
  12702. The number of consumed samples, not including the current frame (only
  12703. audio)
  12704. @item NB_SAMPLES, S
  12705. The number of samples in the current frame (only audio)
  12706. @item SAMPLE_RATE, SR
  12707. The audio sample rate.
  12708. @item STARTPTS
  12709. The PTS of the first frame.
  12710. @item STARTT
  12711. the time in seconds of the first frame
  12712. @item INTERLACED
  12713. State whether the current frame is interlaced.
  12714. @item T
  12715. the time in seconds of the current frame
  12716. @item POS
  12717. original position in the file of the frame, or undefined if undefined
  12718. for the current frame
  12719. @item PREV_INPTS
  12720. The previous input PTS.
  12721. @item PREV_INT
  12722. previous input time in seconds
  12723. @item PREV_OUTPTS
  12724. The previous output PTS.
  12725. @item PREV_OUTT
  12726. previous output time in seconds
  12727. @item RTCTIME
  12728. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12729. instead.
  12730. @item RTCSTART
  12731. The wallclock (RTC) time at the start of the movie in microseconds.
  12732. @item TB
  12733. The timebase of the input timestamps.
  12734. @end table
  12735. @subsection Examples
  12736. @itemize
  12737. @item
  12738. Start counting PTS from zero
  12739. @example
  12740. setpts=PTS-STARTPTS
  12741. @end example
  12742. @item
  12743. Apply fast motion effect:
  12744. @example
  12745. setpts=0.5*PTS
  12746. @end example
  12747. @item
  12748. Apply slow motion effect:
  12749. @example
  12750. setpts=2.0*PTS
  12751. @end example
  12752. @item
  12753. Set fixed rate of 25 frames per second:
  12754. @example
  12755. setpts=N/(25*TB)
  12756. @end example
  12757. @item
  12758. Set fixed rate 25 fps with some jitter:
  12759. @example
  12760. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12761. @end example
  12762. @item
  12763. Apply an offset of 10 seconds to the input PTS:
  12764. @example
  12765. setpts=PTS+10/TB
  12766. @end example
  12767. @item
  12768. Generate timestamps from a "live source" and rebase onto the current timebase:
  12769. @example
  12770. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12771. @end example
  12772. @item
  12773. Generate timestamps by counting samples:
  12774. @example
  12775. asetpts=N/SR/TB
  12776. @end example
  12777. @end itemize
  12778. @section settb, asettb
  12779. Set the timebase to use for the output frames timestamps.
  12780. It is mainly useful for testing timebase configuration.
  12781. It accepts the following parameters:
  12782. @table @option
  12783. @item expr, tb
  12784. The expression which is evaluated into the output timebase.
  12785. @end table
  12786. The value for @option{tb} is an arithmetic expression representing a
  12787. rational. The expression can contain the constants "AVTB" (the default
  12788. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12789. audio only). Default value is "intb".
  12790. @subsection Examples
  12791. @itemize
  12792. @item
  12793. Set the timebase to 1/25:
  12794. @example
  12795. settb=expr=1/25
  12796. @end example
  12797. @item
  12798. Set the timebase to 1/10:
  12799. @example
  12800. settb=expr=0.1
  12801. @end example
  12802. @item
  12803. Set the timebase to 1001/1000:
  12804. @example
  12805. settb=1+0.001
  12806. @end example
  12807. @item
  12808. Set the timebase to 2*intb:
  12809. @example
  12810. settb=2*intb
  12811. @end example
  12812. @item
  12813. Set the default timebase value:
  12814. @example
  12815. settb=AVTB
  12816. @end example
  12817. @end itemize
  12818. @section showcqt
  12819. Convert input audio to a video output representing frequency spectrum
  12820. logarithmically using Brown-Puckette constant Q transform algorithm with
  12821. direct frequency domain coefficient calculation (but the transform itself
  12822. is not really constant Q, instead the Q factor is actually variable/clamped),
  12823. with musical tone scale, from E0 to D#10.
  12824. The filter accepts the following options:
  12825. @table @option
  12826. @item size, s
  12827. Specify the video size for the output. It must be even. For the syntax of this option,
  12828. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12829. Default value is @code{1920x1080}.
  12830. @item fps, rate, r
  12831. Set the output frame rate. Default value is @code{25}.
  12832. @item bar_h
  12833. Set the bargraph height. It must be even. Default value is @code{-1} which
  12834. computes the bargraph height automatically.
  12835. @item axis_h
  12836. Set the axis height. It must be even. Default value is @code{-1} which computes
  12837. the axis height automatically.
  12838. @item sono_h
  12839. Set the sonogram height. It must be even. Default value is @code{-1} which
  12840. computes the sonogram height automatically.
  12841. @item fullhd
  12842. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12843. instead. Default value is @code{1}.
  12844. @item sono_v, volume
  12845. Specify the sonogram volume expression. It can contain variables:
  12846. @table @option
  12847. @item bar_v
  12848. the @var{bar_v} evaluated expression
  12849. @item frequency, freq, f
  12850. the frequency where it is evaluated
  12851. @item timeclamp, tc
  12852. the value of @var{timeclamp} option
  12853. @end table
  12854. and functions:
  12855. @table @option
  12856. @item a_weighting(f)
  12857. A-weighting of equal loudness
  12858. @item b_weighting(f)
  12859. B-weighting of equal loudness
  12860. @item c_weighting(f)
  12861. C-weighting of equal loudness.
  12862. @end table
  12863. Default value is @code{16}.
  12864. @item bar_v, volume2
  12865. Specify the bargraph volume expression. It can contain variables:
  12866. @table @option
  12867. @item sono_v
  12868. the @var{sono_v} evaluated expression
  12869. @item frequency, freq, f
  12870. the frequency where it is evaluated
  12871. @item timeclamp, tc
  12872. the value of @var{timeclamp} option
  12873. @end table
  12874. and functions:
  12875. @table @option
  12876. @item a_weighting(f)
  12877. A-weighting of equal loudness
  12878. @item b_weighting(f)
  12879. B-weighting of equal loudness
  12880. @item c_weighting(f)
  12881. C-weighting of equal loudness.
  12882. @end table
  12883. Default value is @code{sono_v}.
  12884. @item sono_g, gamma
  12885. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12886. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12887. Acceptable range is @code{[1, 7]}.
  12888. @item bar_g, gamma2
  12889. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12890. @code{[1, 7]}.
  12891. @item bar_t
  12892. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  12893. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  12894. @item timeclamp, tc
  12895. Specify the transform timeclamp. At low frequency, there is trade-off between
  12896. accuracy in time domain and frequency domain. If timeclamp is lower,
  12897. event in time domain is represented more accurately (such as fast bass drum),
  12898. otherwise event in frequency domain is represented more accurately
  12899. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12900. @item basefreq
  12901. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12902. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12903. @item endfreq
  12904. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12905. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12906. @item coeffclamp
  12907. This option is deprecated and ignored.
  12908. @item tlength
  12909. Specify the transform length in time domain. Use this option to control accuracy
  12910. trade-off between time domain and frequency domain at every frequency sample.
  12911. It can contain variables:
  12912. @table @option
  12913. @item frequency, freq, f
  12914. the frequency where it is evaluated
  12915. @item timeclamp, tc
  12916. the value of @var{timeclamp} option.
  12917. @end table
  12918. Default value is @code{384*tc/(384+tc*f)}.
  12919. @item count
  12920. Specify the transform count for every video frame. Default value is @code{6}.
  12921. Acceptable range is @code{[1, 30]}.
  12922. @item fcount
  12923. Specify the transform count for every single pixel. Default value is @code{0},
  12924. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12925. @item fontfile
  12926. Specify font file for use with freetype to draw the axis. If not specified,
  12927. use embedded font. Note that drawing with font file or embedded font is not
  12928. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12929. option instead.
  12930. @item font
  12931. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  12932. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  12933. @item fontcolor
  12934. Specify font color expression. This is arithmetic expression that should return
  12935. integer value 0xRRGGBB. It can contain variables:
  12936. @table @option
  12937. @item frequency, freq, f
  12938. the frequency where it is evaluated
  12939. @item timeclamp, tc
  12940. the value of @var{timeclamp} option
  12941. @end table
  12942. and functions:
  12943. @table @option
  12944. @item midi(f)
  12945. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12946. @item r(x), g(x), b(x)
  12947. red, green, and blue value of intensity x.
  12948. @end table
  12949. Default value is @code{st(0, (midi(f)-59.5)/12);
  12950. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12951. r(1-ld(1)) + b(ld(1))}.
  12952. @item axisfile
  12953. Specify image file to draw the axis. This option override @var{fontfile} and
  12954. @var{fontcolor} option.
  12955. @item axis, text
  12956. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12957. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12958. Default value is @code{1}.
  12959. @item csp
  12960. Set colorspace. The accepted values are:
  12961. @table @samp
  12962. @item unspecified
  12963. Unspecified (default)
  12964. @item bt709
  12965. BT.709
  12966. @item fcc
  12967. FCC
  12968. @item bt470bg
  12969. BT.470BG or BT.601-6 625
  12970. @item smpte170m
  12971. SMPTE-170M or BT.601-6 525
  12972. @item smpte240m
  12973. SMPTE-240M
  12974. @item bt2020ncl
  12975. BT.2020 with non-constant luminance
  12976. @end table
  12977. @item cscheme
  12978. Set spectrogram color scheme. This is list of floating point values with format
  12979. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  12980. The default is @code{1|0.5|0|0|0.5|1}.
  12981. @end table
  12982. @subsection Examples
  12983. @itemize
  12984. @item
  12985. Playing audio while showing the spectrum:
  12986. @example
  12987. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12988. @end example
  12989. @item
  12990. Same as above, but with frame rate 30 fps:
  12991. @example
  12992. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12993. @end example
  12994. @item
  12995. Playing at 1280x720:
  12996. @example
  12997. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12998. @end example
  12999. @item
  13000. Disable sonogram display:
  13001. @example
  13002. sono_h=0
  13003. @end example
  13004. @item
  13005. A1 and its harmonics: A1, A2, (near)E3, A3:
  13006. @example
  13007. 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),
  13008. asplit[a][out1]; [a] showcqt [out0]'
  13009. @end example
  13010. @item
  13011. Same as above, but with more accuracy in frequency domain:
  13012. @example
  13013. 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),
  13014. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13015. @end example
  13016. @item
  13017. Custom volume:
  13018. @example
  13019. bar_v=10:sono_v=bar_v*a_weighting(f)
  13020. @end example
  13021. @item
  13022. Custom gamma, now spectrum is linear to the amplitude.
  13023. @example
  13024. bar_g=2:sono_g=2
  13025. @end example
  13026. @item
  13027. Custom tlength equation:
  13028. @example
  13029. 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)))'
  13030. @end example
  13031. @item
  13032. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13033. @example
  13034. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13035. @end example
  13036. @item
  13037. Custom font using fontconfig:
  13038. @example
  13039. font='Courier New,Monospace,mono|bold'
  13040. @end example
  13041. @item
  13042. Custom frequency range with custom axis using image file:
  13043. @example
  13044. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13045. @end example
  13046. @end itemize
  13047. @section showfreqs
  13048. Convert input audio to video output representing the audio power spectrum.
  13049. Audio amplitude is on Y-axis while frequency is on X-axis.
  13050. The filter accepts the following options:
  13051. @table @option
  13052. @item size, s
  13053. Specify size of video. For the syntax of this option, check the
  13054. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13055. Default is @code{1024x512}.
  13056. @item mode
  13057. Set display mode.
  13058. This set how each frequency bin will be represented.
  13059. It accepts the following values:
  13060. @table @samp
  13061. @item line
  13062. @item bar
  13063. @item dot
  13064. @end table
  13065. Default is @code{bar}.
  13066. @item ascale
  13067. Set amplitude scale.
  13068. It accepts the following values:
  13069. @table @samp
  13070. @item lin
  13071. Linear scale.
  13072. @item sqrt
  13073. Square root scale.
  13074. @item cbrt
  13075. Cubic root scale.
  13076. @item log
  13077. Logarithmic scale.
  13078. @end table
  13079. Default is @code{log}.
  13080. @item fscale
  13081. Set frequency scale.
  13082. It accepts the following values:
  13083. @table @samp
  13084. @item lin
  13085. Linear scale.
  13086. @item log
  13087. Logarithmic scale.
  13088. @item rlog
  13089. Reverse logarithmic scale.
  13090. @end table
  13091. Default is @code{lin}.
  13092. @item win_size
  13093. Set window size.
  13094. It accepts the following values:
  13095. @table @samp
  13096. @item w16
  13097. @item w32
  13098. @item w64
  13099. @item w128
  13100. @item w256
  13101. @item w512
  13102. @item w1024
  13103. @item w2048
  13104. @item w4096
  13105. @item w8192
  13106. @item w16384
  13107. @item w32768
  13108. @item w65536
  13109. @end table
  13110. Default is @code{w2048}
  13111. @item win_func
  13112. Set windowing function.
  13113. It accepts the following values:
  13114. @table @samp
  13115. @item rect
  13116. @item bartlett
  13117. @item hanning
  13118. @item hamming
  13119. @item blackman
  13120. @item welch
  13121. @item flattop
  13122. @item bharris
  13123. @item bnuttall
  13124. @item bhann
  13125. @item sine
  13126. @item nuttall
  13127. @item lanczos
  13128. @item gauss
  13129. @item tukey
  13130. @item dolph
  13131. @item cauchy
  13132. @item parzen
  13133. @item poisson
  13134. @end table
  13135. Default is @code{hanning}.
  13136. @item overlap
  13137. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13138. which means optimal overlap for selected window function will be picked.
  13139. @item averaging
  13140. Set time averaging. Setting this to 0 will display current maximal peaks.
  13141. Default is @code{1}, which means time averaging is disabled.
  13142. @item colors
  13143. Specify list of colors separated by space or by '|' which will be used to
  13144. draw channel frequencies. Unrecognized or missing colors will be replaced
  13145. by white color.
  13146. @item cmode
  13147. Set channel display mode.
  13148. It accepts the following values:
  13149. @table @samp
  13150. @item combined
  13151. @item separate
  13152. @end table
  13153. Default is @code{combined}.
  13154. @item minamp
  13155. Set minimum amplitude used in @code{log} amplitude scaler.
  13156. @end table
  13157. @anchor{showspectrum}
  13158. @section showspectrum
  13159. Convert input audio to a video output, representing the audio frequency
  13160. spectrum.
  13161. The filter accepts the following options:
  13162. @table @option
  13163. @item size, s
  13164. Specify the video size for the output. For the syntax of this option, check the
  13165. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13166. Default value is @code{640x512}.
  13167. @item slide
  13168. Specify how the spectrum should slide along the window.
  13169. It accepts the following values:
  13170. @table @samp
  13171. @item replace
  13172. the samples start again on the left when they reach the right
  13173. @item scroll
  13174. the samples scroll from right to left
  13175. @item fullframe
  13176. frames are only produced when the samples reach the right
  13177. @item rscroll
  13178. the samples scroll from left to right
  13179. @end table
  13180. Default value is @code{replace}.
  13181. @item mode
  13182. Specify display mode.
  13183. It accepts the following values:
  13184. @table @samp
  13185. @item combined
  13186. all channels are displayed in the same row
  13187. @item separate
  13188. all channels are displayed in separate rows
  13189. @end table
  13190. Default value is @samp{combined}.
  13191. @item color
  13192. Specify display color mode.
  13193. It accepts the following values:
  13194. @table @samp
  13195. @item channel
  13196. each channel is displayed in a separate color
  13197. @item intensity
  13198. each channel is displayed using the same color scheme
  13199. @item rainbow
  13200. each channel is displayed using the rainbow color scheme
  13201. @item moreland
  13202. each channel is displayed using the moreland color scheme
  13203. @item nebulae
  13204. each channel is displayed using the nebulae color scheme
  13205. @item fire
  13206. each channel is displayed using the fire color scheme
  13207. @item fiery
  13208. each channel is displayed using the fiery color scheme
  13209. @item fruit
  13210. each channel is displayed using the fruit color scheme
  13211. @item cool
  13212. each channel is displayed using the cool color scheme
  13213. @end table
  13214. Default value is @samp{channel}.
  13215. @item scale
  13216. Specify scale used for calculating intensity color values.
  13217. It accepts the following values:
  13218. @table @samp
  13219. @item lin
  13220. linear
  13221. @item sqrt
  13222. square root, default
  13223. @item cbrt
  13224. cubic root
  13225. @item log
  13226. logarithmic
  13227. @item 4thrt
  13228. 4th root
  13229. @item 5thrt
  13230. 5th root
  13231. @end table
  13232. Default value is @samp{sqrt}.
  13233. @item saturation
  13234. Set saturation modifier for displayed colors. Negative values provide
  13235. alternative color scheme. @code{0} is no saturation at all.
  13236. Saturation must be in [-10.0, 10.0] range.
  13237. Default value is @code{1}.
  13238. @item win_func
  13239. Set window function.
  13240. It accepts the following values:
  13241. @table @samp
  13242. @item rect
  13243. @item bartlett
  13244. @item hann
  13245. @item hanning
  13246. @item hamming
  13247. @item blackman
  13248. @item welch
  13249. @item flattop
  13250. @item bharris
  13251. @item bnuttall
  13252. @item bhann
  13253. @item sine
  13254. @item nuttall
  13255. @item lanczos
  13256. @item gauss
  13257. @item tukey
  13258. @item dolph
  13259. @item cauchy
  13260. @item parzen
  13261. @item poisson
  13262. @end table
  13263. Default value is @code{hann}.
  13264. @item orientation
  13265. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13266. @code{horizontal}. Default is @code{vertical}.
  13267. @item overlap
  13268. Set ratio of overlap window. Default value is @code{0}.
  13269. When value is @code{1} overlap is set to recommended size for specific
  13270. window function currently used.
  13271. @item gain
  13272. Set scale gain for calculating intensity color values.
  13273. Default value is @code{1}.
  13274. @item data
  13275. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13276. @item rotation
  13277. Set color rotation, must be in [-1.0, 1.0] range.
  13278. Default value is @code{0}.
  13279. @end table
  13280. The usage is very similar to the showwaves filter; see the examples in that
  13281. section.
  13282. @subsection Examples
  13283. @itemize
  13284. @item
  13285. Large window with logarithmic color scaling:
  13286. @example
  13287. showspectrum=s=1280x480:scale=log
  13288. @end example
  13289. @item
  13290. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13291. @example
  13292. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13293. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13294. @end example
  13295. @end itemize
  13296. @section showspectrumpic
  13297. Convert input audio to a single video frame, representing the audio frequency
  13298. spectrum.
  13299. The filter accepts the following options:
  13300. @table @option
  13301. @item size, s
  13302. Specify the video size for the output. For the syntax of this option, check the
  13303. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13304. Default value is @code{4096x2048}.
  13305. @item mode
  13306. Specify display mode.
  13307. It accepts the following values:
  13308. @table @samp
  13309. @item combined
  13310. all channels are displayed in the same row
  13311. @item separate
  13312. all channels are displayed in separate rows
  13313. @end table
  13314. Default value is @samp{combined}.
  13315. @item color
  13316. Specify display color mode.
  13317. It accepts the following values:
  13318. @table @samp
  13319. @item channel
  13320. each channel is displayed in a separate color
  13321. @item intensity
  13322. each channel is displayed using the same color scheme
  13323. @item rainbow
  13324. each channel is displayed using the rainbow color scheme
  13325. @item moreland
  13326. each channel is displayed using the moreland color scheme
  13327. @item nebulae
  13328. each channel is displayed using the nebulae color scheme
  13329. @item fire
  13330. each channel is displayed using the fire color scheme
  13331. @item fiery
  13332. each channel is displayed using the fiery color scheme
  13333. @item fruit
  13334. each channel is displayed using the fruit color scheme
  13335. @item cool
  13336. each channel is displayed using the cool color scheme
  13337. @end table
  13338. Default value is @samp{intensity}.
  13339. @item scale
  13340. Specify scale used for calculating intensity color values.
  13341. It accepts the following values:
  13342. @table @samp
  13343. @item lin
  13344. linear
  13345. @item sqrt
  13346. square root, default
  13347. @item cbrt
  13348. cubic root
  13349. @item log
  13350. logarithmic
  13351. @item 4thrt
  13352. 4th root
  13353. @item 5thrt
  13354. 5th root
  13355. @end table
  13356. Default value is @samp{log}.
  13357. @item saturation
  13358. Set saturation modifier for displayed colors. Negative values provide
  13359. alternative color scheme. @code{0} is no saturation at all.
  13360. Saturation must be in [-10.0, 10.0] range.
  13361. Default value is @code{1}.
  13362. @item win_func
  13363. Set window function.
  13364. It accepts the following values:
  13365. @table @samp
  13366. @item rect
  13367. @item bartlett
  13368. @item hann
  13369. @item hanning
  13370. @item hamming
  13371. @item blackman
  13372. @item welch
  13373. @item flattop
  13374. @item bharris
  13375. @item bnuttall
  13376. @item bhann
  13377. @item sine
  13378. @item nuttall
  13379. @item lanczos
  13380. @item gauss
  13381. @item tukey
  13382. @item dolph
  13383. @item cauchy
  13384. @item parzen
  13385. @item poisson
  13386. @end table
  13387. Default value is @code{hann}.
  13388. @item orientation
  13389. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13390. @code{horizontal}. Default is @code{vertical}.
  13391. @item gain
  13392. Set scale gain for calculating intensity color values.
  13393. Default value is @code{1}.
  13394. @item legend
  13395. Draw time and frequency axes and legends. Default is enabled.
  13396. @item rotation
  13397. Set color rotation, must be in [-1.0, 1.0] range.
  13398. Default value is @code{0}.
  13399. @end table
  13400. @subsection Examples
  13401. @itemize
  13402. @item
  13403. Extract an audio spectrogram of a whole audio track
  13404. in a 1024x1024 picture using @command{ffmpeg}:
  13405. @example
  13406. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13407. @end example
  13408. @end itemize
  13409. @section showvolume
  13410. Convert input audio volume to a video output.
  13411. The filter accepts the following options:
  13412. @table @option
  13413. @item rate, r
  13414. Set video rate.
  13415. @item b
  13416. Set border width, allowed range is [0, 5]. Default is 1.
  13417. @item w
  13418. Set channel width, allowed range is [80, 8192]. Default is 400.
  13419. @item h
  13420. Set channel height, allowed range is [1, 900]. Default is 20.
  13421. @item f
  13422. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13423. @item c
  13424. Set volume color expression.
  13425. The expression can use the following variables:
  13426. @table @option
  13427. @item VOLUME
  13428. Current max volume of channel in dB.
  13429. @item PEAK
  13430. Current peak.
  13431. @item CHANNEL
  13432. Current channel number, starting from 0.
  13433. @end table
  13434. @item t
  13435. If set, displays channel names. Default is enabled.
  13436. @item v
  13437. If set, displays volume values. Default is enabled.
  13438. @item o
  13439. Set orientation, can be @code{horizontal} or @code{vertical},
  13440. default is @code{horizontal}.
  13441. @item s
  13442. Set step size, allowed range s [0, 5]. Default is 0, which means
  13443. step is disabled.
  13444. @end table
  13445. @section showwaves
  13446. Convert input audio to a video output, representing the samples waves.
  13447. The filter accepts the following options:
  13448. @table @option
  13449. @item size, s
  13450. Specify the video size for the output. For the syntax of this option, check the
  13451. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13452. Default value is @code{600x240}.
  13453. @item mode
  13454. Set display mode.
  13455. Available values are:
  13456. @table @samp
  13457. @item point
  13458. Draw a point for each sample.
  13459. @item line
  13460. Draw a vertical line for each sample.
  13461. @item p2p
  13462. Draw a point for each sample and a line between them.
  13463. @item cline
  13464. Draw a centered vertical line for each sample.
  13465. @end table
  13466. Default value is @code{point}.
  13467. @item n
  13468. Set the number of samples which are printed on the same column. A
  13469. larger value will decrease the frame rate. Must be a positive
  13470. integer. This option can be set only if the value for @var{rate}
  13471. is not explicitly specified.
  13472. @item rate, r
  13473. Set the (approximate) output frame rate. This is done by setting the
  13474. option @var{n}. Default value is "25".
  13475. @item split_channels
  13476. Set if channels should be drawn separately or overlap. Default value is 0.
  13477. @item colors
  13478. Set colors separated by '|' which are going to be used for drawing of each channel.
  13479. @item scale
  13480. Set amplitude scale.
  13481. Available values are:
  13482. @table @samp
  13483. @item lin
  13484. Linear.
  13485. @item log
  13486. Logarithmic.
  13487. @item sqrt
  13488. Square root.
  13489. @item cbrt
  13490. Cubic root.
  13491. @end table
  13492. Default is linear.
  13493. @end table
  13494. @subsection Examples
  13495. @itemize
  13496. @item
  13497. Output the input file audio and the corresponding video representation
  13498. at the same time:
  13499. @example
  13500. amovie=a.mp3,asplit[out0],showwaves[out1]
  13501. @end example
  13502. @item
  13503. Create a synthetic signal and show it with showwaves, forcing a
  13504. frame rate of 30 frames per second:
  13505. @example
  13506. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13507. @end example
  13508. @end itemize
  13509. @section showwavespic
  13510. Convert input audio to a single video frame, representing the samples waves.
  13511. The filter accepts the following options:
  13512. @table @option
  13513. @item size, s
  13514. Specify the video size for the output. For the syntax of this option, check the
  13515. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13516. Default value is @code{600x240}.
  13517. @item split_channels
  13518. Set if channels should be drawn separately or overlap. Default value is 0.
  13519. @item colors
  13520. Set colors separated by '|' which are going to be used for drawing of each channel.
  13521. @item scale
  13522. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13523. Default is linear.
  13524. @end table
  13525. @subsection Examples
  13526. @itemize
  13527. @item
  13528. Extract a channel split representation of the wave form of a whole audio track
  13529. in a 1024x800 picture using @command{ffmpeg}:
  13530. @example
  13531. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13532. @end example
  13533. @end itemize
  13534. @section sidedata, asidedata
  13535. Delete frame side data, or select frames based on it.
  13536. This filter accepts the following options:
  13537. @table @option
  13538. @item mode
  13539. Set mode of operation of the filter.
  13540. Can be one of the following:
  13541. @table @samp
  13542. @item select
  13543. Select every frame with side data of @code{type}.
  13544. @item delete
  13545. Delete side data of @code{type}. If @code{type} is not set, delete all side
  13546. data in the frame.
  13547. @end table
  13548. @item type
  13549. Set side data type used with all modes. Must be set for @code{select} mode. For
  13550. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  13551. in @file{libavutil/frame.h}. For example, to choose
  13552. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  13553. @end table
  13554. @section spectrumsynth
  13555. Sythesize audio from 2 input video spectrums, first input stream represents
  13556. magnitude across time and second represents phase across time.
  13557. The filter will transform from frequency domain as displayed in videos back
  13558. to time domain as presented in audio output.
  13559. This filter is primarily created for reversing processed @ref{showspectrum}
  13560. filter outputs, but can synthesize sound from other spectrograms too.
  13561. But in such case results are going to be poor if the phase data is not
  13562. available, because in such cases phase data need to be recreated, usually
  13563. its just recreated from random noise.
  13564. For best results use gray only output (@code{channel} color mode in
  13565. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13566. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13567. @code{data} option. Inputs videos should generally use @code{fullframe}
  13568. slide mode as that saves resources needed for decoding video.
  13569. The filter accepts the following options:
  13570. @table @option
  13571. @item sample_rate
  13572. Specify sample rate of output audio, the sample rate of audio from which
  13573. spectrum was generated may differ.
  13574. @item channels
  13575. Set number of channels represented in input video spectrums.
  13576. @item scale
  13577. Set scale which was used when generating magnitude input spectrum.
  13578. Can be @code{lin} or @code{log}. Default is @code{log}.
  13579. @item slide
  13580. Set slide which was used when generating inputs spectrums.
  13581. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13582. Default is @code{fullframe}.
  13583. @item win_func
  13584. Set window function used for resynthesis.
  13585. @item overlap
  13586. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13587. which means optimal overlap for selected window function will be picked.
  13588. @item orientation
  13589. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13590. Default is @code{vertical}.
  13591. @end table
  13592. @subsection Examples
  13593. @itemize
  13594. @item
  13595. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13596. then resynthesize videos back to audio with spectrumsynth:
  13597. @example
  13598. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
  13599. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
  13600. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13601. @end example
  13602. @end itemize
  13603. @section split, asplit
  13604. Split input into several identical outputs.
  13605. @code{asplit} works with audio input, @code{split} with video.
  13606. The filter accepts a single parameter which specifies the number of outputs. If
  13607. unspecified, it defaults to 2.
  13608. @subsection Examples
  13609. @itemize
  13610. @item
  13611. Create two separate outputs from the same input:
  13612. @example
  13613. [in] split [out0][out1]
  13614. @end example
  13615. @item
  13616. To create 3 or more outputs, you need to specify the number of
  13617. outputs, like in:
  13618. @example
  13619. [in] asplit=3 [out0][out1][out2]
  13620. @end example
  13621. @item
  13622. Create two separate outputs from the same input, one cropped and
  13623. one padded:
  13624. @example
  13625. [in] split [splitout1][splitout2];
  13626. [splitout1] crop=100:100:0:0 [cropout];
  13627. [splitout2] pad=200:200:100:100 [padout];
  13628. @end example
  13629. @item
  13630. Create 5 copies of the input audio with @command{ffmpeg}:
  13631. @example
  13632. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13633. @end example
  13634. @end itemize
  13635. @section zmq, azmq
  13636. Receive commands sent through a libzmq client, and forward them to
  13637. filters in the filtergraph.
  13638. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13639. must be inserted between two video filters, @code{azmq} between two
  13640. audio filters.
  13641. To enable these filters you need to install the libzmq library and
  13642. headers and configure FFmpeg with @code{--enable-libzmq}.
  13643. For more information about libzmq see:
  13644. @url{http://www.zeromq.org/}
  13645. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13646. receives messages sent through a network interface defined by the
  13647. @option{bind_address} option.
  13648. The received message must be in the form:
  13649. @example
  13650. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13651. @end example
  13652. @var{TARGET} specifies the target of the command, usually the name of
  13653. the filter class or a specific filter instance name.
  13654. @var{COMMAND} specifies the name of the command for the target filter.
  13655. @var{ARG} is optional and specifies the optional argument list for the
  13656. given @var{COMMAND}.
  13657. Upon reception, the message is processed and the corresponding command
  13658. is injected into the filtergraph. Depending on the result, the filter
  13659. will send a reply to the client, adopting the format:
  13660. @example
  13661. @var{ERROR_CODE} @var{ERROR_REASON}
  13662. @var{MESSAGE}
  13663. @end example
  13664. @var{MESSAGE} is optional.
  13665. @subsection Examples
  13666. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13667. be used to send commands processed by these filters.
  13668. Consider the following filtergraph generated by @command{ffplay}
  13669. @example
  13670. ffplay -dumpgraph 1 -f lavfi "
  13671. color=s=100x100:c=red [l];
  13672. color=s=100x100:c=blue [r];
  13673. nullsrc=s=200x100, zmq [bg];
  13674. [bg][l] overlay [bg+l];
  13675. [bg+l][r] overlay=x=100 "
  13676. @end example
  13677. To change the color of the left side of the video, the following
  13678. command can be used:
  13679. @example
  13680. echo Parsed_color_0 c yellow | tools/zmqsend
  13681. @end example
  13682. To change the right side:
  13683. @example
  13684. echo Parsed_color_1 c pink | tools/zmqsend
  13685. @end example
  13686. @c man end MULTIMEDIA FILTERS
  13687. @chapter Multimedia Sources
  13688. @c man begin MULTIMEDIA SOURCES
  13689. Below is a description of the currently available multimedia sources.
  13690. @section amovie
  13691. This is the same as @ref{movie} source, except it selects an audio
  13692. stream by default.
  13693. @anchor{movie}
  13694. @section movie
  13695. Read audio and/or video stream(s) from a movie container.
  13696. It accepts the following parameters:
  13697. @table @option
  13698. @item filename
  13699. The name of the resource to read (not necessarily a file; it can also be a
  13700. device or a stream accessed through some protocol).
  13701. @item format_name, f
  13702. Specifies the format assumed for the movie to read, and can be either
  13703. the name of a container or an input device. If not specified, the
  13704. format is guessed from @var{movie_name} or by probing.
  13705. @item seek_point, sp
  13706. Specifies the seek point in seconds. The frames will be output
  13707. starting from this seek point. The parameter is evaluated with
  13708. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13709. postfix. The default value is "0".
  13710. @item streams, s
  13711. Specifies the streams to read. Several streams can be specified,
  13712. separated by "+". The source will then have as many outputs, in the
  13713. same order. The syntax is explained in the ``Stream specifiers''
  13714. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13715. respectively the default (best suited) video and audio stream. Default
  13716. is "dv", or "da" if the filter is called as "amovie".
  13717. @item stream_index, si
  13718. Specifies the index of the video stream to read. If the value is -1,
  13719. the most suitable video stream will be automatically selected. The default
  13720. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13721. audio instead of video.
  13722. @item loop
  13723. Specifies how many times to read the stream in sequence.
  13724. If the value is less than 1, the stream will be read again and again.
  13725. Default value is "1".
  13726. Note that when the movie is looped the source timestamps are not
  13727. changed, so it will generate non monotonically increasing timestamps.
  13728. @item discontinuity
  13729. Specifies the time difference between frames above which the point is
  13730. considered a timestamp discontinuity which is removed by adjusting the later
  13731. timestamps.
  13732. @end table
  13733. It allows overlaying a second video on top of the main input of
  13734. a filtergraph, as shown in this graph:
  13735. @example
  13736. input -----------> deltapts0 --> overlay --> output
  13737. ^
  13738. |
  13739. movie --> scale--> deltapts1 -------+
  13740. @end example
  13741. @subsection Examples
  13742. @itemize
  13743. @item
  13744. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13745. on top of the input labelled "in":
  13746. @example
  13747. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13748. [in] setpts=PTS-STARTPTS [main];
  13749. [main][over] overlay=16:16 [out]
  13750. @end example
  13751. @item
  13752. Read from a video4linux2 device, and overlay it on top of the input
  13753. labelled "in":
  13754. @example
  13755. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13756. [in] setpts=PTS-STARTPTS [main];
  13757. [main][over] overlay=16:16 [out]
  13758. @end example
  13759. @item
  13760. Read the first video stream and the audio stream with id 0x81 from
  13761. dvd.vob; the video is connected to the pad named "video" and the audio is
  13762. connected to the pad named "audio":
  13763. @example
  13764. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13765. @end example
  13766. @end itemize
  13767. @subsection Commands
  13768. Both movie and amovie support the following commands:
  13769. @table @option
  13770. @item seek
  13771. Perform seek using "av_seek_frame".
  13772. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13773. @itemize
  13774. @item
  13775. @var{stream_index}: If stream_index is -1, a default
  13776. stream is selected, and @var{timestamp} is automatically converted
  13777. from AV_TIME_BASE units to the stream specific time_base.
  13778. @item
  13779. @var{timestamp}: Timestamp in AVStream.time_base units
  13780. or, if no stream is specified, in AV_TIME_BASE units.
  13781. @item
  13782. @var{flags}: Flags which select direction and seeking mode.
  13783. @end itemize
  13784. @item get_duration
  13785. Get movie duration in AV_TIME_BASE units.
  13786. @end table
  13787. @c man end MULTIMEDIA SOURCES