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.

18691 lines
496KB

  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. See @code{ffmpeg -filters} to view which filters have timeline support.
  248. @c man end FILTERGRAPH DESCRIPTION
  249. @chapter Audio Filters
  250. @c man begin AUDIO FILTERS
  251. When you configure your FFmpeg build, you can disable any of the
  252. existing filters using @code{--disable-filters}.
  253. The configure output will show the audio filters included in your
  254. build.
  255. Below is a description of the currently available audio filters.
  256. @section acompressor
  257. A compressor is mainly used to reduce the dynamic range of a signal.
  258. Especially modern music is mostly compressed at a high ratio to
  259. improve the overall loudness. It's done to get the highest attention
  260. of a listener, "fatten" the sound and bring more "power" to the track.
  261. If a signal is compressed too much it may sound dull or "dead"
  262. afterwards or it may start to "pump" (which could be a powerful effect
  263. but can also destroy a track completely).
  264. The right compression is the key to reach a professional sound and is
  265. the high art of mixing and mastering. Because of its complex settings
  266. it may take a long time to get the right feeling for this kind of effect.
  267. Compression is done by detecting the volume above a chosen level
  268. @code{threshold} and dividing it by the factor set with @code{ratio}.
  269. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  270. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  271. the signal would cause distortion of the waveform the reduction can be
  272. levelled over the time. This is done by setting "Attack" and "Release".
  273. @code{attack} determines how long the signal has to rise above the threshold
  274. before any reduction will occur and @code{release} sets the time the signal
  275. has to fall below the threshold to reduce the reduction again. Shorter signals
  276. than the chosen attack time will be left untouched.
  277. The overall reduction of the signal can be made up afterwards with the
  278. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  279. raising the makeup to this level results in a signal twice as loud than the
  280. source. To gain a softer entry in the compression the @code{knee} flattens the
  281. hard edge at the threshold in the range of the chosen decibels.
  282. The filter accepts the following options:
  283. @table @option
  284. @item level_in
  285. Set input gain. Default is 1. Range is between 0.015625 and 64.
  286. @item threshold
  287. If a signal of second stream rises above this level it will affect the gain
  288. reduction of the first stream.
  289. By default it is 0.125. Range is between 0.00097563 and 1.
  290. @item ratio
  291. Set a ratio by which the signal is reduced. 1:2 means that if the level
  292. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  293. Default is 2. Range is between 1 and 20.
  294. @item attack
  295. Amount of milliseconds the signal has to rise above the threshold before gain
  296. reduction starts. Default is 20. Range is between 0.01 and 2000.
  297. @item release
  298. Amount of milliseconds the signal has to fall below the threshold before
  299. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  300. @item makeup
  301. Set the amount by how much signal will be amplified after processing.
  302. Default is 2. Range is from 1 and 64.
  303. @item knee
  304. Curve the sharp knee around the threshold to enter gain reduction more softly.
  305. Default is 2.82843. Range is between 1 and 8.
  306. @item link
  307. Choose if the @code{average} level between all channels of input stream
  308. or the louder(@code{maximum}) channel of input stream affects the
  309. reduction. Default is @code{average}.
  310. @item detection
  311. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  312. of @code{rms}. Default is @code{rms} which is mostly smoother.
  313. @item mix
  314. How much to use compressed signal in output. Default is 1.
  315. Range is between 0 and 1.
  316. @end table
  317. @section acopy
  318. Copy the input audio source unchanged to the output. This is mainly useful for
  319. testing purposes.
  320. @section acrossfade
  321. Apply cross fade from one input audio stream to another input audio stream.
  322. The cross fade is applied for specified duration near the end of first stream.
  323. The filter accepts the following options:
  324. @table @option
  325. @item nb_samples, ns
  326. Specify the number of samples for which the cross fade effect has to last.
  327. At the end of the cross fade effect the first input audio will be completely
  328. silent. Default is 44100.
  329. @item duration, d
  330. Specify the duration of the cross fade effect. See
  331. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  332. for the accepted syntax.
  333. By default the duration is determined by @var{nb_samples}.
  334. If set this option is used instead of @var{nb_samples}.
  335. @item overlap, o
  336. Should first stream end overlap with second stream start. Default is enabled.
  337. @item curve1
  338. Set curve for cross fade transition for first stream.
  339. @item curve2
  340. Set curve for cross fade transition for second stream.
  341. For description of available curve types see @ref{afade} filter description.
  342. @end table
  343. @subsection Examples
  344. @itemize
  345. @item
  346. Cross fade from one input to another:
  347. @example
  348. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  349. @end example
  350. @item
  351. Cross fade from one input to another but without overlapping:
  352. @example
  353. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  354. @end example
  355. @end itemize
  356. @section acrusher
  357. Reduce audio bit resolution.
  358. This filter is bit crusher with enhanced functionality. A bit crusher
  359. is used to audibly reduce number of bits an audio signal is sampled
  360. with. This doesn't change the bit depth at all, it just produces the
  361. effect. Material reduced in bit depth sounds more harsh and "digital".
  362. This filter is able to even round to continuous values instead of discrete
  363. bit depths.
  364. Additionally it has a D/C offset which results in different crushing of
  365. the lower and the upper half of the signal.
  366. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  367. Another feature of this filter is the logarithmic mode.
  368. This setting switches from linear distances between bits to logarithmic ones.
  369. The result is a much more "natural" sounding crusher which doesn't gate low
  370. signals for example. The human ear has a logarithmic perception, too
  371. so this kind of crushing is much more pleasant.
  372. Logarithmic crushing is also able to get anti-aliased.
  373. The filter accepts the following options:
  374. @table @option
  375. @item level_in
  376. Set level in.
  377. @item level_out
  378. Set level out.
  379. @item bits
  380. Set bit reduction.
  381. @item mix
  382. Set mixing amount.
  383. @item mode
  384. Can be linear: @code{lin} or logarithmic: @code{log}.
  385. @item dc
  386. Set DC.
  387. @item aa
  388. Set anti-aliasing.
  389. @item samples
  390. Set sample reduction.
  391. @item lfo
  392. Enable LFO. By default disabled.
  393. @item lforange
  394. Set LFO range.
  395. @item lforate
  396. Set LFO rate.
  397. @end table
  398. @section adelay
  399. Delay one or more audio channels.
  400. Samples in delayed channel are filled with silence.
  401. The filter accepts the following option:
  402. @table @option
  403. @item delays
  404. Set list of delays in milliseconds for each channel separated by '|'.
  405. At least one delay greater than 0 should be provided.
  406. Unused delays will be silently ignored. If number of given delays is
  407. smaller than number of channels all remaining channels will not be delayed.
  408. If you want to delay exact number of samples, append 'S' to number.
  409. @end table
  410. @subsection Examples
  411. @itemize
  412. @item
  413. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  414. the second channel (and any other channels that may be present) unchanged.
  415. @example
  416. adelay=1500|0|500
  417. @end example
  418. @item
  419. Delay second channel by 500 samples, the third channel by 700 samples and leave
  420. the first channel (and any other channels that may be present) unchanged.
  421. @example
  422. adelay=0|500S|700S
  423. @end example
  424. @end itemize
  425. @section aecho
  426. Apply echoing to the input audio.
  427. Echoes are reflected sound and can occur naturally amongst mountains
  428. (and sometimes large buildings) when talking or shouting; digital echo
  429. effects emulate this behaviour and are often used to help fill out the
  430. sound of a single instrument or vocal. The time difference between the
  431. original signal and the reflection is the @code{delay}, and the
  432. loudness of the reflected signal is the @code{decay}.
  433. Multiple echoes can have different delays and decays.
  434. A description of the accepted parameters follows.
  435. @table @option
  436. @item in_gain
  437. Set input gain of reflected signal. Default is @code{0.6}.
  438. @item out_gain
  439. Set output gain of reflected signal. Default is @code{0.3}.
  440. @item delays
  441. Set list of time intervals in milliseconds between original signal and reflections
  442. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  443. Default is @code{1000}.
  444. @item decays
  445. Set list of loudnesses of reflected signals separated by '|'.
  446. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  447. Default is @code{0.5}.
  448. @end table
  449. @subsection Examples
  450. @itemize
  451. @item
  452. Make it sound as if there are twice as many instruments as are actually playing:
  453. @example
  454. aecho=0.8:0.88:60:0.4
  455. @end example
  456. @item
  457. If delay is very short, then it sound like a (metallic) robot playing music:
  458. @example
  459. aecho=0.8:0.88:6:0.4
  460. @end example
  461. @item
  462. A longer delay will sound like an open air concert in the mountains:
  463. @example
  464. aecho=0.8:0.9:1000:0.3
  465. @end example
  466. @item
  467. Same as above but with one more mountain:
  468. @example
  469. aecho=0.8:0.9:1000|1800:0.3|0.25
  470. @end example
  471. @end itemize
  472. @section aemphasis
  473. Audio emphasis filter creates or restores material directly taken from LPs or
  474. emphased CDs with different filter curves. E.g. to store music on vinyl the
  475. signal has to be altered by a filter first to even out the disadvantages of
  476. this recording medium.
  477. Once the material is played back the inverse filter has to be applied to
  478. restore the distortion of the frequency response.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set input gain.
  483. @item level_out
  484. Set output gain.
  485. @item mode
  486. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  487. use @code{production} mode. Default is @code{reproduction} mode.
  488. @item type
  489. Set filter type. Selects medium. Can be one of the following:
  490. @table @option
  491. @item col
  492. select Columbia.
  493. @item emi
  494. select EMI.
  495. @item bsi
  496. select BSI (78RPM).
  497. @item riaa
  498. select RIAA.
  499. @item cd
  500. select Compact Disc (CD).
  501. @item 50fm
  502. select 50µs (FM).
  503. @item 75fm
  504. select 75µs (FM).
  505. @item 50kf
  506. select 50µs (FM-KF).
  507. @item 75kf
  508. select 75µs (FM-KF).
  509. @end table
  510. @end table
  511. @section aeval
  512. Modify an audio signal according to the specified expressions.
  513. This filter accepts one or more expressions (one for each channel),
  514. which are evaluated and used to modify a corresponding audio signal.
  515. It accepts the following parameters:
  516. @table @option
  517. @item exprs
  518. Set the '|'-separated expressions list for each separate channel. If
  519. the number of input channels is greater than the number of
  520. expressions, the last specified expression is used for the remaining
  521. output channels.
  522. @item channel_layout, c
  523. Set output channel layout. If not specified, the channel layout is
  524. specified by the number of expressions. If set to @samp{same}, it will
  525. use by default the same input channel layout.
  526. @end table
  527. Each expression in @var{exprs} can contain the following constants and functions:
  528. @table @option
  529. @item ch
  530. channel number of the current expression
  531. @item n
  532. number of the evaluated sample, starting from 0
  533. @item s
  534. sample rate
  535. @item t
  536. time of the evaluated sample expressed in seconds
  537. @item nb_in_channels
  538. @item nb_out_channels
  539. input and output number of channels
  540. @item val(CH)
  541. the value of input channel with number @var{CH}
  542. @end table
  543. Note: this filter is slow. For faster processing you should use a
  544. dedicated filter.
  545. @subsection Examples
  546. @itemize
  547. @item
  548. Half volume:
  549. @example
  550. aeval=val(ch)/2:c=same
  551. @end example
  552. @item
  553. Invert phase of the second channel:
  554. @example
  555. aeval=val(0)|-val(1)
  556. @end example
  557. @end itemize
  558. @anchor{afade}
  559. @section afade
  560. Apply fade-in/out effect to input audio.
  561. A description of the accepted parameters follows.
  562. @table @option
  563. @item type, t
  564. Specify the effect type, can be either @code{in} for fade-in, or
  565. @code{out} for a fade-out effect. Default is @code{in}.
  566. @item start_sample, ss
  567. Specify the number of the start sample for starting to apply the fade
  568. effect. Default is 0.
  569. @item nb_samples, ns
  570. Specify the number of samples for which the fade effect has to last. At
  571. the end of the fade-in effect the output audio will have the same
  572. volume as the input audio, at the end of the fade-out transition
  573. the output audio will be silence. Default is 44100.
  574. @item start_time, st
  575. Specify the start time of the fade effect. Default is 0.
  576. The value must be specified as a time duration; see
  577. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  578. for the accepted syntax.
  579. If set this option is used instead of @var{start_sample}.
  580. @item duration, d
  581. Specify the duration of the fade effect. See
  582. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  583. for the accepted syntax.
  584. At the end of the fade-in effect the output audio will have the same
  585. volume as the input audio, at the end of the fade-out transition
  586. the output audio will be silence.
  587. By default the duration is determined by @var{nb_samples}.
  588. If set this option is used instead of @var{nb_samples}.
  589. @item curve
  590. Set curve for fade transition.
  591. It accepts the following values:
  592. @table @option
  593. @item tri
  594. select triangular, linear slope (default)
  595. @item qsin
  596. select quarter of sine wave
  597. @item hsin
  598. select half of sine wave
  599. @item esin
  600. select exponential sine wave
  601. @item log
  602. select logarithmic
  603. @item ipar
  604. select inverted parabola
  605. @item qua
  606. select quadratic
  607. @item cub
  608. select cubic
  609. @item squ
  610. select square root
  611. @item cbr
  612. select cubic root
  613. @item par
  614. select parabola
  615. @item exp
  616. select exponential
  617. @item iqsin
  618. select inverted quarter of sine wave
  619. @item ihsin
  620. select inverted half of sine wave
  621. @item dese
  622. select double-exponential seat
  623. @item desi
  624. select double-exponential sigmoid
  625. @end table
  626. @end table
  627. @subsection Examples
  628. @itemize
  629. @item
  630. Fade in first 15 seconds of audio:
  631. @example
  632. afade=t=in:ss=0:d=15
  633. @end example
  634. @item
  635. Fade out last 25 seconds of a 900 seconds audio:
  636. @example
  637. afade=t=out:st=875:d=25
  638. @end example
  639. @end itemize
  640. @section afftfilt
  641. Apply arbitrary expressions to samples in frequency domain.
  642. @table @option
  643. @item real
  644. Set frequency domain real expression for each separate channel separated
  645. by '|'. Default is "1".
  646. If the number of input channels is greater than the number of
  647. expressions, the last specified expression is used for the remaining
  648. output channels.
  649. @item imag
  650. Set frequency domain imaginary expression for each separate channel
  651. separated by '|'. If not set, @var{real} option is used.
  652. Each expression in @var{real} and @var{imag} can contain the following
  653. constants:
  654. @table @option
  655. @item sr
  656. sample rate
  657. @item b
  658. current frequency bin number
  659. @item nb
  660. number of available bins
  661. @item ch
  662. channel number of the current expression
  663. @item chs
  664. number of channels
  665. @item pts
  666. current frame pts
  667. @end table
  668. @item win_size
  669. Set window size.
  670. It accepts the following values:
  671. @table @samp
  672. @item w16
  673. @item w32
  674. @item w64
  675. @item w128
  676. @item w256
  677. @item w512
  678. @item w1024
  679. @item w2048
  680. @item w4096
  681. @item w8192
  682. @item w16384
  683. @item w32768
  684. @item w65536
  685. @end table
  686. Default is @code{w4096}
  687. @item win_func
  688. Set window function. Default is @code{hann}.
  689. @item overlap
  690. Set window overlap. If set to 1, the recommended overlap for selected
  691. window function will be picked. Default is @code{0.75}.
  692. @end table
  693. @subsection Examples
  694. @itemize
  695. @item
  696. Leave almost only low frequencies in audio:
  697. @example
  698. afftfilt="1-clip((b/nb)*b,0,1)"
  699. @end example
  700. @end itemize
  701. @section afir
  702. Apply an arbitrary Frequency Impulse Response filter.
  703. This filter is designed for applying long FIR filters,
  704. up to 30 seconds long.
  705. It can be used as component for digital crossover filters,
  706. room equalization, cross talk cancellation, wavefield synthesis,
  707. auralization, ambiophonics and ambisonics.
  708. This filter uses second stream as FIR coefficients.
  709. If second stream holds single channel, it will be used
  710. for all input channels in first stream, otherwise
  711. number of channels in second stream must be same as
  712. number of channels in first stream.
  713. It accepts the following parameters:
  714. @table @option
  715. @item dry
  716. Set dry gain. This sets input gain.
  717. @item wet
  718. Set wet gain. This sets final output gain.
  719. @item length
  720. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  721. @item again
  722. Enable applying gain measured from power of IR.
  723. @end table
  724. @subsection Examples
  725. @itemize
  726. @item
  727. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  728. @example
  729. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  730. @end example
  731. @end itemize
  732. @anchor{aformat}
  733. @section aformat
  734. Set output format constraints for the input audio. The framework will
  735. negotiate the most appropriate format to minimize conversions.
  736. It accepts the following parameters:
  737. @table @option
  738. @item sample_fmts
  739. A '|'-separated list of requested sample formats.
  740. @item sample_rates
  741. A '|'-separated list of requested sample rates.
  742. @item channel_layouts
  743. A '|'-separated list of requested channel layouts.
  744. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  745. for the required syntax.
  746. @end table
  747. If a parameter is omitted, all values are allowed.
  748. Force the output to either unsigned 8-bit or signed 16-bit stereo
  749. @example
  750. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  751. @end example
  752. @section agate
  753. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  754. processing reduces disturbing noise between useful signals.
  755. Gating is done by detecting the volume below a chosen level @var{threshold}
  756. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  757. floor is set via @var{range}. Because an exact manipulation of the signal
  758. would cause distortion of the waveform the reduction can be levelled over
  759. time. This is done by setting @var{attack} and @var{release}.
  760. @var{attack} determines how long the signal has to fall below the threshold
  761. before any reduction will occur and @var{release} sets the time the signal
  762. has to rise above the threshold to reduce the reduction again.
  763. Shorter signals than the chosen attack time will be left untouched.
  764. @table @option
  765. @item level_in
  766. Set input level before filtering.
  767. Default is 1. Allowed range is from 0.015625 to 64.
  768. @item range
  769. Set the level of gain reduction when the signal is below the threshold.
  770. Default is 0.06125. Allowed range is from 0 to 1.
  771. @item threshold
  772. If a signal rises above this level the gain reduction is released.
  773. Default is 0.125. Allowed range is from 0 to 1.
  774. @item ratio
  775. Set a ratio by which the signal is reduced.
  776. Default is 2. Allowed range is from 1 to 9000.
  777. @item attack
  778. Amount of milliseconds the signal has to rise above the threshold before gain
  779. reduction stops.
  780. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  781. @item release
  782. Amount of milliseconds the signal has to fall below the threshold before the
  783. reduction is increased again. Default is 250 milliseconds.
  784. Allowed range is from 0.01 to 9000.
  785. @item makeup
  786. Set amount of amplification of signal after processing.
  787. Default is 1. Allowed range is from 1 to 64.
  788. @item knee
  789. Curve the sharp knee around the threshold to enter gain reduction more softly.
  790. Default is 2.828427125. Allowed range is from 1 to 8.
  791. @item detection
  792. Choose if exact signal should be taken for detection or an RMS like one.
  793. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  794. @item link
  795. Choose if the average level between all channels or the louder channel affects
  796. the reduction.
  797. Default is @code{average}. Can be @code{average} or @code{maximum}.
  798. @end table
  799. @section alimiter
  800. The limiter prevents an input signal from rising over a desired threshold.
  801. This limiter uses lookahead technology to prevent your signal from distorting.
  802. It means that there is a small delay after the signal is processed. Keep in mind
  803. that the delay it produces is the attack time you set.
  804. The filter accepts the following options:
  805. @table @option
  806. @item level_in
  807. Set input gain. Default is 1.
  808. @item level_out
  809. Set output gain. Default is 1.
  810. @item limit
  811. Don't let signals above this level pass the limiter. Default is 1.
  812. @item attack
  813. The limiter will reach its attenuation level in this amount of time in
  814. milliseconds. Default is 5 milliseconds.
  815. @item release
  816. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  817. Default is 50 milliseconds.
  818. @item asc
  819. When gain reduction is always needed ASC takes care of releasing to an
  820. average reduction level rather than reaching a reduction of 0 in the release
  821. time.
  822. @item asc_level
  823. Select how much the release time is affected by ASC, 0 means nearly no changes
  824. in release time while 1 produces higher release times.
  825. @item level
  826. Auto level output signal. Default is enabled.
  827. This normalizes audio back to 0dB if enabled.
  828. @end table
  829. Depending on picked setting it is recommended to upsample input 2x or 4x times
  830. with @ref{aresample} before applying this filter.
  831. @section allpass
  832. Apply a two-pole all-pass filter with central frequency (in Hz)
  833. @var{frequency}, and filter-width @var{width}.
  834. An all-pass filter changes the audio's frequency to phase relationship
  835. without changing its frequency to amplitude relationship.
  836. The filter accepts the following options:
  837. @table @option
  838. @item frequency, f
  839. Set frequency in Hz.
  840. @item width_type
  841. Set method to specify band-width of filter.
  842. @table @option
  843. @item h
  844. Hz
  845. @item q
  846. Q-Factor
  847. @item o
  848. octave
  849. @item s
  850. slope
  851. @end table
  852. @item width, w
  853. Specify the band-width of a filter in width_type units.
  854. @item channels, c
  855. Specify which channels to filter, by default all available are filtered.
  856. @end table
  857. @section aloop
  858. Loop audio samples.
  859. The filter accepts the following options:
  860. @table @option
  861. @item loop
  862. Set the number of loops.
  863. @item size
  864. Set maximal number of samples.
  865. @item start
  866. Set first sample of loop.
  867. @end table
  868. @anchor{amerge}
  869. @section amerge
  870. Merge two or more audio streams into a single multi-channel stream.
  871. The filter accepts the following options:
  872. @table @option
  873. @item inputs
  874. Set the number of inputs. Default is 2.
  875. @end table
  876. If the channel layouts of the inputs are disjoint, and therefore compatible,
  877. the channel layout of the output will be set accordingly and the channels
  878. will be reordered as necessary. If the channel layouts of the inputs are not
  879. disjoint, the output will have all the channels of the first input then all
  880. the channels of the second input, in that order, and the channel layout of
  881. the output will be the default value corresponding to the total number of
  882. channels.
  883. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  884. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  885. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  886. first input, b1 is the first channel of the second input).
  887. On the other hand, if both input are in stereo, the output channels will be
  888. in the default order: a1, a2, b1, b2, and the channel layout will be
  889. arbitrarily set to 4.0, which may or may not be the expected value.
  890. All inputs must have the same sample rate, and format.
  891. If inputs do not have the same duration, the output will stop with the
  892. shortest.
  893. @subsection Examples
  894. @itemize
  895. @item
  896. Merge two mono files into a stereo stream:
  897. @example
  898. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  899. @end example
  900. @item
  901. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  902. @example
  903. 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
  904. @end example
  905. @end itemize
  906. @section amix
  907. Mixes multiple audio inputs into a single output.
  908. Note that this filter only supports float samples (the @var{amerge}
  909. and @var{pan} audio filters support many formats). If the @var{amix}
  910. input has integer samples then @ref{aresample} will be automatically
  911. inserted to perform the conversion to float samples.
  912. For example
  913. @example
  914. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  915. @end example
  916. will mix 3 input audio streams to a single output with the same duration as the
  917. first input and a dropout transition time of 3 seconds.
  918. It accepts the following parameters:
  919. @table @option
  920. @item inputs
  921. The number of inputs. If unspecified, it defaults to 2.
  922. @item duration
  923. How to determine the end-of-stream.
  924. @table @option
  925. @item longest
  926. The duration of the longest input. (default)
  927. @item shortest
  928. The duration of the shortest input.
  929. @item first
  930. The duration of the first input.
  931. @end table
  932. @item dropout_transition
  933. The transition time, in seconds, for volume renormalization when an input
  934. stream ends. The default value is 2 seconds.
  935. @end table
  936. @section anequalizer
  937. High-order parametric multiband equalizer for each channel.
  938. It accepts the following parameters:
  939. @table @option
  940. @item params
  941. This option string is in format:
  942. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  943. Each equalizer band is separated by '|'.
  944. @table @option
  945. @item chn
  946. Set channel number to which equalization will be applied.
  947. If input doesn't have that channel the entry is ignored.
  948. @item f
  949. Set central frequency for band.
  950. If input doesn't have that frequency the entry is ignored.
  951. @item w
  952. Set band width in hertz.
  953. @item g
  954. Set band gain in dB.
  955. @item t
  956. Set filter type for band, optional, can be:
  957. @table @samp
  958. @item 0
  959. Butterworth, this is default.
  960. @item 1
  961. Chebyshev type 1.
  962. @item 2
  963. Chebyshev type 2.
  964. @end table
  965. @end table
  966. @item curves
  967. With this option activated frequency response of anequalizer is displayed
  968. in video stream.
  969. @item size
  970. Set video stream size. Only useful if curves option is activated.
  971. @item mgain
  972. Set max gain that will be displayed. Only useful if curves option is activated.
  973. Setting this to a reasonable value makes it possible to display gain which is derived from
  974. neighbour bands which are too close to each other and thus produce higher gain
  975. when both are activated.
  976. @item fscale
  977. Set frequency scale used to draw frequency response in video output.
  978. Can be linear or logarithmic. Default is logarithmic.
  979. @item colors
  980. Set color for each channel curve which is going to be displayed in video stream.
  981. This is list of color names separated by space or by '|'.
  982. Unrecognised or missing colors will be replaced by white color.
  983. @end table
  984. @subsection Examples
  985. @itemize
  986. @item
  987. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  988. for first 2 channels using Chebyshev type 1 filter:
  989. @example
  990. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  991. @end example
  992. @end itemize
  993. @subsection Commands
  994. This filter supports the following commands:
  995. @table @option
  996. @item change
  997. Alter existing filter parameters.
  998. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  999. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1000. error is returned.
  1001. @var{freq} set new frequency parameter.
  1002. @var{width} set new width parameter in herz.
  1003. @var{gain} set new gain parameter in dB.
  1004. Full filter invocation with asendcmd may look like this:
  1005. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1006. @end table
  1007. @section anull
  1008. Pass the audio source unchanged to the output.
  1009. @section apad
  1010. Pad the end of an audio stream with silence.
  1011. This can be used together with @command{ffmpeg} @option{-shortest} to
  1012. extend audio streams to the same length as the video stream.
  1013. A description of the accepted options follows.
  1014. @table @option
  1015. @item packet_size
  1016. Set silence packet size. Default value is 4096.
  1017. @item pad_len
  1018. Set the number of samples of silence to add to the end. After the
  1019. value is reached, the stream is terminated. This option is mutually
  1020. exclusive with @option{whole_len}.
  1021. @item whole_len
  1022. Set the minimum total number of samples in the output audio stream. If
  1023. the value is longer than the input audio length, silence is added to
  1024. the end, until the value is reached. This option is mutually exclusive
  1025. with @option{pad_len}.
  1026. @end table
  1027. If neither the @option{pad_len} nor the @option{whole_len} option is
  1028. set, the filter will add silence to the end of the input stream
  1029. indefinitely.
  1030. @subsection Examples
  1031. @itemize
  1032. @item
  1033. Add 1024 samples of silence to the end of the input:
  1034. @example
  1035. apad=pad_len=1024
  1036. @end example
  1037. @item
  1038. Make sure the audio output will contain at least 10000 samples, pad
  1039. the input with silence if required:
  1040. @example
  1041. apad=whole_len=10000
  1042. @end example
  1043. @item
  1044. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1045. video stream will always result the shortest and will be converted
  1046. until the end in the output file when using the @option{shortest}
  1047. option:
  1048. @example
  1049. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1050. @end example
  1051. @end itemize
  1052. @section aphaser
  1053. Add a phasing effect to the input audio.
  1054. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1055. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1056. A description of the accepted parameters follows.
  1057. @table @option
  1058. @item in_gain
  1059. Set input gain. Default is 0.4.
  1060. @item out_gain
  1061. Set output gain. Default is 0.74
  1062. @item delay
  1063. Set delay in milliseconds. Default is 3.0.
  1064. @item decay
  1065. Set decay. Default is 0.4.
  1066. @item speed
  1067. Set modulation speed in Hz. Default is 0.5.
  1068. @item type
  1069. Set modulation type. Default is triangular.
  1070. It accepts the following values:
  1071. @table @samp
  1072. @item triangular, t
  1073. @item sinusoidal, s
  1074. @end table
  1075. @end table
  1076. @section apulsator
  1077. Audio pulsator is something between an autopanner and a tremolo.
  1078. But it can produce funny stereo effects as well. Pulsator changes the volume
  1079. of the left and right channel based on a LFO (low frequency oscillator) with
  1080. different waveforms and shifted phases.
  1081. This filter have the ability to define an offset between left and right
  1082. channel. An offset of 0 means that both LFO shapes match each other.
  1083. The left and right channel are altered equally - a conventional tremolo.
  1084. An offset of 50% means that the shape of the right channel is exactly shifted
  1085. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1086. an autopanner. At 1 both curves match again. Every setting in between moves the
  1087. phase shift gapless between all stages and produces some "bypassing" sounds with
  1088. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1089. the 0.5) the faster the signal passes from the left to the right speaker.
  1090. The filter accepts the following options:
  1091. @table @option
  1092. @item level_in
  1093. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1094. @item level_out
  1095. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1096. @item mode
  1097. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1098. sawup or sawdown. Default is sine.
  1099. @item amount
  1100. Set modulation. Define how much of original signal is affected by the LFO.
  1101. @item offset_l
  1102. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1103. @item offset_r
  1104. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1105. @item width
  1106. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1107. @item timing
  1108. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1109. @item bpm
  1110. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1111. is set to bpm.
  1112. @item ms
  1113. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1114. is set to ms.
  1115. @item hz
  1116. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1117. if timing is set to hz.
  1118. @end table
  1119. @anchor{aresample}
  1120. @section aresample
  1121. Resample the input audio to the specified parameters, using the
  1122. libswresample library. If none are specified then the filter will
  1123. automatically convert between its input and output.
  1124. This filter is also able to stretch/squeeze the audio data to make it match
  1125. the timestamps or to inject silence / cut out audio to make it match the
  1126. timestamps, do a combination of both or do neither.
  1127. The filter accepts the syntax
  1128. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1129. expresses a sample rate and @var{resampler_options} is a list of
  1130. @var{key}=@var{value} pairs, separated by ":". See the
  1131. @ref{Resampler Options,,the "Resampler Options" section in the
  1132. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1133. for the complete list of supported options.
  1134. @subsection Examples
  1135. @itemize
  1136. @item
  1137. Resample the input audio to 44100Hz:
  1138. @example
  1139. aresample=44100
  1140. @end example
  1141. @item
  1142. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1143. samples per second compensation:
  1144. @example
  1145. aresample=async=1000
  1146. @end example
  1147. @end itemize
  1148. @section areverse
  1149. Reverse an audio clip.
  1150. Warning: This filter requires memory to buffer the entire clip, so trimming
  1151. is suggested.
  1152. @subsection Examples
  1153. @itemize
  1154. @item
  1155. Take the first 5 seconds of a clip, and reverse it.
  1156. @example
  1157. atrim=end=5,areverse
  1158. @end example
  1159. @end itemize
  1160. @section asetnsamples
  1161. Set the number of samples per each output audio frame.
  1162. The last output packet may contain a different number of samples, as
  1163. the filter will flush all the remaining samples when the input audio
  1164. signals its end.
  1165. The filter accepts the following options:
  1166. @table @option
  1167. @item nb_out_samples, n
  1168. Set the number of frames per each output audio frame. The number is
  1169. intended as the number of samples @emph{per each channel}.
  1170. Default value is 1024.
  1171. @item pad, p
  1172. If set to 1, the filter will pad the last audio frame with zeroes, so
  1173. that the last frame will contain the same number of samples as the
  1174. previous ones. Default value is 1.
  1175. @end table
  1176. For example, to set the number of per-frame samples to 1234 and
  1177. disable padding for the last frame, use:
  1178. @example
  1179. asetnsamples=n=1234:p=0
  1180. @end example
  1181. @section asetrate
  1182. Set the sample rate without altering the PCM data.
  1183. This will result in a change of speed and pitch.
  1184. The filter accepts the following options:
  1185. @table @option
  1186. @item sample_rate, r
  1187. Set the output sample rate. Default is 44100 Hz.
  1188. @end table
  1189. @section ashowinfo
  1190. Show a line containing various information for each input audio frame.
  1191. The input audio is not modified.
  1192. The shown line contains a sequence of key/value pairs of the form
  1193. @var{key}:@var{value}.
  1194. The following values are shown in the output:
  1195. @table @option
  1196. @item n
  1197. The (sequential) number of the input frame, starting from 0.
  1198. @item pts
  1199. The presentation timestamp of the input frame, in time base units; the time base
  1200. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1201. @item pts_time
  1202. The presentation timestamp of the input frame in seconds.
  1203. @item pos
  1204. position of the frame in the input stream, -1 if this information in
  1205. unavailable and/or meaningless (for example in case of synthetic audio)
  1206. @item fmt
  1207. The sample format.
  1208. @item chlayout
  1209. The channel layout.
  1210. @item rate
  1211. The sample rate for the audio frame.
  1212. @item nb_samples
  1213. The number of samples (per channel) in the frame.
  1214. @item checksum
  1215. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1216. audio, the data is treated as if all the planes were concatenated.
  1217. @item plane_checksums
  1218. A list of Adler-32 checksums for each data plane.
  1219. @end table
  1220. @anchor{astats}
  1221. @section astats
  1222. Display time domain statistical information about the audio channels.
  1223. Statistics are calculated and displayed for each audio channel and,
  1224. where applicable, an overall figure is also given.
  1225. It accepts the following option:
  1226. @table @option
  1227. @item length
  1228. Short window length in seconds, used for peak and trough RMS measurement.
  1229. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1230. @item metadata
  1231. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1232. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1233. disabled.
  1234. Available keys for each channel are:
  1235. DC_offset
  1236. Min_level
  1237. Max_level
  1238. Min_difference
  1239. Max_difference
  1240. Mean_difference
  1241. RMS_difference
  1242. Peak_level
  1243. RMS_peak
  1244. RMS_trough
  1245. Crest_factor
  1246. Flat_factor
  1247. Peak_count
  1248. Bit_depth
  1249. and for Overall:
  1250. DC_offset
  1251. Min_level
  1252. Max_level
  1253. Min_difference
  1254. Max_difference
  1255. Mean_difference
  1256. RMS_difference
  1257. Peak_level
  1258. RMS_level
  1259. RMS_peak
  1260. RMS_trough
  1261. Flat_factor
  1262. Peak_count
  1263. Bit_depth
  1264. Number_of_samples
  1265. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1266. this @code{lavfi.astats.Overall.Peak_count}.
  1267. For description what each key means read below.
  1268. @item reset
  1269. Set number of frame after which stats are going to be recalculated.
  1270. Default is disabled.
  1271. @end table
  1272. A description of each shown parameter follows:
  1273. @table @option
  1274. @item DC offset
  1275. Mean amplitude displacement from zero.
  1276. @item Min level
  1277. Minimal sample level.
  1278. @item Max level
  1279. Maximal sample level.
  1280. @item Min difference
  1281. Minimal difference between two consecutive samples.
  1282. @item Max difference
  1283. Maximal difference between two consecutive samples.
  1284. @item Mean difference
  1285. Mean difference between two consecutive samples.
  1286. The average of each difference between two consecutive samples.
  1287. @item RMS difference
  1288. Root Mean Square difference between two consecutive samples.
  1289. @item Peak level dB
  1290. @item RMS level dB
  1291. Standard peak and RMS level measured in dBFS.
  1292. @item RMS peak dB
  1293. @item RMS trough dB
  1294. Peak and trough values for RMS level measured over a short window.
  1295. @item Crest factor
  1296. Standard ratio of peak to RMS level (note: not in dB).
  1297. @item Flat factor
  1298. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1299. (i.e. either @var{Min level} or @var{Max level}).
  1300. @item Peak count
  1301. Number of occasions (not the number of samples) that the signal attained either
  1302. @var{Min level} or @var{Max level}.
  1303. @item Bit depth
  1304. Overall bit depth of audio. Number of bits used for each sample.
  1305. @end table
  1306. @section atempo
  1307. Adjust audio tempo.
  1308. The filter accepts exactly one parameter, the audio tempo. If not
  1309. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1310. be in the [0.5, 2.0] range.
  1311. @subsection Examples
  1312. @itemize
  1313. @item
  1314. Slow down audio to 80% tempo:
  1315. @example
  1316. atempo=0.8
  1317. @end example
  1318. @item
  1319. To speed up audio to 125% tempo:
  1320. @example
  1321. atempo=1.25
  1322. @end example
  1323. @end itemize
  1324. @section atrim
  1325. Trim the input so that the output contains one continuous subpart of the input.
  1326. It accepts the following parameters:
  1327. @table @option
  1328. @item start
  1329. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1330. sample with the timestamp @var{start} will be the first sample in the output.
  1331. @item end
  1332. Specify time of the first audio sample that will be dropped, i.e. the
  1333. audio sample immediately preceding the one with the timestamp @var{end} will be
  1334. the last sample in the output.
  1335. @item start_pts
  1336. Same as @var{start}, except this option sets the start timestamp in samples
  1337. instead of seconds.
  1338. @item end_pts
  1339. Same as @var{end}, except this option sets the end timestamp in samples instead
  1340. of seconds.
  1341. @item duration
  1342. The maximum duration of the output in seconds.
  1343. @item start_sample
  1344. The number of the first sample that should be output.
  1345. @item end_sample
  1346. The number of the first sample that should be dropped.
  1347. @end table
  1348. @option{start}, @option{end}, and @option{duration} are expressed as time
  1349. duration specifications; see
  1350. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1351. Note that the first two sets of the start/end options and the @option{duration}
  1352. option look at the frame timestamp, while the _sample options simply count the
  1353. samples that pass through the filter. So start/end_pts and start/end_sample will
  1354. give different results when the timestamps are wrong, inexact or do not start at
  1355. zero. Also note that this filter does not modify the timestamps. If you wish
  1356. to have the output timestamps start at zero, insert the asetpts filter after the
  1357. atrim filter.
  1358. If multiple start or end options are set, this filter tries to be greedy and
  1359. keep all samples that match at least one of the specified constraints. To keep
  1360. only the part that matches all the constraints at once, chain multiple atrim
  1361. filters.
  1362. The defaults are such that all the input is kept. So it is possible to set e.g.
  1363. just the end values to keep everything before the specified time.
  1364. Examples:
  1365. @itemize
  1366. @item
  1367. Drop everything except the second minute of input:
  1368. @example
  1369. ffmpeg -i INPUT -af atrim=60:120
  1370. @end example
  1371. @item
  1372. Keep only the first 1000 samples:
  1373. @example
  1374. ffmpeg -i INPUT -af atrim=end_sample=1000
  1375. @end example
  1376. @end itemize
  1377. @section bandpass
  1378. Apply a two-pole Butterworth band-pass filter with central
  1379. frequency @var{frequency}, and (3dB-point) band-width width.
  1380. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1381. instead of the default: constant 0dB peak gain.
  1382. The filter roll off at 6dB per octave (20dB per decade).
  1383. The filter accepts the following options:
  1384. @table @option
  1385. @item frequency, f
  1386. Set the filter's central frequency. Default is @code{3000}.
  1387. @item csg
  1388. Constant skirt gain if set to 1. Defaults to 0.
  1389. @item width_type
  1390. Set method to specify band-width of filter.
  1391. @table @option
  1392. @item h
  1393. Hz
  1394. @item q
  1395. Q-Factor
  1396. @item o
  1397. octave
  1398. @item s
  1399. slope
  1400. @end table
  1401. @item width, w
  1402. Specify the band-width of a filter in width_type units.
  1403. @item channels, c
  1404. Specify which channels to filter, by default all available are filtered.
  1405. @end table
  1406. @section bandreject
  1407. Apply a two-pole Butterworth band-reject filter with central
  1408. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1409. The filter roll off at 6dB per octave (20dB per decade).
  1410. The filter accepts the following options:
  1411. @table @option
  1412. @item frequency, f
  1413. Set the filter's central frequency. Default is @code{3000}.
  1414. @item width_type
  1415. Set method to specify band-width of filter.
  1416. @table @option
  1417. @item h
  1418. Hz
  1419. @item q
  1420. Q-Factor
  1421. @item o
  1422. octave
  1423. @item s
  1424. slope
  1425. @end table
  1426. @item width, w
  1427. Specify the band-width of a filter in width_type units.
  1428. @item channels, c
  1429. Specify which channels to filter, by default all available are filtered.
  1430. @end table
  1431. @section bass
  1432. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1433. shelving filter with a response similar to that of a standard
  1434. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1435. The filter accepts the following options:
  1436. @table @option
  1437. @item gain, g
  1438. Give the gain at 0 Hz. Its useful range is about -20
  1439. (for a large cut) to +20 (for a large boost).
  1440. Beware of clipping when using a positive gain.
  1441. @item frequency, f
  1442. Set the filter's central frequency and so can be used
  1443. to extend or reduce the frequency range to be boosted or cut.
  1444. The default value is @code{100} Hz.
  1445. @item width_type
  1446. Set method to specify band-width of filter.
  1447. @table @option
  1448. @item h
  1449. Hz
  1450. @item q
  1451. Q-Factor
  1452. @item o
  1453. octave
  1454. @item s
  1455. slope
  1456. @end table
  1457. @item width, w
  1458. Determine how steep is the filter's shelf transition.
  1459. @item channels, c
  1460. Specify which channels to filter, by default all available are filtered.
  1461. @end table
  1462. @section biquad
  1463. Apply a biquad IIR filter with the given coefficients.
  1464. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1465. are the numerator and denominator coefficients respectively.
  1466. and @var{channels}, @var{c} specify which channels to filter, by default all
  1467. available are filtered.
  1468. @section bs2b
  1469. Bauer stereo to binaural transformation, which improves headphone listening of
  1470. stereo audio records.
  1471. To enable compilation of this filter you need to configure FFmpeg with
  1472. @code{--enable-libbs2b}.
  1473. It accepts the following parameters:
  1474. @table @option
  1475. @item profile
  1476. Pre-defined crossfeed level.
  1477. @table @option
  1478. @item default
  1479. Default level (fcut=700, feed=50).
  1480. @item cmoy
  1481. Chu Moy circuit (fcut=700, feed=60).
  1482. @item jmeier
  1483. Jan Meier circuit (fcut=650, feed=95).
  1484. @end table
  1485. @item fcut
  1486. Cut frequency (in Hz).
  1487. @item feed
  1488. Feed level (in Hz).
  1489. @end table
  1490. @section channelmap
  1491. Remap input channels to new locations.
  1492. It accepts the following parameters:
  1493. @table @option
  1494. @item map
  1495. Map channels from input to output. The argument is a '|'-separated list of
  1496. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1497. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1498. channel (e.g. FL for front left) or its index in the input channel layout.
  1499. @var{out_channel} is the name of the output channel or its index in the output
  1500. channel layout. If @var{out_channel} is not given then it is implicitly an
  1501. index, starting with zero and increasing by one for each mapping.
  1502. @item channel_layout
  1503. The channel layout of the output stream.
  1504. @end table
  1505. If no mapping is present, the filter will implicitly map input channels to
  1506. output channels, preserving indices.
  1507. For example, assuming a 5.1+downmix input MOV file,
  1508. @example
  1509. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1510. @end example
  1511. will create an output WAV file tagged as stereo from the downmix channels of
  1512. the input.
  1513. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1514. @example
  1515. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1516. @end example
  1517. @section channelsplit
  1518. Split each channel from an input audio stream into a separate output stream.
  1519. It accepts the following parameters:
  1520. @table @option
  1521. @item channel_layout
  1522. The channel layout of the input stream. The default is "stereo".
  1523. @end table
  1524. For example, assuming a stereo input MP3 file,
  1525. @example
  1526. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1527. @end example
  1528. will create an output Matroska file with two audio streams, one containing only
  1529. the left channel and the other the right channel.
  1530. Split a 5.1 WAV file into per-channel files:
  1531. @example
  1532. ffmpeg -i in.wav -filter_complex
  1533. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1534. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1535. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1536. side_right.wav
  1537. @end example
  1538. @section chorus
  1539. Add a chorus effect to the audio.
  1540. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1541. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1542. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1543. The modulation depth defines the range the modulated delay is played before or after
  1544. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1545. sound tuned around the original one, like in a chorus where some vocals are slightly
  1546. off key.
  1547. It accepts the following parameters:
  1548. @table @option
  1549. @item in_gain
  1550. Set input gain. Default is 0.4.
  1551. @item out_gain
  1552. Set output gain. Default is 0.4.
  1553. @item delays
  1554. Set delays. A typical delay is around 40ms to 60ms.
  1555. @item decays
  1556. Set decays.
  1557. @item speeds
  1558. Set speeds.
  1559. @item depths
  1560. Set depths.
  1561. @end table
  1562. @subsection Examples
  1563. @itemize
  1564. @item
  1565. A single delay:
  1566. @example
  1567. chorus=0.7:0.9:55:0.4:0.25:2
  1568. @end example
  1569. @item
  1570. Two delays:
  1571. @example
  1572. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1573. @end example
  1574. @item
  1575. Fuller sounding chorus with three delays:
  1576. @example
  1577. 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
  1578. @end example
  1579. @end itemize
  1580. @section compand
  1581. Compress or expand the audio's dynamic range.
  1582. It accepts the following parameters:
  1583. @table @option
  1584. @item attacks
  1585. @item decays
  1586. A list of times in seconds for each channel over which the instantaneous level
  1587. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1588. increase of volume and @var{decays} refers to decrease of volume. For most
  1589. situations, the attack time (response to the audio getting louder) should be
  1590. shorter than the decay time, because the human ear is more sensitive to sudden
  1591. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1592. a typical value for decay is 0.8 seconds.
  1593. If specified number of attacks & decays is lower than number of channels, the last
  1594. set attack/decay will be used for all remaining channels.
  1595. @item points
  1596. A list of points for the transfer function, specified in dB relative to the
  1597. maximum possible signal amplitude. Each key points list must be defined using
  1598. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1599. @code{x0/y0 x1/y1 x2/y2 ....}
  1600. The input values must be in strictly increasing order but the transfer function
  1601. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1602. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1603. function are @code{-70/-70|-60/-20|1/0}.
  1604. @item soft-knee
  1605. Set the curve radius in dB for all joints. It defaults to 0.01.
  1606. @item gain
  1607. Set the additional gain in dB to be applied at all points on the transfer
  1608. function. This allows for easy adjustment of the overall gain.
  1609. It defaults to 0.
  1610. @item volume
  1611. Set an initial volume, in dB, to be assumed for each channel when filtering
  1612. starts. This permits the user to supply a nominal level initially, so that, for
  1613. example, a very large gain is not applied to initial signal levels before the
  1614. companding has begun to operate. A typical value for audio which is initially
  1615. quiet is -90 dB. It defaults to 0.
  1616. @item delay
  1617. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1618. delayed before being fed to the volume adjuster. Specifying a delay
  1619. approximately equal to the attack/decay times allows the filter to effectively
  1620. operate in predictive rather than reactive mode. It defaults to 0.
  1621. @end table
  1622. @subsection Examples
  1623. @itemize
  1624. @item
  1625. Make music with both quiet and loud passages suitable for listening to in a
  1626. noisy environment:
  1627. @example
  1628. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1629. @end example
  1630. Another example for audio with whisper and explosion parts:
  1631. @example
  1632. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1633. @end example
  1634. @item
  1635. A noise gate for when the noise is at a lower level than the signal:
  1636. @example
  1637. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1638. @end example
  1639. @item
  1640. Here is another noise gate, this time for when the noise is at a higher level
  1641. than the signal (making it, in some ways, similar to squelch):
  1642. @example
  1643. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1644. @end example
  1645. @item
  1646. 2:1 compression starting at -6dB:
  1647. @example
  1648. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1649. @end example
  1650. @item
  1651. 2:1 compression starting at -9dB:
  1652. @example
  1653. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1654. @end example
  1655. @item
  1656. 2:1 compression starting at -12dB:
  1657. @example
  1658. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1659. @end example
  1660. @item
  1661. 2:1 compression starting at -18dB:
  1662. @example
  1663. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1664. @end example
  1665. @item
  1666. 3:1 compression starting at -15dB:
  1667. @example
  1668. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1669. @end example
  1670. @item
  1671. Compressor/Gate:
  1672. @example
  1673. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1674. @end example
  1675. @item
  1676. Expander:
  1677. @example
  1678. 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
  1679. @end example
  1680. @item
  1681. Hard limiter at -6dB:
  1682. @example
  1683. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1684. @end example
  1685. @item
  1686. Hard limiter at -12dB:
  1687. @example
  1688. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1689. @end example
  1690. @item
  1691. Hard noise gate at -35 dB:
  1692. @example
  1693. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1694. @end example
  1695. @item
  1696. Soft limiter:
  1697. @example
  1698. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1699. @end example
  1700. @end itemize
  1701. @section compensationdelay
  1702. Compensation Delay Line is a metric based delay to compensate differing
  1703. positions of microphones or speakers.
  1704. For example, you have recorded guitar with two microphones placed in
  1705. different location. Because the front of sound wave has fixed speed in
  1706. normal conditions, the phasing of microphones can vary and depends on
  1707. their location and interposition. The best sound mix can be achieved when
  1708. these microphones are in phase (synchronized). Note that distance of
  1709. ~30 cm between microphones makes one microphone to capture signal in
  1710. antiphase to another microphone. That makes the final mix sounding moody.
  1711. This filter helps to solve phasing problems by adding different delays
  1712. to each microphone track and make them synchronized.
  1713. The best result can be reached when you take one track as base and
  1714. synchronize other tracks one by one with it.
  1715. Remember that synchronization/delay tolerance depends on sample rate, too.
  1716. Higher sample rates will give more tolerance.
  1717. It accepts the following parameters:
  1718. @table @option
  1719. @item mm
  1720. Set millimeters distance. This is compensation distance for fine tuning.
  1721. Default is 0.
  1722. @item cm
  1723. Set cm distance. This is compensation distance for tightening distance setup.
  1724. Default is 0.
  1725. @item m
  1726. Set meters distance. This is compensation distance for hard distance setup.
  1727. Default is 0.
  1728. @item dry
  1729. Set dry amount. Amount of unprocessed (dry) signal.
  1730. Default is 0.
  1731. @item wet
  1732. Set wet amount. Amount of processed (wet) signal.
  1733. Default is 1.
  1734. @item temp
  1735. Set temperature degree in Celsius. This is the temperature of the environment.
  1736. Default is 20.
  1737. @end table
  1738. @section crossfeed
  1739. Apply headphone crossfeed filter.
  1740. Crossfeed is the process of blending the left and right channels of stereo
  1741. audio recording.
  1742. It is mainly used to reduce extreme stereo separation of low frequencies.
  1743. The intent is to produce more speaker like sound to the listener.
  1744. The filter accepts the following options:
  1745. @table @option
  1746. @item strength
  1747. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1748. This sets gain of low shelf filter for side part of stereo image.
  1749. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1750. @item range
  1751. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1752. This sets cut off frequency of low shelf filter. Default is cut off near
  1753. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1754. @item level_in
  1755. Set input gain. Default is 0.9.
  1756. @item level_out
  1757. Set output gain. Default is 1.
  1758. @end table
  1759. @section crystalizer
  1760. Simple algorithm to expand audio dynamic range.
  1761. The filter accepts the following options:
  1762. @table @option
  1763. @item i
  1764. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1765. (unchanged sound) to 10.0 (maximum effect).
  1766. @item c
  1767. Enable clipping. By default is enabled.
  1768. @end table
  1769. @section dcshift
  1770. Apply a DC shift to the audio.
  1771. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1772. in the recording chain) from the audio. The effect of a DC offset is reduced
  1773. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1774. a signal has a DC offset.
  1775. @table @option
  1776. @item shift
  1777. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1778. the audio.
  1779. @item limitergain
  1780. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1781. used to prevent clipping.
  1782. @end table
  1783. @section dynaudnorm
  1784. Dynamic Audio Normalizer.
  1785. This filter applies a certain amount of gain to the input audio in order
  1786. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1787. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1788. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1789. This allows for applying extra gain to the "quiet" sections of the audio
  1790. while avoiding distortions or clipping the "loud" sections. In other words:
  1791. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1792. sections, in the sense that the volume of each section is brought to the
  1793. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1794. this goal *without* applying "dynamic range compressing". It will retain 100%
  1795. of the dynamic range *within* each section of the audio file.
  1796. @table @option
  1797. @item f
  1798. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1799. Default is 500 milliseconds.
  1800. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1801. referred to as frames. This is required, because a peak magnitude has no
  1802. meaning for just a single sample value. Instead, we need to determine the
  1803. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1804. normalizer would simply use the peak magnitude of the complete file, the
  1805. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1806. frame. The length of a frame is specified in milliseconds. By default, the
  1807. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1808. been found to give good results with most files.
  1809. Note that the exact frame length, in number of samples, will be determined
  1810. automatically, based on the sampling rate of the individual input audio file.
  1811. @item g
  1812. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1813. number. Default is 31.
  1814. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1815. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1816. is specified in frames, centered around the current frame. For the sake of
  1817. simplicity, this must be an odd number. Consequently, the default value of 31
  1818. takes into account the current frame, as well as the 15 preceding frames and
  1819. the 15 subsequent frames. Using a larger window results in a stronger
  1820. smoothing effect and thus in less gain variation, i.e. slower gain
  1821. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1822. effect and thus in more gain variation, i.e. faster gain adaptation.
  1823. In other words, the more you increase this value, the more the Dynamic Audio
  1824. Normalizer will behave like a "traditional" normalization filter. On the
  1825. contrary, the more you decrease this value, the more the Dynamic Audio
  1826. Normalizer will behave like a dynamic range compressor.
  1827. @item p
  1828. Set the target peak value. This specifies the highest permissible magnitude
  1829. level for the normalized audio input. This filter will try to approach the
  1830. target peak magnitude as closely as possible, but at the same time it also
  1831. makes sure that the normalized signal will never exceed the peak magnitude.
  1832. A frame's maximum local gain factor is imposed directly by the target peak
  1833. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1834. It is not recommended to go above this value.
  1835. @item m
  1836. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1837. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1838. factor for each input frame, i.e. the maximum gain factor that does not
  1839. result in clipping or distortion. The maximum gain factor is determined by
  1840. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1841. additionally bounds the frame's maximum gain factor by a predetermined
  1842. (global) maximum gain factor. This is done in order to avoid excessive gain
  1843. factors in "silent" or almost silent frames. By default, the maximum gain
  1844. factor is 10.0, For most inputs the default value should be sufficient and
  1845. it usually is not recommended to increase this value. Though, for input
  1846. with an extremely low overall volume level, it may be necessary to allow even
  1847. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1848. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1849. Instead, a "sigmoid" threshold function will be applied. This way, the
  1850. gain factors will smoothly approach the threshold value, but never exceed that
  1851. value.
  1852. @item r
  1853. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1854. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1855. This means that the maximum local gain factor for each frame is defined
  1856. (only) by the frame's highest magnitude sample. This way, the samples can
  1857. be amplified as much as possible without exceeding the maximum signal
  1858. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1859. Normalizer can also take into account the frame's root mean square,
  1860. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1861. determine the power of a time-varying signal. It is therefore considered
  1862. that the RMS is a better approximation of the "perceived loudness" than
  1863. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1864. frames to a constant RMS value, a uniform "perceived loudness" can be
  1865. established. If a target RMS value has been specified, a frame's local gain
  1866. factor is defined as the factor that would result in exactly that RMS value.
  1867. Note, however, that the maximum local gain factor is still restricted by the
  1868. frame's highest magnitude sample, in order to prevent clipping.
  1869. @item n
  1870. Enable channels coupling. By default is enabled.
  1871. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1872. amount. This means the same gain factor will be applied to all channels, i.e.
  1873. the maximum possible gain factor is determined by the "loudest" channel.
  1874. However, in some recordings, it may happen that the volume of the different
  1875. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1876. In this case, this option can be used to disable the channel coupling. This way,
  1877. the gain factor will be determined independently for each channel, depending
  1878. only on the individual channel's highest magnitude sample. This allows for
  1879. harmonizing the volume of the different channels.
  1880. @item c
  1881. Enable DC bias correction. By default is disabled.
  1882. An audio signal (in the time domain) is a sequence of sample values.
  1883. In the Dynamic Audio Normalizer these sample values are represented in the
  1884. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1885. audio signal, or "waveform", should be centered around the zero point.
  1886. That means if we calculate the mean value of all samples in a file, or in a
  1887. single frame, then the result should be 0.0 or at least very close to that
  1888. value. If, however, there is a significant deviation of the mean value from
  1889. 0.0, in either positive or negative direction, this is referred to as a
  1890. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1891. Audio Normalizer provides optional DC bias correction.
  1892. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1893. the mean value, or "DC correction" offset, of each input frame and subtract
  1894. that value from all of the frame's sample values which ensures those samples
  1895. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1896. boundaries, the DC correction offset values will be interpolated smoothly
  1897. between neighbouring frames.
  1898. @item b
  1899. Enable alternative boundary mode. By default is disabled.
  1900. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1901. around each frame. This includes the preceding frames as well as the
  1902. subsequent frames. However, for the "boundary" frames, located at the very
  1903. beginning and at the very end of the audio file, not all neighbouring
  1904. frames are available. In particular, for the first few frames in the audio
  1905. file, the preceding frames are not known. And, similarly, for the last few
  1906. frames in the audio file, the subsequent frames are not known. Thus, the
  1907. question arises which gain factors should be assumed for the missing frames
  1908. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1909. to deal with this situation. The default boundary mode assumes a gain factor
  1910. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1911. "fade out" at the beginning and at the end of the input, respectively.
  1912. @item s
  1913. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1914. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1915. compression. This means that signal peaks will not be pruned and thus the
  1916. full dynamic range will be retained within each local neighbourhood. However,
  1917. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1918. normalization algorithm with a more "traditional" compression.
  1919. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1920. (thresholding) function. If (and only if) the compression feature is enabled,
  1921. all input frames will be processed by a soft knee thresholding function prior
  1922. to the actual normalization process. Put simply, the thresholding function is
  1923. going to prune all samples whose magnitude exceeds a certain threshold value.
  1924. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1925. value. Instead, the threshold value will be adjusted for each individual
  1926. frame.
  1927. In general, smaller parameters result in stronger compression, and vice versa.
  1928. Values below 3.0 are not recommended, because audible distortion may appear.
  1929. @end table
  1930. @section earwax
  1931. Make audio easier to listen to on headphones.
  1932. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1933. so that when listened to on headphones the stereo image is moved from
  1934. inside your head (standard for headphones) to outside and in front of
  1935. the listener (standard for speakers).
  1936. Ported from SoX.
  1937. @section equalizer
  1938. Apply a two-pole peaking equalisation (EQ) filter. With this
  1939. filter, the signal-level at and around a selected frequency can
  1940. be increased or decreased, whilst (unlike bandpass and bandreject
  1941. filters) that at all other frequencies is unchanged.
  1942. In order to produce complex equalisation curves, this filter can
  1943. be given several times, each with a different central frequency.
  1944. The filter accepts the following options:
  1945. @table @option
  1946. @item frequency, f
  1947. Set the filter's central frequency in Hz.
  1948. @item width_type
  1949. Set method to specify band-width of filter.
  1950. @table @option
  1951. @item h
  1952. Hz
  1953. @item q
  1954. Q-Factor
  1955. @item o
  1956. octave
  1957. @item s
  1958. slope
  1959. @end table
  1960. @item width, w
  1961. Specify the band-width of a filter in width_type units.
  1962. @item gain, g
  1963. Set the required gain or attenuation in dB.
  1964. Beware of clipping when using a positive gain.
  1965. @item channels, c
  1966. Specify which channels to filter, by default all available are filtered.
  1967. @end table
  1968. @subsection Examples
  1969. @itemize
  1970. @item
  1971. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1972. @example
  1973. equalizer=f=1000:width_type=h:width=200:g=-10
  1974. @end example
  1975. @item
  1976. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1977. @example
  1978. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1979. @end example
  1980. @end itemize
  1981. @section extrastereo
  1982. Linearly increases the difference between left and right channels which
  1983. adds some sort of "live" effect to playback.
  1984. The filter accepts the following options:
  1985. @table @option
  1986. @item m
  1987. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1988. (average of both channels), with 1.0 sound will be unchanged, with
  1989. -1.0 left and right channels will be swapped.
  1990. @item c
  1991. Enable clipping. By default is enabled.
  1992. @end table
  1993. @section firequalizer
  1994. Apply FIR Equalization using arbitrary frequency response.
  1995. The filter accepts the following option:
  1996. @table @option
  1997. @item gain
  1998. Set gain curve equation (in dB). The expression can contain variables:
  1999. @table @option
  2000. @item f
  2001. the evaluated frequency
  2002. @item sr
  2003. sample rate
  2004. @item ch
  2005. channel number, set to 0 when multichannels evaluation is disabled
  2006. @item chid
  2007. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2008. multichannels evaluation is disabled
  2009. @item chs
  2010. number of channels
  2011. @item chlayout
  2012. channel_layout, see libavutil/channel_layout.h
  2013. @end table
  2014. and functions:
  2015. @table @option
  2016. @item gain_interpolate(f)
  2017. interpolate gain on frequency f based on gain_entry
  2018. @item cubic_interpolate(f)
  2019. same as gain_interpolate, but smoother
  2020. @end table
  2021. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2022. @item gain_entry
  2023. Set gain entry for gain_interpolate function. The expression can
  2024. contain functions:
  2025. @table @option
  2026. @item entry(f, g)
  2027. store gain entry at frequency f with value g
  2028. @end table
  2029. This option is also available as command.
  2030. @item delay
  2031. Set filter delay in seconds. Higher value means more accurate.
  2032. Default is @code{0.01}.
  2033. @item accuracy
  2034. Set filter accuracy in Hz. Lower value means more accurate.
  2035. Default is @code{5}.
  2036. @item wfunc
  2037. Set window function. Acceptable values are:
  2038. @table @option
  2039. @item rectangular
  2040. rectangular window, useful when gain curve is already smooth
  2041. @item hann
  2042. hann window (default)
  2043. @item hamming
  2044. hamming window
  2045. @item blackman
  2046. blackman window
  2047. @item nuttall3
  2048. 3-terms continuous 1st derivative nuttall window
  2049. @item mnuttall3
  2050. minimum 3-terms discontinuous nuttall window
  2051. @item nuttall
  2052. 4-terms continuous 1st derivative nuttall window
  2053. @item bnuttall
  2054. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2055. @item bharris
  2056. blackman-harris window
  2057. @item tukey
  2058. tukey window
  2059. @end table
  2060. @item fixed
  2061. If enabled, use fixed number of audio samples. This improves speed when
  2062. filtering with large delay. Default is disabled.
  2063. @item multi
  2064. Enable multichannels evaluation on gain. Default is disabled.
  2065. @item zero_phase
  2066. Enable zero phase mode by subtracting timestamp to compensate delay.
  2067. Default is disabled.
  2068. @item scale
  2069. Set scale used by gain. Acceptable values are:
  2070. @table @option
  2071. @item linlin
  2072. linear frequency, linear gain
  2073. @item linlog
  2074. linear frequency, logarithmic (in dB) gain (default)
  2075. @item loglin
  2076. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2077. @item loglog
  2078. logarithmic frequency, logarithmic gain
  2079. @end table
  2080. @item dumpfile
  2081. Set file for dumping, suitable for gnuplot.
  2082. @item dumpscale
  2083. Set scale for dumpfile. Acceptable values are same with scale option.
  2084. Default is linlog.
  2085. @item fft2
  2086. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2087. Default is disabled.
  2088. @end table
  2089. @subsection Examples
  2090. @itemize
  2091. @item
  2092. lowpass at 1000 Hz:
  2093. @example
  2094. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2095. @end example
  2096. @item
  2097. lowpass at 1000 Hz with gain_entry:
  2098. @example
  2099. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2100. @end example
  2101. @item
  2102. custom equalization:
  2103. @example
  2104. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2105. @end example
  2106. @item
  2107. higher delay with zero phase to compensate delay:
  2108. @example
  2109. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2110. @end example
  2111. @item
  2112. lowpass on left channel, highpass on right channel:
  2113. @example
  2114. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2115. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2116. @end example
  2117. @end itemize
  2118. @section flanger
  2119. Apply a flanging effect to the audio.
  2120. The filter accepts the following options:
  2121. @table @option
  2122. @item delay
  2123. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2124. @item depth
  2125. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2126. @item regen
  2127. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2128. Default value is 0.
  2129. @item width
  2130. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2131. Default value is 71.
  2132. @item speed
  2133. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2134. @item shape
  2135. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2136. Default value is @var{sinusoidal}.
  2137. @item phase
  2138. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2139. Default value is 25.
  2140. @item interp
  2141. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2142. Default is @var{linear}.
  2143. @end table
  2144. @section hdcd
  2145. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2146. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2147. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2148. of HDCD, and detects the Transient Filter flag.
  2149. @example
  2150. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2151. @end example
  2152. When using the filter with wav, note the default encoding for wav is 16-bit,
  2153. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2154. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2155. @example
  2156. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2157. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2158. @end example
  2159. The filter accepts the following options:
  2160. @table @option
  2161. @item disable_autoconvert
  2162. Disable any automatic format conversion or resampling in the filter graph.
  2163. @item process_stereo
  2164. Process the stereo channels together. If target_gain does not match between
  2165. channels, consider it invalid and use the last valid target_gain.
  2166. @item cdt_ms
  2167. Set the code detect timer period in ms.
  2168. @item force_pe
  2169. Always extend peaks above -3dBFS even if PE isn't signaled.
  2170. @item analyze_mode
  2171. Replace audio with a solid tone and adjust the amplitude to signal some
  2172. specific aspect of the decoding process. The output file can be loaded in
  2173. an audio editor alongside the original to aid analysis.
  2174. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2175. Modes are:
  2176. @table @samp
  2177. @item 0, off
  2178. Disabled
  2179. @item 1, lle
  2180. Gain adjustment level at each sample
  2181. @item 2, pe
  2182. Samples where peak extend occurs
  2183. @item 3, cdt
  2184. Samples where the code detect timer is active
  2185. @item 4, tgm
  2186. Samples where the target gain does not match between channels
  2187. @end table
  2188. @end table
  2189. @section highpass
  2190. Apply a high-pass filter with 3dB point frequency.
  2191. The filter can be either single-pole, or double-pole (the default).
  2192. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2193. The filter accepts the following options:
  2194. @table @option
  2195. @item frequency, f
  2196. Set frequency in Hz. Default is 3000.
  2197. @item poles, p
  2198. Set number of poles. Default is 2.
  2199. @item width_type
  2200. Set method to specify band-width of filter.
  2201. @table @option
  2202. @item h
  2203. Hz
  2204. @item q
  2205. Q-Factor
  2206. @item o
  2207. octave
  2208. @item s
  2209. slope
  2210. @end table
  2211. @item width, w
  2212. Specify the band-width of a filter in width_type units.
  2213. Applies only to double-pole filter.
  2214. The default is 0.707q and gives a Butterworth response.
  2215. @item channels, c
  2216. Specify which channels to filter, by default all available are filtered.
  2217. @end table
  2218. @section join
  2219. Join multiple input streams into one multi-channel stream.
  2220. It accepts the following parameters:
  2221. @table @option
  2222. @item inputs
  2223. The number of input streams. It defaults to 2.
  2224. @item channel_layout
  2225. The desired output channel layout. It defaults to stereo.
  2226. @item map
  2227. Map channels from inputs to output. The argument is a '|'-separated list of
  2228. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2229. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2230. can be either the name of the input channel (e.g. FL for front left) or its
  2231. index in the specified input stream. @var{out_channel} is the name of the output
  2232. channel.
  2233. @end table
  2234. The filter will attempt to guess the mappings when they are not specified
  2235. explicitly. It does so by first trying to find an unused matching input channel
  2236. and if that fails it picks the first unused input channel.
  2237. Join 3 inputs (with properly set channel layouts):
  2238. @example
  2239. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2240. @end example
  2241. Build a 5.1 output from 6 single-channel streams:
  2242. @example
  2243. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2244. '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'
  2245. out
  2246. @end example
  2247. @section ladspa
  2248. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2249. To enable compilation of this filter you need to configure FFmpeg with
  2250. @code{--enable-ladspa}.
  2251. @table @option
  2252. @item file, f
  2253. Specifies the name of LADSPA plugin library to load. If the environment
  2254. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2255. each one of the directories specified by the colon separated list in
  2256. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2257. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2258. @file{/usr/lib/ladspa/}.
  2259. @item plugin, p
  2260. Specifies the plugin within the library. Some libraries contain only
  2261. one plugin, but others contain many of them. If this is not set filter
  2262. will list all available plugins within the specified library.
  2263. @item controls, c
  2264. Set the '|' separated list of controls which are zero or more floating point
  2265. values that determine the behavior of the loaded plugin (for example delay,
  2266. threshold or gain).
  2267. Controls need to be defined using the following syntax:
  2268. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2269. @var{valuei} is the value set on the @var{i}-th control.
  2270. Alternatively they can be also defined using the following syntax:
  2271. @var{value0}|@var{value1}|@var{value2}|..., where
  2272. @var{valuei} is the value set on the @var{i}-th control.
  2273. If @option{controls} is set to @code{help}, all available controls and
  2274. their valid ranges are printed.
  2275. @item sample_rate, s
  2276. Specify the sample rate, default to 44100. Only used if plugin have
  2277. zero inputs.
  2278. @item nb_samples, n
  2279. Set the number of samples per channel per each output frame, default
  2280. is 1024. Only used if plugin have zero inputs.
  2281. @item duration, d
  2282. Set the minimum duration of the sourced audio. See
  2283. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2284. for the accepted syntax.
  2285. Note that the resulting duration may be greater than the specified duration,
  2286. as the generated audio is always cut at the end of a complete frame.
  2287. If not specified, or the expressed duration is negative, the audio is
  2288. supposed to be generated forever.
  2289. Only used if plugin have zero inputs.
  2290. @end table
  2291. @subsection Examples
  2292. @itemize
  2293. @item
  2294. List all available plugins within amp (LADSPA example plugin) library:
  2295. @example
  2296. ladspa=file=amp
  2297. @end example
  2298. @item
  2299. List all available controls and their valid ranges for @code{vcf_notch}
  2300. plugin from @code{VCF} library:
  2301. @example
  2302. ladspa=f=vcf:p=vcf_notch:c=help
  2303. @end example
  2304. @item
  2305. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2306. plugin library:
  2307. @example
  2308. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2309. @end example
  2310. @item
  2311. Add reverberation to the audio using TAP-plugins
  2312. (Tom's Audio Processing plugins):
  2313. @example
  2314. ladspa=file=tap_reverb:tap_reverb
  2315. @end example
  2316. @item
  2317. Generate white noise, with 0.2 amplitude:
  2318. @example
  2319. ladspa=file=cmt:noise_source_white:c=c0=.2
  2320. @end example
  2321. @item
  2322. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2323. @code{C* Audio Plugin Suite} (CAPS) library:
  2324. @example
  2325. ladspa=file=caps:Click:c=c1=20'
  2326. @end example
  2327. @item
  2328. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2329. @example
  2330. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2331. @end example
  2332. @item
  2333. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2334. @code{SWH Plugins} collection:
  2335. @example
  2336. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2337. @end example
  2338. @item
  2339. Attenuate low frequencies using Multiband EQ from Steve Harris
  2340. @code{SWH Plugins} collection:
  2341. @example
  2342. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2343. @end example
  2344. @item
  2345. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2346. (CAPS) library:
  2347. @example
  2348. ladspa=caps:Narrower
  2349. @end example
  2350. @item
  2351. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2352. @example
  2353. ladspa=caps:White:.2
  2354. @end example
  2355. @item
  2356. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2357. @example
  2358. ladspa=caps:Fractal:c=c1=1
  2359. @end example
  2360. @item
  2361. Dynamic volume normalization using @code{VLevel} plugin:
  2362. @example
  2363. ladspa=vlevel-ladspa:vlevel_mono
  2364. @end example
  2365. @end itemize
  2366. @subsection Commands
  2367. This filter supports the following commands:
  2368. @table @option
  2369. @item cN
  2370. Modify the @var{N}-th control value.
  2371. If the specified value is not valid, it is ignored and prior one is kept.
  2372. @end table
  2373. @section loudnorm
  2374. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2375. Support for both single pass (livestreams, files) and double pass (files) modes.
  2376. This algorithm can target IL, LRA, and maximum true peak.
  2377. The filter accepts the following options:
  2378. @table @option
  2379. @item I, i
  2380. Set integrated loudness target.
  2381. Range is -70.0 - -5.0. Default value is -24.0.
  2382. @item LRA, lra
  2383. Set loudness range target.
  2384. Range is 1.0 - 20.0. Default value is 7.0.
  2385. @item TP, tp
  2386. Set maximum true peak.
  2387. Range is -9.0 - +0.0. Default value is -2.0.
  2388. @item measured_I, measured_i
  2389. Measured IL of input file.
  2390. Range is -99.0 - +0.0.
  2391. @item measured_LRA, measured_lra
  2392. Measured LRA of input file.
  2393. Range is 0.0 - 99.0.
  2394. @item measured_TP, measured_tp
  2395. Measured true peak of input file.
  2396. Range is -99.0 - +99.0.
  2397. @item measured_thresh
  2398. Measured threshold of input file.
  2399. Range is -99.0 - +0.0.
  2400. @item offset
  2401. Set offset gain. Gain is applied before the true-peak limiter.
  2402. Range is -99.0 - +99.0. Default is +0.0.
  2403. @item linear
  2404. Normalize linearly if possible.
  2405. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2406. to be specified in order to use this mode.
  2407. Options are true or false. Default is true.
  2408. @item dual_mono
  2409. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2410. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2411. If set to @code{true}, this option will compensate for this effect.
  2412. Multi-channel input files are not affected by this option.
  2413. Options are true or false. Default is false.
  2414. @item print_format
  2415. Set print format for stats. Options are summary, json, or none.
  2416. Default value is none.
  2417. @end table
  2418. @section lowpass
  2419. Apply a low-pass filter with 3dB point frequency.
  2420. The filter can be either single-pole or double-pole (the default).
  2421. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2422. The filter accepts the following options:
  2423. @table @option
  2424. @item frequency, f
  2425. Set frequency in Hz. Default is 500.
  2426. @item poles, p
  2427. Set number of poles. Default is 2.
  2428. @item width_type
  2429. Set method to specify band-width of filter.
  2430. @table @option
  2431. @item h
  2432. Hz
  2433. @item q
  2434. Q-Factor
  2435. @item o
  2436. octave
  2437. @item s
  2438. slope
  2439. @end table
  2440. @item width, w
  2441. Specify the band-width of a filter in width_type units.
  2442. Applies only to double-pole filter.
  2443. The default is 0.707q and gives a Butterworth response.
  2444. @item channels, c
  2445. Specify which channels to filter, by default all available are filtered.
  2446. @end table
  2447. @subsection Examples
  2448. @itemize
  2449. @item
  2450. Lowpass only LFE channel, it LFE is not present it does nothing:
  2451. @example
  2452. lowpass=c=LFE
  2453. @end example
  2454. @end itemize
  2455. @anchor{pan}
  2456. @section pan
  2457. Mix channels with specific gain levels. The filter accepts the output
  2458. channel layout followed by a set of channels definitions.
  2459. This filter is also designed to efficiently remap the channels of an audio
  2460. stream.
  2461. The filter accepts parameters of the form:
  2462. "@var{l}|@var{outdef}|@var{outdef}|..."
  2463. @table @option
  2464. @item l
  2465. output channel layout or number of channels
  2466. @item outdef
  2467. output channel specification, of the form:
  2468. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2469. @item out_name
  2470. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2471. number (c0, c1, etc.)
  2472. @item gain
  2473. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2474. @item in_name
  2475. input channel to use, see out_name for details; it is not possible to mix
  2476. named and numbered input channels
  2477. @end table
  2478. If the `=' in a channel specification is replaced by `<', then the gains for
  2479. that specification will be renormalized so that the total is 1, thus
  2480. avoiding clipping noise.
  2481. @subsection Mixing examples
  2482. For example, if you want to down-mix from stereo to mono, but with a bigger
  2483. factor for the left channel:
  2484. @example
  2485. pan=1c|c0=0.9*c0+0.1*c1
  2486. @end example
  2487. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2488. 7-channels surround:
  2489. @example
  2490. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2491. @end example
  2492. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2493. that should be preferred (see "-ac" option) unless you have very specific
  2494. needs.
  2495. @subsection Remapping examples
  2496. The channel remapping will be effective if, and only if:
  2497. @itemize
  2498. @item gain coefficients are zeroes or ones,
  2499. @item only one input per channel output,
  2500. @end itemize
  2501. If all these conditions are satisfied, the filter will notify the user ("Pure
  2502. channel mapping detected"), and use an optimized and lossless method to do the
  2503. remapping.
  2504. For example, if you have a 5.1 source and want a stereo audio stream by
  2505. dropping the extra channels:
  2506. @example
  2507. pan="stereo| c0=FL | c1=FR"
  2508. @end example
  2509. Given the same source, you can also switch front left and front right channels
  2510. and keep the input channel layout:
  2511. @example
  2512. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2513. @end example
  2514. If the input is a stereo audio stream, you can mute the front left channel (and
  2515. still keep the stereo channel layout) with:
  2516. @example
  2517. pan="stereo|c1=c1"
  2518. @end example
  2519. Still with a stereo audio stream input, you can copy the right channel in both
  2520. front left and right:
  2521. @example
  2522. pan="stereo| c0=FR | c1=FR"
  2523. @end example
  2524. @section replaygain
  2525. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2526. outputs it unchanged.
  2527. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2528. @section resample
  2529. Convert the audio sample format, sample rate and channel layout. It is
  2530. not meant to be used directly.
  2531. @section rubberband
  2532. Apply time-stretching and pitch-shifting with librubberband.
  2533. The filter accepts the following options:
  2534. @table @option
  2535. @item tempo
  2536. Set tempo scale factor.
  2537. @item pitch
  2538. Set pitch scale factor.
  2539. @item transients
  2540. Set transients detector.
  2541. Possible values are:
  2542. @table @var
  2543. @item crisp
  2544. @item mixed
  2545. @item smooth
  2546. @end table
  2547. @item detector
  2548. Set detector.
  2549. Possible values are:
  2550. @table @var
  2551. @item compound
  2552. @item percussive
  2553. @item soft
  2554. @end table
  2555. @item phase
  2556. Set phase.
  2557. Possible values are:
  2558. @table @var
  2559. @item laminar
  2560. @item independent
  2561. @end table
  2562. @item window
  2563. Set processing window size.
  2564. Possible values are:
  2565. @table @var
  2566. @item standard
  2567. @item short
  2568. @item long
  2569. @end table
  2570. @item smoothing
  2571. Set smoothing.
  2572. Possible values are:
  2573. @table @var
  2574. @item off
  2575. @item on
  2576. @end table
  2577. @item formant
  2578. Enable formant preservation when shift pitching.
  2579. Possible values are:
  2580. @table @var
  2581. @item shifted
  2582. @item preserved
  2583. @end table
  2584. @item pitchq
  2585. Set pitch quality.
  2586. Possible values are:
  2587. @table @var
  2588. @item quality
  2589. @item speed
  2590. @item consistency
  2591. @end table
  2592. @item channels
  2593. Set channels.
  2594. Possible values are:
  2595. @table @var
  2596. @item apart
  2597. @item together
  2598. @end table
  2599. @end table
  2600. @section sidechaincompress
  2601. This filter acts like normal compressor but has the ability to compress
  2602. detected signal using second input signal.
  2603. It needs two input streams and returns one output stream.
  2604. First input stream will be processed depending on second stream signal.
  2605. The filtered signal then can be filtered with other filters in later stages of
  2606. processing. See @ref{pan} and @ref{amerge} filter.
  2607. The filter accepts the following options:
  2608. @table @option
  2609. @item level_in
  2610. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2611. @item threshold
  2612. If a signal of second stream raises above this level it will affect the gain
  2613. reduction of first stream.
  2614. By default is 0.125. Range is between 0.00097563 and 1.
  2615. @item ratio
  2616. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2617. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2618. Default is 2. Range is between 1 and 20.
  2619. @item attack
  2620. Amount of milliseconds the signal has to rise above the threshold before gain
  2621. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2622. @item release
  2623. Amount of milliseconds the signal has to fall below the threshold before
  2624. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2625. @item makeup
  2626. Set the amount by how much signal will be amplified after processing.
  2627. Default is 2. Range is from 1 and 64.
  2628. @item knee
  2629. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2630. Default is 2.82843. Range is between 1 and 8.
  2631. @item link
  2632. Choose if the @code{average} level between all channels of side-chain stream
  2633. or the louder(@code{maximum}) channel of side-chain stream affects the
  2634. reduction. Default is @code{average}.
  2635. @item detection
  2636. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2637. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2638. @item level_sc
  2639. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2640. @item mix
  2641. How much to use compressed signal in output. Default is 1.
  2642. Range is between 0 and 1.
  2643. @end table
  2644. @subsection Examples
  2645. @itemize
  2646. @item
  2647. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2648. depending on the signal of 2nd input and later compressed signal to be
  2649. merged with 2nd input:
  2650. @example
  2651. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2652. @end example
  2653. @end itemize
  2654. @section sidechaingate
  2655. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2656. filter the detected signal before sending it to the gain reduction stage.
  2657. Normally a gate uses the full range signal to detect a level above the
  2658. threshold.
  2659. For example: If you cut all lower frequencies from your sidechain signal
  2660. the gate will decrease the volume of your track only if not enough highs
  2661. appear. With this technique you are able to reduce the resonation of a
  2662. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2663. guitar.
  2664. It needs two input streams and returns one output stream.
  2665. First input stream will be processed depending on second stream signal.
  2666. The filter accepts the following options:
  2667. @table @option
  2668. @item level_in
  2669. Set input level before filtering.
  2670. Default is 1. Allowed range is from 0.015625 to 64.
  2671. @item range
  2672. Set the level of gain reduction when the signal is below the threshold.
  2673. Default is 0.06125. Allowed range is from 0 to 1.
  2674. @item threshold
  2675. If a signal rises above this level the gain reduction is released.
  2676. Default is 0.125. Allowed range is from 0 to 1.
  2677. @item ratio
  2678. Set a ratio about which the signal is reduced.
  2679. Default is 2. Allowed range is from 1 to 9000.
  2680. @item attack
  2681. Amount of milliseconds the signal has to rise above the threshold before gain
  2682. reduction stops.
  2683. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2684. @item release
  2685. Amount of milliseconds the signal has to fall below the threshold before the
  2686. reduction is increased again. Default is 250 milliseconds.
  2687. Allowed range is from 0.01 to 9000.
  2688. @item makeup
  2689. Set amount of amplification of signal after processing.
  2690. Default is 1. Allowed range is from 1 to 64.
  2691. @item knee
  2692. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2693. Default is 2.828427125. Allowed range is from 1 to 8.
  2694. @item detection
  2695. Choose if exact signal should be taken for detection or an RMS like one.
  2696. Default is rms. Can be peak or rms.
  2697. @item link
  2698. Choose if the average level between all channels or the louder channel affects
  2699. the reduction.
  2700. Default is average. Can be average or maximum.
  2701. @item level_sc
  2702. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2703. @end table
  2704. @section silencedetect
  2705. Detect silence in an audio stream.
  2706. This filter logs a message when it detects that the input audio volume is less
  2707. or equal to a noise tolerance value for a duration greater or equal to the
  2708. minimum detected noise duration.
  2709. The printed times and duration are expressed in seconds.
  2710. The filter accepts the following options:
  2711. @table @option
  2712. @item duration, d
  2713. Set silence duration until notification (default is 2 seconds).
  2714. @item noise, n
  2715. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2716. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2717. @end table
  2718. @subsection Examples
  2719. @itemize
  2720. @item
  2721. Detect 5 seconds of silence with -50dB noise tolerance:
  2722. @example
  2723. silencedetect=n=-50dB:d=5
  2724. @end example
  2725. @item
  2726. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2727. tolerance in @file{silence.mp3}:
  2728. @example
  2729. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2730. @end example
  2731. @end itemize
  2732. @section silenceremove
  2733. Remove silence from the beginning, middle or end of the audio.
  2734. The filter accepts the following options:
  2735. @table @option
  2736. @item start_periods
  2737. This value is used to indicate if audio should be trimmed at beginning of
  2738. the audio. A value of zero indicates no silence should be trimmed from the
  2739. beginning. When specifying a non-zero value, it trims audio up until it
  2740. finds non-silence. Normally, when trimming silence from beginning of audio
  2741. the @var{start_periods} will be @code{1} but it can be increased to higher
  2742. values to trim all audio up to specific count of non-silence periods.
  2743. Default value is @code{0}.
  2744. @item start_duration
  2745. Specify the amount of time that non-silence must be detected before it stops
  2746. trimming audio. By increasing the duration, bursts of noises can be treated
  2747. as silence and trimmed off. Default value is @code{0}.
  2748. @item start_threshold
  2749. This indicates what sample value should be treated as silence. For digital
  2750. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2751. you may wish to increase the value to account for background noise.
  2752. Can be specified in dB (in case "dB" is appended to the specified value)
  2753. or amplitude ratio. Default value is @code{0}.
  2754. @item stop_periods
  2755. Set the count for trimming silence from the end of audio.
  2756. To remove silence from the middle of a file, specify a @var{stop_periods}
  2757. that is negative. This value is then treated as a positive value and is
  2758. used to indicate the effect should restart processing as specified by
  2759. @var{start_periods}, making it suitable for removing periods of silence
  2760. in the middle of the audio.
  2761. Default value is @code{0}.
  2762. @item stop_duration
  2763. Specify a duration of silence that must exist before audio is not copied any
  2764. more. By specifying a higher duration, silence that is wanted can be left in
  2765. the audio.
  2766. Default value is @code{0}.
  2767. @item stop_threshold
  2768. This is the same as @option{start_threshold} but for trimming silence from
  2769. the end of audio.
  2770. Can be specified in dB (in case "dB" is appended to the specified value)
  2771. or amplitude ratio. Default value is @code{0}.
  2772. @item leave_silence
  2773. This indicates that @var{stop_duration} length of audio should be left intact
  2774. at the beginning of each period of silence.
  2775. For example, if you want to remove long pauses between words but do not want
  2776. to remove the pauses completely. Default value is @code{0}.
  2777. @item detection
  2778. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2779. and works better with digital silence which is exactly 0.
  2780. Default value is @code{rms}.
  2781. @item window
  2782. Set ratio used to calculate size of window for detecting silence.
  2783. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2784. @end table
  2785. @subsection Examples
  2786. @itemize
  2787. @item
  2788. The following example shows how this filter can be used to start a recording
  2789. that does not contain the delay at the start which usually occurs between
  2790. pressing the record button and the start of the performance:
  2791. @example
  2792. silenceremove=1:5:0.02
  2793. @end example
  2794. @item
  2795. Trim all silence encountered from beginning to end where there is more than 1
  2796. second of silence in audio:
  2797. @example
  2798. silenceremove=0:0:0:-1:1:-90dB
  2799. @end example
  2800. @end itemize
  2801. @section sofalizer
  2802. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2803. loudspeakers around the user for binaural listening via headphones (audio
  2804. formats up to 9 channels supported).
  2805. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2806. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2807. Austrian Academy of Sciences.
  2808. To enable compilation of this filter you need to configure FFmpeg with
  2809. @code{--enable-netcdf}.
  2810. The filter accepts the following options:
  2811. @table @option
  2812. @item sofa
  2813. Set the SOFA file used for rendering.
  2814. @item gain
  2815. Set gain applied to audio. Value is in dB. Default is 0.
  2816. @item rotation
  2817. Set rotation of virtual loudspeakers in deg. Default is 0.
  2818. @item elevation
  2819. Set elevation of virtual speakers in deg. Default is 0.
  2820. @item radius
  2821. Set distance in meters between loudspeakers and the listener with near-field
  2822. HRTFs. Default is 1.
  2823. @item type
  2824. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2825. processing audio in time domain which is slow.
  2826. @var{freq} is processing audio in frequency domain which is fast.
  2827. Default is @var{freq}.
  2828. @item speakers
  2829. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2830. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2831. Each virtual loudspeaker is described with short channel name following with
  2832. azimuth and elevation in degreees.
  2833. Each virtual loudspeaker description is separated by '|'.
  2834. For example to override front left and front right channel positions use:
  2835. 'speakers=FL 45 15|FR 345 15'.
  2836. Descriptions with unrecognised channel names are ignored.
  2837. @end table
  2838. @subsection Examples
  2839. @itemize
  2840. @item
  2841. Using ClubFritz6 sofa file:
  2842. @example
  2843. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2844. @end example
  2845. @item
  2846. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2847. @example
  2848. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2849. @end example
  2850. @item
  2851. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2852. and also with custom gain:
  2853. @example
  2854. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2855. @end example
  2856. @end itemize
  2857. @section stereotools
  2858. This filter has some handy utilities to manage stereo signals, for converting
  2859. M/S stereo recordings to L/R signal while having control over the parameters
  2860. or spreading the stereo image of master track.
  2861. The filter accepts the following options:
  2862. @table @option
  2863. @item level_in
  2864. Set input level before filtering for both channels. Defaults is 1.
  2865. Allowed range is from 0.015625 to 64.
  2866. @item level_out
  2867. Set output level after filtering for both channels. Defaults is 1.
  2868. Allowed range is from 0.015625 to 64.
  2869. @item balance_in
  2870. Set input balance between both channels. Default is 0.
  2871. Allowed range is from -1 to 1.
  2872. @item balance_out
  2873. Set output balance between both channels. Default is 0.
  2874. Allowed range is from -1 to 1.
  2875. @item softclip
  2876. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2877. clipping. Disabled by default.
  2878. @item mutel
  2879. Mute the left channel. Disabled by default.
  2880. @item muter
  2881. Mute the right channel. Disabled by default.
  2882. @item phasel
  2883. Change the phase of the left channel. Disabled by default.
  2884. @item phaser
  2885. Change the phase of the right channel. Disabled by default.
  2886. @item mode
  2887. Set stereo mode. Available values are:
  2888. @table @samp
  2889. @item lr>lr
  2890. Left/Right to Left/Right, this is default.
  2891. @item lr>ms
  2892. Left/Right to Mid/Side.
  2893. @item ms>lr
  2894. Mid/Side to Left/Right.
  2895. @item lr>ll
  2896. Left/Right to Left/Left.
  2897. @item lr>rr
  2898. Left/Right to Right/Right.
  2899. @item lr>l+r
  2900. Left/Right to Left + Right.
  2901. @item lr>rl
  2902. Left/Right to Right/Left.
  2903. @end table
  2904. @item slev
  2905. Set level of side signal. Default is 1.
  2906. Allowed range is from 0.015625 to 64.
  2907. @item sbal
  2908. Set balance of side signal. Default is 0.
  2909. Allowed range is from -1 to 1.
  2910. @item mlev
  2911. Set level of the middle signal. Default is 1.
  2912. Allowed range is from 0.015625 to 64.
  2913. @item mpan
  2914. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2915. @item base
  2916. Set stereo base between mono and inversed channels. Default is 0.
  2917. Allowed range is from -1 to 1.
  2918. @item delay
  2919. Set delay in milliseconds how much to delay left from right channel and
  2920. vice versa. Default is 0. Allowed range is from -20 to 20.
  2921. @item sclevel
  2922. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2923. @item phase
  2924. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2925. @item bmode_in, bmode_out
  2926. Set balance mode for balance_in/balance_out option.
  2927. Can be one of the following:
  2928. @table @samp
  2929. @item balance
  2930. Classic balance mode. Attenuate one channel at time.
  2931. Gain is raised up to 1.
  2932. @item amplitude
  2933. Similar as classic mode above but gain is raised up to 2.
  2934. @item power
  2935. Equal power distribution, from -6dB to +6dB range.
  2936. @end table
  2937. @end table
  2938. @subsection Examples
  2939. @itemize
  2940. @item
  2941. Apply karaoke like effect:
  2942. @example
  2943. stereotools=mlev=0.015625
  2944. @end example
  2945. @item
  2946. Convert M/S signal to L/R:
  2947. @example
  2948. "stereotools=mode=ms>lr"
  2949. @end example
  2950. @end itemize
  2951. @section stereowiden
  2952. This filter enhance the stereo effect by suppressing signal common to both
  2953. channels and by delaying the signal of left into right and vice versa,
  2954. thereby widening the stereo effect.
  2955. The filter accepts the following options:
  2956. @table @option
  2957. @item delay
  2958. Time in milliseconds of the delay of left signal into right and vice versa.
  2959. Default is 20 milliseconds.
  2960. @item feedback
  2961. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2962. effect of left signal in right output and vice versa which gives widening
  2963. effect. Default is 0.3.
  2964. @item crossfeed
  2965. Cross feed of left into right with inverted phase. This helps in suppressing
  2966. the mono. If the value is 1 it will cancel all the signal common to both
  2967. channels. Default is 0.3.
  2968. @item drymix
  2969. Set level of input signal of original channel. Default is 0.8.
  2970. @end table
  2971. @section treble
  2972. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2973. shelving filter with a response similar to that of a standard
  2974. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2975. The filter accepts the following options:
  2976. @table @option
  2977. @item gain, g
  2978. Give the gain at whichever is the lower of ~22 kHz and the
  2979. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2980. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2981. @item frequency, f
  2982. Set the filter's central frequency and so can be used
  2983. to extend or reduce the frequency range to be boosted or cut.
  2984. The default value is @code{3000} Hz.
  2985. @item width_type
  2986. Set method to specify band-width of filter.
  2987. @table @option
  2988. @item h
  2989. Hz
  2990. @item q
  2991. Q-Factor
  2992. @item o
  2993. octave
  2994. @item s
  2995. slope
  2996. @end table
  2997. @item width, w
  2998. Determine how steep is the filter's shelf transition.
  2999. @item channels, c
  3000. Specify which channels to filter, by default all available are filtered.
  3001. @end table
  3002. @section tremolo
  3003. Sinusoidal amplitude modulation.
  3004. The filter accepts the following options:
  3005. @table @option
  3006. @item f
  3007. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3008. (20 Hz or lower) will result in a tremolo effect.
  3009. This filter may also be used as a ring modulator by specifying
  3010. a modulation frequency higher than 20 Hz.
  3011. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3012. @item d
  3013. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3014. Default value is 0.5.
  3015. @end table
  3016. @section vibrato
  3017. Sinusoidal phase modulation.
  3018. The filter accepts the following options:
  3019. @table @option
  3020. @item f
  3021. Modulation frequency in Hertz.
  3022. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3023. @item d
  3024. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3025. Default value is 0.5.
  3026. @end table
  3027. @section volume
  3028. Adjust the input audio volume.
  3029. It accepts the following parameters:
  3030. @table @option
  3031. @item volume
  3032. Set audio volume expression.
  3033. Output values are clipped to the maximum value.
  3034. The output audio volume is given by the relation:
  3035. @example
  3036. @var{output_volume} = @var{volume} * @var{input_volume}
  3037. @end example
  3038. The default value for @var{volume} is "1.0".
  3039. @item precision
  3040. This parameter represents the mathematical precision.
  3041. It determines which input sample formats will be allowed, which affects the
  3042. precision of the volume scaling.
  3043. @table @option
  3044. @item fixed
  3045. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3046. @item float
  3047. 32-bit floating-point; this limits input sample format to FLT. (default)
  3048. @item double
  3049. 64-bit floating-point; this limits input sample format to DBL.
  3050. @end table
  3051. @item replaygain
  3052. Choose the behaviour on encountering ReplayGain side data in input frames.
  3053. @table @option
  3054. @item drop
  3055. Remove ReplayGain side data, ignoring its contents (the default).
  3056. @item ignore
  3057. Ignore ReplayGain side data, but leave it in the frame.
  3058. @item track
  3059. Prefer the track gain, if present.
  3060. @item album
  3061. Prefer the album gain, if present.
  3062. @end table
  3063. @item replaygain_preamp
  3064. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3065. Default value for @var{replaygain_preamp} is 0.0.
  3066. @item eval
  3067. Set when the volume expression is evaluated.
  3068. It accepts the following values:
  3069. @table @samp
  3070. @item once
  3071. only evaluate expression once during the filter initialization, or
  3072. when the @samp{volume} command is sent
  3073. @item frame
  3074. evaluate expression for each incoming frame
  3075. @end table
  3076. Default value is @samp{once}.
  3077. @end table
  3078. The volume expression can contain the following parameters.
  3079. @table @option
  3080. @item n
  3081. frame number (starting at zero)
  3082. @item nb_channels
  3083. number of channels
  3084. @item nb_consumed_samples
  3085. number of samples consumed by the filter
  3086. @item nb_samples
  3087. number of samples in the current frame
  3088. @item pos
  3089. original frame position in the file
  3090. @item pts
  3091. frame PTS
  3092. @item sample_rate
  3093. sample rate
  3094. @item startpts
  3095. PTS at start of stream
  3096. @item startt
  3097. time at start of stream
  3098. @item t
  3099. frame time
  3100. @item tb
  3101. timestamp timebase
  3102. @item volume
  3103. last set volume value
  3104. @end table
  3105. Note that when @option{eval} is set to @samp{once} only the
  3106. @var{sample_rate} and @var{tb} variables are available, all other
  3107. variables will evaluate to NAN.
  3108. @subsection Commands
  3109. This filter supports the following commands:
  3110. @table @option
  3111. @item volume
  3112. Modify the volume expression.
  3113. The command accepts the same syntax of the corresponding option.
  3114. If the specified expression is not valid, it is kept at its current
  3115. value.
  3116. @item replaygain_noclip
  3117. Prevent clipping by limiting the gain applied.
  3118. Default value for @var{replaygain_noclip} is 1.
  3119. @end table
  3120. @subsection Examples
  3121. @itemize
  3122. @item
  3123. Halve the input audio volume:
  3124. @example
  3125. volume=volume=0.5
  3126. volume=volume=1/2
  3127. volume=volume=-6.0206dB
  3128. @end example
  3129. In all the above example the named key for @option{volume} can be
  3130. omitted, for example like in:
  3131. @example
  3132. volume=0.5
  3133. @end example
  3134. @item
  3135. Increase input audio power by 6 decibels using fixed-point precision:
  3136. @example
  3137. volume=volume=6dB:precision=fixed
  3138. @end example
  3139. @item
  3140. Fade volume after time 10 with an annihilation period of 5 seconds:
  3141. @example
  3142. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3143. @end example
  3144. @end itemize
  3145. @section volumedetect
  3146. Detect the volume of the input video.
  3147. The filter has no parameters. The input is not modified. Statistics about
  3148. the volume will be printed in the log when the input stream end is reached.
  3149. In particular it will show the mean volume (root mean square), maximum
  3150. volume (on a per-sample basis), and the beginning of a histogram of the
  3151. registered volume values (from the maximum value to a cumulated 1/1000 of
  3152. the samples).
  3153. All volumes are in decibels relative to the maximum PCM value.
  3154. @subsection Examples
  3155. Here is an excerpt of the output:
  3156. @example
  3157. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3158. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3159. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3160. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3161. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3162. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3163. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3164. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3165. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3166. @end example
  3167. It means that:
  3168. @itemize
  3169. @item
  3170. The mean square energy is approximately -27 dB, or 10^-2.7.
  3171. @item
  3172. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3173. @item
  3174. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3175. @end itemize
  3176. In other words, raising the volume by +4 dB does not cause any clipping,
  3177. raising it by +5 dB causes clipping for 6 samples, etc.
  3178. @c man end AUDIO FILTERS
  3179. @chapter Audio Sources
  3180. @c man begin AUDIO SOURCES
  3181. Below is a description of the currently available audio sources.
  3182. @section abuffer
  3183. Buffer audio frames, and make them available to the filter chain.
  3184. This source is mainly intended for a programmatic use, in particular
  3185. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3186. It accepts the following parameters:
  3187. @table @option
  3188. @item time_base
  3189. The timebase which will be used for timestamps of submitted frames. It must be
  3190. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3191. @item sample_rate
  3192. The sample rate of the incoming audio buffers.
  3193. @item sample_fmt
  3194. The sample format of the incoming audio buffers.
  3195. Either a sample format name or its corresponding integer representation from
  3196. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3197. @item channel_layout
  3198. The channel layout of the incoming audio buffers.
  3199. Either a channel layout name from channel_layout_map in
  3200. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3201. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3202. @item channels
  3203. The number of channels of the incoming audio buffers.
  3204. If both @var{channels} and @var{channel_layout} are specified, then they
  3205. must be consistent.
  3206. @end table
  3207. @subsection Examples
  3208. @example
  3209. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3210. @end example
  3211. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3212. Since the sample format with name "s16p" corresponds to the number
  3213. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3214. equivalent to:
  3215. @example
  3216. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3217. @end example
  3218. @section aevalsrc
  3219. Generate an audio signal specified by an expression.
  3220. This source accepts in input one or more expressions (one for each
  3221. channel), which are evaluated and used to generate a corresponding
  3222. audio signal.
  3223. This source accepts the following options:
  3224. @table @option
  3225. @item exprs
  3226. Set the '|'-separated expressions list for each separate channel. In case the
  3227. @option{channel_layout} option is not specified, the selected channel layout
  3228. depends on the number of provided expressions. Otherwise the last
  3229. specified expression is applied to the remaining output channels.
  3230. @item channel_layout, c
  3231. Set the channel layout. The number of channels in the specified layout
  3232. must be equal to the number of specified expressions.
  3233. @item duration, d
  3234. Set the minimum duration of the sourced audio. See
  3235. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3236. for the accepted syntax.
  3237. Note that the resulting duration may be greater than the specified
  3238. duration, as the generated audio is always cut at the end of a
  3239. complete frame.
  3240. If not specified, or the expressed duration is negative, the audio is
  3241. supposed to be generated forever.
  3242. @item nb_samples, n
  3243. Set the number of samples per channel per each output frame,
  3244. default to 1024.
  3245. @item sample_rate, s
  3246. Specify the sample rate, default to 44100.
  3247. @end table
  3248. Each expression in @var{exprs} can contain the following constants:
  3249. @table @option
  3250. @item n
  3251. number of the evaluated sample, starting from 0
  3252. @item t
  3253. time of the evaluated sample expressed in seconds, starting from 0
  3254. @item s
  3255. sample rate
  3256. @end table
  3257. @subsection Examples
  3258. @itemize
  3259. @item
  3260. Generate silence:
  3261. @example
  3262. aevalsrc=0
  3263. @end example
  3264. @item
  3265. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3266. 8000 Hz:
  3267. @example
  3268. aevalsrc="sin(440*2*PI*t):s=8000"
  3269. @end example
  3270. @item
  3271. Generate a two channels signal, specify the channel layout (Front
  3272. Center + Back Center) explicitly:
  3273. @example
  3274. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3275. @end example
  3276. @item
  3277. Generate white noise:
  3278. @example
  3279. aevalsrc="-2+random(0)"
  3280. @end example
  3281. @item
  3282. Generate an amplitude modulated signal:
  3283. @example
  3284. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3285. @end example
  3286. @item
  3287. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3288. @example
  3289. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3290. @end example
  3291. @end itemize
  3292. @section anullsrc
  3293. The null audio source, return unprocessed audio frames. It is mainly useful
  3294. as a template and to be employed in analysis / debugging tools, or as
  3295. the source for filters which ignore the input data (for example the sox
  3296. synth filter).
  3297. This source accepts the following options:
  3298. @table @option
  3299. @item channel_layout, cl
  3300. Specifies the channel layout, and can be either an integer or a string
  3301. representing a channel layout. The default value of @var{channel_layout}
  3302. is "stereo".
  3303. Check the channel_layout_map definition in
  3304. @file{libavutil/channel_layout.c} for the mapping between strings and
  3305. channel layout values.
  3306. @item sample_rate, r
  3307. Specifies the sample rate, and defaults to 44100.
  3308. @item nb_samples, n
  3309. Set the number of samples per requested frames.
  3310. @end table
  3311. @subsection Examples
  3312. @itemize
  3313. @item
  3314. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3315. @example
  3316. anullsrc=r=48000:cl=4
  3317. @end example
  3318. @item
  3319. Do the same operation with a more obvious syntax:
  3320. @example
  3321. anullsrc=r=48000:cl=mono
  3322. @end example
  3323. @end itemize
  3324. All the parameters need to be explicitly defined.
  3325. @section flite
  3326. Synthesize a voice utterance using the libflite library.
  3327. To enable compilation of this filter you need to configure FFmpeg with
  3328. @code{--enable-libflite}.
  3329. Note that the flite library is not thread-safe.
  3330. The filter accepts the following options:
  3331. @table @option
  3332. @item list_voices
  3333. If set to 1, list the names of the available voices and exit
  3334. immediately. Default value is 0.
  3335. @item nb_samples, n
  3336. Set the maximum number of samples per frame. Default value is 512.
  3337. @item textfile
  3338. Set the filename containing the text to speak.
  3339. @item text
  3340. Set the text to speak.
  3341. @item voice, v
  3342. Set the voice to use for the speech synthesis. Default value is
  3343. @code{kal}. See also the @var{list_voices} option.
  3344. @end table
  3345. @subsection Examples
  3346. @itemize
  3347. @item
  3348. Read from file @file{speech.txt}, and synthesize the text using the
  3349. standard flite voice:
  3350. @example
  3351. flite=textfile=speech.txt
  3352. @end example
  3353. @item
  3354. Read the specified text selecting the @code{slt} voice:
  3355. @example
  3356. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3357. @end example
  3358. @item
  3359. Input text to ffmpeg:
  3360. @example
  3361. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3362. @end example
  3363. @item
  3364. Make @file{ffplay} speak the specified text, using @code{flite} and
  3365. the @code{lavfi} device:
  3366. @example
  3367. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3368. @end example
  3369. @end itemize
  3370. For more information about libflite, check:
  3371. @url{http://www.speech.cs.cmu.edu/flite/}
  3372. @section anoisesrc
  3373. Generate a noise audio signal.
  3374. The filter accepts the following options:
  3375. @table @option
  3376. @item sample_rate, r
  3377. Specify the sample rate. Default value is 48000 Hz.
  3378. @item amplitude, a
  3379. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3380. is 1.0.
  3381. @item duration, d
  3382. Specify the duration of the generated audio stream. Not specifying this option
  3383. results in noise with an infinite length.
  3384. @item color, colour, c
  3385. Specify the color of noise. Available noise colors are white, pink, and brown.
  3386. Default color is white.
  3387. @item seed, s
  3388. Specify a value used to seed the PRNG.
  3389. @item nb_samples, n
  3390. Set the number of samples per each output frame, default is 1024.
  3391. @end table
  3392. @subsection Examples
  3393. @itemize
  3394. @item
  3395. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3396. @example
  3397. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3398. @end example
  3399. @end itemize
  3400. @section sine
  3401. Generate an audio signal made of a sine wave with amplitude 1/8.
  3402. The audio signal is bit-exact.
  3403. The filter accepts the following options:
  3404. @table @option
  3405. @item frequency, f
  3406. Set the carrier frequency. Default is 440 Hz.
  3407. @item beep_factor, b
  3408. Enable a periodic beep every second with frequency @var{beep_factor} times
  3409. the carrier frequency. Default is 0, meaning the beep is disabled.
  3410. @item sample_rate, r
  3411. Specify the sample rate, default is 44100.
  3412. @item duration, d
  3413. Specify the duration of the generated audio stream.
  3414. @item samples_per_frame
  3415. Set the number of samples per output frame.
  3416. The expression can contain the following constants:
  3417. @table @option
  3418. @item n
  3419. The (sequential) number of the output audio frame, starting from 0.
  3420. @item pts
  3421. The PTS (Presentation TimeStamp) of the output audio frame,
  3422. expressed in @var{TB} units.
  3423. @item t
  3424. The PTS of the output audio frame, expressed in seconds.
  3425. @item TB
  3426. The timebase of the output audio frames.
  3427. @end table
  3428. Default is @code{1024}.
  3429. @end table
  3430. @subsection Examples
  3431. @itemize
  3432. @item
  3433. Generate a simple 440 Hz sine wave:
  3434. @example
  3435. sine
  3436. @end example
  3437. @item
  3438. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3439. @example
  3440. sine=220:4:d=5
  3441. sine=f=220:b=4:d=5
  3442. sine=frequency=220:beep_factor=4:duration=5
  3443. @end example
  3444. @item
  3445. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3446. pattern:
  3447. @example
  3448. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3449. @end example
  3450. @end itemize
  3451. @c man end AUDIO SOURCES
  3452. @chapter Audio Sinks
  3453. @c man begin AUDIO SINKS
  3454. Below is a description of the currently available audio sinks.
  3455. @section abuffersink
  3456. Buffer audio frames, and make them available to the end of filter chain.
  3457. This sink is mainly intended for programmatic use, in particular
  3458. through the interface defined in @file{libavfilter/buffersink.h}
  3459. or the options system.
  3460. It accepts a pointer to an AVABufferSinkContext structure, which
  3461. defines the incoming buffers' formats, to be passed as the opaque
  3462. parameter to @code{avfilter_init_filter} for initialization.
  3463. @section anullsink
  3464. Null audio sink; do absolutely nothing with the input audio. It is
  3465. mainly useful as a template and for use in analysis / debugging
  3466. tools.
  3467. @c man end AUDIO SINKS
  3468. @chapter Video Filters
  3469. @c man begin VIDEO FILTERS
  3470. When you configure your FFmpeg build, you can disable any of the
  3471. existing filters using @code{--disable-filters}.
  3472. The configure output will show the video filters included in your
  3473. build.
  3474. Below is a description of the currently available video filters.
  3475. @section alphaextract
  3476. Extract the alpha component from the input as a grayscale video. This
  3477. is especially useful with the @var{alphamerge} filter.
  3478. @section alphamerge
  3479. Add or replace the alpha component of the primary input with the
  3480. grayscale value of a second input. This is intended for use with
  3481. @var{alphaextract} to allow the transmission or storage of frame
  3482. sequences that have alpha in a format that doesn't support an alpha
  3483. channel.
  3484. For example, to reconstruct full frames from a normal YUV-encoded video
  3485. and a separate video created with @var{alphaextract}, you might use:
  3486. @example
  3487. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3488. @end example
  3489. Since this filter is designed for reconstruction, it operates on frame
  3490. sequences without considering timestamps, and terminates when either
  3491. input reaches end of stream. This will cause problems if your encoding
  3492. pipeline drops frames. If you're trying to apply an image as an
  3493. overlay to a video stream, consider the @var{overlay} filter instead.
  3494. @section ass
  3495. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3496. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3497. Substation Alpha) subtitles files.
  3498. This filter accepts the following option in addition to the common options from
  3499. the @ref{subtitles} filter:
  3500. @table @option
  3501. @item shaping
  3502. Set the shaping engine
  3503. Available values are:
  3504. @table @samp
  3505. @item auto
  3506. The default libass shaping engine, which is the best available.
  3507. @item simple
  3508. Fast, font-agnostic shaper that can do only substitutions
  3509. @item complex
  3510. Slower shaper using OpenType for substitutions and positioning
  3511. @end table
  3512. The default is @code{auto}.
  3513. @end table
  3514. @section atadenoise
  3515. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3516. The filter accepts the following options:
  3517. @table @option
  3518. @item 0a
  3519. Set threshold A for 1st plane. Default is 0.02.
  3520. Valid range is 0 to 0.3.
  3521. @item 0b
  3522. Set threshold B for 1st plane. Default is 0.04.
  3523. Valid range is 0 to 5.
  3524. @item 1a
  3525. Set threshold A for 2nd plane. Default is 0.02.
  3526. Valid range is 0 to 0.3.
  3527. @item 1b
  3528. Set threshold B for 2nd plane. Default is 0.04.
  3529. Valid range is 0 to 5.
  3530. @item 2a
  3531. Set threshold A for 3rd plane. Default is 0.02.
  3532. Valid range is 0 to 0.3.
  3533. @item 2b
  3534. Set threshold B for 3rd plane. Default is 0.04.
  3535. Valid range is 0 to 5.
  3536. Threshold A is designed to react on abrupt changes in the input signal and
  3537. threshold B is designed to react on continuous changes in the input signal.
  3538. @item s
  3539. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3540. number in range [5, 129].
  3541. @item p
  3542. Set what planes of frame filter will use for averaging. Default is all.
  3543. @end table
  3544. @section avgblur
  3545. Apply average blur filter.
  3546. The filter accepts the following options:
  3547. @table @option
  3548. @item sizeX
  3549. Set horizontal kernel size.
  3550. @item planes
  3551. Set which planes to filter. By default all planes are filtered.
  3552. @item sizeY
  3553. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3554. Default is @code{0}.
  3555. @end table
  3556. @section bbox
  3557. Compute the bounding box for the non-black pixels in the input frame
  3558. luminance plane.
  3559. This filter computes the bounding box containing all the pixels with a
  3560. luminance value greater than the minimum allowed value.
  3561. The parameters describing the bounding box are printed on the filter
  3562. log.
  3563. The filter accepts the following option:
  3564. @table @option
  3565. @item min_val
  3566. Set the minimal luminance value. Default is @code{16}.
  3567. @end table
  3568. @section bitplanenoise
  3569. Show and measure bit plane noise.
  3570. The filter accepts the following options:
  3571. @table @option
  3572. @item bitplane
  3573. Set which plane to analyze. Default is @code{1}.
  3574. @item filter
  3575. Filter out noisy pixels from @code{bitplane} set above.
  3576. Default is disabled.
  3577. @end table
  3578. @section blackdetect
  3579. Detect video intervals that are (almost) completely black. Can be
  3580. useful to detect chapter transitions, commercials, or invalid
  3581. recordings. Output lines contains the time for the start, end and
  3582. duration of the detected black interval expressed in seconds.
  3583. In order to display the output lines, you need to set the loglevel at
  3584. least to the AV_LOG_INFO value.
  3585. The filter accepts the following options:
  3586. @table @option
  3587. @item black_min_duration, d
  3588. Set the minimum detected black duration expressed in seconds. It must
  3589. be a non-negative floating point number.
  3590. Default value is 2.0.
  3591. @item picture_black_ratio_th, pic_th
  3592. Set the threshold for considering a picture "black".
  3593. Express the minimum value for the ratio:
  3594. @example
  3595. @var{nb_black_pixels} / @var{nb_pixels}
  3596. @end example
  3597. for which a picture is considered black.
  3598. Default value is 0.98.
  3599. @item pixel_black_th, pix_th
  3600. Set the threshold for considering a pixel "black".
  3601. The threshold expresses the maximum pixel luminance value for which a
  3602. pixel is considered "black". The provided value is scaled according to
  3603. the following equation:
  3604. @example
  3605. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3606. @end example
  3607. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3608. the input video format, the range is [0-255] for YUV full-range
  3609. formats and [16-235] for YUV non full-range formats.
  3610. Default value is 0.10.
  3611. @end table
  3612. The following example sets the maximum pixel threshold to the minimum
  3613. value, and detects only black intervals of 2 or more seconds:
  3614. @example
  3615. blackdetect=d=2:pix_th=0.00
  3616. @end example
  3617. @section blackframe
  3618. Detect frames that are (almost) completely black. Can be useful to
  3619. detect chapter transitions or commercials. Output lines consist of
  3620. the frame number of the detected frame, the percentage of blackness,
  3621. the position in the file if known or -1 and the timestamp in seconds.
  3622. In order to display the output lines, you need to set the loglevel at
  3623. least to the AV_LOG_INFO value.
  3624. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3625. The value represents the percentage of pixels in the picture that
  3626. are below the threshold value.
  3627. It accepts the following parameters:
  3628. @table @option
  3629. @item amount
  3630. The percentage of the pixels that have to be below the threshold; it defaults to
  3631. @code{98}.
  3632. @item threshold, thresh
  3633. The threshold below which a pixel value is considered black; it defaults to
  3634. @code{32}.
  3635. @end table
  3636. @section blend, tblend
  3637. Blend two video frames into each other.
  3638. The @code{blend} filter takes two input streams and outputs one
  3639. stream, the first input is the "top" layer and second input is
  3640. "bottom" layer. By default, the output terminates when the longest input terminates.
  3641. The @code{tblend} (time blend) filter takes two consecutive frames
  3642. from one single stream, and outputs the result obtained by blending
  3643. the new frame on top of the old frame.
  3644. A description of the accepted options follows.
  3645. @table @option
  3646. @item c0_mode
  3647. @item c1_mode
  3648. @item c2_mode
  3649. @item c3_mode
  3650. @item all_mode
  3651. Set blend mode for specific pixel component or all pixel components in case
  3652. of @var{all_mode}. Default value is @code{normal}.
  3653. Available values for component modes are:
  3654. @table @samp
  3655. @item addition
  3656. @item addition128
  3657. @item and
  3658. @item average
  3659. @item burn
  3660. @item darken
  3661. @item difference
  3662. @item difference128
  3663. @item divide
  3664. @item dodge
  3665. @item freeze
  3666. @item exclusion
  3667. @item glow
  3668. @item hardlight
  3669. @item hardmix
  3670. @item heat
  3671. @item lighten
  3672. @item linearlight
  3673. @item multiply
  3674. @item multiply128
  3675. @item negation
  3676. @item normal
  3677. @item or
  3678. @item overlay
  3679. @item phoenix
  3680. @item pinlight
  3681. @item reflect
  3682. @item screen
  3683. @item softlight
  3684. @item subtract
  3685. @item vividlight
  3686. @item xor
  3687. @end table
  3688. @item c0_opacity
  3689. @item c1_opacity
  3690. @item c2_opacity
  3691. @item c3_opacity
  3692. @item all_opacity
  3693. Set blend opacity for specific pixel component or all pixel components in case
  3694. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3695. @item c0_expr
  3696. @item c1_expr
  3697. @item c2_expr
  3698. @item c3_expr
  3699. @item all_expr
  3700. Set blend expression for specific pixel component or all pixel components in case
  3701. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3702. The expressions can use the following variables:
  3703. @table @option
  3704. @item N
  3705. The sequential number of the filtered frame, starting from @code{0}.
  3706. @item X
  3707. @item Y
  3708. the coordinates of the current sample
  3709. @item W
  3710. @item H
  3711. the width and height of currently filtered plane
  3712. @item SW
  3713. @item SH
  3714. Width and height scale depending on the currently filtered plane. It is the
  3715. ratio between the corresponding luma plane number of pixels and the current
  3716. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3717. @code{0.5,0.5} for chroma planes.
  3718. @item T
  3719. Time of the current frame, expressed in seconds.
  3720. @item TOP, A
  3721. Value of pixel component at current location for first video frame (top layer).
  3722. @item BOTTOM, B
  3723. Value of pixel component at current location for second video frame (bottom layer).
  3724. @end table
  3725. @item shortest
  3726. Force termination when the shortest input terminates. Default is
  3727. @code{0}. This option is only defined for the @code{blend} filter.
  3728. @item repeatlast
  3729. Continue applying the last bottom frame after the end of the stream. A value of
  3730. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3731. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3732. @end table
  3733. @subsection Examples
  3734. @itemize
  3735. @item
  3736. Apply transition from bottom layer to top layer in first 10 seconds:
  3737. @example
  3738. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3739. @end example
  3740. @item
  3741. Apply 1x1 checkerboard effect:
  3742. @example
  3743. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3744. @end example
  3745. @item
  3746. Apply uncover left effect:
  3747. @example
  3748. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3749. @end example
  3750. @item
  3751. Apply uncover down effect:
  3752. @example
  3753. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3754. @end example
  3755. @item
  3756. Apply uncover up-left effect:
  3757. @example
  3758. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3759. @end example
  3760. @item
  3761. Split diagonally video and shows top and bottom layer on each side:
  3762. @example
  3763. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3764. @end example
  3765. @item
  3766. Display differences between the current and the previous frame:
  3767. @example
  3768. tblend=all_mode=difference128
  3769. @end example
  3770. @end itemize
  3771. @section boxblur
  3772. Apply a boxblur algorithm to the input video.
  3773. It accepts the following parameters:
  3774. @table @option
  3775. @item luma_radius, lr
  3776. @item luma_power, lp
  3777. @item chroma_radius, cr
  3778. @item chroma_power, cp
  3779. @item alpha_radius, ar
  3780. @item alpha_power, ap
  3781. @end table
  3782. A description of the accepted options follows.
  3783. @table @option
  3784. @item luma_radius, lr
  3785. @item chroma_radius, cr
  3786. @item alpha_radius, ar
  3787. Set an expression for the box radius in pixels used for blurring the
  3788. corresponding input plane.
  3789. The radius value must be a non-negative number, and must not be
  3790. greater than the value of the expression @code{min(w,h)/2} for the
  3791. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3792. planes.
  3793. Default value for @option{luma_radius} is "2". If not specified,
  3794. @option{chroma_radius} and @option{alpha_radius} default to the
  3795. corresponding value set for @option{luma_radius}.
  3796. The expressions can contain the following constants:
  3797. @table @option
  3798. @item w
  3799. @item h
  3800. The input width and height in pixels.
  3801. @item cw
  3802. @item ch
  3803. The input chroma image width and height in pixels.
  3804. @item hsub
  3805. @item vsub
  3806. The horizontal and vertical chroma subsample values. For example, for the
  3807. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3808. @end table
  3809. @item luma_power, lp
  3810. @item chroma_power, cp
  3811. @item alpha_power, ap
  3812. Specify how many times the boxblur filter is applied to the
  3813. corresponding plane.
  3814. Default value for @option{luma_power} is 2. If not specified,
  3815. @option{chroma_power} and @option{alpha_power} default to the
  3816. corresponding value set for @option{luma_power}.
  3817. A value of 0 will disable the effect.
  3818. @end table
  3819. @subsection Examples
  3820. @itemize
  3821. @item
  3822. Apply a boxblur filter with the luma, chroma, and alpha radii
  3823. set to 2:
  3824. @example
  3825. boxblur=luma_radius=2:luma_power=1
  3826. boxblur=2:1
  3827. @end example
  3828. @item
  3829. Set the luma radius to 2, and alpha and chroma radius to 0:
  3830. @example
  3831. boxblur=2:1:cr=0:ar=0
  3832. @end example
  3833. @item
  3834. Set the luma and chroma radii to a fraction of the video dimension:
  3835. @example
  3836. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3837. @end example
  3838. @end itemize
  3839. @section bwdif
  3840. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3841. Deinterlacing Filter").
  3842. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3843. interpolation algorithms.
  3844. It accepts the following parameters:
  3845. @table @option
  3846. @item mode
  3847. The interlacing mode to adopt. It accepts one of the following values:
  3848. @table @option
  3849. @item 0, send_frame
  3850. Output one frame for each frame.
  3851. @item 1, send_field
  3852. Output one frame for each field.
  3853. @end table
  3854. The default value is @code{send_field}.
  3855. @item parity
  3856. The picture field parity assumed for the input interlaced video. It accepts one
  3857. of the following values:
  3858. @table @option
  3859. @item 0, tff
  3860. Assume the top field is first.
  3861. @item 1, bff
  3862. Assume the bottom field is first.
  3863. @item -1, auto
  3864. Enable automatic detection of field parity.
  3865. @end table
  3866. The default value is @code{auto}.
  3867. If the interlacing is unknown or the decoder does not export this information,
  3868. top field first will be assumed.
  3869. @item deint
  3870. Specify which frames to deinterlace. Accept one of the following
  3871. values:
  3872. @table @option
  3873. @item 0, all
  3874. Deinterlace all frames.
  3875. @item 1, interlaced
  3876. Only deinterlace frames marked as interlaced.
  3877. @end table
  3878. The default value is @code{all}.
  3879. @end table
  3880. @section chromakey
  3881. YUV colorspace color/chroma keying.
  3882. The filter accepts the following options:
  3883. @table @option
  3884. @item color
  3885. The color which will be replaced with transparency.
  3886. @item similarity
  3887. Similarity percentage with the key color.
  3888. 0.01 matches only the exact key color, while 1.0 matches everything.
  3889. @item blend
  3890. Blend percentage.
  3891. 0.0 makes pixels either fully transparent, or not transparent at all.
  3892. Higher values result in semi-transparent pixels, with a higher transparency
  3893. the more similar the pixels color is to the key color.
  3894. @item yuv
  3895. Signals that the color passed is already in YUV instead of RGB.
  3896. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3897. This can be used to pass exact YUV values as hexadecimal numbers.
  3898. @end table
  3899. @subsection Examples
  3900. @itemize
  3901. @item
  3902. Make every green pixel in the input image transparent:
  3903. @example
  3904. ffmpeg -i input.png -vf chromakey=green out.png
  3905. @end example
  3906. @item
  3907. Overlay a greenscreen-video on top of a static black background.
  3908. @example
  3909. 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
  3910. @end example
  3911. @end itemize
  3912. @section ciescope
  3913. Display CIE color diagram with pixels overlaid onto it.
  3914. The filter accepts the following options:
  3915. @table @option
  3916. @item system
  3917. Set color system.
  3918. @table @samp
  3919. @item ntsc, 470m
  3920. @item ebu, 470bg
  3921. @item smpte
  3922. @item 240m
  3923. @item apple
  3924. @item widergb
  3925. @item cie1931
  3926. @item rec709, hdtv
  3927. @item uhdtv, rec2020
  3928. @end table
  3929. @item cie
  3930. Set CIE system.
  3931. @table @samp
  3932. @item xyy
  3933. @item ucs
  3934. @item luv
  3935. @end table
  3936. @item gamuts
  3937. Set what gamuts to draw.
  3938. See @code{system} option for available values.
  3939. @item size, s
  3940. Set ciescope size, by default set to 512.
  3941. @item intensity, i
  3942. Set intensity used to map input pixel values to CIE diagram.
  3943. @item contrast
  3944. Set contrast used to draw tongue colors that are out of active color system gamut.
  3945. @item corrgamma
  3946. Correct gamma displayed on scope, by default enabled.
  3947. @item showwhite
  3948. Show white point on CIE diagram, by default disabled.
  3949. @item gamma
  3950. Set input gamma. Used only with XYZ input color space.
  3951. @end table
  3952. @section codecview
  3953. Visualize information exported by some codecs.
  3954. Some codecs can export information through frames using side-data or other
  3955. means. For example, some MPEG based codecs export motion vectors through the
  3956. @var{export_mvs} flag in the codec @option{flags2} option.
  3957. The filter accepts the following option:
  3958. @table @option
  3959. @item mv
  3960. Set motion vectors to visualize.
  3961. Available flags for @var{mv} are:
  3962. @table @samp
  3963. @item pf
  3964. forward predicted MVs of P-frames
  3965. @item bf
  3966. forward predicted MVs of B-frames
  3967. @item bb
  3968. backward predicted MVs of B-frames
  3969. @end table
  3970. @item qp
  3971. Display quantization parameters using the chroma planes.
  3972. @item mv_type, mvt
  3973. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3974. Available flags for @var{mv_type} are:
  3975. @table @samp
  3976. @item fp
  3977. forward predicted MVs
  3978. @item bp
  3979. backward predicted MVs
  3980. @end table
  3981. @item frame_type, ft
  3982. Set frame type to visualize motion vectors of.
  3983. Available flags for @var{frame_type} are:
  3984. @table @samp
  3985. @item if
  3986. intra-coded frames (I-frames)
  3987. @item pf
  3988. predicted frames (P-frames)
  3989. @item bf
  3990. bi-directionally predicted frames (B-frames)
  3991. @end table
  3992. @end table
  3993. @subsection Examples
  3994. @itemize
  3995. @item
  3996. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3997. @example
  3998. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3999. @end example
  4000. @item
  4001. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4002. @example
  4003. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4004. @end example
  4005. @end itemize
  4006. @section colorbalance
  4007. Modify intensity of primary colors (red, green and blue) of input frames.
  4008. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4009. regions for the red-cyan, green-magenta or blue-yellow balance.
  4010. A positive adjustment value shifts the balance towards the primary color, a negative
  4011. value towards the complementary color.
  4012. The filter accepts the following options:
  4013. @table @option
  4014. @item rs
  4015. @item gs
  4016. @item bs
  4017. Adjust red, green and blue shadows (darkest pixels).
  4018. @item rm
  4019. @item gm
  4020. @item bm
  4021. Adjust red, green and blue midtones (medium pixels).
  4022. @item rh
  4023. @item gh
  4024. @item bh
  4025. Adjust red, green and blue highlights (brightest pixels).
  4026. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4027. @end table
  4028. @subsection Examples
  4029. @itemize
  4030. @item
  4031. Add red color cast to shadows:
  4032. @example
  4033. colorbalance=rs=.3
  4034. @end example
  4035. @end itemize
  4036. @section colorkey
  4037. RGB colorspace color keying.
  4038. The filter accepts the following options:
  4039. @table @option
  4040. @item color
  4041. The color which will be replaced with transparency.
  4042. @item similarity
  4043. Similarity percentage with the key color.
  4044. 0.01 matches only the exact key color, while 1.0 matches everything.
  4045. @item blend
  4046. Blend percentage.
  4047. 0.0 makes pixels either fully transparent, or not transparent at all.
  4048. Higher values result in semi-transparent pixels, with a higher transparency
  4049. the more similar the pixels color is to the key color.
  4050. @end table
  4051. @subsection Examples
  4052. @itemize
  4053. @item
  4054. Make every green pixel in the input image transparent:
  4055. @example
  4056. ffmpeg -i input.png -vf colorkey=green out.png
  4057. @end example
  4058. @item
  4059. Overlay a greenscreen-video on top of a static background image.
  4060. @example
  4061. 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
  4062. @end example
  4063. @end itemize
  4064. @section colorlevels
  4065. Adjust video input frames using levels.
  4066. The filter accepts the following options:
  4067. @table @option
  4068. @item rimin
  4069. @item gimin
  4070. @item bimin
  4071. @item aimin
  4072. Adjust red, green, blue and alpha input black point.
  4073. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4074. @item rimax
  4075. @item gimax
  4076. @item bimax
  4077. @item aimax
  4078. Adjust red, green, blue and alpha input white point.
  4079. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4080. Input levels are used to lighten highlights (bright tones), darken shadows
  4081. (dark tones), change the balance of bright and dark tones.
  4082. @item romin
  4083. @item gomin
  4084. @item bomin
  4085. @item aomin
  4086. Adjust red, green, blue and alpha output black point.
  4087. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4088. @item romax
  4089. @item gomax
  4090. @item bomax
  4091. @item aomax
  4092. Adjust red, green, blue and alpha output white point.
  4093. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4094. Output levels allows manual selection of a constrained output level range.
  4095. @end table
  4096. @subsection Examples
  4097. @itemize
  4098. @item
  4099. Make video output darker:
  4100. @example
  4101. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4102. @end example
  4103. @item
  4104. Increase contrast:
  4105. @example
  4106. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4107. @end example
  4108. @item
  4109. Make video output lighter:
  4110. @example
  4111. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4112. @end example
  4113. @item
  4114. Increase brightness:
  4115. @example
  4116. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4117. @end example
  4118. @end itemize
  4119. @section colorchannelmixer
  4120. Adjust video input frames by re-mixing color channels.
  4121. This filter modifies a color channel by adding the values associated to
  4122. the other channels of the same pixels. For example if the value to
  4123. modify is red, the output value will be:
  4124. @example
  4125. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4126. @end example
  4127. The filter accepts the following options:
  4128. @table @option
  4129. @item rr
  4130. @item rg
  4131. @item rb
  4132. @item ra
  4133. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4134. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4135. @item gr
  4136. @item gg
  4137. @item gb
  4138. @item ga
  4139. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4140. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4141. @item br
  4142. @item bg
  4143. @item bb
  4144. @item ba
  4145. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4146. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4147. @item ar
  4148. @item ag
  4149. @item ab
  4150. @item aa
  4151. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4152. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4153. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4154. @end table
  4155. @subsection Examples
  4156. @itemize
  4157. @item
  4158. Convert source to grayscale:
  4159. @example
  4160. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4161. @end example
  4162. @item
  4163. Simulate sepia tones:
  4164. @example
  4165. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4166. @end example
  4167. @end itemize
  4168. @section colormatrix
  4169. Convert color matrix.
  4170. The filter accepts the following options:
  4171. @table @option
  4172. @item src
  4173. @item dst
  4174. Specify the source and destination color matrix. Both values must be
  4175. specified.
  4176. The accepted values are:
  4177. @table @samp
  4178. @item bt709
  4179. BT.709
  4180. @item fcc
  4181. FCC
  4182. @item bt601
  4183. BT.601
  4184. @item bt470
  4185. BT.470
  4186. @item bt470bg
  4187. BT.470BG
  4188. @item smpte170m
  4189. SMPTE-170M
  4190. @item smpte240m
  4191. SMPTE-240M
  4192. @item bt2020
  4193. BT.2020
  4194. @end table
  4195. @end table
  4196. For example to convert from BT.601 to SMPTE-240M, use the command:
  4197. @example
  4198. colormatrix=bt601:smpte240m
  4199. @end example
  4200. @section colorspace
  4201. Convert colorspace, transfer characteristics or color primaries.
  4202. Input video needs to have an even size.
  4203. The filter accepts the following options:
  4204. @table @option
  4205. @anchor{all}
  4206. @item all
  4207. Specify all color properties at once.
  4208. The accepted values are:
  4209. @table @samp
  4210. @item bt470m
  4211. BT.470M
  4212. @item bt470bg
  4213. BT.470BG
  4214. @item bt601-6-525
  4215. BT.601-6 525
  4216. @item bt601-6-625
  4217. BT.601-6 625
  4218. @item bt709
  4219. BT.709
  4220. @item smpte170m
  4221. SMPTE-170M
  4222. @item smpte240m
  4223. SMPTE-240M
  4224. @item bt2020
  4225. BT.2020
  4226. @end table
  4227. @anchor{space}
  4228. @item space
  4229. Specify output colorspace.
  4230. The accepted values are:
  4231. @table @samp
  4232. @item bt709
  4233. BT.709
  4234. @item fcc
  4235. FCC
  4236. @item bt470bg
  4237. BT.470BG or BT.601-6 625
  4238. @item smpte170m
  4239. SMPTE-170M or BT.601-6 525
  4240. @item smpte240m
  4241. SMPTE-240M
  4242. @item ycgco
  4243. YCgCo
  4244. @item bt2020ncl
  4245. BT.2020 with non-constant luminance
  4246. @end table
  4247. @anchor{trc}
  4248. @item trc
  4249. Specify output transfer characteristics.
  4250. The accepted values are:
  4251. @table @samp
  4252. @item bt709
  4253. BT.709
  4254. @item bt470m
  4255. BT.470M
  4256. @item bt470bg
  4257. BT.470BG
  4258. @item gamma22
  4259. Constant gamma of 2.2
  4260. @item gamma28
  4261. Constant gamma of 2.8
  4262. @item smpte170m
  4263. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4264. @item smpte240m
  4265. SMPTE-240M
  4266. @item srgb
  4267. SRGB
  4268. @item iec61966-2-1
  4269. iec61966-2-1
  4270. @item iec61966-2-4
  4271. iec61966-2-4
  4272. @item xvycc
  4273. xvycc
  4274. @item bt2020-10
  4275. BT.2020 for 10-bits content
  4276. @item bt2020-12
  4277. BT.2020 for 12-bits content
  4278. @end table
  4279. @anchor{primaries}
  4280. @item primaries
  4281. Specify output color primaries.
  4282. The accepted values are:
  4283. @table @samp
  4284. @item bt709
  4285. BT.709
  4286. @item bt470m
  4287. BT.470M
  4288. @item bt470bg
  4289. BT.470BG or BT.601-6 625
  4290. @item smpte170m
  4291. SMPTE-170M or BT.601-6 525
  4292. @item smpte240m
  4293. SMPTE-240M
  4294. @item film
  4295. film
  4296. @item smpte431
  4297. SMPTE-431
  4298. @item smpte432
  4299. SMPTE-432
  4300. @item bt2020
  4301. BT.2020
  4302. @end table
  4303. @anchor{range}
  4304. @item range
  4305. Specify output color range.
  4306. The accepted values are:
  4307. @table @samp
  4308. @item tv
  4309. TV (restricted) range
  4310. @item mpeg
  4311. MPEG (restricted) range
  4312. @item pc
  4313. PC (full) range
  4314. @item jpeg
  4315. JPEG (full) range
  4316. @end table
  4317. @item format
  4318. Specify output color format.
  4319. The accepted values are:
  4320. @table @samp
  4321. @item yuv420p
  4322. YUV 4:2:0 planar 8-bits
  4323. @item yuv420p10
  4324. YUV 4:2:0 planar 10-bits
  4325. @item yuv420p12
  4326. YUV 4:2:0 planar 12-bits
  4327. @item yuv422p
  4328. YUV 4:2:2 planar 8-bits
  4329. @item yuv422p10
  4330. YUV 4:2:2 planar 10-bits
  4331. @item yuv422p12
  4332. YUV 4:2:2 planar 12-bits
  4333. @item yuv444p
  4334. YUV 4:4:4 planar 8-bits
  4335. @item yuv444p10
  4336. YUV 4:4:4 planar 10-bits
  4337. @item yuv444p12
  4338. YUV 4:4:4 planar 12-bits
  4339. @end table
  4340. @item fast
  4341. Do a fast conversion, which skips gamma/primary correction. This will take
  4342. significantly less CPU, but will be mathematically incorrect. To get output
  4343. compatible with that produced by the colormatrix filter, use fast=1.
  4344. @item dither
  4345. Specify dithering mode.
  4346. The accepted values are:
  4347. @table @samp
  4348. @item none
  4349. No dithering
  4350. @item fsb
  4351. Floyd-Steinberg dithering
  4352. @end table
  4353. @item wpadapt
  4354. Whitepoint adaptation mode.
  4355. The accepted values are:
  4356. @table @samp
  4357. @item bradford
  4358. Bradford whitepoint adaptation
  4359. @item vonkries
  4360. von Kries whitepoint adaptation
  4361. @item identity
  4362. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4363. @end table
  4364. @item iall
  4365. Override all input properties at once. Same accepted values as @ref{all}.
  4366. @item ispace
  4367. Override input colorspace. Same accepted values as @ref{space}.
  4368. @item iprimaries
  4369. Override input color primaries. Same accepted values as @ref{primaries}.
  4370. @item itrc
  4371. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4372. @item irange
  4373. Override input color range. Same accepted values as @ref{range}.
  4374. @end table
  4375. The filter converts the transfer characteristics, color space and color
  4376. primaries to the specified user values. The output value, if not specified,
  4377. is set to a default value based on the "all" property. If that property is
  4378. also not specified, the filter will log an error. The output color range and
  4379. format default to the same value as the input color range and format. The
  4380. input transfer characteristics, color space, color primaries and color range
  4381. should be set on the input data. If any of these are missing, the filter will
  4382. log an error and no conversion will take place.
  4383. For example to convert the input to SMPTE-240M, use the command:
  4384. @example
  4385. colorspace=smpte240m
  4386. @end example
  4387. @section convolution
  4388. Apply convolution 3x3 or 5x5 filter.
  4389. The filter accepts the following options:
  4390. @table @option
  4391. @item 0m
  4392. @item 1m
  4393. @item 2m
  4394. @item 3m
  4395. Set matrix for each plane.
  4396. Matrix is sequence of 9 or 25 signed integers.
  4397. @item 0rdiv
  4398. @item 1rdiv
  4399. @item 2rdiv
  4400. @item 3rdiv
  4401. Set multiplier for calculated value for each plane.
  4402. @item 0bias
  4403. @item 1bias
  4404. @item 2bias
  4405. @item 3bias
  4406. Set bias for each plane. This value is added to the result of the multiplication.
  4407. Useful for making the overall image brighter or darker. Default is 0.0.
  4408. @end table
  4409. @subsection Examples
  4410. @itemize
  4411. @item
  4412. Apply sharpen:
  4413. @example
  4414. 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"
  4415. @end example
  4416. @item
  4417. Apply blur:
  4418. @example
  4419. 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"
  4420. @end example
  4421. @item
  4422. Apply edge enhance:
  4423. @example
  4424. 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"
  4425. @end example
  4426. @item
  4427. Apply edge detect:
  4428. @example
  4429. 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"
  4430. @end example
  4431. @item
  4432. Apply emboss:
  4433. @example
  4434. 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"
  4435. @end example
  4436. @end itemize
  4437. @section copy
  4438. Copy the input video source unchanged to the output. This is mainly useful for
  4439. testing purposes.
  4440. @anchor{coreimage}
  4441. @section coreimage
  4442. Video filtering on GPU using Apple's CoreImage API on OSX.
  4443. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4444. processed by video hardware. However, software-based OpenGL implementations
  4445. exist which means there is no guarantee for hardware processing. It depends on
  4446. the respective OSX.
  4447. There are many filters and image generators provided by Apple that come with a
  4448. large variety of options. The filter has to be referenced by its name along
  4449. with its options.
  4450. The coreimage filter accepts the following options:
  4451. @table @option
  4452. @item list_filters
  4453. List all available filters and generators along with all their respective
  4454. options as well as possible minimum and maximum values along with the default
  4455. values.
  4456. @example
  4457. list_filters=true
  4458. @end example
  4459. @item filter
  4460. Specify all filters by their respective name and options.
  4461. Use @var{list_filters} to determine all valid filter names and options.
  4462. Numerical options are specified by a float value and are automatically clamped
  4463. to their respective value range. Vector and color options have to be specified
  4464. by a list of space separated float values. Character escaping has to be done.
  4465. A special option name @code{default} is available to use default options for a
  4466. filter.
  4467. It is required to specify either @code{default} or at least one of the filter options.
  4468. All omitted options are used with their default values.
  4469. The syntax of the filter string is as follows:
  4470. @example
  4471. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4472. @end example
  4473. @item output_rect
  4474. Specify a rectangle where the output of the filter chain is copied into the
  4475. input image. It is given by a list of space separated float values:
  4476. @example
  4477. output_rect=x\ y\ width\ height
  4478. @end example
  4479. If not given, the output rectangle equals the dimensions of the input image.
  4480. The output rectangle is automatically cropped at the borders of the input
  4481. image. Negative values are valid for each component.
  4482. @example
  4483. output_rect=25\ 25\ 100\ 100
  4484. @end example
  4485. @end table
  4486. Several filters can be chained for successive processing without GPU-HOST
  4487. transfers allowing for fast processing of complex filter chains.
  4488. Currently, only filters with zero (generators) or exactly one (filters) input
  4489. image and one output image are supported. Also, transition filters are not yet
  4490. usable as intended.
  4491. Some filters generate output images with additional padding depending on the
  4492. respective filter kernel. The padding is automatically removed to ensure the
  4493. filter output has the same size as the input image.
  4494. For image generators, the size of the output image is determined by the
  4495. previous output image of the filter chain or the input image of the whole
  4496. filterchain, respectively. The generators do not use the pixel information of
  4497. this image to generate their output. However, the generated output is
  4498. blended onto this image, resulting in partial or complete coverage of the
  4499. output image.
  4500. The @ref{coreimagesrc} video source can be used for generating input images
  4501. which are directly fed into the filter chain. By using it, providing input
  4502. images by another video source or an input video is not required.
  4503. @subsection Examples
  4504. @itemize
  4505. @item
  4506. List all filters available:
  4507. @example
  4508. coreimage=list_filters=true
  4509. @end example
  4510. @item
  4511. Use the CIBoxBlur filter with default options to blur an image:
  4512. @example
  4513. coreimage=filter=CIBoxBlur@@default
  4514. @end example
  4515. @item
  4516. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4517. its center at 100x100 and a radius of 50 pixels:
  4518. @example
  4519. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4520. @end example
  4521. @item
  4522. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4523. given as complete and escaped command-line for Apple's standard bash shell:
  4524. @example
  4525. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4526. @end example
  4527. @end itemize
  4528. @section crop
  4529. Crop the input video to given dimensions.
  4530. It accepts the following parameters:
  4531. @table @option
  4532. @item w, out_w
  4533. The width of the output video. It defaults to @code{iw}.
  4534. This expression is evaluated only once during the filter
  4535. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4536. @item h, out_h
  4537. The height of the output video. It defaults to @code{ih}.
  4538. This expression is evaluated only once during the filter
  4539. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4540. @item x
  4541. The horizontal position, in the input video, of the left edge of the output
  4542. video. It defaults to @code{(in_w-out_w)/2}.
  4543. This expression is evaluated per-frame.
  4544. @item y
  4545. The vertical position, in the input video, of the top edge of the output video.
  4546. It defaults to @code{(in_h-out_h)/2}.
  4547. This expression is evaluated per-frame.
  4548. @item keep_aspect
  4549. If set to 1 will force the output display aspect ratio
  4550. to be the same of the input, by changing the output sample aspect
  4551. ratio. It defaults to 0.
  4552. @item exact
  4553. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4554. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4555. It defaults to 0.
  4556. @end table
  4557. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4558. expressions containing the following constants:
  4559. @table @option
  4560. @item x
  4561. @item y
  4562. The computed values for @var{x} and @var{y}. They are evaluated for
  4563. each new frame.
  4564. @item in_w
  4565. @item in_h
  4566. The input width and height.
  4567. @item iw
  4568. @item ih
  4569. These are the same as @var{in_w} and @var{in_h}.
  4570. @item out_w
  4571. @item out_h
  4572. The output (cropped) width and height.
  4573. @item ow
  4574. @item oh
  4575. These are the same as @var{out_w} and @var{out_h}.
  4576. @item a
  4577. same as @var{iw} / @var{ih}
  4578. @item sar
  4579. input sample aspect ratio
  4580. @item dar
  4581. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4582. @item hsub
  4583. @item vsub
  4584. horizontal and vertical chroma subsample values. For example for the
  4585. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4586. @item n
  4587. The number of the input frame, starting from 0.
  4588. @item pos
  4589. the position in the file of the input frame, NAN if unknown
  4590. @item t
  4591. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4592. @end table
  4593. The expression for @var{out_w} may depend on the value of @var{out_h},
  4594. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4595. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4596. evaluated after @var{out_w} and @var{out_h}.
  4597. The @var{x} and @var{y} parameters specify the expressions for the
  4598. position of the top-left corner of the output (non-cropped) area. They
  4599. are evaluated for each frame. If the evaluated value is not valid, it
  4600. is approximated to the nearest valid value.
  4601. The expression for @var{x} may depend on @var{y}, and the expression
  4602. for @var{y} may depend on @var{x}.
  4603. @subsection Examples
  4604. @itemize
  4605. @item
  4606. Crop area with size 100x100 at position (12,34).
  4607. @example
  4608. crop=100:100:12:34
  4609. @end example
  4610. Using named options, the example above becomes:
  4611. @example
  4612. crop=w=100:h=100:x=12:y=34
  4613. @end example
  4614. @item
  4615. Crop the central input area with size 100x100:
  4616. @example
  4617. crop=100:100
  4618. @end example
  4619. @item
  4620. Crop the central input area with size 2/3 of the input video:
  4621. @example
  4622. crop=2/3*in_w:2/3*in_h
  4623. @end example
  4624. @item
  4625. Crop the input video central square:
  4626. @example
  4627. crop=out_w=in_h
  4628. crop=in_h
  4629. @end example
  4630. @item
  4631. Delimit the rectangle with the top-left corner placed at position
  4632. 100:100 and the right-bottom corner corresponding to the right-bottom
  4633. corner of the input image.
  4634. @example
  4635. crop=in_w-100:in_h-100:100:100
  4636. @end example
  4637. @item
  4638. Crop 10 pixels from the left and right borders, and 20 pixels from
  4639. the top and bottom borders
  4640. @example
  4641. crop=in_w-2*10:in_h-2*20
  4642. @end example
  4643. @item
  4644. Keep only the bottom right quarter of the input image:
  4645. @example
  4646. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4647. @end example
  4648. @item
  4649. Crop height for getting Greek harmony:
  4650. @example
  4651. crop=in_w:1/PHI*in_w
  4652. @end example
  4653. @item
  4654. Apply trembling effect:
  4655. @example
  4656. 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)
  4657. @end example
  4658. @item
  4659. Apply erratic camera effect depending on timestamp:
  4660. @example
  4661. 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)"
  4662. @end example
  4663. @item
  4664. Set x depending on the value of y:
  4665. @example
  4666. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4667. @end example
  4668. @end itemize
  4669. @subsection Commands
  4670. This filter supports the following commands:
  4671. @table @option
  4672. @item w, out_w
  4673. @item h, out_h
  4674. @item x
  4675. @item y
  4676. Set width/height of the output video and the horizontal/vertical position
  4677. in the input video.
  4678. The command accepts the same syntax of the corresponding option.
  4679. If the specified expression is not valid, it is kept at its current
  4680. value.
  4681. @end table
  4682. @section cropdetect
  4683. Auto-detect the crop size.
  4684. It calculates the necessary cropping parameters and prints the
  4685. recommended parameters via the logging system. The detected dimensions
  4686. correspond to the non-black area of the input video.
  4687. It accepts the following parameters:
  4688. @table @option
  4689. @item limit
  4690. Set higher black value threshold, which can be optionally specified
  4691. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4692. value greater to the set value is considered non-black. It defaults to 24.
  4693. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4694. on the bitdepth of the pixel format.
  4695. @item round
  4696. The value which the width/height should be divisible by. It defaults to
  4697. 16. The offset is automatically adjusted to center the video. Use 2 to
  4698. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4699. encoding to most video codecs.
  4700. @item reset_count, reset
  4701. Set the counter that determines after how many frames cropdetect will
  4702. reset the previously detected largest video area and start over to
  4703. detect the current optimal crop area. Default value is 0.
  4704. This can be useful when channel logos distort the video area. 0
  4705. indicates 'never reset', and returns the largest area encountered during
  4706. playback.
  4707. @end table
  4708. @anchor{curves}
  4709. @section curves
  4710. Apply color adjustments using curves.
  4711. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4712. component (red, green and blue) has its values defined by @var{N} key points
  4713. tied from each other using a smooth curve. The x-axis represents the pixel
  4714. values from the input frame, and the y-axis the new pixel values to be set for
  4715. the output frame.
  4716. By default, a component curve is defined by the two points @var{(0;0)} and
  4717. @var{(1;1)}. This creates a straight line where each original pixel value is
  4718. "adjusted" to its own value, which means no change to the image.
  4719. The filter allows you to redefine these two points and add some more. A new
  4720. curve (using a natural cubic spline interpolation) will be define to pass
  4721. smoothly through all these new coordinates. The new defined points needs to be
  4722. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4723. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4724. the vector spaces, the values will be clipped accordingly.
  4725. The filter accepts the following options:
  4726. @table @option
  4727. @item preset
  4728. Select one of the available color presets. This option can be used in addition
  4729. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4730. options takes priority on the preset values.
  4731. Available presets are:
  4732. @table @samp
  4733. @item none
  4734. @item color_negative
  4735. @item cross_process
  4736. @item darker
  4737. @item increase_contrast
  4738. @item lighter
  4739. @item linear_contrast
  4740. @item medium_contrast
  4741. @item negative
  4742. @item strong_contrast
  4743. @item vintage
  4744. @end table
  4745. Default is @code{none}.
  4746. @item master, m
  4747. Set the master key points. These points will define a second pass mapping. It
  4748. is sometimes called a "luminance" or "value" mapping. It can be used with
  4749. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4750. post-processing LUT.
  4751. @item red, r
  4752. Set the key points for the red component.
  4753. @item green, g
  4754. Set the key points for the green component.
  4755. @item blue, b
  4756. Set the key points for the blue component.
  4757. @item all
  4758. Set the key points for all components (not including master).
  4759. Can be used in addition to the other key points component
  4760. options. In this case, the unset component(s) will fallback on this
  4761. @option{all} setting.
  4762. @item psfile
  4763. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4764. @item plot
  4765. Save Gnuplot script of the curves in specified file.
  4766. @end table
  4767. To avoid some filtergraph syntax conflicts, each key points list need to be
  4768. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4769. @subsection Examples
  4770. @itemize
  4771. @item
  4772. Increase slightly the middle level of blue:
  4773. @example
  4774. curves=blue='0/0 0.5/0.58 1/1'
  4775. @end example
  4776. @item
  4777. Vintage effect:
  4778. @example
  4779. 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'
  4780. @end example
  4781. Here we obtain the following coordinates for each components:
  4782. @table @var
  4783. @item red
  4784. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4785. @item green
  4786. @code{(0;0) (0.50;0.48) (1;1)}
  4787. @item blue
  4788. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4789. @end table
  4790. @item
  4791. The previous example can also be achieved with the associated built-in preset:
  4792. @example
  4793. curves=preset=vintage
  4794. @end example
  4795. @item
  4796. Or simply:
  4797. @example
  4798. curves=vintage
  4799. @end example
  4800. @item
  4801. Use a Photoshop preset and redefine the points of the green component:
  4802. @example
  4803. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4804. @end example
  4805. @item
  4806. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4807. and @command{gnuplot}:
  4808. @example
  4809. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4810. gnuplot -p /tmp/curves.plt
  4811. @end example
  4812. @end itemize
  4813. @section datascope
  4814. Video data analysis filter.
  4815. This filter shows hexadecimal pixel values of part of video.
  4816. The filter accepts the following options:
  4817. @table @option
  4818. @item size, s
  4819. Set output video size.
  4820. @item x
  4821. Set x offset from where to pick pixels.
  4822. @item y
  4823. Set y offset from where to pick pixels.
  4824. @item mode
  4825. Set scope mode, can be one of the following:
  4826. @table @samp
  4827. @item mono
  4828. Draw hexadecimal pixel values with white color on black background.
  4829. @item color
  4830. Draw hexadecimal pixel values with input video pixel color on black
  4831. background.
  4832. @item color2
  4833. Draw hexadecimal pixel values on color background picked from input video,
  4834. the text color is picked in such way so its always visible.
  4835. @end table
  4836. @item axis
  4837. Draw rows and columns numbers on left and top of video.
  4838. @item opacity
  4839. Set background opacity.
  4840. @end table
  4841. @section dctdnoiz
  4842. Denoise frames using 2D DCT (frequency domain filtering).
  4843. This filter is not designed for real time.
  4844. The filter accepts the following options:
  4845. @table @option
  4846. @item sigma, s
  4847. Set the noise sigma constant.
  4848. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4849. coefficient (absolute value) below this threshold with be dropped.
  4850. If you need a more advanced filtering, see @option{expr}.
  4851. Default is @code{0}.
  4852. @item overlap
  4853. Set number overlapping pixels for each block. Since the filter can be slow, you
  4854. may want to reduce this value, at the cost of a less effective filter and the
  4855. risk of various artefacts.
  4856. If the overlapping value doesn't permit processing the whole input width or
  4857. height, a warning will be displayed and according borders won't be denoised.
  4858. Default value is @var{blocksize}-1, which is the best possible setting.
  4859. @item expr, e
  4860. Set the coefficient factor expression.
  4861. For each coefficient of a DCT block, this expression will be evaluated as a
  4862. multiplier value for the coefficient.
  4863. If this is option is set, the @option{sigma} option will be ignored.
  4864. The absolute value of the coefficient can be accessed through the @var{c}
  4865. variable.
  4866. @item n
  4867. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4868. @var{blocksize}, which is the width and height of the processed blocks.
  4869. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4870. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4871. on the speed processing. Also, a larger block size does not necessarily means a
  4872. better de-noising.
  4873. @end table
  4874. @subsection Examples
  4875. Apply a denoise with a @option{sigma} of @code{4.5}:
  4876. @example
  4877. dctdnoiz=4.5
  4878. @end example
  4879. The same operation can be achieved using the expression system:
  4880. @example
  4881. dctdnoiz=e='gte(c, 4.5*3)'
  4882. @end example
  4883. Violent denoise using a block size of @code{16x16}:
  4884. @example
  4885. dctdnoiz=15:n=4
  4886. @end example
  4887. @section deband
  4888. Remove banding artifacts from input video.
  4889. It works by replacing banded pixels with average value of referenced pixels.
  4890. The filter accepts the following options:
  4891. @table @option
  4892. @item 1thr
  4893. @item 2thr
  4894. @item 3thr
  4895. @item 4thr
  4896. Set banding detection threshold for each plane. Default is 0.02.
  4897. Valid range is 0.00003 to 0.5.
  4898. If difference between current pixel and reference pixel is less than threshold,
  4899. it will be considered as banded.
  4900. @item range, r
  4901. Banding detection range in pixels. Default is 16. If positive, random number
  4902. in range 0 to set value will be used. If negative, exact absolute value
  4903. will be used.
  4904. The range defines square of four pixels around current pixel.
  4905. @item direction, d
  4906. Set direction in radians from which four pixel will be compared. If positive,
  4907. random direction from 0 to set direction will be picked. If negative, exact of
  4908. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4909. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4910. column.
  4911. @item blur, b
  4912. If enabled, current pixel is compared with average value of all four
  4913. surrounding pixels. The default is enabled. If disabled current pixel is
  4914. compared with all four surrounding pixels. The pixel is considered banded
  4915. if only all four differences with surrounding pixels are less than threshold.
  4916. @item coupling, c
  4917. If enabled, current pixel is changed if and only if all pixel components are banded,
  4918. e.g. banding detection threshold is triggered for all color components.
  4919. The default is disabled.
  4920. @end table
  4921. @anchor{decimate}
  4922. @section decimate
  4923. Drop duplicated frames at regular intervals.
  4924. The filter accepts the following options:
  4925. @table @option
  4926. @item cycle
  4927. Set the number of frames from which one will be dropped. Setting this to
  4928. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4929. Default is @code{5}.
  4930. @item dupthresh
  4931. Set the threshold for duplicate detection. If the difference metric for a frame
  4932. is less than or equal to this value, then it is declared as duplicate. Default
  4933. is @code{1.1}
  4934. @item scthresh
  4935. Set scene change threshold. Default is @code{15}.
  4936. @item blockx
  4937. @item blocky
  4938. Set the size of the x and y-axis blocks used during metric calculations.
  4939. Larger blocks give better noise suppression, but also give worse detection of
  4940. small movements. Must be a power of two. Default is @code{32}.
  4941. @item ppsrc
  4942. Mark main input as a pre-processed input and activate clean source input
  4943. stream. This allows the input to be pre-processed with various filters to help
  4944. the metrics calculation while keeping the frame selection lossless. When set to
  4945. @code{1}, the first stream is for the pre-processed input, and the second
  4946. stream is the clean source from where the kept frames are chosen. Default is
  4947. @code{0}.
  4948. @item chroma
  4949. Set whether or not chroma is considered in the metric calculations. Default is
  4950. @code{1}.
  4951. @end table
  4952. @section deflate
  4953. Apply deflate effect to the video.
  4954. This filter replaces the pixel by the local(3x3) average by taking into account
  4955. only values lower than the pixel.
  4956. It accepts the following options:
  4957. @table @option
  4958. @item threshold0
  4959. @item threshold1
  4960. @item threshold2
  4961. @item threshold3
  4962. Limit the maximum change for each plane, default is 65535.
  4963. If 0, plane will remain unchanged.
  4964. @end table
  4965. @section deflicker
  4966. Remove temporal frame luminance variations.
  4967. It accepts the following options:
  4968. @table @option
  4969. @item size, s
  4970. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  4971. @item mode, m
  4972. Set averaging mode to smooth temporal luminance variations.
  4973. Available values are:
  4974. @table @samp
  4975. @item am
  4976. Arithmetic mean
  4977. @item gm
  4978. Geometric mean
  4979. @item hm
  4980. Harmonic mean
  4981. @item qm
  4982. Quadratic mean
  4983. @item cm
  4984. Cubic mean
  4985. @item pm
  4986. Power mean
  4987. @item median
  4988. Median
  4989. @end table
  4990. @item bypass
  4991. Do not actually modify frame. Useful when one only wants metadata.
  4992. @end table
  4993. @section dejudder
  4994. Remove judder produced by partially interlaced telecined content.
  4995. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4996. source was partially telecined content then the output of @code{pullup,dejudder}
  4997. will have a variable frame rate. May change the recorded frame rate of the
  4998. container. Aside from that change, this filter will not affect constant frame
  4999. rate video.
  5000. The option available in this filter is:
  5001. @table @option
  5002. @item cycle
  5003. Specify the length of the window over which the judder repeats.
  5004. Accepts any integer greater than 1. Useful values are:
  5005. @table @samp
  5006. @item 4
  5007. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5008. @item 5
  5009. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5010. @item 20
  5011. If a mixture of the two.
  5012. @end table
  5013. The default is @samp{4}.
  5014. @end table
  5015. @section delogo
  5016. Suppress a TV station logo by a simple interpolation of the surrounding
  5017. pixels. Just set a rectangle covering the logo and watch it disappear
  5018. (and sometimes something even uglier appear - your mileage may vary).
  5019. It accepts the following parameters:
  5020. @table @option
  5021. @item x
  5022. @item y
  5023. Specify the top left corner coordinates of the logo. They must be
  5024. specified.
  5025. @item w
  5026. @item h
  5027. Specify the width and height of the logo to clear. They must be
  5028. specified.
  5029. @item band, t
  5030. Specify the thickness of the fuzzy edge of the rectangle (added to
  5031. @var{w} and @var{h}). The default value is 1. This option is
  5032. deprecated, setting higher values should no longer be necessary and
  5033. is not recommended.
  5034. @item show
  5035. When set to 1, a green rectangle is drawn on the screen to simplify
  5036. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5037. The default value is 0.
  5038. The rectangle is drawn on the outermost pixels which will be (partly)
  5039. replaced with interpolated values. The values of the next pixels
  5040. immediately outside this rectangle in each direction will be used to
  5041. compute the interpolated pixel values inside the rectangle.
  5042. @end table
  5043. @subsection Examples
  5044. @itemize
  5045. @item
  5046. Set a rectangle covering the area with top left corner coordinates 0,0
  5047. and size 100x77, and a band of size 10:
  5048. @example
  5049. delogo=x=0:y=0:w=100:h=77:band=10
  5050. @end example
  5051. @end itemize
  5052. @section deshake
  5053. Attempt to fix small changes in horizontal and/or vertical shift. This
  5054. filter helps remove camera shake from hand-holding a camera, bumping a
  5055. tripod, moving on a vehicle, etc.
  5056. The filter accepts the following options:
  5057. @table @option
  5058. @item x
  5059. @item y
  5060. @item w
  5061. @item h
  5062. Specify a rectangular area where to limit the search for motion
  5063. vectors.
  5064. If desired the search for motion vectors can be limited to a
  5065. rectangular area of the frame defined by its top left corner, width
  5066. and height. These parameters have the same meaning as the drawbox
  5067. filter which can be used to visualise the position of the bounding
  5068. box.
  5069. This is useful when simultaneous movement of subjects within the frame
  5070. might be confused for camera motion by the motion vector search.
  5071. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5072. then the full frame is used. This allows later options to be set
  5073. without specifying the bounding box for the motion vector search.
  5074. Default - search the whole frame.
  5075. @item rx
  5076. @item ry
  5077. Specify the maximum extent of movement in x and y directions in the
  5078. range 0-64 pixels. Default 16.
  5079. @item edge
  5080. Specify how to generate pixels to fill blanks at the edge of the
  5081. frame. Available values are:
  5082. @table @samp
  5083. @item blank, 0
  5084. Fill zeroes at blank locations
  5085. @item original, 1
  5086. Original image at blank locations
  5087. @item clamp, 2
  5088. Extruded edge value at blank locations
  5089. @item mirror, 3
  5090. Mirrored edge at blank locations
  5091. @end table
  5092. Default value is @samp{mirror}.
  5093. @item blocksize
  5094. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5095. default 8.
  5096. @item contrast
  5097. Specify the contrast threshold for blocks. Only blocks with more than
  5098. the specified contrast (difference between darkest and lightest
  5099. pixels) will be considered. Range 1-255, default 125.
  5100. @item search
  5101. Specify the search strategy. Available values are:
  5102. @table @samp
  5103. @item exhaustive, 0
  5104. Set exhaustive search
  5105. @item less, 1
  5106. Set less exhaustive search.
  5107. @end table
  5108. Default value is @samp{exhaustive}.
  5109. @item filename
  5110. If set then a detailed log of the motion search is written to the
  5111. specified file.
  5112. @item opencl
  5113. If set to 1, specify using OpenCL capabilities, only available if
  5114. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5115. @end table
  5116. @section detelecine
  5117. Apply an exact inverse of the telecine operation. It requires a predefined
  5118. pattern specified using the pattern option which must be the same as that passed
  5119. to the telecine filter.
  5120. This filter accepts the following options:
  5121. @table @option
  5122. @item first_field
  5123. @table @samp
  5124. @item top, t
  5125. top field first
  5126. @item bottom, b
  5127. bottom field first
  5128. The default value is @code{top}.
  5129. @end table
  5130. @item pattern
  5131. A string of numbers representing the pulldown pattern you wish to apply.
  5132. The default value is @code{23}.
  5133. @item start_frame
  5134. A number representing position of the first frame with respect to the telecine
  5135. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5136. @end table
  5137. @section dilation
  5138. Apply dilation effect to the video.
  5139. This filter replaces the pixel by the local(3x3) maximum.
  5140. It accepts the following options:
  5141. @table @option
  5142. @item threshold0
  5143. @item threshold1
  5144. @item threshold2
  5145. @item threshold3
  5146. Limit the maximum change for each plane, default is 65535.
  5147. If 0, plane will remain unchanged.
  5148. @item coordinates
  5149. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5150. pixels are used.
  5151. Flags to local 3x3 coordinates maps like this:
  5152. 1 2 3
  5153. 4 5
  5154. 6 7 8
  5155. @end table
  5156. @section displace
  5157. Displace pixels as indicated by second and third input stream.
  5158. It takes three input streams and outputs one stream, the first input is the
  5159. source, and second and third input are displacement maps.
  5160. The second input specifies how much to displace pixels along the
  5161. x-axis, while the third input specifies how much to displace pixels
  5162. along the y-axis.
  5163. If one of displacement map streams terminates, last frame from that
  5164. displacement map will be used.
  5165. Note that once generated, displacements maps can be reused over and over again.
  5166. A description of the accepted options follows.
  5167. @table @option
  5168. @item edge
  5169. Set displace behavior for pixels that are out of range.
  5170. Available values are:
  5171. @table @samp
  5172. @item blank
  5173. Missing pixels are replaced by black pixels.
  5174. @item smear
  5175. Adjacent pixels will spread out to replace missing pixels.
  5176. @item wrap
  5177. Out of range pixels are wrapped so they point to pixels of other side.
  5178. @end table
  5179. Default is @samp{smear}.
  5180. @end table
  5181. @subsection Examples
  5182. @itemize
  5183. @item
  5184. Add ripple effect to rgb input of video size hd720:
  5185. @example
  5186. 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
  5187. @end example
  5188. @item
  5189. Add wave effect to rgb input of video size hd720:
  5190. @example
  5191. 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
  5192. @end example
  5193. @end itemize
  5194. @section drawbox
  5195. Draw a colored box on the input image.
  5196. It accepts the following parameters:
  5197. @table @option
  5198. @item x
  5199. @item y
  5200. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5201. @item width, w
  5202. @item height, h
  5203. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5204. the input width and height. It defaults to 0.
  5205. @item color, c
  5206. Specify the color of the box to write. For the general syntax of this option,
  5207. check the "Color" section in the ffmpeg-utils manual. If the special
  5208. value @code{invert} is used, the box edge color is the same as the
  5209. video with inverted luma.
  5210. @item thickness, t
  5211. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5212. See below for the list of accepted constants.
  5213. @end table
  5214. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5215. following constants:
  5216. @table @option
  5217. @item dar
  5218. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5219. @item hsub
  5220. @item vsub
  5221. horizontal and vertical chroma subsample values. For example for the
  5222. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5223. @item in_h, ih
  5224. @item in_w, iw
  5225. The input width and height.
  5226. @item sar
  5227. The input sample aspect ratio.
  5228. @item x
  5229. @item y
  5230. The x and y offset coordinates where the box is drawn.
  5231. @item w
  5232. @item h
  5233. The width and height of the drawn box.
  5234. @item t
  5235. The thickness of the drawn box.
  5236. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5237. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5238. @end table
  5239. @subsection Examples
  5240. @itemize
  5241. @item
  5242. Draw a black box around the edge of the input image:
  5243. @example
  5244. drawbox
  5245. @end example
  5246. @item
  5247. Draw a box with color red and an opacity of 50%:
  5248. @example
  5249. drawbox=10:20:200:60:red@@0.5
  5250. @end example
  5251. The previous example can be specified as:
  5252. @example
  5253. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5254. @end example
  5255. @item
  5256. Fill the box with pink color:
  5257. @example
  5258. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5259. @end example
  5260. @item
  5261. Draw a 2-pixel red 2.40:1 mask:
  5262. @example
  5263. 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
  5264. @end example
  5265. @end itemize
  5266. @section drawgrid
  5267. Draw a grid on the input image.
  5268. It accepts the following parameters:
  5269. @table @option
  5270. @item x
  5271. @item y
  5272. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5273. @item width, w
  5274. @item height, h
  5275. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5276. input width and height, respectively, minus @code{thickness}, so image gets
  5277. framed. Default to 0.
  5278. @item color, c
  5279. Specify the color of the grid. For the general syntax of this option,
  5280. check the "Color" section in the ffmpeg-utils manual. If the special
  5281. value @code{invert} is used, the grid color is the same as the
  5282. video with inverted luma.
  5283. @item thickness, t
  5284. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5285. See below for the list of accepted constants.
  5286. @end table
  5287. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5288. following constants:
  5289. @table @option
  5290. @item dar
  5291. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5292. @item hsub
  5293. @item vsub
  5294. horizontal and vertical chroma subsample values. For example for the
  5295. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5296. @item in_h, ih
  5297. @item in_w, iw
  5298. The input grid cell width and height.
  5299. @item sar
  5300. The input sample aspect ratio.
  5301. @item x
  5302. @item y
  5303. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5304. @item w
  5305. @item h
  5306. The width and height of the drawn cell.
  5307. @item t
  5308. The thickness of the drawn cell.
  5309. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5310. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5311. @end table
  5312. @subsection Examples
  5313. @itemize
  5314. @item
  5315. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5316. @example
  5317. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5318. @end example
  5319. @item
  5320. Draw a white 3x3 grid with an opacity of 50%:
  5321. @example
  5322. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5323. @end example
  5324. @end itemize
  5325. @anchor{drawtext}
  5326. @section drawtext
  5327. Draw a text string or text from a specified file on top of a video, using the
  5328. libfreetype library.
  5329. To enable compilation of this filter, you need to configure FFmpeg with
  5330. @code{--enable-libfreetype}.
  5331. To enable default font fallback and the @var{font} option you need to
  5332. configure FFmpeg with @code{--enable-libfontconfig}.
  5333. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5334. @code{--enable-libfribidi}.
  5335. @subsection Syntax
  5336. It accepts the following parameters:
  5337. @table @option
  5338. @item box
  5339. Used to draw a box around text using the background color.
  5340. The value must be either 1 (enable) or 0 (disable).
  5341. The default value of @var{box} is 0.
  5342. @item boxborderw
  5343. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5344. The default value of @var{boxborderw} is 0.
  5345. @item boxcolor
  5346. The color to be used for drawing box around text. For the syntax of this
  5347. option, check the "Color" section in the ffmpeg-utils manual.
  5348. The default value of @var{boxcolor} is "white".
  5349. @item line_spacing
  5350. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5351. The default value of @var{line_spacing} is 0.
  5352. @item borderw
  5353. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5354. The default value of @var{borderw} is 0.
  5355. @item bordercolor
  5356. Set the color to be used for drawing border around text. For the syntax of this
  5357. option, check the "Color" section in the ffmpeg-utils manual.
  5358. The default value of @var{bordercolor} is "black".
  5359. @item expansion
  5360. Select how the @var{text} is expanded. Can be either @code{none},
  5361. @code{strftime} (deprecated) or
  5362. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5363. below for details.
  5364. @item basetime
  5365. Set a start time for the count. Value is in microseconds. Only applied
  5366. in the deprecated strftime expansion mode. To emulate in normal expansion
  5367. mode use the @code{pts} function, supplying the start time (in seconds)
  5368. as the second argument.
  5369. @item fix_bounds
  5370. If true, check and fix text coords to avoid clipping.
  5371. @item fontcolor
  5372. The color to be used for drawing fonts. For the syntax of this option, check
  5373. the "Color" section in the ffmpeg-utils manual.
  5374. The default value of @var{fontcolor} is "black".
  5375. @item fontcolor_expr
  5376. String which is expanded the same way as @var{text} to obtain dynamic
  5377. @var{fontcolor} value. By default this option has empty value and is not
  5378. processed. When this option is set, it overrides @var{fontcolor} option.
  5379. @item font
  5380. The font family to be used for drawing text. By default Sans.
  5381. @item fontfile
  5382. The font file to be used for drawing text. The path must be included.
  5383. This parameter is mandatory if the fontconfig support is disabled.
  5384. @item alpha
  5385. Draw the text applying alpha blending. The value can
  5386. be a number between 0.0 and 1.0.
  5387. The expression accepts the same variables @var{x, y} as well.
  5388. The default value is 1.
  5389. Please see @var{fontcolor_expr}.
  5390. @item fontsize
  5391. The font size to be used for drawing text.
  5392. The default value of @var{fontsize} is 16.
  5393. @item text_shaping
  5394. If set to 1, attempt to shape the text (for example, reverse the order of
  5395. right-to-left text and join Arabic characters) before drawing it.
  5396. Otherwise, just draw the text exactly as given.
  5397. By default 1 (if supported).
  5398. @item ft_load_flags
  5399. The flags to be used for loading the fonts.
  5400. The flags map the corresponding flags supported by libfreetype, and are
  5401. a combination of the following values:
  5402. @table @var
  5403. @item default
  5404. @item no_scale
  5405. @item no_hinting
  5406. @item render
  5407. @item no_bitmap
  5408. @item vertical_layout
  5409. @item force_autohint
  5410. @item crop_bitmap
  5411. @item pedantic
  5412. @item ignore_global_advance_width
  5413. @item no_recurse
  5414. @item ignore_transform
  5415. @item monochrome
  5416. @item linear_design
  5417. @item no_autohint
  5418. @end table
  5419. Default value is "default".
  5420. For more information consult the documentation for the FT_LOAD_*
  5421. libfreetype flags.
  5422. @item shadowcolor
  5423. The color to be used for drawing a shadow behind the drawn text. For the
  5424. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5425. The default value of @var{shadowcolor} is "black".
  5426. @item shadowx
  5427. @item shadowy
  5428. The x and y offsets for the text shadow position with respect to the
  5429. position of the text. They can be either positive or negative
  5430. values. The default value for both is "0".
  5431. @item start_number
  5432. The starting frame number for the n/frame_num variable. The default value
  5433. is "0".
  5434. @item tabsize
  5435. The size in number of spaces to use for rendering the tab.
  5436. Default value is 4.
  5437. @item timecode
  5438. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5439. format. It can be used with or without text parameter. @var{timecode_rate}
  5440. option must be specified.
  5441. @item timecode_rate, rate, r
  5442. Set the timecode frame rate (timecode only).
  5443. @item tc24hmax
  5444. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5445. Default is 0 (disabled).
  5446. @item text
  5447. The text string to be drawn. The text must be a sequence of UTF-8
  5448. encoded characters.
  5449. This parameter is mandatory if no file is specified with the parameter
  5450. @var{textfile}.
  5451. @item textfile
  5452. A text file containing text to be drawn. The text must be a sequence
  5453. of UTF-8 encoded characters.
  5454. This parameter is mandatory if no text string is specified with the
  5455. parameter @var{text}.
  5456. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5457. @item reload
  5458. If set to 1, the @var{textfile} will be reloaded before each frame.
  5459. Be sure to update it atomically, or it may be read partially, or even fail.
  5460. @item x
  5461. @item y
  5462. The expressions which specify the offsets where text will be drawn
  5463. within the video frame. They are relative to the top/left border of the
  5464. output image.
  5465. The default value of @var{x} and @var{y} is "0".
  5466. See below for the list of accepted constants and functions.
  5467. @end table
  5468. The parameters for @var{x} and @var{y} are expressions containing the
  5469. following constants and functions:
  5470. @table @option
  5471. @item dar
  5472. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5473. @item hsub
  5474. @item vsub
  5475. horizontal and vertical chroma subsample values. For example for the
  5476. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5477. @item line_h, lh
  5478. the height of each text line
  5479. @item main_h, h, H
  5480. the input height
  5481. @item main_w, w, W
  5482. the input width
  5483. @item max_glyph_a, ascent
  5484. the maximum distance from the baseline to the highest/upper grid
  5485. coordinate used to place a glyph outline point, for all the rendered
  5486. glyphs.
  5487. It is a positive value, due to the grid's orientation with the Y axis
  5488. upwards.
  5489. @item max_glyph_d, descent
  5490. the maximum distance from the baseline to the lowest grid coordinate
  5491. used to place a glyph outline point, for all the rendered glyphs.
  5492. This is a negative value, due to the grid's orientation, with the Y axis
  5493. upwards.
  5494. @item max_glyph_h
  5495. maximum glyph height, that is the maximum height for all the glyphs
  5496. contained in the rendered text, it is equivalent to @var{ascent} -
  5497. @var{descent}.
  5498. @item max_glyph_w
  5499. maximum glyph width, that is the maximum width for all the glyphs
  5500. contained in the rendered text
  5501. @item n
  5502. the number of input frame, starting from 0
  5503. @item rand(min, max)
  5504. return a random number included between @var{min} and @var{max}
  5505. @item sar
  5506. The input sample aspect ratio.
  5507. @item t
  5508. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5509. @item text_h, th
  5510. the height of the rendered text
  5511. @item text_w, tw
  5512. the width of the rendered text
  5513. @item x
  5514. @item y
  5515. the x and y offset coordinates where the text is drawn.
  5516. These parameters allow the @var{x} and @var{y} expressions to refer
  5517. each other, so you can for example specify @code{y=x/dar}.
  5518. @end table
  5519. @anchor{drawtext_expansion}
  5520. @subsection Text expansion
  5521. If @option{expansion} is set to @code{strftime},
  5522. the filter recognizes strftime() sequences in the provided text and
  5523. expands them accordingly. Check the documentation of strftime(). This
  5524. feature is deprecated.
  5525. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5526. If @option{expansion} is set to @code{normal} (which is the default),
  5527. the following expansion mechanism is used.
  5528. The backslash character @samp{\}, followed by any character, always expands to
  5529. the second character.
  5530. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5531. braces is a function name, possibly followed by arguments separated by ':'.
  5532. If the arguments contain special characters or delimiters (':' or '@}'),
  5533. they should be escaped.
  5534. Note that they probably must also be escaped as the value for the
  5535. @option{text} option in the filter argument string and as the filter
  5536. argument in the filtergraph description, and possibly also for the shell,
  5537. that makes up to four levels of escaping; using a text file avoids these
  5538. problems.
  5539. The following functions are available:
  5540. @table @command
  5541. @item expr, e
  5542. The expression evaluation result.
  5543. It must take one argument specifying the expression to be evaluated,
  5544. which accepts the same constants and functions as the @var{x} and
  5545. @var{y} values. Note that not all constants should be used, for
  5546. example the text size is not known when evaluating the expression, so
  5547. the constants @var{text_w} and @var{text_h} will have an undefined
  5548. value.
  5549. @item expr_int_format, eif
  5550. Evaluate the expression's value and output as formatted integer.
  5551. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5552. The second argument specifies the output format. Allowed values are @samp{x},
  5553. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5554. @code{printf} function.
  5555. The third parameter is optional and sets the number of positions taken by the output.
  5556. It can be used to add padding with zeros from the left.
  5557. @item gmtime
  5558. The time at which the filter is running, expressed in UTC.
  5559. It can accept an argument: a strftime() format string.
  5560. @item localtime
  5561. The time at which the filter is running, expressed in the local time zone.
  5562. It can accept an argument: a strftime() format string.
  5563. @item metadata
  5564. Frame metadata. Takes one or two arguments.
  5565. The first argument is mandatory and specifies the metadata key.
  5566. The second argument is optional and specifies a default value, used when the
  5567. metadata key is not found or empty.
  5568. @item n, frame_num
  5569. The frame number, starting from 0.
  5570. @item pict_type
  5571. A 1 character description of the current picture type.
  5572. @item pts
  5573. The timestamp of the current frame.
  5574. It can take up to three arguments.
  5575. The first argument is the format of the timestamp; it defaults to @code{flt}
  5576. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5577. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5578. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5579. @code{localtime} stands for the timestamp of the frame formatted as
  5580. local time zone time.
  5581. The second argument is an offset added to the timestamp.
  5582. If the format is set to @code{localtime} or @code{gmtime},
  5583. a third argument may be supplied: a strftime() format string.
  5584. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5585. @end table
  5586. @subsection Examples
  5587. @itemize
  5588. @item
  5589. Draw "Test Text" with font FreeSerif, using the default values for the
  5590. optional parameters.
  5591. @example
  5592. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5593. @end example
  5594. @item
  5595. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5596. and y=50 (counting from the top-left corner of the screen), text is
  5597. yellow with a red box around it. Both the text and the box have an
  5598. opacity of 20%.
  5599. @example
  5600. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5601. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5602. @end example
  5603. Note that the double quotes are not necessary if spaces are not used
  5604. within the parameter list.
  5605. @item
  5606. Show the text at the center of the video frame:
  5607. @example
  5608. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5609. @end example
  5610. @item
  5611. Show the text at a random position, switching to a new position every 30 seconds:
  5612. @example
  5613. 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)"
  5614. @end example
  5615. @item
  5616. Show a text line sliding from right to left in the last row of the video
  5617. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5618. with no newlines.
  5619. @example
  5620. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5621. @end example
  5622. @item
  5623. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5624. @example
  5625. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5626. @end example
  5627. @item
  5628. Draw a single green letter "g", at the center of the input video.
  5629. The glyph baseline is placed at half screen height.
  5630. @example
  5631. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5632. @end example
  5633. @item
  5634. Show text for 1 second every 3 seconds:
  5635. @example
  5636. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5637. @end example
  5638. @item
  5639. Use fontconfig to set the font. Note that the colons need to be escaped.
  5640. @example
  5641. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5642. @end example
  5643. @item
  5644. Print the date of a real-time encoding (see strftime(3)):
  5645. @example
  5646. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5647. @end example
  5648. @item
  5649. Show text fading in and out (appearing/disappearing):
  5650. @example
  5651. #!/bin/sh
  5652. DS=1.0 # display start
  5653. DE=10.0 # display end
  5654. FID=1.5 # fade in duration
  5655. FOD=5 # fade out duration
  5656. 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 @}"
  5657. @end example
  5658. @item
  5659. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5660. and the @option{fontsize} value are included in the @option{y} offset.
  5661. @example
  5662. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5663. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5664. @end example
  5665. @end itemize
  5666. For more information about libfreetype, check:
  5667. @url{http://www.freetype.org/}.
  5668. For more information about fontconfig, check:
  5669. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5670. For more information about libfribidi, check:
  5671. @url{http://fribidi.org/}.
  5672. @section edgedetect
  5673. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5674. The filter accepts the following options:
  5675. @table @option
  5676. @item low
  5677. @item high
  5678. Set low and high threshold values used by the Canny thresholding
  5679. algorithm.
  5680. The high threshold selects the "strong" edge pixels, which are then
  5681. connected through 8-connectivity with the "weak" edge pixels selected
  5682. by the low threshold.
  5683. @var{low} and @var{high} threshold values must be chosen in the range
  5684. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5685. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5686. is @code{50/255}.
  5687. @item mode
  5688. Define the drawing mode.
  5689. @table @samp
  5690. @item wires
  5691. Draw white/gray wires on black background.
  5692. @item colormix
  5693. Mix the colors to create a paint/cartoon effect.
  5694. @end table
  5695. Default value is @var{wires}.
  5696. @end table
  5697. @subsection Examples
  5698. @itemize
  5699. @item
  5700. Standard edge detection with custom values for the hysteresis thresholding:
  5701. @example
  5702. edgedetect=low=0.1:high=0.4
  5703. @end example
  5704. @item
  5705. Painting effect without thresholding:
  5706. @example
  5707. edgedetect=mode=colormix:high=0
  5708. @end example
  5709. @end itemize
  5710. @section eq
  5711. Set brightness, contrast, saturation and approximate gamma adjustment.
  5712. The filter accepts the following options:
  5713. @table @option
  5714. @item contrast
  5715. Set the contrast expression. The value must be a float value in range
  5716. @code{-2.0} to @code{2.0}. The default value is "1".
  5717. @item brightness
  5718. Set the brightness expression. The value must be a float value in
  5719. range @code{-1.0} to @code{1.0}. The default value is "0".
  5720. @item saturation
  5721. Set the saturation expression. The value must be a float in
  5722. range @code{0.0} to @code{3.0}. The default value is "1".
  5723. @item gamma
  5724. Set the gamma expression. The value must be a float in range
  5725. @code{0.1} to @code{10.0}. The default value is "1".
  5726. @item gamma_r
  5727. Set the gamma expression for red. The value must be a float in
  5728. range @code{0.1} to @code{10.0}. The default value is "1".
  5729. @item gamma_g
  5730. Set the gamma expression for green. The value must be a float in range
  5731. @code{0.1} to @code{10.0}. The default value is "1".
  5732. @item gamma_b
  5733. Set the gamma expression for blue. The value must be a float in range
  5734. @code{0.1} to @code{10.0}. The default value is "1".
  5735. @item gamma_weight
  5736. Set the gamma weight expression. It can be used to reduce the effect
  5737. of a high gamma value on bright image areas, e.g. keep them from
  5738. getting overamplified and just plain white. The value must be a float
  5739. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5740. gamma correction all the way down while @code{1.0} leaves it at its
  5741. full strength. Default is "1".
  5742. @item eval
  5743. Set when the expressions for brightness, contrast, saturation and
  5744. gamma expressions are evaluated.
  5745. It accepts the following values:
  5746. @table @samp
  5747. @item init
  5748. only evaluate expressions once during the filter initialization or
  5749. when a command is processed
  5750. @item frame
  5751. evaluate expressions for each incoming frame
  5752. @end table
  5753. Default value is @samp{init}.
  5754. @end table
  5755. The expressions accept the following parameters:
  5756. @table @option
  5757. @item n
  5758. frame count of the input frame starting from 0
  5759. @item pos
  5760. byte position of the corresponding packet in the input file, NAN if
  5761. unspecified
  5762. @item r
  5763. frame rate of the input video, NAN if the input frame rate is unknown
  5764. @item t
  5765. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5766. @end table
  5767. @subsection Commands
  5768. The filter supports the following commands:
  5769. @table @option
  5770. @item contrast
  5771. Set the contrast expression.
  5772. @item brightness
  5773. Set the brightness expression.
  5774. @item saturation
  5775. Set the saturation expression.
  5776. @item gamma
  5777. Set the gamma expression.
  5778. @item gamma_r
  5779. Set the gamma_r expression.
  5780. @item gamma_g
  5781. Set gamma_g expression.
  5782. @item gamma_b
  5783. Set gamma_b expression.
  5784. @item gamma_weight
  5785. Set gamma_weight expression.
  5786. The command accepts the same syntax of the corresponding option.
  5787. If the specified expression is not valid, it is kept at its current
  5788. value.
  5789. @end table
  5790. @section erosion
  5791. Apply erosion effect to the video.
  5792. This filter replaces the pixel by the local(3x3) minimum.
  5793. It accepts the following options:
  5794. @table @option
  5795. @item threshold0
  5796. @item threshold1
  5797. @item threshold2
  5798. @item threshold3
  5799. Limit the maximum change for each plane, default is 65535.
  5800. If 0, plane will remain unchanged.
  5801. @item coordinates
  5802. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5803. pixels are used.
  5804. Flags to local 3x3 coordinates maps like this:
  5805. 1 2 3
  5806. 4 5
  5807. 6 7 8
  5808. @end table
  5809. @section extractplanes
  5810. Extract color channel components from input video stream into
  5811. separate grayscale video streams.
  5812. The filter accepts the following option:
  5813. @table @option
  5814. @item planes
  5815. Set plane(s) to extract.
  5816. Available values for planes are:
  5817. @table @samp
  5818. @item y
  5819. @item u
  5820. @item v
  5821. @item a
  5822. @item r
  5823. @item g
  5824. @item b
  5825. @end table
  5826. Choosing planes not available in the input will result in an error.
  5827. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5828. with @code{y}, @code{u}, @code{v} planes at same time.
  5829. @end table
  5830. @subsection Examples
  5831. @itemize
  5832. @item
  5833. Extract luma, u and v color channel component from input video frame
  5834. into 3 grayscale outputs:
  5835. @example
  5836. 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
  5837. @end example
  5838. @end itemize
  5839. @section elbg
  5840. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5841. For each input image, the filter will compute the optimal mapping from
  5842. the input to the output given the codebook length, that is the number
  5843. of distinct output colors.
  5844. This filter accepts the following options.
  5845. @table @option
  5846. @item codebook_length, l
  5847. Set codebook length. The value must be a positive integer, and
  5848. represents the number of distinct output colors. Default value is 256.
  5849. @item nb_steps, n
  5850. Set the maximum number of iterations to apply for computing the optimal
  5851. mapping. The higher the value the better the result and the higher the
  5852. computation time. Default value is 1.
  5853. @item seed, s
  5854. Set a random seed, must be an integer included between 0 and
  5855. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5856. will try to use a good random seed on a best effort basis.
  5857. @item pal8
  5858. Set pal8 output pixel format. This option does not work with codebook
  5859. length greater than 256.
  5860. @end table
  5861. @section fade
  5862. Apply a fade-in/out effect to the input video.
  5863. It accepts the following parameters:
  5864. @table @option
  5865. @item type, t
  5866. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5867. effect.
  5868. Default is @code{in}.
  5869. @item start_frame, s
  5870. Specify the number of the frame to start applying the fade
  5871. effect at. Default is 0.
  5872. @item nb_frames, n
  5873. The number of frames that the fade effect lasts. At the end of the
  5874. fade-in effect, the output video will have the same intensity as the input video.
  5875. At the end of the fade-out transition, the output video will be filled with the
  5876. selected @option{color}.
  5877. Default is 25.
  5878. @item alpha
  5879. If set to 1, fade only alpha channel, if one exists on the input.
  5880. Default value is 0.
  5881. @item start_time, st
  5882. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5883. effect. If both start_frame and start_time are specified, the fade will start at
  5884. whichever comes last. Default is 0.
  5885. @item duration, d
  5886. The number of seconds for which the fade effect has to last. At the end of the
  5887. fade-in effect the output video will have the same intensity as the input video,
  5888. at the end of the fade-out transition the output video will be filled with the
  5889. selected @option{color}.
  5890. If both duration and nb_frames are specified, duration is used. Default is 0
  5891. (nb_frames is used by default).
  5892. @item color, c
  5893. Specify the color of the fade. Default is "black".
  5894. @end table
  5895. @subsection Examples
  5896. @itemize
  5897. @item
  5898. Fade in the first 30 frames of video:
  5899. @example
  5900. fade=in:0:30
  5901. @end example
  5902. The command above is equivalent to:
  5903. @example
  5904. fade=t=in:s=0:n=30
  5905. @end example
  5906. @item
  5907. Fade out the last 45 frames of a 200-frame video:
  5908. @example
  5909. fade=out:155:45
  5910. fade=type=out:start_frame=155:nb_frames=45
  5911. @end example
  5912. @item
  5913. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5914. @example
  5915. fade=in:0:25, fade=out:975:25
  5916. @end example
  5917. @item
  5918. Make the first 5 frames yellow, then fade in from frame 5-24:
  5919. @example
  5920. fade=in:5:20:color=yellow
  5921. @end example
  5922. @item
  5923. Fade in alpha over first 25 frames of video:
  5924. @example
  5925. fade=in:0:25:alpha=1
  5926. @end example
  5927. @item
  5928. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5929. @example
  5930. fade=t=in:st=5.5:d=0.5
  5931. @end example
  5932. @end itemize
  5933. @section fftfilt
  5934. Apply arbitrary expressions to samples in frequency domain
  5935. @table @option
  5936. @item dc_Y
  5937. Adjust the dc value (gain) of the luma plane of the image. The filter
  5938. accepts an integer value in range @code{0} to @code{1000}. The default
  5939. value is set to @code{0}.
  5940. @item dc_U
  5941. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5942. filter accepts an integer value in range @code{0} to @code{1000}. The
  5943. default value is set to @code{0}.
  5944. @item dc_V
  5945. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5946. filter accepts an integer value in range @code{0} to @code{1000}. The
  5947. default value is set to @code{0}.
  5948. @item weight_Y
  5949. Set the frequency domain weight expression for the luma plane.
  5950. @item weight_U
  5951. Set the frequency domain weight expression for the 1st chroma plane.
  5952. @item weight_V
  5953. Set the frequency domain weight expression for the 2nd chroma plane.
  5954. The filter accepts the following variables:
  5955. @item X
  5956. @item Y
  5957. The coordinates of the current sample.
  5958. @item W
  5959. @item H
  5960. The width and height of the image.
  5961. @end table
  5962. @subsection Examples
  5963. @itemize
  5964. @item
  5965. High-pass:
  5966. @example
  5967. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5968. @end example
  5969. @item
  5970. Low-pass:
  5971. @example
  5972. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5973. @end example
  5974. @item
  5975. Sharpen:
  5976. @example
  5977. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5978. @end example
  5979. @item
  5980. Blur:
  5981. @example
  5982. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5983. @end example
  5984. @end itemize
  5985. @section field
  5986. Extract a single field from an interlaced image using stride
  5987. arithmetic to avoid wasting CPU time. The output frames are marked as
  5988. non-interlaced.
  5989. The filter accepts the following options:
  5990. @table @option
  5991. @item type
  5992. Specify whether to extract the top (if the value is @code{0} or
  5993. @code{top}) or the bottom field (if the value is @code{1} or
  5994. @code{bottom}).
  5995. @end table
  5996. @section fieldhint
  5997. Create new frames by copying the top and bottom fields from surrounding frames
  5998. supplied as numbers by the hint file.
  5999. @table @option
  6000. @item hint
  6001. Set file containing hints: absolute/relative frame numbers.
  6002. There must be one line for each frame in a clip. Each line must contain two
  6003. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6004. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6005. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6006. for @code{relative} mode. First number tells from which frame to pick up top
  6007. field and second number tells from which frame to pick up bottom field.
  6008. If optionally followed by @code{+} output frame will be marked as interlaced,
  6009. else if followed by @code{-} output frame will be marked as progressive, else
  6010. it will be marked same as input frame.
  6011. If line starts with @code{#} or @code{;} that line is skipped.
  6012. @item mode
  6013. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6014. @end table
  6015. Example of first several lines of @code{hint} file for @code{relative} mode:
  6016. @example
  6017. 0,0 - # first frame
  6018. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6019. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6020. 1,0 -
  6021. 0,0 -
  6022. 0,0 -
  6023. 1,0 -
  6024. 1,0 -
  6025. 1,0 -
  6026. 0,0 -
  6027. 0,0 -
  6028. 1,0 -
  6029. 1,0 -
  6030. 1,0 -
  6031. 0,0 -
  6032. @end example
  6033. @section fieldmatch
  6034. Field matching filter for inverse telecine. It is meant to reconstruct the
  6035. progressive frames from a telecined stream. The filter does not drop duplicated
  6036. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6037. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6038. The separation of the field matching and the decimation is notably motivated by
  6039. the possibility of inserting a de-interlacing filter fallback between the two.
  6040. If the source has mixed telecined and real interlaced content,
  6041. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6042. But these remaining combed frames will be marked as interlaced, and thus can be
  6043. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6044. In addition to the various configuration options, @code{fieldmatch} can take an
  6045. optional second stream, activated through the @option{ppsrc} option. If
  6046. enabled, the frames reconstruction will be based on the fields and frames from
  6047. this second stream. This allows the first input to be pre-processed in order to
  6048. help the various algorithms of the filter, while keeping the output lossless
  6049. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6050. or brightness/contrast adjustments can help.
  6051. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6052. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6053. which @code{fieldmatch} is based on. While the semantic and usage are very
  6054. close, some behaviour and options names can differ.
  6055. The @ref{decimate} filter currently only works for constant frame rate input.
  6056. If your input has mixed telecined (30fps) and progressive content with a lower
  6057. framerate like 24fps use the following filterchain to produce the necessary cfr
  6058. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6059. The filter accepts the following options:
  6060. @table @option
  6061. @item order
  6062. Specify the assumed field order of the input stream. Available values are:
  6063. @table @samp
  6064. @item auto
  6065. Auto detect parity (use FFmpeg's internal parity value).
  6066. @item bff
  6067. Assume bottom field first.
  6068. @item tff
  6069. Assume top field first.
  6070. @end table
  6071. Note that it is sometimes recommended not to trust the parity announced by the
  6072. stream.
  6073. Default value is @var{auto}.
  6074. @item mode
  6075. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6076. sense that it won't risk creating jerkiness due to duplicate frames when
  6077. possible, but if there are bad edits or blended fields it will end up
  6078. outputting combed frames when a good match might actually exist. On the other
  6079. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6080. but will almost always find a good frame if there is one. The other values are
  6081. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6082. jerkiness and creating duplicate frames versus finding good matches in sections
  6083. with bad edits, orphaned fields, blended fields, etc.
  6084. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6085. Available values are:
  6086. @table @samp
  6087. @item pc
  6088. 2-way matching (p/c)
  6089. @item pc_n
  6090. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6091. @item pc_u
  6092. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6093. @item pc_n_ub
  6094. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6095. still combed (p/c + n + u/b)
  6096. @item pcn
  6097. 3-way matching (p/c/n)
  6098. @item pcn_ub
  6099. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6100. detected as combed (p/c/n + u/b)
  6101. @end table
  6102. The parenthesis at the end indicate the matches that would be used for that
  6103. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6104. @var{top}).
  6105. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6106. the slowest.
  6107. Default value is @var{pc_n}.
  6108. @item ppsrc
  6109. Mark the main input stream as a pre-processed input, and enable the secondary
  6110. input stream as the clean source to pick the fields from. See the filter
  6111. introduction for more details. It is similar to the @option{clip2} feature from
  6112. VFM/TFM.
  6113. Default value is @code{0} (disabled).
  6114. @item field
  6115. Set the field to match from. It is recommended to set this to the same value as
  6116. @option{order} unless you experience matching failures with that setting. In
  6117. certain circumstances changing the field that is used to match from can have a
  6118. large impact on matching performance. Available values are:
  6119. @table @samp
  6120. @item auto
  6121. Automatic (same value as @option{order}).
  6122. @item bottom
  6123. Match from the bottom field.
  6124. @item top
  6125. Match from the top field.
  6126. @end table
  6127. Default value is @var{auto}.
  6128. @item mchroma
  6129. Set whether or not chroma is included during the match comparisons. In most
  6130. cases it is recommended to leave this enabled. You should set this to @code{0}
  6131. only if your clip has bad chroma problems such as heavy rainbowing or other
  6132. artifacts. Setting this to @code{0} could also be used to speed things up at
  6133. the cost of some accuracy.
  6134. Default value is @code{1}.
  6135. @item y0
  6136. @item y1
  6137. These define an exclusion band which excludes the lines between @option{y0} and
  6138. @option{y1} from being included in the field matching decision. An exclusion
  6139. band can be used to ignore subtitles, a logo, or other things that may
  6140. interfere with the matching. @option{y0} sets the starting scan line and
  6141. @option{y1} sets the ending line; all lines in between @option{y0} and
  6142. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6143. @option{y0} and @option{y1} to the same value will disable the feature.
  6144. @option{y0} and @option{y1} defaults to @code{0}.
  6145. @item scthresh
  6146. Set the scene change detection threshold as a percentage of maximum change on
  6147. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6148. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6149. @option{scthresh} is @code{[0.0, 100.0]}.
  6150. Default value is @code{12.0}.
  6151. @item combmatch
  6152. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6153. account the combed scores of matches when deciding what match to use as the
  6154. final match. Available values are:
  6155. @table @samp
  6156. @item none
  6157. No final matching based on combed scores.
  6158. @item sc
  6159. Combed scores are only used when a scene change is detected.
  6160. @item full
  6161. Use combed scores all the time.
  6162. @end table
  6163. Default is @var{sc}.
  6164. @item combdbg
  6165. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6166. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6167. Available values are:
  6168. @table @samp
  6169. @item none
  6170. No forced calculation.
  6171. @item pcn
  6172. Force p/c/n calculations.
  6173. @item pcnub
  6174. Force p/c/n/u/b calculations.
  6175. @end table
  6176. Default value is @var{none}.
  6177. @item cthresh
  6178. This is the area combing threshold used for combed frame detection. This
  6179. essentially controls how "strong" or "visible" combing must be to be detected.
  6180. Larger values mean combing must be more visible and smaller values mean combing
  6181. can be less visible or strong and still be detected. Valid settings are from
  6182. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6183. be detected as combed). This is basically a pixel difference value. A good
  6184. range is @code{[8, 12]}.
  6185. Default value is @code{9}.
  6186. @item chroma
  6187. Sets whether or not chroma is considered in the combed frame decision. Only
  6188. disable this if your source has chroma problems (rainbowing, etc.) that are
  6189. causing problems for the combed frame detection with chroma enabled. Actually,
  6190. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6191. where there is chroma only combing in the source.
  6192. Default value is @code{0}.
  6193. @item blockx
  6194. @item blocky
  6195. Respectively set the x-axis and y-axis size of the window used during combed
  6196. frame detection. This has to do with the size of the area in which
  6197. @option{combpel} pixels are required to be detected as combed for a frame to be
  6198. declared combed. See the @option{combpel} parameter description for more info.
  6199. Possible values are any number that is a power of 2 starting at 4 and going up
  6200. to 512.
  6201. Default value is @code{16}.
  6202. @item combpel
  6203. The number of combed pixels inside any of the @option{blocky} by
  6204. @option{blockx} size blocks on the frame for the frame to be detected as
  6205. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6206. setting controls "how much" combing there must be in any localized area (a
  6207. window defined by the @option{blockx} and @option{blocky} settings) on the
  6208. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6209. which point no frames will ever be detected as combed). This setting is known
  6210. as @option{MI} in TFM/VFM vocabulary.
  6211. Default value is @code{80}.
  6212. @end table
  6213. @anchor{p/c/n/u/b meaning}
  6214. @subsection p/c/n/u/b meaning
  6215. @subsubsection p/c/n
  6216. We assume the following telecined stream:
  6217. @example
  6218. Top fields: 1 2 2 3 4
  6219. Bottom fields: 1 2 3 4 4
  6220. @end example
  6221. The numbers correspond to the progressive frame the fields relate to. Here, the
  6222. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6223. When @code{fieldmatch} is configured to run a matching from bottom
  6224. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6225. @example
  6226. Input stream:
  6227. T 1 2 2 3 4
  6228. B 1 2 3 4 4 <-- matching reference
  6229. Matches: c c n n c
  6230. Output stream:
  6231. T 1 2 3 4 4
  6232. B 1 2 3 4 4
  6233. @end example
  6234. As a result of the field matching, we can see that some frames get duplicated.
  6235. To perform a complete inverse telecine, you need to rely on a decimation filter
  6236. after this operation. See for instance the @ref{decimate} filter.
  6237. The same operation now matching from top fields (@option{field}=@var{top})
  6238. looks like this:
  6239. @example
  6240. Input stream:
  6241. T 1 2 2 3 4 <-- matching reference
  6242. B 1 2 3 4 4
  6243. Matches: c c p p c
  6244. Output stream:
  6245. T 1 2 2 3 4
  6246. B 1 2 2 3 4
  6247. @end example
  6248. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6249. basically, they refer to the frame and field of the opposite parity:
  6250. @itemize
  6251. @item @var{p} matches the field of the opposite parity in the previous frame
  6252. @item @var{c} matches the field of the opposite parity in the current frame
  6253. @item @var{n} matches the field of the opposite parity in the next frame
  6254. @end itemize
  6255. @subsubsection u/b
  6256. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6257. from the opposite parity flag. In the following examples, we assume that we are
  6258. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6259. 'x' is placed above and below each matched fields.
  6260. With bottom matching (@option{field}=@var{bottom}):
  6261. @example
  6262. Match: c p n b u
  6263. x x x x x
  6264. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6265. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6266. x x x x x
  6267. Output frames:
  6268. 2 1 2 2 2
  6269. 2 2 2 1 3
  6270. @end example
  6271. With top matching (@option{field}=@var{top}):
  6272. @example
  6273. Match: c p n b u
  6274. x x x x x
  6275. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6276. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6277. x x x x x
  6278. Output frames:
  6279. 2 2 2 1 2
  6280. 2 1 3 2 2
  6281. @end example
  6282. @subsection Examples
  6283. Simple IVTC of a top field first telecined stream:
  6284. @example
  6285. fieldmatch=order=tff:combmatch=none, decimate
  6286. @end example
  6287. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6288. @example
  6289. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6290. @end example
  6291. @section fieldorder
  6292. Transform the field order of the input video.
  6293. It accepts the following parameters:
  6294. @table @option
  6295. @item order
  6296. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6297. for bottom field first.
  6298. @end table
  6299. The default value is @samp{tff}.
  6300. The transformation is done by shifting the picture content up or down
  6301. by one line, and filling the remaining line with appropriate picture content.
  6302. This method is consistent with most broadcast field order converters.
  6303. If the input video is not flagged as being interlaced, or it is already
  6304. flagged as being of the required output field order, then this filter does
  6305. not alter the incoming video.
  6306. It is very useful when converting to or from PAL DV material,
  6307. which is bottom field first.
  6308. For example:
  6309. @example
  6310. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6311. @end example
  6312. @section fifo, afifo
  6313. Buffer input images and send them when they are requested.
  6314. It is mainly useful when auto-inserted by the libavfilter
  6315. framework.
  6316. It does not take parameters.
  6317. @section find_rect
  6318. Find a rectangular object
  6319. It accepts the following options:
  6320. @table @option
  6321. @item object
  6322. Filepath of the object image, needs to be in gray8.
  6323. @item threshold
  6324. Detection threshold, default is 0.5.
  6325. @item mipmaps
  6326. Number of mipmaps, default is 3.
  6327. @item xmin, ymin, xmax, ymax
  6328. Specifies the rectangle in which to search.
  6329. @end table
  6330. @subsection Examples
  6331. @itemize
  6332. @item
  6333. Generate a representative palette of a given video using @command{ffmpeg}:
  6334. @example
  6335. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6336. @end example
  6337. @end itemize
  6338. @section cover_rect
  6339. Cover a rectangular object
  6340. It accepts the following options:
  6341. @table @option
  6342. @item cover
  6343. Filepath of the optional cover image, needs to be in yuv420.
  6344. @item mode
  6345. Set covering mode.
  6346. It accepts the following values:
  6347. @table @samp
  6348. @item cover
  6349. cover it by the supplied image
  6350. @item blur
  6351. cover it by interpolating the surrounding pixels
  6352. @end table
  6353. Default value is @var{blur}.
  6354. @end table
  6355. @subsection Examples
  6356. @itemize
  6357. @item
  6358. Generate a representative palette of a given video using @command{ffmpeg}:
  6359. @example
  6360. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6361. @end example
  6362. @end itemize
  6363. @anchor{format}
  6364. @section format
  6365. Convert the input video to one of the specified pixel formats.
  6366. Libavfilter will try to pick one that is suitable as input to
  6367. the next filter.
  6368. It accepts the following parameters:
  6369. @table @option
  6370. @item pix_fmts
  6371. A '|'-separated list of pixel format names, such as
  6372. "pix_fmts=yuv420p|monow|rgb24".
  6373. @end table
  6374. @subsection Examples
  6375. @itemize
  6376. @item
  6377. Convert the input video to the @var{yuv420p} format
  6378. @example
  6379. format=pix_fmts=yuv420p
  6380. @end example
  6381. Convert the input video to any of the formats in the list
  6382. @example
  6383. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6384. @end example
  6385. @end itemize
  6386. @anchor{fps}
  6387. @section fps
  6388. Convert the video to specified constant frame rate by duplicating or dropping
  6389. frames as necessary.
  6390. It accepts the following parameters:
  6391. @table @option
  6392. @item fps
  6393. The desired output frame rate. The default is @code{25}.
  6394. @item round
  6395. Rounding method.
  6396. Possible values are:
  6397. @table @option
  6398. @item zero
  6399. zero round towards 0
  6400. @item inf
  6401. round away from 0
  6402. @item down
  6403. round towards -infinity
  6404. @item up
  6405. round towards +infinity
  6406. @item near
  6407. round to nearest
  6408. @end table
  6409. The default is @code{near}.
  6410. @item start_time
  6411. Assume the first PTS should be the given value, in seconds. This allows for
  6412. padding/trimming at the start of stream. By default, no assumption is made
  6413. about the first frame's expected PTS, so no padding or trimming is done.
  6414. For example, this could be set to 0 to pad the beginning with duplicates of
  6415. the first frame if a video stream starts after the audio stream or to trim any
  6416. frames with a negative PTS.
  6417. @end table
  6418. Alternatively, the options can be specified as a flat string:
  6419. @var{fps}[:@var{round}].
  6420. See also the @ref{setpts} filter.
  6421. @subsection Examples
  6422. @itemize
  6423. @item
  6424. A typical usage in order to set the fps to 25:
  6425. @example
  6426. fps=fps=25
  6427. @end example
  6428. @item
  6429. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6430. @example
  6431. fps=fps=film:round=near
  6432. @end example
  6433. @end itemize
  6434. @section framepack
  6435. Pack two different video streams into a stereoscopic video, setting proper
  6436. metadata on supported codecs. The two views should have the same size and
  6437. framerate and processing will stop when the shorter video ends. Please note
  6438. that you may conveniently adjust view properties with the @ref{scale} and
  6439. @ref{fps} filters.
  6440. It accepts the following parameters:
  6441. @table @option
  6442. @item format
  6443. The desired packing format. Supported values are:
  6444. @table @option
  6445. @item sbs
  6446. The views are next to each other (default).
  6447. @item tab
  6448. The views are on top of each other.
  6449. @item lines
  6450. The views are packed by line.
  6451. @item columns
  6452. The views are packed by column.
  6453. @item frameseq
  6454. The views are temporally interleaved.
  6455. @end table
  6456. @end table
  6457. Some examples:
  6458. @example
  6459. # Convert left and right views into a frame-sequential video
  6460. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6461. # Convert views into a side-by-side video with the same output resolution as the input
  6462. 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
  6463. @end example
  6464. @section framerate
  6465. Change the frame rate by interpolating new video output frames from the source
  6466. frames.
  6467. This filter is not designed to function correctly with interlaced media. If
  6468. you wish to change the frame rate of interlaced media then you are required
  6469. to deinterlace before this filter and re-interlace after this filter.
  6470. A description of the accepted options follows.
  6471. @table @option
  6472. @item fps
  6473. Specify the output frames per second. This option can also be specified
  6474. as a value alone. The default is @code{50}.
  6475. @item interp_start
  6476. Specify the start of a range where the output frame will be created as a
  6477. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6478. the default is @code{15}.
  6479. @item interp_end
  6480. Specify the end of a range where the output frame will be created as a
  6481. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6482. the default is @code{240}.
  6483. @item scene
  6484. Specify the level at which a scene change is detected as a value between
  6485. 0 and 100 to indicate a new scene; a low value reflects a low
  6486. probability for the current frame to introduce a new scene, while a higher
  6487. value means the current frame is more likely to be one.
  6488. The default is @code{7}.
  6489. @item flags
  6490. Specify flags influencing the filter process.
  6491. Available value for @var{flags} is:
  6492. @table @option
  6493. @item scene_change_detect, scd
  6494. Enable scene change detection using the value of the option @var{scene}.
  6495. This flag is enabled by default.
  6496. @end table
  6497. @end table
  6498. @section framestep
  6499. Select one frame every N-th frame.
  6500. This filter accepts the following option:
  6501. @table @option
  6502. @item step
  6503. Select frame after every @code{step} frames.
  6504. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6505. @end table
  6506. @anchor{frei0r}
  6507. @section frei0r
  6508. Apply a frei0r effect to the input video.
  6509. To enable the compilation of this filter, you need to install the frei0r
  6510. header and configure FFmpeg with @code{--enable-frei0r}.
  6511. It accepts the following parameters:
  6512. @table @option
  6513. @item filter_name
  6514. The name of the frei0r effect to load. If the environment variable
  6515. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6516. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6517. Otherwise, the standard frei0r paths are searched, in this order:
  6518. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6519. @file{/usr/lib/frei0r-1/}.
  6520. @item filter_params
  6521. A '|'-separated list of parameters to pass to the frei0r effect.
  6522. @end table
  6523. A frei0r effect parameter can be a boolean (its value is either
  6524. "y" or "n"), a double, a color (specified as
  6525. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6526. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6527. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6528. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6529. The number and types of parameters depend on the loaded effect. If an
  6530. effect parameter is not specified, the default value is set.
  6531. @subsection Examples
  6532. @itemize
  6533. @item
  6534. Apply the distort0r effect, setting the first two double parameters:
  6535. @example
  6536. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6537. @end example
  6538. @item
  6539. Apply the colordistance effect, taking a color as the first parameter:
  6540. @example
  6541. frei0r=colordistance:0.2/0.3/0.4
  6542. frei0r=colordistance:violet
  6543. frei0r=colordistance:0x112233
  6544. @end example
  6545. @item
  6546. Apply the perspective effect, specifying the top left and top right image
  6547. positions:
  6548. @example
  6549. frei0r=perspective:0.2/0.2|0.8/0.2
  6550. @end example
  6551. @end itemize
  6552. For more information, see
  6553. @url{http://frei0r.dyne.org}
  6554. @section fspp
  6555. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6556. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6557. processing filter, one of them is performed once per block, not per pixel.
  6558. This allows for much higher speed.
  6559. The filter accepts the following options:
  6560. @table @option
  6561. @item quality
  6562. Set quality. This option defines the number of levels for averaging. It accepts
  6563. an integer in the range 4-5. Default value is @code{4}.
  6564. @item qp
  6565. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6566. If not set, the filter will use the QP from the video stream (if available).
  6567. @item strength
  6568. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6569. more details but also more artifacts, while higher values make the image smoother
  6570. but also blurrier. Default value is @code{0} − PSNR optimal.
  6571. @item use_bframe_qp
  6572. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6573. option may cause flicker since the B-Frames have often larger QP. Default is
  6574. @code{0} (not enabled).
  6575. @end table
  6576. @section gblur
  6577. Apply Gaussian blur filter.
  6578. The filter accepts the following options:
  6579. @table @option
  6580. @item sigma
  6581. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6582. @item steps
  6583. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6584. @item planes
  6585. Set which planes to filter. By default all planes are filtered.
  6586. @item sigmaV
  6587. Set vertical sigma, if negative it will be same as @code{sigma}.
  6588. Default is @code{-1}.
  6589. @end table
  6590. @section geq
  6591. The filter accepts the following options:
  6592. @table @option
  6593. @item lum_expr, lum
  6594. Set the luminance expression.
  6595. @item cb_expr, cb
  6596. Set the chrominance blue expression.
  6597. @item cr_expr, cr
  6598. Set the chrominance red expression.
  6599. @item alpha_expr, a
  6600. Set the alpha expression.
  6601. @item red_expr, r
  6602. Set the red expression.
  6603. @item green_expr, g
  6604. Set the green expression.
  6605. @item blue_expr, b
  6606. Set the blue expression.
  6607. @end table
  6608. The colorspace is selected according to the specified options. If one
  6609. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6610. options is specified, the filter will automatically select a YCbCr
  6611. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6612. @option{blue_expr} options is specified, it will select an RGB
  6613. colorspace.
  6614. If one of the chrominance expression is not defined, it falls back on the other
  6615. one. If no alpha expression is specified it will evaluate to opaque value.
  6616. If none of chrominance expressions are specified, they will evaluate
  6617. to the luminance expression.
  6618. The expressions can use the following variables and functions:
  6619. @table @option
  6620. @item N
  6621. The sequential number of the filtered frame, starting from @code{0}.
  6622. @item X
  6623. @item Y
  6624. The coordinates of the current sample.
  6625. @item W
  6626. @item H
  6627. The width and height of the image.
  6628. @item SW
  6629. @item SH
  6630. Width and height scale depending on the currently filtered plane. It is the
  6631. ratio between the corresponding luma plane number of pixels and the current
  6632. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6633. @code{0.5,0.5} for chroma planes.
  6634. @item T
  6635. Time of the current frame, expressed in seconds.
  6636. @item p(x, y)
  6637. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6638. plane.
  6639. @item lum(x, y)
  6640. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6641. plane.
  6642. @item cb(x, y)
  6643. Return the value of the pixel at location (@var{x},@var{y}) of the
  6644. blue-difference chroma plane. Return 0 if there is no such plane.
  6645. @item cr(x, y)
  6646. Return the value of the pixel at location (@var{x},@var{y}) of the
  6647. red-difference chroma plane. Return 0 if there is no such plane.
  6648. @item r(x, y)
  6649. @item g(x, y)
  6650. @item b(x, y)
  6651. Return the value of the pixel at location (@var{x},@var{y}) of the
  6652. red/green/blue component. Return 0 if there is no such component.
  6653. @item alpha(x, y)
  6654. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6655. plane. Return 0 if there is no such plane.
  6656. @end table
  6657. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6658. automatically clipped to the closer edge.
  6659. @subsection Examples
  6660. @itemize
  6661. @item
  6662. Flip the image horizontally:
  6663. @example
  6664. geq=p(W-X\,Y)
  6665. @end example
  6666. @item
  6667. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6668. wavelength of 100 pixels:
  6669. @example
  6670. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6671. @end example
  6672. @item
  6673. Generate a fancy enigmatic moving light:
  6674. @example
  6675. 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
  6676. @end example
  6677. @item
  6678. Generate a quick emboss effect:
  6679. @example
  6680. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6681. @end example
  6682. @item
  6683. Modify RGB components depending on pixel position:
  6684. @example
  6685. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6686. @end example
  6687. @item
  6688. Create a radial gradient that is the same size as the input (also see
  6689. the @ref{vignette} filter):
  6690. @example
  6691. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6692. @end example
  6693. @end itemize
  6694. @section gradfun
  6695. Fix the banding artifacts that are sometimes introduced into nearly flat
  6696. regions by truncation to 8-bit color depth.
  6697. Interpolate the gradients that should go where the bands are, and
  6698. dither them.
  6699. It is designed for playback only. Do not use it prior to
  6700. lossy compression, because compression tends to lose the dither and
  6701. bring back the bands.
  6702. It accepts the following parameters:
  6703. @table @option
  6704. @item strength
  6705. The maximum amount by which the filter will change any one pixel. This is also
  6706. the threshold for detecting nearly flat regions. Acceptable values range from
  6707. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6708. valid range.
  6709. @item radius
  6710. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6711. gradients, but also prevents the filter from modifying the pixels near detailed
  6712. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6713. values will be clipped to the valid range.
  6714. @end table
  6715. Alternatively, the options can be specified as a flat string:
  6716. @var{strength}[:@var{radius}]
  6717. @subsection Examples
  6718. @itemize
  6719. @item
  6720. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6721. @example
  6722. gradfun=3.5:8
  6723. @end example
  6724. @item
  6725. Specify radius, omitting the strength (which will fall-back to the default
  6726. value):
  6727. @example
  6728. gradfun=radius=8
  6729. @end example
  6730. @end itemize
  6731. @anchor{haldclut}
  6732. @section haldclut
  6733. Apply a Hald CLUT to a video stream.
  6734. First input is the video stream to process, and second one is the Hald CLUT.
  6735. The Hald CLUT input can be a simple picture or a complete video stream.
  6736. The filter accepts the following options:
  6737. @table @option
  6738. @item shortest
  6739. Force termination when the shortest input terminates. Default is @code{0}.
  6740. @item repeatlast
  6741. Continue applying the last CLUT after the end of the stream. A value of
  6742. @code{0} disable the filter after the last frame of the CLUT is reached.
  6743. Default is @code{1}.
  6744. @end table
  6745. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6746. filters share the same internals).
  6747. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6748. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6749. @subsection Workflow examples
  6750. @subsubsection Hald CLUT video stream
  6751. Generate an identity Hald CLUT stream altered with various effects:
  6752. @example
  6753. 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
  6754. @end example
  6755. Note: make sure you use a lossless codec.
  6756. Then use it with @code{haldclut} to apply it on some random stream:
  6757. @example
  6758. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6759. @end example
  6760. The Hald CLUT will be applied to the 10 first seconds (duration of
  6761. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6762. to the remaining frames of the @code{mandelbrot} stream.
  6763. @subsubsection Hald CLUT with preview
  6764. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6765. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6766. biggest possible square starting at the top left of the picture. The remaining
  6767. padding pixels (bottom or right) will be ignored. This area can be used to add
  6768. a preview of the Hald CLUT.
  6769. Typically, the following generated Hald CLUT will be supported by the
  6770. @code{haldclut} filter:
  6771. @example
  6772. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6773. pad=iw+320 [padded_clut];
  6774. smptebars=s=320x256, split [a][b];
  6775. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6776. [main][b] overlay=W-320" -frames:v 1 clut.png
  6777. @end example
  6778. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6779. bars are displayed on the right-top, and below the same color bars processed by
  6780. the color changes.
  6781. Then, the effect of this Hald CLUT can be visualized with:
  6782. @example
  6783. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6784. @end example
  6785. @section hflip
  6786. Flip the input video horizontally.
  6787. For example, to horizontally flip the input video with @command{ffmpeg}:
  6788. @example
  6789. ffmpeg -i in.avi -vf "hflip" out.avi
  6790. @end example
  6791. @section histeq
  6792. This filter applies a global color histogram equalization on a
  6793. per-frame basis.
  6794. It can be used to correct video that has a compressed range of pixel
  6795. intensities. The filter redistributes the pixel intensities to
  6796. equalize their distribution across the intensity range. It may be
  6797. viewed as an "automatically adjusting contrast filter". This filter is
  6798. useful only for correcting degraded or poorly captured source
  6799. video.
  6800. The filter accepts the following options:
  6801. @table @option
  6802. @item strength
  6803. Determine the amount of equalization to be applied. As the strength
  6804. is reduced, the distribution of pixel intensities more-and-more
  6805. approaches that of the input frame. The value must be a float number
  6806. in the range [0,1] and defaults to 0.200.
  6807. @item intensity
  6808. Set the maximum intensity that can generated and scale the output
  6809. values appropriately. The strength should be set as desired and then
  6810. the intensity can be limited if needed to avoid washing-out. The value
  6811. must be a float number in the range [0,1] and defaults to 0.210.
  6812. @item antibanding
  6813. Set the antibanding level. If enabled the filter will randomly vary
  6814. the luminance of output pixels by a small amount to avoid banding of
  6815. the histogram. Possible values are @code{none}, @code{weak} or
  6816. @code{strong}. It defaults to @code{none}.
  6817. @end table
  6818. @section histogram
  6819. Compute and draw a color distribution histogram for the input video.
  6820. The computed histogram is a representation of the color component
  6821. distribution in an image.
  6822. Standard histogram displays the color components distribution in an image.
  6823. Displays color graph for each color component. Shows distribution of
  6824. the Y, U, V, A or R, G, B components, depending on input format, in the
  6825. current frame. Below each graph a color component scale meter is shown.
  6826. The filter accepts the following options:
  6827. @table @option
  6828. @item level_height
  6829. Set height of level. Default value is @code{200}.
  6830. Allowed range is [50, 2048].
  6831. @item scale_height
  6832. Set height of color scale. Default value is @code{12}.
  6833. Allowed range is [0, 40].
  6834. @item display_mode
  6835. Set display mode.
  6836. It accepts the following values:
  6837. @table @samp
  6838. @item stack
  6839. Per color component graphs are placed below each other.
  6840. @item parade
  6841. Per color component graphs are placed side by side.
  6842. @item overlay
  6843. Presents information identical to that in the @code{parade}, except
  6844. that the graphs representing color components are superimposed directly
  6845. over one another.
  6846. @end table
  6847. Default is @code{stack}.
  6848. @item levels_mode
  6849. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6850. Default is @code{linear}.
  6851. @item components
  6852. Set what color components to display.
  6853. Default is @code{7}.
  6854. @item fgopacity
  6855. Set foreground opacity. Default is @code{0.7}.
  6856. @item bgopacity
  6857. Set background opacity. Default is @code{0.5}.
  6858. @end table
  6859. @subsection Examples
  6860. @itemize
  6861. @item
  6862. Calculate and draw histogram:
  6863. @example
  6864. ffplay -i input -vf histogram
  6865. @end example
  6866. @end itemize
  6867. @anchor{hqdn3d}
  6868. @section hqdn3d
  6869. This is a high precision/quality 3d denoise filter. It aims to reduce
  6870. image noise, producing smooth images and making still images really
  6871. still. It should enhance compressibility.
  6872. It accepts the following optional parameters:
  6873. @table @option
  6874. @item luma_spatial
  6875. A non-negative floating point number which specifies spatial luma strength.
  6876. It defaults to 4.0.
  6877. @item chroma_spatial
  6878. A non-negative floating point number which specifies spatial chroma strength.
  6879. It defaults to 3.0*@var{luma_spatial}/4.0.
  6880. @item luma_tmp
  6881. A floating point number which specifies luma temporal strength. It defaults to
  6882. 6.0*@var{luma_spatial}/4.0.
  6883. @item chroma_tmp
  6884. A floating point number which specifies chroma temporal strength. It defaults to
  6885. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6886. @end table
  6887. @anchor{hwupload_cuda}
  6888. @section hwupload_cuda
  6889. Upload system memory frames to a CUDA device.
  6890. It accepts the following optional parameters:
  6891. @table @option
  6892. @item device
  6893. The number of the CUDA device to use
  6894. @end table
  6895. @section hqx
  6896. Apply a high-quality magnification filter designed for pixel art. This filter
  6897. was originally created by Maxim Stepin.
  6898. It accepts the following option:
  6899. @table @option
  6900. @item n
  6901. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6902. @code{hq3x} and @code{4} for @code{hq4x}.
  6903. Default is @code{3}.
  6904. @end table
  6905. @section hstack
  6906. Stack input videos horizontally.
  6907. All streams must be of same pixel format and of same height.
  6908. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6909. to create same output.
  6910. The filter accept the following option:
  6911. @table @option
  6912. @item inputs
  6913. Set number of input streams. Default is 2.
  6914. @item shortest
  6915. If set to 1, force the output to terminate when the shortest input
  6916. terminates. Default value is 0.
  6917. @end table
  6918. @section hue
  6919. Modify the hue and/or the saturation of the input.
  6920. It accepts the following parameters:
  6921. @table @option
  6922. @item h
  6923. Specify the hue angle as a number of degrees. It accepts an expression,
  6924. and defaults to "0".
  6925. @item s
  6926. Specify the saturation in the [-10,10] range. It accepts an expression and
  6927. defaults to "1".
  6928. @item H
  6929. Specify the hue angle as a number of radians. It accepts an
  6930. expression, and defaults to "0".
  6931. @item b
  6932. Specify the brightness in the [-10,10] range. It accepts an expression and
  6933. defaults to "0".
  6934. @end table
  6935. @option{h} and @option{H} are mutually exclusive, and can't be
  6936. specified at the same time.
  6937. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6938. expressions containing the following constants:
  6939. @table @option
  6940. @item n
  6941. frame count of the input frame starting from 0
  6942. @item pts
  6943. presentation timestamp of the input frame expressed in time base units
  6944. @item r
  6945. frame rate of the input video, NAN if the input frame rate is unknown
  6946. @item t
  6947. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6948. @item tb
  6949. time base of the input video
  6950. @end table
  6951. @subsection Examples
  6952. @itemize
  6953. @item
  6954. Set the hue to 90 degrees and the saturation to 1.0:
  6955. @example
  6956. hue=h=90:s=1
  6957. @end example
  6958. @item
  6959. Same command but expressing the hue in radians:
  6960. @example
  6961. hue=H=PI/2:s=1
  6962. @end example
  6963. @item
  6964. Rotate hue and make the saturation swing between 0
  6965. and 2 over a period of 1 second:
  6966. @example
  6967. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6968. @end example
  6969. @item
  6970. Apply a 3 seconds saturation fade-in effect starting at 0:
  6971. @example
  6972. hue="s=min(t/3\,1)"
  6973. @end example
  6974. The general fade-in expression can be written as:
  6975. @example
  6976. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6977. @end example
  6978. @item
  6979. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6980. @example
  6981. hue="s=max(0\, min(1\, (8-t)/3))"
  6982. @end example
  6983. The general fade-out expression can be written as:
  6984. @example
  6985. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6986. @end example
  6987. @end itemize
  6988. @subsection Commands
  6989. This filter supports the following commands:
  6990. @table @option
  6991. @item b
  6992. @item s
  6993. @item h
  6994. @item H
  6995. Modify the hue and/or the saturation and/or brightness of the input video.
  6996. The command accepts the same syntax of the corresponding option.
  6997. If the specified expression is not valid, it is kept at its current
  6998. value.
  6999. @end table
  7000. @section hysteresis
  7001. Grow first stream into second stream by connecting components.
  7002. This makes it possible to build more robust edge masks.
  7003. This filter accepts the following options:
  7004. @table @option
  7005. @item planes
  7006. Set which planes will be processed as bitmap, unprocessed planes will be
  7007. copied from first stream.
  7008. By default value 0xf, all planes will be processed.
  7009. @item threshold
  7010. Set threshold which is used in filtering. If pixel component value is higher than
  7011. this value filter algorithm for connecting components is activated.
  7012. By default value is 0.
  7013. @end table
  7014. @section idet
  7015. Detect video interlacing type.
  7016. This filter tries to detect if the input frames are interlaced, progressive,
  7017. top or bottom field first. It will also try to detect fields that are
  7018. repeated between adjacent frames (a sign of telecine).
  7019. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7020. Multiple frame detection incorporates the classification history of previous frames.
  7021. The filter will log these metadata values:
  7022. @table @option
  7023. @item single.current_frame
  7024. Detected type of current frame using single-frame detection. One of:
  7025. ``tff'' (top field first), ``bff'' (bottom field first),
  7026. ``progressive'', or ``undetermined''
  7027. @item single.tff
  7028. Cumulative number of frames detected as top field first using single-frame detection.
  7029. @item multiple.tff
  7030. Cumulative number of frames detected as top field first using multiple-frame detection.
  7031. @item single.bff
  7032. Cumulative number of frames detected as bottom field first using single-frame detection.
  7033. @item multiple.current_frame
  7034. Detected type of current frame using multiple-frame detection. One of:
  7035. ``tff'' (top field first), ``bff'' (bottom field first),
  7036. ``progressive'', or ``undetermined''
  7037. @item multiple.bff
  7038. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7039. @item single.progressive
  7040. Cumulative number of frames detected as progressive using single-frame detection.
  7041. @item multiple.progressive
  7042. Cumulative number of frames detected as progressive using multiple-frame detection.
  7043. @item single.undetermined
  7044. Cumulative number of frames that could not be classified using single-frame detection.
  7045. @item multiple.undetermined
  7046. Cumulative number of frames that could not be classified using multiple-frame detection.
  7047. @item repeated.current_frame
  7048. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7049. @item repeated.neither
  7050. Cumulative number of frames with no repeated field.
  7051. @item repeated.top
  7052. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7053. @item repeated.bottom
  7054. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7055. @end table
  7056. The filter accepts the following options:
  7057. @table @option
  7058. @item intl_thres
  7059. Set interlacing threshold.
  7060. @item prog_thres
  7061. Set progressive threshold.
  7062. @item rep_thres
  7063. Threshold for repeated field detection.
  7064. @item half_life
  7065. Number of frames after which a given frame's contribution to the
  7066. statistics is halved (i.e., it contributes only 0.5 to its
  7067. classification). The default of 0 means that all frames seen are given
  7068. full weight of 1.0 forever.
  7069. @item analyze_interlaced_flag
  7070. When this is not 0 then idet will use the specified number of frames to determine
  7071. if the interlaced flag is accurate, it will not count undetermined frames.
  7072. If the flag is found to be accurate it will be used without any further
  7073. computations, if it is found to be inaccurate it will be cleared without any
  7074. further computations. This allows inserting the idet filter as a low computational
  7075. method to clean up the interlaced flag
  7076. @end table
  7077. @section il
  7078. Deinterleave or interleave fields.
  7079. This filter allows one to process interlaced images fields without
  7080. deinterlacing them. Deinterleaving splits the input frame into 2
  7081. fields (so called half pictures). Odd lines are moved to the top
  7082. half of the output image, even lines to the bottom half.
  7083. You can process (filter) them independently and then re-interleave them.
  7084. The filter accepts the following options:
  7085. @table @option
  7086. @item luma_mode, l
  7087. @item chroma_mode, c
  7088. @item alpha_mode, a
  7089. Available values for @var{luma_mode}, @var{chroma_mode} and
  7090. @var{alpha_mode} are:
  7091. @table @samp
  7092. @item none
  7093. Do nothing.
  7094. @item deinterleave, d
  7095. Deinterleave fields, placing one above the other.
  7096. @item interleave, i
  7097. Interleave fields. Reverse the effect of deinterleaving.
  7098. @end table
  7099. Default value is @code{none}.
  7100. @item luma_swap, ls
  7101. @item chroma_swap, cs
  7102. @item alpha_swap, as
  7103. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7104. @end table
  7105. @section inflate
  7106. Apply inflate effect to the video.
  7107. This filter replaces the pixel by the local(3x3) average by taking into account
  7108. only values higher than the pixel.
  7109. It accepts the following options:
  7110. @table @option
  7111. @item threshold0
  7112. @item threshold1
  7113. @item threshold2
  7114. @item threshold3
  7115. Limit the maximum change for each plane, default is 65535.
  7116. If 0, plane will remain unchanged.
  7117. @end table
  7118. @section interlace
  7119. Simple interlacing filter from progressive contents. This interleaves upper (or
  7120. lower) lines from odd frames with lower (or upper) lines from even frames,
  7121. halving the frame rate and preserving image height.
  7122. @example
  7123. Original Original New Frame
  7124. Frame 'j' Frame 'j+1' (tff)
  7125. ========== =========== ==================
  7126. Line 0 --------------------> Frame 'j' Line 0
  7127. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7128. Line 2 ---------------------> Frame 'j' Line 2
  7129. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7130. ... ... ...
  7131. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7132. @end example
  7133. It accepts the following optional parameters:
  7134. @table @option
  7135. @item scan
  7136. This determines whether the interlaced frame is taken from the even
  7137. (tff - default) or odd (bff) lines of the progressive frame.
  7138. @item lowpass
  7139. Vertical lowpass filter to avoid twitter interlacing and
  7140. reduce moire patterns.
  7141. @table @samp
  7142. @item 0, off
  7143. Disable vertical lowpass filter
  7144. @item 1, linear
  7145. Enable linear filter (default)
  7146. @item 2, complex
  7147. Enable complex filter. This will slightly less reduce twitter and moire
  7148. but better retain detail and subjective sharpness impression.
  7149. @end table
  7150. @end table
  7151. @section kerndeint
  7152. Deinterlace input video by applying Donald Graft's adaptive kernel
  7153. deinterling. Work on interlaced parts of a video to produce
  7154. progressive frames.
  7155. The description of the accepted parameters follows.
  7156. @table @option
  7157. @item thresh
  7158. Set the threshold which affects the filter's tolerance when
  7159. determining if a pixel line must be processed. It must be an integer
  7160. in the range [0,255] and defaults to 10. A value of 0 will result in
  7161. applying the process on every pixels.
  7162. @item map
  7163. Paint pixels exceeding the threshold value to white if set to 1.
  7164. Default is 0.
  7165. @item order
  7166. Set the fields order. Swap fields if set to 1, leave fields alone if
  7167. 0. Default is 0.
  7168. @item sharp
  7169. Enable additional sharpening if set to 1. Default is 0.
  7170. @item twoway
  7171. Enable twoway sharpening if set to 1. Default is 0.
  7172. @end table
  7173. @subsection Examples
  7174. @itemize
  7175. @item
  7176. Apply default values:
  7177. @example
  7178. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7179. @end example
  7180. @item
  7181. Enable additional sharpening:
  7182. @example
  7183. kerndeint=sharp=1
  7184. @end example
  7185. @item
  7186. Paint processed pixels in white:
  7187. @example
  7188. kerndeint=map=1
  7189. @end example
  7190. @end itemize
  7191. @section lenscorrection
  7192. Correct radial lens distortion
  7193. This filter can be used to correct for radial distortion as can result from the use
  7194. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7195. one can use tools available for example as part of opencv or simply trial-and-error.
  7196. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7197. and extract the k1 and k2 coefficients from the resulting matrix.
  7198. Note that effectively the same filter is available in the open-source tools Krita and
  7199. Digikam from the KDE project.
  7200. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7201. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7202. brightness distribution, so you may want to use both filters together in certain
  7203. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7204. be applied before or after lens correction.
  7205. @subsection Options
  7206. The filter accepts the following options:
  7207. @table @option
  7208. @item cx
  7209. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7210. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7211. width.
  7212. @item cy
  7213. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7214. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7215. height.
  7216. @item k1
  7217. Coefficient of the quadratic correction term. 0.5 means no correction.
  7218. @item k2
  7219. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7220. @end table
  7221. The formula that generates the correction is:
  7222. @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)
  7223. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7224. distances from the focal point in the source and target images, respectively.
  7225. @section loop
  7226. Loop video frames.
  7227. The filter accepts the following options:
  7228. @table @option
  7229. @item loop
  7230. Set the number of loops.
  7231. @item size
  7232. Set maximal size in number of frames.
  7233. @item start
  7234. Set first frame of loop.
  7235. @end table
  7236. @anchor{lut3d}
  7237. @section lut3d
  7238. Apply a 3D LUT to an input video.
  7239. The filter accepts the following options:
  7240. @table @option
  7241. @item file
  7242. Set the 3D LUT file name.
  7243. Currently supported formats:
  7244. @table @samp
  7245. @item 3dl
  7246. AfterEffects
  7247. @item cube
  7248. Iridas
  7249. @item dat
  7250. DaVinci
  7251. @item m3d
  7252. Pandora
  7253. @end table
  7254. @item interp
  7255. Select interpolation mode.
  7256. Available values are:
  7257. @table @samp
  7258. @item nearest
  7259. Use values from the nearest defined point.
  7260. @item trilinear
  7261. Interpolate values using the 8 points defining a cube.
  7262. @item tetrahedral
  7263. Interpolate values using a tetrahedron.
  7264. @end table
  7265. @end table
  7266. @section lumakey
  7267. Turn certain luma values into transparency.
  7268. The filter accepts the following options:
  7269. @table @option
  7270. @item threshold
  7271. Set the luma which will be used as base for transparency.
  7272. Default value is @code{0}.
  7273. @item tolerance
  7274. Set the range of luma values to be keyed out.
  7275. Default value is @code{0}.
  7276. @item softness
  7277. Set the range of softness. Default value is @code{0}.
  7278. Use this to control gradual transition from zero to full transparency.
  7279. @end table
  7280. @section lut, lutrgb, lutyuv
  7281. Compute a look-up table for binding each pixel component input value
  7282. to an output value, and apply it to the input video.
  7283. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7284. to an RGB input video.
  7285. These filters accept the following parameters:
  7286. @table @option
  7287. @item c0
  7288. set first pixel component expression
  7289. @item c1
  7290. set second pixel component expression
  7291. @item c2
  7292. set third pixel component expression
  7293. @item c3
  7294. set fourth pixel component expression, corresponds to the alpha component
  7295. @item r
  7296. set red component expression
  7297. @item g
  7298. set green component expression
  7299. @item b
  7300. set blue component expression
  7301. @item a
  7302. alpha component expression
  7303. @item y
  7304. set Y/luminance component expression
  7305. @item u
  7306. set U/Cb component expression
  7307. @item v
  7308. set V/Cr component expression
  7309. @end table
  7310. Each of them specifies the expression to use for computing the lookup table for
  7311. the corresponding pixel component values.
  7312. The exact component associated to each of the @var{c*} options depends on the
  7313. format in input.
  7314. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7315. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7316. The expressions can contain the following constants and functions:
  7317. @table @option
  7318. @item w
  7319. @item h
  7320. The input width and height.
  7321. @item val
  7322. The input value for the pixel component.
  7323. @item clipval
  7324. The input value, clipped to the @var{minval}-@var{maxval} range.
  7325. @item maxval
  7326. The maximum value for the pixel component.
  7327. @item minval
  7328. The minimum value for the pixel component.
  7329. @item negval
  7330. The negated value for the pixel component value, clipped to the
  7331. @var{minval}-@var{maxval} range; it corresponds to the expression
  7332. "maxval-clipval+minval".
  7333. @item clip(val)
  7334. The computed value in @var{val}, clipped to the
  7335. @var{minval}-@var{maxval} range.
  7336. @item gammaval(gamma)
  7337. The computed gamma correction value of the pixel component value,
  7338. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7339. expression
  7340. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7341. @end table
  7342. All expressions default to "val".
  7343. @subsection Examples
  7344. @itemize
  7345. @item
  7346. Negate input video:
  7347. @example
  7348. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7349. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7350. @end example
  7351. The above is the same as:
  7352. @example
  7353. lutrgb="r=negval:g=negval:b=negval"
  7354. lutyuv="y=negval:u=negval:v=negval"
  7355. @end example
  7356. @item
  7357. Negate luminance:
  7358. @example
  7359. lutyuv=y=negval
  7360. @end example
  7361. @item
  7362. Remove chroma components, turning the video into a graytone image:
  7363. @example
  7364. lutyuv="u=128:v=128"
  7365. @end example
  7366. @item
  7367. Apply a luma burning effect:
  7368. @example
  7369. lutyuv="y=2*val"
  7370. @end example
  7371. @item
  7372. Remove green and blue components:
  7373. @example
  7374. lutrgb="g=0:b=0"
  7375. @end example
  7376. @item
  7377. Set a constant alpha channel value on input:
  7378. @example
  7379. format=rgba,lutrgb=a="maxval-minval/2"
  7380. @end example
  7381. @item
  7382. Correct luminance gamma by a factor of 0.5:
  7383. @example
  7384. lutyuv=y=gammaval(0.5)
  7385. @end example
  7386. @item
  7387. Discard least significant bits of luma:
  7388. @example
  7389. lutyuv=y='bitand(val, 128+64+32)'
  7390. @end example
  7391. @item
  7392. Technicolor like effect:
  7393. @example
  7394. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7395. @end example
  7396. @end itemize
  7397. @section lut2
  7398. Compute and apply a lookup table from two video inputs.
  7399. This filter accepts the following parameters:
  7400. @table @option
  7401. @item c0
  7402. set first pixel component expression
  7403. @item c1
  7404. set second pixel component expression
  7405. @item c2
  7406. set third pixel component expression
  7407. @item c3
  7408. set fourth pixel component expression, corresponds to the alpha component
  7409. @end table
  7410. Each of them specifies the expression to use for computing the lookup table for
  7411. the corresponding pixel component values.
  7412. The exact component associated to each of the @var{c*} options depends on the
  7413. format in inputs.
  7414. The expressions can contain the following constants:
  7415. @table @option
  7416. @item w
  7417. @item h
  7418. The input width and height.
  7419. @item x
  7420. The first input value for the pixel component.
  7421. @item y
  7422. The second input value for the pixel component.
  7423. @item bdx
  7424. The first input video bit depth.
  7425. @item bdy
  7426. The second input video bit depth.
  7427. @end table
  7428. All expressions default to "x".
  7429. @subsection Examples
  7430. @itemize
  7431. @item
  7432. Highlight differences between two RGB video streams:
  7433. @example
  7434. 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)'
  7435. @end example
  7436. @item
  7437. Highlight differences between two YUV video streams:
  7438. @example
  7439. 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)'
  7440. @end example
  7441. @end itemize
  7442. @section maskedclamp
  7443. Clamp the first input stream with the second input and third input stream.
  7444. Returns the value of first stream to be between second input
  7445. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7446. This filter accepts the following options:
  7447. @table @option
  7448. @item undershoot
  7449. Default value is @code{0}.
  7450. @item overshoot
  7451. Default value is @code{0}.
  7452. @item planes
  7453. Set which planes will be processed as bitmap, unprocessed planes will be
  7454. copied from first stream.
  7455. By default value 0xf, all planes will be processed.
  7456. @end table
  7457. @section maskedmerge
  7458. Merge the first input stream with the second input stream using per pixel
  7459. weights in the third input stream.
  7460. A value of 0 in the third stream pixel component means that pixel component
  7461. from first stream is returned unchanged, while maximum value (eg. 255 for
  7462. 8-bit videos) means that pixel component from second stream is returned
  7463. unchanged. Intermediate values define the amount of merging between both
  7464. input stream's pixel components.
  7465. This filter accepts the following options:
  7466. @table @option
  7467. @item planes
  7468. Set which planes will be processed as bitmap, unprocessed planes will be
  7469. copied from first stream.
  7470. By default value 0xf, all planes will be processed.
  7471. @end table
  7472. @section mcdeint
  7473. Apply motion-compensation deinterlacing.
  7474. It needs one field per frame as input and must thus be used together
  7475. with yadif=1/3 or equivalent.
  7476. This filter accepts the following options:
  7477. @table @option
  7478. @item mode
  7479. Set the deinterlacing mode.
  7480. It accepts one of the following values:
  7481. @table @samp
  7482. @item fast
  7483. @item medium
  7484. @item slow
  7485. use iterative motion estimation
  7486. @item extra_slow
  7487. like @samp{slow}, but use multiple reference frames.
  7488. @end table
  7489. Default value is @samp{fast}.
  7490. @item parity
  7491. Set the picture field parity assumed for the input video. It must be
  7492. one of the following values:
  7493. @table @samp
  7494. @item 0, tff
  7495. assume top field first
  7496. @item 1, bff
  7497. assume bottom field first
  7498. @end table
  7499. Default value is @samp{bff}.
  7500. @item qp
  7501. Set per-block quantization parameter (QP) used by the internal
  7502. encoder.
  7503. Higher values should result in a smoother motion vector field but less
  7504. optimal individual vectors. Default value is 1.
  7505. @end table
  7506. @section mergeplanes
  7507. Merge color channel components from several video streams.
  7508. The filter accepts up to 4 input streams, and merge selected input
  7509. planes to the output video.
  7510. This filter accepts the following options:
  7511. @table @option
  7512. @item mapping
  7513. Set input to output plane mapping. Default is @code{0}.
  7514. The mappings is specified as a bitmap. It should be specified as a
  7515. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7516. mapping for the first plane of the output stream. 'A' sets the number of
  7517. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7518. corresponding input to use (from 0 to 3). The rest of the mappings is
  7519. similar, 'Bb' describes the mapping for the output stream second
  7520. plane, 'Cc' describes the mapping for the output stream third plane and
  7521. 'Dd' describes the mapping for the output stream fourth plane.
  7522. @item format
  7523. Set output pixel format. Default is @code{yuva444p}.
  7524. @end table
  7525. @subsection Examples
  7526. @itemize
  7527. @item
  7528. Merge three gray video streams of same width and height into single video stream:
  7529. @example
  7530. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7531. @end example
  7532. @item
  7533. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7534. @example
  7535. [a0][a1]mergeplanes=0x00010210:yuva444p
  7536. @end example
  7537. @item
  7538. Swap Y and A plane in yuva444p stream:
  7539. @example
  7540. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7541. @end example
  7542. @item
  7543. Swap U and V plane in yuv420p stream:
  7544. @example
  7545. format=yuv420p,mergeplanes=0x000201:yuv420p
  7546. @end example
  7547. @item
  7548. Cast a rgb24 clip to yuv444p:
  7549. @example
  7550. format=rgb24,mergeplanes=0x000102:yuv444p
  7551. @end example
  7552. @end itemize
  7553. @section mestimate
  7554. Estimate and export motion vectors using block matching algorithms.
  7555. Motion vectors are stored in frame side data to be used by other filters.
  7556. This filter accepts the following options:
  7557. @table @option
  7558. @item method
  7559. Specify the motion estimation method. Accepts one of the following values:
  7560. @table @samp
  7561. @item esa
  7562. Exhaustive search algorithm.
  7563. @item tss
  7564. Three step search algorithm.
  7565. @item tdls
  7566. Two dimensional logarithmic search algorithm.
  7567. @item ntss
  7568. New three step search algorithm.
  7569. @item fss
  7570. Four step search algorithm.
  7571. @item ds
  7572. Diamond search algorithm.
  7573. @item hexbs
  7574. Hexagon-based search algorithm.
  7575. @item epzs
  7576. Enhanced predictive zonal search algorithm.
  7577. @item umh
  7578. Uneven multi-hexagon search algorithm.
  7579. @end table
  7580. Default value is @samp{esa}.
  7581. @item mb_size
  7582. Macroblock size. Default @code{16}.
  7583. @item search_param
  7584. Search parameter. Default @code{7}.
  7585. @end table
  7586. @section midequalizer
  7587. Apply Midway Image Equalization effect using two video streams.
  7588. Midway Image Equalization adjusts a pair of images to have the same
  7589. histogram, while maintaining their dynamics as much as possible. It's
  7590. useful for e.g. matching exposures from a pair of stereo cameras.
  7591. This filter has two inputs and one output, which must be of same pixel format, but
  7592. may be of different sizes. The output of filter is first input adjusted with
  7593. midway histogram of both inputs.
  7594. This filter accepts the following option:
  7595. @table @option
  7596. @item planes
  7597. Set which planes to process. Default is @code{15}, which is all available planes.
  7598. @end table
  7599. @section minterpolate
  7600. Convert the video to specified frame rate using motion interpolation.
  7601. This filter accepts the following options:
  7602. @table @option
  7603. @item fps
  7604. 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}.
  7605. @item mi_mode
  7606. Motion interpolation mode. Following values are accepted:
  7607. @table @samp
  7608. @item dup
  7609. Duplicate previous or next frame for interpolating new ones.
  7610. @item blend
  7611. Blend source frames. Interpolated frame is mean of previous and next frames.
  7612. @item mci
  7613. Motion compensated interpolation. Following options are effective when this mode is selected:
  7614. @table @samp
  7615. @item mc_mode
  7616. Motion compensation mode. Following values are accepted:
  7617. @table @samp
  7618. @item obmc
  7619. Overlapped block motion compensation.
  7620. @item aobmc
  7621. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7622. @end table
  7623. Default mode is @samp{obmc}.
  7624. @item me_mode
  7625. Motion estimation mode. Following values are accepted:
  7626. @table @samp
  7627. @item bidir
  7628. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7629. @item bilat
  7630. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7631. @end table
  7632. Default mode is @samp{bilat}.
  7633. @item me
  7634. The algorithm to be used for motion estimation. Following values are accepted:
  7635. @table @samp
  7636. @item esa
  7637. Exhaustive search algorithm.
  7638. @item tss
  7639. Three step search algorithm.
  7640. @item tdls
  7641. Two dimensional logarithmic search algorithm.
  7642. @item ntss
  7643. New three step search algorithm.
  7644. @item fss
  7645. Four step search algorithm.
  7646. @item ds
  7647. Diamond search algorithm.
  7648. @item hexbs
  7649. Hexagon-based search algorithm.
  7650. @item epzs
  7651. Enhanced predictive zonal search algorithm.
  7652. @item umh
  7653. Uneven multi-hexagon search algorithm.
  7654. @end table
  7655. Default algorithm is @samp{epzs}.
  7656. @item mb_size
  7657. Macroblock size. Default @code{16}.
  7658. @item search_param
  7659. Motion estimation search parameter. Default @code{32}.
  7660. @item vsbmc
  7661. 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).
  7662. @end table
  7663. @end table
  7664. @item scd
  7665. 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:
  7666. @table @samp
  7667. @item none
  7668. Disable scene change detection.
  7669. @item fdiff
  7670. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7671. @end table
  7672. Default method is @samp{fdiff}.
  7673. @item scd_threshold
  7674. Scene change detection threshold. Default is @code{5.0}.
  7675. @end table
  7676. @section mpdecimate
  7677. Drop frames that do not differ greatly from the previous frame in
  7678. order to reduce frame rate.
  7679. The main use of this filter is for very-low-bitrate encoding
  7680. (e.g. streaming over dialup modem), but it could in theory be used for
  7681. fixing movies that were inverse-telecined incorrectly.
  7682. A description of the accepted options follows.
  7683. @table @option
  7684. @item max
  7685. Set the maximum number of consecutive frames which can be dropped (if
  7686. positive), or the minimum interval between dropped frames (if
  7687. negative). If the value is 0, the frame is dropped unregarding the
  7688. number of previous sequentially dropped frames.
  7689. Default value is 0.
  7690. @item hi
  7691. @item lo
  7692. @item frac
  7693. Set the dropping threshold values.
  7694. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7695. represent actual pixel value differences, so a threshold of 64
  7696. corresponds to 1 unit of difference for each pixel, or the same spread
  7697. out differently over the block.
  7698. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7699. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7700. meaning the whole image) differ by more than a threshold of @option{lo}.
  7701. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7702. 64*5, and default value for @option{frac} is 0.33.
  7703. @end table
  7704. @section negate
  7705. Negate input video.
  7706. It accepts an integer in input; if non-zero it negates the
  7707. alpha component (if available). The default value in input is 0.
  7708. @section nlmeans
  7709. Denoise frames using Non-Local Means algorithm.
  7710. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7711. context similarity is defined by comparing their surrounding patches of size
  7712. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7713. around the pixel.
  7714. Note that the research area defines centers for patches, which means some
  7715. patches will be made of pixels outside that research area.
  7716. The filter accepts the following options.
  7717. @table @option
  7718. @item s
  7719. Set denoising strength.
  7720. @item p
  7721. Set patch size.
  7722. @item pc
  7723. Same as @option{p} but for chroma planes.
  7724. The default value is @var{0} and means automatic.
  7725. @item r
  7726. Set research size.
  7727. @item rc
  7728. Same as @option{r} but for chroma planes.
  7729. The default value is @var{0} and means automatic.
  7730. @end table
  7731. @section nnedi
  7732. Deinterlace video using neural network edge directed interpolation.
  7733. This filter accepts the following options:
  7734. @table @option
  7735. @item weights
  7736. Mandatory option, without binary file filter can not work.
  7737. Currently file can be found here:
  7738. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7739. @item deint
  7740. Set which frames to deinterlace, by default it is @code{all}.
  7741. Can be @code{all} or @code{interlaced}.
  7742. @item field
  7743. Set mode of operation.
  7744. Can be one of the following:
  7745. @table @samp
  7746. @item af
  7747. Use frame flags, both fields.
  7748. @item a
  7749. Use frame flags, single field.
  7750. @item t
  7751. Use top field only.
  7752. @item b
  7753. Use bottom field only.
  7754. @item tf
  7755. Use both fields, top first.
  7756. @item bf
  7757. Use both fields, bottom first.
  7758. @end table
  7759. @item planes
  7760. Set which planes to process, by default filter process all frames.
  7761. @item nsize
  7762. Set size of local neighborhood around each pixel, used by the predictor neural
  7763. network.
  7764. Can be one of the following:
  7765. @table @samp
  7766. @item s8x6
  7767. @item s16x6
  7768. @item s32x6
  7769. @item s48x6
  7770. @item s8x4
  7771. @item s16x4
  7772. @item s32x4
  7773. @end table
  7774. @item nns
  7775. Set the number of neurons in predicctor neural network.
  7776. Can be one of the following:
  7777. @table @samp
  7778. @item n16
  7779. @item n32
  7780. @item n64
  7781. @item n128
  7782. @item n256
  7783. @end table
  7784. @item qual
  7785. Controls the number of different neural network predictions that are blended
  7786. together to compute the final output value. Can be @code{fast}, default or
  7787. @code{slow}.
  7788. @item etype
  7789. Set which set of weights to use in the predictor.
  7790. Can be one of the following:
  7791. @table @samp
  7792. @item a
  7793. weights trained to minimize absolute error
  7794. @item s
  7795. weights trained to minimize squared error
  7796. @end table
  7797. @item pscrn
  7798. Controls whether or not the prescreener neural network is used to decide
  7799. which pixels should be processed by the predictor neural network and which
  7800. can be handled by simple cubic interpolation.
  7801. The prescreener is trained to know whether cubic interpolation will be
  7802. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7803. The computational complexity of the prescreener nn is much less than that of
  7804. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7805. using the prescreener generally results in much faster processing.
  7806. The prescreener is pretty accurate, so the difference between using it and not
  7807. using it is almost always unnoticeable.
  7808. Can be one of the following:
  7809. @table @samp
  7810. @item none
  7811. @item original
  7812. @item new
  7813. @end table
  7814. Default is @code{new}.
  7815. @item fapprox
  7816. Set various debugging flags.
  7817. @end table
  7818. @section noformat
  7819. Force libavfilter not to use any of the specified pixel formats for the
  7820. input to the next filter.
  7821. It accepts the following parameters:
  7822. @table @option
  7823. @item pix_fmts
  7824. A '|'-separated list of pixel format names, such as
  7825. apix_fmts=yuv420p|monow|rgb24".
  7826. @end table
  7827. @subsection Examples
  7828. @itemize
  7829. @item
  7830. Force libavfilter to use a format different from @var{yuv420p} for the
  7831. input to the vflip filter:
  7832. @example
  7833. noformat=pix_fmts=yuv420p,vflip
  7834. @end example
  7835. @item
  7836. Convert the input video to any of the formats not contained in the list:
  7837. @example
  7838. noformat=yuv420p|yuv444p|yuv410p
  7839. @end example
  7840. @end itemize
  7841. @section noise
  7842. Add noise on video input frame.
  7843. The filter accepts the following options:
  7844. @table @option
  7845. @item all_seed
  7846. @item c0_seed
  7847. @item c1_seed
  7848. @item c2_seed
  7849. @item c3_seed
  7850. Set noise seed for specific pixel component or all pixel components in case
  7851. of @var{all_seed}. Default value is @code{123457}.
  7852. @item all_strength, alls
  7853. @item c0_strength, c0s
  7854. @item c1_strength, c1s
  7855. @item c2_strength, c2s
  7856. @item c3_strength, c3s
  7857. Set noise strength for specific pixel component or all pixel components in case
  7858. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7859. @item all_flags, allf
  7860. @item c0_flags, c0f
  7861. @item c1_flags, c1f
  7862. @item c2_flags, c2f
  7863. @item c3_flags, c3f
  7864. Set pixel component flags or set flags for all components if @var{all_flags}.
  7865. Available values for component flags are:
  7866. @table @samp
  7867. @item a
  7868. averaged temporal noise (smoother)
  7869. @item p
  7870. mix random noise with a (semi)regular pattern
  7871. @item t
  7872. temporal noise (noise pattern changes between frames)
  7873. @item u
  7874. uniform noise (gaussian otherwise)
  7875. @end table
  7876. @end table
  7877. @subsection Examples
  7878. Add temporal and uniform noise to input video:
  7879. @example
  7880. noise=alls=20:allf=t+u
  7881. @end example
  7882. @section null
  7883. Pass the video source unchanged to the output.
  7884. @section ocr
  7885. Optical Character Recognition
  7886. This filter uses Tesseract for optical character recognition.
  7887. It accepts the following options:
  7888. @table @option
  7889. @item datapath
  7890. Set datapath to tesseract data. Default is to use whatever was
  7891. set at installation.
  7892. @item language
  7893. Set language, default is "eng".
  7894. @item whitelist
  7895. Set character whitelist.
  7896. @item blacklist
  7897. Set character blacklist.
  7898. @end table
  7899. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7900. @section ocv
  7901. Apply a video transform using libopencv.
  7902. To enable this filter, install the libopencv library and headers and
  7903. configure FFmpeg with @code{--enable-libopencv}.
  7904. It accepts the following parameters:
  7905. @table @option
  7906. @item filter_name
  7907. The name of the libopencv filter to apply.
  7908. @item filter_params
  7909. The parameters to pass to the libopencv filter. If not specified, the default
  7910. values are assumed.
  7911. @end table
  7912. Refer to the official libopencv documentation for more precise
  7913. information:
  7914. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7915. Several libopencv filters are supported; see the following subsections.
  7916. @anchor{dilate}
  7917. @subsection dilate
  7918. Dilate an image by using a specific structuring element.
  7919. It corresponds to the libopencv function @code{cvDilate}.
  7920. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7921. @var{struct_el} represents a structuring element, and has the syntax:
  7922. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7923. @var{cols} and @var{rows} represent the number of columns and rows of
  7924. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7925. point, and @var{shape} the shape for the structuring element. @var{shape}
  7926. must be "rect", "cross", "ellipse", or "custom".
  7927. If the value for @var{shape} is "custom", it must be followed by a
  7928. string of the form "=@var{filename}". The file with name
  7929. @var{filename} is assumed to represent a binary image, with each
  7930. printable character corresponding to a bright pixel. When a custom
  7931. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7932. or columns and rows of the read file are assumed instead.
  7933. The default value for @var{struct_el} is "3x3+0x0/rect".
  7934. @var{nb_iterations} specifies the number of times the transform is
  7935. applied to the image, and defaults to 1.
  7936. Some examples:
  7937. @example
  7938. # Use the default values
  7939. ocv=dilate
  7940. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7941. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7942. # Read the shape from the file diamond.shape, iterating two times.
  7943. # The file diamond.shape may contain a pattern of characters like this
  7944. # *
  7945. # ***
  7946. # *****
  7947. # ***
  7948. # *
  7949. # The specified columns and rows are ignored
  7950. # but the anchor point coordinates are not
  7951. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7952. @end example
  7953. @subsection erode
  7954. Erode an image by using a specific structuring element.
  7955. It corresponds to the libopencv function @code{cvErode}.
  7956. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7957. with the same syntax and semantics as the @ref{dilate} filter.
  7958. @subsection smooth
  7959. Smooth the input video.
  7960. The filter takes the following parameters:
  7961. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7962. @var{type} is the type of smooth filter to apply, and must be one of
  7963. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7964. or "bilateral". The default value is "gaussian".
  7965. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7966. depend on the smooth type. @var{param1} and
  7967. @var{param2} accept integer positive values or 0. @var{param3} and
  7968. @var{param4} accept floating point values.
  7969. The default value for @var{param1} is 3. The default value for the
  7970. other parameters is 0.
  7971. These parameters correspond to the parameters assigned to the
  7972. libopencv function @code{cvSmooth}.
  7973. @section oscilloscope
  7974. 2D Video Oscilloscope.
  7975. Useful to measure spatial impulse, step responses, chroma delays, etc.
  7976. It accepts the following parameters:
  7977. @table @option
  7978. @item x
  7979. Set scope center x position.
  7980. @item y
  7981. Set scope center y position.
  7982. @item s
  7983. Set scope size, relative to frame diagonal.
  7984. @item t
  7985. Set scope tilt/rotation.
  7986. @item o
  7987. Set trace opacity.
  7988. @item tx
  7989. Set trace center x position.
  7990. @item ty
  7991. Set trace center y position.
  7992. @item tw
  7993. Set trace width, relative to width of frame.
  7994. @item th
  7995. Set trace height, relative to height of frame.
  7996. @item c
  7997. Set which components to trace. By default it traces first three components.
  7998. @item g
  7999. Draw trace grid. By default is enabled.
  8000. @item st
  8001. Draw some statistics. By default is enabled.
  8002. @item sc
  8003. Draw scope. By default is enabled.
  8004. @end table
  8005. @subsection Examples
  8006. @itemize
  8007. @item
  8008. Inspect full first row of video frame.
  8009. @example
  8010. oscilloscope=x=0.5:y=0:s=1
  8011. @end example
  8012. @item
  8013. Inspect full last row of video frame.
  8014. @example
  8015. oscilloscope=x=0.5:y=1:s=1
  8016. @end example
  8017. @item
  8018. Inspect full 5th line of video frame of height 1080.
  8019. @example
  8020. oscilloscope=x=0.5:y=5/1080:s=1
  8021. @end example
  8022. @item
  8023. Inspect full last column of video frame.
  8024. @example
  8025. oscilloscope=x=1:y=0.5:s=1:t=1
  8026. @end example
  8027. @end itemize
  8028. @anchor{overlay}
  8029. @section overlay
  8030. Overlay one video on top of another.
  8031. It takes two inputs and has one output. The first input is the "main"
  8032. video on which the second input is overlaid.
  8033. It accepts the following parameters:
  8034. A description of the accepted options follows.
  8035. @table @option
  8036. @item x
  8037. @item y
  8038. Set the expression for the x and y coordinates of the overlaid video
  8039. on the main video. Default value is "0" for both expressions. In case
  8040. the expression is invalid, it is set to a huge value (meaning that the
  8041. overlay will not be displayed within the output visible area).
  8042. @item eof_action
  8043. The action to take when EOF is encountered on the secondary input; it accepts
  8044. one of the following values:
  8045. @table @option
  8046. @item repeat
  8047. Repeat the last frame (the default).
  8048. @item endall
  8049. End both streams.
  8050. @item pass
  8051. Pass the main input through.
  8052. @end table
  8053. @item eval
  8054. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8055. It accepts the following values:
  8056. @table @samp
  8057. @item init
  8058. only evaluate expressions once during the filter initialization or
  8059. when a command is processed
  8060. @item frame
  8061. evaluate expressions for each incoming frame
  8062. @end table
  8063. Default value is @samp{frame}.
  8064. @item shortest
  8065. If set to 1, force the output to terminate when the shortest input
  8066. terminates. Default value is 0.
  8067. @item format
  8068. Set the format for the output video.
  8069. It accepts the following values:
  8070. @table @samp
  8071. @item yuv420
  8072. force YUV420 output
  8073. @item yuv422
  8074. force YUV422 output
  8075. @item yuv444
  8076. force YUV444 output
  8077. @item rgb
  8078. force packed RGB output
  8079. @item gbrp
  8080. force planar RGB output
  8081. @end table
  8082. Default value is @samp{yuv420}.
  8083. @item rgb @emph{(deprecated)}
  8084. If set to 1, force the filter to accept inputs in the RGB
  8085. color space. Default value is 0. This option is deprecated, use
  8086. @option{format} instead.
  8087. @item repeatlast
  8088. If set to 1, force the filter to draw the last overlay frame over the
  8089. main input until the end of the stream. A value of 0 disables this
  8090. behavior. Default value is 1.
  8091. @end table
  8092. The @option{x}, and @option{y} expressions can contain the following
  8093. parameters.
  8094. @table @option
  8095. @item main_w, W
  8096. @item main_h, H
  8097. The main input width and height.
  8098. @item overlay_w, w
  8099. @item overlay_h, h
  8100. The overlay input width and height.
  8101. @item x
  8102. @item y
  8103. The computed values for @var{x} and @var{y}. They are evaluated for
  8104. each new frame.
  8105. @item hsub
  8106. @item vsub
  8107. horizontal and vertical chroma subsample values of the output
  8108. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8109. @var{vsub} is 1.
  8110. @item n
  8111. the number of input frame, starting from 0
  8112. @item pos
  8113. the position in the file of the input frame, NAN if unknown
  8114. @item t
  8115. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8116. @end table
  8117. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8118. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8119. when @option{eval} is set to @samp{init}.
  8120. Be aware that frames are taken from each input video in timestamp
  8121. order, hence, if their initial timestamps differ, it is a good idea
  8122. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8123. have them begin in the same zero timestamp, as the example for
  8124. the @var{movie} filter does.
  8125. You can chain together more overlays but you should test the
  8126. efficiency of such approach.
  8127. @subsection Commands
  8128. This filter supports the following commands:
  8129. @table @option
  8130. @item x
  8131. @item y
  8132. Modify the x and y of the overlay input.
  8133. The command accepts the same syntax of the corresponding option.
  8134. If the specified expression is not valid, it is kept at its current
  8135. value.
  8136. @end table
  8137. @subsection Examples
  8138. @itemize
  8139. @item
  8140. Draw the overlay at 10 pixels from the bottom right corner of the main
  8141. video:
  8142. @example
  8143. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8144. @end example
  8145. Using named options the example above becomes:
  8146. @example
  8147. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8148. @end example
  8149. @item
  8150. Insert a transparent PNG logo in the bottom left corner of the input,
  8151. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8152. @example
  8153. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8154. @end example
  8155. @item
  8156. Insert 2 different transparent PNG logos (second logo on bottom
  8157. right corner) using the @command{ffmpeg} tool:
  8158. @example
  8159. 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
  8160. @end example
  8161. @item
  8162. Add a transparent color layer on top of the main video; @code{WxH}
  8163. must specify the size of the main input to the overlay filter:
  8164. @example
  8165. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8166. @end example
  8167. @item
  8168. Play an original video and a filtered version (here with the deshake
  8169. filter) side by side using the @command{ffplay} tool:
  8170. @example
  8171. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8172. @end example
  8173. The above command is the same as:
  8174. @example
  8175. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8176. @end example
  8177. @item
  8178. Make a sliding overlay appearing from the left to the right top part of the
  8179. screen starting since time 2:
  8180. @example
  8181. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8182. @end example
  8183. @item
  8184. Compose output by putting two input videos side to side:
  8185. @example
  8186. ffmpeg -i left.avi -i right.avi -filter_complex "
  8187. nullsrc=size=200x100 [background];
  8188. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8189. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8190. [background][left] overlay=shortest=1 [background+left];
  8191. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8192. "
  8193. @end example
  8194. @item
  8195. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8196. @example
  8197. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8198. -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]'
  8199. masked.avi
  8200. @end example
  8201. @item
  8202. Chain several overlays in cascade:
  8203. @example
  8204. nullsrc=s=200x200 [bg];
  8205. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8206. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8207. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8208. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8209. [in3] null, [mid2] overlay=100:100 [out0]
  8210. @end example
  8211. @end itemize
  8212. @section owdenoise
  8213. Apply Overcomplete Wavelet denoiser.
  8214. The filter accepts the following options:
  8215. @table @option
  8216. @item depth
  8217. Set depth.
  8218. Larger depth values will denoise lower frequency components more, but
  8219. slow down filtering.
  8220. Must be an int in the range 8-16, default is @code{8}.
  8221. @item luma_strength, ls
  8222. Set luma strength.
  8223. Must be a double value in the range 0-1000, default is @code{1.0}.
  8224. @item chroma_strength, cs
  8225. Set chroma strength.
  8226. Must be a double value in the range 0-1000, default is @code{1.0}.
  8227. @end table
  8228. @anchor{pad}
  8229. @section pad
  8230. Add paddings to the input image, and place the original input at the
  8231. provided @var{x}, @var{y} coordinates.
  8232. It accepts the following parameters:
  8233. @table @option
  8234. @item width, w
  8235. @item height, h
  8236. Specify an expression for the size of the output image with the
  8237. paddings added. If the value for @var{width} or @var{height} is 0, the
  8238. corresponding input size is used for the output.
  8239. The @var{width} expression can reference the value set by the
  8240. @var{height} expression, and vice versa.
  8241. The default value of @var{width} and @var{height} is 0.
  8242. @item x
  8243. @item y
  8244. Specify the offsets to place the input image at within the padded area,
  8245. with respect to the top/left border of the output image.
  8246. The @var{x} expression can reference the value set by the @var{y}
  8247. expression, and vice versa.
  8248. The default value of @var{x} and @var{y} is 0.
  8249. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8250. so the input image is centered on the padded area.
  8251. @item color
  8252. Specify the color of the padded area. For the syntax of this option,
  8253. check the "Color" section in the ffmpeg-utils manual.
  8254. The default value of @var{color} is "black".
  8255. @item eval
  8256. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8257. It accepts the following values:
  8258. @table @samp
  8259. @item init
  8260. Only evaluate expressions once during the filter initialization or when
  8261. a command is processed.
  8262. @item frame
  8263. Evaluate expressions for each incoming frame.
  8264. @end table
  8265. Default value is @samp{init}.
  8266. @item aspect
  8267. Pad to aspect instead to a resolution.
  8268. @end table
  8269. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8270. options are expressions containing the following constants:
  8271. @table @option
  8272. @item in_w
  8273. @item in_h
  8274. The input video width and height.
  8275. @item iw
  8276. @item ih
  8277. These are the same as @var{in_w} and @var{in_h}.
  8278. @item out_w
  8279. @item out_h
  8280. The output width and height (the size of the padded area), as
  8281. specified by the @var{width} and @var{height} expressions.
  8282. @item ow
  8283. @item oh
  8284. These are the same as @var{out_w} and @var{out_h}.
  8285. @item x
  8286. @item y
  8287. The x and y offsets as specified by the @var{x} and @var{y}
  8288. expressions, or NAN if not yet specified.
  8289. @item a
  8290. same as @var{iw} / @var{ih}
  8291. @item sar
  8292. input sample aspect ratio
  8293. @item dar
  8294. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8295. @item hsub
  8296. @item vsub
  8297. The horizontal and vertical chroma subsample values. For example for the
  8298. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8299. @end table
  8300. @subsection Examples
  8301. @itemize
  8302. @item
  8303. Add paddings with the color "violet" to the input video. The output video
  8304. size is 640x480, and the top-left corner of the input video is placed at
  8305. column 0, row 40
  8306. @example
  8307. pad=640:480:0:40:violet
  8308. @end example
  8309. The example above is equivalent to the following command:
  8310. @example
  8311. pad=width=640:height=480:x=0:y=40:color=violet
  8312. @end example
  8313. @item
  8314. Pad the input to get an output with dimensions increased by 3/2,
  8315. and put the input video at the center of the padded area:
  8316. @example
  8317. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8318. @end example
  8319. @item
  8320. Pad the input to get a squared output with size equal to the maximum
  8321. value between the input width and height, and put the input video at
  8322. the center of the padded area:
  8323. @example
  8324. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8325. @end example
  8326. @item
  8327. Pad the input to get a final w/h ratio of 16:9:
  8328. @example
  8329. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8330. @end example
  8331. @item
  8332. In case of anamorphic video, in order to set the output display aspect
  8333. correctly, it is necessary to use @var{sar} in the expression,
  8334. according to the relation:
  8335. @example
  8336. (ih * X / ih) * sar = output_dar
  8337. X = output_dar / sar
  8338. @end example
  8339. Thus the previous example needs to be modified to:
  8340. @example
  8341. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8342. @end example
  8343. @item
  8344. Double the output size and put the input video in the bottom-right
  8345. corner of the output padded area:
  8346. @example
  8347. pad="2*iw:2*ih:ow-iw:oh-ih"
  8348. @end example
  8349. @end itemize
  8350. @anchor{palettegen}
  8351. @section palettegen
  8352. Generate one palette for a whole video stream.
  8353. It accepts the following options:
  8354. @table @option
  8355. @item max_colors
  8356. Set the maximum number of colors to quantize in the palette.
  8357. Note: the palette will still contain 256 colors; the unused palette entries
  8358. will be black.
  8359. @item reserve_transparent
  8360. Create a palette of 255 colors maximum and reserve the last one for
  8361. transparency. Reserving the transparency color is useful for GIF optimization.
  8362. If not set, the maximum of colors in the palette will be 256. You probably want
  8363. to disable this option for a standalone image.
  8364. Set by default.
  8365. @item stats_mode
  8366. Set statistics mode.
  8367. It accepts the following values:
  8368. @table @samp
  8369. @item full
  8370. Compute full frame histograms.
  8371. @item diff
  8372. Compute histograms only for the part that differs from previous frame. This
  8373. might be relevant to give more importance to the moving part of your input if
  8374. the background is static.
  8375. @item single
  8376. Compute new histogram for each frame.
  8377. @end table
  8378. Default value is @var{full}.
  8379. @end table
  8380. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8381. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8382. color quantization of the palette. This information is also visible at
  8383. @var{info} logging level.
  8384. @subsection Examples
  8385. @itemize
  8386. @item
  8387. Generate a representative palette of a given video using @command{ffmpeg}:
  8388. @example
  8389. ffmpeg -i input.mkv -vf palettegen palette.png
  8390. @end example
  8391. @end itemize
  8392. @section paletteuse
  8393. Use a palette to downsample an input video stream.
  8394. The filter takes two inputs: one video stream and a palette. The palette must
  8395. be a 256 pixels image.
  8396. It accepts the following options:
  8397. @table @option
  8398. @item dither
  8399. Select dithering mode. Available algorithms are:
  8400. @table @samp
  8401. @item bayer
  8402. Ordered 8x8 bayer dithering (deterministic)
  8403. @item heckbert
  8404. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8405. Note: this dithering is sometimes considered "wrong" and is included as a
  8406. reference.
  8407. @item floyd_steinberg
  8408. Floyd and Steingberg dithering (error diffusion)
  8409. @item sierra2
  8410. Frankie Sierra dithering v2 (error diffusion)
  8411. @item sierra2_4a
  8412. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8413. @end table
  8414. Default is @var{sierra2_4a}.
  8415. @item bayer_scale
  8416. When @var{bayer} dithering is selected, this option defines the scale of the
  8417. pattern (how much the crosshatch pattern is visible). A low value means more
  8418. visible pattern for less banding, and higher value means less visible pattern
  8419. at the cost of more banding.
  8420. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8421. @item diff_mode
  8422. If set, define the zone to process
  8423. @table @samp
  8424. @item rectangle
  8425. Only the changing rectangle will be reprocessed. This is similar to GIF
  8426. cropping/offsetting compression mechanism. This option can be useful for speed
  8427. if only a part of the image is changing, and has use cases such as limiting the
  8428. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8429. moving scene (it leads to more deterministic output if the scene doesn't change
  8430. much, and as a result less moving noise and better GIF compression).
  8431. @end table
  8432. Default is @var{none}.
  8433. @item new
  8434. Take new palette for each output frame.
  8435. @end table
  8436. @subsection Examples
  8437. @itemize
  8438. @item
  8439. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8440. using @command{ffmpeg}:
  8441. @example
  8442. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8443. @end example
  8444. @end itemize
  8445. @section perspective
  8446. Correct perspective of video not recorded perpendicular to the screen.
  8447. A description of the accepted parameters follows.
  8448. @table @option
  8449. @item x0
  8450. @item y0
  8451. @item x1
  8452. @item y1
  8453. @item x2
  8454. @item y2
  8455. @item x3
  8456. @item y3
  8457. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8458. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8459. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8460. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8461. then the corners of the source will be sent to the specified coordinates.
  8462. The expressions can use the following variables:
  8463. @table @option
  8464. @item W
  8465. @item H
  8466. the width and height of video frame.
  8467. @item in
  8468. Input frame count.
  8469. @item on
  8470. Output frame count.
  8471. @end table
  8472. @item interpolation
  8473. Set interpolation for perspective correction.
  8474. It accepts the following values:
  8475. @table @samp
  8476. @item linear
  8477. @item cubic
  8478. @end table
  8479. Default value is @samp{linear}.
  8480. @item sense
  8481. Set interpretation of coordinate options.
  8482. It accepts the following values:
  8483. @table @samp
  8484. @item 0, source
  8485. Send point in the source specified by the given coordinates to
  8486. the corners of the destination.
  8487. @item 1, destination
  8488. Send the corners of the source to the point in the destination specified
  8489. by the given coordinates.
  8490. Default value is @samp{source}.
  8491. @end table
  8492. @item eval
  8493. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8494. It accepts the following values:
  8495. @table @samp
  8496. @item init
  8497. only evaluate expressions once during the filter initialization or
  8498. when a command is processed
  8499. @item frame
  8500. evaluate expressions for each incoming frame
  8501. @end table
  8502. Default value is @samp{init}.
  8503. @end table
  8504. @section phase
  8505. Delay interlaced video by one field time so that the field order changes.
  8506. The intended use is to fix PAL movies that have been captured with the
  8507. opposite field order to the film-to-video transfer.
  8508. A description of the accepted parameters follows.
  8509. @table @option
  8510. @item mode
  8511. Set phase mode.
  8512. It accepts the following values:
  8513. @table @samp
  8514. @item t
  8515. Capture field order top-first, transfer bottom-first.
  8516. Filter will delay the bottom field.
  8517. @item b
  8518. Capture field order bottom-first, transfer top-first.
  8519. Filter will delay the top field.
  8520. @item p
  8521. Capture and transfer with the same field order. This mode only exists
  8522. for the documentation of the other options to refer to, but if you
  8523. actually select it, the filter will faithfully do nothing.
  8524. @item a
  8525. Capture field order determined automatically by field flags, transfer
  8526. opposite.
  8527. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8528. basis using field flags. If no field information is available,
  8529. then this works just like @samp{u}.
  8530. @item u
  8531. Capture unknown or varying, transfer opposite.
  8532. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8533. analyzing the images and selecting the alternative that produces best
  8534. match between the fields.
  8535. @item T
  8536. Capture top-first, transfer unknown or varying.
  8537. Filter selects among @samp{t} and @samp{p} using image analysis.
  8538. @item B
  8539. Capture bottom-first, transfer unknown or varying.
  8540. Filter selects among @samp{b} and @samp{p} using image analysis.
  8541. @item A
  8542. Capture determined by field flags, transfer unknown or varying.
  8543. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8544. image analysis. If no field information is available, then this works just
  8545. like @samp{U}. This is the default mode.
  8546. @item U
  8547. Both capture and transfer unknown or varying.
  8548. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8549. @end table
  8550. @end table
  8551. @section pixdesctest
  8552. Pixel format descriptor test filter, mainly useful for internal
  8553. testing. The output video should be equal to the input video.
  8554. For example:
  8555. @example
  8556. format=monow, pixdesctest
  8557. @end example
  8558. can be used to test the monowhite pixel format descriptor definition.
  8559. @section pixscope
  8560. Display sample values of color channels. Mainly useful for checking color and levels.
  8561. The filters accept the following options:
  8562. @table @option
  8563. @item x
  8564. Set scope X position, offset on X axis.
  8565. @item y
  8566. Set scope Y position, offset on Y axis.
  8567. @item w
  8568. Set scope width.
  8569. @item h
  8570. Set scope height.
  8571. @item o
  8572. Set window opacity. This window also holds statistics about pixel area.
  8573. @end table
  8574. @section pp
  8575. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8576. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8577. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8578. Each subfilter and some options have a short and a long name that can be used
  8579. interchangeably, i.e. dr/dering are the same.
  8580. The filters accept the following options:
  8581. @table @option
  8582. @item subfilters
  8583. Set postprocessing subfilters string.
  8584. @end table
  8585. All subfilters share common options to determine their scope:
  8586. @table @option
  8587. @item a/autoq
  8588. Honor the quality commands for this subfilter.
  8589. @item c/chrom
  8590. Do chrominance filtering, too (default).
  8591. @item y/nochrom
  8592. Do luminance filtering only (no chrominance).
  8593. @item n/noluma
  8594. Do chrominance filtering only (no luminance).
  8595. @end table
  8596. These options can be appended after the subfilter name, separated by a '|'.
  8597. Available subfilters are:
  8598. @table @option
  8599. @item hb/hdeblock[|difference[|flatness]]
  8600. Horizontal deblocking filter
  8601. @table @option
  8602. @item difference
  8603. Difference factor where higher values mean more deblocking (default: @code{32}).
  8604. @item flatness
  8605. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8606. @end table
  8607. @item vb/vdeblock[|difference[|flatness]]
  8608. Vertical deblocking filter
  8609. @table @option
  8610. @item difference
  8611. Difference factor where higher values mean more deblocking (default: @code{32}).
  8612. @item flatness
  8613. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8614. @end table
  8615. @item ha/hadeblock[|difference[|flatness]]
  8616. Accurate horizontal deblocking filter
  8617. @table @option
  8618. @item difference
  8619. Difference factor where higher values mean more deblocking (default: @code{32}).
  8620. @item flatness
  8621. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8622. @end table
  8623. @item va/vadeblock[|difference[|flatness]]
  8624. Accurate vertical deblocking filter
  8625. @table @option
  8626. @item difference
  8627. Difference factor where higher values mean more deblocking (default: @code{32}).
  8628. @item flatness
  8629. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8630. @end table
  8631. @end table
  8632. The horizontal and vertical deblocking filters share the difference and
  8633. flatness values so you cannot set different horizontal and vertical
  8634. thresholds.
  8635. @table @option
  8636. @item h1/x1hdeblock
  8637. Experimental horizontal deblocking filter
  8638. @item v1/x1vdeblock
  8639. Experimental vertical deblocking filter
  8640. @item dr/dering
  8641. Deringing filter
  8642. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8643. @table @option
  8644. @item threshold1
  8645. larger -> stronger filtering
  8646. @item threshold2
  8647. larger -> stronger filtering
  8648. @item threshold3
  8649. larger -> stronger filtering
  8650. @end table
  8651. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8652. @table @option
  8653. @item f/fullyrange
  8654. Stretch luminance to @code{0-255}.
  8655. @end table
  8656. @item lb/linblenddeint
  8657. Linear blend deinterlacing filter that deinterlaces the given block by
  8658. filtering all lines with a @code{(1 2 1)} filter.
  8659. @item li/linipoldeint
  8660. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8661. linearly interpolating every second line.
  8662. @item ci/cubicipoldeint
  8663. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8664. cubically interpolating every second line.
  8665. @item md/mediandeint
  8666. Median deinterlacing filter that deinterlaces the given block by applying a
  8667. median filter to every second line.
  8668. @item fd/ffmpegdeint
  8669. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8670. second line with a @code{(-1 4 2 4 -1)} filter.
  8671. @item l5/lowpass5
  8672. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8673. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8674. @item fq/forceQuant[|quantizer]
  8675. Overrides the quantizer table from the input with the constant quantizer you
  8676. specify.
  8677. @table @option
  8678. @item quantizer
  8679. Quantizer to use
  8680. @end table
  8681. @item de/default
  8682. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8683. @item fa/fast
  8684. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8685. @item ac
  8686. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8687. @end table
  8688. @subsection Examples
  8689. @itemize
  8690. @item
  8691. Apply horizontal and vertical deblocking, deringing and automatic
  8692. brightness/contrast:
  8693. @example
  8694. pp=hb/vb/dr/al
  8695. @end example
  8696. @item
  8697. Apply default filters without brightness/contrast correction:
  8698. @example
  8699. pp=de/-al
  8700. @end example
  8701. @item
  8702. Apply default filters and temporal denoiser:
  8703. @example
  8704. pp=default/tmpnoise|1|2|3
  8705. @end example
  8706. @item
  8707. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8708. automatically depending on available CPU time:
  8709. @example
  8710. pp=hb|y/vb|a
  8711. @end example
  8712. @end itemize
  8713. @section pp7
  8714. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8715. similar to spp = 6 with 7 point DCT, where only the center sample is
  8716. used after IDCT.
  8717. The filter accepts the following options:
  8718. @table @option
  8719. @item qp
  8720. Force a constant quantization parameter. It accepts an integer in range
  8721. 0 to 63. If not set, the filter will use the QP from the video stream
  8722. (if available).
  8723. @item mode
  8724. Set thresholding mode. Available modes are:
  8725. @table @samp
  8726. @item hard
  8727. Set hard thresholding.
  8728. @item soft
  8729. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8730. @item medium
  8731. Set medium thresholding (good results, default).
  8732. @end table
  8733. @end table
  8734. @section premultiply
  8735. Apply alpha premultiply effect to input video stream using first plane
  8736. of second stream as alpha.
  8737. Both streams must have same dimensions and same pixel format.
  8738. The filter accepts the following option:
  8739. @table @option
  8740. @item planes
  8741. Set which planes will be processed, unprocessed planes will be copied.
  8742. By default value 0xf, all planes will be processed.
  8743. @end table
  8744. @section prewitt
  8745. Apply prewitt operator to input video stream.
  8746. The filter accepts the following option:
  8747. @table @option
  8748. @item planes
  8749. Set which planes will be processed, unprocessed planes will be copied.
  8750. By default value 0xf, all planes will be processed.
  8751. @item scale
  8752. Set value which will be multiplied with filtered result.
  8753. @item delta
  8754. Set value which will be added to filtered result.
  8755. @end table
  8756. @section psnr
  8757. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8758. Ratio) between two input videos.
  8759. This filter takes in input two input videos, the first input is
  8760. considered the "main" source and is passed unchanged to the
  8761. output. The second input is used as a "reference" video for computing
  8762. the PSNR.
  8763. Both video inputs must have the same resolution and pixel format for
  8764. this filter to work correctly. Also it assumes that both inputs
  8765. have the same number of frames, which are compared one by one.
  8766. The obtained average PSNR is printed through the logging system.
  8767. The filter stores the accumulated MSE (mean squared error) of each
  8768. frame, and at the end of the processing it is averaged across all frames
  8769. equally, and the following formula is applied to obtain the PSNR:
  8770. @example
  8771. PSNR = 10*log10(MAX^2/MSE)
  8772. @end example
  8773. Where MAX is the average of the maximum values of each component of the
  8774. image.
  8775. The description of the accepted parameters follows.
  8776. @table @option
  8777. @item stats_file, f
  8778. If specified the filter will use the named file to save the PSNR of
  8779. each individual frame. When filename equals "-" the data is sent to
  8780. standard output.
  8781. @item stats_version
  8782. Specifies which version of the stats file format to use. Details of
  8783. each format are written below.
  8784. Default value is 1.
  8785. @item stats_add_max
  8786. Determines whether the max value is output to the stats log.
  8787. Default value is 0.
  8788. Requires stats_version >= 2. If this is set and stats_version < 2,
  8789. the filter will return an error.
  8790. @end table
  8791. The file printed if @var{stats_file} is selected, contains a sequence of
  8792. key/value pairs of the form @var{key}:@var{value} for each compared
  8793. couple of frames.
  8794. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8795. the list of per-frame-pair stats, with key value pairs following the frame
  8796. format with the following parameters:
  8797. @table @option
  8798. @item psnr_log_version
  8799. The version of the log file format. Will match @var{stats_version}.
  8800. @item fields
  8801. A comma separated list of the per-frame-pair parameters included in
  8802. the log.
  8803. @end table
  8804. A description of each shown per-frame-pair parameter follows:
  8805. @table @option
  8806. @item n
  8807. sequential number of the input frame, starting from 1
  8808. @item mse_avg
  8809. Mean Square Error pixel-by-pixel average difference of the compared
  8810. frames, averaged over all the image components.
  8811. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8812. Mean Square Error pixel-by-pixel average difference of the compared
  8813. frames for the component specified by the suffix.
  8814. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8815. Peak Signal to Noise ratio of the compared frames for the component
  8816. specified by the suffix.
  8817. @item max_avg, max_y, max_u, max_v
  8818. Maximum allowed value for each channel, and average over all
  8819. channels.
  8820. @end table
  8821. For example:
  8822. @example
  8823. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8824. [main][ref] psnr="stats_file=stats.log" [out]
  8825. @end example
  8826. On this example the input file being processed is compared with the
  8827. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8828. is stored in @file{stats.log}.
  8829. @anchor{pullup}
  8830. @section pullup
  8831. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8832. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8833. content.
  8834. The pullup filter is designed to take advantage of future context in making
  8835. its decisions. This filter is stateless in the sense that it does not lock
  8836. onto a pattern to follow, but it instead looks forward to the following
  8837. fields in order to identify matches and rebuild progressive frames.
  8838. To produce content with an even framerate, insert the fps filter after
  8839. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8840. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8841. The filter accepts the following options:
  8842. @table @option
  8843. @item jl
  8844. @item jr
  8845. @item jt
  8846. @item jb
  8847. These options set the amount of "junk" to ignore at the left, right, top, and
  8848. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8849. while top and bottom are in units of 2 lines.
  8850. The default is 8 pixels on each side.
  8851. @item sb
  8852. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8853. filter generating an occasional mismatched frame, but it may also cause an
  8854. excessive number of frames to be dropped during high motion sequences.
  8855. Conversely, setting it to -1 will make filter match fields more easily.
  8856. This may help processing of video where there is slight blurring between
  8857. the fields, but may also cause there to be interlaced frames in the output.
  8858. Default value is @code{0}.
  8859. @item mp
  8860. Set the metric plane to use. It accepts the following values:
  8861. @table @samp
  8862. @item l
  8863. Use luma plane.
  8864. @item u
  8865. Use chroma blue plane.
  8866. @item v
  8867. Use chroma red plane.
  8868. @end table
  8869. This option may be set to use chroma plane instead of the default luma plane
  8870. for doing filter's computations. This may improve accuracy on very clean
  8871. source material, but more likely will decrease accuracy, especially if there
  8872. is chroma noise (rainbow effect) or any grayscale video.
  8873. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8874. load and make pullup usable in realtime on slow machines.
  8875. @end table
  8876. For best results (without duplicated frames in the output file) it is
  8877. necessary to change the output frame rate. For example, to inverse
  8878. telecine NTSC input:
  8879. @example
  8880. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8881. @end example
  8882. @section qp
  8883. Change video quantization parameters (QP).
  8884. The filter accepts the following option:
  8885. @table @option
  8886. @item qp
  8887. Set expression for quantization parameter.
  8888. @end table
  8889. The expression is evaluated through the eval API and can contain, among others,
  8890. the following constants:
  8891. @table @var
  8892. @item known
  8893. 1 if index is not 129, 0 otherwise.
  8894. @item qp
  8895. Sequentional index starting from -129 to 128.
  8896. @end table
  8897. @subsection Examples
  8898. @itemize
  8899. @item
  8900. Some equation like:
  8901. @example
  8902. qp=2+2*sin(PI*qp)
  8903. @end example
  8904. @end itemize
  8905. @section random
  8906. Flush video frames from internal cache of frames into a random order.
  8907. No frame is discarded.
  8908. Inspired by @ref{frei0r} nervous filter.
  8909. @table @option
  8910. @item frames
  8911. Set size in number of frames of internal cache, in range from @code{2} to
  8912. @code{512}. Default is @code{30}.
  8913. @item seed
  8914. Set seed for random number generator, must be an integer included between
  8915. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8916. less than @code{0}, the filter will try to use a good random seed on a
  8917. best effort basis.
  8918. @end table
  8919. @section readeia608
  8920. Read closed captioning (EIA-608) information from the top lines of a video frame.
  8921. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  8922. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  8923. with EIA-608 data (starting from 0). A description of each metadata value follows:
  8924. @table @option
  8925. @item lavfi.readeia608.X.cc
  8926. The two bytes stored as EIA-608 data (printed in hexadecimal).
  8927. @item lavfi.readeia608.X.line
  8928. The number of the line on which the EIA-608 data was identified and read.
  8929. @end table
  8930. This filter accepts the following options:
  8931. @table @option
  8932. @item scan_min
  8933. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  8934. @item scan_max
  8935. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  8936. @item mac
  8937. Set minimal acceptable amplitude change for sync codes detection.
  8938. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  8939. @item spw
  8940. Set the ratio of width reserved for sync code detection.
  8941. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  8942. @item mhd
  8943. Set the max peaks height difference for sync code detection.
  8944. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8945. @item mpd
  8946. Set max peaks period difference for sync code detection.
  8947. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8948. @item msd
  8949. Set the first two max start code bits differences.
  8950. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  8951. @item bhd
  8952. Set the minimum ratio of bits height compared to 3rd start code bit.
  8953. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  8954. @item th_w
  8955. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  8956. @item th_b
  8957. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  8958. @item chp
  8959. Enable checking the parity bit. In the event of a parity error, the filter will output
  8960. @code{0x00} for that character. Default is false.
  8961. @end table
  8962. @subsection Examples
  8963. @itemize
  8964. @item
  8965. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  8966. @example
  8967. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  8968. @end example
  8969. @end itemize
  8970. @section readvitc
  8971. Read vertical interval timecode (VITC) information from the top lines of a
  8972. video frame.
  8973. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8974. timecode value, if a valid timecode has been detected. Further metadata key
  8975. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8976. timecode data has been found or not.
  8977. This filter accepts the following options:
  8978. @table @option
  8979. @item scan_max
  8980. Set the maximum number of lines to scan for VITC data. If the value is set to
  8981. @code{-1} the full video frame is scanned. Default is @code{45}.
  8982. @item thr_b
  8983. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8984. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8985. @item thr_w
  8986. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8987. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8988. @end table
  8989. @subsection Examples
  8990. @itemize
  8991. @item
  8992. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8993. draw @code{--:--:--:--} as a placeholder:
  8994. @example
  8995. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8996. @end example
  8997. @end itemize
  8998. @section remap
  8999. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9000. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9001. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9002. value for pixel will be used for destination pixel.
  9003. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9004. will have Xmap/Ymap video stream dimensions.
  9005. Xmap and Ymap input video streams are 16bit depth, single channel.
  9006. @section removegrain
  9007. The removegrain filter is a spatial denoiser for progressive video.
  9008. @table @option
  9009. @item m0
  9010. Set mode for the first plane.
  9011. @item m1
  9012. Set mode for the second plane.
  9013. @item m2
  9014. Set mode for the third plane.
  9015. @item m3
  9016. Set mode for the fourth plane.
  9017. @end table
  9018. Range of mode is from 0 to 24. Description of each mode follows:
  9019. @table @var
  9020. @item 0
  9021. Leave input plane unchanged. Default.
  9022. @item 1
  9023. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9024. @item 2
  9025. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9026. @item 3
  9027. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9028. @item 4
  9029. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9030. This is equivalent to a median filter.
  9031. @item 5
  9032. Line-sensitive clipping giving the minimal change.
  9033. @item 6
  9034. Line-sensitive clipping, intermediate.
  9035. @item 7
  9036. Line-sensitive clipping, intermediate.
  9037. @item 8
  9038. Line-sensitive clipping, intermediate.
  9039. @item 9
  9040. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9041. @item 10
  9042. Replaces the target pixel with the closest neighbour.
  9043. @item 11
  9044. [1 2 1] horizontal and vertical kernel blur.
  9045. @item 12
  9046. Same as mode 11.
  9047. @item 13
  9048. Bob mode, interpolates top field from the line where the neighbours
  9049. pixels are the closest.
  9050. @item 14
  9051. Bob mode, interpolates bottom field from the line where the neighbours
  9052. pixels are the closest.
  9053. @item 15
  9054. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9055. interpolation formula.
  9056. @item 16
  9057. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9058. interpolation formula.
  9059. @item 17
  9060. Clips the pixel with the minimum and maximum of respectively the maximum and
  9061. minimum of each pair of opposite neighbour pixels.
  9062. @item 18
  9063. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9064. the current pixel is minimal.
  9065. @item 19
  9066. Replaces the pixel with the average of its 8 neighbours.
  9067. @item 20
  9068. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9069. @item 21
  9070. Clips pixels using the averages of opposite neighbour.
  9071. @item 22
  9072. Same as mode 21 but simpler and faster.
  9073. @item 23
  9074. Small edge and halo removal, but reputed useless.
  9075. @item 24
  9076. Similar as 23.
  9077. @end table
  9078. @section removelogo
  9079. Suppress a TV station logo, using an image file to determine which
  9080. pixels comprise the logo. It works by filling in the pixels that
  9081. comprise the logo with neighboring pixels.
  9082. The filter accepts the following options:
  9083. @table @option
  9084. @item filename, f
  9085. Set the filter bitmap file, which can be any image format supported by
  9086. libavformat. The width and height of the image file must match those of the
  9087. video stream being processed.
  9088. @end table
  9089. Pixels in the provided bitmap image with a value of zero are not
  9090. considered part of the logo, non-zero pixels are considered part of
  9091. the logo. If you use white (255) for the logo and black (0) for the
  9092. rest, you will be safe. For making the filter bitmap, it is
  9093. recommended to take a screen capture of a black frame with the logo
  9094. visible, and then using a threshold filter followed by the erode
  9095. filter once or twice.
  9096. If needed, little splotches can be fixed manually. Remember that if
  9097. logo pixels are not covered, the filter quality will be much
  9098. reduced. Marking too many pixels as part of the logo does not hurt as
  9099. much, but it will increase the amount of blurring needed to cover over
  9100. the image and will destroy more information than necessary, and extra
  9101. pixels will slow things down on a large logo.
  9102. @section repeatfields
  9103. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9104. fields based on its value.
  9105. @section reverse
  9106. Reverse a video clip.
  9107. Warning: This filter requires memory to buffer the entire clip, so trimming
  9108. is suggested.
  9109. @subsection Examples
  9110. @itemize
  9111. @item
  9112. Take the first 5 seconds of a clip, and reverse it.
  9113. @example
  9114. trim=end=5,reverse
  9115. @end example
  9116. @end itemize
  9117. @section rotate
  9118. Rotate video by an arbitrary angle expressed in radians.
  9119. The filter accepts the following options:
  9120. A description of the optional parameters follows.
  9121. @table @option
  9122. @item angle, a
  9123. Set an expression for the angle by which to rotate the input video
  9124. clockwise, expressed as a number of radians. A negative value will
  9125. result in a counter-clockwise rotation. By default it is set to "0".
  9126. This expression is evaluated for each frame.
  9127. @item out_w, ow
  9128. Set the output width expression, default value is "iw".
  9129. This expression is evaluated just once during configuration.
  9130. @item out_h, oh
  9131. Set the output height expression, default value is "ih".
  9132. This expression is evaluated just once during configuration.
  9133. @item bilinear
  9134. Enable bilinear interpolation if set to 1, a value of 0 disables
  9135. it. Default value is 1.
  9136. @item fillcolor, c
  9137. Set the color used to fill the output area not covered by the rotated
  9138. image. For the general syntax of this option, check the "Color" section in the
  9139. ffmpeg-utils manual. If the special value "none" is selected then no
  9140. background is printed (useful for example if the background is never shown).
  9141. Default value is "black".
  9142. @end table
  9143. The expressions for the angle and the output size can contain the
  9144. following constants and functions:
  9145. @table @option
  9146. @item n
  9147. sequential number of the input frame, starting from 0. It is always NAN
  9148. before the first frame is filtered.
  9149. @item t
  9150. time in seconds of the input frame, it is set to 0 when the filter is
  9151. configured. It is always NAN before the first frame is filtered.
  9152. @item hsub
  9153. @item vsub
  9154. horizontal and vertical chroma subsample values. For example for the
  9155. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9156. @item in_w, iw
  9157. @item in_h, ih
  9158. the input video width and height
  9159. @item out_w, ow
  9160. @item out_h, oh
  9161. the output width and height, that is the size of the padded area as
  9162. specified by the @var{width} and @var{height} expressions
  9163. @item rotw(a)
  9164. @item roth(a)
  9165. the minimal width/height required for completely containing the input
  9166. video rotated by @var{a} radians.
  9167. These are only available when computing the @option{out_w} and
  9168. @option{out_h} expressions.
  9169. @end table
  9170. @subsection Examples
  9171. @itemize
  9172. @item
  9173. Rotate the input by PI/6 radians clockwise:
  9174. @example
  9175. rotate=PI/6
  9176. @end example
  9177. @item
  9178. Rotate the input by PI/6 radians counter-clockwise:
  9179. @example
  9180. rotate=-PI/6
  9181. @end example
  9182. @item
  9183. Rotate the input by 45 degrees clockwise:
  9184. @example
  9185. rotate=45*PI/180
  9186. @end example
  9187. @item
  9188. Apply a constant rotation with period T, starting from an angle of PI/3:
  9189. @example
  9190. rotate=PI/3+2*PI*t/T
  9191. @end example
  9192. @item
  9193. Make the input video rotation oscillating with a period of T
  9194. seconds and an amplitude of A radians:
  9195. @example
  9196. rotate=A*sin(2*PI/T*t)
  9197. @end example
  9198. @item
  9199. Rotate the video, output size is chosen so that the whole rotating
  9200. input video is always completely contained in the output:
  9201. @example
  9202. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9203. @end example
  9204. @item
  9205. Rotate the video, reduce the output size so that no background is ever
  9206. shown:
  9207. @example
  9208. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9209. @end example
  9210. @end itemize
  9211. @subsection Commands
  9212. The filter supports the following commands:
  9213. @table @option
  9214. @item a, angle
  9215. Set the angle expression.
  9216. The command accepts the same syntax of the corresponding option.
  9217. If the specified expression is not valid, it is kept at its current
  9218. value.
  9219. @end table
  9220. @section sab
  9221. Apply Shape Adaptive Blur.
  9222. The filter accepts the following options:
  9223. @table @option
  9224. @item luma_radius, lr
  9225. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9226. value is 1.0. A greater value will result in a more blurred image, and
  9227. in slower processing.
  9228. @item luma_pre_filter_radius, lpfr
  9229. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9230. value is 1.0.
  9231. @item luma_strength, ls
  9232. Set luma maximum difference between pixels to still be considered, must
  9233. be a value in the 0.1-100.0 range, default value is 1.0.
  9234. @item chroma_radius, cr
  9235. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9236. greater value will result in a more blurred image, and in slower
  9237. processing.
  9238. @item chroma_pre_filter_radius, cpfr
  9239. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9240. @item chroma_strength, cs
  9241. Set chroma maximum difference between pixels to still be considered,
  9242. must be a value in the -0.9-100.0 range.
  9243. @end table
  9244. Each chroma option value, if not explicitly specified, is set to the
  9245. corresponding luma option value.
  9246. @anchor{scale}
  9247. @section scale
  9248. Scale (resize) the input video, using the libswscale library.
  9249. The scale filter forces the output display aspect ratio to be the same
  9250. of the input, by changing the output sample aspect ratio.
  9251. If the input image format is different from the format requested by
  9252. the next filter, the scale filter will convert the input to the
  9253. requested format.
  9254. @subsection Options
  9255. The filter accepts the following options, or any of the options
  9256. supported by the libswscale scaler.
  9257. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9258. the complete list of scaler options.
  9259. @table @option
  9260. @item width, w
  9261. @item height, h
  9262. Set the output video dimension expression. Default value is the input
  9263. dimension.
  9264. If the value is 0, the input width is used for the output.
  9265. If one of the values is -1, the scale filter will use a value that
  9266. maintains the aspect ratio of the input image, calculated from the
  9267. other specified dimension. If both of them are -1, the input size is
  9268. used
  9269. If one of the values is -n with n > 1, the scale filter will also use a value
  9270. that maintains the aspect ratio of the input image, calculated from the other
  9271. specified dimension. After that it will, however, make sure that the calculated
  9272. dimension is divisible by n and adjust the value if necessary.
  9273. See below for the list of accepted constants for use in the dimension
  9274. expression.
  9275. @item eval
  9276. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9277. @table @samp
  9278. @item init
  9279. Only evaluate expressions once during the filter initialization or when a command is processed.
  9280. @item frame
  9281. Evaluate expressions for each incoming frame.
  9282. @end table
  9283. Default value is @samp{init}.
  9284. @item interl
  9285. Set the interlacing mode. It accepts the following values:
  9286. @table @samp
  9287. @item 1
  9288. Force interlaced aware scaling.
  9289. @item 0
  9290. Do not apply interlaced scaling.
  9291. @item -1
  9292. Select interlaced aware scaling depending on whether the source frames
  9293. are flagged as interlaced or not.
  9294. @end table
  9295. Default value is @samp{0}.
  9296. @item flags
  9297. Set libswscale scaling flags. See
  9298. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9299. complete list of values. If not explicitly specified the filter applies
  9300. the default flags.
  9301. @item param0, param1
  9302. Set libswscale input parameters for scaling algorithms that need them. See
  9303. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9304. complete documentation. If not explicitly specified the filter applies
  9305. empty parameters.
  9306. @item size, s
  9307. Set the video size. For the syntax of this option, check the
  9308. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9309. @item in_color_matrix
  9310. @item out_color_matrix
  9311. Set in/output YCbCr color space type.
  9312. This allows the autodetected value to be overridden as well as allows forcing
  9313. a specific value used for the output and encoder.
  9314. If not specified, the color space type depends on the pixel format.
  9315. Possible values:
  9316. @table @samp
  9317. @item auto
  9318. Choose automatically.
  9319. @item bt709
  9320. Format conforming to International Telecommunication Union (ITU)
  9321. Recommendation BT.709.
  9322. @item fcc
  9323. Set color space conforming to the United States Federal Communications
  9324. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9325. @item bt601
  9326. Set color space conforming to:
  9327. @itemize
  9328. @item
  9329. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9330. @item
  9331. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9332. @item
  9333. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9334. @end itemize
  9335. @item smpte240m
  9336. Set color space conforming to SMPTE ST 240:1999.
  9337. @end table
  9338. @item in_range
  9339. @item out_range
  9340. Set in/output YCbCr sample range.
  9341. This allows the autodetected value to be overridden as well as allows forcing
  9342. a specific value used for the output and encoder. If not specified, the
  9343. range depends on the pixel format. Possible values:
  9344. @table @samp
  9345. @item auto
  9346. Choose automatically.
  9347. @item jpeg/full/pc
  9348. Set full range (0-255 in case of 8-bit luma).
  9349. @item mpeg/tv
  9350. Set "MPEG" range (16-235 in case of 8-bit luma).
  9351. @end table
  9352. @item force_original_aspect_ratio
  9353. Enable decreasing or increasing output video width or height if necessary to
  9354. keep the original aspect ratio. Possible values:
  9355. @table @samp
  9356. @item disable
  9357. Scale the video as specified and disable this feature.
  9358. @item decrease
  9359. The output video dimensions will automatically be decreased if needed.
  9360. @item increase
  9361. The output video dimensions will automatically be increased if needed.
  9362. @end table
  9363. One useful instance of this option is that when you know a specific device's
  9364. maximum allowed resolution, you can use this to limit the output video to
  9365. that, while retaining the aspect ratio. For example, device A allows
  9366. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9367. decrease) and specifying 1280x720 to the command line makes the output
  9368. 1280x533.
  9369. Please note that this is a different thing than specifying -1 for @option{w}
  9370. or @option{h}, you still need to specify the output resolution for this option
  9371. to work.
  9372. @end table
  9373. The values of the @option{w} and @option{h} options are expressions
  9374. containing the following constants:
  9375. @table @var
  9376. @item in_w
  9377. @item in_h
  9378. The input width and height
  9379. @item iw
  9380. @item ih
  9381. These are the same as @var{in_w} and @var{in_h}.
  9382. @item out_w
  9383. @item out_h
  9384. The output (scaled) width and height
  9385. @item ow
  9386. @item oh
  9387. These are the same as @var{out_w} and @var{out_h}
  9388. @item a
  9389. The same as @var{iw} / @var{ih}
  9390. @item sar
  9391. input sample aspect ratio
  9392. @item dar
  9393. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9394. @item hsub
  9395. @item vsub
  9396. horizontal and vertical input chroma subsample values. For example for the
  9397. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9398. @item ohsub
  9399. @item ovsub
  9400. horizontal and vertical output chroma subsample values. For example for the
  9401. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9402. @end table
  9403. @subsection Examples
  9404. @itemize
  9405. @item
  9406. Scale the input video to a size of 200x100
  9407. @example
  9408. scale=w=200:h=100
  9409. @end example
  9410. This is equivalent to:
  9411. @example
  9412. scale=200:100
  9413. @end example
  9414. or:
  9415. @example
  9416. scale=200x100
  9417. @end example
  9418. @item
  9419. Specify a size abbreviation for the output size:
  9420. @example
  9421. scale=qcif
  9422. @end example
  9423. which can also be written as:
  9424. @example
  9425. scale=size=qcif
  9426. @end example
  9427. @item
  9428. Scale the input to 2x:
  9429. @example
  9430. scale=w=2*iw:h=2*ih
  9431. @end example
  9432. @item
  9433. The above is the same as:
  9434. @example
  9435. scale=2*in_w:2*in_h
  9436. @end example
  9437. @item
  9438. Scale the input to 2x with forced interlaced scaling:
  9439. @example
  9440. scale=2*iw:2*ih:interl=1
  9441. @end example
  9442. @item
  9443. Scale the input to half size:
  9444. @example
  9445. scale=w=iw/2:h=ih/2
  9446. @end example
  9447. @item
  9448. Increase the width, and set the height to the same size:
  9449. @example
  9450. scale=3/2*iw:ow
  9451. @end example
  9452. @item
  9453. Seek Greek harmony:
  9454. @example
  9455. scale=iw:1/PHI*iw
  9456. scale=ih*PHI:ih
  9457. @end example
  9458. @item
  9459. Increase the height, and set the width to 3/2 of the height:
  9460. @example
  9461. scale=w=3/2*oh:h=3/5*ih
  9462. @end example
  9463. @item
  9464. Increase the size, making the size a multiple of the chroma
  9465. subsample values:
  9466. @example
  9467. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9468. @end example
  9469. @item
  9470. Increase the width to a maximum of 500 pixels,
  9471. keeping the same aspect ratio as the input:
  9472. @example
  9473. scale=w='min(500\, iw*3/2):h=-1'
  9474. @end example
  9475. @end itemize
  9476. @subsection Commands
  9477. This filter supports the following commands:
  9478. @table @option
  9479. @item width, w
  9480. @item height, h
  9481. Set the output video dimension expression.
  9482. The command accepts the same syntax of the corresponding option.
  9483. If the specified expression is not valid, it is kept at its current
  9484. value.
  9485. @end table
  9486. @section scale_npp
  9487. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9488. format conversion on CUDA video frames. Setting the output width and height
  9489. works in the same way as for the @var{scale} filter.
  9490. The following additional options are accepted:
  9491. @table @option
  9492. @item format
  9493. The pixel format of the output CUDA frames. If set to the string "same" (the
  9494. default), the input format will be kept. Note that automatic format negotiation
  9495. and conversion is not yet supported for hardware frames
  9496. @item interp_algo
  9497. The interpolation algorithm used for resizing. One of the following:
  9498. @table @option
  9499. @item nn
  9500. Nearest neighbour.
  9501. @item linear
  9502. @item cubic
  9503. @item cubic2p_bspline
  9504. 2-parameter cubic (B=1, C=0)
  9505. @item cubic2p_catmullrom
  9506. 2-parameter cubic (B=0, C=1/2)
  9507. @item cubic2p_b05c03
  9508. 2-parameter cubic (B=1/2, C=3/10)
  9509. @item super
  9510. Supersampling
  9511. @item lanczos
  9512. @end table
  9513. @end table
  9514. @section scale2ref
  9515. Scale (resize) the input video, based on a reference video.
  9516. See the scale filter for available options, scale2ref supports the same but
  9517. uses the reference video instead of the main input as basis.
  9518. @subsection Examples
  9519. @itemize
  9520. @item
  9521. Scale a subtitle stream to match the main video in size before overlaying
  9522. @example
  9523. 'scale2ref[b][a];[a][b]overlay'
  9524. @end example
  9525. @end itemize
  9526. @anchor{selectivecolor}
  9527. @section selectivecolor
  9528. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9529. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9530. by the "purity" of the color (that is, how saturated it already is).
  9531. This filter is similar to the Adobe Photoshop Selective Color tool.
  9532. The filter accepts the following options:
  9533. @table @option
  9534. @item correction_method
  9535. Select color correction method.
  9536. Available values are:
  9537. @table @samp
  9538. @item absolute
  9539. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9540. component value).
  9541. @item relative
  9542. Specified adjustments are relative to the original component value.
  9543. @end table
  9544. Default is @code{absolute}.
  9545. @item reds
  9546. Adjustments for red pixels (pixels where the red component is the maximum)
  9547. @item yellows
  9548. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9549. @item greens
  9550. Adjustments for green pixels (pixels where the green component is the maximum)
  9551. @item cyans
  9552. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9553. @item blues
  9554. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9555. @item magentas
  9556. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9557. @item whites
  9558. Adjustments for white pixels (pixels where all components are greater than 128)
  9559. @item neutrals
  9560. Adjustments for all pixels except pure black and pure white
  9561. @item blacks
  9562. Adjustments for black pixels (pixels where all components are lesser than 128)
  9563. @item psfile
  9564. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9565. @end table
  9566. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9567. 4 space separated floating point adjustment values in the [-1,1] range,
  9568. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9569. pixels of its range.
  9570. @subsection Examples
  9571. @itemize
  9572. @item
  9573. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9574. increase magenta by 27% in blue areas:
  9575. @example
  9576. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9577. @end example
  9578. @item
  9579. Use a Photoshop selective color preset:
  9580. @example
  9581. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9582. @end example
  9583. @end itemize
  9584. @anchor{separatefields}
  9585. @section separatefields
  9586. The @code{separatefields} takes a frame-based video input and splits
  9587. each frame into its components fields, producing a new half height clip
  9588. with twice the frame rate and twice the frame count.
  9589. This filter use field-dominance information in frame to decide which
  9590. of each pair of fields to place first in the output.
  9591. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9592. @section setdar, setsar
  9593. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9594. output video.
  9595. This is done by changing the specified Sample (aka Pixel) Aspect
  9596. Ratio, according to the following equation:
  9597. @example
  9598. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9599. @end example
  9600. Keep in mind that the @code{setdar} filter does not modify the pixel
  9601. dimensions of the video frame. Also, the display aspect ratio set by
  9602. this filter may be changed by later filters in the filterchain,
  9603. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9604. applied.
  9605. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9606. the filter output video.
  9607. Note that as a consequence of the application of this filter, the
  9608. output display aspect ratio will change according to the equation
  9609. above.
  9610. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9611. filter may be changed by later filters in the filterchain, e.g. if
  9612. another "setsar" or a "setdar" filter is applied.
  9613. It accepts the following parameters:
  9614. @table @option
  9615. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9616. Set the aspect ratio used by the filter.
  9617. The parameter can be a floating point number string, an expression, or
  9618. a string of the form @var{num}:@var{den}, where @var{num} and
  9619. @var{den} are the numerator and denominator of the aspect ratio. If
  9620. the parameter is not specified, it is assumed the value "0".
  9621. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9622. should be escaped.
  9623. @item max
  9624. Set the maximum integer value to use for expressing numerator and
  9625. denominator when reducing the expressed aspect ratio to a rational.
  9626. Default value is @code{100}.
  9627. @end table
  9628. The parameter @var{sar} is an expression containing
  9629. the following constants:
  9630. @table @option
  9631. @item E, PI, PHI
  9632. These are approximated values for the mathematical constants e
  9633. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9634. @item w, h
  9635. The input width and height.
  9636. @item a
  9637. These are the same as @var{w} / @var{h}.
  9638. @item sar
  9639. The input sample aspect ratio.
  9640. @item dar
  9641. The input display aspect ratio. It is the same as
  9642. (@var{w} / @var{h}) * @var{sar}.
  9643. @item hsub, vsub
  9644. Horizontal and vertical chroma subsample values. For example, for the
  9645. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9646. @end table
  9647. @subsection Examples
  9648. @itemize
  9649. @item
  9650. To change the display aspect ratio to 16:9, specify one of the following:
  9651. @example
  9652. setdar=dar=1.77777
  9653. setdar=dar=16/9
  9654. @end example
  9655. @item
  9656. To change the sample aspect ratio to 10:11, specify:
  9657. @example
  9658. setsar=sar=10/11
  9659. @end example
  9660. @item
  9661. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9662. 1000 in the aspect ratio reduction, use the command:
  9663. @example
  9664. setdar=ratio=16/9:max=1000
  9665. @end example
  9666. @end itemize
  9667. @anchor{setfield}
  9668. @section setfield
  9669. Force field for the output video frame.
  9670. The @code{setfield} filter marks the interlace type field for the
  9671. output frames. It does not change the input frame, but only sets the
  9672. corresponding property, which affects how the frame is treated by
  9673. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9674. The filter accepts the following options:
  9675. @table @option
  9676. @item mode
  9677. Available values are:
  9678. @table @samp
  9679. @item auto
  9680. Keep the same field property.
  9681. @item bff
  9682. Mark the frame as bottom-field-first.
  9683. @item tff
  9684. Mark the frame as top-field-first.
  9685. @item prog
  9686. Mark the frame as progressive.
  9687. @end table
  9688. @end table
  9689. @section showinfo
  9690. Show a line containing various information for each input video frame.
  9691. The input video is not modified.
  9692. The shown line contains a sequence of key/value pairs of the form
  9693. @var{key}:@var{value}.
  9694. The following values are shown in the output:
  9695. @table @option
  9696. @item n
  9697. The (sequential) number of the input frame, starting from 0.
  9698. @item pts
  9699. The Presentation TimeStamp of the input frame, expressed as a number of
  9700. time base units. The time base unit depends on the filter input pad.
  9701. @item pts_time
  9702. The Presentation TimeStamp of the input frame, expressed as a number of
  9703. seconds.
  9704. @item pos
  9705. The position of the frame in the input stream, or -1 if this information is
  9706. unavailable and/or meaningless (for example in case of synthetic video).
  9707. @item fmt
  9708. The pixel format name.
  9709. @item sar
  9710. The sample aspect ratio of the input frame, expressed in the form
  9711. @var{num}/@var{den}.
  9712. @item s
  9713. The size of the input frame. For the syntax of this option, check the
  9714. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9715. @item i
  9716. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9717. for bottom field first).
  9718. @item iskey
  9719. This is 1 if the frame is a key frame, 0 otherwise.
  9720. @item type
  9721. The picture type of the input frame ("I" for an I-frame, "P" for a
  9722. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9723. Also refer to the documentation of the @code{AVPictureType} enum and of
  9724. the @code{av_get_picture_type_char} function defined in
  9725. @file{libavutil/avutil.h}.
  9726. @item checksum
  9727. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9728. @item plane_checksum
  9729. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9730. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9731. @end table
  9732. @section showpalette
  9733. Displays the 256 colors palette of each frame. This filter is only relevant for
  9734. @var{pal8} pixel format frames.
  9735. It accepts the following option:
  9736. @table @option
  9737. @item s
  9738. Set the size of the box used to represent one palette color entry. Default is
  9739. @code{30} (for a @code{30x30} pixel box).
  9740. @end table
  9741. @section shuffleframes
  9742. Reorder and/or duplicate and/or drop video frames.
  9743. It accepts the following parameters:
  9744. @table @option
  9745. @item mapping
  9746. Set the destination indexes of input frames.
  9747. This is space or '|' separated list of indexes that maps input frames to output
  9748. frames. Number of indexes also sets maximal value that each index may have.
  9749. '-1' index have special meaning and that is to drop frame.
  9750. @end table
  9751. The first frame has the index 0. The default is to keep the input unchanged.
  9752. @subsection Examples
  9753. @itemize
  9754. @item
  9755. Swap second and third frame of every three frames of the input:
  9756. @example
  9757. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9758. @end example
  9759. @item
  9760. Swap 10th and 1st frame of every ten frames of the input:
  9761. @example
  9762. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9763. @end example
  9764. @end itemize
  9765. @section shuffleplanes
  9766. Reorder and/or duplicate video planes.
  9767. It accepts the following parameters:
  9768. @table @option
  9769. @item map0
  9770. The index of the input plane to be used as the first output plane.
  9771. @item map1
  9772. The index of the input plane to be used as the second output plane.
  9773. @item map2
  9774. The index of the input plane to be used as the third output plane.
  9775. @item map3
  9776. The index of the input plane to be used as the fourth output plane.
  9777. @end table
  9778. The first plane has the index 0. The default is to keep the input unchanged.
  9779. @subsection Examples
  9780. @itemize
  9781. @item
  9782. Swap the second and third planes of the input:
  9783. @example
  9784. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9785. @end example
  9786. @end itemize
  9787. @anchor{signalstats}
  9788. @section signalstats
  9789. Evaluate various visual metrics that assist in determining issues associated
  9790. with the digitization of analog video media.
  9791. By default the filter will log these metadata values:
  9792. @table @option
  9793. @item YMIN
  9794. Display the minimal Y value contained within the input frame. Expressed in
  9795. range of [0-255].
  9796. @item YLOW
  9797. Display the Y value at the 10% percentile within the input frame. Expressed in
  9798. range of [0-255].
  9799. @item YAVG
  9800. Display the average Y value within the input frame. Expressed in range of
  9801. [0-255].
  9802. @item YHIGH
  9803. Display the Y value at the 90% percentile within the input frame. Expressed in
  9804. range of [0-255].
  9805. @item YMAX
  9806. Display the maximum Y value contained within the input frame. Expressed in
  9807. range of [0-255].
  9808. @item UMIN
  9809. Display the minimal U value contained within the input frame. Expressed in
  9810. range of [0-255].
  9811. @item ULOW
  9812. Display the U value at the 10% percentile within the input frame. Expressed in
  9813. range of [0-255].
  9814. @item UAVG
  9815. Display the average U value within the input frame. Expressed in range of
  9816. [0-255].
  9817. @item UHIGH
  9818. Display the U value at the 90% percentile within the input frame. Expressed in
  9819. range of [0-255].
  9820. @item UMAX
  9821. Display the maximum U value contained within the input frame. Expressed in
  9822. range of [0-255].
  9823. @item VMIN
  9824. Display the minimal V value contained within the input frame. Expressed in
  9825. range of [0-255].
  9826. @item VLOW
  9827. Display the V value at the 10% percentile within the input frame. Expressed in
  9828. range of [0-255].
  9829. @item VAVG
  9830. Display the average V value within the input frame. Expressed in range of
  9831. [0-255].
  9832. @item VHIGH
  9833. Display the V value at the 90% percentile within the input frame. Expressed in
  9834. range of [0-255].
  9835. @item VMAX
  9836. Display the maximum V value contained within the input frame. Expressed in
  9837. range of [0-255].
  9838. @item SATMIN
  9839. Display the minimal saturation value contained within the input frame.
  9840. Expressed in range of [0-~181.02].
  9841. @item SATLOW
  9842. Display the saturation value at the 10% percentile within the input frame.
  9843. Expressed in range of [0-~181.02].
  9844. @item SATAVG
  9845. Display the average saturation value within the input frame. Expressed in range
  9846. of [0-~181.02].
  9847. @item SATHIGH
  9848. Display the saturation value at the 90% percentile within the input frame.
  9849. Expressed in range of [0-~181.02].
  9850. @item SATMAX
  9851. Display the maximum saturation value contained within the input frame.
  9852. Expressed in range of [0-~181.02].
  9853. @item HUEMED
  9854. Display the median value for hue within the input frame. Expressed in range of
  9855. [0-360].
  9856. @item HUEAVG
  9857. Display the average value for hue within the input frame. Expressed in range of
  9858. [0-360].
  9859. @item YDIF
  9860. Display the average of sample value difference between all values of the Y
  9861. plane in the current frame and corresponding values of the previous input frame.
  9862. Expressed in range of [0-255].
  9863. @item UDIF
  9864. Display the average of sample value difference between all values of the U
  9865. plane in the current frame and corresponding values of the previous input frame.
  9866. Expressed in range of [0-255].
  9867. @item VDIF
  9868. Display the average of sample value difference between all values of the V
  9869. plane in the current frame and corresponding values of the previous input frame.
  9870. Expressed in range of [0-255].
  9871. @item YBITDEPTH
  9872. Display bit depth of Y plane in current frame.
  9873. Expressed in range of [0-16].
  9874. @item UBITDEPTH
  9875. Display bit depth of U plane in current frame.
  9876. Expressed in range of [0-16].
  9877. @item VBITDEPTH
  9878. Display bit depth of V plane in current frame.
  9879. Expressed in range of [0-16].
  9880. @end table
  9881. The filter accepts the following options:
  9882. @table @option
  9883. @item stat
  9884. @item out
  9885. @option{stat} specify an additional form of image analysis.
  9886. @option{out} output video with the specified type of pixel highlighted.
  9887. Both options accept the following values:
  9888. @table @samp
  9889. @item tout
  9890. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9891. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9892. include the results of video dropouts, head clogs, or tape tracking issues.
  9893. @item vrep
  9894. Identify @var{vertical line repetition}. Vertical line repetition includes
  9895. similar rows of pixels within a frame. In born-digital video vertical line
  9896. repetition is common, but this pattern is uncommon in video digitized from an
  9897. analog source. When it occurs in video that results from the digitization of an
  9898. analog source it can indicate concealment from a dropout compensator.
  9899. @item brng
  9900. Identify pixels that fall outside of legal broadcast range.
  9901. @end table
  9902. @item color, c
  9903. Set the highlight color for the @option{out} option. The default color is
  9904. yellow.
  9905. @end table
  9906. @subsection Examples
  9907. @itemize
  9908. @item
  9909. Output data of various video metrics:
  9910. @example
  9911. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9912. @end example
  9913. @item
  9914. Output specific data about the minimum and maximum values of the Y plane per frame:
  9915. @example
  9916. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9917. @end example
  9918. @item
  9919. Playback video while highlighting pixels that are outside of broadcast range in red.
  9920. @example
  9921. ffplay example.mov -vf signalstats="out=brng:color=red"
  9922. @end example
  9923. @item
  9924. Playback video with signalstats metadata drawn over the frame.
  9925. @example
  9926. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9927. @end example
  9928. The contents of signalstat_drawtext.txt used in the command are:
  9929. @example
  9930. time %@{pts:hms@}
  9931. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9932. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9933. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9934. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9935. @end example
  9936. @end itemize
  9937. @anchor{signature}
  9938. @section signature
  9939. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  9940. input. In this case the matching between the inputs can be calculated additionally.
  9941. The filter always passes through the first input. The signature of each stream can
  9942. be written into a file.
  9943. It accepts the following options:
  9944. @table @option
  9945. @item detectmode
  9946. Enable or disable the matching process.
  9947. Available values are:
  9948. @table @samp
  9949. @item off
  9950. Disable the calculation of a matching (default).
  9951. @item full
  9952. Calculate the matching for the whole video and output whether the whole video
  9953. matches or only parts.
  9954. @item fast
  9955. Calculate only until a matching is found or the video ends. Should be faster in
  9956. some cases.
  9957. @end table
  9958. @item nb_inputs
  9959. Set the number of inputs. The option value must be a non negative integer.
  9960. Default value is 1.
  9961. @item filename
  9962. Set the path to which the output is written. If there is more than one input,
  9963. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  9964. integer), that will be replaced with the input number. If no filename is
  9965. specified, no output will be written. This is the default.
  9966. @item format
  9967. Choose the output format.
  9968. Available values are:
  9969. @table @samp
  9970. @item binary
  9971. Use the specified binary representation (default).
  9972. @item xml
  9973. Use the specified xml representation.
  9974. @end table
  9975. @item th_d
  9976. Set threshold to detect one word as similar. The option value must be an integer
  9977. greater than zero. The default value is 9000.
  9978. @item th_dc
  9979. Set threshold to detect all words as similar. The option value must be an integer
  9980. greater than zero. The default value is 60000.
  9981. @item th_xh
  9982. Set threshold to detect frames as similar. The option value must be an integer
  9983. greater than zero. The default value is 116.
  9984. @item th_di
  9985. Set the minimum length of a sequence in frames to recognize it as matching
  9986. sequence. The option value must be a non negative integer value.
  9987. The default value is 0.
  9988. @item th_it
  9989. Set the minimum relation, that matching frames to all frames must have.
  9990. The option value must be a double value between 0 and 1. The default value is 0.5.
  9991. @end table
  9992. @subsection Examples
  9993. @itemize
  9994. @item
  9995. To calculate the signature of an input video and store it in signature.bin:
  9996. @example
  9997. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  9998. @end example
  9999. @item
  10000. To detect whether two videos match and store the signatures in XML format in
  10001. signature0.xml and signature1.xml:
  10002. @example
  10003. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  10004. @end example
  10005. @end itemize
  10006. @anchor{smartblur}
  10007. @section smartblur
  10008. Blur the input video without impacting the outlines.
  10009. It accepts the following options:
  10010. @table @option
  10011. @item luma_radius, lr
  10012. Set the luma radius. The option value must be a float number in
  10013. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10014. used to blur the image (slower if larger). Default value is 1.0.
  10015. @item luma_strength, ls
  10016. Set the luma strength. The option value must be a float number
  10017. in the range [-1.0,1.0] that configures the blurring. A value included
  10018. in [0.0,1.0] will blur the image whereas a value included in
  10019. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10020. @item luma_threshold, lt
  10021. Set the luma threshold used as a coefficient to determine
  10022. whether a pixel should be blurred or not. The option value must be an
  10023. integer in the range [-30,30]. A value of 0 will filter all the image,
  10024. a value included in [0,30] will filter flat areas and a value included
  10025. in [-30,0] will filter edges. Default value is 0.
  10026. @item chroma_radius, cr
  10027. Set the chroma radius. The option value must be a float number in
  10028. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10029. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10030. @item chroma_strength, cs
  10031. Set the chroma strength. The option value must be a float number
  10032. in the range [-1.0,1.0] that configures the blurring. A value included
  10033. in [0.0,1.0] will blur the image whereas a value included in
  10034. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10035. @item chroma_threshold, ct
  10036. Set the chroma threshold used as a coefficient to determine
  10037. whether a pixel should be blurred or not. The option value must be an
  10038. integer in the range [-30,30]. A value of 0 will filter all the image,
  10039. a value included in [0,30] will filter flat areas and a value included
  10040. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10041. @end table
  10042. If a chroma option is not explicitly set, the corresponding luma value
  10043. is set.
  10044. @section ssim
  10045. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10046. This filter takes in input two input videos, the first input is
  10047. considered the "main" source and is passed unchanged to the
  10048. output. The second input is used as a "reference" video for computing
  10049. the SSIM.
  10050. Both video inputs must have the same resolution and pixel format for
  10051. this filter to work correctly. Also it assumes that both inputs
  10052. have the same number of frames, which are compared one by one.
  10053. The filter stores the calculated SSIM of each frame.
  10054. The description of the accepted parameters follows.
  10055. @table @option
  10056. @item stats_file, f
  10057. If specified the filter will use the named file to save the SSIM of
  10058. each individual frame. When filename equals "-" the data is sent to
  10059. standard output.
  10060. @end table
  10061. The file printed if @var{stats_file} is selected, contains a sequence of
  10062. key/value pairs of the form @var{key}:@var{value} for each compared
  10063. couple of frames.
  10064. A description of each shown parameter follows:
  10065. @table @option
  10066. @item n
  10067. sequential number of the input frame, starting from 1
  10068. @item Y, U, V, R, G, B
  10069. SSIM of the compared frames for the component specified by the suffix.
  10070. @item All
  10071. SSIM of the compared frames for the whole frame.
  10072. @item dB
  10073. Same as above but in dB representation.
  10074. @end table
  10075. For example:
  10076. @example
  10077. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10078. [main][ref] ssim="stats_file=stats.log" [out]
  10079. @end example
  10080. On this example the input file being processed is compared with the
  10081. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10082. is stored in @file{stats.log}.
  10083. Another example with both psnr and ssim at same time:
  10084. @example
  10085. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10086. @end example
  10087. @section stereo3d
  10088. Convert between different stereoscopic image formats.
  10089. The filters accept the following options:
  10090. @table @option
  10091. @item in
  10092. Set stereoscopic image format of input.
  10093. Available values for input image formats are:
  10094. @table @samp
  10095. @item sbsl
  10096. side by side parallel (left eye left, right eye right)
  10097. @item sbsr
  10098. side by side crosseye (right eye left, left eye right)
  10099. @item sbs2l
  10100. side by side parallel with half width resolution
  10101. (left eye left, right eye right)
  10102. @item sbs2r
  10103. side by side crosseye with half width resolution
  10104. (right eye left, left eye right)
  10105. @item abl
  10106. above-below (left eye above, right eye below)
  10107. @item abr
  10108. above-below (right eye above, left eye below)
  10109. @item ab2l
  10110. above-below with half height resolution
  10111. (left eye above, right eye below)
  10112. @item ab2r
  10113. above-below with half height resolution
  10114. (right eye above, left eye below)
  10115. @item al
  10116. alternating frames (left eye first, right eye second)
  10117. @item ar
  10118. alternating frames (right eye first, left eye second)
  10119. @item irl
  10120. interleaved rows (left eye has top row, right eye starts on next row)
  10121. @item irr
  10122. interleaved rows (right eye has top row, left eye starts on next row)
  10123. @item icl
  10124. interleaved columns, left eye first
  10125. @item icr
  10126. interleaved columns, right eye first
  10127. Default value is @samp{sbsl}.
  10128. @end table
  10129. @item out
  10130. Set stereoscopic image format of output.
  10131. @table @samp
  10132. @item sbsl
  10133. side by side parallel (left eye left, right eye right)
  10134. @item sbsr
  10135. side by side crosseye (right eye left, left eye right)
  10136. @item sbs2l
  10137. side by side parallel with half width resolution
  10138. (left eye left, right eye right)
  10139. @item sbs2r
  10140. side by side crosseye with half width resolution
  10141. (right eye left, left eye right)
  10142. @item abl
  10143. above-below (left eye above, right eye below)
  10144. @item abr
  10145. above-below (right eye above, left eye below)
  10146. @item ab2l
  10147. above-below with half height resolution
  10148. (left eye above, right eye below)
  10149. @item ab2r
  10150. above-below with half height resolution
  10151. (right eye above, left eye below)
  10152. @item al
  10153. alternating frames (left eye first, right eye second)
  10154. @item ar
  10155. alternating frames (right eye first, left eye second)
  10156. @item irl
  10157. interleaved rows (left eye has top row, right eye starts on next row)
  10158. @item irr
  10159. interleaved rows (right eye has top row, left eye starts on next row)
  10160. @item arbg
  10161. anaglyph red/blue gray
  10162. (red filter on left eye, blue filter on right eye)
  10163. @item argg
  10164. anaglyph red/green gray
  10165. (red filter on left eye, green filter on right eye)
  10166. @item arcg
  10167. anaglyph red/cyan gray
  10168. (red filter on left eye, cyan filter on right eye)
  10169. @item arch
  10170. anaglyph red/cyan half colored
  10171. (red filter on left eye, cyan filter on right eye)
  10172. @item arcc
  10173. anaglyph red/cyan color
  10174. (red filter on left eye, cyan filter on right eye)
  10175. @item arcd
  10176. anaglyph red/cyan color optimized with the least squares projection of dubois
  10177. (red filter on left eye, cyan filter on right eye)
  10178. @item agmg
  10179. anaglyph green/magenta gray
  10180. (green filter on left eye, magenta filter on right eye)
  10181. @item agmh
  10182. anaglyph green/magenta half colored
  10183. (green filter on left eye, magenta filter on right eye)
  10184. @item agmc
  10185. anaglyph green/magenta colored
  10186. (green filter on left eye, magenta filter on right eye)
  10187. @item agmd
  10188. anaglyph green/magenta color optimized with the least squares projection of dubois
  10189. (green filter on left eye, magenta filter on right eye)
  10190. @item aybg
  10191. anaglyph yellow/blue gray
  10192. (yellow filter on left eye, blue filter on right eye)
  10193. @item aybh
  10194. anaglyph yellow/blue half colored
  10195. (yellow filter on left eye, blue filter on right eye)
  10196. @item aybc
  10197. anaglyph yellow/blue colored
  10198. (yellow filter on left eye, blue filter on right eye)
  10199. @item aybd
  10200. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10201. (yellow filter on left eye, blue filter on right eye)
  10202. @item ml
  10203. mono output (left eye only)
  10204. @item mr
  10205. mono output (right eye only)
  10206. @item chl
  10207. checkerboard, left eye first
  10208. @item chr
  10209. checkerboard, right eye first
  10210. @item icl
  10211. interleaved columns, left eye first
  10212. @item icr
  10213. interleaved columns, right eye first
  10214. @item hdmi
  10215. HDMI frame pack
  10216. @end table
  10217. Default value is @samp{arcd}.
  10218. @end table
  10219. @subsection Examples
  10220. @itemize
  10221. @item
  10222. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10223. @example
  10224. stereo3d=sbsl:aybd
  10225. @end example
  10226. @item
  10227. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10228. @example
  10229. stereo3d=abl:sbsr
  10230. @end example
  10231. @end itemize
  10232. @section streamselect, astreamselect
  10233. Select video or audio streams.
  10234. The filter accepts the following options:
  10235. @table @option
  10236. @item inputs
  10237. Set number of inputs. Default is 2.
  10238. @item map
  10239. Set input indexes to remap to outputs.
  10240. @end table
  10241. @subsection Commands
  10242. The @code{streamselect} and @code{astreamselect} filter supports the following
  10243. commands:
  10244. @table @option
  10245. @item map
  10246. Set input indexes to remap to outputs.
  10247. @end table
  10248. @subsection Examples
  10249. @itemize
  10250. @item
  10251. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10252. @example
  10253. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10254. @end example
  10255. @item
  10256. Same as above, but for audio:
  10257. @example
  10258. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10259. @end example
  10260. @end itemize
  10261. @section sobel
  10262. Apply sobel operator to input video stream.
  10263. The filter accepts the following option:
  10264. @table @option
  10265. @item planes
  10266. Set which planes will be processed, unprocessed planes will be copied.
  10267. By default value 0xf, all planes will be processed.
  10268. @item scale
  10269. Set value which will be multiplied with filtered result.
  10270. @item delta
  10271. Set value which will be added to filtered result.
  10272. @end table
  10273. @anchor{spp}
  10274. @section spp
  10275. Apply a simple postprocessing filter that compresses and decompresses the image
  10276. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10277. and average the results.
  10278. The filter accepts the following options:
  10279. @table @option
  10280. @item quality
  10281. Set quality. This option defines the number of levels for averaging. It accepts
  10282. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10283. effect. A value of @code{6} means the higher quality. For each increment of
  10284. that value the speed drops by a factor of approximately 2. Default value is
  10285. @code{3}.
  10286. @item qp
  10287. Force a constant quantization parameter. If not set, the filter will use the QP
  10288. from the video stream (if available).
  10289. @item mode
  10290. Set thresholding mode. Available modes are:
  10291. @table @samp
  10292. @item hard
  10293. Set hard thresholding (default).
  10294. @item soft
  10295. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10296. @end table
  10297. @item use_bframe_qp
  10298. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10299. option may cause flicker since the B-Frames have often larger QP. Default is
  10300. @code{0} (not enabled).
  10301. @end table
  10302. @anchor{subtitles}
  10303. @section subtitles
  10304. Draw subtitles on top of input video using the libass library.
  10305. To enable compilation of this filter you need to configure FFmpeg with
  10306. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10307. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10308. Alpha) subtitles format.
  10309. The filter accepts the following options:
  10310. @table @option
  10311. @item filename, f
  10312. Set the filename of the subtitle file to read. It must be specified.
  10313. @item original_size
  10314. Specify the size of the original video, the video for which the ASS file
  10315. was composed. For the syntax of this option, check the
  10316. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10317. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10318. correctly scale the fonts if the aspect ratio has been changed.
  10319. @item fontsdir
  10320. Set a directory path containing fonts that can be used by the filter.
  10321. These fonts will be used in addition to whatever the font provider uses.
  10322. @item charenc
  10323. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10324. useful if not UTF-8.
  10325. @item stream_index, si
  10326. Set subtitles stream index. @code{subtitles} filter only.
  10327. @item force_style
  10328. Override default style or script info parameters of the subtitles. It accepts a
  10329. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10330. @end table
  10331. If the first key is not specified, it is assumed that the first value
  10332. specifies the @option{filename}.
  10333. For example, to render the file @file{sub.srt} on top of the input
  10334. video, use the command:
  10335. @example
  10336. subtitles=sub.srt
  10337. @end example
  10338. which is equivalent to:
  10339. @example
  10340. subtitles=filename=sub.srt
  10341. @end example
  10342. To render the default subtitles stream from file @file{video.mkv}, use:
  10343. @example
  10344. subtitles=video.mkv
  10345. @end example
  10346. To render the second subtitles stream from that file, use:
  10347. @example
  10348. subtitles=video.mkv:si=1
  10349. @end example
  10350. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10351. @code{DejaVu Serif}, use:
  10352. @example
  10353. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10354. @end example
  10355. @section super2xsai
  10356. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10357. Interpolate) pixel art scaling algorithm.
  10358. Useful for enlarging pixel art images without reducing sharpness.
  10359. @section swaprect
  10360. Swap two rectangular objects in video.
  10361. This filter accepts the following options:
  10362. @table @option
  10363. @item w
  10364. Set object width.
  10365. @item h
  10366. Set object height.
  10367. @item x1
  10368. Set 1st rect x coordinate.
  10369. @item y1
  10370. Set 1st rect y coordinate.
  10371. @item x2
  10372. Set 2nd rect x coordinate.
  10373. @item y2
  10374. Set 2nd rect y coordinate.
  10375. All expressions are evaluated once for each frame.
  10376. @end table
  10377. The all options are expressions containing the following constants:
  10378. @table @option
  10379. @item w
  10380. @item h
  10381. The input width and height.
  10382. @item a
  10383. same as @var{w} / @var{h}
  10384. @item sar
  10385. input sample aspect ratio
  10386. @item dar
  10387. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10388. @item n
  10389. The number of the input frame, starting from 0.
  10390. @item t
  10391. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10392. @item pos
  10393. the position in the file of the input frame, NAN if unknown
  10394. @end table
  10395. @section swapuv
  10396. Swap U & V plane.
  10397. @section telecine
  10398. Apply telecine process to the video.
  10399. This filter accepts the following options:
  10400. @table @option
  10401. @item first_field
  10402. @table @samp
  10403. @item top, t
  10404. top field first
  10405. @item bottom, b
  10406. bottom field first
  10407. The default value is @code{top}.
  10408. @end table
  10409. @item pattern
  10410. A string of numbers representing the pulldown pattern you wish to apply.
  10411. The default value is @code{23}.
  10412. @end table
  10413. @example
  10414. Some typical patterns:
  10415. NTSC output (30i):
  10416. 27.5p: 32222
  10417. 24p: 23 (classic)
  10418. 24p: 2332 (preferred)
  10419. 20p: 33
  10420. 18p: 334
  10421. 16p: 3444
  10422. PAL output (25i):
  10423. 27.5p: 12222
  10424. 24p: 222222222223 ("Euro pulldown")
  10425. 16.67p: 33
  10426. 16p: 33333334
  10427. @end example
  10428. @section threshold
  10429. Apply threshold effect to video stream.
  10430. This filter needs four video streams to perform thresholding.
  10431. First stream is stream we are filtering.
  10432. Second stream is holding threshold values, third stream is holding min values,
  10433. and last, fourth stream is holding max values.
  10434. The filter accepts the following option:
  10435. @table @option
  10436. @item planes
  10437. Set which planes will be processed, unprocessed planes will be copied.
  10438. By default value 0xf, all planes will be processed.
  10439. @end table
  10440. For example if first stream pixel's component value is less then threshold value
  10441. of pixel component from 2nd threshold stream, third stream value will picked,
  10442. otherwise fourth stream pixel component value will be picked.
  10443. Using color source filter one can perform various types of thresholding:
  10444. @subsection Examples
  10445. @itemize
  10446. @item
  10447. Binary threshold, using gray color as threshold:
  10448. @example
  10449. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10450. @end example
  10451. @item
  10452. Inverted binary threshold, using gray color as threshold:
  10453. @example
  10454. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10455. @end example
  10456. @item
  10457. Truncate binary threshold, using gray color as threshold:
  10458. @example
  10459. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10460. @end example
  10461. @item
  10462. Threshold to zero, using gray color as threshold:
  10463. @example
  10464. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10465. @end example
  10466. @item
  10467. Inverted threshold to zero, using gray color as threshold:
  10468. @example
  10469. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10470. @end example
  10471. @end itemize
  10472. @section thumbnail
  10473. Select the most representative frame in a given sequence of consecutive frames.
  10474. The filter accepts the following options:
  10475. @table @option
  10476. @item n
  10477. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10478. will pick one of them, and then handle the next batch of @var{n} frames until
  10479. the end. Default is @code{100}.
  10480. @end table
  10481. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10482. value will result in a higher memory usage, so a high value is not recommended.
  10483. @subsection Examples
  10484. @itemize
  10485. @item
  10486. Extract one picture each 50 frames:
  10487. @example
  10488. thumbnail=50
  10489. @end example
  10490. @item
  10491. Complete example of a thumbnail creation with @command{ffmpeg}:
  10492. @example
  10493. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10494. @end example
  10495. @end itemize
  10496. @section tile
  10497. Tile several successive frames together.
  10498. The filter accepts the following options:
  10499. @table @option
  10500. @item layout
  10501. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10502. this option, check the
  10503. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10504. @item nb_frames
  10505. Set the maximum number of frames to render in the given area. It must be less
  10506. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10507. the area will be used.
  10508. @item margin
  10509. Set the outer border margin in pixels.
  10510. @item padding
  10511. Set the inner border thickness (i.e. the number of pixels between frames). For
  10512. more advanced padding options (such as having different values for the edges),
  10513. refer to the pad video filter.
  10514. @item color
  10515. Specify the color of the unused area. For the syntax of this option, check the
  10516. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10517. is "black".
  10518. @end table
  10519. @subsection Examples
  10520. @itemize
  10521. @item
  10522. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10523. @example
  10524. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10525. @end example
  10526. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10527. duplicating each output frame to accommodate the originally detected frame
  10528. rate.
  10529. @item
  10530. Display @code{5} pictures in an area of @code{3x2} frames,
  10531. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10532. mixed flat and named options:
  10533. @example
  10534. tile=3x2:nb_frames=5:padding=7:margin=2
  10535. @end example
  10536. @end itemize
  10537. @section tinterlace
  10538. Perform various types of temporal field interlacing.
  10539. Frames are counted starting from 1, so the first input frame is
  10540. considered odd.
  10541. The filter accepts the following options:
  10542. @table @option
  10543. @item mode
  10544. Specify the mode of the interlacing. This option can also be specified
  10545. as a value alone. See below for a list of values for this option.
  10546. Available values are:
  10547. @table @samp
  10548. @item merge, 0
  10549. Move odd frames into the upper field, even into the lower field,
  10550. generating a double height frame at half frame rate.
  10551. @example
  10552. ------> time
  10553. Input:
  10554. Frame 1 Frame 2 Frame 3 Frame 4
  10555. 11111 22222 33333 44444
  10556. 11111 22222 33333 44444
  10557. 11111 22222 33333 44444
  10558. 11111 22222 33333 44444
  10559. Output:
  10560. 11111 33333
  10561. 22222 44444
  10562. 11111 33333
  10563. 22222 44444
  10564. 11111 33333
  10565. 22222 44444
  10566. 11111 33333
  10567. 22222 44444
  10568. @end example
  10569. @item drop_even, 1
  10570. Only output odd frames, even frames are dropped, generating a frame with
  10571. unchanged height at half frame rate.
  10572. @example
  10573. ------> time
  10574. Input:
  10575. Frame 1 Frame 2 Frame 3 Frame 4
  10576. 11111 22222 33333 44444
  10577. 11111 22222 33333 44444
  10578. 11111 22222 33333 44444
  10579. 11111 22222 33333 44444
  10580. Output:
  10581. 11111 33333
  10582. 11111 33333
  10583. 11111 33333
  10584. 11111 33333
  10585. @end example
  10586. @item drop_odd, 2
  10587. Only output even frames, odd frames are dropped, generating a frame with
  10588. unchanged height at half frame rate.
  10589. @example
  10590. ------> time
  10591. Input:
  10592. Frame 1 Frame 2 Frame 3 Frame 4
  10593. 11111 22222 33333 44444
  10594. 11111 22222 33333 44444
  10595. 11111 22222 33333 44444
  10596. 11111 22222 33333 44444
  10597. Output:
  10598. 22222 44444
  10599. 22222 44444
  10600. 22222 44444
  10601. 22222 44444
  10602. @end example
  10603. @item pad, 3
  10604. Expand each frame to full height, but pad alternate lines with black,
  10605. generating a frame with double height at the same input frame rate.
  10606. @example
  10607. ------> time
  10608. Input:
  10609. Frame 1 Frame 2 Frame 3 Frame 4
  10610. 11111 22222 33333 44444
  10611. 11111 22222 33333 44444
  10612. 11111 22222 33333 44444
  10613. 11111 22222 33333 44444
  10614. Output:
  10615. 11111 ..... 33333 .....
  10616. ..... 22222 ..... 44444
  10617. 11111 ..... 33333 .....
  10618. ..... 22222 ..... 44444
  10619. 11111 ..... 33333 .....
  10620. ..... 22222 ..... 44444
  10621. 11111 ..... 33333 .....
  10622. ..... 22222 ..... 44444
  10623. @end example
  10624. @item interleave_top, 4
  10625. Interleave the upper field from odd frames with the lower field from
  10626. even frames, generating a frame with unchanged height at half frame rate.
  10627. @example
  10628. ------> time
  10629. Input:
  10630. Frame 1 Frame 2 Frame 3 Frame 4
  10631. 11111<- 22222 33333<- 44444
  10632. 11111 22222<- 33333 44444<-
  10633. 11111<- 22222 33333<- 44444
  10634. 11111 22222<- 33333 44444<-
  10635. Output:
  10636. 11111 33333
  10637. 22222 44444
  10638. 11111 33333
  10639. 22222 44444
  10640. @end example
  10641. @item interleave_bottom, 5
  10642. Interleave the lower field from odd frames with the upper field from
  10643. even frames, generating a frame with unchanged height at half frame rate.
  10644. @example
  10645. ------> time
  10646. Input:
  10647. Frame 1 Frame 2 Frame 3 Frame 4
  10648. 11111 22222<- 33333 44444<-
  10649. 11111<- 22222 33333<- 44444
  10650. 11111 22222<- 33333 44444<-
  10651. 11111<- 22222 33333<- 44444
  10652. Output:
  10653. 22222 44444
  10654. 11111 33333
  10655. 22222 44444
  10656. 11111 33333
  10657. @end example
  10658. @item interlacex2, 6
  10659. Double frame rate with unchanged height. Frames are inserted each
  10660. containing the second temporal field from the previous input frame and
  10661. the first temporal field from the next input frame. This mode relies on
  10662. the top_field_first flag. Useful for interlaced video displays with no
  10663. field synchronisation.
  10664. @example
  10665. ------> time
  10666. Input:
  10667. Frame 1 Frame 2 Frame 3 Frame 4
  10668. 11111 22222 33333 44444
  10669. 11111 22222 33333 44444
  10670. 11111 22222 33333 44444
  10671. 11111 22222 33333 44444
  10672. Output:
  10673. 11111 22222 22222 33333 33333 44444 44444
  10674. 11111 11111 22222 22222 33333 33333 44444
  10675. 11111 22222 22222 33333 33333 44444 44444
  10676. 11111 11111 22222 22222 33333 33333 44444
  10677. @end example
  10678. @item mergex2, 7
  10679. Move odd frames into the upper field, even into the lower field,
  10680. generating a double height frame at same frame rate.
  10681. @example
  10682. ------> time
  10683. Input:
  10684. Frame 1 Frame 2 Frame 3 Frame 4
  10685. 11111 22222 33333 44444
  10686. 11111 22222 33333 44444
  10687. 11111 22222 33333 44444
  10688. 11111 22222 33333 44444
  10689. Output:
  10690. 11111 33333 33333 55555
  10691. 22222 22222 44444 44444
  10692. 11111 33333 33333 55555
  10693. 22222 22222 44444 44444
  10694. 11111 33333 33333 55555
  10695. 22222 22222 44444 44444
  10696. 11111 33333 33333 55555
  10697. 22222 22222 44444 44444
  10698. @end example
  10699. @end table
  10700. Numeric values are deprecated but are accepted for backward
  10701. compatibility reasons.
  10702. Default mode is @code{merge}.
  10703. @item flags
  10704. Specify flags influencing the filter process.
  10705. Available value for @var{flags} is:
  10706. @table @option
  10707. @item low_pass_filter, vlfp
  10708. Enable linear vertical low-pass filtering in the filter.
  10709. Vertical low-pass filtering is required when creating an interlaced
  10710. destination from a progressive source which contains high-frequency
  10711. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10712. patterning.
  10713. @item complex_filter, cvlfp
  10714. Enable complex vertical low-pass filtering.
  10715. This will slightly less reduce interlace 'twitter' and Moire
  10716. patterning but better retain detail and subjective sharpness impression.
  10717. @end table
  10718. Vertical low-pass filtering can only be enabled for @option{mode}
  10719. @var{interleave_top} and @var{interleave_bottom}.
  10720. @end table
  10721. @section transpose
  10722. Transpose rows with columns in the input video and optionally flip it.
  10723. It accepts the following parameters:
  10724. @table @option
  10725. @item dir
  10726. Specify the transposition direction.
  10727. Can assume the following values:
  10728. @table @samp
  10729. @item 0, 4, cclock_flip
  10730. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10731. @example
  10732. L.R L.l
  10733. . . -> . .
  10734. l.r R.r
  10735. @end example
  10736. @item 1, 5, clock
  10737. Rotate by 90 degrees clockwise, that is:
  10738. @example
  10739. L.R l.L
  10740. . . -> . .
  10741. l.r r.R
  10742. @end example
  10743. @item 2, 6, cclock
  10744. Rotate by 90 degrees counterclockwise, that is:
  10745. @example
  10746. L.R R.r
  10747. . . -> . .
  10748. l.r L.l
  10749. @end example
  10750. @item 3, 7, clock_flip
  10751. Rotate by 90 degrees clockwise and vertically flip, that is:
  10752. @example
  10753. L.R r.R
  10754. . . -> . .
  10755. l.r l.L
  10756. @end example
  10757. @end table
  10758. For values between 4-7, the transposition is only done if the input
  10759. video geometry is portrait and not landscape. These values are
  10760. deprecated, the @code{passthrough} option should be used instead.
  10761. Numerical values are deprecated, and should be dropped in favor of
  10762. symbolic constants.
  10763. @item passthrough
  10764. Do not apply the transposition if the input geometry matches the one
  10765. specified by the specified value. It accepts the following values:
  10766. @table @samp
  10767. @item none
  10768. Always apply transposition.
  10769. @item portrait
  10770. Preserve portrait geometry (when @var{height} >= @var{width}).
  10771. @item landscape
  10772. Preserve landscape geometry (when @var{width} >= @var{height}).
  10773. @end table
  10774. Default value is @code{none}.
  10775. @end table
  10776. For example to rotate by 90 degrees clockwise and preserve portrait
  10777. layout:
  10778. @example
  10779. transpose=dir=1:passthrough=portrait
  10780. @end example
  10781. The command above can also be specified as:
  10782. @example
  10783. transpose=1:portrait
  10784. @end example
  10785. @section trim
  10786. Trim the input so that the output contains one continuous subpart of the input.
  10787. It accepts the following parameters:
  10788. @table @option
  10789. @item start
  10790. Specify the time of the start of the kept section, i.e. the frame with the
  10791. timestamp @var{start} will be the first frame in the output.
  10792. @item end
  10793. Specify the time of the first frame that will be dropped, i.e. the frame
  10794. immediately preceding the one with the timestamp @var{end} will be the last
  10795. frame in the output.
  10796. @item start_pts
  10797. This is the same as @var{start}, except this option sets the start timestamp
  10798. in timebase units instead of seconds.
  10799. @item end_pts
  10800. This is the same as @var{end}, except this option sets the end timestamp
  10801. in timebase units instead of seconds.
  10802. @item duration
  10803. The maximum duration of the output in seconds.
  10804. @item start_frame
  10805. The number of the first frame that should be passed to the output.
  10806. @item end_frame
  10807. The number of the first frame that should be dropped.
  10808. @end table
  10809. @option{start}, @option{end}, and @option{duration} are expressed as time
  10810. duration specifications; see
  10811. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10812. for the accepted syntax.
  10813. Note that the first two sets of the start/end options and the @option{duration}
  10814. option look at the frame timestamp, while the _frame variants simply count the
  10815. frames that pass through the filter. Also note that this filter does not modify
  10816. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10817. setpts filter after the trim filter.
  10818. If multiple start or end options are set, this filter tries to be greedy and
  10819. keep all the frames that match at least one of the specified constraints. To keep
  10820. only the part that matches all the constraints at once, chain multiple trim
  10821. filters.
  10822. The defaults are such that all the input is kept. So it is possible to set e.g.
  10823. just the end values to keep everything before the specified time.
  10824. Examples:
  10825. @itemize
  10826. @item
  10827. Drop everything except the second minute of input:
  10828. @example
  10829. ffmpeg -i INPUT -vf trim=60:120
  10830. @end example
  10831. @item
  10832. Keep only the first second:
  10833. @example
  10834. ffmpeg -i INPUT -vf trim=duration=1
  10835. @end example
  10836. @end itemize
  10837. @anchor{unsharp}
  10838. @section unsharp
  10839. Sharpen or blur the input video.
  10840. It accepts the following parameters:
  10841. @table @option
  10842. @item luma_msize_x, lx
  10843. Set the luma matrix horizontal size. It must be an odd integer between
  10844. 3 and 23. The default value is 5.
  10845. @item luma_msize_y, ly
  10846. Set the luma matrix vertical size. It must be an odd integer between 3
  10847. and 23. The default value is 5.
  10848. @item luma_amount, la
  10849. Set the luma effect strength. It must be a floating point number, reasonable
  10850. values lay between -1.5 and 1.5.
  10851. Negative values will blur the input video, while positive values will
  10852. sharpen it, a value of zero will disable the effect.
  10853. Default value is 1.0.
  10854. @item chroma_msize_x, cx
  10855. Set the chroma matrix horizontal size. It must be an odd integer
  10856. between 3 and 23. The default value is 5.
  10857. @item chroma_msize_y, cy
  10858. Set the chroma matrix vertical size. It must be an odd integer
  10859. between 3 and 23. The default value is 5.
  10860. @item chroma_amount, ca
  10861. Set the chroma effect strength. It must be a floating point number, reasonable
  10862. values lay between -1.5 and 1.5.
  10863. Negative values will blur the input video, while positive values will
  10864. sharpen it, a value of zero will disable the effect.
  10865. Default value is 0.0.
  10866. @item opencl
  10867. If set to 1, specify using OpenCL capabilities, only available if
  10868. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10869. @end table
  10870. All parameters are optional and default to the equivalent of the
  10871. string '5:5:1.0:5:5:0.0'.
  10872. @subsection Examples
  10873. @itemize
  10874. @item
  10875. Apply strong luma sharpen effect:
  10876. @example
  10877. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10878. @end example
  10879. @item
  10880. Apply a strong blur of both luma and chroma parameters:
  10881. @example
  10882. unsharp=7:7:-2:7:7:-2
  10883. @end example
  10884. @end itemize
  10885. @section uspp
  10886. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10887. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10888. shifts and average the results.
  10889. The way this differs from the behavior of spp is that uspp actually encodes &
  10890. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10891. DCT similar to MJPEG.
  10892. The filter accepts the following options:
  10893. @table @option
  10894. @item quality
  10895. Set quality. This option defines the number of levels for averaging. It accepts
  10896. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10897. effect. A value of @code{8} means the higher quality. For each increment of
  10898. that value the speed drops by a factor of approximately 2. Default value is
  10899. @code{3}.
  10900. @item qp
  10901. Force a constant quantization parameter. If not set, the filter will use the QP
  10902. from the video stream (if available).
  10903. @end table
  10904. @section vaguedenoiser
  10905. Apply a wavelet based denoiser.
  10906. It transforms each frame from the video input into the wavelet domain,
  10907. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10908. the obtained coefficients. It does an inverse wavelet transform after.
  10909. Due to wavelet properties, it should give a nice smoothed result, and
  10910. reduced noise, without blurring picture features.
  10911. This filter accepts the following options:
  10912. @table @option
  10913. @item threshold
  10914. The filtering strength. The higher, the more filtered the video will be.
  10915. Hard thresholding can use a higher threshold than soft thresholding
  10916. before the video looks overfiltered.
  10917. @item method
  10918. The filtering method the filter will use.
  10919. It accepts the following values:
  10920. @table @samp
  10921. @item hard
  10922. All values under the threshold will be zeroed.
  10923. @item soft
  10924. All values under the threshold will be zeroed. All values above will be
  10925. reduced by the threshold.
  10926. @item garrote
  10927. Scales or nullifies coefficients - intermediary between (more) soft and
  10928. (less) hard thresholding.
  10929. @end table
  10930. @item nsteps
  10931. Number of times, the wavelet will decompose the picture. Picture can't
  10932. be decomposed beyond a particular point (typically, 8 for a 640x480
  10933. frame - as 2^9 = 512 > 480)
  10934. @item percent
  10935. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10936. @item planes
  10937. A list of the planes to process. By default all planes are processed.
  10938. @end table
  10939. @section vectorscope
  10940. Display 2 color component values in the two dimensional graph (which is called
  10941. a vectorscope).
  10942. This filter accepts the following options:
  10943. @table @option
  10944. @item mode, m
  10945. Set vectorscope mode.
  10946. It accepts the following values:
  10947. @table @samp
  10948. @item gray
  10949. Gray values are displayed on graph, higher brightness means more pixels have
  10950. same component color value on location in graph. This is the default mode.
  10951. @item color
  10952. Gray values are displayed on graph. Surrounding pixels values which are not
  10953. present in video frame are drawn in gradient of 2 color components which are
  10954. set by option @code{x} and @code{y}. The 3rd color component is static.
  10955. @item color2
  10956. Actual color components values present in video frame are displayed on graph.
  10957. @item color3
  10958. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10959. on graph increases value of another color component, which is luminance by
  10960. default values of @code{x} and @code{y}.
  10961. @item color4
  10962. Actual colors present in video frame are displayed on graph. If two different
  10963. colors map to same position on graph then color with higher value of component
  10964. not present in graph is picked.
  10965. @item color5
  10966. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10967. component picked from radial gradient.
  10968. @end table
  10969. @item x
  10970. Set which color component will be represented on X-axis. Default is @code{1}.
  10971. @item y
  10972. Set which color component will be represented on Y-axis. Default is @code{2}.
  10973. @item intensity, i
  10974. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10975. of color component which represents frequency of (X, Y) location in graph.
  10976. @item envelope, e
  10977. @table @samp
  10978. @item none
  10979. No envelope, this is default.
  10980. @item instant
  10981. Instant envelope, even darkest single pixel will be clearly highlighted.
  10982. @item peak
  10983. Hold maximum and minimum values presented in graph over time. This way you
  10984. can still spot out of range values without constantly looking at vectorscope.
  10985. @item peak+instant
  10986. Peak and instant envelope combined together.
  10987. @end table
  10988. @item graticule, g
  10989. Set what kind of graticule to draw.
  10990. @table @samp
  10991. @item none
  10992. @item green
  10993. @item color
  10994. @end table
  10995. @item opacity, o
  10996. Set graticule opacity.
  10997. @item flags, f
  10998. Set graticule flags.
  10999. @table @samp
  11000. @item white
  11001. Draw graticule for white point.
  11002. @item black
  11003. Draw graticule for black point.
  11004. @item name
  11005. Draw color points short names.
  11006. @end table
  11007. @item bgopacity, b
  11008. Set background opacity.
  11009. @item lthreshold, l
  11010. Set low threshold for color component not represented on X or Y axis.
  11011. Values lower than this value will be ignored. Default is 0.
  11012. Note this value is multiplied with actual max possible value one pixel component
  11013. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11014. is 0.1 * 255 = 25.
  11015. @item hthreshold, h
  11016. Set high threshold for color component not represented on X or Y axis.
  11017. Values higher than this value will be ignored. Default is 1.
  11018. Note this value is multiplied with actual max possible value one pixel component
  11019. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11020. is 0.9 * 255 = 230.
  11021. @item colorspace, c
  11022. Set what kind of colorspace to use when drawing graticule.
  11023. @table @samp
  11024. @item auto
  11025. @item 601
  11026. @item 709
  11027. @end table
  11028. Default is auto.
  11029. @end table
  11030. @anchor{vidstabdetect}
  11031. @section vidstabdetect
  11032. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11033. @ref{vidstabtransform} for pass 2.
  11034. This filter generates a file with relative translation and rotation
  11035. transform information about subsequent frames, which is then used by
  11036. the @ref{vidstabtransform} filter.
  11037. To enable compilation of this filter you need to configure FFmpeg with
  11038. @code{--enable-libvidstab}.
  11039. This filter accepts the following options:
  11040. @table @option
  11041. @item result
  11042. Set the path to the file used to write the transforms information.
  11043. Default value is @file{transforms.trf}.
  11044. @item shakiness
  11045. Set how shaky the video is and how quick the camera is. It accepts an
  11046. integer in the range 1-10, a value of 1 means little shakiness, a
  11047. value of 10 means strong shakiness. Default value is 5.
  11048. @item accuracy
  11049. Set the accuracy of the detection process. It must be a value in the
  11050. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11051. accuracy. Default value is 15.
  11052. @item stepsize
  11053. Set stepsize of the search process. The region around minimum is
  11054. scanned with 1 pixel resolution. Default value is 6.
  11055. @item mincontrast
  11056. Set minimum contrast. Below this value a local measurement field is
  11057. discarded. Must be a floating point value in the range 0-1. Default
  11058. value is 0.3.
  11059. @item tripod
  11060. Set reference frame number for tripod mode.
  11061. If enabled, the motion of the frames is compared to a reference frame
  11062. in the filtered stream, identified by the specified number. The idea
  11063. is to compensate all movements in a more-or-less static scene and keep
  11064. the camera view absolutely still.
  11065. If set to 0, it is disabled. The frames are counted starting from 1.
  11066. @item show
  11067. Show fields and transforms in the resulting frames. It accepts an
  11068. integer in the range 0-2. Default value is 0, which disables any
  11069. visualization.
  11070. @end table
  11071. @subsection Examples
  11072. @itemize
  11073. @item
  11074. Use default values:
  11075. @example
  11076. vidstabdetect
  11077. @end example
  11078. @item
  11079. Analyze strongly shaky movie and put the results in file
  11080. @file{mytransforms.trf}:
  11081. @example
  11082. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11083. @end example
  11084. @item
  11085. Visualize the result of internal transformations in the resulting
  11086. video:
  11087. @example
  11088. vidstabdetect=show=1
  11089. @end example
  11090. @item
  11091. Analyze a video with medium shakiness using @command{ffmpeg}:
  11092. @example
  11093. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11094. @end example
  11095. @end itemize
  11096. @anchor{vidstabtransform}
  11097. @section vidstabtransform
  11098. Video stabilization/deshaking: pass 2 of 2,
  11099. see @ref{vidstabdetect} for pass 1.
  11100. Read a file with transform information for each frame and
  11101. apply/compensate them. Together with the @ref{vidstabdetect}
  11102. filter this can be used to deshake videos. See also
  11103. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11104. the @ref{unsharp} filter, see below.
  11105. To enable compilation of this filter you need to configure FFmpeg with
  11106. @code{--enable-libvidstab}.
  11107. @subsection Options
  11108. @table @option
  11109. @item input
  11110. Set path to the file used to read the transforms. Default value is
  11111. @file{transforms.trf}.
  11112. @item smoothing
  11113. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11114. camera movements. Default value is 10.
  11115. For example a number of 10 means that 21 frames are used (10 in the
  11116. past and 10 in the future) to smoothen the motion in the video. A
  11117. larger value leads to a smoother video, but limits the acceleration of
  11118. the camera (pan/tilt movements). 0 is a special case where a static
  11119. camera is simulated.
  11120. @item optalgo
  11121. Set the camera path optimization algorithm.
  11122. Accepted values are:
  11123. @table @samp
  11124. @item gauss
  11125. gaussian kernel low-pass filter on camera motion (default)
  11126. @item avg
  11127. averaging on transformations
  11128. @end table
  11129. @item maxshift
  11130. Set maximal number of pixels to translate frames. Default value is -1,
  11131. meaning no limit.
  11132. @item maxangle
  11133. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11134. value is -1, meaning no limit.
  11135. @item crop
  11136. Specify how to deal with borders that may be visible due to movement
  11137. compensation.
  11138. Available values are:
  11139. @table @samp
  11140. @item keep
  11141. keep image information from previous frame (default)
  11142. @item black
  11143. fill the border black
  11144. @end table
  11145. @item invert
  11146. Invert transforms if set to 1. Default value is 0.
  11147. @item relative
  11148. Consider transforms as relative to previous frame if set to 1,
  11149. absolute if set to 0. Default value is 0.
  11150. @item zoom
  11151. Set percentage to zoom. A positive value will result in a zoom-in
  11152. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11153. zoom).
  11154. @item optzoom
  11155. Set optimal zooming to avoid borders.
  11156. Accepted values are:
  11157. @table @samp
  11158. @item 0
  11159. disabled
  11160. @item 1
  11161. optimal static zoom value is determined (only very strong movements
  11162. will lead to visible borders) (default)
  11163. @item 2
  11164. optimal adaptive zoom value is determined (no borders will be
  11165. visible), see @option{zoomspeed}
  11166. @end table
  11167. Note that the value given at zoom is added to the one calculated here.
  11168. @item zoomspeed
  11169. Set percent to zoom maximally each frame (enabled when
  11170. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11171. 0.25.
  11172. @item interpol
  11173. Specify type of interpolation.
  11174. Available values are:
  11175. @table @samp
  11176. @item no
  11177. no interpolation
  11178. @item linear
  11179. linear only horizontal
  11180. @item bilinear
  11181. linear in both directions (default)
  11182. @item bicubic
  11183. cubic in both directions (slow)
  11184. @end table
  11185. @item tripod
  11186. Enable virtual tripod mode if set to 1, which is equivalent to
  11187. @code{relative=0:smoothing=0}. Default value is 0.
  11188. Use also @code{tripod} option of @ref{vidstabdetect}.
  11189. @item debug
  11190. Increase log verbosity if set to 1. Also the detected global motions
  11191. are written to the temporary file @file{global_motions.trf}. Default
  11192. value is 0.
  11193. @end table
  11194. @subsection Examples
  11195. @itemize
  11196. @item
  11197. Use @command{ffmpeg} for a typical stabilization with default values:
  11198. @example
  11199. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11200. @end example
  11201. Note the use of the @ref{unsharp} filter which is always recommended.
  11202. @item
  11203. Zoom in a bit more and load transform data from a given file:
  11204. @example
  11205. vidstabtransform=zoom=5:input="mytransforms.trf"
  11206. @end example
  11207. @item
  11208. Smoothen the video even more:
  11209. @example
  11210. vidstabtransform=smoothing=30
  11211. @end example
  11212. @end itemize
  11213. @section vflip
  11214. Flip the input video vertically.
  11215. For example, to vertically flip a video with @command{ffmpeg}:
  11216. @example
  11217. ffmpeg -i in.avi -vf "vflip" out.avi
  11218. @end example
  11219. @anchor{vignette}
  11220. @section vignette
  11221. Make or reverse a natural vignetting effect.
  11222. The filter accepts the following options:
  11223. @table @option
  11224. @item angle, a
  11225. Set lens angle expression as a number of radians.
  11226. The value is clipped in the @code{[0,PI/2]} range.
  11227. Default value: @code{"PI/5"}
  11228. @item x0
  11229. @item y0
  11230. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11231. by default.
  11232. @item mode
  11233. Set forward/backward mode.
  11234. Available modes are:
  11235. @table @samp
  11236. @item forward
  11237. The larger the distance from the central point, the darker the image becomes.
  11238. @item backward
  11239. The larger the distance from the central point, the brighter the image becomes.
  11240. This can be used to reverse a vignette effect, though there is no automatic
  11241. detection to extract the lens @option{angle} and other settings (yet). It can
  11242. also be used to create a burning effect.
  11243. @end table
  11244. Default value is @samp{forward}.
  11245. @item eval
  11246. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11247. It accepts the following values:
  11248. @table @samp
  11249. @item init
  11250. Evaluate expressions only once during the filter initialization.
  11251. @item frame
  11252. Evaluate expressions for each incoming frame. This is way slower than the
  11253. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11254. allows advanced dynamic expressions.
  11255. @end table
  11256. Default value is @samp{init}.
  11257. @item dither
  11258. Set dithering to reduce the circular banding effects. Default is @code{1}
  11259. (enabled).
  11260. @item aspect
  11261. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11262. Setting this value to the SAR of the input will make a rectangular vignetting
  11263. following the dimensions of the video.
  11264. Default is @code{1/1}.
  11265. @end table
  11266. @subsection Expressions
  11267. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11268. following parameters.
  11269. @table @option
  11270. @item w
  11271. @item h
  11272. input width and height
  11273. @item n
  11274. the number of input frame, starting from 0
  11275. @item pts
  11276. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11277. @var{TB} units, NAN if undefined
  11278. @item r
  11279. frame rate of the input video, NAN if the input frame rate is unknown
  11280. @item t
  11281. the PTS (Presentation TimeStamp) of the filtered video frame,
  11282. expressed in seconds, NAN if undefined
  11283. @item tb
  11284. time base of the input video
  11285. @end table
  11286. @subsection Examples
  11287. @itemize
  11288. @item
  11289. Apply simple strong vignetting effect:
  11290. @example
  11291. vignette=PI/4
  11292. @end example
  11293. @item
  11294. Make a flickering vignetting:
  11295. @example
  11296. vignette='PI/4+random(1)*PI/50':eval=frame
  11297. @end example
  11298. @end itemize
  11299. @section vstack
  11300. Stack input videos vertically.
  11301. All streams must be of same pixel format and of same width.
  11302. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11303. to create same output.
  11304. The filter accept the following option:
  11305. @table @option
  11306. @item inputs
  11307. Set number of input streams. Default is 2.
  11308. @item shortest
  11309. If set to 1, force the output to terminate when the shortest input
  11310. terminates. Default value is 0.
  11311. @end table
  11312. @section w3fdif
  11313. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11314. Deinterlacing Filter").
  11315. Based on the process described by Martin Weston for BBC R&D, and
  11316. implemented based on the de-interlace algorithm written by Jim
  11317. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11318. uses filter coefficients calculated by BBC R&D.
  11319. There are two sets of filter coefficients, so called "simple":
  11320. and "complex". Which set of filter coefficients is used can
  11321. be set by passing an optional parameter:
  11322. @table @option
  11323. @item filter
  11324. Set the interlacing filter coefficients. Accepts one of the following values:
  11325. @table @samp
  11326. @item simple
  11327. Simple filter coefficient set.
  11328. @item complex
  11329. More-complex filter coefficient set.
  11330. @end table
  11331. Default value is @samp{complex}.
  11332. @item deint
  11333. Specify which frames to deinterlace. Accept one of the following values:
  11334. @table @samp
  11335. @item all
  11336. Deinterlace all frames,
  11337. @item interlaced
  11338. Only deinterlace frames marked as interlaced.
  11339. @end table
  11340. Default value is @samp{all}.
  11341. @end table
  11342. @section waveform
  11343. Video waveform monitor.
  11344. The waveform monitor plots color component intensity. By default luminance
  11345. only. Each column of the waveform corresponds to a column of pixels in the
  11346. source video.
  11347. It accepts the following options:
  11348. @table @option
  11349. @item mode, m
  11350. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11351. In row mode, the graph on the left side represents color component value 0 and
  11352. the right side represents value = 255. In column mode, the top side represents
  11353. color component value = 0 and bottom side represents value = 255.
  11354. @item intensity, i
  11355. Set intensity. Smaller values are useful to find out how many values of the same
  11356. luminance are distributed across input rows/columns.
  11357. Default value is @code{0.04}. Allowed range is [0, 1].
  11358. @item mirror, r
  11359. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11360. In mirrored mode, higher values will be represented on the left
  11361. side for @code{row} mode and at the top for @code{column} mode. Default is
  11362. @code{1} (mirrored).
  11363. @item display, d
  11364. Set display mode.
  11365. It accepts the following values:
  11366. @table @samp
  11367. @item overlay
  11368. Presents information identical to that in the @code{parade}, except
  11369. that the graphs representing color components are superimposed directly
  11370. over one another.
  11371. This display mode makes it easier to spot relative differences or similarities
  11372. in overlapping areas of the color components that are supposed to be identical,
  11373. such as neutral whites, grays, or blacks.
  11374. @item stack
  11375. Display separate graph for the color components side by side in
  11376. @code{row} mode or one below the other in @code{column} mode.
  11377. @item parade
  11378. Display separate graph for the color components side by side in
  11379. @code{column} mode or one below the other in @code{row} mode.
  11380. Using this display mode makes it easy to spot color casts in the highlights
  11381. and shadows of an image, by comparing the contours of the top and the bottom
  11382. graphs of each waveform. Since whites, grays, and blacks are characterized
  11383. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11384. should display three waveforms of roughly equal width/height. If not, the
  11385. correction is easy to perform by making level adjustments the three waveforms.
  11386. @end table
  11387. Default is @code{stack}.
  11388. @item components, c
  11389. Set which color components to display. Default is 1, which means only luminance
  11390. or red color component if input is in RGB colorspace. If is set for example to
  11391. 7 it will display all 3 (if) available color components.
  11392. @item envelope, e
  11393. @table @samp
  11394. @item none
  11395. No envelope, this is default.
  11396. @item instant
  11397. Instant envelope, minimum and maximum values presented in graph will be easily
  11398. visible even with small @code{step} value.
  11399. @item peak
  11400. Hold minimum and maximum values presented in graph across time. This way you
  11401. can still spot out of range values without constantly looking at waveforms.
  11402. @item peak+instant
  11403. Peak and instant envelope combined together.
  11404. @end table
  11405. @item filter, f
  11406. @table @samp
  11407. @item lowpass
  11408. No filtering, this is default.
  11409. @item flat
  11410. Luma and chroma combined together.
  11411. @item aflat
  11412. Similar as above, but shows difference between blue and red chroma.
  11413. @item chroma
  11414. Displays only chroma.
  11415. @item color
  11416. Displays actual color value on waveform.
  11417. @item acolor
  11418. Similar as above, but with luma showing frequency of chroma values.
  11419. @end table
  11420. @item graticule, g
  11421. Set which graticule to display.
  11422. @table @samp
  11423. @item none
  11424. Do not display graticule.
  11425. @item green
  11426. Display green graticule showing legal broadcast ranges.
  11427. @end table
  11428. @item opacity, o
  11429. Set graticule opacity.
  11430. @item flags, fl
  11431. Set graticule flags.
  11432. @table @samp
  11433. @item numbers
  11434. Draw numbers above lines. By default enabled.
  11435. @item dots
  11436. Draw dots instead of lines.
  11437. @end table
  11438. @item scale, s
  11439. Set scale used for displaying graticule.
  11440. @table @samp
  11441. @item digital
  11442. @item millivolts
  11443. @item ire
  11444. @end table
  11445. Default is digital.
  11446. @item bgopacity, b
  11447. Set background opacity.
  11448. @end table
  11449. @section weave, doubleweave
  11450. The @code{weave} takes a field-based video input and join
  11451. each two sequential fields into single frame, producing a new double
  11452. height clip with half the frame rate and half the frame count.
  11453. The @code{doubleweave} works same as @code{weave} but without
  11454. halving frame rate and frame count.
  11455. It accepts the following option:
  11456. @table @option
  11457. @item first_field
  11458. Set first field. Available values are:
  11459. @table @samp
  11460. @item top, t
  11461. Set the frame as top-field-first.
  11462. @item bottom, b
  11463. Set the frame as bottom-field-first.
  11464. @end table
  11465. @end table
  11466. @subsection Examples
  11467. @itemize
  11468. @item
  11469. Interlace video using @ref{select} and @ref{separatefields} filter:
  11470. @example
  11471. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11472. @end example
  11473. @end itemize
  11474. @section xbr
  11475. Apply the xBR high-quality magnification filter which is designed for pixel
  11476. art. It follows a set of edge-detection rules, see
  11477. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11478. It accepts the following option:
  11479. @table @option
  11480. @item n
  11481. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11482. @code{3xBR} and @code{4} for @code{4xBR}.
  11483. Default is @code{3}.
  11484. @end table
  11485. @anchor{yadif}
  11486. @section yadif
  11487. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11488. filter").
  11489. It accepts the following parameters:
  11490. @table @option
  11491. @item mode
  11492. The interlacing mode to adopt. It accepts one of the following values:
  11493. @table @option
  11494. @item 0, send_frame
  11495. Output one frame for each frame.
  11496. @item 1, send_field
  11497. Output one frame for each field.
  11498. @item 2, send_frame_nospatial
  11499. Like @code{send_frame}, but it skips the spatial interlacing check.
  11500. @item 3, send_field_nospatial
  11501. Like @code{send_field}, but it skips the spatial interlacing check.
  11502. @end table
  11503. The default value is @code{send_frame}.
  11504. @item parity
  11505. The picture field parity assumed for the input interlaced video. It accepts one
  11506. of the following values:
  11507. @table @option
  11508. @item 0, tff
  11509. Assume the top field is first.
  11510. @item 1, bff
  11511. Assume the bottom field is first.
  11512. @item -1, auto
  11513. Enable automatic detection of field parity.
  11514. @end table
  11515. The default value is @code{auto}.
  11516. If the interlacing is unknown or the decoder does not export this information,
  11517. top field first will be assumed.
  11518. @item deint
  11519. Specify which frames to deinterlace. Accept one of the following
  11520. values:
  11521. @table @option
  11522. @item 0, all
  11523. Deinterlace all frames.
  11524. @item 1, interlaced
  11525. Only deinterlace frames marked as interlaced.
  11526. @end table
  11527. The default value is @code{all}.
  11528. @end table
  11529. @section zoompan
  11530. Apply Zoom & Pan effect.
  11531. This filter accepts the following options:
  11532. @table @option
  11533. @item zoom, z
  11534. Set the zoom expression. Default is 1.
  11535. @item x
  11536. @item y
  11537. Set the x and y expression. Default is 0.
  11538. @item d
  11539. Set the duration expression in number of frames.
  11540. This sets for how many number of frames effect will last for
  11541. single input image.
  11542. @item s
  11543. Set the output image size, default is 'hd720'.
  11544. @item fps
  11545. Set the output frame rate, default is '25'.
  11546. @end table
  11547. Each expression can contain the following constants:
  11548. @table @option
  11549. @item in_w, iw
  11550. Input width.
  11551. @item in_h, ih
  11552. Input height.
  11553. @item out_w, ow
  11554. Output width.
  11555. @item out_h, oh
  11556. Output height.
  11557. @item in
  11558. Input frame count.
  11559. @item on
  11560. Output frame count.
  11561. @item x
  11562. @item y
  11563. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11564. for current input frame.
  11565. @item px
  11566. @item py
  11567. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11568. not yet such frame (first input frame).
  11569. @item zoom
  11570. Last calculated zoom from 'z' expression for current input frame.
  11571. @item pzoom
  11572. Last calculated zoom of last output frame of previous input frame.
  11573. @item duration
  11574. Number of output frames for current input frame. Calculated from 'd' expression
  11575. for each input frame.
  11576. @item pduration
  11577. number of output frames created for previous input frame
  11578. @item a
  11579. Rational number: input width / input height
  11580. @item sar
  11581. sample aspect ratio
  11582. @item dar
  11583. display aspect ratio
  11584. @end table
  11585. @subsection Examples
  11586. @itemize
  11587. @item
  11588. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11589. @example
  11590. 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
  11591. @end example
  11592. @item
  11593. Zoom-in up to 1.5 and pan always at center of picture:
  11594. @example
  11595. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11596. @end example
  11597. @item
  11598. Same as above but without pausing:
  11599. @example
  11600. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11601. @end example
  11602. @end itemize
  11603. @section zscale
  11604. Scale (resize) the input video, using the z.lib library:
  11605. https://github.com/sekrit-twc/zimg.
  11606. The zscale filter forces the output display aspect ratio to be the same
  11607. as the input, by changing the output sample aspect ratio.
  11608. If the input image format is different from the format requested by
  11609. the next filter, the zscale filter will convert the input to the
  11610. requested format.
  11611. @subsection Options
  11612. The filter accepts the following options.
  11613. @table @option
  11614. @item width, w
  11615. @item height, h
  11616. Set the output video dimension expression. Default value is the input
  11617. dimension.
  11618. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11619. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11620. If one of the values is -1, the zscale filter will use a value that
  11621. maintains the aspect ratio of the input image, calculated from the
  11622. other specified dimension. If both of them are -1, the input size is
  11623. used
  11624. If one of the values is -n with n > 1, the zscale filter will also use a value
  11625. that maintains the aspect ratio of the input image, calculated from the other
  11626. specified dimension. After that it will, however, make sure that the calculated
  11627. dimension is divisible by n and adjust the value if necessary.
  11628. See below for the list of accepted constants for use in the dimension
  11629. expression.
  11630. @item size, s
  11631. Set the video size. For the syntax of this option, check the
  11632. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11633. @item dither, d
  11634. Set the dither type.
  11635. Possible values are:
  11636. @table @var
  11637. @item none
  11638. @item ordered
  11639. @item random
  11640. @item error_diffusion
  11641. @end table
  11642. Default is none.
  11643. @item filter, f
  11644. Set the resize filter type.
  11645. Possible values are:
  11646. @table @var
  11647. @item point
  11648. @item bilinear
  11649. @item bicubic
  11650. @item spline16
  11651. @item spline36
  11652. @item lanczos
  11653. @end table
  11654. Default is bilinear.
  11655. @item range, r
  11656. Set the color range.
  11657. Possible values are:
  11658. @table @var
  11659. @item input
  11660. @item limited
  11661. @item full
  11662. @end table
  11663. Default is same as input.
  11664. @item primaries, p
  11665. Set the color primaries.
  11666. Possible values are:
  11667. @table @var
  11668. @item input
  11669. @item 709
  11670. @item unspecified
  11671. @item 170m
  11672. @item 240m
  11673. @item 2020
  11674. @end table
  11675. Default is same as input.
  11676. @item transfer, t
  11677. Set the transfer characteristics.
  11678. Possible values are:
  11679. @table @var
  11680. @item input
  11681. @item 709
  11682. @item unspecified
  11683. @item 601
  11684. @item linear
  11685. @item 2020_10
  11686. @item 2020_12
  11687. @item smpte2084
  11688. @item iec61966-2-1
  11689. @item arib-std-b67
  11690. @end table
  11691. Default is same as input.
  11692. @item matrix, m
  11693. Set the colorspace matrix.
  11694. Possible value are:
  11695. @table @var
  11696. @item input
  11697. @item 709
  11698. @item unspecified
  11699. @item 470bg
  11700. @item 170m
  11701. @item 2020_ncl
  11702. @item 2020_cl
  11703. @end table
  11704. Default is same as input.
  11705. @item rangein, rin
  11706. Set the input color range.
  11707. Possible values are:
  11708. @table @var
  11709. @item input
  11710. @item limited
  11711. @item full
  11712. @end table
  11713. Default is same as input.
  11714. @item primariesin, pin
  11715. Set the input color primaries.
  11716. Possible values are:
  11717. @table @var
  11718. @item input
  11719. @item 709
  11720. @item unspecified
  11721. @item 170m
  11722. @item 240m
  11723. @item 2020
  11724. @end table
  11725. Default is same as input.
  11726. @item transferin, tin
  11727. Set the input transfer characteristics.
  11728. Possible values are:
  11729. @table @var
  11730. @item input
  11731. @item 709
  11732. @item unspecified
  11733. @item 601
  11734. @item linear
  11735. @item 2020_10
  11736. @item 2020_12
  11737. @end table
  11738. Default is same as input.
  11739. @item matrixin, min
  11740. Set the input colorspace matrix.
  11741. Possible value are:
  11742. @table @var
  11743. @item input
  11744. @item 709
  11745. @item unspecified
  11746. @item 470bg
  11747. @item 170m
  11748. @item 2020_ncl
  11749. @item 2020_cl
  11750. @end table
  11751. @item chromal, c
  11752. Set the output chroma location.
  11753. Possible values are:
  11754. @table @var
  11755. @item input
  11756. @item left
  11757. @item center
  11758. @item topleft
  11759. @item top
  11760. @item bottomleft
  11761. @item bottom
  11762. @end table
  11763. @item chromalin, cin
  11764. Set the input chroma location.
  11765. Possible values are:
  11766. @table @var
  11767. @item input
  11768. @item left
  11769. @item center
  11770. @item topleft
  11771. @item top
  11772. @item bottomleft
  11773. @item bottom
  11774. @end table
  11775. @item npl
  11776. Set the nominal peak luminance.
  11777. @end table
  11778. The values of the @option{w} and @option{h} options are expressions
  11779. containing the following constants:
  11780. @table @var
  11781. @item in_w
  11782. @item in_h
  11783. The input width and height
  11784. @item iw
  11785. @item ih
  11786. These are the same as @var{in_w} and @var{in_h}.
  11787. @item out_w
  11788. @item out_h
  11789. The output (scaled) width and height
  11790. @item ow
  11791. @item oh
  11792. These are the same as @var{out_w} and @var{out_h}
  11793. @item a
  11794. The same as @var{iw} / @var{ih}
  11795. @item sar
  11796. input sample aspect ratio
  11797. @item dar
  11798. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11799. @item hsub
  11800. @item vsub
  11801. horizontal and vertical input chroma subsample values. For example for the
  11802. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11803. @item ohsub
  11804. @item ovsub
  11805. horizontal and vertical output chroma subsample values. For example for the
  11806. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11807. @end table
  11808. @table @option
  11809. @end table
  11810. @c man end VIDEO FILTERS
  11811. @chapter Video Sources
  11812. @c man begin VIDEO SOURCES
  11813. Below is a description of the currently available video sources.
  11814. @section buffer
  11815. Buffer video frames, and make them available to the filter chain.
  11816. This source is mainly intended for a programmatic use, in particular
  11817. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11818. It accepts the following parameters:
  11819. @table @option
  11820. @item video_size
  11821. Specify the size (width and height) of the buffered video frames. For the
  11822. syntax of this option, check the
  11823. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11824. @item width
  11825. The input video width.
  11826. @item height
  11827. The input video height.
  11828. @item pix_fmt
  11829. A string representing the pixel format of the buffered video frames.
  11830. It may be a number corresponding to a pixel format, or a pixel format
  11831. name.
  11832. @item time_base
  11833. Specify the timebase assumed by the timestamps of the buffered frames.
  11834. @item frame_rate
  11835. Specify the frame rate expected for the video stream.
  11836. @item pixel_aspect, sar
  11837. The sample (pixel) aspect ratio of the input video.
  11838. @item sws_param
  11839. Specify the optional parameters to be used for the scale filter which
  11840. is automatically inserted when an input change is detected in the
  11841. input size or format.
  11842. @item hw_frames_ctx
  11843. When using a hardware pixel format, this should be a reference to an
  11844. AVHWFramesContext describing input frames.
  11845. @end table
  11846. For example:
  11847. @example
  11848. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11849. @end example
  11850. will instruct the source to accept video frames with size 320x240 and
  11851. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11852. square pixels (1:1 sample aspect ratio).
  11853. Since the pixel format with name "yuv410p" corresponds to the number 6
  11854. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11855. this example corresponds to:
  11856. @example
  11857. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11858. @end example
  11859. Alternatively, the options can be specified as a flat string, but this
  11860. syntax is deprecated:
  11861. @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}]
  11862. @section cellauto
  11863. Create a pattern generated by an elementary cellular automaton.
  11864. The initial state of the cellular automaton can be defined through the
  11865. @option{filename} and @option{pattern} options. If such options are
  11866. not specified an initial state is created randomly.
  11867. At each new frame a new row in the video is filled with the result of
  11868. the cellular automaton next generation. The behavior when the whole
  11869. frame is filled is defined by the @option{scroll} option.
  11870. This source accepts the following options:
  11871. @table @option
  11872. @item filename, f
  11873. Read the initial cellular automaton state, i.e. the starting row, from
  11874. the specified file.
  11875. In the file, each non-whitespace character is considered an alive
  11876. cell, a newline will terminate the row, and further characters in the
  11877. file will be ignored.
  11878. @item pattern, p
  11879. Read the initial cellular automaton state, i.e. the starting row, from
  11880. the specified string.
  11881. Each non-whitespace character in the string is considered an alive
  11882. cell, a newline will terminate the row, and further characters in the
  11883. string will be ignored.
  11884. @item rate, r
  11885. Set the video rate, that is the number of frames generated per second.
  11886. Default is 25.
  11887. @item random_fill_ratio, ratio
  11888. Set the random fill ratio for the initial cellular automaton row. It
  11889. is a floating point number value ranging from 0 to 1, defaults to
  11890. 1/PHI.
  11891. This option is ignored when a file or a pattern is specified.
  11892. @item random_seed, seed
  11893. Set the seed for filling randomly the initial row, must be an integer
  11894. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11895. set to -1, the filter will try to use a good random seed on a best
  11896. effort basis.
  11897. @item rule
  11898. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11899. Default value is 110.
  11900. @item size, s
  11901. Set the size of the output video. For the syntax of this option, check the
  11902. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11903. If @option{filename} or @option{pattern} is specified, the size is set
  11904. by default to the width of the specified initial state row, and the
  11905. height is set to @var{width} * PHI.
  11906. If @option{size} is set, it must contain the width of the specified
  11907. pattern string, and the specified pattern will be centered in the
  11908. larger row.
  11909. If a filename or a pattern string is not specified, the size value
  11910. defaults to "320x518" (used for a randomly generated initial state).
  11911. @item scroll
  11912. If set to 1, scroll the output upward when all the rows in the output
  11913. have been already filled. If set to 0, the new generated row will be
  11914. written over the top row just after the bottom row is filled.
  11915. Defaults to 1.
  11916. @item start_full, full
  11917. If set to 1, completely fill the output with generated rows before
  11918. outputting the first frame.
  11919. This is the default behavior, for disabling set the value to 0.
  11920. @item stitch
  11921. If set to 1, stitch the left and right row edges together.
  11922. This is the default behavior, for disabling set the value to 0.
  11923. @end table
  11924. @subsection Examples
  11925. @itemize
  11926. @item
  11927. Read the initial state from @file{pattern}, and specify an output of
  11928. size 200x400.
  11929. @example
  11930. cellauto=f=pattern:s=200x400
  11931. @end example
  11932. @item
  11933. Generate a random initial row with a width of 200 cells, with a fill
  11934. ratio of 2/3:
  11935. @example
  11936. cellauto=ratio=2/3:s=200x200
  11937. @end example
  11938. @item
  11939. Create a pattern generated by rule 18 starting by a single alive cell
  11940. centered on an initial row with width 100:
  11941. @example
  11942. cellauto=p=@@:s=100x400:full=0:rule=18
  11943. @end example
  11944. @item
  11945. Specify a more elaborated initial pattern:
  11946. @example
  11947. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11948. @end example
  11949. @end itemize
  11950. @anchor{coreimagesrc}
  11951. @section coreimagesrc
  11952. Video source generated on GPU using Apple's CoreImage API on OSX.
  11953. This video source is a specialized version of the @ref{coreimage} video filter.
  11954. Use a core image generator at the beginning of the applied filterchain to
  11955. generate the content.
  11956. The coreimagesrc video source accepts the following options:
  11957. @table @option
  11958. @item list_generators
  11959. List all available generators along with all their respective options as well as
  11960. possible minimum and maximum values along with the default values.
  11961. @example
  11962. list_generators=true
  11963. @end example
  11964. @item size, s
  11965. Specify the size of the sourced video. For the syntax of this option, check the
  11966. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11967. The default value is @code{320x240}.
  11968. @item rate, r
  11969. Specify the frame rate of the sourced video, as the number of frames
  11970. generated per second. It has to be a string in the format
  11971. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11972. number or a valid video frame rate abbreviation. The default value is
  11973. "25".
  11974. @item sar
  11975. Set the sample aspect ratio of the sourced video.
  11976. @item duration, d
  11977. Set the duration of the sourced video. See
  11978. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11979. for the accepted syntax.
  11980. If not specified, or the expressed duration is negative, the video is
  11981. supposed to be generated forever.
  11982. @end table
  11983. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11984. A complete filterchain can be used for further processing of the
  11985. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11986. and examples for details.
  11987. @subsection Examples
  11988. @itemize
  11989. @item
  11990. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11991. given as complete and escaped command-line for Apple's standard bash shell:
  11992. @example
  11993. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11994. @end example
  11995. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11996. need for a nullsrc video source.
  11997. @end itemize
  11998. @section mandelbrot
  11999. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12000. point specified with @var{start_x} and @var{start_y}.
  12001. This source accepts the following options:
  12002. @table @option
  12003. @item end_pts
  12004. Set the terminal pts value. Default value is 400.
  12005. @item end_scale
  12006. Set the terminal scale value.
  12007. Must be a floating point value. Default value is 0.3.
  12008. @item inner
  12009. Set the inner coloring mode, that is the algorithm used to draw the
  12010. Mandelbrot fractal internal region.
  12011. It shall assume one of the following values:
  12012. @table @option
  12013. @item black
  12014. Set black mode.
  12015. @item convergence
  12016. Show time until convergence.
  12017. @item mincol
  12018. Set color based on point closest to the origin of the iterations.
  12019. @item period
  12020. Set period mode.
  12021. @end table
  12022. Default value is @var{mincol}.
  12023. @item bailout
  12024. Set the bailout value. Default value is 10.0.
  12025. @item maxiter
  12026. Set the maximum of iterations performed by the rendering
  12027. algorithm. Default value is 7189.
  12028. @item outer
  12029. Set outer coloring mode.
  12030. It shall assume one of following values:
  12031. @table @option
  12032. @item iteration_count
  12033. Set iteration cound mode.
  12034. @item normalized_iteration_count
  12035. set normalized iteration count mode.
  12036. @end table
  12037. Default value is @var{normalized_iteration_count}.
  12038. @item rate, r
  12039. Set frame rate, expressed as number of frames per second. Default
  12040. value is "25".
  12041. @item size, s
  12042. Set frame size. For the syntax of this option, check the "Video
  12043. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12044. @item start_scale
  12045. Set the initial scale value. Default value is 3.0.
  12046. @item start_x
  12047. Set the initial x position. Must be a floating point value between
  12048. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12049. @item start_y
  12050. Set the initial y position. Must be a floating point value between
  12051. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12052. @end table
  12053. @section mptestsrc
  12054. Generate various test patterns, as generated by the MPlayer test filter.
  12055. The size of the generated video is fixed, and is 256x256.
  12056. This source is useful in particular for testing encoding features.
  12057. This source accepts the following options:
  12058. @table @option
  12059. @item rate, r
  12060. Specify the frame rate of the sourced video, as the number of frames
  12061. generated per second. It has to be a string in the format
  12062. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12063. number or a valid video frame rate abbreviation. The default value is
  12064. "25".
  12065. @item duration, d
  12066. Set the duration of the sourced video. See
  12067. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12068. for the accepted syntax.
  12069. If not specified, or the expressed duration is negative, the video is
  12070. supposed to be generated forever.
  12071. @item test, t
  12072. Set the number or the name of the test to perform. Supported tests are:
  12073. @table @option
  12074. @item dc_luma
  12075. @item dc_chroma
  12076. @item freq_luma
  12077. @item freq_chroma
  12078. @item amp_luma
  12079. @item amp_chroma
  12080. @item cbp
  12081. @item mv
  12082. @item ring1
  12083. @item ring2
  12084. @item all
  12085. @end table
  12086. Default value is "all", which will cycle through the list of all tests.
  12087. @end table
  12088. Some examples:
  12089. @example
  12090. mptestsrc=t=dc_luma
  12091. @end example
  12092. will generate a "dc_luma" test pattern.
  12093. @section frei0r_src
  12094. Provide a frei0r source.
  12095. To enable compilation of this filter you need to install the frei0r
  12096. header and configure FFmpeg with @code{--enable-frei0r}.
  12097. This source accepts the following parameters:
  12098. @table @option
  12099. @item size
  12100. The size of the video to generate. For the syntax of this option, check the
  12101. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12102. @item framerate
  12103. The framerate of the generated video. It may be a string of the form
  12104. @var{num}/@var{den} or a frame rate abbreviation.
  12105. @item filter_name
  12106. The name to the frei0r source to load. For more information regarding frei0r and
  12107. how to set the parameters, read the @ref{frei0r} section in the video filters
  12108. documentation.
  12109. @item filter_params
  12110. A '|'-separated list of parameters to pass to the frei0r source.
  12111. @end table
  12112. For example, to generate a frei0r partik0l source with size 200x200
  12113. and frame rate 10 which is overlaid on the overlay filter main input:
  12114. @example
  12115. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12116. @end example
  12117. @section life
  12118. Generate a life pattern.
  12119. This source is based on a generalization of John Conway's life game.
  12120. The sourced input represents a life grid, each pixel represents a cell
  12121. which can be in one of two possible states, alive or dead. Every cell
  12122. interacts with its eight neighbours, which are the cells that are
  12123. horizontally, vertically, or diagonally adjacent.
  12124. At each interaction the grid evolves according to the adopted rule,
  12125. which specifies the number of neighbor alive cells which will make a
  12126. cell stay alive or born. The @option{rule} option allows one to specify
  12127. the rule to adopt.
  12128. This source accepts the following options:
  12129. @table @option
  12130. @item filename, f
  12131. Set the file from which to read the initial grid state. In the file,
  12132. each non-whitespace character is considered an alive cell, and newline
  12133. is used to delimit the end of each row.
  12134. If this option is not specified, the initial grid is generated
  12135. randomly.
  12136. @item rate, r
  12137. Set the video rate, that is the number of frames generated per second.
  12138. Default is 25.
  12139. @item random_fill_ratio, ratio
  12140. Set the random fill ratio for the initial random grid. It is a
  12141. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12142. It is ignored when a file is specified.
  12143. @item random_seed, seed
  12144. Set the seed for filling the initial random grid, must be an integer
  12145. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12146. set to -1, the filter will try to use a good random seed on a best
  12147. effort basis.
  12148. @item rule
  12149. Set the life rule.
  12150. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12151. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12152. @var{NS} specifies the number of alive neighbor cells which make a
  12153. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12154. which make a dead cell to become alive (i.e. to "born").
  12155. "s" and "b" can be used in place of "S" and "B", respectively.
  12156. Alternatively a rule can be specified by an 18-bits integer. The 9
  12157. high order bits are used to encode the next cell state if it is alive
  12158. for each number of neighbor alive cells, the low order bits specify
  12159. the rule for "borning" new cells. Higher order bits encode for an
  12160. higher number of neighbor cells.
  12161. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12162. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12163. Default value is "S23/B3", which is the original Conway's game of life
  12164. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12165. cells, and will born a new cell if there are three alive cells around
  12166. a dead cell.
  12167. @item size, s
  12168. Set the size of the output video. For the syntax of this option, check the
  12169. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12170. If @option{filename} is specified, the size is set by default to the
  12171. same size of the input file. If @option{size} is set, it must contain
  12172. the size specified in the input file, and the initial grid defined in
  12173. that file is centered in the larger resulting area.
  12174. If a filename is not specified, the size value defaults to "320x240"
  12175. (used for a randomly generated initial grid).
  12176. @item stitch
  12177. If set to 1, stitch the left and right grid edges together, and the
  12178. top and bottom edges also. Defaults to 1.
  12179. @item mold
  12180. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12181. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12182. value from 0 to 255.
  12183. @item life_color
  12184. Set the color of living (or new born) cells.
  12185. @item death_color
  12186. Set the color of dead cells. If @option{mold} is set, this is the first color
  12187. used to represent a dead cell.
  12188. @item mold_color
  12189. Set mold color, for definitely dead and moldy cells.
  12190. For the syntax of these 3 color options, check the "Color" section in the
  12191. ffmpeg-utils manual.
  12192. @end table
  12193. @subsection Examples
  12194. @itemize
  12195. @item
  12196. Read a grid from @file{pattern}, and center it on a grid of size
  12197. 300x300 pixels:
  12198. @example
  12199. life=f=pattern:s=300x300
  12200. @end example
  12201. @item
  12202. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12203. @example
  12204. life=ratio=2/3:s=200x200
  12205. @end example
  12206. @item
  12207. Specify a custom rule for evolving a randomly generated grid:
  12208. @example
  12209. life=rule=S14/B34
  12210. @end example
  12211. @item
  12212. Full example with slow death effect (mold) using @command{ffplay}:
  12213. @example
  12214. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12215. @end example
  12216. @end itemize
  12217. @anchor{allrgb}
  12218. @anchor{allyuv}
  12219. @anchor{color}
  12220. @anchor{haldclutsrc}
  12221. @anchor{nullsrc}
  12222. @anchor{rgbtestsrc}
  12223. @anchor{smptebars}
  12224. @anchor{smptehdbars}
  12225. @anchor{testsrc}
  12226. @anchor{testsrc2}
  12227. @anchor{yuvtestsrc}
  12228. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12229. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12230. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12231. The @code{color} source provides an uniformly colored input.
  12232. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12233. @ref{haldclut} filter.
  12234. The @code{nullsrc} source returns unprocessed video frames. It is
  12235. mainly useful to be employed in analysis / debugging tools, or as the
  12236. source for filters which ignore the input data.
  12237. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12238. detecting RGB vs BGR issues. You should see a red, green and blue
  12239. stripe from top to bottom.
  12240. The @code{smptebars} source generates a color bars pattern, based on
  12241. the SMPTE Engineering Guideline EG 1-1990.
  12242. The @code{smptehdbars} source generates a color bars pattern, based on
  12243. the SMPTE RP 219-2002.
  12244. The @code{testsrc} source generates a test video pattern, showing a
  12245. color pattern, a scrolling gradient and a timestamp. This is mainly
  12246. intended for testing purposes.
  12247. The @code{testsrc2} source is similar to testsrc, but supports more
  12248. pixel formats instead of just @code{rgb24}. This allows using it as an
  12249. input for other tests without requiring a format conversion.
  12250. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12251. see a y, cb and cr stripe from top to bottom.
  12252. The sources accept the following parameters:
  12253. @table @option
  12254. @item color, c
  12255. Specify the color of the source, only available in the @code{color}
  12256. source. For the syntax of this option, check the "Color" section in the
  12257. ffmpeg-utils manual.
  12258. @item level
  12259. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12260. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12261. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12262. coded on a @code{1/(N*N)} scale.
  12263. @item size, s
  12264. Specify the size of the sourced video. For the syntax of this option, check the
  12265. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12266. The default value is @code{320x240}.
  12267. This option is not available with the @code{haldclutsrc} filter.
  12268. @item rate, r
  12269. Specify the frame rate of the sourced video, as the number of frames
  12270. generated per second. It has to be a string in the format
  12271. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12272. number or a valid video frame rate abbreviation. The default value is
  12273. "25".
  12274. @item sar
  12275. Set the sample aspect ratio of the sourced video.
  12276. @item duration, d
  12277. Set the duration of the sourced video. See
  12278. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12279. for the accepted syntax.
  12280. If not specified, or the expressed duration is negative, the video is
  12281. supposed to be generated forever.
  12282. @item decimals, n
  12283. Set the number of decimals to show in the timestamp, only available in the
  12284. @code{testsrc} source.
  12285. The displayed timestamp value will correspond to the original
  12286. timestamp value multiplied by the power of 10 of the specified
  12287. value. Default value is 0.
  12288. @end table
  12289. For example the following:
  12290. @example
  12291. testsrc=duration=5.3:size=qcif:rate=10
  12292. @end example
  12293. will generate a video with a duration of 5.3 seconds, with size
  12294. 176x144 and a frame rate of 10 frames per second.
  12295. The following graph description will generate a red source
  12296. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12297. frames per second.
  12298. @example
  12299. color=c=red@@0.2:s=qcif:r=10
  12300. @end example
  12301. If the input content is to be ignored, @code{nullsrc} can be used. The
  12302. following command generates noise in the luminance plane by employing
  12303. the @code{geq} filter:
  12304. @example
  12305. nullsrc=s=256x256, geq=random(1)*255:128:128
  12306. @end example
  12307. @subsection Commands
  12308. The @code{color} source supports the following commands:
  12309. @table @option
  12310. @item c, color
  12311. Set the color of the created image. Accepts the same syntax of the
  12312. corresponding @option{color} option.
  12313. @end table
  12314. @c man end VIDEO SOURCES
  12315. @chapter Video Sinks
  12316. @c man begin VIDEO SINKS
  12317. Below is a description of the currently available video sinks.
  12318. @section buffersink
  12319. Buffer video frames, and make them available to the end of the filter
  12320. graph.
  12321. This sink is mainly intended for programmatic use, in particular
  12322. through the interface defined in @file{libavfilter/buffersink.h}
  12323. or the options system.
  12324. It accepts a pointer to an AVBufferSinkContext structure, which
  12325. defines the incoming buffers' formats, to be passed as the opaque
  12326. parameter to @code{avfilter_init_filter} for initialization.
  12327. @section nullsink
  12328. Null video sink: do absolutely nothing with the input video. It is
  12329. mainly useful as a template and for use in analysis / debugging
  12330. tools.
  12331. @c man end VIDEO SINKS
  12332. @chapter Multimedia Filters
  12333. @c man begin MULTIMEDIA FILTERS
  12334. Below is a description of the currently available multimedia filters.
  12335. @section abitscope
  12336. Convert input audio to a video output, displaying the audio bit scope.
  12337. The filter accepts the following options:
  12338. @table @option
  12339. @item rate, r
  12340. Set frame rate, expressed as number of frames per second. Default
  12341. value is "25".
  12342. @item size, s
  12343. Specify the video size for the output. For the syntax of this option, check the
  12344. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12345. Default value is @code{1024x256}.
  12346. @item colors
  12347. Specify list of colors separated by space or by '|' which will be used to
  12348. draw channels. Unrecognized or missing colors will be replaced
  12349. by white color.
  12350. @end table
  12351. @section ahistogram
  12352. Convert input audio to a video output, displaying the volume histogram.
  12353. The filter accepts the following options:
  12354. @table @option
  12355. @item dmode
  12356. Specify how histogram is calculated.
  12357. It accepts the following values:
  12358. @table @samp
  12359. @item single
  12360. Use single histogram for all channels.
  12361. @item separate
  12362. Use separate histogram for each channel.
  12363. @end table
  12364. Default is @code{single}.
  12365. @item rate, r
  12366. Set frame rate, expressed as number of frames per second. Default
  12367. value is "25".
  12368. @item size, s
  12369. Specify the video size for the output. For the syntax of this option, check the
  12370. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12371. Default value is @code{hd720}.
  12372. @item scale
  12373. Set display scale.
  12374. It accepts the following values:
  12375. @table @samp
  12376. @item log
  12377. logarithmic
  12378. @item sqrt
  12379. square root
  12380. @item cbrt
  12381. cubic root
  12382. @item lin
  12383. linear
  12384. @item rlog
  12385. reverse logarithmic
  12386. @end table
  12387. Default is @code{log}.
  12388. @item ascale
  12389. Set amplitude scale.
  12390. It accepts the following values:
  12391. @table @samp
  12392. @item log
  12393. logarithmic
  12394. @item lin
  12395. linear
  12396. @end table
  12397. Default is @code{log}.
  12398. @item acount
  12399. Set how much frames to accumulate in histogram.
  12400. Defauls is 1. Setting this to -1 accumulates all frames.
  12401. @item rheight
  12402. Set histogram ratio of window height.
  12403. @item slide
  12404. Set sonogram sliding.
  12405. It accepts the following values:
  12406. @table @samp
  12407. @item replace
  12408. replace old rows with new ones.
  12409. @item scroll
  12410. scroll from top to bottom.
  12411. @end table
  12412. Default is @code{replace}.
  12413. @end table
  12414. @section aphasemeter
  12415. Convert input audio to a video output, displaying the audio phase.
  12416. The filter accepts the following options:
  12417. @table @option
  12418. @item rate, r
  12419. Set the output frame rate. Default value is @code{25}.
  12420. @item size, s
  12421. Set the video size for the output. For the syntax of this option, check the
  12422. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12423. Default value is @code{800x400}.
  12424. @item rc
  12425. @item gc
  12426. @item bc
  12427. Specify the red, green, blue contrast. Default values are @code{2},
  12428. @code{7} and @code{1}.
  12429. Allowed range is @code{[0, 255]}.
  12430. @item mpc
  12431. Set color which will be used for drawing median phase. If color is
  12432. @code{none} which is default, no median phase value will be drawn.
  12433. @item video
  12434. Enable video output. Default is enabled.
  12435. @end table
  12436. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12437. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12438. The @code{-1} means left and right channels are completely out of phase and
  12439. @code{1} means channels are in phase.
  12440. @section avectorscope
  12441. Convert input audio to a video output, representing the audio vector
  12442. scope.
  12443. The filter is used to measure the difference between channels of stereo
  12444. audio stream. A monoaural signal, consisting of identical left and right
  12445. signal, results in straight vertical line. Any stereo separation is visible
  12446. as a deviation from this line, creating a Lissajous figure.
  12447. If the straight (or deviation from it) but horizontal line appears this
  12448. indicates that the left and right channels are out of phase.
  12449. The filter accepts the following options:
  12450. @table @option
  12451. @item mode, m
  12452. Set the vectorscope mode.
  12453. Available values are:
  12454. @table @samp
  12455. @item lissajous
  12456. Lissajous rotated by 45 degrees.
  12457. @item lissajous_xy
  12458. Same as above but not rotated.
  12459. @item polar
  12460. Shape resembling half of circle.
  12461. @end table
  12462. Default value is @samp{lissajous}.
  12463. @item size, s
  12464. Set the video size for the output. For the syntax of this option, check the
  12465. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12466. Default value is @code{400x400}.
  12467. @item rate, r
  12468. Set the output frame rate. Default value is @code{25}.
  12469. @item rc
  12470. @item gc
  12471. @item bc
  12472. @item ac
  12473. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12474. @code{160}, @code{80} and @code{255}.
  12475. Allowed range is @code{[0, 255]}.
  12476. @item rf
  12477. @item gf
  12478. @item bf
  12479. @item af
  12480. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12481. @code{10}, @code{5} and @code{5}.
  12482. Allowed range is @code{[0, 255]}.
  12483. @item zoom
  12484. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12485. @item draw
  12486. Set the vectorscope drawing mode.
  12487. Available values are:
  12488. @table @samp
  12489. @item dot
  12490. Draw dot for each sample.
  12491. @item line
  12492. Draw line between previous and current sample.
  12493. @end table
  12494. Default value is @samp{dot}.
  12495. @item scale
  12496. Specify amplitude scale of audio samples.
  12497. Available values are:
  12498. @table @samp
  12499. @item lin
  12500. Linear.
  12501. @item sqrt
  12502. Square root.
  12503. @item cbrt
  12504. Cubic root.
  12505. @item log
  12506. Logarithmic.
  12507. @end table
  12508. @end table
  12509. @subsection Examples
  12510. @itemize
  12511. @item
  12512. Complete example using @command{ffplay}:
  12513. @example
  12514. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12515. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12516. @end example
  12517. @end itemize
  12518. @section bench, abench
  12519. Benchmark part of a filtergraph.
  12520. The filter accepts the following options:
  12521. @table @option
  12522. @item action
  12523. Start or stop a timer.
  12524. Available values are:
  12525. @table @samp
  12526. @item start
  12527. Get the current time, set it as frame metadata (using the key
  12528. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12529. @item stop
  12530. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12531. the input frame metadata to get the time difference. Time difference, average,
  12532. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12533. @code{min}) are then printed. The timestamps are expressed in seconds.
  12534. @end table
  12535. @end table
  12536. @subsection Examples
  12537. @itemize
  12538. @item
  12539. Benchmark @ref{selectivecolor} filter:
  12540. @example
  12541. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12542. @end example
  12543. @end itemize
  12544. @section concat
  12545. Concatenate audio and video streams, joining them together one after the
  12546. other.
  12547. The filter works on segments of synchronized video and audio streams. All
  12548. segments must have the same number of streams of each type, and that will
  12549. also be the number of streams at output.
  12550. The filter accepts the following options:
  12551. @table @option
  12552. @item n
  12553. Set the number of segments. Default is 2.
  12554. @item v
  12555. Set the number of output video streams, that is also the number of video
  12556. streams in each segment. Default is 1.
  12557. @item a
  12558. Set the number of output audio streams, that is also the number of audio
  12559. streams in each segment. Default is 0.
  12560. @item unsafe
  12561. Activate unsafe mode: do not fail if segments have a different format.
  12562. @end table
  12563. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12564. @var{a} audio outputs.
  12565. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12566. segment, in the same order as the outputs, then the inputs for the second
  12567. segment, etc.
  12568. Related streams do not always have exactly the same duration, for various
  12569. reasons including codec frame size or sloppy authoring. For that reason,
  12570. related synchronized streams (e.g. a video and its audio track) should be
  12571. concatenated at once. The concat filter will use the duration of the longest
  12572. stream in each segment (except the last one), and if necessary pad shorter
  12573. audio streams with silence.
  12574. For this filter to work correctly, all segments must start at timestamp 0.
  12575. All corresponding streams must have the same parameters in all segments; the
  12576. filtering system will automatically select a common pixel format for video
  12577. streams, and a common sample format, sample rate and channel layout for
  12578. audio streams, but other settings, such as resolution, must be converted
  12579. explicitly by the user.
  12580. Different frame rates are acceptable but will result in variable frame rate
  12581. at output; be sure to configure the output file to handle it.
  12582. @subsection Examples
  12583. @itemize
  12584. @item
  12585. Concatenate an opening, an episode and an ending, all in bilingual version
  12586. (video in stream 0, audio in streams 1 and 2):
  12587. @example
  12588. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12589. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12590. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12591. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12592. @end example
  12593. @item
  12594. Concatenate two parts, handling audio and video separately, using the
  12595. (a)movie sources, and adjusting the resolution:
  12596. @example
  12597. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12598. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12599. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12600. @end example
  12601. Note that a desync will happen at the stitch if the audio and video streams
  12602. do not have exactly the same duration in the first file.
  12603. @end itemize
  12604. @section drawgraph, adrawgraph
  12605. Draw a graph using input video or audio metadata.
  12606. It accepts the following parameters:
  12607. @table @option
  12608. @item m1
  12609. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12610. @item fg1
  12611. Set 1st foreground color expression.
  12612. @item m2
  12613. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12614. @item fg2
  12615. Set 2nd foreground color expression.
  12616. @item m3
  12617. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12618. @item fg3
  12619. Set 3rd foreground color expression.
  12620. @item m4
  12621. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12622. @item fg4
  12623. Set 4th foreground color expression.
  12624. @item min
  12625. Set minimal value of metadata value.
  12626. @item max
  12627. Set maximal value of metadata value.
  12628. @item bg
  12629. Set graph background color. Default is white.
  12630. @item mode
  12631. Set graph mode.
  12632. Available values for mode is:
  12633. @table @samp
  12634. @item bar
  12635. @item dot
  12636. @item line
  12637. @end table
  12638. Default is @code{line}.
  12639. @item slide
  12640. Set slide mode.
  12641. Available values for slide is:
  12642. @table @samp
  12643. @item frame
  12644. Draw new frame when right border is reached.
  12645. @item replace
  12646. Replace old columns with new ones.
  12647. @item scroll
  12648. Scroll from right to left.
  12649. @item rscroll
  12650. Scroll from left to right.
  12651. @item picture
  12652. Draw single picture.
  12653. @end table
  12654. Default is @code{frame}.
  12655. @item size
  12656. Set size of graph video. For the syntax of this option, check the
  12657. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12658. The default value is @code{900x256}.
  12659. The foreground color expressions can use the following variables:
  12660. @table @option
  12661. @item MIN
  12662. Minimal value of metadata value.
  12663. @item MAX
  12664. Maximal value of metadata value.
  12665. @item VAL
  12666. Current metadata key value.
  12667. @end table
  12668. The color is defined as 0xAABBGGRR.
  12669. @end table
  12670. Example using metadata from @ref{signalstats} filter:
  12671. @example
  12672. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12673. @end example
  12674. Example using metadata from @ref{ebur128} filter:
  12675. @example
  12676. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12677. @end example
  12678. @anchor{ebur128}
  12679. @section ebur128
  12680. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12681. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12682. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12683. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12684. The filter also has a video output (see the @var{video} option) with a real
  12685. time graph to observe the loudness evolution. The graphic contains the logged
  12686. message mentioned above, so it is not printed anymore when this option is set,
  12687. unless the verbose logging is set. The main graphing area contains the
  12688. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12689. the momentary loudness (400 milliseconds).
  12690. More information about the Loudness Recommendation EBU R128 on
  12691. @url{http://tech.ebu.ch/loudness}.
  12692. The filter accepts the following options:
  12693. @table @option
  12694. @item video
  12695. Activate the video output. The audio stream is passed unchanged whether this
  12696. option is set or no. The video stream will be the first output stream if
  12697. activated. Default is @code{0}.
  12698. @item size
  12699. Set the video size. This option is for video only. For the syntax of this
  12700. option, check the
  12701. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12702. Default and minimum resolution is @code{640x480}.
  12703. @item meter
  12704. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12705. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12706. other integer value between this range is allowed.
  12707. @item metadata
  12708. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12709. into 100ms output frames, each of them containing various loudness information
  12710. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12711. Default is @code{0}.
  12712. @item framelog
  12713. Force the frame logging level.
  12714. Available values are:
  12715. @table @samp
  12716. @item info
  12717. information logging level
  12718. @item verbose
  12719. verbose logging level
  12720. @end table
  12721. By default, the logging level is set to @var{info}. If the @option{video} or
  12722. the @option{metadata} options are set, it switches to @var{verbose}.
  12723. @item peak
  12724. Set peak mode(s).
  12725. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12726. values are:
  12727. @table @samp
  12728. @item none
  12729. Disable any peak mode (default).
  12730. @item sample
  12731. Enable sample-peak mode.
  12732. Simple peak mode looking for the higher sample value. It logs a message
  12733. for sample-peak (identified by @code{SPK}).
  12734. @item true
  12735. Enable true-peak mode.
  12736. If enabled, the peak lookup is done on an over-sampled version of the input
  12737. stream for better peak accuracy. It logs a message for true-peak.
  12738. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12739. This mode requires a build with @code{libswresample}.
  12740. @end table
  12741. @item dualmono
  12742. Treat mono input files as "dual mono". If a mono file is intended for playback
  12743. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12744. If set to @code{true}, this option will compensate for this effect.
  12745. Multi-channel input files are not affected by this option.
  12746. @item panlaw
  12747. Set a specific pan law to be used for the measurement of dual mono files.
  12748. This parameter is optional, and has a default value of -3.01dB.
  12749. @end table
  12750. @subsection Examples
  12751. @itemize
  12752. @item
  12753. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12754. @example
  12755. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12756. @end example
  12757. @item
  12758. Run an analysis with @command{ffmpeg}:
  12759. @example
  12760. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12761. @end example
  12762. @end itemize
  12763. @section interleave, ainterleave
  12764. Temporally interleave frames from several inputs.
  12765. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12766. These filters read frames from several inputs and send the oldest
  12767. queued frame to the output.
  12768. Input streams must have well defined, monotonically increasing frame
  12769. timestamp values.
  12770. In order to submit one frame to output, these filters need to enqueue
  12771. at least one frame for each input, so they cannot work in case one
  12772. input is not yet terminated and will not receive incoming frames.
  12773. For example consider the case when one input is a @code{select} filter
  12774. which always drops input frames. The @code{interleave} filter will keep
  12775. reading from that input, but it will never be able to send new frames
  12776. to output until the input sends an end-of-stream signal.
  12777. Also, depending on inputs synchronization, the filters will drop
  12778. frames in case one input receives more frames than the other ones, and
  12779. the queue is already filled.
  12780. These filters accept the following options:
  12781. @table @option
  12782. @item nb_inputs, n
  12783. Set the number of different inputs, it is 2 by default.
  12784. @end table
  12785. @subsection Examples
  12786. @itemize
  12787. @item
  12788. Interleave frames belonging to different streams using @command{ffmpeg}:
  12789. @example
  12790. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12791. @end example
  12792. @item
  12793. Add flickering blur effect:
  12794. @example
  12795. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12796. @end example
  12797. @end itemize
  12798. @section metadata, ametadata
  12799. Manipulate frame metadata.
  12800. This filter accepts the following options:
  12801. @table @option
  12802. @item mode
  12803. Set mode of operation of the filter.
  12804. Can be one of the following:
  12805. @table @samp
  12806. @item select
  12807. If both @code{value} and @code{key} is set, select frames
  12808. which have such metadata. If only @code{key} is set, select
  12809. every frame that has such key in metadata.
  12810. @item add
  12811. Add new metadata @code{key} and @code{value}. If key is already available
  12812. do nothing.
  12813. @item modify
  12814. Modify value of already present key.
  12815. @item delete
  12816. If @code{value} is set, delete only keys that have such value.
  12817. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12818. the frame.
  12819. @item print
  12820. Print key and its value if metadata was found. If @code{key} is not set print all
  12821. metadata values available in frame.
  12822. @end table
  12823. @item key
  12824. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12825. @item value
  12826. Set metadata value which will be used. This option is mandatory for
  12827. @code{modify} and @code{add} mode.
  12828. @item function
  12829. Which function to use when comparing metadata value and @code{value}.
  12830. Can be one of following:
  12831. @table @samp
  12832. @item same_str
  12833. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12834. @item starts_with
  12835. Values are interpreted as strings, returns true if metadata value starts with
  12836. the @code{value} option string.
  12837. @item less
  12838. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12839. @item equal
  12840. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12841. @item greater
  12842. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12843. @item expr
  12844. Values are interpreted as floats, returns true if expression from option @code{expr}
  12845. evaluates to true.
  12846. @end table
  12847. @item expr
  12848. Set expression which is used when @code{function} is set to @code{expr}.
  12849. The expression is evaluated through the eval API and can contain the following
  12850. constants:
  12851. @table @option
  12852. @item VALUE1
  12853. Float representation of @code{value} from metadata key.
  12854. @item VALUE2
  12855. Float representation of @code{value} as supplied by user in @code{value} option.
  12856. @end table
  12857. @item file
  12858. If specified in @code{print} mode, output is written to the named file. Instead of
  12859. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12860. for standard output. If @code{file} option is not set, output is written to the log
  12861. with AV_LOG_INFO loglevel.
  12862. @end table
  12863. @subsection Examples
  12864. @itemize
  12865. @item
  12866. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12867. between 0 and 1.
  12868. @example
  12869. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12870. @end example
  12871. @item
  12872. Print silencedetect output to file @file{metadata.txt}.
  12873. @example
  12874. silencedetect,ametadata=mode=print:file=metadata.txt
  12875. @end example
  12876. @item
  12877. Direct all metadata to a pipe with file descriptor 4.
  12878. @example
  12879. metadata=mode=print:file='pipe\:4'
  12880. @end example
  12881. @end itemize
  12882. @section perms, aperms
  12883. Set read/write permissions for the output frames.
  12884. These filters are mainly aimed at developers to test direct path in the
  12885. following filter in the filtergraph.
  12886. The filters accept the following options:
  12887. @table @option
  12888. @item mode
  12889. Select the permissions mode.
  12890. It accepts the following values:
  12891. @table @samp
  12892. @item none
  12893. Do nothing. This is the default.
  12894. @item ro
  12895. Set all the output frames read-only.
  12896. @item rw
  12897. Set all the output frames directly writable.
  12898. @item toggle
  12899. Make the frame read-only if writable, and writable if read-only.
  12900. @item random
  12901. Set each output frame read-only or writable randomly.
  12902. @end table
  12903. @item seed
  12904. Set the seed for the @var{random} mode, must be an integer included between
  12905. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12906. @code{-1}, the filter will try to use a good random seed on a best effort
  12907. basis.
  12908. @end table
  12909. Note: in case of auto-inserted filter between the permission filter and the
  12910. following one, the permission might not be received as expected in that
  12911. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12912. perms/aperms filter can avoid this problem.
  12913. @section realtime, arealtime
  12914. Slow down filtering to match real time approximatively.
  12915. These filters will pause the filtering for a variable amount of time to
  12916. match the output rate with the input timestamps.
  12917. They are similar to the @option{re} option to @code{ffmpeg}.
  12918. They accept the following options:
  12919. @table @option
  12920. @item limit
  12921. Time limit for the pauses. Any pause longer than that will be considered
  12922. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12923. @end table
  12924. @anchor{select}
  12925. @section select, aselect
  12926. Select frames to pass in output.
  12927. This filter accepts the following options:
  12928. @table @option
  12929. @item expr, e
  12930. Set expression, which is evaluated for each input frame.
  12931. If the expression is evaluated to zero, the frame is discarded.
  12932. If the evaluation result is negative or NaN, the frame is sent to the
  12933. first output; otherwise it is sent to the output with index
  12934. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12935. For example a value of @code{1.2} corresponds to the output with index
  12936. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12937. @item outputs, n
  12938. Set the number of outputs. The output to which to send the selected
  12939. frame is based on the result of the evaluation. Default value is 1.
  12940. @end table
  12941. The expression can contain the following constants:
  12942. @table @option
  12943. @item n
  12944. The (sequential) number of the filtered frame, starting from 0.
  12945. @item selected_n
  12946. The (sequential) number of the selected frame, starting from 0.
  12947. @item prev_selected_n
  12948. The sequential number of the last selected frame. It's NAN if undefined.
  12949. @item TB
  12950. The timebase of the input timestamps.
  12951. @item pts
  12952. The PTS (Presentation TimeStamp) of the filtered video frame,
  12953. expressed in @var{TB} units. It's NAN if undefined.
  12954. @item t
  12955. The PTS of the filtered video frame,
  12956. expressed in seconds. It's NAN if undefined.
  12957. @item prev_pts
  12958. The PTS of the previously filtered video frame. It's NAN if undefined.
  12959. @item prev_selected_pts
  12960. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12961. @item prev_selected_t
  12962. The PTS of the last previously selected video frame. It's NAN if undefined.
  12963. @item start_pts
  12964. The PTS of the first video frame in the video. It's NAN if undefined.
  12965. @item start_t
  12966. The time of the first video frame in the video. It's NAN if undefined.
  12967. @item pict_type @emph{(video only)}
  12968. The type of the filtered frame. It can assume one of the following
  12969. values:
  12970. @table @option
  12971. @item I
  12972. @item P
  12973. @item B
  12974. @item S
  12975. @item SI
  12976. @item SP
  12977. @item BI
  12978. @end table
  12979. @item interlace_type @emph{(video only)}
  12980. The frame interlace type. It can assume one of the following values:
  12981. @table @option
  12982. @item PROGRESSIVE
  12983. The frame is progressive (not interlaced).
  12984. @item TOPFIRST
  12985. The frame is top-field-first.
  12986. @item BOTTOMFIRST
  12987. The frame is bottom-field-first.
  12988. @end table
  12989. @item consumed_sample_n @emph{(audio only)}
  12990. the number of selected samples before the current frame
  12991. @item samples_n @emph{(audio only)}
  12992. the number of samples in the current frame
  12993. @item sample_rate @emph{(audio only)}
  12994. the input sample rate
  12995. @item key
  12996. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12997. @item pos
  12998. the position in the file of the filtered frame, -1 if the information
  12999. is not available (e.g. for synthetic video)
  13000. @item scene @emph{(video only)}
  13001. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13002. probability for the current frame to introduce a new scene, while a higher
  13003. value means the current frame is more likely to be one (see the example below)
  13004. @item concatdec_select
  13005. The concat demuxer can select only part of a concat input file by setting an
  13006. inpoint and an outpoint, but the output packets may not be entirely contained
  13007. in the selected interval. By using this variable, it is possible to skip frames
  13008. generated by the concat demuxer which are not exactly contained in the selected
  13009. interval.
  13010. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13011. and the @var{lavf.concat.duration} packet metadata values which are also
  13012. present in the decoded frames.
  13013. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13014. start_time and either the duration metadata is missing or the frame pts is less
  13015. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13016. missing.
  13017. That basically means that an input frame is selected if its pts is within the
  13018. interval set by the concat demuxer.
  13019. @end table
  13020. The default value of the select expression is "1".
  13021. @subsection Examples
  13022. @itemize
  13023. @item
  13024. Select all frames in input:
  13025. @example
  13026. select
  13027. @end example
  13028. The example above is the same as:
  13029. @example
  13030. select=1
  13031. @end example
  13032. @item
  13033. Skip all frames:
  13034. @example
  13035. select=0
  13036. @end example
  13037. @item
  13038. Select only I-frames:
  13039. @example
  13040. select='eq(pict_type\,I)'
  13041. @end example
  13042. @item
  13043. Select one frame every 100:
  13044. @example
  13045. select='not(mod(n\,100))'
  13046. @end example
  13047. @item
  13048. Select only frames contained in the 10-20 time interval:
  13049. @example
  13050. select=between(t\,10\,20)
  13051. @end example
  13052. @item
  13053. Select only I-frames contained in the 10-20 time interval:
  13054. @example
  13055. select=between(t\,10\,20)*eq(pict_type\,I)
  13056. @end example
  13057. @item
  13058. Select frames with a minimum distance of 10 seconds:
  13059. @example
  13060. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13061. @end example
  13062. @item
  13063. Use aselect to select only audio frames with samples number > 100:
  13064. @example
  13065. aselect='gt(samples_n\,100)'
  13066. @end example
  13067. @item
  13068. Create a mosaic of the first scenes:
  13069. @example
  13070. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13071. @end example
  13072. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13073. choice.
  13074. @item
  13075. Send even and odd frames to separate outputs, and compose them:
  13076. @example
  13077. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13078. @end example
  13079. @item
  13080. Select useful frames from an ffconcat file which is using inpoints and
  13081. outpoints but where the source files are not intra frame only.
  13082. @example
  13083. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13084. @end example
  13085. @end itemize
  13086. @section sendcmd, asendcmd
  13087. Send commands to filters in the filtergraph.
  13088. These filters read commands to be sent to other filters in the
  13089. filtergraph.
  13090. @code{sendcmd} must be inserted between two video filters,
  13091. @code{asendcmd} must be inserted between two audio filters, but apart
  13092. from that they act the same way.
  13093. The specification of commands can be provided in the filter arguments
  13094. with the @var{commands} option, or in a file specified by the
  13095. @var{filename} option.
  13096. These filters accept the following options:
  13097. @table @option
  13098. @item commands, c
  13099. Set the commands to be read and sent to the other filters.
  13100. @item filename, f
  13101. Set the filename of the commands to be read and sent to the other
  13102. filters.
  13103. @end table
  13104. @subsection Commands syntax
  13105. A commands description consists of a sequence of interval
  13106. specifications, comprising a list of commands to be executed when a
  13107. particular event related to that interval occurs. The occurring event
  13108. is typically the current frame time entering or leaving a given time
  13109. interval.
  13110. An interval is specified by the following syntax:
  13111. @example
  13112. @var{START}[-@var{END}] @var{COMMANDS};
  13113. @end example
  13114. The time interval is specified by the @var{START} and @var{END} times.
  13115. @var{END} is optional and defaults to the maximum time.
  13116. The current frame time is considered within the specified interval if
  13117. it is included in the interval [@var{START}, @var{END}), that is when
  13118. the time is greater or equal to @var{START} and is lesser than
  13119. @var{END}.
  13120. @var{COMMANDS} consists of a sequence of one or more command
  13121. specifications, separated by ",", relating to that interval. The
  13122. syntax of a command specification is given by:
  13123. @example
  13124. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13125. @end example
  13126. @var{FLAGS} is optional and specifies the type of events relating to
  13127. the time interval which enable sending the specified command, and must
  13128. be a non-null sequence of identifier flags separated by "+" or "|" and
  13129. enclosed between "[" and "]".
  13130. The following flags are recognized:
  13131. @table @option
  13132. @item enter
  13133. The command is sent when the current frame timestamp enters the
  13134. specified interval. In other words, the command is sent when the
  13135. previous frame timestamp was not in the given interval, and the
  13136. current is.
  13137. @item leave
  13138. The command is sent when the current frame timestamp leaves the
  13139. specified interval. In other words, the command is sent when the
  13140. previous frame timestamp was in the given interval, and the
  13141. current is not.
  13142. @end table
  13143. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13144. assumed.
  13145. @var{TARGET} specifies the target of the command, usually the name of
  13146. the filter class or a specific filter instance name.
  13147. @var{COMMAND} specifies the name of the command for the target filter.
  13148. @var{ARG} is optional and specifies the optional list of argument for
  13149. the given @var{COMMAND}.
  13150. Between one interval specification and another, whitespaces, or
  13151. sequences of characters starting with @code{#} until the end of line,
  13152. are ignored and can be used to annotate comments.
  13153. A simplified BNF description of the commands specification syntax
  13154. follows:
  13155. @example
  13156. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13157. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13158. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13159. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13160. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13161. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13162. @end example
  13163. @subsection Examples
  13164. @itemize
  13165. @item
  13166. Specify audio tempo change at second 4:
  13167. @example
  13168. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13169. @end example
  13170. @item
  13171. Specify a list of drawtext and hue commands in a file.
  13172. @example
  13173. # show text in the interval 5-10
  13174. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13175. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13176. # desaturate the image in the interval 15-20
  13177. 15.0-20.0 [enter] hue s 0,
  13178. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13179. [leave] hue s 1,
  13180. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13181. # apply an exponential saturation fade-out effect, starting from time 25
  13182. 25 [enter] hue s exp(25-t)
  13183. @end example
  13184. A filtergraph allowing to read and process the above command list
  13185. stored in a file @file{test.cmd}, can be specified with:
  13186. @example
  13187. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13188. @end example
  13189. @end itemize
  13190. @anchor{setpts}
  13191. @section setpts, asetpts
  13192. Change the PTS (presentation timestamp) of the input frames.
  13193. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13194. This filter accepts the following options:
  13195. @table @option
  13196. @item expr
  13197. The expression which is evaluated for each frame to construct its timestamp.
  13198. @end table
  13199. The expression is evaluated through the eval API and can contain the following
  13200. constants:
  13201. @table @option
  13202. @item FRAME_RATE
  13203. frame rate, only defined for constant frame-rate video
  13204. @item PTS
  13205. The presentation timestamp in input
  13206. @item N
  13207. The count of the input frame for video or the number of consumed samples,
  13208. not including the current frame for audio, starting from 0.
  13209. @item NB_CONSUMED_SAMPLES
  13210. The number of consumed samples, not including the current frame (only
  13211. audio)
  13212. @item NB_SAMPLES, S
  13213. The number of samples in the current frame (only audio)
  13214. @item SAMPLE_RATE, SR
  13215. The audio sample rate.
  13216. @item STARTPTS
  13217. The PTS of the first frame.
  13218. @item STARTT
  13219. the time in seconds of the first frame
  13220. @item INTERLACED
  13221. State whether the current frame is interlaced.
  13222. @item T
  13223. the time in seconds of the current frame
  13224. @item POS
  13225. original position in the file of the frame, or undefined if undefined
  13226. for the current frame
  13227. @item PREV_INPTS
  13228. The previous input PTS.
  13229. @item PREV_INT
  13230. previous input time in seconds
  13231. @item PREV_OUTPTS
  13232. The previous output PTS.
  13233. @item PREV_OUTT
  13234. previous output time in seconds
  13235. @item RTCTIME
  13236. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13237. instead.
  13238. @item RTCSTART
  13239. The wallclock (RTC) time at the start of the movie in microseconds.
  13240. @item TB
  13241. The timebase of the input timestamps.
  13242. @end table
  13243. @subsection Examples
  13244. @itemize
  13245. @item
  13246. Start counting PTS from zero
  13247. @example
  13248. setpts=PTS-STARTPTS
  13249. @end example
  13250. @item
  13251. Apply fast motion effect:
  13252. @example
  13253. setpts=0.5*PTS
  13254. @end example
  13255. @item
  13256. Apply slow motion effect:
  13257. @example
  13258. setpts=2.0*PTS
  13259. @end example
  13260. @item
  13261. Set fixed rate of 25 frames per second:
  13262. @example
  13263. setpts=N/(25*TB)
  13264. @end example
  13265. @item
  13266. Set fixed rate 25 fps with some jitter:
  13267. @example
  13268. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13269. @end example
  13270. @item
  13271. Apply an offset of 10 seconds to the input PTS:
  13272. @example
  13273. setpts=PTS+10/TB
  13274. @end example
  13275. @item
  13276. Generate timestamps from a "live source" and rebase onto the current timebase:
  13277. @example
  13278. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13279. @end example
  13280. @item
  13281. Generate timestamps by counting samples:
  13282. @example
  13283. asetpts=N/SR/TB
  13284. @end example
  13285. @end itemize
  13286. @section settb, asettb
  13287. Set the timebase to use for the output frames timestamps.
  13288. It is mainly useful for testing timebase configuration.
  13289. It accepts the following parameters:
  13290. @table @option
  13291. @item expr, tb
  13292. The expression which is evaluated into the output timebase.
  13293. @end table
  13294. The value for @option{tb} is an arithmetic expression representing a
  13295. rational. The expression can contain the constants "AVTB" (the default
  13296. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13297. audio only). Default value is "intb".
  13298. @subsection Examples
  13299. @itemize
  13300. @item
  13301. Set the timebase to 1/25:
  13302. @example
  13303. settb=expr=1/25
  13304. @end example
  13305. @item
  13306. Set the timebase to 1/10:
  13307. @example
  13308. settb=expr=0.1
  13309. @end example
  13310. @item
  13311. Set the timebase to 1001/1000:
  13312. @example
  13313. settb=1+0.001
  13314. @end example
  13315. @item
  13316. Set the timebase to 2*intb:
  13317. @example
  13318. settb=2*intb
  13319. @end example
  13320. @item
  13321. Set the default timebase value:
  13322. @example
  13323. settb=AVTB
  13324. @end example
  13325. @end itemize
  13326. @section showcqt
  13327. Convert input audio to a video output representing frequency spectrum
  13328. logarithmically using Brown-Puckette constant Q transform algorithm with
  13329. direct frequency domain coefficient calculation (but the transform itself
  13330. is not really constant Q, instead the Q factor is actually variable/clamped),
  13331. with musical tone scale, from E0 to D#10.
  13332. The filter accepts the following options:
  13333. @table @option
  13334. @item size, s
  13335. Specify the video size for the output. It must be even. For the syntax of this option,
  13336. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13337. Default value is @code{1920x1080}.
  13338. @item fps, rate, r
  13339. Set the output frame rate. Default value is @code{25}.
  13340. @item bar_h
  13341. Set the bargraph height. It must be even. Default value is @code{-1} which
  13342. computes the bargraph height automatically.
  13343. @item axis_h
  13344. Set the axis height. It must be even. Default value is @code{-1} which computes
  13345. the axis height automatically.
  13346. @item sono_h
  13347. Set the sonogram height. It must be even. Default value is @code{-1} which
  13348. computes the sonogram height automatically.
  13349. @item fullhd
  13350. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13351. instead. Default value is @code{1}.
  13352. @item sono_v, volume
  13353. Specify the sonogram volume expression. It can contain variables:
  13354. @table @option
  13355. @item bar_v
  13356. the @var{bar_v} evaluated expression
  13357. @item frequency, freq, f
  13358. the frequency where it is evaluated
  13359. @item timeclamp, tc
  13360. the value of @var{timeclamp} option
  13361. @end table
  13362. and functions:
  13363. @table @option
  13364. @item a_weighting(f)
  13365. A-weighting of equal loudness
  13366. @item b_weighting(f)
  13367. B-weighting of equal loudness
  13368. @item c_weighting(f)
  13369. C-weighting of equal loudness.
  13370. @end table
  13371. Default value is @code{16}.
  13372. @item bar_v, volume2
  13373. Specify the bargraph volume expression. It can contain variables:
  13374. @table @option
  13375. @item sono_v
  13376. the @var{sono_v} evaluated expression
  13377. @item frequency, freq, f
  13378. the frequency where it is evaluated
  13379. @item timeclamp, tc
  13380. the value of @var{timeclamp} option
  13381. @end table
  13382. and functions:
  13383. @table @option
  13384. @item a_weighting(f)
  13385. A-weighting of equal loudness
  13386. @item b_weighting(f)
  13387. B-weighting of equal loudness
  13388. @item c_weighting(f)
  13389. C-weighting of equal loudness.
  13390. @end table
  13391. Default value is @code{sono_v}.
  13392. @item sono_g, gamma
  13393. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13394. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13395. Acceptable range is @code{[1, 7]}.
  13396. @item bar_g, gamma2
  13397. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13398. @code{[1, 7]}.
  13399. @item bar_t
  13400. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13401. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13402. @item timeclamp, tc
  13403. Specify the transform timeclamp. At low frequency, there is trade-off between
  13404. accuracy in time domain and frequency domain. If timeclamp is lower,
  13405. event in time domain is represented more accurately (such as fast bass drum),
  13406. otherwise event in frequency domain is represented more accurately
  13407. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13408. @item attack
  13409. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13410. limits future samples by applying asymmetric windowing in time domain, useful
  13411. when low latency is required. Accepted range is @code{[0, 1]}.
  13412. @item basefreq
  13413. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13414. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13415. @item endfreq
  13416. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13417. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13418. @item coeffclamp
  13419. This option is deprecated and ignored.
  13420. @item tlength
  13421. Specify the transform length in time domain. Use this option to control accuracy
  13422. trade-off between time domain and frequency domain at every frequency sample.
  13423. It can contain variables:
  13424. @table @option
  13425. @item frequency, freq, f
  13426. the frequency where it is evaluated
  13427. @item timeclamp, tc
  13428. the value of @var{timeclamp} option.
  13429. @end table
  13430. Default value is @code{384*tc/(384+tc*f)}.
  13431. @item count
  13432. Specify the transform count for every video frame. Default value is @code{6}.
  13433. Acceptable range is @code{[1, 30]}.
  13434. @item fcount
  13435. Specify the transform count for every single pixel. Default value is @code{0},
  13436. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13437. @item fontfile
  13438. Specify font file for use with freetype to draw the axis. If not specified,
  13439. use embedded font. Note that drawing with font file or embedded font is not
  13440. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13441. option instead.
  13442. @item font
  13443. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13444. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13445. @item fontcolor
  13446. Specify font color expression. This is arithmetic expression that should return
  13447. integer value 0xRRGGBB. It can contain variables:
  13448. @table @option
  13449. @item frequency, freq, f
  13450. the frequency where it is evaluated
  13451. @item timeclamp, tc
  13452. the value of @var{timeclamp} option
  13453. @end table
  13454. and functions:
  13455. @table @option
  13456. @item midi(f)
  13457. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13458. @item r(x), g(x), b(x)
  13459. red, green, and blue value of intensity x.
  13460. @end table
  13461. Default value is @code{st(0, (midi(f)-59.5)/12);
  13462. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13463. r(1-ld(1)) + b(ld(1))}.
  13464. @item axisfile
  13465. Specify image file to draw the axis. This option override @var{fontfile} and
  13466. @var{fontcolor} option.
  13467. @item axis, text
  13468. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13469. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13470. Default value is @code{1}.
  13471. @item csp
  13472. Set colorspace. The accepted values are:
  13473. @table @samp
  13474. @item unspecified
  13475. Unspecified (default)
  13476. @item bt709
  13477. BT.709
  13478. @item fcc
  13479. FCC
  13480. @item bt470bg
  13481. BT.470BG or BT.601-6 625
  13482. @item smpte170m
  13483. SMPTE-170M or BT.601-6 525
  13484. @item smpte240m
  13485. SMPTE-240M
  13486. @item bt2020ncl
  13487. BT.2020 with non-constant luminance
  13488. @end table
  13489. @item cscheme
  13490. Set spectrogram color scheme. This is list of floating point values with format
  13491. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13492. The default is @code{1|0.5|0|0|0.5|1}.
  13493. @end table
  13494. @subsection Examples
  13495. @itemize
  13496. @item
  13497. Playing audio while showing the spectrum:
  13498. @example
  13499. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13500. @end example
  13501. @item
  13502. Same as above, but with frame rate 30 fps:
  13503. @example
  13504. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13505. @end example
  13506. @item
  13507. Playing at 1280x720:
  13508. @example
  13509. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13510. @end example
  13511. @item
  13512. Disable sonogram display:
  13513. @example
  13514. sono_h=0
  13515. @end example
  13516. @item
  13517. A1 and its harmonics: A1, A2, (near)E3, A3:
  13518. @example
  13519. 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),
  13520. asplit[a][out1]; [a] showcqt [out0]'
  13521. @end example
  13522. @item
  13523. Same as above, but with more accuracy in frequency domain:
  13524. @example
  13525. 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),
  13526. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13527. @end example
  13528. @item
  13529. Custom volume:
  13530. @example
  13531. bar_v=10:sono_v=bar_v*a_weighting(f)
  13532. @end example
  13533. @item
  13534. Custom gamma, now spectrum is linear to the amplitude.
  13535. @example
  13536. bar_g=2:sono_g=2
  13537. @end example
  13538. @item
  13539. Custom tlength equation:
  13540. @example
  13541. 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)))'
  13542. @end example
  13543. @item
  13544. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13545. @example
  13546. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13547. @end example
  13548. @item
  13549. Custom font using fontconfig:
  13550. @example
  13551. font='Courier New,Monospace,mono|bold'
  13552. @end example
  13553. @item
  13554. Custom frequency range with custom axis using image file:
  13555. @example
  13556. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13557. @end example
  13558. @end itemize
  13559. @section showfreqs
  13560. Convert input audio to video output representing the audio power spectrum.
  13561. Audio amplitude is on Y-axis while frequency is on X-axis.
  13562. The filter accepts the following options:
  13563. @table @option
  13564. @item size, s
  13565. Specify size of video. For the syntax of this option, check the
  13566. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13567. Default is @code{1024x512}.
  13568. @item mode
  13569. Set display mode.
  13570. This set how each frequency bin will be represented.
  13571. It accepts the following values:
  13572. @table @samp
  13573. @item line
  13574. @item bar
  13575. @item dot
  13576. @end table
  13577. Default is @code{bar}.
  13578. @item ascale
  13579. Set amplitude scale.
  13580. It accepts the following values:
  13581. @table @samp
  13582. @item lin
  13583. Linear scale.
  13584. @item sqrt
  13585. Square root scale.
  13586. @item cbrt
  13587. Cubic root scale.
  13588. @item log
  13589. Logarithmic scale.
  13590. @end table
  13591. Default is @code{log}.
  13592. @item fscale
  13593. Set frequency scale.
  13594. It accepts the following values:
  13595. @table @samp
  13596. @item lin
  13597. Linear scale.
  13598. @item log
  13599. Logarithmic scale.
  13600. @item rlog
  13601. Reverse logarithmic scale.
  13602. @end table
  13603. Default is @code{lin}.
  13604. @item win_size
  13605. Set window size.
  13606. It accepts the following values:
  13607. @table @samp
  13608. @item w16
  13609. @item w32
  13610. @item w64
  13611. @item w128
  13612. @item w256
  13613. @item w512
  13614. @item w1024
  13615. @item w2048
  13616. @item w4096
  13617. @item w8192
  13618. @item w16384
  13619. @item w32768
  13620. @item w65536
  13621. @end table
  13622. Default is @code{w2048}
  13623. @item win_func
  13624. Set windowing function.
  13625. It accepts the following values:
  13626. @table @samp
  13627. @item rect
  13628. @item bartlett
  13629. @item hanning
  13630. @item hamming
  13631. @item blackman
  13632. @item welch
  13633. @item flattop
  13634. @item bharris
  13635. @item bnuttall
  13636. @item bhann
  13637. @item sine
  13638. @item nuttall
  13639. @item lanczos
  13640. @item gauss
  13641. @item tukey
  13642. @item dolph
  13643. @item cauchy
  13644. @item parzen
  13645. @item poisson
  13646. @end table
  13647. Default is @code{hanning}.
  13648. @item overlap
  13649. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13650. which means optimal overlap for selected window function will be picked.
  13651. @item averaging
  13652. Set time averaging. Setting this to 0 will display current maximal peaks.
  13653. Default is @code{1}, which means time averaging is disabled.
  13654. @item colors
  13655. Specify list of colors separated by space or by '|' which will be used to
  13656. draw channel frequencies. Unrecognized or missing colors will be replaced
  13657. by white color.
  13658. @item cmode
  13659. Set channel display mode.
  13660. It accepts the following values:
  13661. @table @samp
  13662. @item combined
  13663. @item separate
  13664. @end table
  13665. Default is @code{combined}.
  13666. @item minamp
  13667. Set minimum amplitude used in @code{log} amplitude scaler.
  13668. @end table
  13669. @anchor{showspectrum}
  13670. @section showspectrum
  13671. Convert input audio to a video output, representing the audio frequency
  13672. spectrum.
  13673. The filter accepts the following options:
  13674. @table @option
  13675. @item size, s
  13676. Specify the video size for the output. For the syntax of this option, check the
  13677. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13678. Default value is @code{640x512}.
  13679. @item slide
  13680. Specify how the spectrum should slide along the window.
  13681. It accepts the following values:
  13682. @table @samp
  13683. @item replace
  13684. the samples start again on the left when they reach the right
  13685. @item scroll
  13686. the samples scroll from right to left
  13687. @item fullframe
  13688. frames are only produced when the samples reach the right
  13689. @item rscroll
  13690. the samples scroll from left to right
  13691. @end table
  13692. Default value is @code{replace}.
  13693. @item mode
  13694. Specify display mode.
  13695. It accepts the following values:
  13696. @table @samp
  13697. @item combined
  13698. all channels are displayed in the same row
  13699. @item separate
  13700. all channels are displayed in separate rows
  13701. @end table
  13702. Default value is @samp{combined}.
  13703. @item color
  13704. Specify display color mode.
  13705. It accepts the following values:
  13706. @table @samp
  13707. @item channel
  13708. each channel is displayed in a separate color
  13709. @item intensity
  13710. each channel is displayed using the same color scheme
  13711. @item rainbow
  13712. each channel is displayed using the rainbow color scheme
  13713. @item moreland
  13714. each channel is displayed using the moreland color scheme
  13715. @item nebulae
  13716. each channel is displayed using the nebulae color scheme
  13717. @item fire
  13718. each channel is displayed using the fire color scheme
  13719. @item fiery
  13720. each channel is displayed using the fiery color scheme
  13721. @item fruit
  13722. each channel is displayed using the fruit color scheme
  13723. @item cool
  13724. each channel is displayed using the cool color scheme
  13725. @end table
  13726. Default value is @samp{channel}.
  13727. @item scale
  13728. Specify scale used for calculating intensity color values.
  13729. It accepts the following values:
  13730. @table @samp
  13731. @item lin
  13732. linear
  13733. @item sqrt
  13734. square root, default
  13735. @item cbrt
  13736. cubic root
  13737. @item log
  13738. logarithmic
  13739. @item 4thrt
  13740. 4th root
  13741. @item 5thrt
  13742. 5th root
  13743. @end table
  13744. Default value is @samp{sqrt}.
  13745. @item saturation
  13746. Set saturation modifier for displayed colors. Negative values provide
  13747. alternative color scheme. @code{0} is no saturation at all.
  13748. Saturation must be in [-10.0, 10.0] range.
  13749. Default value is @code{1}.
  13750. @item win_func
  13751. Set window function.
  13752. It accepts the following values:
  13753. @table @samp
  13754. @item rect
  13755. @item bartlett
  13756. @item hann
  13757. @item hanning
  13758. @item hamming
  13759. @item blackman
  13760. @item welch
  13761. @item flattop
  13762. @item bharris
  13763. @item bnuttall
  13764. @item bhann
  13765. @item sine
  13766. @item nuttall
  13767. @item lanczos
  13768. @item gauss
  13769. @item tukey
  13770. @item dolph
  13771. @item cauchy
  13772. @item parzen
  13773. @item poisson
  13774. @end table
  13775. Default value is @code{hann}.
  13776. @item orientation
  13777. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13778. @code{horizontal}. Default is @code{vertical}.
  13779. @item overlap
  13780. Set ratio of overlap window. Default value is @code{0}.
  13781. When value is @code{1} overlap is set to recommended size for specific
  13782. window function currently used.
  13783. @item gain
  13784. Set scale gain for calculating intensity color values.
  13785. Default value is @code{1}.
  13786. @item data
  13787. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13788. @item rotation
  13789. Set color rotation, must be in [-1.0, 1.0] range.
  13790. Default value is @code{0}.
  13791. @end table
  13792. The usage is very similar to the showwaves filter; see the examples in that
  13793. section.
  13794. @subsection Examples
  13795. @itemize
  13796. @item
  13797. Large window with logarithmic color scaling:
  13798. @example
  13799. showspectrum=s=1280x480:scale=log
  13800. @end example
  13801. @item
  13802. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13803. @example
  13804. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13805. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13806. @end example
  13807. @end itemize
  13808. @section showspectrumpic
  13809. Convert input audio to a single video frame, representing the audio frequency
  13810. spectrum.
  13811. The filter accepts the following options:
  13812. @table @option
  13813. @item size, s
  13814. Specify the video size for the output. For the syntax of this option, check the
  13815. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13816. Default value is @code{4096x2048}.
  13817. @item mode
  13818. Specify display mode.
  13819. It accepts the following values:
  13820. @table @samp
  13821. @item combined
  13822. all channels are displayed in the same row
  13823. @item separate
  13824. all channels are displayed in separate rows
  13825. @end table
  13826. Default value is @samp{combined}.
  13827. @item color
  13828. Specify display color mode.
  13829. It accepts the following values:
  13830. @table @samp
  13831. @item channel
  13832. each channel is displayed in a separate color
  13833. @item intensity
  13834. each channel is displayed using the same color scheme
  13835. @item rainbow
  13836. each channel is displayed using the rainbow color scheme
  13837. @item moreland
  13838. each channel is displayed using the moreland color scheme
  13839. @item nebulae
  13840. each channel is displayed using the nebulae color scheme
  13841. @item fire
  13842. each channel is displayed using the fire color scheme
  13843. @item fiery
  13844. each channel is displayed using the fiery color scheme
  13845. @item fruit
  13846. each channel is displayed using the fruit color scheme
  13847. @item cool
  13848. each channel is displayed using the cool color scheme
  13849. @end table
  13850. Default value is @samp{intensity}.
  13851. @item scale
  13852. Specify scale used for calculating intensity color values.
  13853. It accepts the following values:
  13854. @table @samp
  13855. @item lin
  13856. linear
  13857. @item sqrt
  13858. square root, default
  13859. @item cbrt
  13860. cubic root
  13861. @item log
  13862. logarithmic
  13863. @item 4thrt
  13864. 4th root
  13865. @item 5thrt
  13866. 5th root
  13867. @end table
  13868. Default value is @samp{log}.
  13869. @item saturation
  13870. Set saturation modifier for displayed colors. Negative values provide
  13871. alternative color scheme. @code{0} is no saturation at all.
  13872. Saturation must be in [-10.0, 10.0] range.
  13873. Default value is @code{1}.
  13874. @item win_func
  13875. Set window function.
  13876. It accepts the following values:
  13877. @table @samp
  13878. @item rect
  13879. @item bartlett
  13880. @item hann
  13881. @item hanning
  13882. @item hamming
  13883. @item blackman
  13884. @item welch
  13885. @item flattop
  13886. @item bharris
  13887. @item bnuttall
  13888. @item bhann
  13889. @item sine
  13890. @item nuttall
  13891. @item lanczos
  13892. @item gauss
  13893. @item tukey
  13894. @item dolph
  13895. @item cauchy
  13896. @item parzen
  13897. @item poisson
  13898. @end table
  13899. Default value is @code{hann}.
  13900. @item orientation
  13901. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13902. @code{horizontal}. Default is @code{vertical}.
  13903. @item gain
  13904. Set scale gain for calculating intensity color values.
  13905. Default value is @code{1}.
  13906. @item legend
  13907. Draw time and frequency axes and legends. Default is enabled.
  13908. @item rotation
  13909. Set color rotation, must be in [-1.0, 1.0] range.
  13910. Default value is @code{0}.
  13911. @end table
  13912. @subsection Examples
  13913. @itemize
  13914. @item
  13915. Extract an audio spectrogram of a whole audio track
  13916. in a 1024x1024 picture using @command{ffmpeg}:
  13917. @example
  13918. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13919. @end example
  13920. @end itemize
  13921. @section showvolume
  13922. Convert input audio volume to a video output.
  13923. The filter accepts the following options:
  13924. @table @option
  13925. @item rate, r
  13926. Set video rate.
  13927. @item b
  13928. Set border width, allowed range is [0, 5]. Default is 1.
  13929. @item w
  13930. Set channel width, allowed range is [80, 8192]. Default is 400.
  13931. @item h
  13932. Set channel height, allowed range is [1, 900]. Default is 20.
  13933. @item f
  13934. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13935. @item c
  13936. Set volume color expression.
  13937. The expression can use the following variables:
  13938. @table @option
  13939. @item VOLUME
  13940. Current max volume of channel in dB.
  13941. @item PEAK
  13942. Current peak.
  13943. @item CHANNEL
  13944. Current channel number, starting from 0.
  13945. @end table
  13946. @item t
  13947. If set, displays channel names. Default is enabled.
  13948. @item v
  13949. If set, displays volume values. Default is enabled.
  13950. @item o
  13951. Set orientation, can be @code{horizontal} or @code{vertical},
  13952. default is @code{horizontal}.
  13953. @item s
  13954. Set step size, allowed range s [0, 5]. Default is 0, which means
  13955. step is disabled.
  13956. @end table
  13957. @section showwaves
  13958. Convert input audio to a video output, representing the samples waves.
  13959. The filter accepts the following options:
  13960. @table @option
  13961. @item size, s
  13962. Specify the video size for the output. For the syntax of this option, check the
  13963. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13964. Default value is @code{600x240}.
  13965. @item mode
  13966. Set display mode.
  13967. Available values are:
  13968. @table @samp
  13969. @item point
  13970. Draw a point for each sample.
  13971. @item line
  13972. Draw a vertical line for each sample.
  13973. @item p2p
  13974. Draw a point for each sample and a line between them.
  13975. @item cline
  13976. Draw a centered vertical line for each sample.
  13977. @end table
  13978. Default value is @code{point}.
  13979. @item n
  13980. Set the number of samples which are printed on the same column. A
  13981. larger value will decrease the frame rate. Must be a positive
  13982. integer. This option can be set only if the value for @var{rate}
  13983. is not explicitly specified.
  13984. @item rate, r
  13985. Set the (approximate) output frame rate. This is done by setting the
  13986. option @var{n}. Default value is "25".
  13987. @item split_channels
  13988. Set if channels should be drawn separately or overlap. Default value is 0.
  13989. @item colors
  13990. Set colors separated by '|' which are going to be used for drawing of each channel.
  13991. @item scale
  13992. Set amplitude scale.
  13993. Available values are:
  13994. @table @samp
  13995. @item lin
  13996. Linear.
  13997. @item log
  13998. Logarithmic.
  13999. @item sqrt
  14000. Square root.
  14001. @item cbrt
  14002. Cubic root.
  14003. @end table
  14004. Default is linear.
  14005. @end table
  14006. @subsection Examples
  14007. @itemize
  14008. @item
  14009. Output the input file audio and the corresponding video representation
  14010. at the same time:
  14011. @example
  14012. amovie=a.mp3,asplit[out0],showwaves[out1]
  14013. @end example
  14014. @item
  14015. Create a synthetic signal and show it with showwaves, forcing a
  14016. frame rate of 30 frames per second:
  14017. @example
  14018. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14019. @end example
  14020. @end itemize
  14021. @section showwavespic
  14022. Convert input audio to a single video frame, representing the samples waves.
  14023. The filter accepts the following options:
  14024. @table @option
  14025. @item size, s
  14026. Specify the video size for the output. For the syntax of this option, check the
  14027. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14028. Default value is @code{600x240}.
  14029. @item split_channels
  14030. Set if channels should be drawn separately or overlap. Default value is 0.
  14031. @item colors
  14032. Set colors separated by '|' which are going to be used for drawing of each channel.
  14033. @item scale
  14034. Set amplitude scale.
  14035. Available values are:
  14036. @table @samp
  14037. @item lin
  14038. Linear.
  14039. @item log
  14040. Logarithmic.
  14041. @item sqrt
  14042. Square root.
  14043. @item cbrt
  14044. Cubic root.
  14045. @end table
  14046. Default is linear.
  14047. @end table
  14048. @subsection Examples
  14049. @itemize
  14050. @item
  14051. Extract a channel split representation of the wave form of a whole audio track
  14052. in a 1024x800 picture using @command{ffmpeg}:
  14053. @example
  14054. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14055. @end example
  14056. @end itemize
  14057. @section sidedata, asidedata
  14058. Delete frame side data, or select frames based on it.
  14059. This filter accepts the following options:
  14060. @table @option
  14061. @item mode
  14062. Set mode of operation of the filter.
  14063. Can be one of the following:
  14064. @table @samp
  14065. @item select
  14066. Select every frame with side data of @code{type}.
  14067. @item delete
  14068. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14069. data in the frame.
  14070. @end table
  14071. @item type
  14072. Set side data type used with all modes. Must be set for @code{select} mode. For
  14073. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14074. in @file{libavutil/frame.h}. For example, to choose
  14075. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14076. @end table
  14077. @section spectrumsynth
  14078. Sythesize audio from 2 input video spectrums, first input stream represents
  14079. magnitude across time and second represents phase across time.
  14080. The filter will transform from frequency domain as displayed in videos back
  14081. to time domain as presented in audio output.
  14082. This filter is primarily created for reversing processed @ref{showspectrum}
  14083. filter outputs, but can synthesize sound from other spectrograms too.
  14084. But in such case results are going to be poor if the phase data is not
  14085. available, because in such cases phase data need to be recreated, usually
  14086. its just recreated from random noise.
  14087. For best results use gray only output (@code{channel} color mode in
  14088. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14089. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14090. @code{data} option. Inputs videos should generally use @code{fullframe}
  14091. slide mode as that saves resources needed for decoding video.
  14092. The filter accepts the following options:
  14093. @table @option
  14094. @item sample_rate
  14095. Specify sample rate of output audio, the sample rate of audio from which
  14096. spectrum was generated may differ.
  14097. @item channels
  14098. Set number of channels represented in input video spectrums.
  14099. @item scale
  14100. Set scale which was used when generating magnitude input spectrum.
  14101. Can be @code{lin} or @code{log}. Default is @code{log}.
  14102. @item slide
  14103. Set slide which was used when generating inputs spectrums.
  14104. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14105. Default is @code{fullframe}.
  14106. @item win_func
  14107. Set window function used for resynthesis.
  14108. @item overlap
  14109. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14110. which means optimal overlap for selected window function will be picked.
  14111. @item orientation
  14112. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14113. Default is @code{vertical}.
  14114. @end table
  14115. @subsection Examples
  14116. @itemize
  14117. @item
  14118. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14119. then resynthesize videos back to audio with spectrumsynth:
  14120. @example
  14121. 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
  14122. 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
  14123. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14124. @end example
  14125. @end itemize
  14126. @section split, asplit
  14127. Split input into several identical outputs.
  14128. @code{asplit} works with audio input, @code{split} with video.
  14129. The filter accepts a single parameter which specifies the number of outputs. If
  14130. unspecified, it defaults to 2.
  14131. @subsection Examples
  14132. @itemize
  14133. @item
  14134. Create two separate outputs from the same input:
  14135. @example
  14136. [in] split [out0][out1]
  14137. @end example
  14138. @item
  14139. To create 3 or more outputs, you need to specify the number of
  14140. outputs, like in:
  14141. @example
  14142. [in] asplit=3 [out0][out1][out2]
  14143. @end example
  14144. @item
  14145. Create two separate outputs from the same input, one cropped and
  14146. one padded:
  14147. @example
  14148. [in] split [splitout1][splitout2];
  14149. [splitout1] crop=100:100:0:0 [cropout];
  14150. [splitout2] pad=200:200:100:100 [padout];
  14151. @end example
  14152. @item
  14153. Create 5 copies of the input audio with @command{ffmpeg}:
  14154. @example
  14155. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14156. @end example
  14157. @end itemize
  14158. @section zmq, azmq
  14159. Receive commands sent through a libzmq client, and forward them to
  14160. filters in the filtergraph.
  14161. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14162. must be inserted between two video filters, @code{azmq} between two
  14163. audio filters.
  14164. To enable these filters you need to install the libzmq library and
  14165. headers and configure FFmpeg with @code{--enable-libzmq}.
  14166. For more information about libzmq see:
  14167. @url{http://www.zeromq.org/}
  14168. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14169. receives messages sent through a network interface defined by the
  14170. @option{bind_address} option.
  14171. The received message must be in the form:
  14172. @example
  14173. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14174. @end example
  14175. @var{TARGET} specifies the target of the command, usually the name of
  14176. the filter class or a specific filter instance name.
  14177. @var{COMMAND} specifies the name of the command for the target filter.
  14178. @var{ARG} is optional and specifies the optional argument list for the
  14179. given @var{COMMAND}.
  14180. Upon reception, the message is processed and the corresponding command
  14181. is injected into the filtergraph. Depending on the result, the filter
  14182. will send a reply to the client, adopting the format:
  14183. @example
  14184. @var{ERROR_CODE} @var{ERROR_REASON}
  14185. @var{MESSAGE}
  14186. @end example
  14187. @var{MESSAGE} is optional.
  14188. @subsection Examples
  14189. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14190. be used to send commands processed by these filters.
  14191. Consider the following filtergraph generated by @command{ffplay}
  14192. @example
  14193. ffplay -dumpgraph 1 -f lavfi "
  14194. color=s=100x100:c=red [l];
  14195. color=s=100x100:c=blue [r];
  14196. nullsrc=s=200x100, zmq [bg];
  14197. [bg][l] overlay [bg+l];
  14198. [bg+l][r] overlay=x=100 "
  14199. @end example
  14200. To change the color of the left side of the video, the following
  14201. command can be used:
  14202. @example
  14203. echo Parsed_color_0 c yellow | tools/zmqsend
  14204. @end example
  14205. To change the right side:
  14206. @example
  14207. echo Parsed_color_1 c pink | tools/zmqsend
  14208. @end example
  14209. @c man end MULTIMEDIA FILTERS
  14210. @chapter Multimedia Sources
  14211. @c man begin MULTIMEDIA SOURCES
  14212. Below is a description of the currently available multimedia sources.
  14213. @section amovie
  14214. This is the same as @ref{movie} source, except it selects an audio
  14215. stream by default.
  14216. @anchor{movie}
  14217. @section movie
  14218. Read audio and/or video stream(s) from a movie container.
  14219. It accepts the following parameters:
  14220. @table @option
  14221. @item filename
  14222. The name of the resource to read (not necessarily a file; it can also be a
  14223. device or a stream accessed through some protocol).
  14224. @item format_name, f
  14225. Specifies the format assumed for the movie to read, and can be either
  14226. the name of a container or an input device. If not specified, the
  14227. format is guessed from @var{movie_name} or by probing.
  14228. @item seek_point, sp
  14229. Specifies the seek point in seconds. The frames will be output
  14230. starting from this seek point. The parameter is evaluated with
  14231. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14232. postfix. The default value is "0".
  14233. @item streams, s
  14234. Specifies the streams to read. Several streams can be specified,
  14235. separated by "+". The source will then have as many outputs, in the
  14236. same order. The syntax is explained in the ``Stream specifiers''
  14237. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14238. respectively the default (best suited) video and audio stream. Default
  14239. is "dv", or "da" if the filter is called as "amovie".
  14240. @item stream_index, si
  14241. Specifies the index of the video stream to read. If the value is -1,
  14242. the most suitable video stream will be automatically selected. The default
  14243. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14244. audio instead of video.
  14245. @item loop
  14246. Specifies how many times to read the stream in sequence.
  14247. If the value is 0, the stream will be looped infinitely.
  14248. Default value is "1".
  14249. Note that when the movie is looped the source timestamps are not
  14250. changed, so it will generate non monotonically increasing timestamps.
  14251. @item discontinuity
  14252. Specifies the time difference between frames above which the point is
  14253. considered a timestamp discontinuity which is removed by adjusting the later
  14254. timestamps.
  14255. @end table
  14256. It allows overlaying a second video on top of the main input of
  14257. a filtergraph, as shown in this graph:
  14258. @example
  14259. input -----------> deltapts0 --> overlay --> output
  14260. ^
  14261. |
  14262. movie --> scale--> deltapts1 -------+
  14263. @end example
  14264. @subsection Examples
  14265. @itemize
  14266. @item
  14267. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14268. on top of the input labelled "in":
  14269. @example
  14270. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14271. [in] setpts=PTS-STARTPTS [main];
  14272. [main][over] overlay=16:16 [out]
  14273. @end example
  14274. @item
  14275. Read from a video4linux2 device, and overlay it on top of the input
  14276. labelled "in":
  14277. @example
  14278. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14279. [in] setpts=PTS-STARTPTS [main];
  14280. [main][over] overlay=16:16 [out]
  14281. @end example
  14282. @item
  14283. Read the first video stream and the audio stream with id 0x81 from
  14284. dvd.vob; the video is connected to the pad named "video" and the audio is
  14285. connected to the pad named "audio":
  14286. @example
  14287. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14288. @end example
  14289. @end itemize
  14290. @subsection Commands
  14291. Both movie and amovie support the following commands:
  14292. @table @option
  14293. @item seek
  14294. Perform seek using "av_seek_frame".
  14295. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14296. @itemize
  14297. @item
  14298. @var{stream_index}: If stream_index is -1, a default
  14299. stream is selected, and @var{timestamp} is automatically converted
  14300. from AV_TIME_BASE units to the stream specific time_base.
  14301. @item
  14302. @var{timestamp}: Timestamp in AVStream.time_base units
  14303. or, if no stream is specified, in AV_TIME_BASE units.
  14304. @item
  14305. @var{flags}: Flags which select direction and seeking mode.
  14306. @end itemize
  14307. @item get_duration
  14308. Get movie duration in AV_TIME_BASE units.
  14309. @end table
  14310. @c man end MULTIMEDIA SOURCES