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.

17309 lines
463KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section acrusher
  353. Reduce audio bit resolution.
  354. This filter is bit crusher with enhanced functionality. A bit crusher
  355. is used to audibly reduce number of bits an audio signal is sampled
  356. with. This doesn't change the bit depth at all, it just produces the
  357. effect. Material reduced in bit depth sounds more harsh and "digital".
  358. This filter is able to even round to continous values instead of discrete
  359. bit depths.
  360. Additionally it has a D/C offset which results in different crushing of
  361. the lower and the upper half of the signal.
  362. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  363. Another feature of this filter is the logarithmic mode.
  364. This setting switches from linear distances between bits to logarithmic ones.
  365. The result is a much more "natural" sounding crusher which doesn't gate low
  366. signals for example. The human ear has a logarithmic perception, too
  367. so this kind of crushing is much more pleasant.
  368. Logarithmic crushing is also able to get anti-aliased.
  369. The filter accepts the following options:
  370. @table @option
  371. @item level_in
  372. Set level in.
  373. @item level_out
  374. Set level out.
  375. @item bits
  376. Set bit reduction.
  377. @item mix
  378. Set mixing ammount.
  379. @item mode
  380. Can be linear: @code{lin} or logarithmic: @code{log}.
  381. @item dc
  382. Set DC.
  383. @item aa
  384. Set anti-aliasing.
  385. @item samples
  386. Set sample reduction.
  387. @item lfo
  388. Enable LFO. By default disabled.
  389. @item lforange
  390. Set LFO range.
  391. @item lforate
  392. Set LFO rate.
  393. @end table
  394. @section adelay
  395. Delay one or more audio channels.
  396. Samples in delayed channel are filled with silence.
  397. The filter accepts the following option:
  398. @table @option
  399. @item delays
  400. Set list of delays in milliseconds for each channel separated by '|'.
  401. At least one delay greater than 0 should be provided.
  402. Unused delays will be silently ignored. If number of given delays is
  403. smaller than number of channels all remaining channels will not be delayed.
  404. If you want to delay exact number of samples, append 'S' to number.
  405. @end table
  406. @subsection Examples
  407. @itemize
  408. @item
  409. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  410. the second channel (and any other channels that may be present) unchanged.
  411. @example
  412. adelay=1500|0|500
  413. @end example
  414. @item
  415. Delay second channel by 500 samples, the third channel by 700 samples and leave
  416. the first channel (and any other channels that may be present) unchanged.
  417. @example
  418. adelay=0|500S|700S
  419. @end example
  420. @end itemize
  421. @section aecho
  422. Apply echoing to the input audio.
  423. Echoes are reflected sound and can occur naturally amongst mountains
  424. (and sometimes large buildings) when talking or shouting; digital echo
  425. effects emulate this behaviour and are often used to help fill out the
  426. sound of a single instrument or vocal. The time difference between the
  427. original signal and the reflection is the @code{delay}, and the
  428. loudness of the reflected signal is the @code{decay}.
  429. Multiple echoes can have different delays and decays.
  430. A description of the accepted parameters follows.
  431. @table @option
  432. @item in_gain
  433. Set input gain of reflected signal. Default is @code{0.6}.
  434. @item out_gain
  435. Set output gain of reflected signal. Default is @code{0.3}.
  436. @item delays
  437. Set list of time intervals in milliseconds between original signal and reflections
  438. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  439. Default is @code{1000}.
  440. @item decays
  441. Set list of loudnesses of reflected signals separated by '|'.
  442. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  443. Default is @code{0.5}.
  444. @end table
  445. @subsection Examples
  446. @itemize
  447. @item
  448. Make it sound as if there are twice as many instruments as are actually playing:
  449. @example
  450. aecho=0.8:0.88:60:0.4
  451. @end example
  452. @item
  453. If delay is very short, then it sound like a (metallic) robot playing music:
  454. @example
  455. aecho=0.8:0.88:6:0.4
  456. @end example
  457. @item
  458. A longer delay will sound like an open air concert in the mountains:
  459. @example
  460. aecho=0.8:0.9:1000:0.3
  461. @end example
  462. @item
  463. Same as above but with one more mountain:
  464. @example
  465. aecho=0.8:0.9:1000|1800:0.3|0.25
  466. @end example
  467. @end itemize
  468. @section aemphasis
  469. Audio emphasis filter creates or restores material directly taken from LPs or
  470. emphased CDs with different filter curves. E.g. to store music on vinyl the
  471. signal has to be altered by a filter first to even out the disadvantages of
  472. this recording medium.
  473. Once the material is played back the inverse filter has to be applied to
  474. restore the distortion of the frequency response.
  475. The filter accepts the following options:
  476. @table @option
  477. @item level_in
  478. Set input gain.
  479. @item level_out
  480. Set output gain.
  481. @item mode
  482. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  483. use @code{production} mode. Default is @code{reproduction} mode.
  484. @item type
  485. Set filter type. Selects medium. Can be one of the following:
  486. @table @option
  487. @item col
  488. select Columbia.
  489. @item emi
  490. select EMI.
  491. @item bsi
  492. select BSI (78RPM).
  493. @item riaa
  494. select RIAA.
  495. @item cd
  496. select Compact Disc (CD).
  497. @item 50fm
  498. select 50µs (FM).
  499. @item 75fm
  500. select 75µs (FM).
  501. @item 50kf
  502. select 50µs (FM-KF).
  503. @item 75kf
  504. select 75µs (FM-KF).
  505. @end table
  506. @end table
  507. @section aeval
  508. Modify an audio signal according to the specified expressions.
  509. This filter accepts one or more expressions (one for each channel),
  510. which are evaluated and used to modify a corresponding audio signal.
  511. It accepts the following parameters:
  512. @table @option
  513. @item exprs
  514. Set the '|'-separated expressions list for each separate channel. If
  515. the number of input channels is greater than the number of
  516. expressions, the last specified expression is used for the remaining
  517. output channels.
  518. @item channel_layout, c
  519. Set output channel layout. If not specified, the channel layout is
  520. specified by the number of expressions. If set to @samp{same}, it will
  521. use by default the same input channel layout.
  522. @end table
  523. Each expression in @var{exprs} can contain the following constants and functions:
  524. @table @option
  525. @item ch
  526. channel number of the current expression
  527. @item n
  528. number of the evaluated sample, starting from 0
  529. @item s
  530. sample rate
  531. @item t
  532. time of the evaluated sample expressed in seconds
  533. @item nb_in_channels
  534. @item nb_out_channels
  535. input and output number of channels
  536. @item val(CH)
  537. the value of input channel with number @var{CH}
  538. @end table
  539. Note: this filter is slow. For faster processing you should use a
  540. dedicated filter.
  541. @subsection Examples
  542. @itemize
  543. @item
  544. Half volume:
  545. @example
  546. aeval=val(ch)/2:c=same
  547. @end example
  548. @item
  549. Invert phase of the second channel:
  550. @example
  551. aeval=val(0)|-val(1)
  552. @end example
  553. @end itemize
  554. @anchor{afade}
  555. @section afade
  556. Apply fade-in/out effect to input audio.
  557. A description of the accepted parameters follows.
  558. @table @option
  559. @item type, t
  560. Specify the effect type, can be either @code{in} for fade-in, or
  561. @code{out} for a fade-out effect. Default is @code{in}.
  562. @item start_sample, ss
  563. Specify the number of the start sample for starting to apply the fade
  564. effect. Default is 0.
  565. @item nb_samples, ns
  566. Specify the number of samples for which the fade effect has to last. At
  567. the end of the fade-in effect the output audio will have the same
  568. volume as the input audio, at the end of the fade-out transition
  569. the output audio will be silence. Default is 44100.
  570. @item start_time, st
  571. Specify the start time of the fade effect. Default is 0.
  572. The value must be specified as a time duration; see
  573. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  574. for the accepted syntax.
  575. If set this option is used instead of @var{start_sample}.
  576. @item duration, d
  577. Specify the duration of the fade effect. See
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. At the end of the fade-in effect the output audio will have the same
  581. volume as the input audio, at the end of the fade-out transition
  582. the output audio will be silence.
  583. By default the duration is determined by @var{nb_samples}.
  584. If set this option is used instead of @var{nb_samples}.
  585. @item curve
  586. Set curve for fade transition.
  587. It accepts the following values:
  588. @table @option
  589. @item tri
  590. select triangular, linear slope (default)
  591. @item qsin
  592. select quarter of sine wave
  593. @item hsin
  594. select half of sine wave
  595. @item esin
  596. select exponential sine wave
  597. @item log
  598. select logarithmic
  599. @item ipar
  600. select inverted parabola
  601. @item qua
  602. select quadratic
  603. @item cub
  604. select cubic
  605. @item squ
  606. select square root
  607. @item cbr
  608. select cubic root
  609. @item par
  610. select parabola
  611. @item exp
  612. select exponential
  613. @item iqsin
  614. select inverted quarter of sine wave
  615. @item ihsin
  616. select inverted half of sine wave
  617. @item dese
  618. select double-exponential seat
  619. @item desi
  620. select double-exponential sigmoid
  621. @end table
  622. @end table
  623. @subsection Examples
  624. @itemize
  625. @item
  626. Fade in first 15 seconds of audio:
  627. @example
  628. afade=t=in:ss=0:d=15
  629. @end example
  630. @item
  631. Fade out last 25 seconds of a 900 seconds audio:
  632. @example
  633. afade=t=out:st=875:d=25
  634. @end example
  635. @end itemize
  636. @section afftfilt
  637. Apply arbitrary expressions to samples in frequency domain.
  638. @table @option
  639. @item real
  640. Set frequency domain real expression for each separate channel separated
  641. by '|'. Default is "1".
  642. If the number of input channels is greater than the number of
  643. expressions, the last specified expression is used for the remaining
  644. output channels.
  645. @item imag
  646. Set frequency domain imaginary expression for each separate channel
  647. separated by '|'. If not set, @var{real} option is used.
  648. Each expression in @var{real} and @var{imag} can contain the following
  649. constants:
  650. @table @option
  651. @item sr
  652. sample rate
  653. @item b
  654. current frequency bin number
  655. @item nb
  656. number of available bins
  657. @item ch
  658. channel number of the current expression
  659. @item chs
  660. number of channels
  661. @item pts
  662. current frame pts
  663. @end table
  664. @item win_size
  665. Set window size.
  666. It accepts the following values:
  667. @table @samp
  668. @item w16
  669. @item w32
  670. @item w64
  671. @item w128
  672. @item w256
  673. @item w512
  674. @item w1024
  675. @item w2048
  676. @item w4096
  677. @item w8192
  678. @item w16384
  679. @item w32768
  680. @item w65536
  681. @end table
  682. Default is @code{w4096}
  683. @item win_func
  684. Set window function. Default is @code{hann}.
  685. @item overlap
  686. Set window overlap. If set to 1, the recommended overlap for selected
  687. window function will be picked. Default is @code{0.75}.
  688. @end table
  689. @subsection Examples
  690. @itemize
  691. @item
  692. Leave almost only low frequencies in audio:
  693. @example
  694. afftfilt="1-clip((b/nb)*b,0,1)"
  695. @end example
  696. @end itemize
  697. @anchor{aformat}
  698. @section aformat
  699. Set output format constraints for the input audio. The framework will
  700. negotiate the most appropriate format to minimize conversions.
  701. It accepts the following parameters:
  702. @table @option
  703. @item sample_fmts
  704. A '|'-separated list of requested sample formats.
  705. @item sample_rates
  706. A '|'-separated list of requested sample rates.
  707. @item channel_layouts
  708. A '|'-separated list of requested channel layouts.
  709. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the required syntax.
  711. @end table
  712. If a parameter is omitted, all values are allowed.
  713. Force the output to either unsigned 8-bit or signed 16-bit stereo
  714. @example
  715. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  716. @end example
  717. @section agate
  718. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  719. processing reduces disturbing noise between useful signals.
  720. Gating is done by detecting the volume below a chosen level @var{threshold}
  721. and divide it by the factor set with @var{ratio}. The bottom of the noise
  722. floor is set via @var{range}. Because an exact manipulation of the signal
  723. would cause distortion of the waveform the reduction can be levelled over
  724. time. This is done by setting @var{attack} and @var{release}.
  725. @var{attack} determines how long the signal has to fall below the threshold
  726. before any reduction will occur and @var{release} sets the time the signal
  727. has to raise above the threshold to reduce the reduction again.
  728. Shorter signals than the chosen attack time will be left untouched.
  729. @table @option
  730. @item level_in
  731. Set input level before filtering.
  732. Default is 1. Allowed range is from 0.015625 to 64.
  733. @item range
  734. Set the level of gain reduction when the signal is below the threshold.
  735. Default is 0.06125. Allowed range is from 0 to 1.
  736. @item threshold
  737. If a signal rises above this level the gain reduction is released.
  738. Default is 0.125. Allowed range is from 0 to 1.
  739. @item ratio
  740. Set a ratio about which the signal is reduced.
  741. Default is 2. Allowed range is from 1 to 9000.
  742. @item attack
  743. Amount of milliseconds the signal has to rise above the threshold before gain
  744. reduction stops.
  745. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  746. @item release
  747. Amount of milliseconds the signal has to fall below the threshold before the
  748. reduction is increased again. Default is 250 milliseconds.
  749. Allowed range is from 0.01 to 9000.
  750. @item makeup
  751. Set amount of amplification of signal after processing.
  752. Default is 1. Allowed range is from 1 to 64.
  753. @item knee
  754. Curve the sharp knee around the threshold to enter gain reduction more softly.
  755. Default is 2.828427125. Allowed range is from 1 to 8.
  756. @item detection
  757. Choose if exact signal should be taken for detection or an RMS like one.
  758. Default is rms. Can be peak or rms.
  759. @item link
  760. Choose if the average level between all channels or the louder channel affects
  761. the reduction.
  762. Default is average. Can be average or maximum.
  763. @end table
  764. @section alimiter
  765. The limiter prevents input signal from raising over a desired threshold.
  766. This limiter uses lookahead technology to prevent your signal from distorting.
  767. It means that there is a small delay after signal is processed. Keep in mind
  768. that the delay it produces is the attack time you set.
  769. The filter accepts the following options:
  770. @table @option
  771. @item level_in
  772. Set input gain. Default is 1.
  773. @item level_out
  774. Set output gain. Default is 1.
  775. @item limit
  776. Don't let signals above this level pass the limiter. Default is 1.
  777. @item attack
  778. The limiter will reach its attenuation level in this amount of time in
  779. milliseconds. Default is 5 milliseconds.
  780. @item release
  781. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  782. Default is 50 milliseconds.
  783. @item asc
  784. When gain reduction is always needed ASC takes care of releasing to an
  785. average reduction level rather than reaching a reduction of 0 in the release
  786. time.
  787. @item asc_level
  788. Select how much the release time is affected by ASC, 0 means nearly no changes
  789. in release time while 1 produces higher release times.
  790. @item level
  791. Auto level output signal. Default is enabled.
  792. This normalizes audio back to 0dB if enabled.
  793. @end table
  794. Depending on picked setting it is recommended to upsample input 2x or 4x times
  795. with @ref{aresample} before applying this filter.
  796. @section allpass
  797. Apply a two-pole all-pass filter with central frequency (in Hz)
  798. @var{frequency}, and filter-width @var{width}.
  799. An all-pass filter changes the audio's frequency to phase relationship
  800. without changing its frequency to amplitude relationship.
  801. The filter accepts the following options:
  802. @table @option
  803. @item frequency, f
  804. Set frequency in Hz.
  805. @item width_type
  806. Set method to specify band-width of filter.
  807. @table @option
  808. @item h
  809. Hz
  810. @item q
  811. Q-Factor
  812. @item o
  813. octave
  814. @item s
  815. slope
  816. @end table
  817. @item width, w
  818. Specify the band-width of a filter in width_type units.
  819. @end table
  820. @section aloop
  821. Loop audio samples.
  822. The filter accepts the following options:
  823. @table @option
  824. @item loop
  825. Set the number of loops.
  826. @item size
  827. Set maximal number of samples.
  828. @item start
  829. Set first sample of loop.
  830. @end table
  831. @anchor{amerge}
  832. @section amerge
  833. Merge two or more audio streams into a single multi-channel stream.
  834. The filter accepts the following options:
  835. @table @option
  836. @item inputs
  837. Set the number of inputs. Default is 2.
  838. @end table
  839. If the channel layouts of the inputs are disjoint, and therefore compatible,
  840. the channel layout of the output will be set accordingly and the channels
  841. will be reordered as necessary. If the channel layouts of the inputs are not
  842. disjoint, the output will have all the channels of the first input then all
  843. the channels of the second input, in that order, and the channel layout of
  844. the output will be the default value corresponding to the total number of
  845. channels.
  846. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  847. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  848. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  849. first input, b1 is the first channel of the second input).
  850. On the other hand, if both input are in stereo, the output channels will be
  851. in the default order: a1, a2, b1, b2, and the channel layout will be
  852. arbitrarily set to 4.0, which may or may not be the expected value.
  853. All inputs must have the same sample rate, and format.
  854. If inputs do not have the same duration, the output will stop with the
  855. shortest.
  856. @subsection Examples
  857. @itemize
  858. @item
  859. Merge two mono files into a stereo stream:
  860. @example
  861. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  862. @end example
  863. @item
  864. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  865. @example
  866. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  867. @end example
  868. @end itemize
  869. @section amix
  870. Mixes multiple audio inputs into a single output.
  871. Note that this filter only supports float samples (the @var{amerge}
  872. and @var{pan} audio filters support many formats). If the @var{amix}
  873. input has integer samples then @ref{aresample} will be automatically
  874. inserted to perform the conversion to float samples.
  875. For example
  876. @example
  877. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  878. @end example
  879. will mix 3 input audio streams to a single output with the same duration as the
  880. first input and a dropout transition time of 3 seconds.
  881. It accepts the following parameters:
  882. @table @option
  883. @item inputs
  884. The number of inputs. If unspecified, it defaults to 2.
  885. @item duration
  886. How to determine the end-of-stream.
  887. @table @option
  888. @item longest
  889. The duration of the longest input. (default)
  890. @item shortest
  891. The duration of the shortest input.
  892. @item first
  893. The duration of the first input.
  894. @end table
  895. @item dropout_transition
  896. The transition time, in seconds, for volume renormalization when an input
  897. stream ends. The default value is 2 seconds.
  898. @end table
  899. @section anequalizer
  900. High-order parametric multiband equalizer for each channel.
  901. It accepts the following parameters:
  902. @table @option
  903. @item params
  904. This option string is in format:
  905. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  906. Each equalizer band is separated by '|'.
  907. @table @option
  908. @item chn
  909. Set channel number to which equalization will be applied.
  910. If input doesn't have that channel the entry is ignored.
  911. @item cf
  912. Set central frequency for band.
  913. If input doesn't have that frequency the entry is ignored.
  914. @item w
  915. Set band width in hertz.
  916. @item g
  917. Set band gain in dB.
  918. @item f
  919. Set filter type for band, optional, can be:
  920. @table @samp
  921. @item 0
  922. Butterworth, this is default.
  923. @item 1
  924. Chebyshev type 1.
  925. @item 2
  926. Chebyshev type 2.
  927. @end table
  928. @end table
  929. @item curves
  930. With this option activated frequency response of anequalizer is displayed
  931. in video stream.
  932. @item size
  933. Set video stream size. Only useful if curves option is activated.
  934. @item mgain
  935. Set max gain that will be displayed. Only useful if curves option is activated.
  936. Setting this to reasonable value allows to display gain which is derived from
  937. neighbour bands which are too close to each other and thus produce higher gain
  938. when both are activated.
  939. @item fscale
  940. Set frequency scale used to draw frequency response in video output.
  941. Can be linear or logarithmic. Default is logarithmic.
  942. @item colors
  943. Set color for each channel curve which is going to be displayed in video stream.
  944. This is list of color names separated by space or by '|'.
  945. Unrecognised or missing colors will be replaced by white color.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  951. for first 2 channels using Chebyshev type 1 filter:
  952. @example
  953. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  954. @end example
  955. @end itemize
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item change
  960. Alter existing filter parameters.
  961. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  962. @var{fN} is existing filter number, starting from 0, if no such filter is available
  963. error is returned.
  964. @var{freq} set new frequency parameter.
  965. @var{width} set new width parameter in herz.
  966. @var{gain} set new gain parameter in dB.
  967. Full filter invocation with asendcmd may look like this:
  968. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  969. @end table
  970. @section anull
  971. Pass the audio source unchanged to the output.
  972. @section apad
  973. Pad the end of an audio stream with silence.
  974. This can be used together with @command{ffmpeg} @option{-shortest} to
  975. extend audio streams to the same length as the video stream.
  976. A description of the accepted options follows.
  977. @table @option
  978. @item packet_size
  979. Set silence packet size. Default value is 4096.
  980. @item pad_len
  981. Set the number of samples of silence to add to the end. After the
  982. value is reached, the stream is terminated. This option is mutually
  983. exclusive with @option{whole_len}.
  984. @item whole_len
  985. Set the minimum total number of samples in the output audio stream. If
  986. the value is longer than the input audio length, silence is added to
  987. the end, until the value is reached. This option is mutually exclusive
  988. with @option{pad_len}.
  989. @end table
  990. If neither the @option{pad_len} nor the @option{whole_len} option is
  991. set, the filter will add silence to the end of the input stream
  992. indefinitely.
  993. @subsection Examples
  994. @itemize
  995. @item
  996. Add 1024 samples of silence to the end of the input:
  997. @example
  998. apad=pad_len=1024
  999. @end example
  1000. @item
  1001. Make sure the audio output will contain at least 10000 samples, pad
  1002. the input with silence if required:
  1003. @example
  1004. apad=whole_len=10000
  1005. @end example
  1006. @item
  1007. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1008. video stream will always result the shortest and will be converted
  1009. until the end in the output file when using the @option{shortest}
  1010. option:
  1011. @example
  1012. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1013. @end example
  1014. @end itemize
  1015. @section aphaser
  1016. Add a phasing effect to the input audio.
  1017. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1018. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1019. A description of the accepted parameters follows.
  1020. @table @option
  1021. @item in_gain
  1022. Set input gain. Default is 0.4.
  1023. @item out_gain
  1024. Set output gain. Default is 0.74
  1025. @item delay
  1026. Set delay in milliseconds. Default is 3.0.
  1027. @item decay
  1028. Set decay. Default is 0.4.
  1029. @item speed
  1030. Set modulation speed in Hz. Default is 0.5.
  1031. @item type
  1032. Set modulation type. Default is triangular.
  1033. It accepts the following values:
  1034. @table @samp
  1035. @item triangular, t
  1036. @item sinusoidal, s
  1037. @end table
  1038. @end table
  1039. @section apulsator
  1040. Audio pulsator is something between an autopanner and a tremolo.
  1041. But it can produce funny stereo effects as well. Pulsator changes the volume
  1042. of the left and right channel based on a LFO (low frequency oscillator) with
  1043. different waveforms and shifted phases.
  1044. This filter have the ability to define an offset between left and right
  1045. channel. An offset of 0 means that both LFO shapes match each other.
  1046. The left and right channel are altered equally - a conventional tremolo.
  1047. An offset of 50% means that the shape of the right channel is exactly shifted
  1048. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1049. an autopanner. At 1 both curves match again. Every setting in between moves the
  1050. phase shift gapless between all stages and produces some "bypassing" sounds with
  1051. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1052. the 0.5) the faster the signal passes from the left to the right speaker.
  1053. The filter accepts the following options:
  1054. @table @option
  1055. @item level_in
  1056. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1057. @item level_out
  1058. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1059. @item mode
  1060. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1061. sawup or sawdown. Default is sine.
  1062. @item amount
  1063. Set modulation. Define how much of original signal is affected by the LFO.
  1064. @item offset_l
  1065. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1066. @item offset_r
  1067. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1068. @item width
  1069. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1070. @item timing
  1071. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1072. @item bpm
  1073. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1074. is set to bpm.
  1075. @item ms
  1076. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1077. is set to ms.
  1078. @item hz
  1079. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1080. if timing is set to hz.
  1081. @end table
  1082. @anchor{aresample}
  1083. @section aresample
  1084. Resample the input audio to the specified parameters, using the
  1085. libswresample library. If none are specified then the filter will
  1086. automatically convert between its input and output.
  1087. This filter is also able to stretch/squeeze the audio data to make it match
  1088. the timestamps or to inject silence / cut out audio to make it match the
  1089. timestamps, do a combination of both or do neither.
  1090. The filter accepts the syntax
  1091. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1092. expresses a sample rate and @var{resampler_options} is a list of
  1093. @var{key}=@var{value} pairs, separated by ":". See the
  1094. ffmpeg-resampler manual for the complete list of supported options.
  1095. @subsection Examples
  1096. @itemize
  1097. @item
  1098. Resample the input audio to 44100Hz:
  1099. @example
  1100. aresample=44100
  1101. @end example
  1102. @item
  1103. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1104. samples per second compensation:
  1105. @example
  1106. aresample=async=1000
  1107. @end example
  1108. @end itemize
  1109. @section areverse
  1110. Reverse an audio clip.
  1111. Warning: This filter requires memory to buffer the entire clip, so trimming
  1112. is suggested.
  1113. @subsection Examples
  1114. @itemize
  1115. @item
  1116. Take the first 5 seconds of a clip, and reverse it.
  1117. @example
  1118. atrim=end=5,areverse
  1119. @end example
  1120. @end itemize
  1121. @section asetnsamples
  1122. Set the number of samples per each output audio frame.
  1123. The last output packet may contain a different number of samples, as
  1124. the filter will flush all the remaining samples when the input audio
  1125. signal its end.
  1126. The filter accepts the following options:
  1127. @table @option
  1128. @item nb_out_samples, n
  1129. Set the number of frames per each output audio frame. The number is
  1130. intended as the number of samples @emph{per each channel}.
  1131. Default value is 1024.
  1132. @item pad, p
  1133. If set to 1, the filter will pad the last audio frame with zeroes, so
  1134. that the last frame will contain the same number of samples as the
  1135. previous ones. Default value is 1.
  1136. @end table
  1137. For example, to set the number of per-frame samples to 1234 and
  1138. disable padding for the last frame, use:
  1139. @example
  1140. asetnsamples=n=1234:p=0
  1141. @end example
  1142. @section asetrate
  1143. Set the sample rate without altering the PCM data.
  1144. This will result in a change of speed and pitch.
  1145. The filter accepts the following options:
  1146. @table @option
  1147. @item sample_rate, r
  1148. Set the output sample rate. Default is 44100 Hz.
  1149. @end table
  1150. @section ashowinfo
  1151. Show a line containing various information for each input audio frame.
  1152. The input audio is not modified.
  1153. The shown line contains a sequence of key/value pairs of the form
  1154. @var{key}:@var{value}.
  1155. The following values are shown in the output:
  1156. @table @option
  1157. @item n
  1158. The (sequential) number of the input frame, starting from 0.
  1159. @item pts
  1160. The presentation timestamp of the input frame, in time base units; the time base
  1161. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1162. @item pts_time
  1163. The presentation timestamp of the input frame in seconds.
  1164. @item pos
  1165. position of the frame in the input stream, -1 if this information in
  1166. unavailable and/or meaningless (for example in case of synthetic audio)
  1167. @item fmt
  1168. The sample format.
  1169. @item chlayout
  1170. The channel layout.
  1171. @item rate
  1172. The sample rate for the audio frame.
  1173. @item nb_samples
  1174. The number of samples (per channel) in the frame.
  1175. @item checksum
  1176. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1177. audio, the data is treated as if all the planes were concatenated.
  1178. @item plane_checksums
  1179. A list of Adler-32 checksums for each data plane.
  1180. @end table
  1181. @anchor{astats}
  1182. @section astats
  1183. Display time domain statistical information about the audio channels.
  1184. Statistics are calculated and displayed for each audio channel and,
  1185. where applicable, an overall figure is also given.
  1186. It accepts the following option:
  1187. @table @option
  1188. @item length
  1189. Short window length in seconds, used for peak and trough RMS measurement.
  1190. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1191. @item metadata
  1192. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1193. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1194. disabled.
  1195. Available keys for each channel are:
  1196. DC_offset
  1197. Min_level
  1198. Max_level
  1199. Min_difference
  1200. Max_difference
  1201. Mean_difference
  1202. Peak_level
  1203. RMS_peak
  1204. RMS_trough
  1205. Crest_factor
  1206. Flat_factor
  1207. Peak_count
  1208. Bit_depth
  1209. and for Overall:
  1210. DC_offset
  1211. Min_level
  1212. Max_level
  1213. Min_difference
  1214. Max_difference
  1215. Mean_difference
  1216. Peak_level
  1217. RMS_level
  1218. RMS_peak
  1219. RMS_trough
  1220. Flat_factor
  1221. Peak_count
  1222. Bit_depth
  1223. Number_of_samples
  1224. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1225. this @code{lavfi.astats.Overall.Peak_count}.
  1226. For description what each key means read below.
  1227. @item reset
  1228. Set number of frame after which stats are going to be recalculated.
  1229. Default is disabled.
  1230. @end table
  1231. A description of each shown parameter follows:
  1232. @table @option
  1233. @item DC offset
  1234. Mean amplitude displacement from zero.
  1235. @item Min level
  1236. Minimal sample level.
  1237. @item Max level
  1238. Maximal sample level.
  1239. @item Min difference
  1240. Minimal difference between two consecutive samples.
  1241. @item Max difference
  1242. Maximal difference between two consecutive samples.
  1243. @item Mean difference
  1244. Mean difference between two consecutive samples.
  1245. The average of each difference between two consecutive samples.
  1246. @item Peak level dB
  1247. @item RMS level dB
  1248. Standard peak and RMS level measured in dBFS.
  1249. @item RMS peak dB
  1250. @item RMS trough dB
  1251. Peak and trough values for RMS level measured over a short window.
  1252. @item Crest factor
  1253. Standard ratio of peak to RMS level (note: not in dB).
  1254. @item Flat factor
  1255. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1256. (i.e. either @var{Min level} or @var{Max level}).
  1257. @item Peak count
  1258. Number of occasions (not the number of samples) that the signal attained either
  1259. @var{Min level} or @var{Max level}.
  1260. @item Bit depth
  1261. Overall bit depth of audio. Number of bits used for each sample.
  1262. @end table
  1263. @section asyncts
  1264. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1265. dropping samples/adding silence when needed.
  1266. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1267. It accepts the following parameters:
  1268. @table @option
  1269. @item compensate
  1270. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1271. by default. When disabled, time gaps are covered with silence.
  1272. @item min_delta
  1273. The minimum difference between timestamps and audio data (in seconds) to trigger
  1274. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1275. sync with this filter, try setting this parameter to 0.
  1276. @item max_comp
  1277. The maximum compensation in samples per second. Only relevant with compensate=1.
  1278. The default value is 500.
  1279. @item first_pts
  1280. Assume that the first PTS should be this value. The time base is 1 / sample
  1281. rate. This allows for padding/trimming at the start of the stream. By default,
  1282. no assumption is made about the first frame's expected PTS, so no padding or
  1283. trimming is done. For example, this could be set to 0 to pad the beginning with
  1284. silence if an audio stream starts after the video stream or to trim any samples
  1285. with a negative PTS due to encoder delay.
  1286. @end table
  1287. @section atempo
  1288. Adjust audio tempo.
  1289. The filter accepts exactly one parameter, the audio tempo. If not
  1290. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1291. be in the [0.5, 2.0] range.
  1292. @subsection Examples
  1293. @itemize
  1294. @item
  1295. Slow down audio to 80% tempo:
  1296. @example
  1297. atempo=0.8
  1298. @end example
  1299. @item
  1300. To speed up audio to 125% tempo:
  1301. @example
  1302. atempo=1.25
  1303. @end example
  1304. @end itemize
  1305. @section atrim
  1306. Trim the input so that the output contains one continuous subpart of the input.
  1307. It accepts the following parameters:
  1308. @table @option
  1309. @item start
  1310. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1311. sample with the timestamp @var{start} will be the first sample in the output.
  1312. @item end
  1313. Specify time of the first audio sample that will be dropped, i.e. the
  1314. audio sample immediately preceding the one with the timestamp @var{end} will be
  1315. the last sample in the output.
  1316. @item start_pts
  1317. Same as @var{start}, except this option sets the start timestamp in samples
  1318. instead of seconds.
  1319. @item end_pts
  1320. Same as @var{end}, except this option sets the end timestamp in samples instead
  1321. of seconds.
  1322. @item duration
  1323. The maximum duration of the output in seconds.
  1324. @item start_sample
  1325. The number of the first sample that should be output.
  1326. @item end_sample
  1327. The number of the first sample that should be dropped.
  1328. @end table
  1329. @option{start}, @option{end}, and @option{duration} are expressed as time
  1330. duration specifications; see
  1331. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1332. Note that the first two sets of the start/end options and the @option{duration}
  1333. option look at the frame timestamp, while the _sample options simply count the
  1334. samples that pass through the filter. So start/end_pts and start/end_sample will
  1335. give different results when the timestamps are wrong, inexact or do not start at
  1336. zero. Also note that this filter does not modify the timestamps. If you wish
  1337. to have the output timestamps start at zero, insert the asetpts filter after the
  1338. atrim filter.
  1339. If multiple start or end options are set, this filter tries to be greedy and
  1340. keep all samples that match at least one of the specified constraints. To keep
  1341. only the part that matches all the constraints at once, chain multiple atrim
  1342. filters.
  1343. The defaults are such that all the input is kept. So it is possible to set e.g.
  1344. just the end values to keep everything before the specified time.
  1345. Examples:
  1346. @itemize
  1347. @item
  1348. Drop everything except the second minute of input:
  1349. @example
  1350. ffmpeg -i INPUT -af atrim=60:120
  1351. @end example
  1352. @item
  1353. Keep only the first 1000 samples:
  1354. @example
  1355. ffmpeg -i INPUT -af atrim=end_sample=1000
  1356. @end example
  1357. @end itemize
  1358. @section bandpass
  1359. Apply a two-pole Butterworth band-pass filter with central
  1360. frequency @var{frequency}, and (3dB-point) band-width width.
  1361. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1362. instead of the default: constant 0dB peak gain.
  1363. The filter roll off at 6dB per octave (20dB per decade).
  1364. The filter accepts the following options:
  1365. @table @option
  1366. @item frequency, f
  1367. Set the filter's central frequency. Default is @code{3000}.
  1368. @item csg
  1369. Constant skirt gain if set to 1. Defaults to 0.
  1370. @item width_type
  1371. Set method to specify band-width of filter.
  1372. @table @option
  1373. @item h
  1374. Hz
  1375. @item q
  1376. Q-Factor
  1377. @item o
  1378. octave
  1379. @item s
  1380. slope
  1381. @end table
  1382. @item width, w
  1383. Specify the band-width of a filter in width_type units.
  1384. @end table
  1385. @section bandreject
  1386. Apply a two-pole Butterworth band-reject filter with central
  1387. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1388. The filter roll off at 6dB per octave (20dB per decade).
  1389. The filter accepts the following options:
  1390. @table @option
  1391. @item frequency, f
  1392. Set the filter's central frequency. Default is @code{3000}.
  1393. @item width_type
  1394. Set method to specify band-width of filter.
  1395. @table @option
  1396. @item h
  1397. Hz
  1398. @item q
  1399. Q-Factor
  1400. @item o
  1401. octave
  1402. @item s
  1403. slope
  1404. @end table
  1405. @item width, w
  1406. Specify the band-width of a filter in width_type units.
  1407. @end table
  1408. @section bass
  1409. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1410. shelving filter with a response similar to that of a standard
  1411. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item gain, g
  1415. Give the gain at 0 Hz. Its useful range is about -20
  1416. (for a large cut) to +20 (for a large boost).
  1417. Beware of clipping when using a positive gain.
  1418. @item frequency, f
  1419. Set the filter's central frequency and so can be used
  1420. to extend or reduce the frequency range to be boosted or cut.
  1421. The default value is @code{100} Hz.
  1422. @item width_type
  1423. Set method to specify band-width of filter.
  1424. @table @option
  1425. @item h
  1426. Hz
  1427. @item q
  1428. Q-Factor
  1429. @item o
  1430. octave
  1431. @item s
  1432. slope
  1433. @end table
  1434. @item width, w
  1435. Determine how steep is the filter's shelf transition.
  1436. @end table
  1437. @section biquad
  1438. Apply a biquad IIR filter with the given coefficients.
  1439. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1440. are the numerator and denominator coefficients respectively.
  1441. @section bs2b
  1442. Bauer stereo to binaural transformation, which improves headphone listening of
  1443. stereo audio records.
  1444. It accepts the following parameters:
  1445. @table @option
  1446. @item profile
  1447. Pre-defined crossfeed level.
  1448. @table @option
  1449. @item default
  1450. Default level (fcut=700, feed=50).
  1451. @item cmoy
  1452. Chu Moy circuit (fcut=700, feed=60).
  1453. @item jmeier
  1454. Jan Meier circuit (fcut=650, feed=95).
  1455. @end table
  1456. @item fcut
  1457. Cut frequency (in Hz).
  1458. @item feed
  1459. Feed level (in Hz).
  1460. @end table
  1461. @section channelmap
  1462. Remap input channels to new locations.
  1463. It accepts the following parameters:
  1464. @table @option
  1465. @item channel_layout
  1466. The channel layout of the output stream.
  1467. @item map
  1468. Map channels from input to output. The argument is a '|'-separated list of
  1469. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1470. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1471. channel (e.g. FL for front left) or its index in the input channel layout.
  1472. @var{out_channel} is the name of the output channel or its index in the output
  1473. channel layout. If @var{out_channel} is not given then it is implicitly an
  1474. index, starting with zero and increasing by one for each mapping.
  1475. @end table
  1476. If no mapping is present, the filter will implicitly map input channels to
  1477. output channels, preserving indices.
  1478. For example, assuming a 5.1+downmix input MOV file,
  1479. @example
  1480. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1481. @end example
  1482. will create an output WAV file tagged as stereo from the downmix channels of
  1483. the input.
  1484. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1485. @example
  1486. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1487. @end example
  1488. @section channelsplit
  1489. Split each channel from an input audio stream into a separate output stream.
  1490. It accepts the following parameters:
  1491. @table @option
  1492. @item channel_layout
  1493. The channel layout of the input stream. The default is "stereo".
  1494. @end table
  1495. For example, assuming a stereo input MP3 file,
  1496. @example
  1497. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1498. @end example
  1499. will create an output Matroska file with two audio streams, one containing only
  1500. the left channel and the other the right channel.
  1501. Split a 5.1 WAV file into per-channel files:
  1502. @example
  1503. ffmpeg -i in.wav -filter_complex
  1504. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1505. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1506. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1507. side_right.wav
  1508. @end example
  1509. @section chorus
  1510. Add a chorus effect to the audio.
  1511. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1512. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1513. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1514. The modulation depth defines the range the modulated delay is played before or after
  1515. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1516. sound tuned around the original one, like in a chorus where some vocals are slightly
  1517. off key.
  1518. It accepts the following parameters:
  1519. @table @option
  1520. @item in_gain
  1521. Set input gain. Default is 0.4.
  1522. @item out_gain
  1523. Set output gain. Default is 0.4.
  1524. @item delays
  1525. Set delays. A typical delay is around 40ms to 60ms.
  1526. @item decays
  1527. Set decays.
  1528. @item speeds
  1529. Set speeds.
  1530. @item depths
  1531. Set depths.
  1532. @end table
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. A single delay:
  1537. @example
  1538. chorus=0.7:0.9:55:0.4:0.25:2
  1539. @end example
  1540. @item
  1541. Two delays:
  1542. @example
  1543. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1544. @end example
  1545. @item
  1546. Fuller sounding chorus with three delays:
  1547. @example
  1548. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1549. @end example
  1550. @end itemize
  1551. @section compand
  1552. Compress or expand the audio's dynamic range.
  1553. It accepts the following parameters:
  1554. @table @option
  1555. @item attacks
  1556. @item decays
  1557. A list of times in seconds for each channel over which the instantaneous level
  1558. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1559. increase of volume and @var{decays} refers to decrease of volume. For most
  1560. situations, the attack time (response to the audio getting louder) should be
  1561. shorter than the decay time, because the human ear is more sensitive to sudden
  1562. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1563. a typical value for decay is 0.8 seconds.
  1564. If specified number of attacks & decays is lower than number of channels, the last
  1565. set attack/decay will be used for all remaining channels.
  1566. @item points
  1567. A list of points for the transfer function, specified in dB relative to the
  1568. maximum possible signal amplitude. Each key points list must be defined using
  1569. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1570. @code{x0/y0 x1/y1 x2/y2 ....}
  1571. The input values must be in strictly increasing order but the transfer function
  1572. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1573. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1574. function are @code{-70/-70|-60/-20}.
  1575. @item soft-knee
  1576. Set the curve radius in dB for all joints. It defaults to 0.01.
  1577. @item gain
  1578. Set the additional gain in dB to be applied at all points on the transfer
  1579. function. This allows for easy adjustment of the overall gain.
  1580. It defaults to 0.
  1581. @item volume
  1582. Set an initial volume, in dB, to be assumed for each channel when filtering
  1583. starts. This permits the user to supply a nominal level initially, so that, for
  1584. example, a very large gain is not applied to initial signal levels before the
  1585. companding has begun to operate. A typical value for audio which is initially
  1586. quiet is -90 dB. It defaults to 0.
  1587. @item delay
  1588. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1589. delayed before being fed to the volume adjuster. Specifying a delay
  1590. approximately equal to the attack/decay times allows the filter to effectively
  1591. operate in predictive rather than reactive mode. It defaults to 0.
  1592. @end table
  1593. @subsection Examples
  1594. @itemize
  1595. @item
  1596. Make music with both quiet and loud passages suitable for listening to in a
  1597. noisy environment:
  1598. @example
  1599. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1600. @end example
  1601. Another example for audio with whisper and explosion parts:
  1602. @example
  1603. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1604. @end example
  1605. @item
  1606. A noise gate for when the noise is at a lower level than the signal:
  1607. @example
  1608. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1609. @end example
  1610. @item
  1611. Here is another noise gate, this time for when the noise is at a higher level
  1612. than the signal (making it, in some ways, similar to squelch):
  1613. @example
  1614. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1615. @end example
  1616. @item
  1617. 2:1 compression starting at -6dB:
  1618. @example
  1619. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1620. @end example
  1621. @item
  1622. 2:1 compression starting at -9dB:
  1623. @example
  1624. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1625. @end example
  1626. @item
  1627. 2:1 compression starting at -12dB:
  1628. @example
  1629. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1630. @end example
  1631. @item
  1632. 2:1 compression starting at -18dB:
  1633. @example
  1634. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1635. @end example
  1636. @item
  1637. 3:1 compression starting at -15dB:
  1638. @example
  1639. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1640. @end example
  1641. @item
  1642. Compressor/Gate:
  1643. @example
  1644. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1645. @end example
  1646. @item
  1647. Expander:
  1648. @example
  1649. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1650. @end example
  1651. @item
  1652. Hard limiter at -6dB:
  1653. @example
  1654. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1655. @end example
  1656. @item
  1657. Hard limiter at -12dB:
  1658. @example
  1659. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1660. @end example
  1661. @item
  1662. Hard noise gate at -35 dB:
  1663. @example
  1664. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1665. @end example
  1666. @item
  1667. Soft limiter:
  1668. @example
  1669. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1670. @end example
  1671. @end itemize
  1672. @section compensationdelay
  1673. Compensation Delay Line is a metric based delay to compensate differing
  1674. positions of microphones or speakers.
  1675. For example, you have recorded guitar with two microphones placed in
  1676. different location. Because the front of sound wave has fixed speed in
  1677. normal conditions, the phasing of microphones can vary and depends on
  1678. their location and interposition. The best sound mix can be achieved when
  1679. these microphones are in phase (synchronized). Note that distance of
  1680. ~30 cm between microphones makes one microphone to capture signal in
  1681. antiphase to another microphone. That makes the final mix sounding moody.
  1682. This filter helps to solve phasing problems by adding different delays
  1683. to each microphone track and make them synchronized.
  1684. The best result can be reached when you take one track as base and
  1685. synchronize other tracks one by one with it.
  1686. Remember that synchronization/delay tolerance depends on sample rate, too.
  1687. Higher sample rates will give more tolerance.
  1688. It accepts the following parameters:
  1689. @table @option
  1690. @item mm
  1691. Set millimeters distance. This is compensation distance for fine tuning.
  1692. Default is 0.
  1693. @item cm
  1694. Set cm distance. This is compensation distance for tightening distance setup.
  1695. Default is 0.
  1696. @item m
  1697. Set meters distance. This is compensation distance for hard distance setup.
  1698. Default is 0.
  1699. @item dry
  1700. Set dry amount. Amount of unprocessed (dry) signal.
  1701. Default is 0.
  1702. @item wet
  1703. Set wet amount. Amount of processed (wet) signal.
  1704. Default is 1.
  1705. @item temp
  1706. Set temperature degree in Celsius. This is the temperature of the environment.
  1707. Default is 20.
  1708. @end table
  1709. @section crystalizer
  1710. Simple algorithm to expand audio dynamic range.
  1711. The filter accepts the following options:
  1712. @table @option
  1713. @item i
  1714. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1715. (unchanged sound) to 10.0 (maximum effect).
  1716. @item c
  1717. Enable clipping. By default is enabled.
  1718. @end table
  1719. @section dcshift
  1720. Apply a DC shift to the audio.
  1721. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1722. in the recording chain) from the audio. The effect of a DC offset is reduced
  1723. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1724. a signal has a DC offset.
  1725. @table @option
  1726. @item shift
  1727. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1728. the audio.
  1729. @item limitergain
  1730. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1731. used to prevent clipping.
  1732. @end table
  1733. @section dynaudnorm
  1734. Dynamic Audio Normalizer.
  1735. This filter applies a certain amount of gain to the input audio in order
  1736. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1737. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1738. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1739. This allows for applying extra gain to the "quiet" sections of the audio
  1740. while avoiding distortions or clipping the "loud" sections. In other words:
  1741. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1742. sections, in the sense that the volume of each section is brought to the
  1743. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1744. this goal *without* applying "dynamic range compressing". It will retain 100%
  1745. of the dynamic range *within* each section of the audio file.
  1746. @table @option
  1747. @item f
  1748. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1749. Default is 500 milliseconds.
  1750. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1751. referred to as frames. This is required, because a peak magnitude has no
  1752. meaning for just a single sample value. Instead, we need to determine the
  1753. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1754. normalizer would simply use the peak magnitude of the complete file, the
  1755. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1756. frame. The length of a frame is specified in milliseconds. By default, the
  1757. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1758. been found to give good results with most files.
  1759. Note that the exact frame length, in number of samples, will be determined
  1760. automatically, based on the sampling rate of the individual input audio file.
  1761. @item g
  1762. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1763. number. Default is 31.
  1764. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1765. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1766. is specified in frames, centered around the current frame. For the sake of
  1767. simplicity, this must be an odd number. Consequently, the default value of 31
  1768. takes into account the current frame, as well as the 15 preceding frames and
  1769. the 15 subsequent frames. Using a larger window results in a stronger
  1770. smoothing effect and thus in less gain variation, i.e. slower gain
  1771. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1772. effect and thus in more gain variation, i.e. faster gain adaptation.
  1773. In other words, the more you increase this value, the more the Dynamic Audio
  1774. Normalizer will behave like a "traditional" normalization filter. On the
  1775. contrary, the more you decrease this value, the more the Dynamic Audio
  1776. Normalizer will behave like a dynamic range compressor.
  1777. @item p
  1778. Set the target peak value. This specifies the highest permissible magnitude
  1779. level for the normalized audio input. This filter will try to approach the
  1780. target peak magnitude as closely as possible, but at the same time it also
  1781. makes sure that the normalized signal will never exceed the peak magnitude.
  1782. A frame's maximum local gain factor is imposed directly by the target peak
  1783. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1784. It is not recommended to go above this value.
  1785. @item m
  1786. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1787. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1788. factor for each input frame, i.e. the maximum gain factor that does not
  1789. result in clipping or distortion. The maximum gain factor is determined by
  1790. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1791. additionally bounds the frame's maximum gain factor by a predetermined
  1792. (global) maximum gain factor. This is done in order to avoid excessive gain
  1793. factors in "silent" or almost silent frames. By default, the maximum gain
  1794. factor is 10.0, For most inputs the default value should be sufficient and
  1795. it usually is not recommended to increase this value. Though, for input
  1796. with an extremely low overall volume level, it may be necessary to allow even
  1797. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1798. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1799. Instead, a "sigmoid" threshold function will be applied. This way, the
  1800. gain factors will smoothly approach the threshold value, but never exceed that
  1801. value.
  1802. @item r
  1803. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1804. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1805. This means that the maximum local gain factor for each frame is defined
  1806. (only) by the frame's highest magnitude sample. This way, the samples can
  1807. be amplified as much as possible without exceeding the maximum signal
  1808. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1809. Normalizer can also take into account the frame's root mean square,
  1810. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1811. determine the power of a time-varying signal. It is therefore considered
  1812. that the RMS is a better approximation of the "perceived loudness" than
  1813. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1814. frames to a constant RMS value, a uniform "perceived loudness" can be
  1815. established. If a target RMS value has been specified, a frame's local gain
  1816. factor is defined as the factor that would result in exactly that RMS value.
  1817. Note, however, that the maximum local gain factor is still restricted by the
  1818. frame's highest magnitude sample, in order to prevent clipping.
  1819. @item n
  1820. Enable channels coupling. By default is enabled.
  1821. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1822. amount. This means the same gain factor will be applied to all channels, i.e.
  1823. the maximum possible gain factor is determined by the "loudest" channel.
  1824. However, in some recordings, it may happen that the volume of the different
  1825. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1826. In this case, this option can be used to disable the channel coupling. This way,
  1827. the gain factor will be determined independently for each channel, depending
  1828. only on the individual channel's highest magnitude sample. This allows for
  1829. harmonizing the volume of the different channels.
  1830. @item c
  1831. Enable DC bias correction. By default is disabled.
  1832. An audio signal (in the time domain) is a sequence of sample values.
  1833. In the Dynamic Audio Normalizer these sample values are represented in the
  1834. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1835. audio signal, or "waveform", should be centered around the zero point.
  1836. That means if we calculate the mean value of all samples in a file, or in a
  1837. single frame, then the result should be 0.0 or at least very close to that
  1838. value. If, however, there is a significant deviation of the mean value from
  1839. 0.0, in either positive or negative direction, this is referred to as a
  1840. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1841. Audio Normalizer provides optional DC bias correction.
  1842. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1843. the mean value, or "DC correction" offset, of each input frame and subtract
  1844. that value from all of the frame's sample values which ensures those samples
  1845. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1846. boundaries, the DC correction offset values will be interpolated smoothly
  1847. between neighbouring frames.
  1848. @item b
  1849. Enable alternative boundary mode. By default is disabled.
  1850. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1851. around each frame. This includes the preceding frames as well as the
  1852. subsequent frames. However, for the "boundary" frames, located at the very
  1853. beginning and at the very end of the audio file, not all neighbouring
  1854. frames are available. In particular, for the first few frames in the audio
  1855. file, the preceding frames are not known. And, similarly, for the last few
  1856. frames in the audio file, the subsequent frames are not known. Thus, the
  1857. question arises which gain factors should be assumed for the missing frames
  1858. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1859. to deal with this situation. The default boundary mode assumes a gain factor
  1860. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1861. "fade out" at the beginning and at the end of the input, respectively.
  1862. @item s
  1863. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1864. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1865. compression. This means that signal peaks will not be pruned and thus the
  1866. full dynamic range will be retained within each local neighbourhood. However,
  1867. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1868. normalization algorithm with a more "traditional" compression.
  1869. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1870. (thresholding) function. If (and only if) the compression feature is enabled,
  1871. all input frames will be processed by a soft knee thresholding function prior
  1872. to the actual normalization process. Put simply, the thresholding function is
  1873. going to prune all samples whose magnitude exceeds a certain threshold value.
  1874. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1875. value. Instead, the threshold value will be adjusted for each individual
  1876. frame.
  1877. In general, smaller parameters result in stronger compression, and vice versa.
  1878. Values below 3.0 are not recommended, because audible distortion may appear.
  1879. @end table
  1880. @section earwax
  1881. Make audio easier to listen to on headphones.
  1882. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1883. so that when listened to on headphones the stereo image is moved from
  1884. inside your head (standard for headphones) to outside and in front of
  1885. the listener (standard for speakers).
  1886. Ported from SoX.
  1887. @section equalizer
  1888. Apply a two-pole peaking equalisation (EQ) filter. With this
  1889. filter, the signal-level at and around a selected frequency can
  1890. be increased or decreased, whilst (unlike bandpass and bandreject
  1891. filters) that at all other frequencies is unchanged.
  1892. In order to produce complex equalisation curves, this filter can
  1893. be given several times, each with a different central frequency.
  1894. The filter accepts the following options:
  1895. @table @option
  1896. @item frequency, f
  1897. Set the filter's central frequency in Hz.
  1898. @item width_type
  1899. Set method to specify band-width of filter.
  1900. @table @option
  1901. @item h
  1902. Hz
  1903. @item q
  1904. Q-Factor
  1905. @item o
  1906. octave
  1907. @item s
  1908. slope
  1909. @end table
  1910. @item width, w
  1911. Specify the band-width of a filter in width_type units.
  1912. @item gain, g
  1913. Set the required gain or attenuation in dB.
  1914. Beware of clipping when using a positive gain.
  1915. @end table
  1916. @subsection Examples
  1917. @itemize
  1918. @item
  1919. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1920. @example
  1921. equalizer=f=1000:width_type=h:width=200:g=-10
  1922. @end example
  1923. @item
  1924. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1925. @example
  1926. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1927. @end example
  1928. @end itemize
  1929. @section extrastereo
  1930. Linearly increases the difference between left and right channels which
  1931. adds some sort of "live" effect to playback.
  1932. The filter accepts the following options:
  1933. @table @option
  1934. @item m
  1935. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1936. (average of both channels), with 1.0 sound will be unchanged, with
  1937. -1.0 left and right channels will be swapped.
  1938. @item c
  1939. Enable clipping. By default is enabled.
  1940. @end table
  1941. @section firequalizer
  1942. Apply FIR Equalization using arbitrary frequency response.
  1943. The filter accepts the following option:
  1944. @table @option
  1945. @item gain
  1946. Set gain curve equation (in dB). The expression can contain variables:
  1947. @table @option
  1948. @item f
  1949. the evaluated frequency
  1950. @item sr
  1951. sample rate
  1952. @item ch
  1953. channel number, set to 0 when multichannels evaluation is disabled
  1954. @item chid
  1955. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1956. multichannels evaluation is disabled
  1957. @item chs
  1958. number of channels
  1959. @item chlayout
  1960. channel_layout, see libavutil/channel_layout.h
  1961. @end table
  1962. and functions:
  1963. @table @option
  1964. @item gain_interpolate(f)
  1965. interpolate gain on frequency f based on gain_entry
  1966. @end table
  1967. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1968. @item gain_entry
  1969. Set gain entry for gain_interpolate function. The expression can
  1970. contain functions:
  1971. @table @option
  1972. @item entry(f, g)
  1973. store gain entry at frequency f with value g
  1974. @end table
  1975. This option is also available as command.
  1976. @item delay
  1977. Set filter delay in seconds. Higher value means more accurate.
  1978. Default is @code{0.01}.
  1979. @item accuracy
  1980. Set filter accuracy in Hz. Lower value means more accurate.
  1981. Default is @code{5}.
  1982. @item wfunc
  1983. Set window function. Acceptable values are:
  1984. @table @option
  1985. @item rectangular
  1986. rectangular window, useful when gain curve is already smooth
  1987. @item hann
  1988. hann window (default)
  1989. @item hamming
  1990. hamming window
  1991. @item blackman
  1992. blackman window
  1993. @item nuttall3
  1994. 3-terms continuous 1st derivative nuttall window
  1995. @item mnuttall3
  1996. minimum 3-terms discontinuous nuttall window
  1997. @item nuttall
  1998. 4-terms continuous 1st derivative nuttall window
  1999. @item bnuttall
  2000. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2001. @item bharris
  2002. blackman-harris window
  2003. @end table
  2004. @item fixed
  2005. If enabled, use fixed number of audio samples. This improves speed when
  2006. filtering with large delay. Default is disabled.
  2007. @item multi
  2008. Enable multichannels evaluation on gain. Default is disabled.
  2009. @item zero_phase
  2010. Enable zero phase mode by substracting timestamp to compensate delay.
  2011. Default is disabled.
  2012. @end table
  2013. @subsection Examples
  2014. @itemize
  2015. @item
  2016. lowpass at 1000 Hz:
  2017. @example
  2018. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2019. @end example
  2020. @item
  2021. lowpass at 1000 Hz with gain_entry:
  2022. @example
  2023. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2024. @end example
  2025. @item
  2026. custom equalization:
  2027. @example
  2028. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2029. @end example
  2030. @item
  2031. higher delay with zero phase to compensate delay:
  2032. @example
  2033. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2034. @end example
  2035. @item
  2036. lowpass on left channel, highpass on right channel:
  2037. @example
  2038. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2039. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2040. @end example
  2041. @end itemize
  2042. @section flanger
  2043. Apply a flanging effect to the audio.
  2044. The filter accepts the following options:
  2045. @table @option
  2046. @item delay
  2047. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2048. @item depth
  2049. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2050. @item regen
  2051. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2052. Default value is 0.
  2053. @item width
  2054. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2055. Default value is 71.
  2056. @item speed
  2057. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2058. @item shape
  2059. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2060. Default value is @var{sinusoidal}.
  2061. @item phase
  2062. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2063. Default value is 25.
  2064. @item interp
  2065. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2066. Default is @var{linear}.
  2067. @end table
  2068. @section hdcd
  2069. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2070. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2071. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2072. of HDCD, and detects the Transient Filter flag.
  2073. @example
  2074. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2075. @end example
  2076. When using the filter with wav, note the default encoding for wav is 16-bit,
  2077. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2078. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2079. @example
  2080. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2081. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2082. @end example
  2083. The filter accepts the following options:
  2084. @table @option
  2085. @item process_stereo
  2086. Process the stereo channels together. If target_gain does not match between
  2087. channels, consider it invalid and use the last valid target_gain.
  2088. @item force_pe
  2089. Always extend peaks above -3dBFS even if PE isn't signaled.
  2090. @item analyze_mode
  2091. Replace audio with a solid tone and adjust the amplitude to signal some
  2092. specific aspect of the decoding process. The output file can be loaded in
  2093. an audio editor alongside the original to aid analysis.
  2094. @code{analyze_mode=pe:force_pe=1} can be used to see all samples above the PE level.
  2095. Modes are:
  2096. @table @samp
  2097. @item 0, off
  2098. Disabled
  2099. @item 1, lle
  2100. Gain adjustment level at each sample
  2101. @item 2, pe
  2102. Samples where peak extend occurs
  2103. @item 3, cdt
  2104. Samples where the code detect timer is active
  2105. @item 4, tgm
  2106. Samples where the target gain does not match between channels
  2107. @end table
  2108. @end table
  2109. @section highpass
  2110. Apply a high-pass filter with 3dB point frequency.
  2111. The filter can be either single-pole, or double-pole (the default).
  2112. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2113. The filter accepts the following options:
  2114. @table @option
  2115. @item frequency, f
  2116. Set frequency in Hz. Default is 3000.
  2117. @item poles, p
  2118. Set number of poles. Default is 2.
  2119. @item width_type
  2120. Set method to specify band-width of filter.
  2121. @table @option
  2122. @item h
  2123. Hz
  2124. @item q
  2125. Q-Factor
  2126. @item o
  2127. octave
  2128. @item s
  2129. slope
  2130. @end table
  2131. @item width, w
  2132. Specify the band-width of a filter in width_type units.
  2133. Applies only to double-pole filter.
  2134. The default is 0.707q and gives a Butterworth response.
  2135. @end table
  2136. @section join
  2137. Join multiple input streams into one multi-channel stream.
  2138. It accepts the following parameters:
  2139. @table @option
  2140. @item inputs
  2141. The number of input streams. It defaults to 2.
  2142. @item channel_layout
  2143. The desired output channel layout. It defaults to stereo.
  2144. @item map
  2145. Map channels from inputs to output. The argument is a '|'-separated list of
  2146. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2147. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2148. can be either the name of the input channel (e.g. FL for front left) or its
  2149. index in the specified input stream. @var{out_channel} is the name of the output
  2150. channel.
  2151. @end table
  2152. The filter will attempt to guess the mappings when they are not specified
  2153. explicitly. It does so by first trying to find an unused matching input channel
  2154. and if that fails it picks the first unused input channel.
  2155. Join 3 inputs (with properly set channel layouts):
  2156. @example
  2157. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2158. @end example
  2159. Build a 5.1 output from 6 single-channel streams:
  2160. @example
  2161. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2162. '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'
  2163. out
  2164. @end example
  2165. @section ladspa
  2166. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2167. To enable compilation of this filter you need to configure FFmpeg with
  2168. @code{--enable-ladspa}.
  2169. @table @option
  2170. @item file, f
  2171. Specifies the name of LADSPA plugin library to load. If the environment
  2172. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2173. each one of the directories specified by the colon separated list in
  2174. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2175. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2176. @file{/usr/lib/ladspa/}.
  2177. @item plugin, p
  2178. Specifies the plugin within the library. Some libraries contain only
  2179. one plugin, but others contain many of them. If this is not set filter
  2180. will list all available plugins within the specified library.
  2181. @item controls, c
  2182. Set the '|' separated list of controls which are zero or more floating point
  2183. values that determine the behavior of the loaded plugin (for example delay,
  2184. threshold or gain).
  2185. Controls need to be defined using the following syntax:
  2186. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2187. @var{valuei} is the value set on the @var{i}-th control.
  2188. Alternatively they can be also defined using the following syntax:
  2189. @var{value0}|@var{value1}|@var{value2}|..., where
  2190. @var{valuei} is the value set on the @var{i}-th control.
  2191. If @option{controls} is set to @code{help}, all available controls and
  2192. their valid ranges are printed.
  2193. @item sample_rate, s
  2194. Specify the sample rate, default to 44100. Only used if plugin have
  2195. zero inputs.
  2196. @item nb_samples, n
  2197. Set the number of samples per channel per each output frame, default
  2198. is 1024. Only used if plugin have zero inputs.
  2199. @item duration, d
  2200. Set the minimum duration of the sourced audio. See
  2201. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2202. for the accepted syntax.
  2203. Note that the resulting duration may be greater than the specified duration,
  2204. as the generated audio is always cut at the end of a complete frame.
  2205. If not specified, or the expressed duration is negative, the audio is
  2206. supposed to be generated forever.
  2207. Only used if plugin have zero inputs.
  2208. @end table
  2209. @subsection Examples
  2210. @itemize
  2211. @item
  2212. List all available plugins within amp (LADSPA example plugin) library:
  2213. @example
  2214. ladspa=file=amp
  2215. @end example
  2216. @item
  2217. List all available controls and their valid ranges for @code{vcf_notch}
  2218. plugin from @code{VCF} library:
  2219. @example
  2220. ladspa=f=vcf:p=vcf_notch:c=help
  2221. @end example
  2222. @item
  2223. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2224. plugin library:
  2225. @example
  2226. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2227. @end example
  2228. @item
  2229. Add reverberation to the audio using TAP-plugins
  2230. (Tom's Audio Processing plugins):
  2231. @example
  2232. ladspa=file=tap_reverb:tap_reverb
  2233. @end example
  2234. @item
  2235. Generate white noise, with 0.2 amplitude:
  2236. @example
  2237. ladspa=file=cmt:noise_source_white:c=c0=.2
  2238. @end example
  2239. @item
  2240. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2241. @code{C* Audio Plugin Suite} (CAPS) library:
  2242. @example
  2243. ladspa=file=caps:Click:c=c1=20'
  2244. @end example
  2245. @item
  2246. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2247. @example
  2248. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2249. @end example
  2250. @item
  2251. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2252. @code{SWH Plugins} collection:
  2253. @example
  2254. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2255. @end example
  2256. @item
  2257. Attenuate low frequencies using Multiband EQ from Steve Harris
  2258. @code{SWH Plugins} collection:
  2259. @example
  2260. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2261. @end example
  2262. @end itemize
  2263. @subsection Commands
  2264. This filter supports the following commands:
  2265. @table @option
  2266. @item cN
  2267. Modify the @var{N}-th control value.
  2268. If the specified value is not valid, it is ignored and prior one is kept.
  2269. @end table
  2270. @section loudnorm
  2271. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2272. Support for both single pass (livestreams, files) and double pass (files) modes.
  2273. This algorithm can target IL, LRA, and maximum true peak.
  2274. To enable compilation of this filter you need to configure FFmpeg with
  2275. @code{--enable-libebur128}.
  2276. The filter accepts the following options:
  2277. @table @option
  2278. @item I, i
  2279. Set integrated loudness target.
  2280. Range is -70.0 - -5.0. Default value is -24.0.
  2281. @item LRA, lra
  2282. Set loudness range target.
  2283. Range is 1.0 - 20.0. Default value is 7.0.
  2284. @item TP, tp
  2285. Set maximum true peak.
  2286. Range is -9.0 - +0.0. Default value is -2.0.
  2287. @item measured_I, measured_i
  2288. Measured IL of input file.
  2289. Range is -99.0 - +0.0.
  2290. @item measured_LRA, measured_lra
  2291. Measured LRA of input file.
  2292. Range is 0.0 - 99.0.
  2293. @item measured_TP, measured_tp
  2294. Measured true peak of input file.
  2295. Range is -99.0 - +99.0.
  2296. @item measured_thresh
  2297. Measured threshold of input file.
  2298. Range is -99.0 - +0.0.
  2299. @item offset
  2300. Set offset gain. Gain is applied before the true-peak limiter.
  2301. Range is -99.0 - +99.0. Default is +0.0.
  2302. @item linear
  2303. Normalize linearly if possible.
  2304. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2305. to be specified in order to use this mode.
  2306. Options are true or false. Default is true.
  2307. @item dual_mono
  2308. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2309. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2310. If set to @code{true}, this option will compensate for this effect.
  2311. Multi-channel input files are not affected by this option.
  2312. Options are true or false. Default is false.
  2313. @item print_format
  2314. Set print format for stats. Options are summary, json, or none.
  2315. Default value is none.
  2316. @end table
  2317. @section lowpass
  2318. Apply a low-pass filter with 3dB point frequency.
  2319. The filter can be either single-pole or double-pole (the default).
  2320. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2321. The filter accepts the following options:
  2322. @table @option
  2323. @item frequency, f
  2324. Set frequency in Hz. Default is 500.
  2325. @item poles, p
  2326. Set number of poles. Default is 2.
  2327. @item width_type
  2328. Set method to specify band-width of filter.
  2329. @table @option
  2330. @item h
  2331. Hz
  2332. @item q
  2333. Q-Factor
  2334. @item o
  2335. octave
  2336. @item s
  2337. slope
  2338. @end table
  2339. @item width, w
  2340. Specify the band-width of a filter in width_type units.
  2341. Applies only to double-pole filter.
  2342. The default is 0.707q and gives a Butterworth response.
  2343. @end table
  2344. @anchor{pan}
  2345. @section pan
  2346. Mix channels with specific gain levels. The filter accepts the output
  2347. channel layout followed by a set of channels definitions.
  2348. This filter is also designed to efficiently remap the channels of an audio
  2349. stream.
  2350. The filter accepts parameters of the form:
  2351. "@var{l}|@var{outdef}|@var{outdef}|..."
  2352. @table @option
  2353. @item l
  2354. output channel layout or number of channels
  2355. @item outdef
  2356. output channel specification, of the form:
  2357. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2358. @item out_name
  2359. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2360. number (c0, c1, etc.)
  2361. @item gain
  2362. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2363. @item in_name
  2364. input channel to use, see out_name for details; it is not possible to mix
  2365. named and numbered input channels
  2366. @end table
  2367. If the `=' in a channel specification is replaced by `<', then the gains for
  2368. that specification will be renormalized so that the total is 1, thus
  2369. avoiding clipping noise.
  2370. @subsection Mixing examples
  2371. For example, if you want to down-mix from stereo to mono, but with a bigger
  2372. factor for the left channel:
  2373. @example
  2374. pan=1c|c0=0.9*c0+0.1*c1
  2375. @end example
  2376. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2377. 7-channels surround:
  2378. @example
  2379. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2380. @end example
  2381. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2382. that should be preferred (see "-ac" option) unless you have very specific
  2383. needs.
  2384. @subsection Remapping examples
  2385. The channel remapping will be effective if, and only if:
  2386. @itemize
  2387. @item gain coefficients are zeroes or ones,
  2388. @item only one input per channel output,
  2389. @end itemize
  2390. If all these conditions are satisfied, the filter will notify the user ("Pure
  2391. channel mapping detected"), and use an optimized and lossless method to do the
  2392. remapping.
  2393. For example, if you have a 5.1 source and want a stereo audio stream by
  2394. dropping the extra channels:
  2395. @example
  2396. pan="stereo| c0=FL | c1=FR"
  2397. @end example
  2398. Given the same source, you can also switch front left and front right channels
  2399. and keep the input channel layout:
  2400. @example
  2401. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2402. @end example
  2403. If the input is a stereo audio stream, you can mute the front left channel (and
  2404. still keep the stereo channel layout) with:
  2405. @example
  2406. pan="stereo|c1=c1"
  2407. @end example
  2408. Still with a stereo audio stream input, you can copy the right channel in both
  2409. front left and right:
  2410. @example
  2411. pan="stereo| c0=FR | c1=FR"
  2412. @end example
  2413. @section replaygain
  2414. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2415. outputs it unchanged.
  2416. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2417. @section resample
  2418. Convert the audio sample format, sample rate and channel layout. It is
  2419. not meant to be used directly.
  2420. @section rubberband
  2421. Apply time-stretching and pitch-shifting with librubberband.
  2422. The filter accepts the following options:
  2423. @table @option
  2424. @item tempo
  2425. Set tempo scale factor.
  2426. @item pitch
  2427. Set pitch scale factor.
  2428. @item transients
  2429. Set transients detector.
  2430. Possible values are:
  2431. @table @var
  2432. @item crisp
  2433. @item mixed
  2434. @item smooth
  2435. @end table
  2436. @item detector
  2437. Set detector.
  2438. Possible values are:
  2439. @table @var
  2440. @item compound
  2441. @item percussive
  2442. @item soft
  2443. @end table
  2444. @item phase
  2445. Set phase.
  2446. Possible values are:
  2447. @table @var
  2448. @item laminar
  2449. @item independent
  2450. @end table
  2451. @item window
  2452. Set processing window size.
  2453. Possible values are:
  2454. @table @var
  2455. @item standard
  2456. @item short
  2457. @item long
  2458. @end table
  2459. @item smoothing
  2460. Set smoothing.
  2461. Possible values are:
  2462. @table @var
  2463. @item off
  2464. @item on
  2465. @end table
  2466. @item formant
  2467. Enable formant preservation when shift pitching.
  2468. Possible values are:
  2469. @table @var
  2470. @item shifted
  2471. @item preserved
  2472. @end table
  2473. @item pitchq
  2474. Set pitch quality.
  2475. Possible values are:
  2476. @table @var
  2477. @item quality
  2478. @item speed
  2479. @item consistency
  2480. @end table
  2481. @item channels
  2482. Set channels.
  2483. Possible values are:
  2484. @table @var
  2485. @item apart
  2486. @item together
  2487. @end table
  2488. @end table
  2489. @section sidechaincompress
  2490. This filter acts like normal compressor but has the ability to compress
  2491. detected signal using second input signal.
  2492. It needs two input streams and returns one output stream.
  2493. First input stream will be processed depending on second stream signal.
  2494. The filtered signal then can be filtered with other filters in later stages of
  2495. processing. See @ref{pan} and @ref{amerge} filter.
  2496. The filter accepts the following options:
  2497. @table @option
  2498. @item level_in
  2499. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2500. @item threshold
  2501. If a signal of second stream raises above this level it will affect the gain
  2502. reduction of first stream.
  2503. By default is 0.125. Range is between 0.00097563 and 1.
  2504. @item ratio
  2505. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2506. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2507. Default is 2. Range is between 1 and 20.
  2508. @item attack
  2509. Amount of milliseconds the signal has to rise above the threshold before gain
  2510. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2511. @item release
  2512. Amount of milliseconds the signal has to fall below the threshold before
  2513. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2514. @item makeup
  2515. Set the amount by how much signal will be amplified after processing.
  2516. Default is 2. Range is from 1 and 64.
  2517. @item knee
  2518. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2519. Default is 2.82843. Range is between 1 and 8.
  2520. @item link
  2521. Choose if the @code{average} level between all channels of side-chain stream
  2522. or the louder(@code{maximum}) channel of side-chain stream affects the
  2523. reduction. Default is @code{average}.
  2524. @item detection
  2525. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2526. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2527. @item level_sc
  2528. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2529. @item mix
  2530. How much to use compressed signal in output. Default is 1.
  2531. Range is between 0 and 1.
  2532. @end table
  2533. @subsection Examples
  2534. @itemize
  2535. @item
  2536. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2537. depending on the signal of 2nd input and later compressed signal to be
  2538. merged with 2nd input:
  2539. @example
  2540. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2541. @end example
  2542. @end itemize
  2543. @section sidechaingate
  2544. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2545. filter the detected signal before sending it to the gain reduction stage.
  2546. Normally a gate uses the full range signal to detect a level above the
  2547. threshold.
  2548. For example: If you cut all lower frequencies from your sidechain signal
  2549. the gate will decrease the volume of your track only if not enough highs
  2550. appear. With this technique you are able to reduce the resonation of a
  2551. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2552. guitar.
  2553. It needs two input streams and returns one output stream.
  2554. First input stream will be processed depending on second stream signal.
  2555. The filter accepts the following options:
  2556. @table @option
  2557. @item level_in
  2558. Set input level before filtering.
  2559. Default is 1. Allowed range is from 0.015625 to 64.
  2560. @item range
  2561. Set the level of gain reduction when the signal is below the threshold.
  2562. Default is 0.06125. Allowed range is from 0 to 1.
  2563. @item threshold
  2564. If a signal rises above this level the gain reduction is released.
  2565. Default is 0.125. Allowed range is from 0 to 1.
  2566. @item ratio
  2567. Set a ratio about which the signal is reduced.
  2568. Default is 2. Allowed range is from 1 to 9000.
  2569. @item attack
  2570. Amount of milliseconds the signal has to rise above the threshold before gain
  2571. reduction stops.
  2572. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2573. @item release
  2574. Amount of milliseconds the signal has to fall below the threshold before the
  2575. reduction is increased again. Default is 250 milliseconds.
  2576. Allowed range is from 0.01 to 9000.
  2577. @item makeup
  2578. Set amount of amplification of signal after processing.
  2579. Default is 1. Allowed range is from 1 to 64.
  2580. @item knee
  2581. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2582. Default is 2.828427125. Allowed range is from 1 to 8.
  2583. @item detection
  2584. Choose if exact signal should be taken for detection or an RMS like one.
  2585. Default is rms. Can be peak or rms.
  2586. @item link
  2587. Choose if the average level between all channels or the louder channel affects
  2588. the reduction.
  2589. Default is average. Can be average or maximum.
  2590. @item level_sc
  2591. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2592. @end table
  2593. @section silencedetect
  2594. Detect silence in an audio stream.
  2595. This filter logs a message when it detects that the input audio volume is less
  2596. or equal to a noise tolerance value for a duration greater or equal to the
  2597. minimum detected noise duration.
  2598. The printed times and duration are expressed in seconds.
  2599. The filter accepts the following options:
  2600. @table @option
  2601. @item duration, d
  2602. Set silence duration until notification (default is 2 seconds).
  2603. @item noise, n
  2604. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2605. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2606. @end table
  2607. @subsection Examples
  2608. @itemize
  2609. @item
  2610. Detect 5 seconds of silence with -50dB noise tolerance:
  2611. @example
  2612. silencedetect=n=-50dB:d=5
  2613. @end example
  2614. @item
  2615. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2616. tolerance in @file{silence.mp3}:
  2617. @example
  2618. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2619. @end example
  2620. @end itemize
  2621. @section silenceremove
  2622. Remove silence from the beginning, middle or end of the audio.
  2623. The filter accepts the following options:
  2624. @table @option
  2625. @item start_periods
  2626. This value is used to indicate if audio should be trimmed at beginning of
  2627. the audio. A value of zero indicates no silence should be trimmed from the
  2628. beginning. When specifying a non-zero value, it trims audio up until it
  2629. finds non-silence. Normally, when trimming silence from beginning of audio
  2630. the @var{start_periods} will be @code{1} but it can be increased to higher
  2631. values to trim all audio up to specific count of non-silence periods.
  2632. Default value is @code{0}.
  2633. @item start_duration
  2634. Specify the amount of time that non-silence must be detected before it stops
  2635. trimming audio. By increasing the duration, bursts of noises can be treated
  2636. as silence and trimmed off. Default value is @code{0}.
  2637. @item start_threshold
  2638. This indicates what sample value should be treated as silence. For digital
  2639. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2640. you may wish to increase the value to account for background noise.
  2641. Can be specified in dB (in case "dB" is appended to the specified value)
  2642. or amplitude ratio. Default value is @code{0}.
  2643. @item stop_periods
  2644. Set the count for trimming silence from the end of audio.
  2645. To remove silence from the middle of a file, specify a @var{stop_periods}
  2646. that is negative. This value is then treated as a positive value and is
  2647. used to indicate the effect should restart processing as specified by
  2648. @var{start_periods}, making it suitable for removing periods of silence
  2649. in the middle of the audio.
  2650. Default value is @code{0}.
  2651. @item stop_duration
  2652. Specify a duration of silence that must exist before audio is not copied any
  2653. more. By specifying a higher duration, silence that is wanted can be left in
  2654. the audio.
  2655. Default value is @code{0}.
  2656. @item stop_threshold
  2657. This is the same as @option{start_threshold} but for trimming silence from
  2658. the end of audio.
  2659. Can be specified in dB (in case "dB" is appended to the specified value)
  2660. or amplitude ratio. Default value is @code{0}.
  2661. @item leave_silence
  2662. This indicate that @var{stop_duration} length of audio should be left intact
  2663. at the beginning of each period of silence.
  2664. For example, if you want to remove long pauses between words but do not want
  2665. to remove the pauses completely. Default value is @code{0}.
  2666. @item detection
  2667. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2668. and works better with digital silence which is exactly 0.
  2669. Default value is @code{rms}.
  2670. @item window
  2671. Set ratio used to calculate size of window for detecting silence.
  2672. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2673. @end table
  2674. @subsection Examples
  2675. @itemize
  2676. @item
  2677. The following example shows how this filter can be used to start a recording
  2678. that does not contain the delay at the start which usually occurs between
  2679. pressing the record button and the start of the performance:
  2680. @example
  2681. silenceremove=1:5:0.02
  2682. @end example
  2683. @item
  2684. Trim all silence encountered from beginning to end where there is more than 1
  2685. second of silence in audio:
  2686. @example
  2687. silenceremove=0:0:0:-1:1:-90dB
  2688. @end example
  2689. @end itemize
  2690. @section sofalizer
  2691. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2692. loudspeakers around the user for binaural listening via headphones (audio
  2693. formats up to 9 channels supported).
  2694. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2695. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2696. Austrian Academy of Sciences.
  2697. To enable compilation of this filter you need to configure FFmpeg with
  2698. @code{--enable-netcdf}.
  2699. The filter accepts the following options:
  2700. @table @option
  2701. @item sofa
  2702. Set the SOFA file used for rendering.
  2703. @item gain
  2704. Set gain applied to audio. Value is in dB. Default is 0.
  2705. @item rotation
  2706. Set rotation of virtual loudspeakers in deg. Default is 0.
  2707. @item elevation
  2708. Set elevation of virtual speakers in deg. Default is 0.
  2709. @item radius
  2710. Set distance in meters between loudspeakers and the listener with near-field
  2711. HRTFs. Default is 1.
  2712. @item type
  2713. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2714. processing audio in time domain which is slow.
  2715. @var{freq} is processing audio in frequency domain which is fast.
  2716. Default is @var{freq}.
  2717. @item speakers
  2718. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2719. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2720. Each virtual loudspeaker is described with short channel name following with
  2721. azimuth and elevation in degreees.
  2722. Each virtual loudspeaker description is separated by '|'.
  2723. For example to override front left and front right channel positions use:
  2724. 'speakers=FL 45 15|FR 345 15'.
  2725. Descriptions with unrecognised channel names are ignored.
  2726. @end table
  2727. @subsection Examples
  2728. @itemize
  2729. @item
  2730. Using ClubFritz6 sofa file:
  2731. @example
  2732. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2733. @end example
  2734. @item
  2735. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2736. @example
  2737. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2738. @end example
  2739. @item
  2740. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2741. and also with custom gain:
  2742. @example
  2743. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2744. @end example
  2745. @end itemize
  2746. @section stereotools
  2747. This filter has some handy utilities to manage stereo signals, for converting
  2748. M/S stereo recordings to L/R signal while having control over the parameters
  2749. or spreading the stereo image of master track.
  2750. The filter accepts the following options:
  2751. @table @option
  2752. @item level_in
  2753. Set input level before filtering for both channels. Defaults is 1.
  2754. Allowed range is from 0.015625 to 64.
  2755. @item level_out
  2756. Set output level after filtering for both channels. Defaults is 1.
  2757. Allowed range is from 0.015625 to 64.
  2758. @item balance_in
  2759. Set input balance between both channels. Default is 0.
  2760. Allowed range is from -1 to 1.
  2761. @item balance_out
  2762. Set output balance between both channels. Default is 0.
  2763. Allowed range is from -1 to 1.
  2764. @item softclip
  2765. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2766. clipping. Disabled by default.
  2767. @item mutel
  2768. Mute the left channel. Disabled by default.
  2769. @item muter
  2770. Mute the right channel. Disabled by default.
  2771. @item phasel
  2772. Change the phase of the left channel. Disabled by default.
  2773. @item phaser
  2774. Change the phase of the right channel. Disabled by default.
  2775. @item mode
  2776. Set stereo mode. Available values are:
  2777. @table @samp
  2778. @item lr>lr
  2779. Left/Right to Left/Right, this is default.
  2780. @item lr>ms
  2781. Left/Right to Mid/Side.
  2782. @item ms>lr
  2783. Mid/Side to Left/Right.
  2784. @item lr>ll
  2785. Left/Right to Left/Left.
  2786. @item lr>rr
  2787. Left/Right to Right/Right.
  2788. @item lr>l+r
  2789. Left/Right to Left + Right.
  2790. @item lr>rl
  2791. Left/Right to Right/Left.
  2792. @end table
  2793. @item slev
  2794. Set level of side signal. Default is 1.
  2795. Allowed range is from 0.015625 to 64.
  2796. @item sbal
  2797. Set balance of side signal. Default is 0.
  2798. Allowed range is from -1 to 1.
  2799. @item mlev
  2800. Set level of the middle signal. Default is 1.
  2801. Allowed range is from 0.015625 to 64.
  2802. @item mpan
  2803. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2804. @item base
  2805. Set stereo base between mono and inversed channels. Default is 0.
  2806. Allowed range is from -1 to 1.
  2807. @item delay
  2808. Set delay in milliseconds how much to delay left from right channel and
  2809. vice versa. Default is 0. Allowed range is from -20 to 20.
  2810. @item sclevel
  2811. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2812. @item phase
  2813. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2814. @end table
  2815. @subsection Examples
  2816. @itemize
  2817. @item
  2818. Apply karaoke like effect:
  2819. @example
  2820. stereotools=mlev=0.015625
  2821. @end example
  2822. @item
  2823. Convert M/S signal to L/R:
  2824. @example
  2825. "stereotools=mode=ms>lr"
  2826. @end example
  2827. @end itemize
  2828. @section stereowiden
  2829. This filter enhance the stereo effect by suppressing signal common to both
  2830. channels and by delaying the signal of left into right and vice versa,
  2831. thereby widening the stereo effect.
  2832. The filter accepts the following options:
  2833. @table @option
  2834. @item delay
  2835. Time in milliseconds of the delay of left signal into right and vice versa.
  2836. Default is 20 milliseconds.
  2837. @item feedback
  2838. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2839. effect of left signal in right output and vice versa which gives widening
  2840. effect. Default is 0.3.
  2841. @item crossfeed
  2842. Cross feed of left into right with inverted phase. This helps in suppressing
  2843. the mono. If the value is 1 it will cancel all the signal common to both
  2844. channels. Default is 0.3.
  2845. @item drymix
  2846. Set level of input signal of original channel. Default is 0.8.
  2847. @end table
  2848. @section treble
  2849. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2850. shelving filter with a response similar to that of a standard
  2851. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2852. The filter accepts the following options:
  2853. @table @option
  2854. @item gain, g
  2855. Give the gain at whichever is the lower of ~22 kHz and the
  2856. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2857. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2858. @item frequency, f
  2859. Set the filter's central frequency and so can be used
  2860. to extend or reduce the frequency range to be boosted or cut.
  2861. The default value is @code{3000} Hz.
  2862. @item width_type
  2863. Set method to specify band-width of filter.
  2864. @table @option
  2865. @item h
  2866. Hz
  2867. @item q
  2868. Q-Factor
  2869. @item o
  2870. octave
  2871. @item s
  2872. slope
  2873. @end table
  2874. @item width, w
  2875. Determine how steep is the filter's shelf transition.
  2876. @end table
  2877. @section tremolo
  2878. Sinusoidal amplitude modulation.
  2879. The filter accepts the following options:
  2880. @table @option
  2881. @item f
  2882. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2883. (20 Hz or lower) will result in a tremolo effect.
  2884. This filter may also be used as a ring modulator by specifying
  2885. a modulation frequency higher than 20 Hz.
  2886. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2887. @item d
  2888. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2889. Default value is 0.5.
  2890. @end table
  2891. @section vibrato
  2892. Sinusoidal phase modulation.
  2893. The filter accepts the following options:
  2894. @table @option
  2895. @item f
  2896. Modulation frequency in Hertz.
  2897. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2898. @item d
  2899. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2900. Default value is 0.5.
  2901. @end table
  2902. @section volume
  2903. Adjust the input audio volume.
  2904. It accepts the following parameters:
  2905. @table @option
  2906. @item volume
  2907. Set audio volume expression.
  2908. Output values are clipped to the maximum value.
  2909. The output audio volume is given by the relation:
  2910. @example
  2911. @var{output_volume} = @var{volume} * @var{input_volume}
  2912. @end example
  2913. The default value for @var{volume} is "1.0".
  2914. @item precision
  2915. This parameter represents the mathematical precision.
  2916. It determines which input sample formats will be allowed, which affects the
  2917. precision of the volume scaling.
  2918. @table @option
  2919. @item fixed
  2920. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2921. @item float
  2922. 32-bit floating-point; this limits input sample format to FLT. (default)
  2923. @item double
  2924. 64-bit floating-point; this limits input sample format to DBL.
  2925. @end table
  2926. @item replaygain
  2927. Choose the behaviour on encountering ReplayGain side data in input frames.
  2928. @table @option
  2929. @item drop
  2930. Remove ReplayGain side data, ignoring its contents (the default).
  2931. @item ignore
  2932. Ignore ReplayGain side data, but leave it in the frame.
  2933. @item track
  2934. Prefer the track gain, if present.
  2935. @item album
  2936. Prefer the album gain, if present.
  2937. @end table
  2938. @item replaygain_preamp
  2939. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2940. Default value for @var{replaygain_preamp} is 0.0.
  2941. @item eval
  2942. Set when the volume expression is evaluated.
  2943. It accepts the following values:
  2944. @table @samp
  2945. @item once
  2946. only evaluate expression once during the filter initialization, or
  2947. when the @samp{volume} command is sent
  2948. @item frame
  2949. evaluate expression for each incoming frame
  2950. @end table
  2951. Default value is @samp{once}.
  2952. @end table
  2953. The volume expression can contain the following parameters.
  2954. @table @option
  2955. @item n
  2956. frame number (starting at zero)
  2957. @item nb_channels
  2958. number of channels
  2959. @item nb_consumed_samples
  2960. number of samples consumed by the filter
  2961. @item nb_samples
  2962. number of samples in the current frame
  2963. @item pos
  2964. original frame position in the file
  2965. @item pts
  2966. frame PTS
  2967. @item sample_rate
  2968. sample rate
  2969. @item startpts
  2970. PTS at start of stream
  2971. @item startt
  2972. time at start of stream
  2973. @item t
  2974. frame time
  2975. @item tb
  2976. timestamp timebase
  2977. @item volume
  2978. last set volume value
  2979. @end table
  2980. Note that when @option{eval} is set to @samp{once} only the
  2981. @var{sample_rate} and @var{tb} variables are available, all other
  2982. variables will evaluate to NAN.
  2983. @subsection Commands
  2984. This filter supports the following commands:
  2985. @table @option
  2986. @item volume
  2987. Modify the volume expression.
  2988. The command accepts the same syntax of the corresponding option.
  2989. If the specified expression is not valid, it is kept at its current
  2990. value.
  2991. @item replaygain_noclip
  2992. Prevent clipping by limiting the gain applied.
  2993. Default value for @var{replaygain_noclip} is 1.
  2994. @end table
  2995. @subsection Examples
  2996. @itemize
  2997. @item
  2998. Halve the input audio volume:
  2999. @example
  3000. volume=volume=0.5
  3001. volume=volume=1/2
  3002. volume=volume=-6.0206dB
  3003. @end example
  3004. In all the above example the named key for @option{volume} can be
  3005. omitted, for example like in:
  3006. @example
  3007. volume=0.5
  3008. @end example
  3009. @item
  3010. Increase input audio power by 6 decibels using fixed-point precision:
  3011. @example
  3012. volume=volume=6dB:precision=fixed
  3013. @end example
  3014. @item
  3015. Fade volume after time 10 with an annihilation period of 5 seconds:
  3016. @example
  3017. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3018. @end example
  3019. @end itemize
  3020. @section volumedetect
  3021. Detect the volume of the input video.
  3022. The filter has no parameters. The input is not modified. Statistics about
  3023. the volume will be printed in the log when the input stream end is reached.
  3024. In particular it will show the mean volume (root mean square), maximum
  3025. volume (on a per-sample basis), and the beginning of a histogram of the
  3026. registered volume values (from the maximum value to a cumulated 1/1000 of
  3027. the samples).
  3028. All volumes are in decibels relative to the maximum PCM value.
  3029. @subsection Examples
  3030. Here is an excerpt of the output:
  3031. @example
  3032. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3033. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3034. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3035. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3036. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3037. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3038. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3039. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3040. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3041. @end example
  3042. It means that:
  3043. @itemize
  3044. @item
  3045. The mean square energy is approximately -27 dB, or 10^-2.7.
  3046. @item
  3047. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3048. @item
  3049. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3050. @end itemize
  3051. In other words, raising the volume by +4 dB does not cause any clipping,
  3052. raising it by +5 dB causes clipping for 6 samples, etc.
  3053. @c man end AUDIO FILTERS
  3054. @chapter Audio Sources
  3055. @c man begin AUDIO SOURCES
  3056. Below is a description of the currently available audio sources.
  3057. @section abuffer
  3058. Buffer audio frames, and make them available to the filter chain.
  3059. This source is mainly intended for a programmatic use, in particular
  3060. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3061. It accepts the following parameters:
  3062. @table @option
  3063. @item time_base
  3064. The timebase which will be used for timestamps of submitted frames. It must be
  3065. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3066. @item sample_rate
  3067. The sample rate of the incoming audio buffers.
  3068. @item sample_fmt
  3069. The sample format of the incoming audio buffers.
  3070. Either a sample format name or its corresponding integer representation from
  3071. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3072. @item channel_layout
  3073. The channel layout of the incoming audio buffers.
  3074. Either a channel layout name from channel_layout_map in
  3075. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3076. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3077. @item channels
  3078. The number of channels of the incoming audio buffers.
  3079. If both @var{channels} and @var{channel_layout} are specified, then they
  3080. must be consistent.
  3081. @end table
  3082. @subsection Examples
  3083. @example
  3084. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3085. @end example
  3086. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3087. Since the sample format with name "s16p" corresponds to the number
  3088. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3089. equivalent to:
  3090. @example
  3091. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3092. @end example
  3093. @section aevalsrc
  3094. Generate an audio signal specified by an expression.
  3095. This source accepts in input one or more expressions (one for each
  3096. channel), which are evaluated and used to generate a corresponding
  3097. audio signal.
  3098. This source accepts the following options:
  3099. @table @option
  3100. @item exprs
  3101. Set the '|'-separated expressions list for each separate channel. In case the
  3102. @option{channel_layout} option is not specified, the selected channel layout
  3103. depends on the number of provided expressions. Otherwise the last
  3104. specified expression is applied to the remaining output channels.
  3105. @item channel_layout, c
  3106. Set the channel layout. The number of channels in the specified layout
  3107. must be equal to the number of specified expressions.
  3108. @item duration, d
  3109. Set the minimum duration of the sourced audio. See
  3110. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3111. for the accepted syntax.
  3112. Note that the resulting duration may be greater than the specified
  3113. duration, as the generated audio is always cut at the end of a
  3114. complete frame.
  3115. If not specified, or the expressed duration is negative, the audio is
  3116. supposed to be generated forever.
  3117. @item nb_samples, n
  3118. Set the number of samples per channel per each output frame,
  3119. default to 1024.
  3120. @item sample_rate, s
  3121. Specify the sample rate, default to 44100.
  3122. @end table
  3123. Each expression in @var{exprs} can contain the following constants:
  3124. @table @option
  3125. @item n
  3126. number of the evaluated sample, starting from 0
  3127. @item t
  3128. time of the evaluated sample expressed in seconds, starting from 0
  3129. @item s
  3130. sample rate
  3131. @end table
  3132. @subsection Examples
  3133. @itemize
  3134. @item
  3135. Generate silence:
  3136. @example
  3137. aevalsrc=0
  3138. @end example
  3139. @item
  3140. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3141. 8000 Hz:
  3142. @example
  3143. aevalsrc="sin(440*2*PI*t):s=8000"
  3144. @end example
  3145. @item
  3146. Generate a two channels signal, specify the channel layout (Front
  3147. Center + Back Center) explicitly:
  3148. @example
  3149. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3150. @end example
  3151. @item
  3152. Generate white noise:
  3153. @example
  3154. aevalsrc="-2+random(0)"
  3155. @end example
  3156. @item
  3157. Generate an amplitude modulated signal:
  3158. @example
  3159. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3160. @end example
  3161. @item
  3162. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3163. @example
  3164. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3165. @end example
  3166. @end itemize
  3167. @section anullsrc
  3168. The null audio source, return unprocessed audio frames. It is mainly useful
  3169. as a template and to be employed in analysis / debugging tools, or as
  3170. the source for filters which ignore the input data (for example the sox
  3171. synth filter).
  3172. This source accepts the following options:
  3173. @table @option
  3174. @item channel_layout, cl
  3175. Specifies the channel layout, and can be either an integer or a string
  3176. representing a channel layout. The default value of @var{channel_layout}
  3177. is "stereo".
  3178. Check the channel_layout_map definition in
  3179. @file{libavutil/channel_layout.c} for the mapping between strings and
  3180. channel layout values.
  3181. @item sample_rate, r
  3182. Specifies the sample rate, and defaults to 44100.
  3183. @item nb_samples, n
  3184. Set the number of samples per requested frames.
  3185. @end table
  3186. @subsection Examples
  3187. @itemize
  3188. @item
  3189. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3190. @example
  3191. anullsrc=r=48000:cl=4
  3192. @end example
  3193. @item
  3194. Do the same operation with a more obvious syntax:
  3195. @example
  3196. anullsrc=r=48000:cl=mono
  3197. @end example
  3198. @end itemize
  3199. All the parameters need to be explicitly defined.
  3200. @section flite
  3201. Synthesize a voice utterance using the libflite library.
  3202. To enable compilation of this filter you need to configure FFmpeg with
  3203. @code{--enable-libflite}.
  3204. Note that the flite library is not thread-safe.
  3205. The filter accepts the following options:
  3206. @table @option
  3207. @item list_voices
  3208. If set to 1, list the names of the available voices and exit
  3209. immediately. Default value is 0.
  3210. @item nb_samples, n
  3211. Set the maximum number of samples per frame. Default value is 512.
  3212. @item textfile
  3213. Set the filename containing the text to speak.
  3214. @item text
  3215. Set the text to speak.
  3216. @item voice, v
  3217. Set the voice to use for the speech synthesis. Default value is
  3218. @code{kal}. See also the @var{list_voices} option.
  3219. @end table
  3220. @subsection Examples
  3221. @itemize
  3222. @item
  3223. Read from file @file{speech.txt}, and synthesize the text using the
  3224. standard flite voice:
  3225. @example
  3226. flite=textfile=speech.txt
  3227. @end example
  3228. @item
  3229. Read the specified text selecting the @code{slt} voice:
  3230. @example
  3231. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3232. @end example
  3233. @item
  3234. Input text to ffmpeg:
  3235. @example
  3236. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3237. @end example
  3238. @item
  3239. Make @file{ffplay} speak the specified text, using @code{flite} and
  3240. the @code{lavfi} device:
  3241. @example
  3242. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3243. @end example
  3244. @end itemize
  3245. For more information about libflite, check:
  3246. @url{http://www.speech.cs.cmu.edu/flite/}
  3247. @section anoisesrc
  3248. Generate a noise audio signal.
  3249. The filter accepts the following options:
  3250. @table @option
  3251. @item sample_rate, r
  3252. Specify the sample rate. Default value is 48000 Hz.
  3253. @item amplitude, a
  3254. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3255. is 1.0.
  3256. @item duration, d
  3257. Specify the duration of the generated audio stream. Not specifying this option
  3258. results in noise with an infinite length.
  3259. @item color, colour, c
  3260. Specify the color of noise. Available noise colors are white, pink, and brown.
  3261. Default color is white.
  3262. @item seed, s
  3263. Specify a value used to seed the PRNG.
  3264. @item nb_samples, n
  3265. Set the number of samples per each output frame, default is 1024.
  3266. @end table
  3267. @subsection Examples
  3268. @itemize
  3269. @item
  3270. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3271. @example
  3272. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3273. @end example
  3274. @end itemize
  3275. @section sine
  3276. Generate an audio signal made of a sine wave with amplitude 1/8.
  3277. The audio signal is bit-exact.
  3278. The filter accepts the following options:
  3279. @table @option
  3280. @item frequency, f
  3281. Set the carrier frequency. Default is 440 Hz.
  3282. @item beep_factor, b
  3283. Enable a periodic beep every second with frequency @var{beep_factor} times
  3284. the carrier frequency. Default is 0, meaning the beep is disabled.
  3285. @item sample_rate, r
  3286. Specify the sample rate, default is 44100.
  3287. @item duration, d
  3288. Specify the duration of the generated audio stream.
  3289. @item samples_per_frame
  3290. Set the number of samples per output frame.
  3291. The expression can contain the following constants:
  3292. @table @option
  3293. @item n
  3294. The (sequential) number of the output audio frame, starting from 0.
  3295. @item pts
  3296. The PTS (Presentation TimeStamp) of the output audio frame,
  3297. expressed in @var{TB} units.
  3298. @item t
  3299. The PTS of the output audio frame, expressed in seconds.
  3300. @item TB
  3301. The timebase of the output audio frames.
  3302. @end table
  3303. Default is @code{1024}.
  3304. @end table
  3305. @subsection Examples
  3306. @itemize
  3307. @item
  3308. Generate a simple 440 Hz sine wave:
  3309. @example
  3310. sine
  3311. @end example
  3312. @item
  3313. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3314. @example
  3315. sine=220:4:d=5
  3316. sine=f=220:b=4:d=5
  3317. sine=frequency=220:beep_factor=4:duration=5
  3318. @end example
  3319. @item
  3320. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3321. pattern:
  3322. @example
  3323. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3324. @end example
  3325. @end itemize
  3326. @c man end AUDIO SOURCES
  3327. @chapter Audio Sinks
  3328. @c man begin AUDIO SINKS
  3329. Below is a description of the currently available audio sinks.
  3330. @section abuffersink
  3331. Buffer audio frames, and make them available to the end of filter chain.
  3332. This sink is mainly intended for programmatic use, in particular
  3333. through the interface defined in @file{libavfilter/buffersink.h}
  3334. or the options system.
  3335. It accepts a pointer to an AVABufferSinkContext structure, which
  3336. defines the incoming buffers' formats, to be passed as the opaque
  3337. parameter to @code{avfilter_init_filter} for initialization.
  3338. @section anullsink
  3339. Null audio sink; do absolutely nothing with the input audio. It is
  3340. mainly useful as a template and for use in analysis / debugging
  3341. tools.
  3342. @c man end AUDIO SINKS
  3343. @chapter Video Filters
  3344. @c man begin VIDEO FILTERS
  3345. When you configure your FFmpeg build, you can disable any of the
  3346. existing filters using @code{--disable-filters}.
  3347. The configure output will show the video filters included in your
  3348. build.
  3349. Below is a description of the currently available video filters.
  3350. @section alphaextract
  3351. Extract the alpha component from the input as a grayscale video. This
  3352. is especially useful with the @var{alphamerge} filter.
  3353. @section alphamerge
  3354. Add or replace the alpha component of the primary input with the
  3355. grayscale value of a second input. This is intended for use with
  3356. @var{alphaextract} to allow the transmission or storage of frame
  3357. sequences that have alpha in a format that doesn't support an alpha
  3358. channel.
  3359. For example, to reconstruct full frames from a normal YUV-encoded video
  3360. and a separate video created with @var{alphaextract}, you might use:
  3361. @example
  3362. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3363. @end example
  3364. Since this filter is designed for reconstruction, it operates on frame
  3365. sequences without considering timestamps, and terminates when either
  3366. input reaches end of stream. This will cause problems if your encoding
  3367. pipeline drops frames. If you're trying to apply an image as an
  3368. overlay to a video stream, consider the @var{overlay} filter instead.
  3369. @section ass
  3370. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3371. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3372. Substation Alpha) subtitles files.
  3373. This filter accepts the following option in addition to the common options from
  3374. the @ref{subtitles} filter:
  3375. @table @option
  3376. @item shaping
  3377. Set the shaping engine
  3378. Available values are:
  3379. @table @samp
  3380. @item auto
  3381. The default libass shaping engine, which is the best available.
  3382. @item simple
  3383. Fast, font-agnostic shaper that can do only substitutions
  3384. @item complex
  3385. Slower shaper using OpenType for substitutions and positioning
  3386. @end table
  3387. The default is @code{auto}.
  3388. @end table
  3389. @section atadenoise
  3390. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3391. The filter accepts the following options:
  3392. @table @option
  3393. @item 0a
  3394. Set threshold A for 1st plane. Default is 0.02.
  3395. Valid range is 0 to 0.3.
  3396. @item 0b
  3397. Set threshold B for 1st plane. Default is 0.04.
  3398. Valid range is 0 to 5.
  3399. @item 1a
  3400. Set threshold A for 2nd plane. Default is 0.02.
  3401. Valid range is 0 to 0.3.
  3402. @item 1b
  3403. Set threshold B for 2nd plane. Default is 0.04.
  3404. Valid range is 0 to 5.
  3405. @item 2a
  3406. Set threshold A for 3rd plane. Default is 0.02.
  3407. Valid range is 0 to 0.3.
  3408. @item 2b
  3409. Set threshold B for 3rd plane. Default is 0.04.
  3410. Valid range is 0 to 5.
  3411. Threshold A is designed to react on abrupt changes in the input signal and
  3412. threshold B is designed to react on continuous changes in the input signal.
  3413. @item s
  3414. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3415. number in range [5, 129].
  3416. @end table
  3417. @section bbox
  3418. Compute the bounding box for the non-black pixels in the input frame
  3419. luminance plane.
  3420. This filter computes the bounding box containing all the pixels with a
  3421. luminance value greater than the minimum allowed value.
  3422. The parameters describing the bounding box are printed on the filter
  3423. log.
  3424. The filter accepts the following option:
  3425. @table @option
  3426. @item min_val
  3427. Set the minimal luminance value. Default is @code{16}.
  3428. @end table
  3429. @section blackdetect
  3430. Detect video intervals that are (almost) completely black. Can be
  3431. useful to detect chapter transitions, commercials, or invalid
  3432. recordings. Output lines contains the time for the start, end and
  3433. duration of the detected black interval expressed in seconds.
  3434. In order to display the output lines, you need to set the loglevel at
  3435. least to the AV_LOG_INFO value.
  3436. The filter accepts the following options:
  3437. @table @option
  3438. @item black_min_duration, d
  3439. Set the minimum detected black duration expressed in seconds. It must
  3440. be a non-negative floating point number.
  3441. Default value is 2.0.
  3442. @item picture_black_ratio_th, pic_th
  3443. Set the threshold for considering a picture "black".
  3444. Express the minimum value for the ratio:
  3445. @example
  3446. @var{nb_black_pixels} / @var{nb_pixels}
  3447. @end example
  3448. for which a picture is considered black.
  3449. Default value is 0.98.
  3450. @item pixel_black_th, pix_th
  3451. Set the threshold for considering a pixel "black".
  3452. The threshold expresses the maximum pixel luminance value for which a
  3453. pixel is considered "black". The provided value is scaled according to
  3454. the following equation:
  3455. @example
  3456. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3457. @end example
  3458. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3459. the input video format, the range is [0-255] for YUV full-range
  3460. formats and [16-235] for YUV non full-range formats.
  3461. Default value is 0.10.
  3462. @end table
  3463. The following example sets the maximum pixel threshold to the minimum
  3464. value, and detects only black intervals of 2 or more seconds:
  3465. @example
  3466. blackdetect=d=2:pix_th=0.00
  3467. @end example
  3468. @section blackframe
  3469. Detect frames that are (almost) completely black. Can be useful to
  3470. detect chapter transitions or commercials. Output lines consist of
  3471. the frame number of the detected frame, the percentage of blackness,
  3472. the position in the file if known or -1 and the timestamp in seconds.
  3473. In order to display the output lines, you need to set the loglevel at
  3474. least to the AV_LOG_INFO value.
  3475. It accepts the following parameters:
  3476. @table @option
  3477. @item amount
  3478. The percentage of the pixels that have to be below the threshold; it defaults to
  3479. @code{98}.
  3480. @item threshold, thresh
  3481. The threshold below which a pixel value is considered black; it defaults to
  3482. @code{32}.
  3483. @end table
  3484. @section blend, tblend
  3485. Blend two video frames into each other.
  3486. The @code{blend} filter takes two input streams and outputs one
  3487. stream, the first input is the "top" layer and second input is
  3488. "bottom" layer. Output terminates when shortest input terminates.
  3489. The @code{tblend} (time blend) filter takes two consecutive frames
  3490. from one single stream, and outputs the result obtained by blending
  3491. the new frame on top of the old frame.
  3492. A description of the accepted options follows.
  3493. @table @option
  3494. @item c0_mode
  3495. @item c1_mode
  3496. @item c2_mode
  3497. @item c3_mode
  3498. @item all_mode
  3499. Set blend mode for specific pixel component or all pixel components in case
  3500. of @var{all_mode}. Default value is @code{normal}.
  3501. Available values for component modes are:
  3502. @table @samp
  3503. @item addition
  3504. @item addition128
  3505. @item and
  3506. @item average
  3507. @item burn
  3508. @item darken
  3509. @item difference
  3510. @item difference128
  3511. @item divide
  3512. @item dodge
  3513. @item freeze
  3514. @item exclusion
  3515. @item glow
  3516. @item hardlight
  3517. @item hardmix
  3518. @item heat
  3519. @item lighten
  3520. @item linearlight
  3521. @item multiply
  3522. @item multiply128
  3523. @item negation
  3524. @item normal
  3525. @item or
  3526. @item overlay
  3527. @item phoenix
  3528. @item pinlight
  3529. @item reflect
  3530. @item screen
  3531. @item softlight
  3532. @item subtract
  3533. @item vividlight
  3534. @item xor
  3535. @end table
  3536. @item c0_opacity
  3537. @item c1_opacity
  3538. @item c2_opacity
  3539. @item c3_opacity
  3540. @item all_opacity
  3541. Set blend opacity for specific pixel component or all pixel components in case
  3542. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3543. @item c0_expr
  3544. @item c1_expr
  3545. @item c2_expr
  3546. @item c3_expr
  3547. @item all_expr
  3548. Set blend expression for specific pixel component or all pixel components in case
  3549. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3550. The expressions can use the following variables:
  3551. @table @option
  3552. @item N
  3553. The sequential number of the filtered frame, starting from @code{0}.
  3554. @item X
  3555. @item Y
  3556. the coordinates of the current sample
  3557. @item W
  3558. @item H
  3559. the width and height of currently filtered plane
  3560. @item SW
  3561. @item SH
  3562. Width and height scale depending on the currently filtered plane. It is the
  3563. ratio between the corresponding luma plane number of pixels and the current
  3564. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3565. @code{0.5,0.5} for chroma planes.
  3566. @item T
  3567. Time of the current frame, expressed in seconds.
  3568. @item TOP, A
  3569. Value of pixel component at current location for first video frame (top layer).
  3570. @item BOTTOM, B
  3571. Value of pixel component at current location for second video frame (bottom layer).
  3572. @end table
  3573. @item shortest
  3574. Force termination when the shortest input terminates. Default is
  3575. @code{0}. This option is only defined for the @code{blend} filter.
  3576. @item repeatlast
  3577. Continue applying the last bottom frame after the end of the stream. A value of
  3578. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3579. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3580. @end table
  3581. @subsection Examples
  3582. @itemize
  3583. @item
  3584. Apply transition from bottom layer to top layer in first 10 seconds:
  3585. @example
  3586. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3587. @end example
  3588. @item
  3589. Apply 1x1 checkerboard effect:
  3590. @example
  3591. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3592. @end example
  3593. @item
  3594. Apply uncover left effect:
  3595. @example
  3596. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3597. @end example
  3598. @item
  3599. Apply uncover down effect:
  3600. @example
  3601. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3602. @end example
  3603. @item
  3604. Apply uncover up-left effect:
  3605. @example
  3606. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3607. @end example
  3608. @item
  3609. Split diagonally video and shows top and bottom layer on each side:
  3610. @example
  3611. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3612. @end example
  3613. @item
  3614. Display differences between the current and the previous frame:
  3615. @example
  3616. tblend=all_mode=difference128
  3617. @end example
  3618. @end itemize
  3619. @section boxblur
  3620. Apply a boxblur algorithm to the input video.
  3621. It accepts the following parameters:
  3622. @table @option
  3623. @item luma_radius, lr
  3624. @item luma_power, lp
  3625. @item chroma_radius, cr
  3626. @item chroma_power, cp
  3627. @item alpha_radius, ar
  3628. @item alpha_power, ap
  3629. @end table
  3630. A description of the accepted options follows.
  3631. @table @option
  3632. @item luma_radius, lr
  3633. @item chroma_radius, cr
  3634. @item alpha_radius, ar
  3635. Set an expression for the box radius in pixels used for blurring the
  3636. corresponding input plane.
  3637. The radius value must be a non-negative number, and must not be
  3638. greater than the value of the expression @code{min(w,h)/2} for the
  3639. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3640. planes.
  3641. Default value for @option{luma_radius} is "2". If not specified,
  3642. @option{chroma_radius} and @option{alpha_radius} default to the
  3643. corresponding value set for @option{luma_radius}.
  3644. The expressions can contain the following constants:
  3645. @table @option
  3646. @item w
  3647. @item h
  3648. The input width and height in pixels.
  3649. @item cw
  3650. @item ch
  3651. The input chroma image width and height in pixels.
  3652. @item hsub
  3653. @item vsub
  3654. The horizontal and vertical chroma subsample values. For example, for the
  3655. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3656. @end table
  3657. @item luma_power, lp
  3658. @item chroma_power, cp
  3659. @item alpha_power, ap
  3660. Specify how many times the boxblur filter is applied to the
  3661. corresponding plane.
  3662. Default value for @option{luma_power} is 2. If not specified,
  3663. @option{chroma_power} and @option{alpha_power} default to the
  3664. corresponding value set for @option{luma_power}.
  3665. A value of 0 will disable the effect.
  3666. @end table
  3667. @subsection Examples
  3668. @itemize
  3669. @item
  3670. Apply a boxblur filter with the luma, chroma, and alpha radii
  3671. set to 2:
  3672. @example
  3673. boxblur=luma_radius=2:luma_power=1
  3674. boxblur=2:1
  3675. @end example
  3676. @item
  3677. Set the luma radius to 2, and alpha and chroma radius to 0:
  3678. @example
  3679. boxblur=2:1:cr=0:ar=0
  3680. @end example
  3681. @item
  3682. Set the luma and chroma radii to a fraction of the video dimension:
  3683. @example
  3684. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3685. @end example
  3686. @end itemize
  3687. @section bwdif
  3688. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3689. Deinterlacing Filter").
  3690. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3691. interpolation algorithms.
  3692. It accepts the following parameters:
  3693. @table @option
  3694. @item mode
  3695. The interlacing mode to adopt. It accepts one of the following values:
  3696. @table @option
  3697. @item 0, send_frame
  3698. Output one frame for each frame.
  3699. @item 1, send_field
  3700. Output one frame for each field.
  3701. @end table
  3702. The default value is @code{send_field}.
  3703. @item parity
  3704. The picture field parity assumed for the input interlaced video. It accepts one
  3705. of the following values:
  3706. @table @option
  3707. @item 0, tff
  3708. Assume the top field is first.
  3709. @item 1, bff
  3710. Assume the bottom field is first.
  3711. @item -1, auto
  3712. Enable automatic detection of field parity.
  3713. @end table
  3714. The default value is @code{auto}.
  3715. If the interlacing is unknown or the decoder does not export this information,
  3716. top field first will be assumed.
  3717. @item deint
  3718. Specify which frames to deinterlace. Accept one of the following
  3719. values:
  3720. @table @option
  3721. @item 0, all
  3722. Deinterlace all frames.
  3723. @item 1, interlaced
  3724. Only deinterlace frames marked as interlaced.
  3725. @end table
  3726. The default value is @code{all}.
  3727. @end table
  3728. @section chromakey
  3729. YUV colorspace color/chroma keying.
  3730. The filter accepts the following options:
  3731. @table @option
  3732. @item color
  3733. The color which will be replaced with transparency.
  3734. @item similarity
  3735. Similarity percentage with the key color.
  3736. 0.01 matches only the exact key color, while 1.0 matches everything.
  3737. @item blend
  3738. Blend percentage.
  3739. 0.0 makes pixels either fully transparent, or not transparent at all.
  3740. Higher values result in semi-transparent pixels, with a higher transparency
  3741. the more similar the pixels color is to the key color.
  3742. @item yuv
  3743. Signals that the color passed is already in YUV instead of RGB.
  3744. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3745. This can be used to pass exact YUV values as hexadecimal numbers.
  3746. @end table
  3747. @subsection Examples
  3748. @itemize
  3749. @item
  3750. Make every green pixel in the input image transparent:
  3751. @example
  3752. ffmpeg -i input.png -vf chromakey=green out.png
  3753. @end example
  3754. @item
  3755. Overlay a greenscreen-video on top of a static black background.
  3756. @example
  3757. 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
  3758. @end example
  3759. @end itemize
  3760. @section ciescope
  3761. Display CIE color diagram with pixels overlaid onto it.
  3762. The filter accepts the following options:
  3763. @table @option
  3764. @item system
  3765. Set color system.
  3766. @table @samp
  3767. @item ntsc, 470m
  3768. @item ebu, 470bg
  3769. @item smpte
  3770. @item 240m
  3771. @item apple
  3772. @item widergb
  3773. @item cie1931
  3774. @item rec709, hdtv
  3775. @item uhdtv, rec2020
  3776. @end table
  3777. @item cie
  3778. Set CIE system.
  3779. @table @samp
  3780. @item xyy
  3781. @item ucs
  3782. @item luv
  3783. @end table
  3784. @item gamuts
  3785. Set what gamuts to draw.
  3786. See @code{system} option for available values.
  3787. @item size, s
  3788. Set ciescope size, by default set to 512.
  3789. @item intensity, i
  3790. Set intensity used to map input pixel values to CIE diagram.
  3791. @item contrast
  3792. Set contrast used to draw tongue colors that are out of active color system gamut.
  3793. @item corrgamma
  3794. Correct gamma displayed on scope, by default enabled.
  3795. @item showwhite
  3796. Show white point on CIE diagram, by default disabled.
  3797. @item gamma
  3798. Set input gamma. Used only with XYZ input color space.
  3799. @end table
  3800. @section codecview
  3801. Visualize information exported by some codecs.
  3802. Some codecs can export information through frames using side-data or other
  3803. means. For example, some MPEG based codecs export motion vectors through the
  3804. @var{export_mvs} flag in the codec @option{flags2} option.
  3805. The filter accepts the following option:
  3806. @table @option
  3807. @item mv
  3808. Set motion vectors to visualize.
  3809. Available flags for @var{mv} are:
  3810. @table @samp
  3811. @item pf
  3812. forward predicted MVs of P-frames
  3813. @item bf
  3814. forward predicted MVs of B-frames
  3815. @item bb
  3816. backward predicted MVs of B-frames
  3817. @end table
  3818. @item qp
  3819. Display quantization parameters using the chroma planes.
  3820. @item mv_type, mvt
  3821. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3822. Available flags for @var{mv_type} are:
  3823. @table @samp
  3824. @item fp
  3825. forward predicted MVs
  3826. @item bp
  3827. backward predicted MVs
  3828. @end table
  3829. @item frame_type, ft
  3830. Set frame type to visualize motion vectors of.
  3831. Available flags for @var{frame_type} are:
  3832. @table @samp
  3833. @item if
  3834. intra-coded frames (I-frames)
  3835. @item pf
  3836. predicted frames (P-frames)
  3837. @item bf
  3838. bi-directionally predicted frames (B-frames)
  3839. @end table
  3840. @end table
  3841. @subsection Examples
  3842. @itemize
  3843. @item
  3844. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3845. @example
  3846. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3847. @end example
  3848. @item
  3849. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3850. @example
  3851. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3852. @end example
  3853. @end itemize
  3854. @section colorbalance
  3855. Modify intensity of primary colors (red, green and blue) of input frames.
  3856. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3857. regions for the red-cyan, green-magenta or blue-yellow balance.
  3858. A positive adjustment value shifts the balance towards the primary color, a negative
  3859. value towards the complementary color.
  3860. The filter accepts the following options:
  3861. @table @option
  3862. @item rs
  3863. @item gs
  3864. @item bs
  3865. Adjust red, green and blue shadows (darkest pixels).
  3866. @item rm
  3867. @item gm
  3868. @item bm
  3869. Adjust red, green and blue midtones (medium pixels).
  3870. @item rh
  3871. @item gh
  3872. @item bh
  3873. Adjust red, green and blue highlights (brightest pixels).
  3874. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3875. @end table
  3876. @subsection Examples
  3877. @itemize
  3878. @item
  3879. Add red color cast to shadows:
  3880. @example
  3881. colorbalance=rs=.3
  3882. @end example
  3883. @end itemize
  3884. @section colorkey
  3885. RGB colorspace color keying.
  3886. The filter accepts the following options:
  3887. @table @option
  3888. @item color
  3889. The color which will be replaced with transparency.
  3890. @item similarity
  3891. Similarity percentage with the key color.
  3892. 0.01 matches only the exact key color, while 1.0 matches everything.
  3893. @item blend
  3894. Blend percentage.
  3895. 0.0 makes pixels either fully transparent, or not transparent at all.
  3896. Higher values result in semi-transparent pixels, with a higher transparency
  3897. the more similar the pixels color is to the key color.
  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 colorkey=green out.png
  3905. @end example
  3906. @item
  3907. Overlay a greenscreen-video on top of a static background image.
  3908. @example
  3909. 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
  3910. @end example
  3911. @end itemize
  3912. @section colorlevels
  3913. Adjust video input frames using levels.
  3914. The filter accepts the following options:
  3915. @table @option
  3916. @item rimin
  3917. @item gimin
  3918. @item bimin
  3919. @item aimin
  3920. Adjust red, green, blue and alpha input black point.
  3921. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3922. @item rimax
  3923. @item gimax
  3924. @item bimax
  3925. @item aimax
  3926. Adjust red, green, blue and alpha input white point.
  3927. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3928. Input levels are used to lighten highlights (bright tones), darken shadows
  3929. (dark tones), change the balance of bright and dark tones.
  3930. @item romin
  3931. @item gomin
  3932. @item bomin
  3933. @item aomin
  3934. Adjust red, green, blue and alpha output black point.
  3935. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3936. @item romax
  3937. @item gomax
  3938. @item bomax
  3939. @item aomax
  3940. Adjust red, green, blue and alpha output white point.
  3941. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3942. Output levels allows manual selection of a constrained output level range.
  3943. @end table
  3944. @subsection Examples
  3945. @itemize
  3946. @item
  3947. Make video output darker:
  3948. @example
  3949. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3950. @end example
  3951. @item
  3952. Increase contrast:
  3953. @example
  3954. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3955. @end example
  3956. @item
  3957. Make video output lighter:
  3958. @example
  3959. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3960. @end example
  3961. @item
  3962. Increase brightness:
  3963. @example
  3964. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3965. @end example
  3966. @end itemize
  3967. @section colorchannelmixer
  3968. Adjust video input frames by re-mixing color channels.
  3969. This filter modifies a color channel by adding the values associated to
  3970. the other channels of the same pixels. For example if the value to
  3971. modify is red, the output value will be:
  3972. @example
  3973. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3974. @end example
  3975. The filter accepts the following options:
  3976. @table @option
  3977. @item rr
  3978. @item rg
  3979. @item rb
  3980. @item ra
  3981. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3982. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3983. @item gr
  3984. @item gg
  3985. @item gb
  3986. @item ga
  3987. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3988. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3989. @item br
  3990. @item bg
  3991. @item bb
  3992. @item ba
  3993. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3994. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3995. @item ar
  3996. @item ag
  3997. @item ab
  3998. @item aa
  3999. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4000. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4001. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4002. @end table
  4003. @subsection Examples
  4004. @itemize
  4005. @item
  4006. Convert source to grayscale:
  4007. @example
  4008. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4009. @end example
  4010. @item
  4011. Simulate sepia tones:
  4012. @example
  4013. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4014. @end example
  4015. @end itemize
  4016. @section colormatrix
  4017. Convert color matrix.
  4018. The filter accepts the following options:
  4019. @table @option
  4020. @item src
  4021. @item dst
  4022. Specify the source and destination color matrix. Both values must be
  4023. specified.
  4024. The accepted values are:
  4025. @table @samp
  4026. @item bt709
  4027. BT.709
  4028. @item bt601
  4029. BT.601
  4030. @item smpte240m
  4031. SMPTE-240M
  4032. @item fcc
  4033. FCC
  4034. @item bt2020
  4035. BT.2020
  4036. @end table
  4037. @end table
  4038. For example to convert from BT.601 to SMPTE-240M, use the command:
  4039. @example
  4040. colormatrix=bt601:smpte240m
  4041. @end example
  4042. @section colorspace
  4043. Convert colorspace, transfer characteristics or color primaries.
  4044. The filter accepts the following options:
  4045. @table @option
  4046. @item all
  4047. Specify all color properties at once.
  4048. The accepted values are:
  4049. @table @samp
  4050. @item bt470m
  4051. BT.470M
  4052. @item bt470bg
  4053. BT.470BG
  4054. @item bt601-6-525
  4055. BT.601-6 525
  4056. @item bt601-6-625
  4057. BT.601-6 625
  4058. @item bt709
  4059. BT.709
  4060. @item smpte170m
  4061. SMPTE-170M
  4062. @item smpte240m
  4063. SMPTE-240M
  4064. @item bt2020
  4065. BT.2020
  4066. @end table
  4067. @item space
  4068. Specify output colorspace.
  4069. The accepted values are:
  4070. @table @samp
  4071. @item bt709
  4072. BT.709
  4073. @item fcc
  4074. FCC
  4075. @item bt470bg
  4076. BT.470BG or BT.601-6 625
  4077. @item smpte170m
  4078. SMPTE-170M or BT.601-6 525
  4079. @item smpte240m
  4080. SMPTE-240M
  4081. @item bt2020ncl
  4082. BT.2020 with non-constant luminance
  4083. @end table
  4084. @item trc
  4085. Specify output transfer characteristics.
  4086. The accepted values are:
  4087. @table @samp
  4088. @item bt709
  4089. BT.709
  4090. @item gamma22
  4091. Constant gamma of 2.2
  4092. @item gamma28
  4093. Constant gamma of 2.8
  4094. @item smpte170m
  4095. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4096. @item smpte240m
  4097. SMPTE-240M
  4098. @item bt2020-10
  4099. BT.2020 for 10-bits content
  4100. @item bt2020-12
  4101. BT.2020 for 12-bits content
  4102. @end table
  4103. @item primaries
  4104. Specify output color primaries.
  4105. The accepted values are:
  4106. @table @samp
  4107. @item bt709
  4108. BT.709
  4109. @item bt470m
  4110. BT.470M
  4111. @item bt470bg
  4112. BT.470BG or BT.601-6 625
  4113. @item smpte170m
  4114. SMPTE-170M or BT.601-6 525
  4115. @item smpte240m
  4116. SMPTE-240M
  4117. @item bt2020
  4118. BT.2020
  4119. @end table
  4120. @item range
  4121. Specify output color range.
  4122. The accepted values are:
  4123. @table @samp
  4124. @item mpeg
  4125. MPEG (restricted) range
  4126. @item jpeg
  4127. JPEG (full) range
  4128. @end table
  4129. @item format
  4130. Specify output color format.
  4131. The accepted values are:
  4132. @table @samp
  4133. @item yuv420p
  4134. YUV 4:2:0 planar 8-bits
  4135. @item yuv420p10
  4136. YUV 4:2:0 planar 10-bits
  4137. @item yuv420p12
  4138. YUV 4:2:0 planar 12-bits
  4139. @item yuv422p
  4140. YUV 4:2:2 planar 8-bits
  4141. @item yuv422p10
  4142. YUV 4:2:2 planar 10-bits
  4143. @item yuv422p12
  4144. YUV 4:2:2 planar 12-bits
  4145. @item yuv444p
  4146. YUV 4:4:4 planar 8-bits
  4147. @item yuv444p10
  4148. YUV 4:4:4 planar 10-bits
  4149. @item yuv444p12
  4150. YUV 4:4:4 planar 12-bits
  4151. @end table
  4152. @item fast
  4153. Do a fast conversion, which skips gamma/primary correction. This will take
  4154. significantly less CPU, but will be mathematically incorrect. To get output
  4155. compatible with that produced by the colormatrix filter, use fast=1.
  4156. @item dither
  4157. Specify dithering mode.
  4158. The accepted values are:
  4159. @table @samp
  4160. @item none
  4161. No dithering
  4162. @item fsb
  4163. Floyd-Steinberg dithering
  4164. @end table
  4165. @item wpadapt
  4166. Whitepoint adaptation mode.
  4167. The accepted values are:
  4168. @table @samp
  4169. @item bradford
  4170. Bradford whitepoint adaptation
  4171. @item vonkries
  4172. von Kries whitepoint adaptation
  4173. @item identity
  4174. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4175. @end table
  4176. @end table
  4177. The filter converts the transfer characteristics, color space and color
  4178. primaries to the specified user values. The output value, if not specified,
  4179. is set to a default value based on the "all" property. If that property is
  4180. also not specified, the filter will log an error. The output color range and
  4181. format default to the same value as the input color range and format. The
  4182. input transfer characteristics, color space, color primaries and color range
  4183. should be set on the input data. If any of these are missing, the filter will
  4184. log an error and no conversion will take place.
  4185. For example to convert the input to SMPTE-240M, use the command:
  4186. @example
  4187. colorspace=smpte240m
  4188. @end example
  4189. @section convolution
  4190. Apply convolution 3x3 or 5x5 filter.
  4191. The filter accepts the following options:
  4192. @table @option
  4193. @item 0m
  4194. @item 1m
  4195. @item 2m
  4196. @item 3m
  4197. Set matrix for each plane.
  4198. Matrix is sequence of 9 or 25 signed integers.
  4199. @item 0rdiv
  4200. @item 1rdiv
  4201. @item 2rdiv
  4202. @item 3rdiv
  4203. Set multiplier for calculated value for each plane.
  4204. @item 0bias
  4205. @item 1bias
  4206. @item 2bias
  4207. @item 3bias
  4208. Set bias for each plane. This value is added to the result of the multiplication.
  4209. Useful for making the overall image brighter or darker. Default is 0.0.
  4210. @end table
  4211. @subsection Examples
  4212. @itemize
  4213. @item
  4214. Apply sharpen:
  4215. @example
  4216. 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"
  4217. @end example
  4218. @item
  4219. Apply blur:
  4220. @example
  4221. 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"
  4222. @end example
  4223. @item
  4224. Apply edge enhance:
  4225. @example
  4226. 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"
  4227. @end example
  4228. @item
  4229. Apply edge detect:
  4230. @example
  4231. 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"
  4232. @end example
  4233. @item
  4234. Apply emboss:
  4235. @example
  4236. 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"
  4237. @end example
  4238. @end itemize
  4239. @section copy
  4240. Copy the input source unchanged to the output. This is mainly useful for
  4241. testing purposes.
  4242. @anchor{coreimage}
  4243. @section coreimage
  4244. Video filtering on GPU using Apple's CoreImage API on OSX.
  4245. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4246. processed by video hardware. However, software-based OpenGL implementations
  4247. exist which means there is no guarantee for hardware processing. It depends on
  4248. the respective OSX.
  4249. There are many filters and image generators provided by Apple that come with a
  4250. large variety of options. The filter has to be referenced by its name along
  4251. with its options.
  4252. The coreimage filter accepts the following options:
  4253. @table @option
  4254. @item list_filters
  4255. List all available filters and generators along with all their respective
  4256. options as well as possible minimum and maximum values along with the default
  4257. values.
  4258. @example
  4259. list_filters=true
  4260. @end example
  4261. @item filter
  4262. Specify all filters by their respective name and options.
  4263. Use @var{list_filters} to determine all valid filter names and options.
  4264. Numerical options are specified by a float value and are automatically clamped
  4265. to their respective value range. Vector and color options have to be specified
  4266. by a list of space separated float values. Character escaping has to be done.
  4267. A special option name @code{default} is available to use default options for a
  4268. filter.
  4269. It is required to specify either @code{default} or at least one of the filter options.
  4270. All omitted options are used with their default values.
  4271. The syntax of the filter string is as follows:
  4272. @example
  4273. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4274. @end example
  4275. @item output_rect
  4276. Specify a rectangle where the output of the filter chain is copied into the
  4277. input image. It is given by a list of space separated float values:
  4278. @example
  4279. output_rect=x\ y\ width\ height
  4280. @end example
  4281. If not given, the output rectangle equals the dimensions of the input image.
  4282. The output rectangle is automatically cropped at the borders of the input
  4283. image. Negative values are valid for each component.
  4284. @example
  4285. output_rect=25\ 25\ 100\ 100
  4286. @end example
  4287. @end table
  4288. Several filters can be chained for successive processing without GPU-HOST
  4289. transfers allowing for fast processing of complex filter chains.
  4290. Currently, only filters with zero (generators) or exactly one (filters) input
  4291. image and one output image are supported. Also, transition filters are not yet
  4292. usable as intended.
  4293. Some filters generate output images with additional padding depending on the
  4294. respective filter kernel. The padding is automatically removed to ensure the
  4295. filter output has the same size as the input image.
  4296. For image generators, the size of the output image is determined by the
  4297. previous output image of the filter chain or the input image of the whole
  4298. filterchain, respectively. The generators do not use the pixel information of
  4299. this image to generate their output. However, the generated output is
  4300. blended onto this image, resulting in partial or complete coverage of the
  4301. output image.
  4302. The @ref{coreimagesrc} video source can be used for generating input images
  4303. which are directly fed into the filter chain. By using it, providing input
  4304. images by another video source or an input video is not required.
  4305. @subsection Examples
  4306. @itemize
  4307. @item
  4308. List all filters available:
  4309. @example
  4310. coreimage=list_filters=true
  4311. @end example
  4312. @item
  4313. Use the CIBoxBlur filter with default options to blur an image:
  4314. @example
  4315. coreimage=filter=CIBoxBlur@@default
  4316. @end example
  4317. @item
  4318. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4319. its center at 100x100 and a radius of 50 pixels:
  4320. @example
  4321. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4322. @end example
  4323. @item
  4324. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4325. given as complete and escaped command-line for Apple's standard bash shell:
  4326. @example
  4327. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4328. @end example
  4329. @end itemize
  4330. @section crop
  4331. Crop the input video to given dimensions.
  4332. It accepts the following parameters:
  4333. @table @option
  4334. @item w, out_w
  4335. The width of the output video. It defaults to @code{iw}.
  4336. This expression is evaluated only once during the filter
  4337. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4338. @item h, out_h
  4339. The height of the output video. It defaults to @code{ih}.
  4340. This expression is evaluated only once during the filter
  4341. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4342. @item x
  4343. The horizontal position, in the input video, of the left edge of the output
  4344. video. It defaults to @code{(in_w-out_w)/2}.
  4345. This expression is evaluated per-frame.
  4346. @item y
  4347. The vertical position, in the input video, of the top edge of the output video.
  4348. It defaults to @code{(in_h-out_h)/2}.
  4349. This expression is evaluated per-frame.
  4350. @item keep_aspect
  4351. If set to 1 will force the output display aspect ratio
  4352. to be the same of the input, by changing the output sample aspect
  4353. ratio. It defaults to 0.
  4354. @end table
  4355. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4356. expressions containing the following constants:
  4357. @table @option
  4358. @item x
  4359. @item y
  4360. The computed values for @var{x} and @var{y}. They are evaluated for
  4361. each new frame.
  4362. @item in_w
  4363. @item in_h
  4364. The input width and height.
  4365. @item iw
  4366. @item ih
  4367. These are the same as @var{in_w} and @var{in_h}.
  4368. @item out_w
  4369. @item out_h
  4370. The output (cropped) width and height.
  4371. @item ow
  4372. @item oh
  4373. These are the same as @var{out_w} and @var{out_h}.
  4374. @item a
  4375. same as @var{iw} / @var{ih}
  4376. @item sar
  4377. input sample aspect ratio
  4378. @item dar
  4379. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4380. @item hsub
  4381. @item vsub
  4382. horizontal and vertical chroma subsample values. For example for the
  4383. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4384. @item n
  4385. The number of the input frame, starting from 0.
  4386. @item pos
  4387. the position in the file of the input frame, NAN if unknown
  4388. @item t
  4389. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4390. @end table
  4391. The expression for @var{out_w} may depend on the value of @var{out_h},
  4392. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4393. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4394. evaluated after @var{out_w} and @var{out_h}.
  4395. The @var{x} and @var{y} parameters specify the expressions for the
  4396. position of the top-left corner of the output (non-cropped) area. They
  4397. are evaluated for each frame. If the evaluated value is not valid, it
  4398. is approximated to the nearest valid value.
  4399. The expression for @var{x} may depend on @var{y}, and the expression
  4400. for @var{y} may depend on @var{x}.
  4401. @subsection Examples
  4402. @itemize
  4403. @item
  4404. Crop area with size 100x100 at position (12,34).
  4405. @example
  4406. crop=100:100:12:34
  4407. @end example
  4408. Using named options, the example above becomes:
  4409. @example
  4410. crop=w=100:h=100:x=12:y=34
  4411. @end example
  4412. @item
  4413. Crop the central input area with size 100x100:
  4414. @example
  4415. crop=100:100
  4416. @end example
  4417. @item
  4418. Crop the central input area with size 2/3 of the input video:
  4419. @example
  4420. crop=2/3*in_w:2/3*in_h
  4421. @end example
  4422. @item
  4423. Crop the input video central square:
  4424. @example
  4425. crop=out_w=in_h
  4426. crop=in_h
  4427. @end example
  4428. @item
  4429. Delimit the rectangle with the top-left corner placed at position
  4430. 100:100 and the right-bottom corner corresponding to the right-bottom
  4431. corner of the input image.
  4432. @example
  4433. crop=in_w-100:in_h-100:100:100
  4434. @end example
  4435. @item
  4436. Crop 10 pixels from the left and right borders, and 20 pixels from
  4437. the top and bottom borders
  4438. @example
  4439. crop=in_w-2*10:in_h-2*20
  4440. @end example
  4441. @item
  4442. Keep only the bottom right quarter of the input image:
  4443. @example
  4444. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4445. @end example
  4446. @item
  4447. Crop height for getting Greek harmony:
  4448. @example
  4449. crop=in_w:1/PHI*in_w
  4450. @end example
  4451. @item
  4452. Apply trembling effect:
  4453. @example
  4454. 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)
  4455. @end example
  4456. @item
  4457. Apply erratic camera effect depending on timestamp:
  4458. @example
  4459. 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)"
  4460. @end example
  4461. @item
  4462. Set x depending on the value of y:
  4463. @example
  4464. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4465. @end example
  4466. @end itemize
  4467. @subsection Commands
  4468. This filter supports the following commands:
  4469. @table @option
  4470. @item w, out_w
  4471. @item h, out_h
  4472. @item x
  4473. @item y
  4474. Set width/height of the output video and the horizontal/vertical position
  4475. in the input video.
  4476. The command accepts the same syntax of the corresponding option.
  4477. If the specified expression is not valid, it is kept at its current
  4478. value.
  4479. @end table
  4480. @section cropdetect
  4481. Auto-detect the crop size.
  4482. It calculates the necessary cropping parameters and prints the
  4483. recommended parameters via the logging system. The detected dimensions
  4484. correspond to the non-black area of the input video.
  4485. It accepts the following parameters:
  4486. @table @option
  4487. @item limit
  4488. Set higher black value threshold, which can be optionally specified
  4489. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4490. value greater to the set value is considered non-black. It defaults to 24.
  4491. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4492. on the bitdepth of the pixel format.
  4493. @item round
  4494. The value which the width/height should be divisible by. It defaults to
  4495. 16. The offset is automatically adjusted to center the video. Use 2 to
  4496. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4497. encoding to most video codecs.
  4498. @item reset_count, reset
  4499. Set the counter that determines after how many frames cropdetect will
  4500. reset the previously detected largest video area and start over to
  4501. detect the current optimal crop area. Default value is 0.
  4502. This can be useful when channel logos distort the video area. 0
  4503. indicates 'never reset', and returns the largest area encountered during
  4504. playback.
  4505. @end table
  4506. @anchor{curves}
  4507. @section curves
  4508. Apply color adjustments using curves.
  4509. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4510. component (red, green and blue) has its values defined by @var{N} key points
  4511. tied from each other using a smooth curve. The x-axis represents the pixel
  4512. values from the input frame, and the y-axis the new pixel values to be set for
  4513. the output frame.
  4514. By default, a component curve is defined by the two points @var{(0;0)} and
  4515. @var{(1;1)}. This creates a straight line where each original pixel value is
  4516. "adjusted" to its own value, which means no change to the image.
  4517. The filter allows you to redefine these two points and add some more. A new
  4518. curve (using a natural cubic spline interpolation) will be define to pass
  4519. smoothly through all these new coordinates. The new defined points needs to be
  4520. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4521. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4522. the vector spaces, the values will be clipped accordingly.
  4523. The filter accepts the following options:
  4524. @table @option
  4525. @item preset
  4526. Select one of the available color presets. This option can be used in addition
  4527. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4528. options takes priority on the preset values.
  4529. Available presets are:
  4530. @table @samp
  4531. @item none
  4532. @item color_negative
  4533. @item cross_process
  4534. @item darker
  4535. @item increase_contrast
  4536. @item lighter
  4537. @item linear_contrast
  4538. @item medium_contrast
  4539. @item negative
  4540. @item strong_contrast
  4541. @item vintage
  4542. @end table
  4543. Default is @code{none}.
  4544. @item master, m
  4545. Set the master key points. These points will define a second pass mapping. It
  4546. is sometimes called a "luminance" or "value" mapping. It can be used with
  4547. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4548. post-processing LUT.
  4549. @item red, r
  4550. Set the key points for the red component.
  4551. @item green, g
  4552. Set the key points for the green component.
  4553. @item blue, b
  4554. Set the key points for the blue component.
  4555. @item all
  4556. Set the key points for all components (not including master).
  4557. Can be used in addition to the other key points component
  4558. options. In this case, the unset component(s) will fallback on this
  4559. @option{all} setting.
  4560. @item psfile
  4561. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4562. @item plot
  4563. Save Gnuplot script of the curves in specified file.
  4564. @end table
  4565. To avoid some filtergraph syntax conflicts, each key points list need to be
  4566. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4567. @subsection Examples
  4568. @itemize
  4569. @item
  4570. Increase slightly the middle level of blue:
  4571. @example
  4572. curves=blue='0/0 0.5/0.58 1/1'
  4573. @end example
  4574. @item
  4575. Vintage effect:
  4576. @example
  4577. 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'
  4578. @end example
  4579. Here we obtain the following coordinates for each components:
  4580. @table @var
  4581. @item red
  4582. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4583. @item green
  4584. @code{(0;0) (0.50;0.48) (1;1)}
  4585. @item blue
  4586. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4587. @end table
  4588. @item
  4589. The previous example can also be achieved with the associated built-in preset:
  4590. @example
  4591. curves=preset=vintage
  4592. @end example
  4593. @item
  4594. Or simply:
  4595. @example
  4596. curves=vintage
  4597. @end example
  4598. @item
  4599. Use a Photoshop preset and redefine the points of the green component:
  4600. @example
  4601. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4602. @end example
  4603. @item
  4604. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4605. and @command{gnuplot}:
  4606. @example
  4607. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4608. gnuplot -p /tmp/curves.plt
  4609. @end example
  4610. @end itemize
  4611. @section datascope
  4612. Video data analysis filter.
  4613. This filter shows hexadecimal pixel values of part of video.
  4614. The filter accepts the following options:
  4615. @table @option
  4616. @item size, s
  4617. Set output video size.
  4618. @item x
  4619. Set x offset from where to pick pixels.
  4620. @item y
  4621. Set y offset from where to pick pixels.
  4622. @item mode
  4623. Set scope mode, can be one of the following:
  4624. @table @samp
  4625. @item mono
  4626. Draw hexadecimal pixel values with white color on black background.
  4627. @item color
  4628. Draw hexadecimal pixel values with input video pixel color on black
  4629. background.
  4630. @item color2
  4631. Draw hexadecimal pixel values on color background picked from input video,
  4632. the text color is picked in such way so its always visible.
  4633. @end table
  4634. @item axis
  4635. Draw rows and columns numbers on left and top of video.
  4636. @end table
  4637. @section dctdnoiz
  4638. Denoise frames using 2D DCT (frequency domain filtering).
  4639. This filter is not designed for real time.
  4640. The filter accepts the following options:
  4641. @table @option
  4642. @item sigma, s
  4643. Set the noise sigma constant.
  4644. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4645. coefficient (absolute value) below this threshold with be dropped.
  4646. If you need a more advanced filtering, see @option{expr}.
  4647. Default is @code{0}.
  4648. @item overlap
  4649. Set number overlapping pixels for each block. Since the filter can be slow, you
  4650. may want to reduce this value, at the cost of a less effective filter and the
  4651. risk of various artefacts.
  4652. If the overlapping value doesn't permit processing the whole input width or
  4653. height, a warning will be displayed and according borders won't be denoised.
  4654. Default value is @var{blocksize}-1, which is the best possible setting.
  4655. @item expr, e
  4656. Set the coefficient factor expression.
  4657. For each coefficient of a DCT block, this expression will be evaluated as a
  4658. multiplier value for the coefficient.
  4659. If this is option is set, the @option{sigma} option will be ignored.
  4660. The absolute value of the coefficient can be accessed through the @var{c}
  4661. variable.
  4662. @item n
  4663. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4664. @var{blocksize}, which is the width and height of the processed blocks.
  4665. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4666. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4667. on the speed processing. Also, a larger block size does not necessarily means a
  4668. better de-noising.
  4669. @end table
  4670. @subsection Examples
  4671. Apply a denoise with a @option{sigma} of @code{4.5}:
  4672. @example
  4673. dctdnoiz=4.5
  4674. @end example
  4675. The same operation can be achieved using the expression system:
  4676. @example
  4677. dctdnoiz=e='gte(c, 4.5*3)'
  4678. @end example
  4679. Violent denoise using a block size of @code{16x16}:
  4680. @example
  4681. dctdnoiz=15:n=4
  4682. @end example
  4683. @section deband
  4684. Remove banding artifacts from input video.
  4685. It works by replacing banded pixels with average value of referenced pixels.
  4686. The filter accepts the following options:
  4687. @table @option
  4688. @item 1thr
  4689. @item 2thr
  4690. @item 3thr
  4691. @item 4thr
  4692. Set banding detection threshold for each plane. Default is 0.02.
  4693. Valid range is 0.00003 to 0.5.
  4694. If difference between current pixel and reference pixel is less than threshold,
  4695. it will be considered as banded.
  4696. @item range, r
  4697. Banding detection range in pixels. Default is 16. If positive, random number
  4698. in range 0 to set value will be used. If negative, exact absolute value
  4699. will be used.
  4700. The range defines square of four pixels around current pixel.
  4701. @item direction, d
  4702. Set direction in radians from which four pixel will be compared. If positive,
  4703. random direction from 0 to set direction will be picked. If negative, exact of
  4704. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4705. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4706. column.
  4707. @item blur
  4708. If enabled, current pixel is compared with average value of all four
  4709. surrounding pixels. The default is enabled. If disabled current pixel is
  4710. compared with all four surrounding pixels. The pixel is considered banded
  4711. if only all four differences with surrounding pixels are less than threshold.
  4712. @end table
  4713. @anchor{decimate}
  4714. @section decimate
  4715. Drop duplicated frames at regular intervals.
  4716. The filter accepts the following options:
  4717. @table @option
  4718. @item cycle
  4719. Set the number of frames from which one will be dropped. Setting this to
  4720. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4721. Default is @code{5}.
  4722. @item dupthresh
  4723. Set the threshold for duplicate detection. If the difference metric for a frame
  4724. is less than or equal to this value, then it is declared as duplicate. Default
  4725. is @code{1.1}
  4726. @item scthresh
  4727. Set scene change threshold. Default is @code{15}.
  4728. @item blockx
  4729. @item blocky
  4730. Set the size of the x and y-axis blocks used during metric calculations.
  4731. Larger blocks give better noise suppression, but also give worse detection of
  4732. small movements. Must be a power of two. Default is @code{32}.
  4733. @item ppsrc
  4734. Mark main input as a pre-processed input and activate clean source input
  4735. stream. This allows the input to be pre-processed with various filters to help
  4736. the metrics calculation while keeping the frame selection lossless. When set to
  4737. @code{1}, the first stream is for the pre-processed input, and the second
  4738. stream is the clean source from where the kept frames are chosen. Default is
  4739. @code{0}.
  4740. @item chroma
  4741. Set whether or not chroma is considered in the metric calculations. Default is
  4742. @code{1}.
  4743. @end table
  4744. @section deflate
  4745. Apply deflate effect to the video.
  4746. This filter replaces the pixel by the local(3x3) average by taking into account
  4747. only values lower than the pixel.
  4748. It accepts the following options:
  4749. @table @option
  4750. @item threshold0
  4751. @item threshold1
  4752. @item threshold2
  4753. @item threshold3
  4754. Limit the maximum change for each plane, default is 65535.
  4755. If 0, plane will remain unchanged.
  4756. @end table
  4757. @section dejudder
  4758. Remove judder produced by partially interlaced telecined content.
  4759. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4760. source was partially telecined content then the output of @code{pullup,dejudder}
  4761. will have a variable frame rate. May change the recorded frame rate of the
  4762. container. Aside from that change, this filter will not affect constant frame
  4763. rate video.
  4764. The option available in this filter is:
  4765. @table @option
  4766. @item cycle
  4767. Specify the length of the window over which the judder repeats.
  4768. Accepts any integer greater than 1. Useful values are:
  4769. @table @samp
  4770. @item 4
  4771. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4772. @item 5
  4773. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4774. @item 20
  4775. If a mixture of the two.
  4776. @end table
  4777. The default is @samp{4}.
  4778. @end table
  4779. @section delogo
  4780. Suppress a TV station logo by a simple interpolation of the surrounding
  4781. pixels. Just set a rectangle covering the logo and watch it disappear
  4782. (and sometimes something even uglier appear - your mileage may vary).
  4783. It accepts the following parameters:
  4784. @table @option
  4785. @item x
  4786. @item y
  4787. Specify the top left corner coordinates of the logo. They must be
  4788. specified.
  4789. @item w
  4790. @item h
  4791. Specify the width and height of the logo to clear. They must be
  4792. specified.
  4793. @item band, t
  4794. Specify the thickness of the fuzzy edge of the rectangle (added to
  4795. @var{w} and @var{h}). The default value is 1. This option is
  4796. deprecated, setting higher values should no longer be necessary and
  4797. is not recommended.
  4798. @item show
  4799. When set to 1, a green rectangle is drawn on the screen to simplify
  4800. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4801. The default value is 0.
  4802. The rectangle is drawn on the outermost pixels which will be (partly)
  4803. replaced with interpolated values. The values of the next pixels
  4804. immediately outside this rectangle in each direction will be used to
  4805. compute the interpolated pixel values inside the rectangle.
  4806. @end table
  4807. @subsection Examples
  4808. @itemize
  4809. @item
  4810. Set a rectangle covering the area with top left corner coordinates 0,0
  4811. and size 100x77, and a band of size 10:
  4812. @example
  4813. delogo=x=0:y=0:w=100:h=77:band=10
  4814. @end example
  4815. @end itemize
  4816. @section deshake
  4817. Attempt to fix small changes in horizontal and/or vertical shift. This
  4818. filter helps remove camera shake from hand-holding a camera, bumping a
  4819. tripod, moving on a vehicle, etc.
  4820. The filter accepts the following options:
  4821. @table @option
  4822. @item x
  4823. @item y
  4824. @item w
  4825. @item h
  4826. Specify a rectangular area where to limit the search for motion
  4827. vectors.
  4828. If desired the search for motion vectors can be limited to a
  4829. rectangular area of the frame defined by its top left corner, width
  4830. and height. These parameters have the same meaning as the drawbox
  4831. filter which can be used to visualise the position of the bounding
  4832. box.
  4833. This is useful when simultaneous movement of subjects within the frame
  4834. might be confused for camera motion by the motion vector search.
  4835. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4836. then the full frame is used. This allows later options to be set
  4837. without specifying the bounding box for the motion vector search.
  4838. Default - search the whole frame.
  4839. @item rx
  4840. @item ry
  4841. Specify the maximum extent of movement in x and y directions in the
  4842. range 0-64 pixels. Default 16.
  4843. @item edge
  4844. Specify how to generate pixels to fill blanks at the edge of the
  4845. frame. Available values are:
  4846. @table @samp
  4847. @item blank, 0
  4848. Fill zeroes at blank locations
  4849. @item original, 1
  4850. Original image at blank locations
  4851. @item clamp, 2
  4852. Extruded edge value at blank locations
  4853. @item mirror, 3
  4854. Mirrored edge at blank locations
  4855. @end table
  4856. Default value is @samp{mirror}.
  4857. @item blocksize
  4858. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4859. default 8.
  4860. @item contrast
  4861. Specify the contrast threshold for blocks. Only blocks with more than
  4862. the specified contrast (difference between darkest and lightest
  4863. pixels) will be considered. Range 1-255, default 125.
  4864. @item search
  4865. Specify the search strategy. Available values are:
  4866. @table @samp
  4867. @item exhaustive, 0
  4868. Set exhaustive search
  4869. @item less, 1
  4870. Set less exhaustive search.
  4871. @end table
  4872. Default value is @samp{exhaustive}.
  4873. @item filename
  4874. If set then a detailed log of the motion search is written to the
  4875. specified file.
  4876. @item opencl
  4877. If set to 1, specify using OpenCL capabilities, only available if
  4878. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4879. @end table
  4880. @section detelecine
  4881. Apply an exact inverse of the telecine operation. It requires a predefined
  4882. pattern specified using the pattern option which must be the same as that passed
  4883. to the telecine filter.
  4884. This filter accepts the following options:
  4885. @table @option
  4886. @item first_field
  4887. @table @samp
  4888. @item top, t
  4889. top field first
  4890. @item bottom, b
  4891. bottom field first
  4892. The default value is @code{top}.
  4893. @end table
  4894. @item pattern
  4895. A string of numbers representing the pulldown pattern you wish to apply.
  4896. The default value is @code{23}.
  4897. @item start_frame
  4898. A number representing position of the first frame with respect to the telecine
  4899. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4900. @end table
  4901. @section dilation
  4902. Apply dilation effect to the video.
  4903. This filter replaces the pixel by the local(3x3) maximum.
  4904. It accepts the following options:
  4905. @table @option
  4906. @item threshold0
  4907. @item threshold1
  4908. @item threshold2
  4909. @item threshold3
  4910. Limit the maximum change for each plane, default is 65535.
  4911. If 0, plane will remain unchanged.
  4912. @item coordinates
  4913. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4914. pixels are used.
  4915. Flags to local 3x3 coordinates maps like this:
  4916. 1 2 3
  4917. 4 5
  4918. 6 7 8
  4919. @end table
  4920. @section displace
  4921. Displace pixels as indicated by second and third input stream.
  4922. It takes three input streams and outputs one stream, the first input is the
  4923. source, and second and third input are displacement maps.
  4924. The second input specifies how much to displace pixels along the
  4925. x-axis, while the third input specifies how much to displace pixels
  4926. along the y-axis.
  4927. If one of displacement map streams terminates, last frame from that
  4928. displacement map will be used.
  4929. Note that once generated, displacements maps can be reused over and over again.
  4930. A description of the accepted options follows.
  4931. @table @option
  4932. @item edge
  4933. Set displace behavior for pixels that are out of range.
  4934. Available values are:
  4935. @table @samp
  4936. @item blank
  4937. Missing pixels are replaced by black pixels.
  4938. @item smear
  4939. Adjacent pixels will spread out to replace missing pixels.
  4940. @item wrap
  4941. Out of range pixels are wrapped so they point to pixels of other side.
  4942. @end table
  4943. Default is @samp{smear}.
  4944. @end table
  4945. @subsection Examples
  4946. @itemize
  4947. @item
  4948. Add ripple effect to rgb input of video size hd720:
  4949. @example
  4950. 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
  4951. @end example
  4952. @item
  4953. Add wave effect to rgb input of video size hd720:
  4954. @example
  4955. 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
  4956. @end example
  4957. @end itemize
  4958. @section drawbox
  4959. Draw a colored box on the input image.
  4960. It accepts the following parameters:
  4961. @table @option
  4962. @item x
  4963. @item y
  4964. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4965. @item width, w
  4966. @item height, h
  4967. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4968. the input width and height. It defaults to 0.
  4969. @item color, c
  4970. Specify the color of the box to write. For the general syntax of this option,
  4971. check the "Color" section in the ffmpeg-utils manual. If the special
  4972. value @code{invert} is used, the box edge color is the same as the
  4973. video with inverted luma.
  4974. @item thickness, t
  4975. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4976. See below for the list of accepted constants.
  4977. @end table
  4978. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4979. following constants:
  4980. @table @option
  4981. @item dar
  4982. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4983. @item hsub
  4984. @item vsub
  4985. horizontal and vertical chroma subsample values. For example for the
  4986. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4987. @item in_h, ih
  4988. @item in_w, iw
  4989. The input width and height.
  4990. @item sar
  4991. The input sample aspect ratio.
  4992. @item x
  4993. @item y
  4994. The x and y offset coordinates where the box is drawn.
  4995. @item w
  4996. @item h
  4997. The width and height of the drawn box.
  4998. @item t
  4999. The thickness of the drawn box.
  5000. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5001. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5002. @end table
  5003. @subsection Examples
  5004. @itemize
  5005. @item
  5006. Draw a black box around the edge of the input image:
  5007. @example
  5008. drawbox
  5009. @end example
  5010. @item
  5011. Draw a box with color red and an opacity of 50%:
  5012. @example
  5013. drawbox=10:20:200:60:red@@0.5
  5014. @end example
  5015. The previous example can be specified as:
  5016. @example
  5017. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5018. @end example
  5019. @item
  5020. Fill the box with pink color:
  5021. @example
  5022. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5023. @end example
  5024. @item
  5025. Draw a 2-pixel red 2.40:1 mask:
  5026. @example
  5027. 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
  5028. @end example
  5029. @end itemize
  5030. @section drawgrid
  5031. Draw a grid on the input image.
  5032. It accepts the following parameters:
  5033. @table @option
  5034. @item x
  5035. @item y
  5036. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5037. @item width, w
  5038. @item height, h
  5039. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5040. input width and height, respectively, minus @code{thickness}, so image gets
  5041. framed. Default to 0.
  5042. @item color, c
  5043. Specify the color of the grid. For the general syntax of this option,
  5044. check the "Color" section in the ffmpeg-utils manual. If the special
  5045. value @code{invert} is used, the grid color is the same as the
  5046. video with inverted luma.
  5047. @item thickness, t
  5048. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5049. See below for the list of accepted constants.
  5050. @end table
  5051. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5052. following constants:
  5053. @table @option
  5054. @item dar
  5055. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5056. @item hsub
  5057. @item vsub
  5058. horizontal and vertical chroma subsample values. For example for the
  5059. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5060. @item in_h, ih
  5061. @item in_w, iw
  5062. The input grid cell width and height.
  5063. @item sar
  5064. The input sample aspect ratio.
  5065. @item x
  5066. @item y
  5067. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5068. @item w
  5069. @item h
  5070. The width and height of the drawn cell.
  5071. @item t
  5072. The thickness of the drawn cell.
  5073. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5074. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5075. @end table
  5076. @subsection Examples
  5077. @itemize
  5078. @item
  5079. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5080. @example
  5081. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5082. @end example
  5083. @item
  5084. Draw a white 3x3 grid with an opacity of 50%:
  5085. @example
  5086. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5087. @end example
  5088. @end itemize
  5089. @anchor{drawtext}
  5090. @section drawtext
  5091. Draw a text string or text from a specified file on top of a video, using the
  5092. libfreetype library.
  5093. To enable compilation of this filter, you need to configure FFmpeg with
  5094. @code{--enable-libfreetype}.
  5095. To enable default font fallback and the @var{font} option you need to
  5096. configure FFmpeg with @code{--enable-libfontconfig}.
  5097. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5098. @code{--enable-libfribidi}.
  5099. @subsection Syntax
  5100. It accepts the following parameters:
  5101. @table @option
  5102. @item box
  5103. Used to draw a box around text using the background color.
  5104. The value must be either 1 (enable) or 0 (disable).
  5105. The default value of @var{box} is 0.
  5106. @item boxborderw
  5107. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5108. The default value of @var{boxborderw} is 0.
  5109. @item boxcolor
  5110. The color to be used for drawing box around text. For the syntax of this
  5111. option, check the "Color" section in the ffmpeg-utils manual.
  5112. The default value of @var{boxcolor} is "white".
  5113. @item borderw
  5114. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5115. The default value of @var{borderw} is 0.
  5116. @item bordercolor
  5117. Set the color to be used for drawing border around text. For the syntax of this
  5118. option, check the "Color" section in the ffmpeg-utils manual.
  5119. The default value of @var{bordercolor} is "black".
  5120. @item expansion
  5121. Select how the @var{text} is expanded. Can be either @code{none},
  5122. @code{strftime} (deprecated) or
  5123. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5124. below for details.
  5125. @item fix_bounds
  5126. If true, check and fix text coords to avoid clipping.
  5127. @item fontcolor
  5128. The color to be used for drawing fonts. For the syntax of this option, check
  5129. the "Color" section in the ffmpeg-utils manual.
  5130. The default value of @var{fontcolor} is "black".
  5131. @item fontcolor_expr
  5132. String which is expanded the same way as @var{text} to obtain dynamic
  5133. @var{fontcolor} value. By default this option has empty value and is not
  5134. processed. When this option is set, it overrides @var{fontcolor} option.
  5135. @item font
  5136. The font family to be used for drawing text. By default Sans.
  5137. @item fontfile
  5138. The font file to be used for drawing text. The path must be included.
  5139. This parameter is mandatory if the fontconfig support is disabled.
  5140. @item draw
  5141. This option does not exist, please see the timeline system
  5142. @item alpha
  5143. Draw the text applying alpha blending. The value can
  5144. be either a number between 0.0 and 1.0
  5145. The expression accepts the same variables @var{x, y} do.
  5146. The default value is 1.
  5147. Please see fontcolor_expr
  5148. @item fontsize
  5149. The font size to be used for drawing text.
  5150. The default value of @var{fontsize} is 16.
  5151. @item text_shaping
  5152. If set to 1, attempt to shape the text (for example, reverse the order of
  5153. right-to-left text and join Arabic characters) before drawing it.
  5154. Otherwise, just draw the text exactly as given.
  5155. By default 1 (if supported).
  5156. @item ft_load_flags
  5157. The flags to be used for loading the fonts.
  5158. The flags map the corresponding flags supported by libfreetype, and are
  5159. a combination of the following values:
  5160. @table @var
  5161. @item default
  5162. @item no_scale
  5163. @item no_hinting
  5164. @item render
  5165. @item no_bitmap
  5166. @item vertical_layout
  5167. @item force_autohint
  5168. @item crop_bitmap
  5169. @item pedantic
  5170. @item ignore_global_advance_width
  5171. @item no_recurse
  5172. @item ignore_transform
  5173. @item monochrome
  5174. @item linear_design
  5175. @item no_autohint
  5176. @end table
  5177. Default value is "default".
  5178. For more information consult the documentation for the FT_LOAD_*
  5179. libfreetype flags.
  5180. @item shadowcolor
  5181. The color to be used for drawing a shadow behind the drawn text. For the
  5182. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5183. The default value of @var{shadowcolor} is "black".
  5184. @item shadowx
  5185. @item shadowy
  5186. The x and y offsets for the text shadow position with respect to the
  5187. position of the text. They can be either positive or negative
  5188. values. The default value for both is "0".
  5189. @item start_number
  5190. The starting frame number for the n/frame_num variable. The default value
  5191. is "0".
  5192. @item tabsize
  5193. The size in number of spaces to use for rendering the tab.
  5194. Default value is 4.
  5195. @item timecode
  5196. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5197. format. It can be used with or without text parameter. @var{timecode_rate}
  5198. option must be specified.
  5199. @item timecode_rate, rate, r
  5200. Set the timecode frame rate (timecode only).
  5201. @item text
  5202. The text string to be drawn. The text must be a sequence of UTF-8
  5203. encoded characters.
  5204. This parameter is mandatory if no file is specified with the parameter
  5205. @var{textfile}.
  5206. @item textfile
  5207. A text file containing text to be drawn. The text must be a sequence
  5208. of UTF-8 encoded characters.
  5209. This parameter is mandatory if no text string is specified with the
  5210. parameter @var{text}.
  5211. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5212. @item reload
  5213. If set to 1, the @var{textfile} will be reloaded before each frame.
  5214. Be sure to update it atomically, or it may be read partially, or even fail.
  5215. @item x
  5216. @item y
  5217. The expressions which specify the offsets where text will be drawn
  5218. within the video frame. They are relative to the top/left border of the
  5219. output image.
  5220. The default value of @var{x} and @var{y} is "0".
  5221. See below for the list of accepted constants and functions.
  5222. @end table
  5223. The parameters for @var{x} and @var{y} are expressions containing the
  5224. following constants and functions:
  5225. @table @option
  5226. @item dar
  5227. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5228. @item hsub
  5229. @item vsub
  5230. horizontal and vertical chroma subsample values. For example for the
  5231. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5232. @item line_h, lh
  5233. the height of each text line
  5234. @item main_h, h, H
  5235. the input height
  5236. @item main_w, w, W
  5237. the input width
  5238. @item max_glyph_a, ascent
  5239. the maximum distance from the baseline to the highest/upper grid
  5240. coordinate used to place a glyph outline point, for all the rendered
  5241. glyphs.
  5242. It is a positive value, due to the grid's orientation with the Y axis
  5243. upwards.
  5244. @item max_glyph_d, descent
  5245. the maximum distance from the baseline to the lowest grid coordinate
  5246. used to place a glyph outline point, for all the rendered glyphs.
  5247. This is a negative value, due to the grid's orientation, with the Y axis
  5248. upwards.
  5249. @item max_glyph_h
  5250. maximum glyph height, that is the maximum height for all the glyphs
  5251. contained in the rendered text, it is equivalent to @var{ascent} -
  5252. @var{descent}.
  5253. @item max_glyph_w
  5254. maximum glyph width, that is the maximum width for all the glyphs
  5255. contained in the rendered text
  5256. @item n
  5257. the number of input frame, starting from 0
  5258. @item rand(min, max)
  5259. return a random number included between @var{min} and @var{max}
  5260. @item sar
  5261. The input sample aspect ratio.
  5262. @item t
  5263. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5264. @item text_h, th
  5265. the height of the rendered text
  5266. @item text_w, tw
  5267. the width of the rendered text
  5268. @item x
  5269. @item y
  5270. the x and y offset coordinates where the text is drawn.
  5271. These parameters allow the @var{x} and @var{y} expressions to refer
  5272. each other, so you can for example specify @code{y=x/dar}.
  5273. @end table
  5274. @anchor{drawtext_expansion}
  5275. @subsection Text expansion
  5276. If @option{expansion} is set to @code{strftime},
  5277. the filter recognizes strftime() sequences in the provided text and
  5278. expands them accordingly. Check the documentation of strftime(). This
  5279. feature is deprecated.
  5280. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5281. If @option{expansion} is set to @code{normal} (which is the default),
  5282. the following expansion mechanism is used.
  5283. The backslash character @samp{\}, followed by any character, always expands to
  5284. the second character.
  5285. Sequence of the form @code{%@{...@}} are expanded. The text between the
  5286. braces is a function name, possibly followed by arguments separated by ':'.
  5287. If the arguments contain special characters or delimiters (':' or '@}'),
  5288. they should be escaped.
  5289. Note that they probably must also be escaped as the value for the
  5290. @option{text} option in the filter argument string and as the filter
  5291. argument in the filtergraph description, and possibly also for the shell,
  5292. that makes up to four levels of escaping; using a text file avoids these
  5293. problems.
  5294. The following functions are available:
  5295. @table @command
  5296. @item expr, e
  5297. The expression evaluation result.
  5298. It must take one argument specifying the expression to be evaluated,
  5299. which accepts the same constants and functions as the @var{x} and
  5300. @var{y} values. Note that not all constants should be used, for
  5301. example the text size is not known when evaluating the expression, so
  5302. the constants @var{text_w} and @var{text_h} will have an undefined
  5303. value.
  5304. @item expr_int_format, eif
  5305. Evaluate the expression's value and output as formatted integer.
  5306. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5307. The second argument specifies the output format. Allowed values are @samp{x},
  5308. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5309. @code{printf} function.
  5310. The third parameter is optional and sets the number of positions taken by the output.
  5311. It can be used to add padding with zeros from the left.
  5312. @item gmtime
  5313. The time at which the filter is running, expressed in UTC.
  5314. It can accept an argument: a strftime() format string.
  5315. @item localtime
  5316. The time at which the filter is running, expressed in the local time zone.
  5317. It can accept an argument: a strftime() format string.
  5318. @item metadata
  5319. Frame metadata. Takes one or two arguments.
  5320. The first argument is mandatory and specifies the metadata key.
  5321. The second argument is optional and specifies a default value, used when the
  5322. metadata key is not found or empty.
  5323. @item n, frame_num
  5324. The frame number, starting from 0.
  5325. @item pict_type
  5326. A 1 character description of the current picture type.
  5327. @item pts
  5328. The timestamp of the current frame.
  5329. It can take up to three arguments.
  5330. The first argument is the format of the timestamp; it defaults to @code{flt}
  5331. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5332. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5333. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5334. @code{localtime} stands for the timestamp of the frame formatted as
  5335. local time zone time.
  5336. The second argument is an offset added to the timestamp.
  5337. If the format is set to @code{localtime} or @code{gmtime},
  5338. a third argument may be supplied: a strftime() format string.
  5339. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5340. @end table
  5341. @subsection Examples
  5342. @itemize
  5343. @item
  5344. Draw "Test Text" with font FreeSerif, using the default values for the
  5345. optional parameters.
  5346. @example
  5347. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5348. @end example
  5349. @item
  5350. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5351. and y=50 (counting from the top-left corner of the screen), text is
  5352. yellow with a red box around it. Both the text and the box have an
  5353. opacity of 20%.
  5354. @example
  5355. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5356. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5357. @end example
  5358. Note that the double quotes are not necessary if spaces are not used
  5359. within the parameter list.
  5360. @item
  5361. Show the text at the center of the video frame:
  5362. @example
  5363. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5364. @end example
  5365. @item
  5366. Show the text at a random position, switching to a new position every 30 seconds:
  5367. @example
  5368. 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)"
  5369. @end example
  5370. @item
  5371. Show a text line sliding from right to left in the last row of the video
  5372. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5373. with no newlines.
  5374. @example
  5375. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5376. @end example
  5377. @item
  5378. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5379. @example
  5380. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5381. @end example
  5382. @item
  5383. Draw a single green letter "g", at the center of the input video.
  5384. The glyph baseline is placed at half screen height.
  5385. @example
  5386. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5387. @end example
  5388. @item
  5389. Show text for 1 second every 3 seconds:
  5390. @example
  5391. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5392. @end example
  5393. @item
  5394. Use fontconfig to set the font. Note that the colons need to be escaped.
  5395. @example
  5396. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5397. @end example
  5398. @item
  5399. Print the date of a real-time encoding (see strftime(3)):
  5400. @example
  5401. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5402. @end example
  5403. @item
  5404. Show text fading in and out (appearing/disappearing):
  5405. @example
  5406. #!/bin/sh
  5407. DS=1.0 # display start
  5408. DE=10.0 # display end
  5409. FID=1.5 # fade in duration
  5410. FOD=5 # fade out duration
  5411. 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 @}"
  5412. @end example
  5413. @end itemize
  5414. For more information about libfreetype, check:
  5415. @url{http://www.freetype.org/}.
  5416. For more information about fontconfig, check:
  5417. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5418. For more information about libfribidi, check:
  5419. @url{http://fribidi.org/}.
  5420. @section edgedetect
  5421. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5422. The filter accepts the following options:
  5423. @table @option
  5424. @item low
  5425. @item high
  5426. Set low and high threshold values used by the Canny thresholding
  5427. algorithm.
  5428. The high threshold selects the "strong" edge pixels, which are then
  5429. connected through 8-connectivity with the "weak" edge pixels selected
  5430. by the low threshold.
  5431. @var{low} and @var{high} threshold values must be chosen in the range
  5432. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5433. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5434. is @code{50/255}.
  5435. @item mode
  5436. Define the drawing mode.
  5437. @table @samp
  5438. @item wires
  5439. Draw white/gray wires on black background.
  5440. @item colormix
  5441. Mix the colors to create a paint/cartoon effect.
  5442. @end table
  5443. Default value is @var{wires}.
  5444. @end table
  5445. @subsection Examples
  5446. @itemize
  5447. @item
  5448. Standard edge detection with custom values for the hysteresis thresholding:
  5449. @example
  5450. edgedetect=low=0.1:high=0.4
  5451. @end example
  5452. @item
  5453. Painting effect without thresholding:
  5454. @example
  5455. edgedetect=mode=colormix:high=0
  5456. @end example
  5457. @end itemize
  5458. @section eq
  5459. Set brightness, contrast, saturation and approximate gamma adjustment.
  5460. The filter accepts the following options:
  5461. @table @option
  5462. @item contrast
  5463. Set the contrast expression. The value must be a float value in range
  5464. @code{-2.0} to @code{2.0}. The default value is "1".
  5465. @item brightness
  5466. Set the brightness expression. The value must be a float value in
  5467. range @code{-1.0} to @code{1.0}. The default value is "0".
  5468. @item saturation
  5469. Set the saturation expression. The value must be a float in
  5470. range @code{0.0} to @code{3.0}. The default value is "1".
  5471. @item gamma
  5472. Set the gamma expression. The value must be a float in range
  5473. @code{0.1} to @code{10.0}. The default value is "1".
  5474. @item gamma_r
  5475. Set the gamma expression for red. The value must be a float in
  5476. range @code{0.1} to @code{10.0}. The default value is "1".
  5477. @item gamma_g
  5478. Set the gamma expression for green. The value must be a float in range
  5479. @code{0.1} to @code{10.0}. The default value is "1".
  5480. @item gamma_b
  5481. Set the gamma expression for blue. The value must be a float in range
  5482. @code{0.1} to @code{10.0}. The default value is "1".
  5483. @item gamma_weight
  5484. Set the gamma weight expression. It can be used to reduce the effect
  5485. of a high gamma value on bright image areas, e.g. keep them from
  5486. getting overamplified and just plain white. The value must be a float
  5487. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5488. gamma correction all the way down while @code{1.0} leaves it at its
  5489. full strength. Default is "1".
  5490. @item eval
  5491. Set when the expressions for brightness, contrast, saturation and
  5492. gamma expressions are evaluated.
  5493. It accepts the following values:
  5494. @table @samp
  5495. @item init
  5496. only evaluate expressions once during the filter initialization or
  5497. when a command is processed
  5498. @item frame
  5499. evaluate expressions for each incoming frame
  5500. @end table
  5501. Default value is @samp{init}.
  5502. @end table
  5503. The expressions accept the following parameters:
  5504. @table @option
  5505. @item n
  5506. frame count of the input frame starting from 0
  5507. @item pos
  5508. byte position of the corresponding packet in the input file, NAN if
  5509. unspecified
  5510. @item r
  5511. frame rate of the input video, NAN if the input frame rate is unknown
  5512. @item t
  5513. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5514. @end table
  5515. @subsection Commands
  5516. The filter supports the following commands:
  5517. @table @option
  5518. @item contrast
  5519. Set the contrast expression.
  5520. @item brightness
  5521. Set the brightness expression.
  5522. @item saturation
  5523. Set the saturation expression.
  5524. @item gamma
  5525. Set the gamma expression.
  5526. @item gamma_r
  5527. Set the gamma_r expression.
  5528. @item gamma_g
  5529. Set gamma_g expression.
  5530. @item gamma_b
  5531. Set gamma_b expression.
  5532. @item gamma_weight
  5533. Set gamma_weight expression.
  5534. The command accepts the same syntax of the corresponding option.
  5535. If the specified expression is not valid, it is kept at its current
  5536. value.
  5537. @end table
  5538. @section erosion
  5539. Apply erosion effect to the video.
  5540. This filter replaces the pixel by the local(3x3) minimum.
  5541. It accepts the following options:
  5542. @table @option
  5543. @item threshold0
  5544. @item threshold1
  5545. @item threshold2
  5546. @item threshold3
  5547. Limit the maximum change for each plane, default is 65535.
  5548. If 0, plane will remain unchanged.
  5549. @item coordinates
  5550. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5551. pixels are used.
  5552. Flags to local 3x3 coordinates maps like this:
  5553. 1 2 3
  5554. 4 5
  5555. 6 7 8
  5556. @end table
  5557. @section extractplanes
  5558. Extract color channel components from input video stream into
  5559. separate grayscale video streams.
  5560. The filter accepts the following option:
  5561. @table @option
  5562. @item planes
  5563. Set plane(s) to extract.
  5564. Available values for planes are:
  5565. @table @samp
  5566. @item y
  5567. @item u
  5568. @item v
  5569. @item a
  5570. @item r
  5571. @item g
  5572. @item b
  5573. @end table
  5574. Choosing planes not available in the input will result in an error.
  5575. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5576. with @code{y}, @code{u}, @code{v} planes at same time.
  5577. @end table
  5578. @subsection Examples
  5579. @itemize
  5580. @item
  5581. Extract luma, u and v color channel component from input video frame
  5582. into 3 grayscale outputs:
  5583. @example
  5584. 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
  5585. @end example
  5586. @end itemize
  5587. @section elbg
  5588. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5589. For each input image, the filter will compute the optimal mapping from
  5590. the input to the output given the codebook length, that is the number
  5591. of distinct output colors.
  5592. This filter accepts the following options.
  5593. @table @option
  5594. @item codebook_length, l
  5595. Set codebook length. The value must be a positive integer, and
  5596. represents the number of distinct output colors. Default value is 256.
  5597. @item nb_steps, n
  5598. Set the maximum number of iterations to apply for computing the optimal
  5599. mapping. The higher the value the better the result and the higher the
  5600. computation time. Default value is 1.
  5601. @item seed, s
  5602. Set a random seed, must be an integer included between 0 and
  5603. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5604. will try to use a good random seed on a best effort basis.
  5605. @item pal8
  5606. Set pal8 output pixel format. This option does not work with codebook
  5607. length greater than 256.
  5608. @end table
  5609. @section fade
  5610. Apply a fade-in/out effect to the input video.
  5611. It accepts the following parameters:
  5612. @table @option
  5613. @item type, t
  5614. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5615. effect.
  5616. Default is @code{in}.
  5617. @item start_frame, s
  5618. Specify the number of the frame to start applying the fade
  5619. effect at. Default is 0.
  5620. @item nb_frames, n
  5621. The number of frames that the fade effect lasts. At the end of the
  5622. fade-in effect, the output video will have the same intensity as the input video.
  5623. At the end of the fade-out transition, the output video will be filled with the
  5624. selected @option{color}.
  5625. Default is 25.
  5626. @item alpha
  5627. If set to 1, fade only alpha channel, if one exists on the input.
  5628. Default value is 0.
  5629. @item start_time, st
  5630. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5631. effect. If both start_frame and start_time are specified, the fade will start at
  5632. whichever comes last. Default is 0.
  5633. @item duration, d
  5634. The number of seconds for which the fade effect has to last. At the end of the
  5635. fade-in effect the output video will have the same intensity as the input video,
  5636. at the end of the fade-out transition the output video will be filled with the
  5637. selected @option{color}.
  5638. If both duration and nb_frames are specified, duration is used. Default is 0
  5639. (nb_frames is used by default).
  5640. @item color, c
  5641. Specify the color of the fade. Default is "black".
  5642. @end table
  5643. @subsection Examples
  5644. @itemize
  5645. @item
  5646. Fade in the first 30 frames of video:
  5647. @example
  5648. fade=in:0:30
  5649. @end example
  5650. The command above is equivalent to:
  5651. @example
  5652. fade=t=in:s=0:n=30
  5653. @end example
  5654. @item
  5655. Fade out the last 45 frames of a 200-frame video:
  5656. @example
  5657. fade=out:155:45
  5658. fade=type=out:start_frame=155:nb_frames=45
  5659. @end example
  5660. @item
  5661. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5662. @example
  5663. fade=in:0:25, fade=out:975:25
  5664. @end example
  5665. @item
  5666. Make the first 5 frames yellow, then fade in from frame 5-24:
  5667. @example
  5668. fade=in:5:20:color=yellow
  5669. @end example
  5670. @item
  5671. Fade in alpha over first 25 frames of video:
  5672. @example
  5673. fade=in:0:25:alpha=1
  5674. @end example
  5675. @item
  5676. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5677. @example
  5678. fade=t=in:st=5.5:d=0.5
  5679. @end example
  5680. @end itemize
  5681. @section fftfilt
  5682. Apply arbitrary expressions to samples in frequency domain
  5683. @table @option
  5684. @item dc_Y
  5685. Adjust the dc value (gain) of the luma plane of the image. The filter
  5686. accepts an integer value in range @code{0} to @code{1000}. The default
  5687. value is set to @code{0}.
  5688. @item dc_U
  5689. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5690. filter accepts an integer value in range @code{0} to @code{1000}. The
  5691. default value is set to @code{0}.
  5692. @item dc_V
  5693. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5694. filter accepts an integer value in range @code{0} to @code{1000}. The
  5695. default value is set to @code{0}.
  5696. @item weight_Y
  5697. Set the frequency domain weight expression for the luma plane.
  5698. @item weight_U
  5699. Set the frequency domain weight expression for the 1st chroma plane.
  5700. @item weight_V
  5701. Set the frequency domain weight expression for the 2nd chroma plane.
  5702. The filter accepts the following variables:
  5703. @item X
  5704. @item Y
  5705. The coordinates of the current sample.
  5706. @item W
  5707. @item H
  5708. The width and height of the image.
  5709. @end table
  5710. @subsection Examples
  5711. @itemize
  5712. @item
  5713. High-pass:
  5714. @example
  5715. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5716. @end example
  5717. @item
  5718. Low-pass:
  5719. @example
  5720. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5721. @end example
  5722. @item
  5723. Sharpen:
  5724. @example
  5725. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5726. @end example
  5727. @item
  5728. Blur:
  5729. @example
  5730. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5731. @end example
  5732. @end itemize
  5733. @section field
  5734. Extract a single field from an interlaced image using stride
  5735. arithmetic to avoid wasting CPU time. The output frames are marked as
  5736. non-interlaced.
  5737. The filter accepts the following options:
  5738. @table @option
  5739. @item type
  5740. Specify whether to extract the top (if the value is @code{0} or
  5741. @code{top}) or the bottom field (if the value is @code{1} or
  5742. @code{bottom}).
  5743. @end table
  5744. @section fieldhint
  5745. Create new frames by copying the top and bottom fields from surrounding frames
  5746. supplied as numbers by the hint file.
  5747. @table @option
  5748. @item hint
  5749. Set file containing hints: absolute/relative frame numbers.
  5750. There must be one line for each frame in a clip. Each line must contain two
  5751. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5752. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5753. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5754. for @code{relative} mode. First number tells from which frame to pick up top
  5755. field and second number tells from which frame to pick up bottom field.
  5756. If optionally followed by @code{+} output frame will be marked as interlaced,
  5757. else if followed by @code{-} output frame will be marked as progressive, else
  5758. it will be marked same as input frame.
  5759. If line starts with @code{#} or @code{;} that line is skipped.
  5760. @item mode
  5761. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5762. @end table
  5763. Example of first several lines of @code{hint} file for @code{relative} mode:
  5764. @example
  5765. 0,0 - # first frame
  5766. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5767. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5768. 1,0 -
  5769. 0,0 -
  5770. 0,0 -
  5771. 1,0 -
  5772. 1,0 -
  5773. 1,0 -
  5774. 0,0 -
  5775. 0,0 -
  5776. 1,0 -
  5777. 1,0 -
  5778. 1,0 -
  5779. 0,0 -
  5780. @end example
  5781. @section fieldmatch
  5782. Field matching filter for inverse telecine. It is meant to reconstruct the
  5783. progressive frames from a telecined stream. The filter does not drop duplicated
  5784. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5785. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5786. The separation of the field matching and the decimation is notably motivated by
  5787. the possibility of inserting a de-interlacing filter fallback between the two.
  5788. If the source has mixed telecined and real interlaced content,
  5789. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5790. But these remaining combed frames will be marked as interlaced, and thus can be
  5791. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5792. In addition to the various configuration options, @code{fieldmatch} can take an
  5793. optional second stream, activated through the @option{ppsrc} option. If
  5794. enabled, the frames reconstruction will be based on the fields and frames from
  5795. this second stream. This allows the first input to be pre-processed in order to
  5796. help the various algorithms of the filter, while keeping the output lossless
  5797. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5798. or brightness/contrast adjustments can help.
  5799. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5800. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5801. which @code{fieldmatch} is based on. While the semantic and usage are very
  5802. close, some behaviour and options names can differ.
  5803. The @ref{decimate} filter currently only works for constant frame rate input.
  5804. If your input has mixed telecined (30fps) and progressive content with a lower
  5805. framerate like 24fps use the following filterchain to produce the necessary cfr
  5806. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5807. The filter accepts the following options:
  5808. @table @option
  5809. @item order
  5810. Specify the assumed field order of the input stream. Available values are:
  5811. @table @samp
  5812. @item auto
  5813. Auto detect parity (use FFmpeg's internal parity value).
  5814. @item bff
  5815. Assume bottom field first.
  5816. @item tff
  5817. Assume top field first.
  5818. @end table
  5819. Note that it is sometimes recommended not to trust the parity announced by the
  5820. stream.
  5821. Default value is @var{auto}.
  5822. @item mode
  5823. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5824. sense that it won't risk creating jerkiness due to duplicate frames when
  5825. possible, but if there are bad edits or blended fields it will end up
  5826. outputting combed frames when a good match might actually exist. On the other
  5827. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5828. but will almost always find a good frame if there is one. The other values are
  5829. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5830. jerkiness and creating duplicate frames versus finding good matches in sections
  5831. with bad edits, orphaned fields, blended fields, etc.
  5832. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5833. Available values are:
  5834. @table @samp
  5835. @item pc
  5836. 2-way matching (p/c)
  5837. @item pc_n
  5838. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5839. @item pc_u
  5840. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5841. @item pc_n_ub
  5842. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5843. still combed (p/c + n + u/b)
  5844. @item pcn
  5845. 3-way matching (p/c/n)
  5846. @item pcn_ub
  5847. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5848. detected as combed (p/c/n + u/b)
  5849. @end table
  5850. The parenthesis at the end indicate the matches that would be used for that
  5851. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5852. @var{top}).
  5853. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5854. the slowest.
  5855. Default value is @var{pc_n}.
  5856. @item ppsrc
  5857. Mark the main input stream as a pre-processed input, and enable the secondary
  5858. input stream as the clean source to pick the fields from. See the filter
  5859. introduction for more details. It is similar to the @option{clip2} feature from
  5860. VFM/TFM.
  5861. Default value is @code{0} (disabled).
  5862. @item field
  5863. Set the field to match from. It is recommended to set this to the same value as
  5864. @option{order} unless you experience matching failures with that setting. In
  5865. certain circumstances changing the field that is used to match from can have a
  5866. large impact on matching performance. Available values are:
  5867. @table @samp
  5868. @item auto
  5869. Automatic (same value as @option{order}).
  5870. @item bottom
  5871. Match from the bottom field.
  5872. @item top
  5873. Match from the top field.
  5874. @end table
  5875. Default value is @var{auto}.
  5876. @item mchroma
  5877. Set whether or not chroma is included during the match comparisons. In most
  5878. cases it is recommended to leave this enabled. You should set this to @code{0}
  5879. only if your clip has bad chroma problems such as heavy rainbowing or other
  5880. artifacts. Setting this to @code{0} could also be used to speed things up at
  5881. the cost of some accuracy.
  5882. Default value is @code{1}.
  5883. @item y0
  5884. @item y1
  5885. These define an exclusion band which excludes the lines between @option{y0} and
  5886. @option{y1} from being included in the field matching decision. An exclusion
  5887. band can be used to ignore subtitles, a logo, or other things that may
  5888. interfere with the matching. @option{y0} sets the starting scan line and
  5889. @option{y1} sets the ending line; all lines in between @option{y0} and
  5890. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5891. @option{y0} and @option{y1} to the same value will disable the feature.
  5892. @option{y0} and @option{y1} defaults to @code{0}.
  5893. @item scthresh
  5894. Set the scene change detection threshold as a percentage of maximum change on
  5895. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5896. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5897. @option{scthresh} is @code{[0.0, 100.0]}.
  5898. Default value is @code{12.0}.
  5899. @item combmatch
  5900. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5901. account the combed scores of matches when deciding what match to use as the
  5902. final match. Available values are:
  5903. @table @samp
  5904. @item none
  5905. No final matching based on combed scores.
  5906. @item sc
  5907. Combed scores are only used when a scene change is detected.
  5908. @item full
  5909. Use combed scores all the time.
  5910. @end table
  5911. Default is @var{sc}.
  5912. @item combdbg
  5913. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5914. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5915. Available values are:
  5916. @table @samp
  5917. @item none
  5918. No forced calculation.
  5919. @item pcn
  5920. Force p/c/n calculations.
  5921. @item pcnub
  5922. Force p/c/n/u/b calculations.
  5923. @end table
  5924. Default value is @var{none}.
  5925. @item cthresh
  5926. This is the area combing threshold used for combed frame detection. This
  5927. essentially controls how "strong" or "visible" combing must be to be detected.
  5928. Larger values mean combing must be more visible and smaller values mean combing
  5929. can be less visible or strong and still be detected. Valid settings are from
  5930. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5931. be detected as combed). This is basically a pixel difference value. A good
  5932. range is @code{[8, 12]}.
  5933. Default value is @code{9}.
  5934. @item chroma
  5935. Sets whether or not chroma is considered in the combed frame decision. Only
  5936. disable this if your source has chroma problems (rainbowing, etc.) that are
  5937. causing problems for the combed frame detection with chroma enabled. Actually,
  5938. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5939. where there is chroma only combing in the source.
  5940. Default value is @code{0}.
  5941. @item blockx
  5942. @item blocky
  5943. Respectively set the x-axis and y-axis size of the window used during combed
  5944. frame detection. This has to do with the size of the area in which
  5945. @option{combpel} pixels are required to be detected as combed for a frame to be
  5946. declared combed. See the @option{combpel} parameter description for more info.
  5947. Possible values are any number that is a power of 2 starting at 4 and going up
  5948. to 512.
  5949. Default value is @code{16}.
  5950. @item combpel
  5951. The number of combed pixels inside any of the @option{blocky} by
  5952. @option{blockx} size blocks on the frame for the frame to be detected as
  5953. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5954. setting controls "how much" combing there must be in any localized area (a
  5955. window defined by the @option{blockx} and @option{blocky} settings) on the
  5956. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5957. which point no frames will ever be detected as combed). This setting is known
  5958. as @option{MI} in TFM/VFM vocabulary.
  5959. Default value is @code{80}.
  5960. @end table
  5961. @anchor{p/c/n/u/b meaning}
  5962. @subsection p/c/n/u/b meaning
  5963. @subsubsection p/c/n
  5964. We assume the following telecined stream:
  5965. @example
  5966. Top fields: 1 2 2 3 4
  5967. Bottom fields: 1 2 3 4 4
  5968. @end example
  5969. The numbers correspond to the progressive frame the fields relate to. Here, the
  5970. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5971. When @code{fieldmatch} is configured to run a matching from bottom
  5972. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5973. @example
  5974. Input stream:
  5975. T 1 2 2 3 4
  5976. B 1 2 3 4 4 <-- matching reference
  5977. Matches: c c n n c
  5978. Output stream:
  5979. T 1 2 3 4 4
  5980. B 1 2 3 4 4
  5981. @end example
  5982. As a result of the field matching, we can see that some frames get duplicated.
  5983. To perform a complete inverse telecine, you need to rely on a decimation filter
  5984. after this operation. See for instance the @ref{decimate} filter.
  5985. The same operation now matching from top fields (@option{field}=@var{top})
  5986. looks like this:
  5987. @example
  5988. Input stream:
  5989. T 1 2 2 3 4 <-- matching reference
  5990. B 1 2 3 4 4
  5991. Matches: c c p p c
  5992. Output stream:
  5993. T 1 2 2 3 4
  5994. B 1 2 2 3 4
  5995. @end example
  5996. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5997. basically, they refer to the frame and field of the opposite parity:
  5998. @itemize
  5999. @item @var{p} matches the field of the opposite parity in the previous frame
  6000. @item @var{c} matches the field of the opposite parity in the current frame
  6001. @item @var{n} matches the field of the opposite parity in the next frame
  6002. @end itemize
  6003. @subsubsection u/b
  6004. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6005. from the opposite parity flag. In the following examples, we assume that we are
  6006. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6007. 'x' is placed above and below each matched fields.
  6008. With bottom matching (@option{field}=@var{bottom}):
  6009. @example
  6010. Match: c p n b u
  6011. x x x x x
  6012. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6013. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6014. x x x x x
  6015. Output frames:
  6016. 2 1 2 2 2
  6017. 2 2 2 1 3
  6018. @end example
  6019. With top matching (@option{field}=@var{top}):
  6020. @example
  6021. Match: c p n b u
  6022. x x x x x
  6023. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6024. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6025. x x x x x
  6026. Output frames:
  6027. 2 2 2 1 2
  6028. 2 1 3 2 2
  6029. @end example
  6030. @subsection Examples
  6031. Simple IVTC of a top field first telecined stream:
  6032. @example
  6033. fieldmatch=order=tff:combmatch=none, decimate
  6034. @end example
  6035. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6036. @example
  6037. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6038. @end example
  6039. @section fieldorder
  6040. Transform the field order of the input video.
  6041. It accepts the following parameters:
  6042. @table @option
  6043. @item order
  6044. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6045. for bottom field first.
  6046. @end table
  6047. The default value is @samp{tff}.
  6048. The transformation is done by shifting the picture content up or down
  6049. by one line, and filling the remaining line with appropriate picture content.
  6050. This method is consistent with most broadcast field order converters.
  6051. If the input video is not flagged as being interlaced, or it is already
  6052. flagged as being of the required output field order, then this filter does
  6053. not alter the incoming video.
  6054. It is very useful when converting to or from PAL DV material,
  6055. which is bottom field first.
  6056. For example:
  6057. @example
  6058. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6059. @end example
  6060. @section fifo, afifo
  6061. Buffer input images and send them when they are requested.
  6062. It is mainly useful when auto-inserted by the libavfilter
  6063. framework.
  6064. It does not take parameters.
  6065. @section find_rect
  6066. Find a rectangular object
  6067. It accepts the following options:
  6068. @table @option
  6069. @item object
  6070. Filepath of the object image, needs to be in gray8.
  6071. @item threshold
  6072. Detection threshold, default is 0.5.
  6073. @item mipmaps
  6074. Number of mipmaps, default is 3.
  6075. @item xmin, ymin, xmax, ymax
  6076. Specifies the rectangle in which to search.
  6077. @end table
  6078. @subsection Examples
  6079. @itemize
  6080. @item
  6081. Generate a representative palette of a given video using @command{ffmpeg}:
  6082. @example
  6083. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6084. @end example
  6085. @end itemize
  6086. @section cover_rect
  6087. Cover a rectangular object
  6088. It accepts the following options:
  6089. @table @option
  6090. @item cover
  6091. Filepath of the optional cover image, needs to be in yuv420.
  6092. @item mode
  6093. Set covering mode.
  6094. It accepts the following values:
  6095. @table @samp
  6096. @item cover
  6097. cover it by the supplied image
  6098. @item blur
  6099. cover it by interpolating the surrounding pixels
  6100. @end table
  6101. Default value is @var{blur}.
  6102. @end table
  6103. @subsection Examples
  6104. @itemize
  6105. @item
  6106. Generate a representative palette of a given video using @command{ffmpeg}:
  6107. @example
  6108. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6109. @end example
  6110. @end itemize
  6111. @anchor{format}
  6112. @section format
  6113. Convert the input video to one of the specified pixel formats.
  6114. Libavfilter will try to pick one that is suitable as input to
  6115. the next filter.
  6116. It accepts the following parameters:
  6117. @table @option
  6118. @item pix_fmts
  6119. A '|'-separated list of pixel format names, such as
  6120. "pix_fmts=yuv420p|monow|rgb24".
  6121. @end table
  6122. @subsection Examples
  6123. @itemize
  6124. @item
  6125. Convert the input video to the @var{yuv420p} format
  6126. @example
  6127. format=pix_fmts=yuv420p
  6128. @end example
  6129. Convert the input video to any of the formats in the list
  6130. @example
  6131. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6132. @end example
  6133. @end itemize
  6134. @anchor{fps}
  6135. @section fps
  6136. Convert the video to specified constant frame rate by duplicating or dropping
  6137. frames as necessary.
  6138. It accepts the following parameters:
  6139. @table @option
  6140. @item fps
  6141. The desired output frame rate. The default is @code{25}.
  6142. @item round
  6143. Rounding method.
  6144. Possible values are:
  6145. @table @option
  6146. @item zero
  6147. zero round towards 0
  6148. @item inf
  6149. round away from 0
  6150. @item down
  6151. round towards -infinity
  6152. @item up
  6153. round towards +infinity
  6154. @item near
  6155. round to nearest
  6156. @end table
  6157. The default is @code{near}.
  6158. @item start_time
  6159. Assume the first PTS should be the given value, in seconds. This allows for
  6160. padding/trimming at the start of stream. By default, no assumption is made
  6161. about the first frame's expected PTS, so no padding or trimming is done.
  6162. For example, this could be set to 0 to pad the beginning with duplicates of
  6163. the first frame if a video stream starts after the audio stream or to trim any
  6164. frames with a negative PTS.
  6165. @end table
  6166. Alternatively, the options can be specified as a flat string:
  6167. @var{fps}[:@var{round}].
  6168. See also the @ref{setpts} filter.
  6169. @subsection Examples
  6170. @itemize
  6171. @item
  6172. A typical usage in order to set the fps to 25:
  6173. @example
  6174. fps=fps=25
  6175. @end example
  6176. @item
  6177. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6178. @example
  6179. fps=fps=film:round=near
  6180. @end example
  6181. @end itemize
  6182. @section framepack
  6183. Pack two different video streams into a stereoscopic video, setting proper
  6184. metadata on supported codecs. The two views should have the same size and
  6185. framerate and processing will stop when the shorter video ends. Please note
  6186. that you may conveniently adjust view properties with the @ref{scale} and
  6187. @ref{fps} filters.
  6188. It accepts the following parameters:
  6189. @table @option
  6190. @item format
  6191. The desired packing format. Supported values are:
  6192. @table @option
  6193. @item sbs
  6194. The views are next to each other (default).
  6195. @item tab
  6196. The views are on top of each other.
  6197. @item lines
  6198. The views are packed by line.
  6199. @item columns
  6200. The views are packed by column.
  6201. @item frameseq
  6202. The views are temporally interleaved.
  6203. @end table
  6204. @end table
  6205. Some examples:
  6206. @example
  6207. # Convert left and right views into a frame-sequential video
  6208. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6209. # Convert views into a side-by-side video with the same output resolution as the input
  6210. 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
  6211. @end example
  6212. @section framerate
  6213. Change the frame rate by interpolating new video output frames from the source
  6214. frames.
  6215. This filter is not designed to function correctly with interlaced media. If
  6216. you wish to change the frame rate of interlaced media then you are required
  6217. to deinterlace before this filter and re-interlace after this filter.
  6218. A description of the accepted options follows.
  6219. @table @option
  6220. @item fps
  6221. Specify the output frames per second. This option can also be specified
  6222. as a value alone. The default is @code{50}.
  6223. @item interp_start
  6224. Specify the start of a range where the output frame will be created as a
  6225. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6226. the default is @code{15}.
  6227. @item interp_end
  6228. Specify the end of a range where the output frame will be created as a
  6229. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6230. the default is @code{240}.
  6231. @item scene
  6232. Specify the level at which a scene change is detected as a value between
  6233. 0 and 100 to indicate a new scene; a low value reflects a low
  6234. probability for the current frame to introduce a new scene, while a higher
  6235. value means the current frame is more likely to be one.
  6236. The default is @code{7}.
  6237. @item flags
  6238. Specify flags influencing the filter process.
  6239. Available value for @var{flags} is:
  6240. @table @option
  6241. @item scene_change_detect, scd
  6242. Enable scene change detection using the value of the option @var{scene}.
  6243. This flag is enabled by default.
  6244. @end table
  6245. @end table
  6246. @section framestep
  6247. Select one frame every N-th frame.
  6248. This filter accepts the following option:
  6249. @table @option
  6250. @item step
  6251. Select frame after every @code{step} frames.
  6252. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6253. @end table
  6254. @anchor{frei0r}
  6255. @section frei0r
  6256. Apply a frei0r effect to the input video.
  6257. To enable the compilation of this filter, you need to install the frei0r
  6258. header and configure FFmpeg with @code{--enable-frei0r}.
  6259. It accepts the following parameters:
  6260. @table @option
  6261. @item filter_name
  6262. The name of the frei0r effect to load. If the environment variable
  6263. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6264. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6265. Otherwise, the standard frei0r paths are searched, in this order:
  6266. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6267. @file{/usr/lib/frei0r-1/}.
  6268. @item filter_params
  6269. A '|'-separated list of parameters to pass to the frei0r effect.
  6270. @end table
  6271. A frei0r effect parameter can be a boolean (its value is either
  6272. "y" or "n"), a double, a color (specified as
  6273. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6274. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6275. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6276. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6277. The number and types of parameters depend on the loaded effect. If an
  6278. effect parameter is not specified, the default value is set.
  6279. @subsection Examples
  6280. @itemize
  6281. @item
  6282. Apply the distort0r effect, setting the first two double parameters:
  6283. @example
  6284. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6285. @end example
  6286. @item
  6287. Apply the colordistance effect, taking a color as the first parameter:
  6288. @example
  6289. frei0r=colordistance:0.2/0.3/0.4
  6290. frei0r=colordistance:violet
  6291. frei0r=colordistance:0x112233
  6292. @end example
  6293. @item
  6294. Apply the perspective effect, specifying the top left and top right image
  6295. positions:
  6296. @example
  6297. frei0r=perspective:0.2/0.2|0.8/0.2
  6298. @end example
  6299. @end itemize
  6300. For more information, see
  6301. @url{http://frei0r.dyne.org}
  6302. @section fspp
  6303. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6304. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6305. processing filter, one of them is performed once per block, not per pixel.
  6306. This allows for much higher speed.
  6307. The filter accepts the following options:
  6308. @table @option
  6309. @item quality
  6310. Set quality. This option defines the number of levels for averaging. It accepts
  6311. an integer in the range 4-5. Default value is @code{4}.
  6312. @item qp
  6313. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6314. If not set, the filter will use the QP from the video stream (if available).
  6315. @item strength
  6316. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6317. more details but also more artifacts, while higher values make the image smoother
  6318. but also blurrier. Default value is @code{0} − PSNR optimal.
  6319. @item use_bframe_qp
  6320. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6321. option may cause flicker since the B-Frames have often larger QP. Default is
  6322. @code{0} (not enabled).
  6323. @end table
  6324. @section geq
  6325. The filter accepts the following options:
  6326. @table @option
  6327. @item lum_expr, lum
  6328. Set the luminance expression.
  6329. @item cb_expr, cb
  6330. Set the chrominance blue expression.
  6331. @item cr_expr, cr
  6332. Set the chrominance red expression.
  6333. @item alpha_expr, a
  6334. Set the alpha expression.
  6335. @item red_expr, r
  6336. Set the red expression.
  6337. @item green_expr, g
  6338. Set the green expression.
  6339. @item blue_expr, b
  6340. Set the blue expression.
  6341. @end table
  6342. The colorspace is selected according to the specified options. If one
  6343. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6344. options is specified, the filter will automatically select a YCbCr
  6345. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6346. @option{blue_expr} options is specified, it will select an RGB
  6347. colorspace.
  6348. If one of the chrominance expression is not defined, it falls back on the other
  6349. one. If no alpha expression is specified it will evaluate to opaque value.
  6350. If none of chrominance expressions are specified, they will evaluate
  6351. to the luminance expression.
  6352. The expressions can use the following variables and functions:
  6353. @table @option
  6354. @item N
  6355. The sequential number of the filtered frame, starting from @code{0}.
  6356. @item X
  6357. @item Y
  6358. The coordinates of the current sample.
  6359. @item W
  6360. @item H
  6361. The width and height of the image.
  6362. @item SW
  6363. @item SH
  6364. Width and height scale depending on the currently filtered plane. It is the
  6365. ratio between the corresponding luma plane number of pixels and the current
  6366. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6367. @code{0.5,0.5} for chroma planes.
  6368. @item T
  6369. Time of the current frame, expressed in seconds.
  6370. @item p(x, y)
  6371. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6372. plane.
  6373. @item lum(x, y)
  6374. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6375. plane.
  6376. @item cb(x, y)
  6377. Return the value of the pixel at location (@var{x},@var{y}) of the
  6378. blue-difference chroma plane. Return 0 if there is no such plane.
  6379. @item cr(x, y)
  6380. Return the value of the pixel at location (@var{x},@var{y}) of the
  6381. red-difference chroma plane. Return 0 if there is no such plane.
  6382. @item r(x, y)
  6383. @item g(x, y)
  6384. @item b(x, y)
  6385. Return the value of the pixel at location (@var{x},@var{y}) of the
  6386. red/green/blue component. Return 0 if there is no such component.
  6387. @item alpha(x, y)
  6388. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6389. plane. Return 0 if there is no such plane.
  6390. @end table
  6391. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6392. automatically clipped to the closer edge.
  6393. @subsection Examples
  6394. @itemize
  6395. @item
  6396. Flip the image horizontally:
  6397. @example
  6398. geq=p(W-X\,Y)
  6399. @end example
  6400. @item
  6401. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6402. wavelength of 100 pixels:
  6403. @example
  6404. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6405. @end example
  6406. @item
  6407. Generate a fancy enigmatic moving light:
  6408. @example
  6409. 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
  6410. @end example
  6411. @item
  6412. Generate a quick emboss effect:
  6413. @example
  6414. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6415. @end example
  6416. @item
  6417. Modify RGB components depending on pixel position:
  6418. @example
  6419. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6420. @end example
  6421. @item
  6422. Create a radial gradient that is the same size as the input (also see
  6423. the @ref{vignette} filter):
  6424. @example
  6425. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6426. @end example
  6427. @end itemize
  6428. @section gradfun
  6429. Fix the banding artifacts that are sometimes introduced into nearly flat
  6430. regions by truncation to 8-bit color depth.
  6431. Interpolate the gradients that should go where the bands are, and
  6432. dither them.
  6433. It is designed for playback only. Do not use it prior to
  6434. lossy compression, because compression tends to lose the dither and
  6435. bring back the bands.
  6436. It accepts the following parameters:
  6437. @table @option
  6438. @item strength
  6439. The maximum amount by which the filter will change any one pixel. This is also
  6440. the threshold for detecting nearly flat regions. Acceptable values range from
  6441. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6442. valid range.
  6443. @item radius
  6444. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6445. gradients, but also prevents the filter from modifying the pixels near detailed
  6446. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6447. values will be clipped to the valid range.
  6448. @end table
  6449. Alternatively, the options can be specified as a flat string:
  6450. @var{strength}[:@var{radius}]
  6451. @subsection Examples
  6452. @itemize
  6453. @item
  6454. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6455. @example
  6456. gradfun=3.5:8
  6457. @end example
  6458. @item
  6459. Specify radius, omitting the strength (which will fall-back to the default
  6460. value):
  6461. @example
  6462. gradfun=radius=8
  6463. @end example
  6464. @end itemize
  6465. @anchor{haldclut}
  6466. @section haldclut
  6467. Apply a Hald CLUT to a video stream.
  6468. First input is the video stream to process, and second one is the Hald CLUT.
  6469. The Hald CLUT input can be a simple picture or a complete video stream.
  6470. The filter accepts the following options:
  6471. @table @option
  6472. @item shortest
  6473. Force termination when the shortest input terminates. Default is @code{0}.
  6474. @item repeatlast
  6475. Continue applying the last CLUT after the end of the stream. A value of
  6476. @code{0} disable the filter after the last frame of the CLUT is reached.
  6477. Default is @code{1}.
  6478. @end table
  6479. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6480. filters share the same internals).
  6481. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6482. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6483. @subsection Workflow examples
  6484. @subsubsection Hald CLUT video stream
  6485. Generate an identity Hald CLUT stream altered with various effects:
  6486. @example
  6487. 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
  6488. @end example
  6489. Note: make sure you use a lossless codec.
  6490. Then use it with @code{haldclut} to apply it on some random stream:
  6491. @example
  6492. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6493. @end example
  6494. The Hald CLUT will be applied to the 10 first seconds (duration of
  6495. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6496. to the remaining frames of the @code{mandelbrot} stream.
  6497. @subsubsection Hald CLUT with preview
  6498. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6499. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6500. biggest possible square starting at the top left of the picture. The remaining
  6501. padding pixels (bottom or right) will be ignored. This area can be used to add
  6502. a preview of the Hald CLUT.
  6503. Typically, the following generated Hald CLUT will be supported by the
  6504. @code{haldclut} filter:
  6505. @example
  6506. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6507. pad=iw+320 [padded_clut];
  6508. smptebars=s=320x256, split [a][b];
  6509. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6510. [main][b] overlay=W-320" -frames:v 1 clut.png
  6511. @end example
  6512. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6513. bars are displayed on the right-top, and below the same color bars processed by
  6514. the color changes.
  6515. Then, the effect of this Hald CLUT can be visualized with:
  6516. @example
  6517. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6518. @end example
  6519. @section hflip
  6520. Flip the input video horizontally.
  6521. For example, to horizontally flip the input video with @command{ffmpeg}:
  6522. @example
  6523. ffmpeg -i in.avi -vf "hflip" out.avi
  6524. @end example
  6525. @section histeq
  6526. This filter applies a global color histogram equalization on a
  6527. per-frame basis.
  6528. It can be used to correct video that has a compressed range of pixel
  6529. intensities. The filter redistributes the pixel intensities to
  6530. equalize their distribution across the intensity range. It may be
  6531. viewed as an "automatically adjusting contrast filter". This filter is
  6532. useful only for correcting degraded or poorly captured source
  6533. video.
  6534. The filter accepts the following options:
  6535. @table @option
  6536. @item strength
  6537. Determine the amount of equalization to be applied. As the strength
  6538. is reduced, the distribution of pixel intensities more-and-more
  6539. approaches that of the input frame. The value must be a float number
  6540. in the range [0,1] and defaults to 0.200.
  6541. @item intensity
  6542. Set the maximum intensity that can generated and scale the output
  6543. values appropriately. The strength should be set as desired and then
  6544. the intensity can be limited if needed to avoid washing-out. The value
  6545. must be a float number in the range [0,1] and defaults to 0.210.
  6546. @item antibanding
  6547. Set the antibanding level. If enabled the filter will randomly vary
  6548. the luminance of output pixels by a small amount to avoid banding of
  6549. the histogram. Possible values are @code{none}, @code{weak} or
  6550. @code{strong}. It defaults to @code{none}.
  6551. @end table
  6552. @section histogram
  6553. Compute and draw a color distribution histogram for the input video.
  6554. The computed histogram is a representation of the color component
  6555. distribution in an image.
  6556. Standard histogram displays the color components distribution in an image.
  6557. Displays color graph for each color component. Shows distribution of
  6558. the Y, U, V, A or R, G, B components, depending on input format, in the
  6559. current frame. Below each graph a color component scale meter is shown.
  6560. The filter accepts the following options:
  6561. @table @option
  6562. @item level_height
  6563. Set height of level. Default value is @code{200}.
  6564. Allowed range is [50, 2048].
  6565. @item scale_height
  6566. Set height of color scale. Default value is @code{12}.
  6567. Allowed range is [0, 40].
  6568. @item display_mode
  6569. Set display mode.
  6570. It accepts the following values:
  6571. @table @samp
  6572. @item parade
  6573. Per color component graphs are placed below each other.
  6574. @item overlay
  6575. Presents information identical to that in the @code{parade}, except
  6576. that the graphs representing color components are superimposed directly
  6577. over one another.
  6578. @end table
  6579. Default is @code{parade}.
  6580. @item levels_mode
  6581. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6582. Default is @code{linear}.
  6583. @item components
  6584. Set what color components to display.
  6585. Default is @code{7}.
  6586. @end table
  6587. @subsection Examples
  6588. @itemize
  6589. @item
  6590. Calculate and draw histogram:
  6591. @example
  6592. ffplay -i input -vf histogram
  6593. @end example
  6594. @end itemize
  6595. @anchor{hqdn3d}
  6596. @section hqdn3d
  6597. This is a high precision/quality 3d denoise filter. It aims to reduce
  6598. image noise, producing smooth images and making still images really
  6599. still. It should enhance compressibility.
  6600. It accepts the following optional parameters:
  6601. @table @option
  6602. @item luma_spatial
  6603. A non-negative floating point number which specifies spatial luma strength.
  6604. It defaults to 4.0.
  6605. @item chroma_spatial
  6606. A non-negative floating point number which specifies spatial chroma strength.
  6607. It defaults to 3.0*@var{luma_spatial}/4.0.
  6608. @item luma_tmp
  6609. A floating point number which specifies luma temporal strength. It defaults to
  6610. 6.0*@var{luma_spatial}/4.0.
  6611. @item chroma_tmp
  6612. A floating point number which specifies chroma temporal strength. It defaults to
  6613. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6614. @end table
  6615. @anchor{hwupload_cuda}
  6616. @section hwupload_cuda
  6617. Upload system memory frames to a CUDA device.
  6618. It accepts the following optional parameters:
  6619. @table @option
  6620. @item device
  6621. The number of the CUDA device to use
  6622. @end table
  6623. @section hqx
  6624. Apply a high-quality magnification filter designed for pixel art. This filter
  6625. was originally created by Maxim Stepin.
  6626. It accepts the following option:
  6627. @table @option
  6628. @item n
  6629. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6630. @code{hq3x} and @code{4} for @code{hq4x}.
  6631. Default is @code{3}.
  6632. @end table
  6633. @section hstack
  6634. Stack input videos horizontally.
  6635. All streams must be of same pixel format and of same height.
  6636. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6637. to create same output.
  6638. The filter accept the following option:
  6639. @table @option
  6640. @item inputs
  6641. Set number of input streams. Default is 2.
  6642. @item shortest
  6643. If set to 1, force the output to terminate when the shortest input
  6644. terminates. Default value is 0.
  6645. @end table
  6646. @section hue
  6647. Modify the hue and/or the saturation of the input.
  6648. It accepts the following parameters:
  6649. @table @option
  6650. @item h
  6651. Specify the hue angle as a number of degrees. It accepts an expression,
  6652. and defaults to "0".
  6653. @item s
  6654. Specify the saturation in the [-10,10] range. It accepts an expression and
  6655. defaults to "1".
  6656. @item H
  6657. Specify the hue angle as a number of radians. It accepts an
  6658. expression, and defaults to "0".
  6659. @item b
  6660. Specify the brightness in the [-10,10] range. It accepts an expression and
  6661. defaults to "0".
  6662. @end table
  6663. @option{h} and @option{H} are mutually exclusive, and can't be
  6664. specified at the same time.
  6665. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6666. expressions containing the following constants:
  6667. @table @option
  6668. @item n
  6669. frame count of the input frame starting from 0
  6670. @item pts
  6671. presentation timestamp of the input frame expressed in time base units
  6672. @item r
  6673. frame rate of the input video, NAN if the input frame rate is unknown
  6674. @item t
  6675. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6676. @item tb
  6677. time base of the input video
  6678. @end table
  6679. @subsection Examples
  6680. @itemize
  6681. @item
  6682. Set the hue to 90 degrees and the saturation to 1.0:
  6683. @example
  6684. hue=h=90:s=1
  6685. @end example
  6686. @item
  6687. Same command but expressing the hue in radians:
  6688. @example
  6689. hue=H=PI/2:s=1
  6690. @end example
  6691. @item
  6692. Rotate hue and make the saturation swing between 0
  6693. and 2 over a period of 1 second:
  6694. @example
  6695. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6696. @end example
  6697. @item
  6698. Apply a 3 seconds saturation fade-in effect starting at 0:
  6699. @example
  6700. hue="s=min(t/3\,1)"
  6701. @end example
  6702. The general fade-in expression can be written as:
  6703. @example
  6704. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6705. @end example
  6706. @item
  6707. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6708. @example
  6709. hue="s=max(0\, min(1\, (8-t)/3))"
  6710. @end example
  6711. The general fade-out expression can be written as:
  6712. @example
  6713. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6714. @end example
  6715. @end itemize
  6716. @subsection Commands
  6717. This filter supports the following commands:
  6718. @table @option
  6719. @item b
  6720. @item s
  6721. @item h
  6722. @item H
  6723. Modify the hue and/or the saturation and/or brightness of the input video.
  6724. The command accepts the same syntax of the corresponding option.
  6725. If the specified expression is not valid, it is kept at its current
  6726. value.
  6727. @end table
  6728. @section idet
  6729. Detect video interlacing type.
  6730. This filter tries to detect if the input frames as interlaced, progressive,
  6731. top or bottom field first. It will also try and detect fields that are
  6732. repeated between adjacent frames (a sign of telecine).
  6733. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6734. Multiple frame detection incorporates the classification history of previous frames.
  6735. The filter will log these metadata values:
  6736. @table @option
  6737. @item single.current_frame
  6738. Detected type of current frame using single-frame detection. One of:
  6739. ``tff'' (top field first), ``bff'' (bottom field first),
  6740. ``progressive'', or ``undetermined''
  6741. @item single.tff
  6742. Cumulative number of frames detected as top field first using single-frame detection.
  6743. @item multiple.tff
  6744. Cumulative number of frames detected as top field first using multiple-frame detection.
  6745. @item single.bff
  6746. Cumulative number of frames detected as bottom field first using single-frame detection.
  6747. @item multiple.current_frame
  6748. Detected type of current frame using multiple-frame detection. One of:
  6749. ``tff'' (top field first), ``bff'' (bottom field first),
  6750. ``progressive'', or ``undetermined''
  6751. @item multiple.bff
  6752. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6753. @item single.progressive
  6754. Cumulative number of frames detected as progressive using single-frame detection.
  6755. @item multiple.progressive
  6756. Cumulative number of frames detected as progressive using multiple-frame detection.
  6757. @item single.undetermined
  6758. Cumulative number of frames that could not be classified using single-frame detection.
  6759. @item multiple.undetermined
  6760. Cumulative number of frames that could not be classified using multiple-frame detection.
  6761. @item repeated.current_frame
  6762. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6763. @item repeated.neither
  6764. Cumulative number of frames with no repeated field.
  6765. @item repeated.top
  6766. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6767. @item repeated.bottom
  6768. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6769. @end table
  6770. The filter accepts the following options:
  6771. @table @option
  6772. @item intl_thres
  6773. Set interlacing threshold.
  6774. @item prog_thres
  6775. Set progressive threshold.
  6776. @item rep_thres
  6777. Threshold for repeated field detection.
  6778. @item half_life
  6779. Number of frames after which a given frame's contribution to the
  6780. statistics is halved (i.e., it contributes only 0.5 to it's
  6781. classification). The default of 0 means that all frames seen are given
  6782. full weight of 1.0 forever.
  6783. @item analyze_interlaced_flag
  6784. When this is not 0 then idet will use the specified number of frames to determine
  6785. if the interlaced flag is accurate, it will not count undetermined frames.
  6786. If the flag is found to be accurate it will be used without any further
  6787. computations, if it is found to be inaccurate it will be cleared without any
  6788. further computations. This allows inserting the idet filter as a low computational
  6789. method to clean up the interlaced flag
  6790. @end table
  6791. @section il
  6792. Deinterleave or interleave fields.
  6793. This filter allows one to process interlaced images fields without
  6794. deinterlacing them. Deinterleaving splits the input frame into 2
  6795. fields (so called half pictures). Odd lines are moved to the top
  6796. half of the output image, even lines to the bottom half.
  6797. You can process (filter) them independently and then re-interleave them.
  6798. The filter accepts the following options:
  6799. @table @option
  6800. @item luma_mode, l
  6801. @item chroma_mode, c
  6802. @item alpha_mode, a
  6803. Available values for @var{luma_mode}, @var{chroma_mode} and
  6804. @var{alpha_mode} are:
  6805. @table @samp
  6806. @item none
  6807. Do nothing.
  6808. @item deinterleave, d
  6809. Deinterleave fields, placing one above the other.
  6810. @item interleave, i
  6811. Interleave fields. Reverse the effect of deinterleaving.
  6812. @end table
  6813. Default value is @code{none}.
  6814. @item luma_swap, ls
  6815. @item chroma_swap, cs
  6816. @item alpha_swap, as
  6817. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6818. @end table
  6819. @section inflate
  6820. Apply inflate effect to the video.
  6821. This filter replaces the pixel by the local(3x3) average by taking into account
  6822. only values higher than the pixel.
  6823. It accepts the following options:
  6824. @table @option
  6825. @item threshold0
  6826. @item threshold1
  6827. @item threshold2
  6828. @item threshold3
  6829. Limit the maximum change for each plane, default is 65535.
  6830. If 0, plane will remain unchanged.
  6831. @end table
  6832. @section interlace
  6833. Simple interlacing filter from progressive contents. This interleaves upper (or
  6834. lower) lines from odd frames with lower (or upper) lines from even frames,
  6835. halving the frame rate and preserving image height.
  6836. @example
  6837. Original Original New Frame
  6838. Frame 'j' Frame 'j+1' (tff)
  6839. ========== =========== ==================
  6840. Line 0 --------------------> Frame 'j' Line 0
  6841. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6842. Line 2 ---------------------> Frame 'j' Line 2
  6843. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6844. ... ... ...
  6845. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6846. @end example
  6847. It accepts the following optional parameters:
  6848. @table @option
  6849. @item scan
  6850. This determines whether the interlaced frame is taken from the even
  6851. (tff - default) or odd (bff) lines of the progressive frame.
  6852. @item lowpass
  6853. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6854. interlacing and reduce moire patterns.
  6855. @end table
  6856. @section kerndeint
  6857. Deinterlace input video by applying Donald Graft's adaptive kernel
  6858. deinterling. Work on interlaced parts of a video to produce
  6859. progressive frames.
  6860. The description of the accepted parameters follows.
  6861. @table @option
  6862. @item thresh
  6863. Set the threshold which affects the filter's tolerance when
  6864. determining if a pixel line must be processed. It must be an integer
  6865. in the range [0,255] and defaults to 10. A value of 0 will result in
  6866. applying the process on every pixels.
  6867. @item map
  6868. Paint pixels exceeding the threshold value to white if set to 1.
  6869. Default is 0.
  6870. @item order
  6871. Set the fields order. Swap fields if set to 1, leave fields alone if
  6872. 0. Default is 0.
  6873. @item sharp
  6874. Enable additional sharpening if set to 1. Default is 0.
  6875. @item twoway
  6876. Enable twoway sharpening if set to 1. Default is 0.
  6877. @end table
  6878. @subsection Examples
  6879. @itemize
  6880. @item
  6881. Apply default values:
  6882. @example
  6883. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6884. @end example
  6885. @item
  6886. Enable additional sharpening:
  6887. @example
  6888. kerndeint=sharp=1
  6889. @end example
  6890. @item
  6891. Paint processed pixels in white:
  6892. @example
  6893. kerndeint=map=1
  6894. @end example
  6895. @end itemize
  6896. @section lenscorrection
  6897. Correct radial lens distortion
  6898. This filter can be used to correct for radial distortion as can result from the use
  6899. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6900. one can use tools available for example as part of opencv or simply trial-and-error.
  6901. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6902. and extract the k1 and k2 coefficients from the resulting matrix.
  6903. Note that effectively the same filter is available in the open-source tools Krita and
  6904. Digikam from the KDE project.
  6905. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6906. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6907. brightness distribution, so you may want to use both filters together in certain
  6908. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6909. be applied before or after lens correction.
  6910. @subsection Options
  6911. The filter accepts the following options:
  6912. @table @option
  6913. @item cx
  6914. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6915. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6916. width.
  6917. @item cy
  6918. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6919. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6920. height.
  6921. @item k1
  6922. Coefficient of the quadratic correction term. 0.5 means no correction.
  6923. @item k2
  6924. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6925. @end table
  6926. The formula that generates the correction is:
  6927. @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)
  6928. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6929. distances from the focal point in the source and target images, respectively.
  6930. @section loop
  6931. Loop video frames.
  6932. The filter accepts the following options:
  6933. @table @option
  6934. @item loop
  6935. Set the number of loops.
  6936. @item size
  6937. Set maximal size in number of frames.
  6938. @item start
  6939. Set first frame of loop.
  6940. @end table
  6941. @anchor{lut3d}
  6942. @section lut3d
  6943. Apply a 3D LUT to an input video.
  6944. The filter accepts the following options:
  6945. @table @option
  6946. @item file
  6947. Set the 3D LUT file name.
  6948. Currently supported formats:
  6949. @table @samp
  6950. @item 3dl
  6951. AfterEffects
  6952. @item cube
  6953. Iridas
  6954. @item dat
  6955. DaVinci
  6956. @item m3d
  6957. Pandora
  6958. @end table
  6959. @item interp
  6960. Select interpolation mode.
  6961. Available values are:
  6962. @table @samp
  6963. @item nearest
  6964. Use values from the nearest defined point.
  6965. @item trilinear
  6966. Interpolate values using the 8 points defining a cube.
  6967. @item tetrahedral
  6968. Interpolate values using a tetrahedron.
  6969. @end table
  6970. @end table
  6971. @section lut, lutrgb, lutyuv
  6972. Compute a look-up table for binding each pixel component input value
  6973. to an output value, and apply it to the input video.
  6974. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6975. to an RGB input video.
  6976. These filters accept the following parameters:
  6977. @table @option
  6978. @item c0
  6979. set first pixel component expression
  6980. @item c1
  6981. set second pixel component expression
  6982. @item c2
  6983. set third pixel component expression
  6984. @item c3
  6985. set fourth pixel component expression, corresponds to the alpha component
  6986. @item r
  6987. set red component expression
  6988. @item g
  6989. set green component expression
  6990. @item b
  6991. set blue component expression
  6992. @item a
  6993. alpha component expression
  6994. @item y
  6995. set Y/luminance component expression
  6996. @item u
  6997. set U/Cb component expression
  6998. @item v
  6999. set V/Cr component expression
  7000. @end table
  7001. Each of them specifies the expression to use for computing the lookup table for
  7002. the corresponding pixel component values.
  7003. The exact component associated to each of the @var{c*} options depends on the
  7004. format in input.
  7005. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7006. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7007. The expressions can contain the following constants and functions:
  7008. @table @option
  7009. @item w
  7010. @item h
  7011. The input width and height.
  7012. @item val
  7013. The input value for the pixel component.
  7014. @item clipval
  7015. The input value, clipped to the @var{minval}-@var{maxval} range.
  7016. @item maxval
  7017. The maximum value for the pixel component.
  7018. @item minval
  7019. The minimum value for the pixel component.
  7020. @item negval
  7021. The negated value for the pixel component value, clipped to the
  7022. @var{minval}-@var{maxval} range; it corresponds to the expression
  7023. "maxval-clipval+minval".
  7024. @item clip(val)
  7025. The computed value in @var{val}, clipped to the
  7026. @var{minval}-@var{maxval} range.
  7027. @item gammaval(gamma)
  7028. The computed gamma correction value of the pixel component value,
  7029. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7030. expression
  7031. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7032. @end table
  7033. All expressions default to "val".
  7034. @subsection Examples
  7035. @itemize
  7036. @item
  7037. Negate input video:
  7038. @example
  7039. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7040. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7041. @end example
  7042. The above is the same as:
  7043. @example
  7044. lutrgb="r=negval:g=negval:b=negval"
  7045. lutyuv="y=negval:u=negval:v=negval"
  7046. @end example
  7047. @item
  7048. Negate luminance:
  7049. @example
  7050. lutyuv=y=negval
  7051. @end example
  7052. @item
  7053. Remove chroma components, turning the video into a graytone image:
  7054. @example
  7055. lutyuv="u=128:v=128"
  7056. @end example
  7057. @item
  7058. Apply a luma burning effect:
  7059. @example
  7060. lutyuv="y=2*val"
  7061. @end example
  7062. @item
  7063. Remove green and blue components:
  7064. @example
  7065. lutrgb="g=0:b=0"
  7066. @end example
  7067. @item
  7068. Set a constant alpha channel value on input:
  7069. @example
  7070. format=rgba,lutrgb=a="maxval-minval/2"
  7071. @end example
  7072. @item
  7073. Correct luminance gamma by a factor of 0.5:
  7074. @example
  7075. lutyuv=y=gammaval(0.5)
  7076. @end example
  7077. @item
  7078. Discard least significant bits of luma:
  7079. @example
  7080. lutyuv=y='bitand(val, 128+64+32)'
  7081. @end example
  7082. @item
  7083. Technicolor like effect:
  7084. @example
  7085. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7086. @end example
  7087. @end itemize
  7088. @section maskedmerge
  7089. Merge the first input stream with the second input stream using per pixel
  7090. weights in the third input stream.
  7091. A value of 0 in the third stream pixel component means that pixel component
  7092. from first stream is returned unchanged, while maximum value (eg. 255 for
  7093. 8-bit videos) means that pixel component from second stream is returned
  7094. unchanged. Intermediate values define the amount of merging between both
  7095. input stream's pixel components.
  7096. This filter accepts the following options:
  7097. @table @option
  7098. @item planes
  7099. Set which planes will be processed as bitmap, unprocessed planes will be
  7100. copied from first stream.
  7101. By default value 0xf, all planes will be processed.
  7102. @end table
  7103. @section mcdeint
  7104. Apply motion-compensation deinterlacing.
  7105. It needs one field per frame as input and must thus be used together
  7106. with yadif=1/3 or equivalent.
  7107. This filter accepts the following options:
  7108. @table @option
  7109. @item mode
  7110. Set the deinterlacing mode.
  7111. It accepts one of the following values:
  7112. @table @samp
  7113. @item fast
  7114. @item medium
  7115. @item slow
  7116. use iterative motion estimation
  7117. @item extra_slow
  7118. like @samp{slow}, but use multiple reference frames.
  7119. @end table
  7120. Default value is @samp{fast}.
  7121. @item parity
  7122. Set the picture field parity assumed for the input video. It must be
  7123. one of the following values:
  7124. @table @samp
  7125. @item 0, tff
  7126. assume top field first
  7127. @item 1, bff
  7128. assume bottom field first
  7129. @end table
  7130. Default value is @samp{bff}.
  7131. @item qp
  7132. Set per-block quantization parameter (QP) used by the internal
  7133. encoder.
  7134. Higher values should result in a smoother motion vector field but less
  7135. optimal individual vectors. Default value is 1.
  7136. @end table
  7137. @section mergeplanes
  7138. Merge color channel components from several video streams.
  7139. The filter accepts up to 4 input streams, and merge selected input
  7140. planes to the output video.
  7141. This filter accepts the following options:
  7142. @table @option
  7143. @item mapping
  7144. Set input to output plane mapping. Default is @code{0}.
  7145. The mappings is specified as a bitmap. It should be specified as a
  7146. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7147. mapping for the first plane of the output stream. 'A' sets the number of
  7148. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7149. corresponding input to use (from 0 to 3). The rest of the mappings is
  7150. similar, 'Bb' describes the mapping for the output stream second
  7151. plane, 'Cc' describes the mapping for the output stream third plane and
  7152. 'Dd' describes the mapping for the output stream fourth plane.
  7153. @item format
  7154. Set output pixel format. Default is @code{yuva444p}.
  7155. @end table
  7156. @subsection Examples
  7157. @itemize
  7158. @item
  7159. Merge three gray video streams of same width and height into single video stream:
  7160. @example
  7161. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7162. @end example
  7163. @item
  7164. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7165. @example
  7166. [a0][a1]mergeplanes=0x00010210:yuva444p
  7167. @end example
  7168. @item
  7169. Swap Y and A plane in yuva444p stream:
  7170. @example
  7171. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7172. @end example
  7173. @item
  7174. Swap U and V plane in yuv420p stream:
  7175. @example
  7176. format=yuv420p,mergeplanes=0x000201:yuv420p
  7177. @end example
  7178. @item
  7179. Cast a rgb24 clip to yuv444p:
  7180. @example
  7181. format=rgb24,mergeplanes=0x000102:yuv444p
  7182. @end example
  7183. @end itemize
  7184. @section mpdecimate
  7185. Drop frames that do not differ greatly from the previous frame in
  7186. order to reduce frame rate.
  7187. The main use of this filter is for very-low-bitrate encoding
  7188. (e.g. streaming over dialup modem), but it could in theory be used for
  7189. fixing movies that were inverse-telecined incorrectly.
  7190. A description of the accepted options follows.
  7191. @table @option
  7192. @item max
  7193. Set the maximum number of consecutive frames which can be dropped (if
  7194. positive), or the minimum interval between dropped frames (if
  7195. negative). If the value is 0, the frame is dropped unregarding the
  7196. number of previous sequentially dropped frames.
  7197. Default value is 0.
  7198. @item hi
  7199. @item lo
  7200. @item frac
  7201. Set the dropping threshold values.
  7202. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7203. represent actual pixel value differences, so a threshold of 64
  7204. corresponds to 1 unit of difference for each pixel, or the same spread
  7205. out differently over the block.
  7206. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7207. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7208. meaning the whole image) differ by more than a threshold of @option{lo}.
  7209. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7210. 64*5, and default value for @option{frac} is 0.33.
  7211. @end table
  7212. @section negate
  7213. Negate input video.
  7214. It accepts an integer in input; if non-zero it negates the
  7215. alpha component (if available). The default value in input is 0.
  7216. @section nnedi
  7217. Deinterlace video using neural network edge directed interpolation.
  7218. This filter accepts the following options:
  7219. @table @option
  7220. @item weights
  7221. Mandatory option, without binary file filter can not work.
  7222. Currently file can be found here:
  7223. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7224. @item deint
  7225. Set which frames to deinterlace, by default it is @code{all}.
  7226. Can be @code{all} or @code{interlaced}.
  7227. @item field
  7228. Set mode of operation.
  7229. Can be one of the following:
  7230. @table @samp
  7231. @item af
  7232. Use frame flags, both fields.
  7233. @item a
  7234. Use frame flags, single field.
  7235. @item t
  7236. Use top field only.
  7237. @item b
  7238. Use bottom field only.
  7239. @item tf
  7240. Use both fields, top first.
  7241. @item bf
  7242. Use both fields, bottom first.
  7243. @end table
  7244. @item planes
  7245. Set which planes to process, by default filter process all frames.
  7246. @item nsize
  7247. Set size of local neighborhood around each pixel, used by the predictor neural
  7248. network.
  7249. Can be one of the following:
  7250. @table @samp
  7251. @item s8x6
  7252. @item s16x6
  7253. @item s32x6
  7254. @item s48x6
  7255. @item s8x4
  7256. @item s16x4
  7257. @item s32x4
  7258. @end table
  7259. @item nns
  7260. Set the number of neurons in predicctor neural network.
  7261. Can be one of the following:
  7262. @table @samp
  7263. @item n16
  7264. @item n32
  7265. @item n64
  7266. @item n128
  7267. @item n256
  7268. @end table
  7269. @item qual
  7270. Controls the number of different neural network predictions that are blended
  7271. together to compute the final output value. Can be @code{fast}, default or
  7272. @code{slow}.
  7273. @item etype
  7274. Set which set of weights to use in the predictor.
  7275. Can be one of the following:
  7276. @table @samp
  7277. @item a
  7278. weights trained to minimize absolute error
  7279. @item s
  7280. weights trained to minimize squared error
  7281. @end table
  7282. @item pscrn
  7283. Controls whether or not the prescreener neural network is used to decide
  7284. which pixels should be processed by the predictor neural network and which
  7285. can be handled by simple cubic interpolation.
  7286. The prescreener is trained to know whether cubic interpolation will be
  7287. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7288. The computational complexity of the prescreener nn is much less than that of
  7289. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7290. using the prescreener generally results in much faster processing.
  7291. The prescreener is pretty accurate, so the difference between using it and not
  7292. using it is almost always unnoticeable.
  7293. Can be one of the following:
  7294. @table @samp
  7295. @item none
  7296. @item original
  7297. @item new
  7298. @end table
  7299. Default is @code{new}.
  7300. @item fapprox
  7301. Set various debugging flags.
  7302. @end table
  7303. @section noformat
  7304. Force libavfilter not to use any of the specified pixel formats for the
  7305. input to the next filter.
  7306. It accepts the following parameters:
  7307. @table @option
  7308. @item pix_fmts
  7309. A '|'-separated list of pixel format names, such as
  7310. apix_fmts=yuv420p|monow|rgb24".
  7311. @end table
  7312. @subsection Examples
  7313. @itemize
  7314. @item
  7315. Force libavfilter to use a format different from @var{yuv420p} for the
  7316. input to the vflip filter:
  7317. @example
  7318. noformat=pix_fmts=yuv420p,vflip
  7319. @end example
  7320. @item
  7321. Convert the input video to any of the formats not contained in the list:
  7322. @example
  7323. noformat=yuv420p|yuv444p|yuv410p
  7324. @end example
  7325. @end itemize
  7326. @section noise
  7327. Add noise on video input frame.
  7328. The filter accepts the following options:
  7329. @table @option
  7330. @item all_seed
  7331. @item c0_seed
  7332. @item c1_seed
  7333. @item c2_seed
  7334. @item c3_seed
  7335. Set noise seed for specific pixel component or all pixel components in case
  7336. of @var{all_seed}. Default value is @code{123457}.
  7337. @item all_strength, alls
  7338. @item c0_strength, c0s
  7339. @item c1_strength, c1s
  7340. @item c2_strength, c2s
  7341. @item c3_strength, c3s
  7342. Set noise strength for specific pixel component or all pixel components in case
  7343. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7344. @item all_flags, allf
  7345. @item c0_flags, c0f
  7346. @item c1_flags, c1f
  7347. @item c2_flags, c2f
  7348. @item c3_flags, c3f
  7349. Set pixel component flags or set flags for all components if @var{all_flags}.
  7350. Available values for component flags are:
  7351. @table @samp
  7352. @item a
  7353. averaged temporal noise (smoother)
  7354. @item p
  7355. mix random noise with a (semi)regular pattern
  7356. @item t
  7357. temporal noise (noise pattern changes between frames)
  7358. @item u
  7359. uniform noise (gaussian otherwise)
  7360. @end table
  7361. @end table
  7362. @subsection Examples
  7363. Add temporal and uniform noise to input video:
  7364. @example
  7365. noise=alls=20:allf=t+u
  7366. @end example
  7367. @section null
  7368. Pass the video source unchanged to the output.
  7369. @section ocr
  7370. Optical Character Recognition
  7371. This filter uses Tesseract for optical character recognition.
  7372. It accepts the following options:
  7373. @table @option
  7374. @item datapath
  7375. Set datapath to tesseract data. Default is to use whatever was
  7376. set at installation.
  7377. @item language
  7378. Set language, default is "eng".
  7379. @item whitelist
  7380. Set character whitelist.
  7381. @item blacklist
  7382. Set character blacklist.
  7383. @end table
  7384. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7385. @section ocv
  7386. Apply a video transform using libopencv.
  7387. To enable this filter, install the libopencv library and headers and
  7388. configure FFmpeg with @code{--enable-libopencv}.
  7389. It accepts the following parameters:
  7390. @table @option
  7391. @item filter_name
  7392. The name of the libopencv filter to apply.
  7393. @item filter_params
  7394. The parameters to pass to the libopencv filter. If not specified, the default
  7395. values are assumed.
  7396. @end table
  7397. Refer to the official libopencv documentation for more precise
  7398. information:
  7399. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7400. Several libopencv filters are supported; see the following subsections.
  7401. @anchor{dilate}
  7402. @subsection dilate
  7403. Dilate an image by using a specific structuring element.
  7404. It corresponds to the libopencv function @code{cvDilate}.
  7405. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7406. @var{struct_el} represents a structuring element, and has the syntax:
  7407. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7408. @var{cols} and @var{rows} represent the number of columns and rows of
  7409. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7410. point, and @var{shape} the shape for the structuring element. @var{shape}
  7411. must be "rect", "cross", "ellipse", or "custom".
  7412. If the value for @var{shape} is "custom", it must be followed by a
  7413. string of the form "=@var{filename}". The file with name
  7414. @var{filename} is assumed to represent a binary image, with each
  7415. printable character corresponding to a bright pixel. When a custom
  7416. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7417. or columns and rows of the read file are assumed instead.
  7418. The default value for @var{struct_el} is "3x3+0x0/rect".
  7419. @var{nb_iterations} specifies the number of times the transform is
  7420. applied to the image, and defaults to 1.
  7421. Some examples:
  7422. @example
  7423. # Use the default values
  7424. ocv=dilate
  7425. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7426. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7427. # Read the shape from the file diamond.shape, iterating two times.
  7428. # The file diamond.shape may contain a pattern of characters like this
  7429. # *
  7430. # ***
  7431. # *****
  7432. # ***
  7433. # *
  7434. # The specified columns and rows are ignored
  7435. # but the anchor point coordinates are not
  7436. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7437. @end example
  7438. @subsection erode
  7439. Erode an image by using a specific structuring element.
  7440. It corresponds to the libopencv function @code{cvErode}.
  7441. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7442. with the same syntax and semantics as the @ref{dilate} filter.
  7443. @subsection smooth
  7444. Smooth the input video.
  7445. The filter takes the following parameters:
  7446. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7447. @var{type} is the type of smooth filter to apply, and must be one of
  7448. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7449. or "bilateral". The default value is "gaussian".
  7450. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7451. depend on the smooth type. @var{param1} and
  7452. @var{param2} accept integer positive values or 0. @var{param3} and
  7453. @var{param4} accept floating point values.
  7454. The default value for @var{param1} is 3. The default value for the
  7455. other parameters is 0.
  7456. These parameters correspond to the parameters assigned to the
  7457. libopencv function @code{cvSmooth}.
  7458. @anchor{overlay}
  7459. @section overlay
  7460. Overlay one video on top of another.
  7461. It takes two inputs and has one output. The first input is the "main"
  7462. video on which the second input is overlaid.
  7463. It accepts the following parameters:
  7464. A description of the accepted options follows.
  7465. @table @option
  7466. @item x
  7467. @item y
  7468. Set the expression for the x and y coordinates of the overlaid video
  7469. on the main video. Default value is "0" for both expressions. In case
  7470. the expression is invalid, it is set to a huge value (meaning that the
  7471. overlay will not be displayed within the output visible area).
  7472. @item eof_action
  7473. The action to take when EOF is encountered on the secondary input; it accepts
  7474. one of the following values:
  7475. @table @option
  7476. @item repeat
  7477. Repeat the last frame (the default).
  7478. @item endall
  7479. End both streams.
  7480. @item pass
  7481. Pass the main input through.
  7482. @end table
  7483. @item eval
  7484. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7485. It accepts the following values:
  7486. @table @samp
  7487. @item init
  7488. only evaluate expressions once during the filter initialization or
  7489. when a command is processed
  7490. @item frame
  7491. evaluate expressions for each incoming frame
  7492. @end table
  7493. Default value is @samp{frame}.
  7494. @item shortest
  7495. If set to 1, force the output to terminate when the shortest input
  7496. terminates. Default value is 0.
  7497. @item format
  7498. Set the format for the output video.
  7499. It accepts the following values:
  7500. @table @samp
  7501. @item yuv420
  7502. force YUV420 output
  7503. @item yuv422
  7504. force YUV422 output
  7505. @item yuv444
  7506. force YUV444 output
  7507. @item rgb
  7508. force RGB output
  7509. @end table
  7510. Default value is @samp{yuv420}.
  7511. @item rgb @emph{(deprecated)}
  7512. If set to 1, force the filter to accept inputs in the RGB
  7513. color space. Default value is 0. This option is deprecated, use
  7514. @option{format} instead.
  7515. @item repeatlast
  7516. If set to 1, force the filter to draw the last overlay frame over the
  7517. main input until the end of the stream. A value of 0 disables this
  7518. behavior. Default value is 1.
  7519. @end table
  7520. The @option{x}, and @option{y} expressions can contain the following
  7521. parameters.
  7522. @table @option
  7523. @item main_w, W
  7524. @item main_h, H
  7525. The main input width and height.
  7526. @item overlay_w, w
  7527. @item overlay_h, h
  7528. The overlay input width and height.
  7529. @item x
  7530. @item y
  7531. The computed values for @var{x} and @var{y}. They are evaluated for
  7532. each new frame.
  7533. @item hsub
  7534. @item vsub
  7535. horizontal and vertical chroma subsample values of the output
  7536. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7537. @var{vsub} is 1.
  7538. @item n
  7539. the number of input frame, starting from 0
  7540. @item pos
  7541. the position in the file of the input frame, NAN if unknown
  7542. @item t
  7543. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7544. @end table
  7545. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7546. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7547. when @option{eval} is set to @samp{init}.
  7548. Be aware that frames are taken from each input video in timestamp
  7549. order, hence, if their initial timestamps differ, it is a good idea
  7550. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7551. have them begin in the same zero timestamp, as the example for
  7552. the @var{movie} filter does.
  7553. You can chain together more overlays but you should test the
  7554. efficiency of such approach.
  7555. @subsection Commands
  7556. This filter supports the following commands:
  7557. @table @option
  7558. @item x
  7559. @item y
  7560. Modify the x and y of the overlay input.
  7561. The command accepts the same syntax of the corresponding option.
  7562. If the specified expression is not valid, it is kept at its current
  7563. value.
  7564. @end table
  7565. @subsection Examples
  7566. @itemize
  7567. @item
  7568. Draw the overlay at 10 pixels from the bottom right corner of the main
  7569. video:
  7570. @example
  7571. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7572. @end example
  7573. Using named options the example above becomes:
  7574. @example
  7575. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7576. @end example
  7577. @item
  7578. Insert a transparent PNG logo in the bottom left corner of the input,
  7579. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7580. @example
  7581. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7582. @end example
  7583. @item
  7584. Insert 2 different transparent PNG logos (second logo on bottom
  7585. right corner) using the @command{ffmpeg} tool:
  7586. @example
  7587. 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
  7588. @end example
  7589. @item
  7590. Add a transparent color layer on top of the main video; @code{WxH}
  7591. must specify the size of the main input to the overlay filter:
  7592. @example
  7593. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7594. @end example
  7595. @item
  7596. Play an original video and a filtered version (here with the deshake
  7597. filter) side by side using the @command{ffplay} tool:
  7598. @example
  7599. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7600. @end example
  7601. The above command is the same as:
  7602. @example
  7603. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7604. @end example
  7605. @item
  7606. Make a sliding overlay appearing from the left to the right top part of the
  7607. screen starting since time 2:
  7608. @example
  7609. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7610. @end example
  7611. @item
  7612. Compose output by putting two input videos side to side:
  7613. @example
  7614. ffmpeg -i left.avi -i right.avi -filter_complex "
  7615. nullsrc=size=200x100 [background];
  7616. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7617. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7618. [background][left] overlay=shortest=1 [background+left];
  7619. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7620. "
  7621. @end example
  7622. @item
  7623. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7624. @example
  7625. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7626. -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]'
  7627. masked.avi
  7628. @end example
  7629. @item
  7630. Chain several overlays in cascade:
  7631. @example
  7632. nullsrc=s=200x200 [bg];
  7633. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7634. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7635. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7636. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7637. [in3] null, [mid2] overlay=100:100 [out0]
  7638. @end example
  7639. @end itemize
  7640. @section owdenoise
  7641. Apply Overcomplete Wavelet denoiser.
  7642. The filter accepts the following options:
  7643. @table @option
  7644. @item depth
  7645. Set depth.
  7646. Larger depth values will denoise lower frequency components more, but
  7647. slow down filtering.
  7648. Must be an int in the range 8-16, default is @code{8}.
  7649. @item luma_strength, ls
  7650. Set luma strength.
  7651. Must be a double value in the range 0-1000, default is @code{1.0}.
  7652. @item chroma_strength, cs
  7653. Set chroma strength.
  7654. Must be a double value in the range 0-1000, default is @code{1.0}.
  7655. @end table
  7656. @anchor{pad}
  7657. @section pad
  7658. Add paddings to the input image, and place the original input at the
  7659. provided @var{x}, @var{y} coordinates.
  7660. It accepts the following parameters:
  7661. @table @option
  7662. @item width, w
  7663. @item height, h
  7664. Specify an expression for the size of the output image with the
  7665. paddings added. If the value for @var{width} or @var{height} is 0, the
  7666. corresponding input size is used for the output.
  7667. The @var{width} expression can reference the value set by the
  7668. @var{height} expression, and vice versa.
  7669. The default value of @var{width} and @var{height} is 0.
  7670. @item x
  7671. @item y
  7672. Specify the offsets to place the input image at within the padded area,
  7673. with respect to the top/left border of the output image.
  7674. The @var{x} expression can reference the value set by the @var{y}
  7675. expression, and vice versa.
  7676. The default value of @var{x} and @var{y} is 0.
  7677. @item color
  7678. Specify the color of the padded area. For the syntax of this option,
  7679. check the "Color" section in the ffmpeg-utils manual.
  7680. The default value of @var{color} is "black".
  7681. @end table
  7682. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7683. options are expressions containing the following constants:
  7684. @table @option
  7685. @item in_w
  7686. @item in_h
  7687. The input video width and height.
  7688. @item iw
  7689. @item ih
  7690. These are the same as @var{in_w} and @var{in_h}.
  7691. @item out_w
  7692. @item out_h
  7693. The output width and height (the size of the padded area), as
  7694. specified by the @var{width} and @var{height} expressions.
  7695. @item ow
  7696. @item oh
  7697. These are the same as @var{out_w} and @var{out_h}.
  7698. @item x
  7699. @item y
  7700. The x and y offsets as specified by the @var{x} and @var{y}
  7701. expressions, or NAN if not yet specified.
  7702. @item a
  7703. same as @var{iw} / @var{ih}
  7704. @item sar
  7705. input sample aspect ratio
  7706. @item dar
  7707. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7708. @item hsub
  7709. @item vsub
  7710. The horizontal and vertical chroma subsample values. For example for the
  7711. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7712. @end table
  7713. @subsection Examples
  7714. @itemize
  7715. @item
  7716. Add paddings with the color "violet" to the input video. The output video
  7717. size is 640x480, and the top-left corner of the input video is placed at
  7718. column 0, row 40
  7719. @example
  7720. pad=640:480:0:40:violet
  7721. @end example
  7722. The example above is equivalent to the following command:
  7723. @example
  7724. pad=width=640:height=480:x=0:y=40:color=violet
  7725. @end example
  7726. @item
  7727. Pad the input to get an output with dimensions increased by 3/2,
  7728. and put the input video at the center of the padded area:
  7729. @example
  7730. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7731. @end example
  7732. @item
  7733. Pad the input to get a squared output with size equal to the maximum
  7734. value between the input width and height, and put the input video at
  7735. the center of the padded area:
  7736. @example
  7737. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7738. @end example
  7739. @item
  7740. Pad the input to get a final w/h ratio of 16:9:
  7741. @example
  7742. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7743. @end example
  7744. @item
  7745. In case of anamorphic video, in order to set the output display aspect
  7746. correctly, it is necessary to use @var{sar} in the expression,
  7747. according to the relation:
  7748. @example
  7749. (ih * X / ih) * sar = output_dar
  7750. X = output_dar / sar
  7751. @end example
  7752. Thus the previous example needs to be modified to:
  7753. @example
  7754. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7755. @end example
  7756. @item
  7757. Double the output size and put the input video in the bottom-right
  7758. corner of the output padded area:
  7759. @example
  7760. pad="2*iw:2*ih:ow-iw:oh-ih"
  7761. @end example
  7762. @end itemize
  7763. @anchor{palettegen}
  7764. @section palettegen
  7765. Generate one palette for a whole video stream.
  7766. It accepts the following options:
  7767. @table @option
  7768. @item max_colors
  7769. Set the maximum number of colors to quantize in the palette.
  7770. Note: the palette will still contain 256 colors; the unused palette entries
  7771. will be black.
  7772. @item reserve_transparent
  7773. Create a palette of 255 colors maximum and reserve the last one for
  7774. transparency. Reserving the transparency color is useful for GIF optimization.
  7775. If not set, the maximum of colors in the palette will be 256. You probably want
  7776. to disable this option for a standalone image.
  7777. Set by default.
  7778. @item stats_mode
  7779. Set statistics mode.
  7780. It accepts the following values:
  7781. @table @samp
  7782. @item full
  7783. Compute full frame histograms.
  7784. @item diff
  7785. Compute histograms only for the part that differs from previous frame. This
  7786. might be relevant to give more importance to the moving part of your input if
  7787. the background is static.
  7788. @end table
  7789. Default value is @var{full}.
  7790. @end table
  7791. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7792. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7793. color quantization of the palette. This information is also visible at
  7794. @var{info} logging level.
  7795. @subsection Examples
  7796. @itemize
  7797. @item
  7798. Generate a representative palette of a given video using @command{ffmpeg}:
  7799. @example
  7800. ffmpeg -i input.mkv -vf palettegen palette.png
  7801. @end example
  7802. @end itemize
  7803. @section paletteuse
  7804. Use a palette to downsample an input video stream.
  7805. The filter takes two inputs: one video stream and a palette. The palette must
  7806. be a 256 pixels image.
  7807. It accepts the following options:
  7808. @table @option
  7809. @item dither
  7810. Select dithering mode. Available algorithms are:
  7811. @table @samp
  7812. @item bayer
  7813. Ordered 8x8 bayer dithering (deterministic)
  7814. @item heckbert
  7815. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7816. Note: this dithering is sometimes considered "wrong" and is included as a
  7817. reference.
  7818. @item floyd_steinberg
  7819. Floyd and Steingberg dithering (error diffusion)
  7820. @item sierra2
  7821. Frankie Sierra dithering v2 (error diffusion)
  7822. @item sierra2_4a
  7823. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7824. @end table
  7825. Default is @var{sierra2_4a}.
  7826. @item bayer_scale
  7827. When @var{bayer} dithering is selected, this option defines the scale of the
  7828. pattern (how much the crosshatch pattern is visible). A low value means more
  7829. visible pattern for less banding, and higher value means less visible pattern
  7830. at the cost of more banding.
  7831. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7832. @item diff_mode
  7833. If set, define the zone to process
  7834. @table @samp
  7835. @item rectangle
  7836. Only the changing rectangle will be reprocessed. This is similar to GIF
  7837. cropping/offsetting compression mechanism. This option can be useful for speed
  7838. if only a part of the image is changing, and has use cases such as limiting the
  7839. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7840. moving scene (it leads to more deterministic output if the scene doesn't change
  7841. much, and as a result less moving noise and better GIF compression).
  7842. @end table
  7843. Default is @var{none}.
  7844. @end table
  7845. @subsection Examples
  7846. @itemize
  7847. @item
  7848. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7849. using @command{ffmpeg}:
  7850. @example
  7851. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7852. @end example
  7853. @end itemize
  7854. @section perspective
  7855. Correct perspective of video not recorded perpendicular to the screen.
  7856. A description of the accepted parameters follows.
  7857. @table @option
  7858. @item x0
  7859. @item y0
  7860. @item x1
  7861. @item y1
  7862. @item x2
  7863. @item y2
  7864. @item x3
  7865. @item y3
  7866. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7867. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7868. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7869. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7870. then the corners of the source will be sent to the specified coordinates.
  7871. The expressions can use the following variables:
  7872. @table @option
  7873. @item W
  7874. @item H
  7875. the width and height of video frame.
  7876. @item in
  7877. Input frame count.
  7878. @item on
  7879. Output frame count.
  7880. @end table
  7881. @item interpolation
  7882. Set interpolation for perspective correction.
  7883. It accepts the following values:
  7884. @table @samp
  7885. @item linear
  7886. @item cubic
  7887. @end table
  7888. Default value is @samp{linear}.
  7889. @item sense
  7890. Set interpretation of coordinate options.
  7891. It accepts the following values:
  7892. @table @samp
  7893. @item 0, source
  7894. Send point in the source specified by the given coordinates to
  7895. the corners of the destination.
  7896. @item 1, destination
  7897. Send the corners of the source to the point in the destination specified
  7898. by the given coordinates.
  7899. Default value is @samp{source}.
  7900. @end table
  7901. @item eval
  7902. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  7903. It accepts the following values:
  7904. @table @samp
  7905. @item init
  7906. only evaluate expressions once during the filter initialization or
  7907. when a command is processed
  7908. @item frame
  7909. evaluate expressions for each incoming frame
  7910. @end table
  7911. Default value is @samp{init}.
  7912. @end table
  7913. @section phase
  7914. Delay interlaced video by one field time so that the field order changes.
  7915. The intended use is to fix PAL movies that have been captured with the
  7916. opposite field order to the film-to-video transfer.
  7917. A description of the accepted parameters follows.
  7918. @table @option
  7919. @item mode
  7920. Set phase mode.
  7921. It accepts the following values:
  7922. @table @samp
  7923. @item t
  7924. Capture field order top-first, transfer bottom-first.
  7925. Filter will delay the bottom field.
  7926. @item b
  7927. Capture field order bottom-first, transfer top-first.
  7928. Filter will delay the top field.
  7929. @item p
  7930. Capture and transfer with the same field order. This mode only exists
  7931. for the documentation of the other options to refer to, but if you
  7932. actually select it, the filter will faithfully do nothing.
  7933. @item a
  7934. Capture field order determined automatically by field flags, transfer
  7935. opposite.
  7936. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7937. basis using field flags. If no field information is available,
  7938. then this works just like @samp{u}.
  7939. @item u
  7940. Capture unknown or varying, transfer opposite.
  7941. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7942. analyzing the images and selecting the alternative that produces best
  7943. match between the fields.
  7944. @item T
  7945. Capture top-first, transfer unknown or varying.
  7946. Filter selects among @samp{t} and @samp{p} using image analysis.
  7947. @item B
  7948. Capture bottom-first, transfer unknown or varying.
  7949. Filter selects among @samp{b} and @samp{p} using image analysis.
  7950. @item A
  7951. Capture determined by field flags, transfer unknown or varying.
  7952. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7953. image analysis. If no field information is available, then this works just
  7954. like @samp{U}. This is the default mode.
  7955. @item U
  7956. Both capture and transfer unknown or varying.
  7957. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7958. @end table
  7959. @end table
  7960. @section pixdesctest
  7961. Pixel format descriptor test filter, mainly useful for internal
  7962. testing. The output video should be equal to the input video.
  7963. For example:
  7964. @example
  7965. format=monow, pixdesctest
  7966. @end example
  7967. can be used to test the monowhite pixel format descriptor definition.
  7968. @section pp
  7969. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7970. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7971. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7972. Each subfilter and some options have a short and a long name that can be used
  7973. interchangeably, i.e. dr/dering are the same.
  7974. The filters accept the following options:
  7975. @table @option
  7976. @item subfilters
  7977. Set postprocessing subfilters string.
  7978. @end table
  7979. All subfilters share common options to determine their scope:
  7980. @table @option
  7981. @item a/autoq
  7982. Honor the quality commands for this subfilter.
  7983. @item c/chrom
  7984. Do chrominance filtering, too (default).
  7985. @item y/nochrom
  7986. Do luminance filtering only (no chrominance).
  7987. @item n/noluma
  7988. Do chrominance filtering only (no luminance).
  7989. @end table
  7990. These options can be appended after the subfilter name, separated by a '|'.
  7991. Available subfilters are:
  7992. @table @option
  7993. @item hb/hdeblock[|difference[|flatness]]
  7994. Horizontal deblocking filter
  7995. @table @option
  7996. @item difference
  7997. Difference factor where higher values mean more deblocking (default: @code{32}).
  7998. @item flatness
  7999. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8000. @end table
  8001. @item vb/vdeblock[|difference[|flatness]]
  8002. Vertical deblocking filter
  8003. @table @option
  8004. @item difference
  8005. Difference factor where higher values mean more deblocking (default: @code{32}).
  8006. @item flatness
  8007. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8008. @end table
  8009. @item ha/hadeblock[|difference[|flatness]]
  8010. Accurate horizontal deblocking filter
  8011. @table @option
  8012. @item difference
  8013. Difference factor where higher values mean more deblocking (default: @code{32}).
  8014. @item flatness
  8015. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8016. @end table
  8017. @item va/vadeblock[|difference[|flatness]]
  8018. Accurate vertical deblocking filter
  8019. @table @option
  8020. @item difference
  8021. Difference factor where higher values mean more deblocking (default: @code{32}).
  8022. @item flatness
  8023. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8024. @end table
  8025. @end table
  8026. The horizontal and vertical deblocking filters share the difference and
  8027. flatness values so you cannot set different horizontal and vertical
  8028. thresholds.
  8029. @table @option
  8030. @item h1/x1hdeblock
  8031. Experimental horizontal deblocking filter
  8032. @item v1/x1vdeblock
  8033. Experimental vertical deblocking filter
  8034. @item dr/dering
  8035. Deringing filter
  8036. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8037. @table @option
  8038. @item threshold1
  8039. larger -> stronger filtering
  8040. @item threshold2
  8041. larger -> stronger filtering
  8042. @item threshold3
  8043. larger -> stronger filtering
  8044. @end table
  8045. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8046. @table @option
  8047. @item f/fullyrange
  8048. Stretch luminance to @code{0-255}.
  8049. @end table
  8050. @item lb/linblenddeint
  8051. Linear blend deinterlacing filter that deinterlaces the given block by
  8052. filtering all lines with a @code{(1 2 1)} filter.
  8053. @item li/linipoldeint
  8054. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8055. linearly interpolating every second line.
  8056. @item ci/cubicipoldeint
  8057. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8058. cubically interpolating every second line.
  8059. @item md/mediandeint
  8060. Median deinterlacing filter that deinterlaces the given block by applying a
  8061. median filter to every second line.
  8062. @item fd/ffmpegdeint
  8063. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8064. second line with a @code{(-1 4 2 4 -1)} filter.
  8065. @item l5/lowpass5
  8066. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8067. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8068. @item fq/forceQuant[|quantizer]
  8069. Overrides the quantizer table from the input with the constant quantizer you
  8070. specify.
  8071. @table @option
  8072. @item quantizer
  8073. Quantizer to use
  8074. @end table
  8075. @item de/default
  8076. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8077. @item fa/fast
  8078. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8079. @item ac
  8080. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8081. @end table
  8082. @subsection Examples
  8083. @itemize
  8084. @item
  8085. Apply horizontal and vertical deblocking, deringing and automatic
  8086. brightness/contrast:
  8087. @example
  8088. pp=hb/vb/dr/al
  8089. @end example
  8090. @item
  8091. Apply default filters without brightness/contrast correction:
  8092. @example
  8093. pp=de/-al
  8094. @end example
  8095. @item
  8096. Apply default filters and temporal denoiser:
  8097. @example
  8098. pp=default/tmpnoise|1|2|3
  8099. @end example
  8100. @item
  8101. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8102. automatically depending on available CPU time:
  8103. @example
  8104. pp=hb|y/vb|a
  8105. @end example
  8106. @end itemize
  8107. @section pp7
  8108. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8109. similar to spp = 6 with 7 point DCT, where only the center sample is
  8110. used after IDCT.
  8111. The filter accepts the following options:
  8112. @table @option
  8113. @item qp
  8114. Force a constant quantization parameter. It accepts an integer in range
  8115. 0 to 63. If not set, the filter will use the QP from the video stream
  8116. (if available).
  8117. @item mode
  8118. Set thresholding mode. Available modes are:
  8119. @table @samp
  8120. @item hard
  8121. Set hard thresholding.
  8122. @item soft
  8123. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8124. @item medium
  8125. Set medium thresholding (good results, default).
  8126. @end table
  8127. @end table
  8128. @section psnr
  8129. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8130. Ratio) between two input videos.
  8131. This filter takes in input two input videos, the first input is
  8132. considered the "main" source and is passed unchanged to the
  8133. output. The second input is used as a "reference" video for computing
  8134. the PSNR.
  8135. Both video inputs must have the same resolution and pixel format for
  8136. this filter to work correctly. Also it assumes that both inputs
  8137. have the same number of frames, which are compared one by one.
  8138. The obtained average PSNR is printed through the logging system.
  8139. The filter stores the accumulated MSE (mean squared error) of each
  8140. frame, and at the end of the processing it is averaged across all frames
  8141. equally, and the following formula is applied to obtain the PSNR:
  8142. @example
  8143. PSNR = 10*log10(MAX^2/MSE)
  8144. @end example
  8145. Where MAX is the average of the maximum values of each component of the
  8146. image.
  8147. The description of the accepted parameters follows.
  8148. @table @option
  8149. @item stats_file, f
  8150. If specified the filter will use the named file to save the PSNR of
  8151. each individual frame. When filename equals "-" the data is sent to
  8152. standard output.
  8153. @item stats_version
  8154. Specifies which version of the stats file format to use. Details of
  8155. each format are written below.
  8156. Default value is 1.
  8157. @end table
  8158. The file printed if @var{stats_file} is selected, contains a sequence of
  8159. key/value pairs of the form @var{key}:@var{value} for each compared
  8160. couple of frames.
  8161. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8162. the list of per-frame-pair stats, with key value pairs following the frame
  8163. format with the following parameters:
  8164. @table @option
  8165. @item psnr_log_version
  8166. The version of the log file format. Will match @var{stats_version}.
  8167. @item fields
  8168. A comma separated list of the per-frame-pair parameters included in
  8169. the log.
  8170. @end table
  8171. A description of each shown per-frame-pair parameter follows:
  8172. @table @option
  8173. @item n
  8174. sequential number of the input frame, starting from 1
  8175. @item mse_avg
  8176. Mean Square Error pixel-by-pixel average difference of the compared
  8177. frames, averaged over all the image components.
  8178. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8179. Mean Square Error pixel-by-pixel average difference of the compared
  8180. frames for the component specified by the suffix.
  8181. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8182. Peak Signal to Noise ratio of the compared frames for the component
  8183. specified by the suffix.
  8184. @end table
  8185. For example:
  8186. @example
  8187. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8188. [main][ref] psnr="stats_file=stats.log" [out]
  8189. @end example
  8190. On this example the input file being processed is compared with the
  8191. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8192. is stored in @file{stats.log}.
  8193. @anchor{pullup}
  8194. @section pullup
  8195. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8196. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8197. content.
  8198. The pullup filter is designed to take advantage of future context in making
  8199. its decisions. This filter is stateless in the sense that it does not lock
  8200. onto a pattern to follow, but it instead looks forward to the following
  8201. fields in order to identify matches and rebuild progressive frames.
  8202. To produce content with an even framerate, insert the fps filter after
  8203. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8204. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8205. The filter accepts the following options:
  8206. @table @option
  8207. @item jl
  8208. @item jr
  8209. @item jt
  8210. @item jb
  8211. These options set the amount of "junk" to ignore at the left, right, top, and
  8212. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8213. while top and bottom are in units of 2 lines.
  8214. The default is 8 pixels on each side.
  8215. @item sb
  8216. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8217. filter generating an occasional mismatched frame, but it may also cause an
  8218. excessive number of frames to be dropped during high motion sequences.
  8219. Conversely, setting it to -1 will make filter match fields more easily.
  8220. This may help processing of video where there is slight blurring between
  8221. the fields, but may also cause there to be interlaced frames in the output.
  8222. Default value is @code{0}.
  8223. @item mp
  8224. Set the metric plane to use. It accepts the following values:
  8225. @table @samp
  8226. @item l
  8227. Use luma plane.
  8228. @item u
  8229. Use chroma blue plane.
  8230. @item v
  8231. Use chroma red plane.
  8232. @end table
  8233. This option may be set to use chroma plane instead of the default luma plane
  8234. for doing filter's computations. This may improve accuracy on very clean
  8235. source material, but more likely will decrease accuracy, especially if there
  8236. is chroma noise (rainbow effect) or any grayscale video.
  8237. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8238. load and make pullup usable in realtime on slow machines.
  8239. @end table
  8240. For best results (without duplicated frames in the output file) it is
  8241. necessary to change the output frame rate. For example, to inverse
  8242. telecine NTSC input:
  8243. @example
  8244. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8245. @end example
  8246. @section qp
  8247. Change video quantization parameters (QP).
  8248. The filter accepts the following option:
  8249. @table @option
  8250. @item qp
  8251. Set expression for quantization parameter.
  8252. @end table
  8253. The expression is evaluated through the eval API and can contain, among others,
  8254. the following constants:
  8255. @table @var
  8256. @item known
  8257. 1 if index is not 129, 0 otherwise.
  8258. @item qp
  8259. Sequentional index starting from -129 to 128.
  8260. @end table
  8261. @subsection Examples
  8262. @itemize
  8263. @item
  8264. Some equation like:
  8265. @example
  8266. qp=2+2*sin(PI*qp)
  8267. @end example
  8268. @end itemize
  8269. @section random
  8270. Flush video frames from internal cache of frames into a random order.
  8271. No frame is discarded.
  8272. Inspired by @ref{frei0r} nervous filter.
  8273. @table @option
  8274. @item frames
  8275. Set size in number of frames of internal cache, in range from @code{2} to
  8276. @code{512}. Default is @code{30}.
  8277. @item seed
  8278. Set seed for random number generator, must be an integer included between
  8279. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8280. less than @code{0}, the filter will try to use a good random seed on a
  8281. best effort basis.
  8282. @end table
  8283. @section readvitc
  8284. Read vertical interval timecode (VITC) information from the top lines of a
  8285. video frame.
  8286. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8287. timecode value, if a valid timecode has been detected. Further metadata key
  8288. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8289. timecode data has been found or not.
  8290. This filter accepts the following options:
  8291. @table @option
  8292. @item scan_max
  8293. Set the maximum number of lines to scan for VITC data. If the value is set to
  8294. @code{-1} the full video frame is scanned. Default is @code{45}.
  8295. @item thr_b
  8296. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8297. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8298. @item thr_w
  8299. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8300. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8301. @end table
  8302. @subsection Examples
  8303. @itemize
  8304. @item
  8305. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8306. draw @code{--:--:--:--} as a placeholder:
  8307. @example
  8308. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8309. @end example
  8310. @end itemize
  8311. @section remap
  8312. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8313. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8314. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8315. value for pixel will be used for destination pixel.
  8316. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8317. will have Xmap/Ymap video stream dimensions.
  8318. Xmap and Ymap input video streams are 16bit depth, single channel.
  8319. @section removegrain
  8320. The removegrain filter is a spatial denoiser for progressive video.
  8321. @table @option
  8322. @item m0
  8323. Set mode for the first plane.
  8324. @item m1
  8325. Set mode for the second plane.
  8326. @item m2
  8327. Set mode for the third plane.
  8328. @item m3
  8329. Set mode for the fourth plane.
  8330. @end table
  8331. Range of mode is from 0 to 24. Description of each mode follows:
  8332. @table @var
  8333. @item 0
  8334. Leave input plane unchanged. Default.
  8335. @item 1
  8336. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8337. @item 2
  8338. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8339. @item 3
  8340. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8341. @item 4
  8342. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8343. This is equivalent to a median filter.
  8344. @item 5
  8345. Line-sensitive clipping giving the minimal change.
  8346. @item 6
  8347. Line-sensitive clipping, intermediate.
  8348. @item 7
  8349. Line-sensitive clipping, intermediate.
  8350. @item 8
  8351. Line-sensitive clipping, intermediate.
  8352. @item 9
  8353. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8354. @item 10
  8355. Replaces the target pixel with the closest neighbour.
  8356. @item 11
  8357. [1 2 1] horizontal and vertical kernel blur.
  8358. @item 12
  8359. Same as mode 11.
  8360. @item 13
  8361. Bob mode, interpolates top field from the line where the neighbours
  8362. pixels are the closest.
  8363. @item 14
  8364. Bob mode, interpolates bottom field from the line where the neighbours
  8365. pixels are the closest.
  8366. @item 15
  8367. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8368. interpolation formula.
  8369. @item 16
  8370. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8371. interpolation formula.
  8372. @item 17
  8373. Clips the pixel with the minimum and maximum of respectively the maximum and
  8374. minimum of each pair of opposite neighbour pixels.
  8375. @item 18
  8376. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8377. the current pixel is minimal.
  8378. @item 19
  8379. Replaces the pixel with the average of its 8 neighbours.
  8380. @item 20
  8381. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8382. @item 21
  8383. Clips pixels using the averages of opposite neighbour.
  8384. @item 22
  8385. Same as mode 21 but simpler and faster.
  8386. @item 23
  8387. Small edge and halo removal, but reputed useless.
  8388. @item 24
  8389. Similar as 23.
  8390. @end table
  8391. @section removelogo
  8392. Suppress a TV station logo, using an image file to determine which
  8393. pixels comprise the logo. It works by filling in the pixels that
  8394. comprise the logo with neighboring pixels.
  8395. The filter accepts the following options:
  8396. @table @option
  8397. @item filename, f
  8398. Set the filter bitmap file, which can be any image format supported by
  8399. libavformat. The width and height of the image file must match those of the
  8400. video stream being processed.
  8401. @end table
  8402. Pixels in the provided bitmap image with a value of zero are not
  8403. considered part of the logo, non-zero pixels are considered part of
  8404. the logo. If you use white (255) for the logo and black (0) for the
  8405. rest, you will be safe. For making the filter bitmap, it is
  8406. recommended to take a screen capture of a black frame with the logo
  8407. visible, and then using a threshold filter followed by the erode
  8408. filter once or twice.
  8409. If needed, little splotches can be fixed manually. Remember that if
  8410. logo pixels are not covered, the filter quality will be much
  8411. reduced. Marking too many pixels as part of the logo does not hurt as
  8412. much, but it will increase the amount of blurring needed to cover over
  8413. the image and will destroy more information than necessary, and extra
  8414. pixels will slow things down on a large logo.
  8415. @section repeatfields
  8416. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8417. fields based on its value.
  8418. @section reverse
  8419. Reverse a video clip.
  8420. Warning: This filter requires memory to buffer the entire clip, so trimming
  8421. is suggested.
  8422. @subsection Examples
  8423. @itemize
  8424. @item
  8425. Take the first 5 seconds of a clip, and reverse it.
  8426. @example
  8427. trim=end=5,reverse
  8428. @end example
  8429. @end itemize
  8430. @section rotate
  8431. Rotate video by an arbitrary angle expressed in radians.
  8432. The filter accepts the following options:
  8433. A description of the optional parameters follows.
  8434. @table @option
  8435. @item angle, a
  8436. Set an expression for the angle by which to rotate the input video
  8437. clockwise, expressed as a number of radians. A negative value will
  8438. result in a counter-clockwise rotation. By default it is set to "0".
  8439. This expression is evaluated for each frame.
  8440. @item out_w, ow
  8441. Set the output width expression, default value is "iw".
  8442. This expression is evaluated just once during configuration.
  8443. @item out_h, oh
  8444. Set the output height expression, default value is "ih".
  8445. This expression is evaluated just once during configuration.
  8446. @item bilinear
  8447. Enable bilinear interpolation if set to 1, a value of 0 disables
  8448. it. Default value is 1.
  8449. @item fillcolor, c
  8450. Set the color used to fill the output area not covered by the rotated
  8451. image. For the general syntax of this option, check the "Color" section in the
  8452. ffmpeg-utils manual. If the special value "none" is selected then no
  8453. background is printed (useful for example if the background is never shown).
  8454. Default value is "black".
  8455. @end table
  8456. The expressions for the angle and the output size can contain the
  8457. following constants and functions:
  8458. @table @option
  8459. @item n
  8460. sequential number of the input frame, starting from 0. It is always NAN
  8461. before the first frame is filtered.
  8462. @item t
  8463. time in seconds of the input frame, it is set to 0 when the filter is
  8464. configured. It is always NAN before the first frame is filtered.
  8465. @item hsub
  8466. @item vsub
  8467. horizontal and vertical chroma subsample values. For example for the
  8468. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8469. @item in_w, iw
  8470. @item in_h, ih
  8471. the input video width and height
  8472. @item out_w, ow
  8473. @item out_h, oh
  8474. the output width and height, that is the size of the padded area as
  8475. specified by the @var{width} and @var{height} expressions
  8476. @item rotw(a)
  8477. @item roth(a)
  8478. the minimal width/height required for completely containing the input
  8479. video rotated by @var{a} radians.
  8480. These are only available when computing the @option{out_w} and
  8481. @option{out_h} expressions.
  8482. @end table
  8483. @subsection Examples
  8484. @itemize
  8485. @item
  8486. Rotate the input by PI/6 radians clockwise:
  8487. @example
  8488. rotate=PI/6
  8489. @end example
  8490. @item
  8491. Rotate the input by PI/6 radians counter-clockwise:
  8492. @example
  8493. rotate=-PI/6
  8494. @end example
  8495. @item
  8496. Rotate the input by 45 degrees clockwise:
  8497. @example
  8498. rotate=45*PI/180
  8499. @end example
  8500. @item
  8501. Apply a constant rotation with period T, starting from an angle of PI/3:
  8502. @example
  8503. rotate=PI/3+2*PI*t/T
  8504. @end example
  8505. @item
  8506. Make the input video rotation oscillating with a period of T
  8507. seconds and an amplitude of A radians:
  8508. @example
  8509. rotate=A*sin(2*PI/T*t)
  8510. @end example
  8511. @item
  8512. Rotate the video, output size is chosen so that the whole rotating
  8513. input video is always completely contained in the output:
  8514. @example
  8515. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8516. @end example
  8517. @item
  8518. Rotate the video, reduce the output size so that no background is ever
  8519. shown:
  8520. @example
  8521. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8522. @end example
  8523. @end itemize
  8524. @subsection Commands
  8525. The filter supports the following commands:
  8526. @table @option
  8527. @item a, angle
  8528. Set the angle expression.
  8529. The command accepts the same syntax of the corresponding option.
  8530. If the specified expression is not valid, it is kept at its current
  8531. value.
  8532. @end table
  8533. @section sab
  8534. Apply Shape Adaptive Blur.
  8535. The filter accepts the following options:
  8536. @table @option
  8537. @item luma_radius, lr
  8538. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8539. value is 1.0. A greater value will result in a more blurred image, and
  8540. in slower processing.
  8541. @item luma_pre_filter_radius, lpfr
  8542. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8543. value is 1.0.
  8544. @item luma_strength, ls
  8545. Set luma maximum difference between pixels to still be considered, must
  8546. be a value in the 0.1-100.0 range, default value is 1.0.
  8547. @item chroma_radius, cr
  8548. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8549. greater value will result in a more blurred image, and in slower
  8550. processing.
  8551. @item chroma_pre_filter_radius, cpfr
  8552. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  8553. @item chroma_strength, cs
  8554. Set chroma maximum difference between pixels to still be considered,
  8555. must be a value in the -0.9-100.0 range.
  8556. @end table
  8557. Each chroma option value, if not explicitly specified, is set to the
  8558. corresponding luma option value.
  8559. @anchor{scale}
  8560. @section scale
  8561. Scale (resize) the input video, using the libswscale library.
  8562. The scale filter forces the output display aspect ratio to be the same
  8563. of the input, by changing the output sample aspect ratio.
  8564. If the input image format is different from the format requested by
  8565. the next filter, the scale filter will convert the input to the
  8566. requested format.
  8567. @subsection Options
  8568. The filter accepts the following options, or any of the options
  8569. supported by the libswscale scaler.
  8570. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8571. the complete list of scaler options.
  8572. @table @option
  8573. @item width, w
  8574. @item height, h
  8575. Set the output video dimension expression. Default value is the input
  8576. dimension.
  8577. If the value is 0, the input width is used for the output.
  8578. If one of the values is -1, the scale filter will use a value that
  8579. maintains the aspect ratio of the input image, calculated from the
  8580. other specified dimension. If both of them are -1, the input size is
  8581. used
  8582. If one of the values is -n with n > 1, the scale filter will also use a value
  8583. that maintains the aspect ratio of the input image, calculated from the other
  8584. specified dimension. After that it will, however, make sure that the calculated
  8585. dimension is divisible by n and adjust the value if necessary.
  8586. See below for the list of accepted constants for use in the dimension
  8587. expression.
  8588. @item eval
  8589. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8590. @table @samp
  8591. @item init
  8592. Only evaluate expressions once during the filter initialization or when a command is processed.
  8593. @item frame
  8594. Evaluate expressions for each incoming frame.
  8595. @end table
  8596. Default value is @samp{init}.
  8597. @item interl
  8598. Set the interlacing mode. It accepts the following values:
  8599. @table @samp
  8600. @item 1
  8601. Force interlaced aware scaling.
  8602. @item 0
  8603. Do not apply interlaced scaling.
  8604. @item -1
  8605. Select interlaced aware scaling depending on whether the source frames
  8606. are flagged as interlaced or not.
  8607. @end table
  8608. Default value is @samp{0}.
  8609. @item flags
  8610. Set libswscale scaling flags. See
  8611. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8612. complete list of values. If not explicitly specified the filter applies
  8613. the default flags.
  8614. @item param0, param1
  8615. Set libswscale input parameters for scaling algorithms that need them. See
  8616. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8617. complete documentation. If not explicitly specified the filter applies
  8618. empty parameters.
  8619. @item size, s
  8620. Set the video size. For the syntax of this option, check the
  8621. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8622. @item in_color_matrix
  8623. @item out_color_matrix
  8624. Set in/output YCbCr color space type.
  8625. This allows the autodetected value to be overridden as well as allows forcing
  8626. a specific value used for the output and encoder.
  8627. If not specified, the color space type depends on the pixel format.
  8628. Possible values:
  8629. @table @samp
  8630. @item auto
  8631. Choose automatically.
  8632. @item bt709
  8633. Format conforming to International Telecommunication Union (ITU)
  8634. Recommendation BT.709.
  8635. @item fcc
  8636. Set color space conforming to the United States Federal Communications
  8637. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8638. @item bt601
  8639. Set color space conforming to:
  8640. @itemize
  8641. @item
  8642. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8643. @item
  8644. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8645. @item
  8646. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8647. @end itemize
  8648. @item smpte240m
  8649. Set color space conforming to SMPTE ST 240:1999.
  8650. @end table
  8651. @item in_range
  8652. @item out_range
  8653. Set in/output YCbCr sample range.
  8654. This allows the autodetected value to be overridden as well as allows forcing
  8655. a specific value used for the output and encoder. If not specified, the
  8656. range depends on the pixel format. Possible values:
  8657. @table @samp
  8658. @item auto
  8659. Choose automatically.
  8660. @item jpeg/full/pc
  8661. Set full range (0-255 in case of 8-bit luma).
  8662. @item mpeg/tv
  8663. Set "MPEG" range (16-235 in case of 8-bit luma).
  8664. @end table
  8665. @item force_original_aspect_ratio
  8666. Enable decreasing or increasing output video width or height if necessary to
  8667. keep the original aspect ratio. Possible values:
  8668. @table @samp
  8669. @item disable
  8670. Scale the video as specified and disable this feature.
  8671. @item decrease
  8672. The output video dimensions will automatically be decreased if needed.
  8673. @item increase
  8674. The output video dimensions will automatically be increased if needed.
  8675. @end table
  8676. One useful instance of this option is that when you know a specific device's
  8677. maximum allowed resolution, you can use this to limit the output video to
  8678. that, while retaining the aspect ratio. For example, device A allows
  8679. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8680. decrease) and specifying 1280x720 to the command line makes the output
  8681. 1280x533.
  8682. Please note that this is a different thing than specifying -1 for @option{w}
  8683. or @option{h}, you still need to specify the output resolution for this option
  8684. to work.
  8685. @end table
  8686. The values of the @option{w} and @option{h} options are expressions
  8687. containing the following constants:
  8688. @table @var
  8689. @item in_w
  8690. @item in_h
  8691. The input width and height
  8692. @item iw
  8693. @item ih
  8694. These are the same as @var{in_w} and @var{in_h}.
  8695. @item out_w
  8696. @item out_h
  8697. The output (scaled) width and height
  8698. @item ow
  8699. @item oh
  8700. These are the same as @var{out_w} and @var{out_h}
  8701. @item a
  8702. The same as @var{iw} / @var{ih}
  8703. @item sar
  8704. input sample aspect ratio
  8705. @item dar
  8706. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8707. @item hsub
  8708. @item vsub
  8709. horizontal and vertical input chroma subsample values. For example for the
  8710. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8711. @item ohsub
  8712. @item ovsub
  8713. horizontal and vertical output chroma subsample values. For example for the
  8714. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8715. @end table
  8716. @subsection Examples
  8717. @itemize
  8718. @item
  8719. Scale the input video to a size of 200x100
  8720. @example
  8721. scale=w=200:h=100
  8722. @end example
  8723. This is equivalent to:
  8724. @example
  8725. scale=200:100
  8726. @end example
  8727. or:
  8728. @example
  8729. scale=200x100
  8730. @end example
  8731. @item
  8732. Specify a size abbreviation for the output size:
  8733. @example
  8734. scale=qcif
  8735. @end example
  8736. which can also be written as:
  8737. @example
  8738. scale=size=qcif
  8739. @end example
  8740. @item
  8741. Scale the input to 2x:
  8742. @example
  8743. scale=w=2*iw:h=2*ih
  8744. @end example
  8745. @item
  8746. The above is the same as:
  8747. @example
  8748. scale=2*in_w:2*in_h
  8749. @end example
  8750. @item
  8751. Scale the input to 2x with forced interlaced scaling:
  8752. @example
  8753. scale=2*iw:2*ih:interl=1
  8754. @end example
  8755. @item
  8756. Scale the input to half size:
  8757. @example
  8758. scale=w=iw/2:h=ih/2
  8759. @end example
  8760. @item
  8761. Increase the width, and set the height to the same size:
  8762. @example
  8763. scale=3/2*iw:ow
  8764. @end example
  8765. @item
  8766. Seek Greek harmony:
  8767. @example
  8768. scale=iw:1/PHI*iw
  8769. scale=ih*PHI:ih
  8770. @end example
  8771. @item
  8772. Increase the height, and set the width to 3/2 of the height:
  8773. @example
  8774. scale=w=3/2*oh:h=3/5*ih
  8775. @end example
  8776. @item
  8777. Increase the size, making the size a multiple of the chroma
  8778. subsample values:
  8779. @example
  8780. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8781. @end example
  8782. @item
  8783. Increase the width to a maximum of 500 pixels,
  8784. keeping the same aspect ratio as the input:
  8785. @example
  8786. scale=w='min(500\, iw*3/2):h=-1'
  8787. @end example
  8788. @end itemize
  8789. @subsection Commands
  8790. This filter supports the following commands:
  8791. @table @option
  8792. @item width, w
  8793. @item height, h
  8794. Set the output video dimension expression.
  8795. The command accepts the same syntax of the corresponding option.
  8796. If the specified expression is not valid, it is kept at its current
  8797. value.
  8798. @end table
  8799. @section scale_npp
  8800. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  8801. format conversion on CUDA video frames. Setting the output width and height
  8802. works in the same way as for the @var{scale} filter.
  8803. The following additional options are accepted:
  8804. @table @option
  8805. @item format
  8806. The pixel format of the output CUDA frames. If set to the string "same" (the
  8807. default), the input format will be kept. Note that automatic format negotiation
  8808. and conversion is not yet supported for hardware frames
  8809. @item interp_algo
  8810. The interpolation algorithm used for resizing. One of the following:
  8811. @table @option
  8812. @item nn
  8813. Nearest neighbour.
  8814. @item linear
  8815. @item cubic
  8816. @item cubic2p_bspline
  8817. 2-parameter cubic (B=1, C=0)
  8818. @item cubic2p_catmullrom
  8819. 2-parameter cubic (B=0, C=1/2)
  8820. @item cubic2p_b05c03
  8821. 2-parameter cubic (B=1/2, C=3/10)
  8822. @item super
  8823. Supersampling
  8824. @item lanczos
  8825. @end table
  8826. @end table
  8827. @section scale2ref
  8828. Scale (resize) the input video, based on a reference video.
  8829. See the scale filter for available options, scale2ref supports the same but
  8830. uses the reference video instead of the main input as basis.
  8831. @subsection Examples
  8832. @itemize
  8833. @item
  8834. Scale a subtitle stream to match the main video in size before overlaying
  8835. @example
  8836. 'scale2ref[b][a];[a][b]overlay'
  8837. @end example
  8838. @end itemize
  8839. @anchor{selectivecolor}
  8840. @section selectivecolor
  8841. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8842. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8843. by the "purity" of the color (that is, how saturated it already is).
  8844. This filter is similar to the Adobe Photoshop Selective Color tool.
  8845. The filter accepts the following options:
  8846. @table @option
  8847. @item correction_method
  8848. Select color correction method.
  8849. Available values are:
  8850. @table @samp
  8851. @item absolute
  8852. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8853. component value).
  8854. @item relative
  8855. Specified adjustments are relative to the original component value.
  8856. @end table
  8857. Default is @code{absolute}.
  8858. @item reds
  8859. Adjustments for red pixels (pixels where the red component is the maximum)
  8860. @item yellows
  8861. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8862. @item greens
  8863. Adjustments for green pixels (pixels where the green component is the maximum)
  8864. @item cyans
  8865. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8866. @item blues
  8867. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8868. @item magentas
  8869. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8870. @item whites
  8871. Adjustments for white pixels (pixels where all components are greater than 128)
  8872. @item neutrals
  8873. Adjustments for all pixels except pure black and pure white
  8874. @item blacks
  8875. Adjustments for black pixels (pixels where all components are lesser than 128)
  8876. @item psfile
  8877. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8878. @end table
  8879. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8880. 4 space separated floating point adjustment values in the [-1,1] range,
  8881. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8882. pixels of its range.
  8883. @subsection Examples
  8884. @itemize
  8885. @item
  8886. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8887. increase magenta by 27% in blue areas:
  8888. @example
  8889. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8890. @end example
  8891. @item
  8892. Use a Photoshop selective color preset:
  8893. @example
  8894. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8895. @end example
  8896. @end itemize
  8897. @section separatefields
  8898. The @code{separatefields} takes a frame-based video input and splits
  8899. each frame into its components fields, producing a new half height clip
  8900. with twice the frame rate and twice the frame count.
  8901. This filter use field-dominance information in frame to decide which
  8902. of each pair of fields to place first in the output.
  8903. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8904. @section setdar, setsar
  8905. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8906. output video.
  8907. This is done by changing the specified Sample (aka Pixel) Aspect
  8908. Ratio, according to the following equation:
  8909. @example
  8910. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8911. @end example
  8912. Keep in mind that the @code{setdar} filter does not modify the pixel
  8913. dimensions of the video frame. Also, the display aspect ratio set by
  8914. this filter may be changed by later filters in the filterchain,
  8915. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8916. applied.
  8917. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8918. the filter output video.
  8919. Note that as a consequence of the application of this filter, the
  8920. output display aspect ratio will change according to the equation
  8921. above.
  8922. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8923. filter may be changed by later filters in the filterchain, e.g. if
  8924. another "setsar" or a "setdar" filter is applied.
  8925. It accepts the following parameters:
  8926. @table @option
  8927. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8928. Set the aspect ratio used by the filter.
  8929. The parameter can be a floating point number string, an expression, or
  8930. a string of the form @var{num}:@var{den}, where @var{num} and
  8931. @var{den} are the numerator and denominator of the aspect ratio. If
  8932. the parameter is not specified, it is assumed the value "0".
  8933. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8934. should be escaped.
  8935. @item max
  8936. Set the maximum integer value to use for expressing numerator and
  8937. denominator when reducing the expressed aspect ratio to a rational.
  8938. Default value is @code{100}.
  8939. @end table
  8940. The parameter @var{sar} is an expression containing
  8941. the following constants:
  8942. @table @option
  8943. @item E, PI, PHI
  8944. These are approximated values for the mathematical constants e
  8945. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8946. @item w, h
  8947. The input width and height.
  8948. @item a
  8949. These are the same as @var{w} / @var{h}.
  8950. @item sar
  8951. The input sample aspect ratio.
  8952. @item dar
  8953. The input display aspect ratio. It is the same as
  8954. (@var{w} / @var{h}) * @var{sar}.
  8955. @item hsub, vsub
  8956. Horizontal and vertical chroma subsample values. For example, for the
  8957. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8958. @end table
  8959. @subsection Examples
  8960. @itemize
  8961. @item
  8962. To change the display aspect ratio to 16:9, specify one of the following:
  8963. @example
  8964. setdar=dar=1.77777
  8965. setdar=dar=16/9
  8966. @end example
  8967. @item
  8968. To change the sample aspect ratio to 10:11, specify:
  8969. @example
  8970. setsar=sar=10/11
  8971. @end example
  8972. @item
  8973. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8974. 1000 in the aspect ratio reduction, use the command:
  8975. @example
  8976. setdar=ratio=16/9:max=1000
  8977. @end example
  8978. @end itemize
  8979. @anchor{setfield}
  8980. @section setfield
  8981. Force field for the output video frame.
  8982. The @code{setfield} filter marks the interlace type field for the
  8983. output frames. It does not change the input frame, but only sets the
  8984. corresponding property, which affects how the frame is treated by
  8985. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8986. The filter accepts the following options:
  8987. @table @option
  8988. @item mode
  8989. Available values are:
  8990. @table @samp
  8991. @item auto
  8992. Keep the same field property.
  8993. @item bff
  8994. Mark the frame as bottom-field-first.
  8995. @item tff
  8996. Mark the frame as top-field-first.
  8997. @item prog
  8998. Mark the frame as progressive.
  8999. @end table
  9000. @end table
  9001. @section showinfo
  9002. Show a line containing various information for each input video frame.
  9003. The input video is not modified.
  9004. The shown line contains a sequence of key/value pairs of the form
  9005. @var{key}:@var{value}.
  9006. The following values are shown in the output:
  9007. @table @option
  9008. @item n
  9009. The (sequential) number of the input frame, starting from 0.
  9010. @item pts
  9011. The Presentation TimeStamp of the input frame, expressed as a number of
  9012. time base units. The time base unit depends on the filter input pad.
  9013. @item pts_time
  9014. The Presentation TimeStamp of the input frame, expressed as a number of
  9015. seconds.
  9016. @item pos
  9017. The position of the frame in the input stream, or -1 if this information is
  9018. unavailable and/or meaningless (for example in case of synthetic video).
  9019. @item fmt
  9020. The pixel format name.
  9021. @item sar
  9022. The sample aspect ratio of the input frame, expressed in the form
  9023. @var{num}/@var{den}.
  9024. @item s
  9025. The size of the input frame. For the syntax of this option, check the
  9026. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9027. @item i
  9028. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9029. for bottom field first).
  9030. @item iskey
  9031. This is 1 if the frame is a key frame, 0 otherwise.
  9032. @item type
  9033. The picture type of the input frame ("I" for an I-frame, "P" for a
  9034. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9035. Also refer to the documentation of the @code{AVPictureType} enum and of
  9036. the @code{av_get_picture_type_char} function defined in
  9037. @file{libavutil/avutil.h}.
  9038. @item checksum
  9039. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9040. @item plane_checksum
  9041. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9042. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9043. @end table
  9044. @section showpalette
  9045. Displays the 256 colors palette of each frame. This filter is only relevant for
  9046. @var{pal8} pixel format frames.
  9047. It accepts the following option:
  9048. @table @option
  9049. @item s
  9050. Set the size of the box used to represent one palette color entry. Default is
  9051. @code{30} (for a @code{30x30} pixel box).
  9052. @end table
  9053. @section shuffleframes
  9054. Reorder and/or duplicate video frames.
  9055. It accepts the following parameters:
  9056. @table @option
  9057. @item mapping
  9058. Set the destination indexes of input frames.
  9059. This is space or '|' separated list of indexes that maps input frames to output
  9060. frames. Number of indexes also sets maximal value that each index may have.
  9061. @end table
  9062. The first frame has the index 0. The default is to keep the input unchanged.
  9063. Swap second and third frame of every three frames of the input:
  9064. @example
  9065. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9066. @end example
  9067. @section shuffleplanes
  9068. Reorder and/or duplicate video planes.
  9069. It accepts the following parameters:
  9070. @table @option
  9071. @item map0
  9072. The index of the input plane to be used as the first output plane.
  9073. @item map1
  9074. The index of the input plane to be used as the second output plane.
  9075. @item map2
  9076. The index of the input plane to be used as the third output plane.
  9077. @item map3
  9078. The index of the input plane to be used as the fourth output plane.
  9079. @end table
  9080. The first plane has the index 0. The default is to keep the input unchanged.
  9081. Swap the second and third planes of the input:
  9082. @example
  9083. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9084. @end example
  9085. @anchor{signalstats}
  9086. @section signalstats
  9087. Evaluate various visual metrics that assist in determining issues associated
  9088. with the digitization of analog video media.
  9089. By default the filter will log these metadata values:
  9090. @table @option
  9091. @item YMIN
  9092. Display the minimal Y value contained within the input frame. Expressed in
  9093. range of [0-255].
  9094. @item YLOW
  9095. Display the Y value at the 10% percentile within the input frame. Expressed in
  9096. range of [0-255].
  9097. @item YAVG
  9098. Display the average Y value within the input frame. Expressed in range of
  9099. [0-255].
  9100. @item YHIGH
  9101. Display the Y value at the 90% percentile within the input frame. Expressed in
  9102. range of [0-255].
  9103. @item YMAX
  9104. Display the maximum Y value contained within the input frame. Expressed in
  9105. range of [0-255].
  9106. @item UMIN
  9107. Display the minimal U value contained within the input frame. Expressed in
  9108. range of [0-255].
  9109. @item ULOW
  9110. Display the U value at the 10% percentile within the input frame. Expressed in
  9111. range of [0-255].
  9112. @item UAVG
  9113. Display the average U value within the input frame. Expressed in range of
  9114. [0-255].
  9115. @item UHIGH
  9116. Display the U value at the 90% percentile within the input frame. Expressed in
  9117. range of [0-255].
  9118. @item UMAX
  9119. Display the maximum U value contained within the input frame. Expressed in
  9120. range of [0-255].
  9121. @item VMIN
  9122. Display the minimal V value contained within the input frame. Expressed in
  9123. range of [0-255].
  9124. @item VLOW
  9125. Display the V value at the 10% percentile within the input frame. Expressed in
  9126. range of [0-255].
  9127. @item VAVG
  9128. Display the average V value within the input frame. Expressed in range of
  9129. [0-255].
  9130. @item VHIGH
  9131. Display the V value at the 90% percentile within the input frame. Expressed in
  9132. range of [0-255].
  9133. @item VMAX
  9134. Display the maximum V value contained within the input frame. Expressed in
  9135. range of [0-255].
  9136. @item SATMIN
  9137. Display the minimal saturation value contained within the input frame.
  9138. Expressed in range of [0-~181.02].
  9139. @item SATLOW
  9140. Display the saturation value at the 10% percentile within the input frame.
  9141. Expressed in range of [0-~181.02].
  9142. @item SATAVG
  9143. Display the average saturation value within the input frame. Expressed in range
  9144. of [0-~181.02].
  9145. @item SATHIGH
  9146. Display the saturation value at the 90% percentile within the input frame.
  9147. Expressed in range of [0-~181.02].
  9148. @item SATMAX
  9149. Display the maximum saturation value contained within the input frame.
  9150. Expressed in range of [0-~181.02].
  9151. @item HUEMED
  9152. Display the median value for hue within the input frame. Expressed in range of
  9153. [0-360].
  9154. @item HUEAVG
  9155. Display the average value for hue within the input frame. Expressed in range of
  9156. [0-360].
  9157. @item YDIF
  9158. Display the average of sample value difference between all values of the Y
  9159. plane in the current frame and corresponding values of the previous input frame.
  9160. Expressed in range of [0-255].
  9161. @item UDIF
  9162. Display the average of sample value difference between all values of the U
  9163. plane in the current frame and corresponding values of the previous input frame.
  9164. Expressed in range of [0-255].
  9165. @item VDIF
  9166. Display the average of sample value difference between all values of the V
  9167. plane in the current frame and corresponding values of the previous input frame.
  9168. Expressed in range of [0-255].
  9169. @item YBITDEPTH
  9170. Display bit depth of Y plane in current frame.
  9171. Expressed in range of [0-16].
  9172. @item UBITDEPTH
  9173. Display bit depth of U plane in current frame.
  9174. Expressed in range of [0-16].
  9175. @item VBITDEPTH
  9176. Display bit depth of V plane in current frame.
  9177. Expressed in range of [0-16].
  9178. @end table
  9179. The filter accepts the following options:
  9180. @table @option
  9181. @item stat
  9182. @item out
  9183. @option{stat} specify an additional form of image analysis.
  9184. @option{out} output video with the specified type of pixel highlighted.
  9185. Both options accept the following values:
  9186. @table @samp
  9187. @item tout
  9188. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9189. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9190. include the results of video dropouts, head clogs, or tape tracking issues.
  9191. @item vrep
  9192. Identify @var{vertical line repetition}. Vertical line repetition includes
  9193. similar rows of pixels within a frame. In born-digital video vertical line
  9194. repetition is common, but this pattern is uncommon in video digitized from an
  9195. analog source. When it occurs in video that results from the digitization of an
  9196. analog source it can indicate concealment from a dropout compensator.
  9197. @item brng
  9198. Identify pixels that fall outside of legal broadcast range.
  9199. @end table
  9200. @item color, c
  9201. Set the highlight color for the @option{out} option. The default color is
  9202. yellow.
  9203. @end table
  9204. @subsection Examples
  9205. @itemize
  9206. @item
  9207. Output data of various video metrics:
  9208. @example
  9209. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9210. @end example
  9211. @item
  9212. Output specific data about the minimum and maximum values of the Y plane per frame:
  9213. @example
  9214. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9215. @end example
  9216. @item
  9217. Playback video while highlighting pixels that are outside of broadcast range in red.
  9218. @example
  9219. ffplay example.mov -vf signalstats="out=brng:color=red"
  9220. @end example
  9221. @item
  9222. Playback video with signalstats metadata drawn over the frame.
  9223. @example
  9224. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9225. @end example
  9226. The contents of signalstat_drawtext.txt used in the command are:
  9227. @example
  9228. time %@{pts:hms@}
  9229. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9230. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9231. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9232. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9233. @end example
  9234. @end itemize
  9235. @anchor{smartblur}
  9236. @section smartblur
  9237. Blur the input video without impacting the outlines.
  9238. It accepts the following options:
  9239. @table @option
  9240. @item luma_radius, lr
  9241. Set the luma radius. The option value must be a float number in
  9242. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9243. used to blur the image (slower if larger). Default value is 1.0.
  9244. @item luma_strength, ls
  9245. Set the luma strength. The option value must be a float number
  9246. in the range [-1.0,1.0] that configures the blurring. A value included
  9247. in [0.0,1.0] will blur the image whereas a value included in
  9248. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9249. @item luma_threshold, lt
  9250. Set the luma threshold used as a coefficient to determine
  9251. whether a pixel should be blurred or not. The option value must be an
  9252. integer in the range [-30,30]. A value of 0 will filter all the image,
  9253. a value included in [0,30] will filter flat areas and a value included
  9254. in [-30,0] will filter edges. Default value is 0.
  9255. @item chroma_radius, cr
  9256. Set the chroma radius. The option value must be a float number in
  9257. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9258. used to blur the image (slower if larger). Default value is 1.0.
  9259. @item chroma_strength, cs
  9260. Set the chroma strength. The option value must be a float number
  9261. in the range [-1.0,1.0] that configures the blurring. A value included
  9262. in [0.0,1.0] will blur the image whereas a value included in
  9263. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9264. @item chroma_threshold, ct
  9265. Set the chroma threshold used as a coefficient to determine
  9266. whether a pixel should be blurred or not. The option value must be an
  9267. integer in the range [-30,30]. A value of 0 will filter all the image,
  9268. a value included in [0,30] will filter flat areas and a value included
  9269. in [-30,0] will filter edges. Default value is 0.
  9270. @end table
  9271. If a chroma option is not explicitly set, the corresponding luma value
  9272. is set.
  9273. @section ssim
  9274. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9275. This filter takes in input two input videos, the first input is
  9276. considered the "main" source and is passed unchanged to the
  9277. output. The second input is used as a "reference" video for computing
  9278. the SSIM.
  9279. Both video inputs must have the same resolution and pixel format for
  9280. this filter to work correctly. Also it assumes that both inputs
  9281. have the same number of frames, which are compared one by one.
  9282. The filter stores the calculated SSIM of each frame.
  9283. The description of the accepted parameters follows.
  9284. @table @option
  9285. @item stats_file, f
  9286. If specified the filter will use the named file to save the SSIM of
  9287. each individual frame. When filename equals "-" the data is sent to
  9288. standard output.
  9289. @end table
  9290. The file printed if @var{stats_file} is selected, contains a sequence of
  9291. key/value pairs of the form @var{key}:@var{value} for each compared
  9292. couple of frames.
  9293. A description of each shown parameter follows:
  9294. @table @option
  9295. @item n
  9296. sequential number of the input frame, starting from 1
  9297. @item Y, U, V, R, G, B
  9298. SSIM of the compared frames for the component specified by the suffix.
  9299. @item All
  9300. SSIM of the compared frames for the whole frame.
  9301. @item dB
  9302. Same as above but in dB representation.
  9303. @end table
  9304. For example:
  9305. @example
  9306. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9307. [main][ref] ssim="stats_file=stats.log" [out]
  9308. @end example
  9309. On this example the input file being processed is compared with the
  9310. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9311. is stored in @file{stats.log}.
  9312. Another example with both psnr and ssim at same time:
  9313. @example
  9314. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9315. @end example
  9316. @section stereo3d
  9317. Convert between different stereoscopic image formats.
  9318. The filters accept the following options:
  9319. @table @option
  9320. @item in
  9321. Set stereoscopic image format of input.
  9322. Available values for input image formats are:
  9323. @table @samp
  9324. @item sbsl
  9325. side by side parallel (left eye left, right eye right)
  9326. @item sbsr
  9327. side by side crosseye (right eye left, left eye right)
  9328. @item sbs2l
  9329. side by side parallel with half width resolution
  9330. (left eye left, right eye right)
  9331. @item sbs2r
  9332. side by side crosseye with half width resolution
  9333. (right eye left, left eye right)
  9334. @item abl
  9335. above-below (left eye above, right eye below)
  9336. @item abr
  9337. above-below (right eye above, left eye below)
  9338. @item ab2l
  9339. above-below with half height resolution
  9340. (left eye above, right eye below)
  9341. @item ab2r
  9342. above-below with half height resolution
  9343. (right eye above, left eye below)
  9344. @item al
  9345. alternating frames (left eye first, right eye second)
  9346. @item ar
  9347. alternating frames (right eye first, left eye second)
  9348. @item irl
  9349. interleaved rows (left eye has top row, right eye starts on next row)
  9350. @item irr
  9351. interleaved rows (right eye has top row, left eye starts on next row)
  9352. @item icl
  9353. interleaved columns, left eye first
  9354. @item icr
  9355. interleaved columns, right eye first
  9356. Default value is @samp{sbsl}.
  9357. @end table
  9358. @item out
  9359. Set stereoscopic image format of output.
  9360. @table @samp
  9361. @item sbsl
  9362. side by side parallel (left eye left, right eye right)
  9363. @item sbsr
  9364. side by side crosseye (right eye left, left eye right)
  9365. @item sbs2l
  9366. side by side parallel with half width resolution
  9367. (left eye left, right eye right)
  9368. @item sbs2r
  9369. side by side crosseye with half width resolution
  9370. (right eye left, left eye right)
  9371. @item abl
  9372. above-below (left eye above, right eye below)
  9373. @item abr
  9374. above-below (right eye above, left eye below)
  9375. @item ab2l
  9376. above-below with half height resolution
  9377. (left eye above, right eye below)
  9378. @item ab2r
  9379. above-below with half height resolution
  9380. (right eye above, left eye below)
  9381. @item al
  9382. alternating frames (left eye first, right eye second)
  9383. @item ar
  9384. alternating frames (right eye first, left eye second)
  9385. @item irl
  9386. interleaved rows (left eye has top row, right eye starts on next row)
  9387. @item irr
  9388. interleaved rows (right eye has top row, left eye starts on next row)
  9389. @item arbg
  9390. anaglyph red/blue gray
  9391. (red filter on left eye, blue filter on right eye)
  9392. @item argg
  9393. anaglyph red/green gray
  9394. (red filter on left eye, green filter on right eye)
  9395. @item arcg
  9396. anaglyph red/cyan gray
  9397. (red filter on left eye, cyan filter on right eye)
  9398. @item arch
  9399. anaglyph red/cyan half colored
  9400. (red filter on left eye, cyan filter on right eye)
  9401. @item arcc
  9402. anaglyph red/cyan color
  9403. (red filter on left eye, cyan filter on right eye)
  9404. @item arcd
  9405. anaglyph red/cyan color optimized with the least squares projection of dubois
  9406. (red filter on left eye, cyan filter on right eye)
  9407. @item agmg
  9408. anaglyph green/magenta gray
  9409. (green filter on left eye, magenta filter on right eye)
  9410. @item agmh
  9411. anaglyph green/magenta half colored
  9412. (green filter on left eye, magenta filter on right eye)
  9413. @item agmc
  9414. anaglyph green/magenta colored
  9415. (green filter on left eye, magenta filter on right eye)
  9416. @item agmd
  9417. anaglyph green/magenta color optimized with the least squares projection of dubois
  9418. (green filter on left eye, magenta filter on right eye)
  9419. @item aybg
  9420. anaglyph yellow/blue gray
  9421. (yellow filter on left eye, blue filter on right eye)
  9422. @item aybh
  9423. anaglyph yellow/blue half colored
  9424. (yellow filter on left eye, blue filter on right eye)
  9425. @item aybc
  9426. anaglyph yellow/blue colored
  9427. (yellow filter on left eye, blue filter on right eye)
  9428. @item aybd
  9429. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9430. (yellow filter on left eye, blue filter on right eye)
  9431. @item ml
  9432. mono output (left eye only)
  9433. @item mr
  9434. mono output (right eye only)
  9435. @item chl
  9436. checkerboard, left eye first
  9437. @item chr
  9438. checkerboard, right eye first
  9439. @item icl
  9440. interleaved columns, left eye first
  9441. @item icr
  9442. interleaved columns, right eye first
  9443. @item hdmi
  9444. HDMI frame pack
  9445. @end table
  9446. Default value is @samp{arcd}.
  9447. @end table
  9448. @subsection Examples
  9449. @itemize
  9450. @item
  9451. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9452. @example
  9453. stereo3d=sbsl:aybd
  9454. @end example
  9455. @item
  9456. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9457. @example
  9458. stereo3d=abl:sbsr
  9459. @end example
  9460. @end itemize
  9461. @section streamselect, astreamselect
  9462. Select video or audio streams.
  9463. The filter accepts the following options:
  9464. @table @option
  9465. @item inputs
  9466. Set number of inputs. Default is 2.
  9467. @item map
  9468. Set input indexes to remap to outputs.
  9469. @end table
  9470. @subsection Commands
  9471. The @code{streamselect} and @code{astreamselect} filter supports the following
  9472. commands:
  9473. @table @option
  9474. @item map
  9475. Set input indexes to remap to outputs.
  9476. @end table
  9477. @subsection Examples
  9478. @itemize
  9479. @item
  9480. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9481. @example
  9482. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9483. @end example
  9484. @item
  9485. Same as above, but for audio:
  9486. @example
  9487. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9488. @end example
  9489. @end itemize
  9490. @anchor{spp}
  9491. @section spp
  9492. Apply a simple postprocessing filter that compresses and decompresses the image
  9493. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9494. and average the results.
  9495. The filter accepts the following options:
  9496. @table @option
  9497. @item quality
  9498. Set quality. This option defines the number of levels for averaging. It accepts
  9499. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9500. effect. A value of @code{6} means the higher quality. For each increment of
  9501. that value the speed drops by a factor of approximately 2. Default value is
  9502. @code{3}.
  9503. @item qp
  9504. Force a constant quantization parameter. If not set, the filter will use the QP
  9505. from the video stream (if available).
  9506. @item mode
  9507. Set thresholding mode. Available modes are:
  9508. @table @samp
  9509. @item hard
  9510. Set hard thresholding (default).
  9511. @item soft
  9512. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9513. @end table
  9514. @item use_bframe_qp
  9515. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9516. option may cause flicker since the B-Frames have often larger QP. Default is
  9517. @code{0} (not enabled).
  9518. @end table
  9519. @anchor{subtitles}
  9520. @section subtitles
  9521. Draw subtitles on top of input video using the libass library.
  9522. To enable compilation of this filter you need to configure FFmpeg with
  9523. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9524. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9525. Alpha) subtitles format.
  9526. The filter accepts the following options:
  9527. @table @option
  9528. @item filename, f
  9529. Set the filename of the subtitle file to read. It must be specified.
  9530. @item original_size
  9531. Specify the size of the original video, the video for which the ASS file
  9532. was composed. For the syntax of this option, check the
  9533. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9534. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9535. correctly scale the fonts if the aspect ratio has been changed.
  9536. @item fontsdir
  9537. Set a directory path containing fonts that can be used by the filter.
  9538. These fonts will be used in addition to whatever the font provider uses.
  9539. @item charenc
  9540. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9541. useful if not UTF-8.
  9542. @item stream_index, si
  9543. Set subtitles stream index. @code{subtitles} filter only.
  9544. @item force_style
  9545. Override default style or script info parameters of the subtitles. It accepts a
  9546. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9547. @end table
  9548. If the first key is not specified, it is assumed that the first value
  9549. specifies the @option{filename}.
  9550. For example, to render the file @file{sub.srt} on top of the input
  9551. video, use the command:
  9552. @example
  9553. subtitles=sub.srt
  9554. @end example
  9555. which is equivalent to:
  9556. @example
  9557. subtitles=filename=sub.srt
  9558. @end example
  9559. To render the default subtitles stream from file @file{video.mkv}, use:
  9560. @example
  9561. subtitles=video.mkv
  9562. @end example
  9563. To render the second subtitles stream from that file, use:
  9564. @example
  9565. subtitles=video.mkv:si=1
  9566. @end example
  9567. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9568. @code{DejaVu Serif}, use:
  9569. @example
  9570. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9571. @end example
  9572. @section super2xsai
  9573. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9574. Interpolate) pixel art scaling algorithm.
  9575. Useful for enlarging pixel art images without reducing sharpness.
  9576. @section swaprect
  9577. Swap two rectangular objects in video.
  9578. This filter accepts the following options:
  9579. @table @option
  9580. @item w
  9581. Set object width.
  9582. @item h
  9583. Set object height.
  9584. @item x1
  9585. Set 1st rect x coordinate.
  9586. @item y1
  9587. Set 1st rect y coordinate.
  9588. @item x2
  9589. Set 2nd rect x coordinate.
  9590. @item y2
  9591. Set 2nd rect y coordinate.
  9592. All expressions are evaluated once for each frame.
  9593. @end table
  9594. The all options are expressions containing the following constants:
  9595. @table @option
  9596. @item w
  9597. @item h
  9598. The input width and height.
  9599. @item a
  9600. same as @var{w} / @var{h}
  9601. @item sar
  9602. input sample aspect ratio
  9603. @item dar
  9604. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9605. @item n
  9606. The number of the input frame, starting from 0.
  9607. @item t
  9608. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9609. @item pos
  9610. the position in the file of the input frame, NAN if unknown
  9611. @end table
  9612. @section swapuv
  9613. Swap U & V plane.
  9614. @section telecine
  9615. Apply telecine process to the video.
  9616. This filter accepts the following options:
  9617. @table @option
  9618. @item first_field
  9619. @table @samp
  9620. @item top, t
  9621. top field first
  9622. @item bottom, b
  9623. bottom field first
  9624. The default value is @code{top}.
  9625. @end table
  9626. @item pattern
  9627. A string of numbers representing the pulldown pattern you wish to apply.
  9628. The default value is @code{23}.
  9629. @end table
  9630. @example
  9631. Some typical patterns:
  9632. NTSC output (30i):
  9633. 27.5p: 32222
  9634. 24p: 23 (classic)
  9635. 24p: 2332 (preferred)
  9636. 20p: 33
  9637. 18p: 334
  9638. 16p: 3444
  9639. PAL output (25i):
  9640. 27.5p: 12222
  9641. 24p: 222222222223 ("Euro pulldown")
  9642. 16.67p: 33
  9643. 16p: 33333334
  9644. @end example
  9645. @section thumbnail
  9646. Select the most representative frame in a given sequence of consecutive frames.
  9647. The filter accepts the following options:
  9648. @table @option
  9649. @item n
  9650. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9651. will pick one of them, and then handle the next batch of @var{n} frames until
  9652. the end. Default is @code{100}.
  9653. @end table
  9654. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9655. value will result in a higher memory usage, so a high value is not recommended.
  9656. @subsection Examples
  9657. @itemize
  9658. @item
  9659. Extract one picture each 50 frames:
  9660. @example
  9661. thumbnail=50
  9662. @end example
  9663. @item
  9664. Complete example of a thumbnail creation with @command{ffmpeg}:
  9665. @example
  9666. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9667. @end example
  9668. @end itemize
  9669. @section tile
  9670. Tile several successive frames together.
  9671. The filter accepts the following options:
  9672. @table @option
  9673. @item layout
  9674. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9675. this option, check the
  9676. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9677. @item nb_frames
  9678. Set the maximum number of frames to render in the given area. It must be less
  9679. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9680. the area will be used.
  9681. @item margin
  9682. Set the outer border margin in pixels.
  9683. @item padding
  9684. Set the inner border thickness (i.e. the number of pixels between frames). For
  9685. more advanced padding options (such as having different values for the edges),
  9686. refer to the pad video filter.
  9687. @item color
  9688. Specify the color of the unused area. For the syntax of this option, check the
  9689. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9690. is "black".
  9691. @end table
  9692. @subsection Examples
  9693. @itemize
  9694. @item
  9695. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9696. @example
  9697. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9698. @end example
  9699. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9700. duplicating each output frame to accommodate the originally detected frame
  9701. rate.
  9702. @item
  9703. Display @code{5} pictures in an area of @code{3x2} frames,
  9704. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9705. mixed flat and named options:
  9706. @example
  9707. tile=3x2:nb_frames=5:padding=7:margin=2
  9708. @end example
  9709. @end itemize
  9710. @section tinterlace
  9711. Perform various types of temporal field interlacing.
  9712. Frames are counted starting from 1, so the first input frame is
  9713. considered odd.
  9714. The filter accepts the following options:
  9715. @table @option
  9716. @item mode
  9717. Specify the mode of the interlacing. This option can also be specified
  9718. as a value alone. See below for a list of values for this option.
  9719. Available values are:
  9720. @table @samp
  9721. @item merge, 0
  9722. Move odd frames into the upper field, even into the lower field,
  9723. generating a double height frame at half frame rate.
  9724. @example
  9725. ------> time
  9726. Input:
  9727. Frame 1 Frame 2 Frame 3 Frame 4
  9728. 11111 22222 33333 44444
  9729. 11111 22222 33333 44444
  9730. 11111 22222 33333 44444
  9731. 11111 22222 33333 44444
  9732. Output:
  9733. 11111 33333
  9734. 22222 44444
  9735. 11111 33333
  9736. 22222 44444
  9737. 11111 33333
  9738. 22222 44444
  9739. 11111 33333
  9740. 22222 44444
  9741. @end example
  9742. @item drop_even, 1
  9743. Only output odd frames, even frames are dropped, generating a frame with
  9744. unchanged height at half frame rate.
  9745. @example
  9746. ------> time
  9747. Input:
  9748. Frame 1 Frame 2 Frame 3 Frame 4
  9749. 11111 22222 33333 44444
  9750. 11111 22222 33333 44444
  9751. 11111 22222 33333 44444
  9752. 11111 22222 33333 44444
  9753. Output:
  9754. 11111 33333
  9755. 11111 33333
  9756. 11111 33333
  9757. 11111 33333
  9758. @end example
  9759. @item drop_odd, 2
  9760. Only output even frames, odd frames are dropped, generating a frame with
  9761. unchanged height at half frame rate.
  9762. @example
  9763. ------> time
  9764. Input:
  9765. Frame 1 Frame 2 Frame 3 Frame 4
  9766. 11111 22222 33333 44444
  9767. 11111 22222 33333 44444
  9768. 11111 22222 33333 44444
  9769. 11111 22222 33333 44444
  9770. Output:
  9771. 22222 44444
  9772. 22222 44444
  9773. 22222 44444
  9774. 22222 44444
  9775. @end example
  9776. @item pad, 3
  9777. Expand each frame to full height, but pad alternate lines with black,
  9778. generating a frame with double height at the same input frame rate.
  9779. @example
  9780. ------> time
  9781. Input:
  9782. Frame 1 Frame 2 Frame 3 Frame 4
  9783. 11111 22222 33333 44444
  9784. 11111 22222 33333 44444
  9785. 11111 22222 33333 44444
  9786. 11111 22222 33333 44444
  9787. Output:
  9788. 11111 ..... 33333 .....
  9789. ..... 22222 ..... 44444
  9790. 11111 ..... 33333 .....
  9791. ..... 22222 ..... 44444
  9792. 11111 ..... 33333 .....
  9793. ..... 22222 ..... 44444
  9794. 11111 ..... 33333 .....
  9795. ..... 22222 ..... 44444
  9796. @end example
  9797. @item interleave_top, 4
  9798. Interleave the upper field from odd frames with the lower field from
  9799. even frames, generating a frame with unchanged height at half frame rate.
  9800. @example
  9801. ------> time
  9802. Input:
  9803. Frame 1 Frame 2 Frame 3 Frame 4
  9804. 11111<- 22222 33333<- 44444
  9805. 11111 22222<- 33333 44444<-
  9806. 11111<- 22222 33333<- 44444
  9807. 11111 22222<- 33333 44444<-
  9808. Output:
  9809. 11111 33333
  9810. 22222 44444
  9811. 11111 33333
  9812. 22222 44444
  9813. @end example
  9814. @item interleave_bottom, 5
  9815. Interleave the lower field from odd frames with the upper field from
  9816. even frames, generating a frame with unchanged height at half frame rate.
  9817. @example
  9818. ------> time
  9819. Input:
  9820. Frame 1 Frame 2 Frame 3 Frame 4
  9821. 11111 22222<- 33333 44444<-
  9822. 11111<- 22222 33333<- 44444
  9823. 11111 22222<- 33333 44444<-
  9824. 11111<- 22222 33333<- 44444
  9825. Output:
  9826. 22222 44444
  9827. 11111 33333
  9828. 22222 44444
  9829. 11111 33333
  9830. @end example
  9831. @item interlacex2, 6
  9832. Double frame rate with unchanged height. Frames are inserted each
  9833. containing the second temporal field from the previous input frame and
  9834. the first temporal field from the next input frame. This mode relies on
  9835. the top_field_first flag. Useful for interlaced video displays with no
  9836. field synchronisation.
  9837. @example
  9838. ------> time
  9839. Input:
  9840. Frame 1 Frame 2 Frame 3 Frame 4
  9841. 11111 22222 33333 44444
  9842. 11111 22222 33333 44444
  9843. 11111 22222 33333 44444
  9844. 11111 22222 33333 44444
  9845. Output:
  9846. 11111 22222 22222 33333 33333 44444 44444
  9847. 11111 11111 22222 22222 33333 33333 44444
  9848. 11111 22222 22222 33333 33333 44444 44444
  9849. 11111 11111 22222 22222 33333 33333 44444
  9850. @end example
  9851. @item mergex2, 7
  9852. Move odd frames into the upper field, even into the lower field,
  9853. generating a double height frame at same frame rate.
  9854. @example
  9855. ------> time
  9856. Input:
  9857. Frame 1 Frame 2 Frame 3 Frame 4
  9858. 11111 22222 33333 44444
  9859. 11111 22222 33333 44444
  9860. 11111 22222 33333 44444
  9861. 11111 22222 33333 44444
  9862. Output:
  9863. 11111 33333 33333 55555
  9864. 22222 22222 44444 44444
  9865. 11111 33333 33333 55555
  9866. 22222 22222 44444 44444
  9867. 11111 33333 33333 55555
  9868. 22222 22222 44444 44444
  9869. 11111 33333 33333 55555
  9870. 22222 22222 44444 44444
  9871. @end example
  9872. @end table
  9873. Numeric values are deprecated but are accepted for backward
  9874. compatibility reasons.
  9875. Default mode is @code{merge}.
  9876. @item flags
  9877. Specify flags influencing the filter process.
  9878. Available value for @var{flags} is:
  9879. @table @option
  9880. @item low_pass_filter, vlfp
  9881. Enable vertical low-pass filtering in the filter.
  9882. Vertical low-pass filtering is required when creating an interlaced
  9883. destination from a progressive source which contains high-frequency
  9884. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9885. patterning.
  9886. Vertical low-pass filtering can only be enabled for @option{mode}
  9887. @var{interleave_top} and @var{interleave_bottom}.
  9888. @end table
  9889. @end table
  9890. @section transpose
  9891. Transpose rows with columns in the input video and optionally flip it.
  9892. It accepts the following parameters:
  9893. @table @option
  9894. @item dir
  9895. Specify the transposition direction.
  9896. Can assume the following values:
  9897. @table @samp
  9898. @item 0, 4, cclock_flip
  9899. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9900. @example
  9901. L.R L.l
  9902. . . -> . .
  9903. l.r R.r
  9904. @end example
  9905. @item 1, 5, clock
  9906. Rotate by 90 degrees clockwise, that is:
  9907. @example
  9908. L.R l.L
  9909. . . -> . .
  9910. l.r r.R
  9911. @end example
  9912. @item 2, 6, cclock
  9913. Rotate by 90 degrees counterclockwise, that is:
  9914. @example
  9915. L.R R.r
  9916. . . -> . .
  9917. l.r L.l
  9918. @end example
  9919. @item 3, 7, clock_flip
  9920. Rotate by 90 degrees clockwise and vertically flip, that is:
  9921. @example
  9922. L.R r.R
  9923. . . -> . .
  9924. l.r l.L
  9925. @end example
  9926. @end table
  9927. For values between 4-7, the transposition is only done if the input
  9928. video geometry is portrait and not landscape. These values are
  9929. deprecated, the @code{passthrough} option should be used instead.
  9930. Numerical values are deprecated, and should be dropped in favor of
  9931. symbolic constants.
  9932. @item passthrough
  9933. Do not apply the transposition if the input geometry matches the one
  9934. specified by the specified value. It accepts the following values:
  9935. @table @samp
  9936. @item none
  9937. Always apply transposition.
  9938. @item portrait
  9939. Preserve portrait geometry (when @var{height} >= @var{width}).
  9940. @item landscape
  9941. Preserve landscape geometry (when @var{width} >= @var{height}).
  9942. @end table
  9943. Default value is @code{none}.
  9944. @end table
  9945. For example to rotate by 90 degrees clockwise and preserve portrait
  9946. layout:
  9947. @example
  9948. transpose=dir=1:passthrough=portrait
  9949. @end example
  9950. The command above can also be specified as:
  9951. @example
  9952. transpose=1:portrait
  9953. @end example
  9954. @section trim
  9955. Trim the input so that the output contains one continuous subpart of the input.
  9956. It accepts the following parameters:
  9957. @table @option
  9958. @item start
  9959. Specify the time of the start of the kept section, i.e. the frame with the
  9960. timestamp @var{start} will be the first frame in the output.
  9961. @item end
  9962. Specify the time of the first frame that will be dropped, i.e. the frame
  9963. immediately preceding the one with the timestamp @var{end} will be the last
  9964. frame in the output.
  9965. @item start_pts
  9966. This is the same as @var{start}, except this option sets the start timestamp
  9967. in timebase units instead of seconds.
  9968. @item end_pts
  9969. This is the same as @var{end}, except this option sets the end timestamp
  9970. in timebase units instead of seconds.
  9971. @item duration
  9972. The maximum duration of the output in seconds.
  9973. @item start_frame
  9974. The number of the first frame that should be passed to the output.
  9975. @item end_frame
  9976. The number of the first frame that should be dropped.
  9977. @end table
  9978. @option{start}, @option{end}, and @option{duration} are expressed as time
  9979. duration specifications; see
  9980. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9981. for the accepted syntax.
  9982. Note that the first two sets of the start/end options and the @option{duration}
  9983. option look at the frame timestamp, while the _frame variants simply count the
  9984. frames that pass through the filter. Also note that this filter does not modify
  9985. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9986. setpts filter after the trim filter.
  9987. If multiple start or end options are set, this filter tries to be greedy and
  9988. keep all the frames that match at least one of the specified constraints. To keep
  9989. only the part that matches all the constraints at once, chain multiple trim
  9990. filters.
  9991. The defaults are such that all the input is kept. So it is possible to set e.g.
  9992. just the end values to keep everything before the specified time.
  9993. Examples:
  9994. @itemize
  9995. @item
  9996. Drop everything except the second minute of input:
  9997. @example
  9998. ffmpeg -i INPUT -vf trim=60:120
  9999. @end example
  10000. @item
  10001. Keep only the first second:
  10002. @example
  10003. ffmpeg -i INPUT -vf trim=duration=1
  10004. @end example
  10005. @end itemize
  10006. @anchor{unsharp}
  10007. @section unsharp
  10008. Sharpen or blur the input video.
  10009. It accepts the following parameters:
  10010. @table @option
  10011. @item luma_msize_x, lx
  10012. Set the luma matrix horizontal size. It must be an odd integer between
  10013. 3 and 63. The default value is 5.
  10014. @item luma_msize_y, ly
  10015. Set the luma matrix vertical size. It must be an odd integer between 3
  10016. and 63. The default value is 5.
  10017. @item luma_amount, la
  10018. Set the luma effect strength. It must be a floating point number, reasonable
  10019. values lay between -1.5 and 1.5.
  10020. Negative values will blur the input video, while positive values will
  10021. sharpen it, a value of zero will disable the effect.
  10022. Default value is 1.0.
  10023. @item chroma_msize_x, cx
  10024. Set the chroma matrix horizontal size. It must be an odd integer
  10025. between 3 and 63. The default value is 5.
  10026. @item chroma_msize_y, cy
  10027. Set the chroma matrix vertical size. It must be an odd integer
  10028. between 3 and 63. The default value is 5.
  10029. @item chroma_amount, ca
  10030. Set the chroma effect strength. It must be a floating point number, reasonable
  10031. values lay between -1.5 and 1.5.
  10032. Negative values will blur the input video, while positive values will
  10033. sharpen it, a value of zero will disable the effect.
  10034. Default value is 0.0.
  10035. @item opencl
  10036. If set to 1, specify using OpenCL capabilities, only available if
  10037. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10038. @end table
  10039. All parameters are optional and default to the equivalent of the
  10040. string '5:5:1.0:5:5:0.0'.
  10041. @subsection Examples
  10042. @itemize
  10043. @item
  10044. Apply strong luma sharpen effect:
  10045. @example
  10046. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10047. @end example
  10048. @item
  10049. Apply a strong blur of both luma and chroma parameters:
  10050. @example
  10051. unsharp=7:7:-2:7:7:-2
  10052. @end example
  10053. @end itemize
  10054. @section uspp
  10055. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10056. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10057. shifts and average the results.
  10058. The way this differs from the behavior of spp is that uspp actually encodes &
  10059. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10060. DCT similar to MJPEG.
  10061. The filter accepts the following options:
  10062. @table @option
  10063. @item quality
  10064. Set quality. This option defines the number of levels for averaging. It accepts
  10065. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10066. effect. A value of @code{8} means the higher quality. For each increment of
  10067. that value the speed drops by a factor of approximately 2. Default value is
  10068. @code{3}.
  10069. @item qp
  10070. Force a constant quantization parameter. If not set, the filter will use the QP
  10071. from the video stream (if available).
  10072. @end table
  10073. @section vectorscope
  10074. Display 2 color component values in the two dimensional graph (which is called
  10075. a vectorscope).
  10076. This filter accepts the following options:
  10077. @table @option
  10078. @item mode, m
  10079. Set vectorscope mode.
  10080. It accepts the following values:
  10081. @table @samp
  10082. @item gray
  10083. Gray values are displayed on graph, higher brightness means more pixels have
  10084. same component color value on location in graph. This is the default mode.
  10085. @item color
  10086. Gray values are displayed on graph. Surrounding pixels values which are not
  10087. present in video frame are drawn in gradient of 2 color components which are
  10088. set by option @code{x} and @code{y}. The 3rd color component is static.
  10089. @item color2
  10090. Actual color components values present in video frame are displayed on graph.
  10091. @item color3
  10092. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10093. on graph increases value of another color component, which is luminance by
  10094. default values of @code{x} and @code{y}.
  10095. @item color4
  10096. Actual colors present in video frame are displayed on graph. If two different
  10097. colors map to same position on graph then color with higher value of component
  10098. not present in graph is picked.
  10099. @item color5
  10100. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10101. component picked from radial gradient.
  10102. @end table
  10103. @item x
  10104. Set which color component will be represented on X-axis. Default is @code{1}.
  10105. @item y
  10106. Set which color component will be represented on Y-axis. Default is @code{2}.
  10107. @item intensity, i
  10108. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10109. of color component which represents frequency of (X, Y) location in graph.
  10110. @item envelope, e
  10111. @table @samp
  10112. @item none
  10113. No envelope, this is default.
  10114. @item instant
  10115. Instant envelope, even darkest single pixel will be clearly highlighted.
  10116. @item peak
  10117. Hold maximum and minimum values presented in graph over time. This way you
  10118. can still spot out of range values without constantly looking at vectorscope.
  10119. @item peak+instant
  10120. Peak and instant envelope combined together.
  10121. @end table
  10122. @item graticule, g
  10123. Set what kind of graticule to draw.
  10124. @table @samp
  10125. @item none
  10126. @item green
  10127. @item color
  10128. @end table
  10129. @item opacity, o
  10130. Set graticule opacity.
  10131. @item flags, f
  10132. Set graticule flags.
  10133. @table @samp
  10134. @item white
  10135. Draw graticule for white point.
  10136. @item black
  10137. Draw graticule for black point.
  10138. @item name
  10139. Draw color points short names.
  10140. @end table
  10141. @item bgopacity, b
  10142. Set background opacity.
  10143. @item lthreshold, l
  10144. Set low threshold for color component not represented on X or Y axis.
  10145. Values lower than this value will be ignored. Default is 0.
  10146. Note this value is multiplied with actual max possible value one pixel component
  10147. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10148. is 0.1 * 255 = 25.
  10149. @item hthreshold, h
  10150. Set high threshold for color component not represented on X or Y axis.
  10151. Values higher than this value will be ignored. Default is 1.
  10152. Note this value is multiplied with actual max possible value one pixel component
  10153. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10154. is 0.9 * 255 = 230.
  10155. @item colorspace, c
  10156. Set what kind of colorspace to use when drawing graticule.
  10157. @table @samp
  10158. @item auto
  10159. @item 601
  10160. @item 709
  10161. @end table
  10162. Default is auto.
  10163. @end table
  10164. @anchor{vidstabdetect}
  10165. @section vidstabdetect
  10166. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10167. @ref{vidstabtransform} for pass 2.
  10168. This filter generates a file with relative translation and rotation
  10169. transform information about subsequent frames, which is then used by
  10170. the @ref{vidstabtransform} filter.
  10171. To enable compilation of this filter you need to configure FFmpeg with
  10172. @code{--enable-libvidstab}.
  10173. This filter accepts the following options:
  10174. @table @option
  10175. @item result
  10176. Set the path to the file used to write the transforms information.
  10177. Default value is @file{transforms.trf}.
  10178. @item shakiness
  10179. Set how shaky the video is and how quick the camera is. It accepts an
  10180. integer in the range 1-10, a value of 1 means little shakiness, a
  10181. value of 10 means strong shakiness. Default value is 5.
  10182. @item accuracy
  10183. Set the accuracy of the detection process. It must be a value in the
  10184. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10185. accuracy. Default value is 15.
  10186. @item stepsize
  10187. Set stepsize of the search process. The region around minimum is
  10188. scanned with 1 pixel resolution. Default value is 6.
  10189. @item mincontrast
  10190. Set minimum contrast. Below this value a local measurement field is
  10191. discarded. Must be a floating point value in the range 0-1. Default
  10192. value is 0.3.
  10193. @item tripod
  10194. Set reference frame number for tripod mode.
  10195. If enabled, the motion of the frames is compared to a reference frame
  10196. in the filtered stream, identified by the specified number. The idea
  10197. is to compensate all movements in a more-or-less static scene and keep
  10198. the camera view absolutely still.
  10199. If set to 0, it is disabled. The frames are counted starting from 1.
  10200. @item show
  10201. Show fields and transforms in the resulting frames. It accepts an
  10202. integer in the range 0-2. Default value is 0, which disables any
  10203. visualization.
  10204. @end table
  10205. @subsection Examples
  10206. @itemize
  10207. @item
  10208. Use default values:
  10209. @example
  10210. vidstabdetect
  10211. @end example
  10212. @item
  10213. Analyze strongly shaky movie and put the results in file
  10214. @file{mytransforms.trf}:
  10215. @example
  10216. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10217. @end example
  10218. @item
  10219. Visualize the result of internal transformations in the resulting
  10220. video:
  10221. @example
  10222. vidstabdetect=show=1
  10223. @end example
  10224. @item
  10225. Analyze a video with medium shakiness using @command{ffmpeg}:
  10226. @example
  10227. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10228. @end example
  10229. @end itemize
  10230. @anchor{vidstabtransform}
  10231. @section vidstabtransform
  10232. Video stabilization/deshaking: pass 2 of 2,
  10233. see @ref{vidstabdetect} for pass 1.
  10234. Read a file with transform information for each frame and
  10235. apply/compensate them. Together with the @ref{vidstabdetect}
  10236. filter this can be used to deshake videos. See also
  10237. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10238. the @ref{unsharp} filter, see below.
  10239. To enable compilation of this filter you need to configure FFmpeg with
  10240. @code{--enable-libvidstab}.
  10241. @subsection Options
  10242. @table @option
  10243. @item input
  10244. Set path to the file used to read the transforms. Default value is
  10245. @file{transforms.trf}.
  10246. @item smoothing
  10247. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10248. camera movements. Default value is 10.
  10249. For example a number of 10 means that 21 frames are used (10 in the
  10250. past and 10 in the future) to smoothen the motion in the video. A
  10251. larger value leads to a smoother video, but limits the acceleration of
  10252. the camera (pan/tilt movements). 0 is a special case where a static
  10253. camera is simulated.
  10254. @item optalgo
  10255. Set the camera path optimization algorithm.
  10256. Accepted values are:
  10257. @table @samp
  10258. @item gauss
  10259. gaussian kernel low-pass filter on camera motion (default)
  10260. @item avg
  10261. averaging on transformations
  10262. @end table
  10263. @item maxshift
  10264. Set maximal number of pixels to translate frames. Default value is -1,
  10265. meaning no limit.
  10266. @item maxangle
  10267. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10268. value is -1, meaning no limit.
  10269. @item crop
  10270. Specify how to deal with borders that may be visible due to movement
  10271. compensation.
  10272. Available values are:
  10273. @table @samp
  10274. @item keep
  10275. keep image information from previous frame (default)
  10276. @item black
  10277. fill the border black
  10278. @end table
  10279. @item invert
  10280. Invert transforms if set to 1. Default value is 0.
  10281. @item relative
  10282. Consider transforms as relative to previous frame if set to 1,
  10283. absolute if set to 0. Default value is 0.
  10284. @item zoom
  10285. Set percentage to zoom. A positive value will result in a zoom-in
  10286. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10287. zoom).
  10288. @item optzoom
  10289. Set optimal zooming to avoid borders.
  10290. Accepted values are:
  10291. @table @samp
  10292. @item 0
  10293. disabled
  10294. @item 1
  10295. optimal static zoom value is determined (only very strong movements
  10296. will lead to visible borders) (default)
  10297. @item 2
  10298. optimal adaptive zoom value is determined (no borders will be
  10299. visible), see @option{zoomspeed}
  10300. @end table
  10301. Note that the value given at zoom is added to the one calculated here.
  10302. @item zoomspeed
  10303. Set percent to zoom maximally each frame (enabled when
  10304. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10305. 0.25.
  10306. @item interpol
  10307. Specify type of interpolation.
  10308. Available values are:
  10309. @table @samp
  10310. @item no
  10311. no interpolation
  10312. @item linear
  10313. linear only horizontal
  10314. @item bilinear
  10315. linear in both directions (default)
  10316. @item bicubic
  10317. cubic in both directions (slow)
  10318. @end table
  10319. @item tripod
  10320. Enable virtual tripod mode if set to 1, which is equivalent to
  10321. @code{relative=0:smoothing=0}. Default value is 0.
  10322. Use also @code{tripod} option of @ref{vidstabdetect}.
  10323. @item debug
  10324. Increase log verbosity if set to 1. Also the detected global motions
  10325. are written to the temporary file @file{global_motions.trf}. Default
  10326. value is 0.
  10327. @end table
  10328. @subsection Examples
  10329. @itemize
  10330. @item
  10331. Use @command{ffmpeg} for a typical stabilization with default values:
  10332. @example
  10333. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10334. @end example
  10335. Note the use of the @ref{unsharp} filter which is always recommended.
  10336. @item
  10337. Zoom in a bit more and load transform data from a given file:
  10338. @example
  10339. vidstabtransform=zoom=5:input="mytransforms.trf"
  10340. @end example
  10341. @item
  10342. Smoothen the video even more:
  10343. @example
  10344. vidstabtransform=smoothing=30
  10345. @end example
  10346. @end itemize
  10347. @section vflip
  10348. Flip the input video vertically.
  10349. For example, to vertically flip a video with @command{ffmpeg}:
  10350. @example
  10351. ffmpeg -i in.avi -vf "vflip" out.avi
  10352. @end example
  10353. @anchor{vignette}
  10354. @section vignette
  10355. Make or reverse a natural vignetting effect.
  10356. The filter accepts the following options:
  10357. @table @option
  10358. @item angle, a
  10359. Set lens angle expression as a number of radians.
  10360. The value is clipped in the @code{[0,PI/2]} range.
  10361. Default value: @code{"PI/5"}
  10362. @item x0
  10363. @item y0
  10364. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10365. by default.
  10366. @item mode
  10367. Set forward/backward mode.
  10368. Available modes are:
  10369. @table @samp
  10370. @item forward
  10371. The larger the distance from the central point, the darker the image becomes.
  10372. @item backward
  10373. The larger the distance from the central point, the brighter the image becomes.
  10374. This can be used to reverse a vignette effect, though there is no automatic
  10375. detection to extract the lens @option{angle} and other settings (yet). It can
  10376. also be used to create a burning effect.
  10377. @end table
  10378. Default value is @samp{forward}.
  10379. @item eval
  10380. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10381. It accepts the following values:
  10382. @table @samp
  10383. @item init
  10384. Evaluate expressions only once during the filter initialization.
  10385. @item frame
  10386. Evaluate expressions for each incoming frame. This is way slower than the
  10387. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10388. allows advanced dynamic expressions.
  10389. @end table
  10390. Default value is @samp{init}.
  10391. @item dither
  10392. Set dithering to reduce the circular banding effects. Default is @code{1}
  10393. (enabled).
  10394. @item aspect
  10395. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10396. Setting this value to the SAR of the input will make a rectangular vignetting
  10397. following the dimensions of the video.
  10398. Default is @code{1/1}.
  10399. @end table
  10400. @subsection Expressions
  10401. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10402. following parameters.
  10403. @table @option
  10404. @item w
  10405. @item h
  10406. input width and height
  10407. @item n
  10408. the number of input frame, starting from 0
  10409. @item pts
  10410. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10411. @var{TB} units, NAN if undefined
  10412. @item r
  10413. frame rate of the input video, NAN if the input frame rate is unknown
  10414. @item t
  10415. the PTS (Presentation TimeStamp) of the filtered video frame,
  10416. expressed in seconds, NAN if undefined
  10417. @item tb
  10418. time base of the input video
  10419. @end table
  10420. @subsection Examples
  10421. @itemize
  10422. @item
  10423. Apply simple strong vignetting effect:
  10424. @example
  10425. vignette=PI/4
  10426. @end example
  10427. @item
  10428. Make a flickering vignetting:
  10429. @example
  10430. vignette='PI/4+random(1)*PI/50':eval=frame
  10431. @end example
  10432. @end itemize
  10433. @section vstack
  10434. Stack input videos vertically.
  10435. All streams must be of same pixel format and of same width.
  10436. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10437. to create same output.
  10438. The filter accept the following option:
  10439. @table @option
  10440. @item inputs
  10441. Set number of input streams. Default is 2.
  10442. @item shortest
  10443. If set to 1, force the output to terminate when the shortest input
  10444. terminates. Default value is 0.
  10445. @end table
  10446. @section w3fdif
  10447. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10448. Deinterlacing Filter").
  10449. Based on the process described by Martin Weston for BBC R&D, and
  10450. implemented based on the de-interlace algorithm written by Jim
  10451. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10452. uses filter coefficients calculated by BBC R&D.
  10453. There are two sets of filter coefficients, so called "simple":
  10454. and "complex". Which set of filter coefficients is used can
  10455. be set by passing an optional parameter:
  10456. @table @option
  10457. @item filter
  10458. Set the interlacing filter coefficients. Accepts one of the following values:
  10459. @table @samp
  10460. @item simple
  10461. Simple filter coefficient set.
  10462. @item complex
  10463. More-complex filter coefficient set.
  10464. @end table
  10465. Default value is @samp{complex}.
  10466. @item deint
  10467. Specify which frames to deinterlace. Accept one of the following values:
  10468. @table @samp
  10469. @item all
  10470. Deinterlace all frames,
  10471. @item interlaced
  10472. Only deinterlace frames marked as interlaced.
  10473. @end table
  10474. Default value is @samp{all}.
  10475. @end table
  10476. @section waveform
  10477. Video waveform monitor.
  10478. The waveform monitor plots color component intensity. By default luminance
  10479. only. Each column of the waveform corresponds to a column of pixels in the
  10480. source video.
  10481. It accepts the following options:
  10482. @table @option
  10483. @item mode, m
  10484. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10485. In row mode, the graph on the left side represents color component value 0 and
  10486. the right side represents value = 255. In column mode, the top side represents
  10487. color component value = 0 and bottom side represents value = 255.
  10488. @item intensity, i
  10489. Set intensity. Smaller values are useful to find out how many values of the same
  10490. luminance are distributed across input rows/columns.
  10491. Default value is @code{0.04}. Allowed range is [0, 1].
  10492. @item mirror, r
  10493. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10494. In mirrored mode, higher values will be represented on the left
  10495. side for @code{row} mode and at the top for @code{column} mode. Default is
  10496. @code{1} (mirrored).
  10497. @item display, d
  10498. Set display mode.
  10499. It accepts the following values:
  10500. @table @samp
  10501. @item overlay
  10502. Presents information identical to that in the @code{parade}, except
  10503. that the graphs representing color components are superimposed directly
  10504. over one another.
  10505. This display mode makes it easier to spot relative differences or similarities
  10506. in overlapping areas of the color components that are supposed to be identical,
  10507. such as neutral whites, grays, or blacks.
  10508. @item stack
  10509. Display separate graph for the color components side by side in
  10510. @code{row} mode or one below the other in @code{column} mode.
  10511. @item parade
  10512. Display separate graph for the color components side by side in
  10513. @code{column} mode or one below the other in @code{row} mode.
  10514. Using this display mode makes it easy to spot color casts in the highlights
  10515. and shadows of an image, by comparing the contours of the top and the bottom
  10516. graphs of each waveform. Since whites, grays, and blacks are characterized
  10517. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10518. should display three waveforms of roughly equal width/height. If not, the
  10519. correction is easy to perform by making level adjustments the three waveforms.
  10520. @end table
  10521. Default is @code{stack}.
  10522. @item components, c
  10523. Set which color components to display. Default is 1, which means only luminance
  10524. or red color component if input is in RGB colorspace. If is set for example to
  10525. 7 it will display all 3 (if) available color components.
  10526. @item envelope, e
  10527. @table @samp
  10528. @item none
  10529. No envelope, this is default.
  10530. @item instant
  10531. Instant envelope, minimum and maximum values presented in graph will be easily
  10532. visible even with small @code{step} value.
  10533. @item peak
  10534. Hold minimum and maximum values presented in graph across time. This way you
  10535. can still spot out of range values without constantly looking at waveforms.
  10536. @item peak+instant
  10537. Peak and instant envelope combined together.
  10538. @end table
  10539. @item filter, f
  10540. @table @samp
  10541. @item lowpass
  10542. No filtering, this is default.
  10543. @item flat
  10544. Luma and chroma combined together.
  10545. @item aflat
  10546. Similar as above, but shows difference between blue and red chroma.
  10547. @item chroma
  10548. Displays only chroma.
  10549. @item color
  10550. Displays actual color value on waveform.
  10551. @item acolor
  10552. Similar as above, but with luma showing frequency of chroma values.
  10553. @end table
  10554. @item graticule, g
  10555. Set which graticule to display.
  10556. @table @samp
  10557. @item none
  10558. Do not display graticule.
  10559. @item green
  10560. Display green graticule showing legal broadcast ranges.
  10561. @end table
  10562. @item opacity, o
  10563. Set graticule opacity.
  10564. @item flags, fl
  10565. Set graticule flags.
  10566. @table @samp
  10567. @item numbers
  10568. Draw numbers above lines. By default enabled.
  10569. @item dots
  10570. Draw dots instead of lines.
  10571. @end table
  10572. @item scale, s
  10573. Set scale used for displaying graticule.
  10574. @table @samp
  10575. @item digital
  10576. @item millivolts
  10577. @item ire
  10578. @end table
  10579. Default is digital.
  10580. @end table
  10581. @section xbr
  10582. Apply the xBR high-quality magnification filter which is designed for pixel
  10583. art. It follows a set of edge-detection rules, see
  10584. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10585. It accepts the following option:
  10586. @table @option
  10587. @item n
  10588. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10589. @code{3xBR} and @code{4} for @code{4xBR}.
  10590. Default is @code{3}.
  10591. @end table
  10592. @anchor{yadif}
  10593. @section yadif
  10594. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10595. filter").
  10596. It accepts the following parameters:
  10597. @table @option
  10598. @item mode
  10599. The interlacing mode to adopt. It accepts one of the following values:
  10600. @table @option
  10601. @item 0, send_frame
  10602. Output one frame for each frame.
  10603. @item 1, send_field
  10604. Output one frame for each field.
  10605. @item 2, send_frame_nospatial
  10606. Like @code{send_frame}, but it skips the spatial interlacing check.
  10607. @item 3, send_field_nospatial
  10608. Like @code{send_field}, but it skips the spatial interlacing check.
  10609. @end table
  10610. The default value is @code{send_frame}.
  10611. @item parity
  10612. The picture field parity assumed for the input interlaced video. It accepts one
  10613. of the following values:
  10614. @table @option
  10615. @item 0, tff
  10616. Assume the top field is first.
  10617. @item 1, bff
  10618. Assume the bottom field is first.
  10619. @item -1, auto
  10620. Enable automatic detection of field parity.
  10621. @end table
  10622. The default value is @code{auto}.
  10623. If the interlacing is unknown or the decoder does not export this information,
  10624. top field first will be assumed.
  10625. @item deint
  10626. Specify which frames to deinterlace. Accept one of the following
  10627. values:
  10628. @table @option
  10629. @item 0, all
  10630. Deinterlace all frames.
  10631. @item 1, interlaced
  10632. Only deinterlace frames marked as interlaced.
  10633. @end table
  10634. The default value is @code{all}.
  10635. @end table
  10636. @section zoompan
  10637. Apply Zoom & Pan effect.
  10638. This filter accepts the following options:
  10639. @table @option
  10640. @item zoom, z
  10641. Set the zoom expression. Default is 1.
  10642. @item x
  10643. @item y
  10644. Set the x and y expression. Default is 0.
  10645. @item d
  10646. Set the duration expression in number of frames.
  10647. This sets for how many number of frames effect will last for
  10648. single input image.
  10649. @item s
  10650. Set the output image size, default is 'hd720'.
  10651. @item fps
  10652. Set the output frame rate, default is '25'.
  10653. @end table
  10654. Each expression can contain the following constants:
  10655. @table @option
  10656. @item in_w, iw
  10657. Input width.
  10658. @item in_h, ih
  10659. Input height.
  10660. @item out_w, ow
  10661. Output width.
  10662. @item out_h, oh
  10663. Output height.
  10664. @item in
  10665. Input frame count.
  10666. @item on
  10667. Output frame count.
  10668. @item x
  10669. @item y
  10670. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10671. for current input frame.
  10672. @item px
  10673. @item py
  10674. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10675. not yet such frame (first input frame).
  10676. @item zoom
  10677. Last calculated zoom from 'z' expression for current input frame.
  10678. @item pzoom
  10679. Last calculated zoom of last output frame of previous input frame.
  10680. @item duration
  10681. Number of output frames for current input frame. Calculated from 'd' expression
  10682. for each input frame.
  10683. @item pduration
  10684. number of output frames created for previous input frame
  10685. @item a
  10686. Rational number: input width / input height
  10687. @item sar
  10688. sample aspect ratio
  10689. @item dar
  10690. display aspect ratio
  10691. @end table
  10692. @subsection Examples
  10693. @itemize
  10694. @item
  10695. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10696. @example
  10697. 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
  10698. @end example
  10699. @item
  10700. Zoom-in up to 1.5 and pan always at center of picture:
  10701. @example
  10702. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10703. @end example
  10704. @item
  10705. Same as above but without pausing:
  10706. @example
  10707. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10708. @end example
  10709. @end itemize
  10710. @section zscale
  10711. Scale (resize) the input video, using the z.lib library:
  10712. https://github.com/sekrit-twc/zimg.
  10713. The zscale filter forces the output display aspect ratio to be the same
  10714. as the input, by changing the output sample aspect ratio.
  10715. If the input image format is different from the format requested by
  10716. the next filter, the zscale filter will convert the input to the
  10717. requested format.
  10718. @subsection Options
  10719. The filter accepts the following options.
  10720. @table @option
  10721. @item width, w
  10722. @item height, h
  10723. Set the output video dimension expression. Default value is the input
  10724. dimension.
  10725. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10726. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10727. If one of the values is -1, the zscale filter will use a value that
  10728. maintains the aspect ratio of the input image, calculated from the
  10729. other specified dimension. If both of them are -1, the input size is
  10730. used
  10731. If one of the values is -n with n > 1, the zscale filter will also use a value
  10732. that maintains the aspect ratio of the input image, calculated from the other
  10733. specified dimension. After that it will, however, make sure that the calculated
  10734. dimension is divisible by n and adjust the value if necessary.
  10735. See below for the list of accepted constants for use in the dimension
  10736. expression.
  10737. @item size, s
  10738. Set the video size. For the syntax of this option, check the
  10739. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10740. @item dither, d
  10741. Set the dither type.
  10742. Possible values are:
  10743. @table @var
  10744. @item none
  10745. @item ordered
  10746. @item random
  10747. @item error_diffusion
  10748. @end table
  10749. Default is none.
  10750. @item filter, f
  10751. Set the resize filter type.
  10752. Possible values are:
  10753. @table @var
  10754. @item point
  10755. @item bilinear
  10756. @item bicubic
  10757. @item spline16
  10758. @item spline36
  10759. @item lanczos
  10760. @end table
  10761. Default is bilinear.
  10762. @item range, r
  10763. Set the color range.
  10764. Possible values are:
  10765. @table @var
  10766. @item input
  10767. @item limited
  10768. @item full
  10769. @end table
  10770. Default is same as input.
  10771. @item primaries, p
  10772. Set the color primaries.
  10773. Possible values are:
  10774. @table @var
  10775. @item input
  10776. @item 709
  10777. @item unspecified
  10778. @item 170m
  10779. @item 240m
  10780. @item 2020
  10781. @end table
  10782. Default is same as input.
  10783. @item transfer, t
  10784. Set the transfer characteristics.
  10785. Possible values are:
  10786. @table @var
  10787. @item input
  10788. @item 709
  10789. @item unspecified
  10790. @item 601
  10791. @item linear
  10792. @item 2020_10
  10793. @item 2020_12
  10794. @end table
  10795. Default is same as input.
  10796. @item matrix, m
  10797. Set the colorspace matrix.
  10798. Possible value are:
  10799. @table @var
  10800. @item input
  10801. @item 709
  10802. @item unspecified
  10803. @item 470bg
  10804. @item 170m
  10805. @item 2020_ncl
  10806. @item 2020_cl
  10807. @end table
  10808. Default is same as input.
  10809. @item rangein, rin
  10810. Set the input color range.
  10811. Possible values are:
  10812. @table @var
  10813. @item input
  10814. @item limited
  10815. @item full
  10816. @end table
  10817. Default is same as input.
  10818. @item primariesin, pin
  10819. Set the input color primaries.
  10820. Possible values are:
  10821. @table @var
  10822. @item input
  10823. @item 709
  10824. @item unspecified
  10825. @item 170m
  10826. @item 240m
  10827. @item 2020
  10828. @end table
  10829. Default is same as input.
  10830. @item transferin, tin
  10831. Set the input transfer characteristics.
  10832. Possible values are:
  10833. @table @var
  10834. @item input
  10835. @item 709
  10836. @item unspecified
  10837. @item 601
  10838. @item linear
  10839. @item 2020_10
  10840. @item 2020_12
  10841. @end table
  10842. Default is same as input.
  10843. @item matrixin, min
  10844. Set the input colorspace matrix.
  10845. Possible value are:
  10846. @table @var
  10847. @item input
  10848. @item 709
  10849. @item unspecified
  10850. @item 470bg
  10851. @item 170m
  10852. @item 2020_ncl
  10853. @item 2020_cl
  10854. @end table
  10855. @end table
  10856. The values of the @option{w} and @option{h} options are expressions
  10857. containing the following constants:
  10858. @table @var
  10859. @item in_w
  10860. @item in_h
  10861. The input width and height
  10862. @item iw
  10863. @item ih
  10864. These are the same as @var{in_w} and @var{in_h}.
  10865. @item out_w
  10866. @item out_h
  10867. The output (scaled) width and height
  10868. @item ow
  10869. @item oh
  10870. These are the same as @var{out_w} and @var{out_h}
  10871. @item a
  10872. The same as @var{iw} / @var{ih}
  10873. @item sar
  10874. input sample aspect ratio
  10875. @item dar
  10876. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10877. @item hsub
  10878. @item vsub
  10879. horizontal and vertical input chroma subsample values. For example for the
  10880. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10881. @item ohsub
  10882. @item ovsub
  10883. horizontal and vertical output chroma subsample values. For example for the
  10884. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10885. @end table
  10886. @table @option
  10887. @end table
  10888. @c man end VIDEO FILTERS
  10889. @chapter Video Sources
  10890. @c man begin VIDEO SOURCES
  10891. Below is a description of the currently available video sources.
  10892. @section buffer
  10893. Buffer video frames, and make them available to the filter chain.
  10894. This source is mainly intended for a programmatic use, in particular
  10895. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10896. It accepts the following parameters:
  10897. @table @option
  10898. @item video_size
  10899. Specify the size (width and height) of the buffered video frames. For the
  10900. syntax of this option, check the
  10901. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10902. @item width
  10903. The input video width.
  10904. @item height
  10905. The input video height.
  10906. @item pix_fmt
  10907. A string representing the pixel format of the buffered video frames.
  10908. It may be a number corresponding to a pixel format, or a pixel format
  10909. name.
  10910. @item time_base
  10911. Specify the timebase assumed by the timestamps of the buffered frames.
  10912. @item frame_rate
  10913. Specify the frame rate expected for the video stream.
  10914. @item pixel_aspect, sar
  10915. The sample (pixel) aspect ratio of the input video.
  10916. @item sws_param
  10917. Specify the optional parameters to be used for the scale filter which
  10918. is automatically inserted when an input change is detected in the
  10919. input size or format.
  10920. @item hw_frames_ctx
  10921. When using a hardware pixel format, this should be a reference to an
  10922. AVHWFramesContext describing input frames.
  10923. @end table
  10924. For example:
  10925. @example
  10926. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10927. @end example
  10928. will instruct the source to accept video frames with size 320x240 and
  10929. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10930. square pixels (1:1 sample aspect ratio).
  10931. Since the pixel format with name "yuv410p" corresponds to the number 6
  10932. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10933. this example corresponds to:
  10934. @example
  10935. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10936. @end example
  10937. Alternatively, the options can be specified as a flat string, but this
  10938. syntax is deprecated:
  10939. @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}]
  10940. @section cellauto
  10941. Create a pattern generated by an elementary cellular automaton.
  10942. The initial state of the cellular automaton can be defined through the
  10943. @option{filename}, and @option{pattern} options. If such options are
  10944. not specified an initial state is created randomly.
  10945. At each new frame a new row in the video is filled with the result of
  10946. the cellular automaton next generation. The behavior when the whole
  10947. frame is filled is defined by the @option{scroll} option.
  10948. This source accepts the following options:
  10949. @table @option
  10950. @item filename, f
  10951. Read the initial cellular automaton state, i.e. the starting row, from
  10952. the specified file.
  10953. In the file, each non-whitespace character is considered an alive
  10954. cell, a newline will terminate the row, and further characters in the
  10955. file will be ignored.
  10956. @item pattern, p
  10957. Read the initial cellular automaton state, i.e. the starting row, from
  10958. the specified string.
  10959. Each non-whitespace character in the string is considered an alive
  10960. cell, a newline will terminate the row, and further characters in the
  10961. string will be ignored.
  10962. @item rate, r
  10963. Set the video rate, that is the number of frames generated per second.
  10964. Default is 25.
  10965. @item random_fill_ratio, ratio
  10966. Set the random fill ratio for the initial cellular automaton row. It
  10967. is a floating point number value ranging from 0 to 1, defaults to
  10968. 1/PHI.
  10969. This option is ignored when a file or a pattern is specified.
  10970. @item random_seed, seed
  10971. Set the seed for filling randomly the initial row, must be an integer
  10972. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10973. set to -1, the filter will try to use a good random seed on a best
  10974. effort basis.
  10975. @item rule
  10976. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10977. Default value is 110.
  10978. @item size, s
  10979. Set the size of the output video. For the syntax of this option, check the
  10980. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10981. If @option{filename} or @option{pattern} is specified, the size is set
  10982. by default to the width of the specified initial state row, and the
  10983. height is set to @var{width} * PHI.
  10984. If @option{size} is set, it must contain the width of the specified
  10985. pattern string, and the specified pattern will be centered in the
  10986. larger row.
  10987. If a filename or a pattern string is not specified, the size value
  10988. defaults to "320x518" (used for a randomly generated initial state).
  10989. @item scroll
  10990. If set to 1, scroll the output upward when all the rows in the output
  10991. have been already filled. If set to 0, the new generated row will be
  10992. written over the top row just after the bottom row is filled.
  10993. Defaults to 1.
  10994. @item start_full, full
  10995. If set to 1, completely fill the output with generated rows before
  10996. outputting the first frame.
  10997. This is the default behavior, for disabling set the value to 0.
  10998. @item stitch
  10999. If set to 1, stitch the left and right row edges together.
  11000. This is the default behavior, for disabling set the value to 0.
  11001. @end table
  11002. @subsection Examples
  11003. @itemize
  11004. @item
  11005. Read the initial state from @file{pattern}, and specify an output of
  11006. size 200x400.
  11007. @example
  11008. cellauto=f=pattern:s=200x400
  11009. @end example
  11010. @item
  11011. Generate a random initial row with a width of 200 cells, with a fill
  11012. ratio of 2/3:
  11013. @example
  11014. cellauto=ratio=2/3:s=200x200
  11015. @end example
  11016. @item
  11017. Create a pattern generated by rule 18 starting by a single alive cell
  11018. centered on an initial row with width 100:
  11019. @example
  11020. cellauto=p=@@:s=100x400:full=0:rule=18
  11021. @end example
  11022. @item
  11023. Specify a more elaborated initial pattern:
  11024. @example
  11025. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11026. @end example
  11027. @end itemize
  11028. @anchor{coreimagesrc}
  11029. @section coreimagesrc
  11030. Video source generated on GPU using Apple's CoreImage API on OSX.
  11031. This video source is a specialized version of the @ref{coreimage} video filter.
  11032. Use a core image generator at the beginning of the applied filterchain to
  11033. generate the content.
  11034. The coreimagesrc video source accepts the following options:
  11035. @table @option
  11036. @item list_generators
  11037. List all available generators along with all their respective options as well as
  11038. possible minimum and maximum values along with the default values.
  11039. @example
  11040. list_generators=true
  11041. @end example
  11042. @item size, s
  11043. Specify the size of the sourced video. For the syntax of this option, check the
  11044. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11045. The default value is @code{320x240}.
  11046. @item rate, r
  11047. Specify the frame rate of the sourced video, as the number of frames
  11048. generated per second. It has to be a string in the format
  11049. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11050. number or a valid video frame rate abbreviation. The default value is
  11051. "25".
  11052. @item sar
  11053. Set the sample aspect ratio of the sourced video.
  11054. @item duration, d
  11055. Set the duration of the sourced video. See
  11056. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11057. for the accepted syntax.
  11058. If not specified, or the expressed duration is negative, the video is
  11059. supposed to be generated forever.
  11060. @end table
  11061. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11062. A complete filterchain can be used for further processing of the
  11063. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11064. and examples for details.
  11065. @subsection Examples
  11066. @itemize
  11067. @item
  11068. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11069. given as complete and escaped command-line for Apple's standard bash shell:
  11070. @example
  11071. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11072. @end example
  11073. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11074. need for a nullsrc video source.
  11075. @end itemize
  11076. @section mandelbrot
  11077. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11078. point specified with @var{start_x} and @var{start_y}.
  11079. This source accepts the following options:
  11080. @table @option
  11081. @item end_pts
  11082. Set the terminal pts value. Default value is 400.
  11083. @item end_scale
  11084. Set the terminal scale value.
  11085. Must be a floating point value. Default value is 0.3.
  11086. @item inner
  11087. Set the inner coloring mode, that is the algorithm used to draw the
  11088. Mandelbrot fractal internal region.
  11089. It shall assume one of the following values:
  11090. @table @option
  11091. @item black
  11092. Set black mode.
  11093. @item convergence
  11094. Show time until convergence.
  11095. @item mincol
  11096. Set color based on point closest to the origin of the iterations.
  11097. @item period
  11098. Set period mode.
  11099. @end table
  11100. Default value is @var{mincol}.
  11101. @item bailout
  11102. Set the bailout value. Default value is 10.0.
  11103. @item maxiter
  11104. Set the maximum of iterations performed by the rendering
  11105. algorithm. Default value is 7189.
  11106. @item outer
  11107. Set outer coloring mode.
  11108. It shall assume one of following values:
  11109. @table @option
  11110. @item iteration_count
  11111. Set iteration cound mode.
  11112. @item normalized_iteration_count
  11113. set normalized iteration count mode.
  11114. @end table
  11115. Default value is @var{normalized_iteration_count}.
  11116. @item rate, r
  11117. Set frame rate, expressed as number of frames per second. Default
  11118. value is "25".
  11119. @item size, s
  11120. Set frame size. For the syntax of this option, check the "Video
  11121. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11122. @item start_scale
  11123. Set the initial scale value. Default value is 3.0.
  11124. @item start_x
  11125. Set the initial x position. Must be a floating point value between
  11126. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11127. @item start_y
  11128. Set the initial y position. Must be a floating point value between
  11129. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11130. @end table
  11131. @section mptestsrc
  11132. Generate various test patterns, as generated by the MPlayer test filter.
  11133. The size of the generated video is fixed, and is 256x256.
  11134. This source is useful in particular for testing encoding features.
  11135. This source accepts the following options:
  11136. @table @option
  11137. @item rate, r
  11138. Specify the frame rate of the sourced video, as the number of frames
  11139. generated per second. It has to be a string in the format
  11140. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11141. number or a valid video frame rate abbreviation. The default value is
  11142. "25".
  11143. @item duration, d
  11144. Set the duration of the sourced video. See
  11145. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11146. for the accepted syntax.
  11147. If not specified, or the expressed duration is negative, the video is
  11148. supposed to be generated forever.
  11149. @item test, t
  11150. Set the number or the name of the test to perform. Supported tests are:
  11151. @table @option
  11152. @item dc_luma
  11153. @item dc_chroma
  11154. @item freq_luma
  11155. @item freq_chroma
  11156. @item amp_luma
  11157. @item amp_chroma
  11158. @item cbp
  11159. @item mv
  11160. @item ring1
  11161. @item ring2
  11162. @item all
  11163. @end table
  11164. Default value is "all", which will cycle through the list of all tests.
  11165. @end table
  11166. Some examples:
  11167. @example
  11168. mptestsrc=t=dc_luma
  11169. @end example
  11170. will generate a "dc_luma" test pattern.
  11171. @section frei0r_src
  11172. Provide a frei0r source.
  11173. To enable compilation of this filter you need to install the frei0r
  11174. header and configure FFmpeg with @code{--enable-frei0r}.
  11175. This source accepts the following parameters:
  11176. @table @option
  11177. @item size
  11178. The size of the video to generate. For the syntax of this option, check the
  11179. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11180. @item framerate
  11181. The framerate of the generated video. It may be a string of the form
  11182. @var{num}/@var{den} or a frame rate abbreviation.
  11183. @item filter_name
  11184. The name to the frei0r source to load. For more information regarding frei0r and
  11185. how to set the parameters, read the @ref{frei0r} section in the video filters
  11186. documentation.
  11187. @item filter_params
  11188. A '|'-separated list of parameters to pass to the frei0r source.
  11189. @end table
  11190. For example, to generate a frei0r partik0l source with size 200x200
  11191. and frame rate 10 which is overlaid on the overlay filter main input:
  11192. @example
  11193. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11194. @end example
  11195. @section life
  11196. Generate a life pattern.
  11197. This source is based on a generalization of John Conway's life game.
  11198. The sourced input represents a life grid, each pixel represents a cell
  11199. which can be in one of two possible states, alive or dead. Every cell
  11200. interacts with its eight neighbours, which are the cells that are
  11201. horizontally, vertically, or diagonally adjacent.
  11202. At each interaction the grid evolves according to the adopted rule,
  11203. which specifies the number of neighbor alive cells which will make a
  11204. cell stay alive or born. The @option{rule} option allows one to specify
  11205. the rule to adopt.
  11206. This source accepts the following options:
  11207. @table @option
  11208. @item filename, f
  11209. Set the file from which to read the initial grid state. In the file,
  11210. each non-whitespace character is considered an alive cell, and newline
  11211. is used to delimit the end of each row.
  11212. If this option is not specified, the initial grid is generated
  11213. randomly.
  11214. @item rate, r
  11215. Set the video rate, that is the number of frames generated per second.
  11216. Default is 25.
  11217. @item random_fill_ratio, ratio
  11218. Set the random fill ratio for the initial random grid. It is a
  11219. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11220. It is ignored when a file is specified.
  11221. @item random_seed, seed
  11222. Set the seed for filling the initial random grid, must be an integer
  11223. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11224. set to -1, the filter will try to use a good random seed on a best
  11225. effort basis.
  11226. @item rule
  11227. Set the life rule.
  11228. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11229. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11230. @var{NS} specifies the number of alive neighbor cells which make a
  11231. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11232. which make a dead cell to become alive (i.e. to "born").
  11233. "s" and "b" can be used in place of "S" and "B", respectively.
  11234. Alternatively a rule can be specified by an 18-bits integer. The 9
  11235. high order bits are used to encode the next cell state if it is alive
  11236. for each number of neighbor alive cells, the low order bits specify
  11237. the rule for "borning" new cells. Higher order bits encode for an
  11238. higher number of neighbor cells.
  11239. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11240. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11241. Default value is "S23/B3", which is the original Conway's game of life
  11242. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11243. cells, and will born a new cell if there are three alive cells around
  11244. a dead cell.
  11245. @item size, s
  11246. Set the size of the output video. For the syntax of this option, check the
  11247. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11248. If @option{filename} is specified, the size is set by default to the
  11249. same size of the input file. If @option{size} is set, it must contain
  11250. the size specified in the input file, and the initial grid defined in
  11251. that file is centered in the larger resulting area.
  11252. If a filename is not specified, the size value defaults to "320x240"
  11253. (used for a randomly generated initial grid).
  11254. @item stitch
  11255. If set to 1, stitch the left and right grid edges together, and the
  11256. top and bottom edges also. Defaults to 1.
  11257. @item mold
  11258. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11259. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11260. value from 0 to 255.
  11261. @item life_color
  11262. Set the color of living (or new born) cells.
  11263. @item death_color
  11264. Set the color of dead cells. If @option{mold} is set, this is the first color
  11265. used to represent a dead cell.
  11266. @item mold_color
  11267. Set mold color, for definitely dead and moldy cells.
  11268. For the syntax of these 3 color options, check the "Color" section in the
  11269. ffmpeg-utils manual.
  11270. @end table
  11271. @subsection Examples
  11272. @itemize
  11273. @item
  11274. Read a grid from @file{pattern}, and center it on a grid of size
  11275. 300x300 pixels:
  11276. @example
  11277. life=f=pattern:s=300x300
  11278. @end example
  11279. @item
  11280. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11281. @example
  11282. life=ratio=2/3:s=200x200
  11283. @end example
  11284. @item
  11285. Specify a custom rule for evolving a randomly generated grid:
  11286. @example
  11287. life=rule=S14/B34
  11288. @end example
  11289. @item
  11290. Full example with slow death effect (mold) using @command{ffplay}:
  11291. @example
  11292. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11293. @end example
  11294. @end itemize
  11295. @anchor{allrgb}
  11296. @anchor{allyuv}
  11297. @anchor{color}
  11298. @anchor{haldclutsrc}
  11299. @anchor{nullsrc}
  11300. @anchor{rgbtestsrc}
  11301. @anchor{smptebars}
  11302. @anchor{smptehdbars}
  11303. @anchor{testsrc}
  11304. @anchor{testsrc2}
  11305. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  11306. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11307. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11308. The @code{color} source provides an uniformly colored input.
  11309. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11310. @ref{haldclut} filter.
  11311. The @code{nullsrc} source returns unprocessed video frames. It is
  11312. mainly useful to be employed in analysis / debugging tools, or as the
  11313. source for filters which ignore the input data.
  11314. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11315. detecting RGB vs BGR issues. You should see a red, green and blue
  11316. stripe from top to bottom.
  11317. The @code{smptebars} source generates a color bars pattern, based on
  11318. the SMPTE Engineering Guideline EG 1-1990.
  11319. The @code{smptehdbars} source generates a color bars pattern, based on
  11320. the SMPTE RP 219-2002.
  11321. The @code{testsrc} source generates a test video pattern, showing a
  11322. color pattern, a scrolling gradient and a timestamp. This is mainly
  11323. intended for testing purposes.
  11324. The @code{testsrc2} source is similar to testsrc, but supports more
  11325. pixel formats instead of just @code{rgb24}. This allows using it as an
  11326. input for other tests without requiring a format conversion.
  11327. The sources accept the following parameters:
  11328. @table @option
  11329. @item color, c
  11330. Specify the color of the source, only available in the @code{color}
  11331. source. For the syntax of this option, check the "Color" section in the
  11332. ffmpeg-utils manual.
  11333. @item level
  11334. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11335. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11336. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11337. coded on a @code{1/(N*N)} scale.
  11338. @item size, s
  11339. Specify the size of the sourced video. For the syntax of this option, check the
  11340. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11341. The default value is @code{320x240}.
  11342. This option is not available with the @code{haldclutsrc} filter.
  11343. @item rate, r
  11344. Specify the frame rate of the sourced video, as the number of frames
  11345. generated per second. It has to be a string in the format
  11346. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11347. number or a valid video frame rate abbreviation. The default value is
  11348. "25".
  11349. @item sar
  11350. Set the sample aspect ratio of the sourced video.
  11351. @item duration, d
  11352. Set the duration of the sourced video. See
  11353. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11354. for the accepted syntax.
  11355. If not specified, or the expressed duration is negative, the video is
  11356. supposed to be generated forever.
  11357. @item decimals, n
  11358. Set the number of decimals to show in the timestamp, only available in the
  11359. @code{testsrc} source.
  11360. The displayed timestamp value will correspond to the original
  11361. timestamp value multiplied by the power of 10 of the specified
  11362. value. Default value is 0.
  11363. @end table
  11364. For example the following:
  11365. @example
  11366. testsrc=duration=5.3:size=qcif:rate=10
  11367. @end example
  11368. will generate a video with a duration of 5.3 seconds, with size
  11369. 176x144 and a frame rate of 10 frames per second.
  11370. The following graph description will generate a red source
  11371. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11372. frames per second.
  11373. @example
  11374. color=c=red@@0.2:s=qcif:r=10
  11375. @end example
  11376. If the input content is to be ignored, @code{nullsrc} can be used. The
  11377. following command generates noise in the luminance plane by employing
  11378. the @code{geq} filter:
  11379. @example
  11380. nullsrc=s=256x256, geq=random(1)*255:128:128
  11381. @end example
  11382. @subsection Commands
  11383. The @code{color} source supports the following commands:
  11384. @table @option
  11385. @item c, color
  11386. Set the color of the created image. Accepts the same syntax of the
  11387. corresponding @option{color} option.
  11388. @end table
  11389. @c man end VIDEO SOURCES
  11390. @chapter Video Sinks
  11391. @c man begin VIDEO SINKS
  11392. Below is a description of the currently available video sinks.
  11393. @section buffersink
  11394. Buffer video frames, and make them available to the end of the filter
  11395. graph.
  11396. This sink is mainly intended for programmatic use, in particular
  11397. through the interface defined in @file{libavfilter/buffersink.h}
  11398. or the options system.
  11399. It accepts a pointer to an AVBufferSinkContext structure, which
  11400. defines the incoming buffers' formats, to be passed as the opaque
  11401. parameter to @code{avfilter_init_filter} for initialization.
  11402. @section nullsink
  11403. Null video sink: do absolutely nothing with the input video. It is
  11404. mainly useful as a template and for use in analysis / debugging
  11405. tools.
  11406. @c man end VIDEO SINKS
  11407. @chapter Multimedia Filters
  11408. @c man begin MULTIMEDIA FILTERS
  11409. Below is a description of the currently available multimedia filters.
  11410. @section ahistogram
  11411. Convert input audio to a video output, displaying the volume histogram.
  11412. The filter accepts the following options:
  11413. @table @option
  11414. @item dmode
  11415. Specify how histogram is calculated.
  11416. It accepts the following values:
  11417. @table @samp
  11418. @item single
  11419. Use single histogram for all channels.
  11420. @item separate
  11421. Use separate histogram for each channel.
  11422. @end table
  11423. Default is @code{single}.
  11424. @item rate, r
  11425. Set frame rate, expressed as number of frames per second. Default
  11426. value is "25".
  11427. @item size, s
  11428. Specify the video size for the output. For the syntax of this option, check the
  11429. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11430. Default value is @code{hd720}.
  11431. @item scale
  11432. Set display scale.
  11433. It accepts the following values:
  11434. @table @samp
  11435. @item log
  11436. logarithmic
  11437. @item sqrt
  11438. square root
  11439. @item cbrt
  11440. cubic root
  11441. @item lin
  11442. linear
  11443. @item rlog
  11444. reverse logarithmic
  11445. @end table
  11446. Default is @code{log}.
  11447. @item ascale
  11448. Set amplitude scale.
  11449. It accepts the following values:
  11450. @table @samp
  11451. @item log
  11452. logarithmic
  11453. @item lin
  11454. linear
  11455. @end table
  11456. Default is @code{log}.
  11457. @item acount
  11458. Set how much frames to accumulate in histogram.
  11459. Defauls is 1. Setting this to -1 accumulates all frames.
  11460. @item rheight
  11461. Set histogram ratio of window height.
  11462. @item slide
  11463. Set sonogram sliding.
  11464. It accepts the following values:
  11465. @table @samp
  11466. @item replace
  11467. replace old rows with new ones.
  11468. @item scroll
  11469. scroll from top to bottom.
  11470. @end table
  11471. Default is @code{replace}.
  11472. @end table
  11473. @section aphasemeter
  11474. Convert input audio to a video output, displaying the audio phase.
  11475. The filter accepts the following options:
  11476. @table @option
  11477. @item rate, r
  11478. Set the output frame rate. Default value is @code{25}.
  11479. @item size, s
  11480. Set the video size for the output. For the syntax of this option, check the
  11481. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11482. Default value is @code{800x400}.
  11483. @item rc
  11484. @item gc
  11485. @item bc
  11486. Specify the red, green, blue contrast. Default values are @code{2},
  11487. @code{7} and @code{1}.
  11488. Allowed range is @code{[0, 255]}.
  11489. @item mpc
  11490. Set color which will be used for drawing median phase. If color is
  11491. @code{none} which is default, no median phase value will be drawn.
  11492. @end table
  11493. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11494. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11495. The @code{-1} means left and right channels are completely out of phase and
  11496. @code{1} means channels are in phase.
  11497. @section avectorscope
  11498. Convert input audio to a video output, representing the audio vector
  11499. scope.
  11500. The filter is used to measure the difference between channels of stereo
  11501. audio stream. A monoaural signal, consisting of identical left and right
  11502. signal, results in straight vertical line. Any stereo separation is visible
  11503. as a deviation from this line, creating a Lissajous figure.
  11504. If the straight (or deviation from it) but horizontal line appears this
  11505. indicates that the left and right channels are out of phase.
  11506. The filter accepts the following options:
  11507. @table @option
  11508. @item mode, m
  11509. Set the vectorscope mode.
  11510. Available values are:
  11511. @table @samp
  11512. @item lissajous
  11513. Lissajous rotated by 45 degrees.
  11514. @item lissajous_xy
  11515. Same as above but not rotated.
  11516. @item polar
  11517. Shape resembling half of circle.
  11518. @end table
  11519. Default value is @samp{lissajous}.
  11520. @item size, s
  11521. Set the video size for the output. For the syntax of this option, check the
  11522. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11523. Default value is @code{400x400}.
  11524. @item rate, r
  11525. Set the output frame rate. Default value is @code{25}.
  11526. @item rc
  11527. @item gc
  11528. @item bc
  11529. @item ac
  11530. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11531. @code{160}, @code{80} and @code{255}.
  11532. Allowed range is @code{[0, 255]}.
  11533. @item rf
  11534. @item gf
  11535. @item bf
  11536. @item af
  11537. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11538. @code{10}, @code{5} and @code{5}.
  11539. Allowed range is @code{[0, 255]}.
  11540. @item zoom
  11541. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11542. @item draw
  11543. Set the vectorscope drawing mode.
  11544. Available values are:
  11545. @table @samp
  11546. @item dot
  11547. Draw dot for each sample.
  11548. @item line
  11549. Draw line between previous and current sample.
  11550. @end table
  11551. Default value is @samp{dot}.
  11552. @item scale
  11553. Specify amplitude scale of audio samples.
  11554. Available values are:
  11555. @table @samp
  11556. @item lin
  11557. Linear.
  11558. @item sqrt
  11559. Square root.
  11560. @item cbrt
  11561. Cubic root.
  11562. @item log
  11563. Logarithmic.
  11564. @end table
  11565. @end table
  11566. @subsection Examples
  11567. @itemize
  11568. @item
  11569. Complete example using @command{ffplay}:
  11570. @example
  11571. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11572. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11573. @end example
  11574. @end itemize
  11575. @section bench, abench
  11576. Benchmark part of a filtergraph.
  11577. The filter accepts the following options:
  11578. @table @option
  11579. @item action
  11580. Start or stop a timer.
  11581. Available values are:
  11582. @table @samp
  11583. @item start
  11584. Get the current time, set it as frame metadata (using the key
  11585. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11586. @item stop
  11587. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11588. the input frame metadata to get the time difference. Time difference, average,
  11589. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11590. @code{min}) are then printed. The timestamps are expressed in seconds.
  11591. @end table
  11592. @end table
  11593. @subsection Examples
  11594. @itemize
  11595. @item
  11596. Benchmark @ref{selectivecolor} filter:
  11597. @example
  11598. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11599. @end example
  11600. @end itemize
  11601. @section concat
  11602. Concatenate audio and video streams, joining them together one after the
  11603. other.
  11604. The filter works on segments of synchronized video and audio streams. All
  11605. segments must have the same number of streams of each type, and that will
  11606. also be the number of streams at output.
  11607. The filter accepts the following options:
  11608. @table @option
  11609. @item n
  11610. Set the number of segments. Default is 2.
  11611. @item v
  11612. Set the number of output video streams, that is also the number of video
  11613. streams in each segment. Default is 1.
  11614. @item a
  11615. Set the number of output audio streams, that is also the number of audio
  11616. streams in each segment. Default is 0.
  11617. @item unsafe
  11618. Activate unsafe mode: do not fail if segments have a different format.
  11619. @end table
  11620. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11621. @var{a} audio outputs.
  11622. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11623. segment, in the same order as the outputs, then the inputs for the second
  11624. segment, etc.
  11625. Related streams do not always have exactly the same duration, for various
  11626. reasons including codec frame size or sloppy authoring. For that reason,
  11627. related synchronized streams (e.g. a video and its audio track) should be
  11628. concatenated at once. The concat filter will use the duration of the longest
  11629. stream in each segment (except the last one), and if necessary pad shorter
  11630. audio streams with silence.
  11631. For this filter to work correctly, all segments must start at timestamp 0.
  11632. All corresponding streams must have the same parameters in all segments; the
  11633. filtering system will automatically select a common pixel format for video
  11634. streams, and a common sample format, sample rate and channel layout for
  11635. audio streams, but other settings, such as resolution, must be converted
  11636. explicitly by the user.
  11637. Different frame rates are acceptable but will result in variable frame rate
  11638. at output; be sure to configure the output file to handle it.
  11639. @subsection Examples
  11640. @itemize
  11641. @item
  11642. Concatenate an opening, an episode and an ending, all in bilingual version
  11643. (video in stream 0, audio in streams 1 and 2):
  11644. @example
  11645. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11646. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11647. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11648. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11649. @end example
  11650. @item
  11651. Concatenate two parts, handling audio and video separately, using the
  11652. (a)movie sources, and adjusting the resolution:
  11653. @example
  11654. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11655. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11656. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11657. @end example
  11658. Note that a desync will happen at the stitch if the audio and video streams
  11659. do not have exactly the same duration in the first file.
  11660. @end itemize
  11661. @section drawgraph, adrawgraph
  11662. Draw a graph using input video or audio metadata.
  11663. It accepts the following parameters:
  11664. @table @option
  11665. @item m1
  11666. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  11667. @item fg1
  11668. Set 1st foreground color expression.
  11669. @item m2
  11670. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  11671. @item fg2
  11672. Set 2nd foreground color expression.
  11673. @item m3
  11674. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  11675. @item fg3
  11676. Set 3rd foreground color expression.
  11677. @item m4
  11678. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  11679. @item fg4
  11680. Set 4th foreground color expression.
  11681. @item min
  11682. Set minimal value of metadata value.
  11683. @item max
  11684. Set maximal value of metadata value.
  11685. @item bg
  11686. Set graph background color. Default is white.
  11687. @item mode
  11688. Set graph mode.
  11689. Available values for mode is:
  11690. @table @samp
  11691. @item bar
  11692. @item dot
  11693. @item line
  11694. @end table
  11695. Default is @code{line}.
  11696. @item slide
  11697. Set slide mode.
  11698. Available values for slide is:
  11699. @table @samp
  11700. @item frame
  11701. Draw new frame when right border is reached.
  11702. @item replace
  11703. Replace old columns with new ones.
  11704. @item scroll
  11705. Scroll from right to left.
  11706. @item rscroll
  11707. Scroll from left to right.
  11708. @item picture
  11709. Draw single picture.
  11710. @end table
  11711. Default is @code{frame}.
  11712. @item size
  11713. Set size of graph video. For the syntax of this option, check the
  11714. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11715. The default value is @code{900x256}.
  11716. The foreground color expressions can use the following variables:
  11717. @table @option
  11718. @item MIN
  11719. Minimal value of metadata value.
  11720. @item MAX
  11721. Maximal value of metadata value.
  11722. @item VAL
  11723. Current metadata key value.
  11724. @end table
  11725. The color is defined as 0xAABBGGRR.
  11726. @end table
  11727. Example using metadata from @ref{signalstats} filter:
  11728. @example
  11729. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  11730. @end example
  11731. Example using metadata from @ref{ebur128} filter:
  11732. @example
  11733. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  11734. @end example
  11735. @anchor{ebur128}
  11736. @section ebur128
  11737. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11738. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11739. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11740. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11741. The filter also has a video output (see the @var{video} option) with a real
  11742. time graph to observe the loudness evolution. The graphic contains the logged
  11743. message mentioned above, so it is not printed anymore when this option is set,
  11744. unless the verbose logging is set. The main graphing area contains the
  11745. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11746. the momentary loudness (400 milliseconds).
  11747. More information about the Loudness Recommendation EBU R128 on
  11748. @url{http://tech.ebu.ch/loudness}.
  11749. The filter accepts the following options:
  11750. @table @option
  11751. @item video
  11752. Activate the video output. The audio stream is passed unchanged whether this
  11753. option is set or no. The video stream will be the first output stream if
  11754. activated. Default is @code{0}.
  11755. @item size
  11756. Set the video size. This option is for video only. For the syntax of this
  11757. option, check the
  11758. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11759. Default and minimum resolution is @code{640x480}.
  11760. @item meter
  11761. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11762. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11763. other integer value between this range is allowed.
  11764. @item metadata
  11765. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11766. into 100ms output frames, each of them containing various loudness information
  11767. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11768. Default is @code{0}.
  11769. @item framelog
  11770. Force the frame logging level.
  11771. Available values are:
  11772. @table @samp
  11773. @item info
  11774. information logging level
  11775. @item verbose
  11776. verbose logging level
  11777. @end table
  11778. By default, the logging level is set to @var{info}. If the @option{video} or
  11779. the @option{metadata} options are set, it switches to @var{verbose}.
  11780. @item peak
  11781. Set peak mode(s).
  11782. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11783. values are:
  11784. @table @samp
  11785. @item none
  11786. Disable any peak mode (default).
  11787. @item sample
  11788. Enable sample-peak mode.
  11789. Simple peak mode looking for the higher sample value. It logs a message
  11790. for sample-peak (identified by @code{SPK}).
  11791. @item true
  11792. Enable true-peak mode.
  11793. If enabled, the peak lookup is done on an over-sampled version of the input
  11794. stream for better peak accuracy. It logs a message for true-peak.
  11795. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11796. This mode requires a build with @code{libswresample}.
  11797. @end table
  11798. @item dualmono
  11799. Treat mono input files as "dual mono". If a mono file is intended for playback
  11800. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11801. If set to @code{true}, this option will compensate for this effect.
  11802. Multi-channel input files are not affected by this option.
  11803. @item panlaw
  11804. Set a specific pan law to be used for the measurement of dual mono files.
  11805. This parameter is optional, and has a default value of -3.01dB.
  11806. @end table
  11807. @subsection Examples
  11808. @itemize
  11809. @item
  11810. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11811. @example
  11812. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11813. @end example
  11814. @item
  11815. Run an analysis with @command{ffmpeg}:
  11816. @example
  11817. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11818. @end example
  11819. @end itemize
  11820. @section interleave, ainterleave
  11821. Temporally interleave frames from several inputs.
  11822. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11823. These filters read frames from several inputs and send the oldest
  11824. queued frame to the output.
  11825. Input streams must have a well defined, monotonically increasing frame
  11826. timestamp values.
  11827. In order to submit one frame to output, these filters need to enqueue
  11828. at least one frame for each input, so they cannot work in case one
  11829. input is not yet terminated and will not receive incoming frames.
  11830. For example consider the case when one input is a @code{select} filter
  11831. which always drop input frames. The @code{interleave} filter will keep
  11832. reading from that input, but it will never be able to send new frames
  11833. to output until the input will send an end-of-stream signal.
  11834. Also, depending on inputs synchronization, the filters will drop
  11835. frames in case one input receives more frames than the other ones, and
  11836. the queue is already filled.
  11837. These filters accept the following options:
  11838. @table @option
  11839. @item nb_inputs, n
  11840. Set the number of different inputs, it is 2 by default.
  11841. @end table
  11842. @subsection Examples
  11843. @itemize
  11844. @item
  11845. Interleave frames belonging to different streams using @command{ffmpeg}:
  11846. @example
  11847. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11848. @end example
  11849. @item
  11850. Add flickering blur effect:
  11851. @example
  11852. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11853. @end example
  11854. @end itemize
  11855. @section metadata, ametadata
  11856. Manipulate frame metadata.
  11857. This filter accepts the following options:
  11858. @table @option
  11859. @item mode
  11860. Set mode of operation of the filter.
  11861. Can be one of the following:
  11862. @table @samp
  11863. @item select
  11864. If both @code{value} and @code{key} is set, select frames
  11865. which have such metadata. If only @code{key} is set, select
  11866. every frame that has such key in metadata.
  11867. @item add
  11868. Add new metadata @code{key} and @code{value}. If key is already available
  11869. do nothing.
  11870. @item modify
  11871. Modify value of already present key.
  11872. @item delete
  11873. If @code{value} is set, delete only keys that have such value.
  11874. Otherwise, delete key.
  11875. @item print
  11876. Print key and its value if metadata was found. If @code{key} is not set print all
  11877. metadata values available in frame.
  11878. @end table
  11879. @item key
  11880. Set key used with all modes. Must be set for all modes except @code{print}.
  11881. @item value
  11882. Set metadata value which will be used. This option is mandatory for
  11883. @code{modify} and @code{add} mode.
  11884. @item function
  11885. Which function to use when comparing metadata value and @code{value}.
  11886. Can be one of following:
  11887. @table @samp
  11888. @item same_str
  11889. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  11890. @item starts_with
  11891. Values are interpreted as strings, returns true if metadata value starts with
  11892. the @code{value} option string.
  11893. @item less
  11894. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  11895. @item equal
  11896. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  11897. @item greater
  11898. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  11899. @item expr
  11900. Values are interpreted as floats, returns true if expression from option @code{expr}
  11901. evaluates to true.
  11902. @end table
  11903. @item expr
  11904. Set expression which is used when @code{function} is set to @code{expr}.
  11905. The expression is evaluated through the eval API and can contain the following
  11906. constants:
  11907. @table @option
  11908. @item VALUE1
  11909. Float representation of @code{value} from metadata key.
  11910. @item VALUE2
  11911. Float representation of @code{value} as supplied by user in @code{value} option.
  11912. @item file
  11913. If specified in @code{print} mode, output is written to the named file. Instead of
  11914. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  11915. for standard output. If @code{file} option is not set, output is written to the log
  11916. with AV_LOG_INFO loglevel.
  11917. @end table
  11918. @end table
  11919. @subsection Examples
  11920. @itemize
  11921. @item
  11922. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  11923. between 0 and 1.
  11924. @example
  11925. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  11926. @end example
  11927. @item
  11928. Print silencedetect output to file @file{metadata.txt}.
  11929. @example
  11930. silencedetect,ametadata=mode=print:file=metadata.txt
  11931. @end example
  11932. @item
  11933. Direct all metadata to a pipe with file descriptor 4.
  11934. @example
  11935. metadata=mode=print:file='pipe\:4'
  11936. @end example
  11937. @end itemize
  11938. @section perms, aperms
  11939. Set read/write permissions for the output frames.
  11940. These filters are mainly aimed at developers to test direct path in the
  11941. following filter in the filtergraph.
  11942. The filters accept the following options:
  11943. @table @option
  11944. @item mode
  11945. Select the permissions mode.
  11946. It accepts the following values:
  11947. @table @samp
  11948. @item none
  11949. Do nothing. This is the default.
  11950. @item ro
  11951. Set all the output frames read-only.
  11952. @item rw
  11953. Set all the output frames directly writable.
  11954. @item toggle
  11955. Make the frame read-only if writable, and writable if read-only.
  11956. @item random
  11957. Set each output frame read-only or writable randomly.
  11958. @end table
  11959. @item seed
  11960. Set the seed for the @var{random} mode, must be an integer included between
  11961. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11962. @code{-1}, the filter will try to use a good random seed on a best effort
  11963. basis.
  11964. @end table
  11965. Note: in case of auto-inserted filter between the permission filter and the
  11966. following one, the permission might not be received as expected in that
  11967. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11968. perms/aperms filter can avoid this problem.
  11969. @section realtime, arealtime
  11970. Slow down filtering to match real time approximatively.
  11971. These filters will pause the filtering for a variable amount of time to
  11972. match the output rate with the input timestamps.
  11973. They are similar to the @option{re} option to @code{ffmpeg}.
  11974. They accept the following options:
  11975. @table @option
  11976. @item limit
  11977. Time limit for the pauses. Any pause longer than that will be considered
  11978. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11979. @end table
  11980. @section select, aselect
  11981. Select frames to pass in output.
  11982. This filter accepts the following options:
  11983. @table @option
  11984. @item expr, e
  11985. Set expression, which is evaluated for each input frame.
  11986. If the expression is evaluated to zero, the frame is discarded.
  11987. If the evaluation result is negative or NaN, the frame is sent to the
  11988. first output; otherwise it is sent to the output with index
  11989. @code{ceil(val)-1}, assuming that the input index starts from 0.
  11990. For example a value of @code{1.2} corresponds to the output with index
  11991. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  11992. @item outputs, n
  11993. Set the number of outputs. The output to which to send the selected
  11994. frame is based on the result of the evaluation. Default value is 1.
  11995. @end table
  11996. The expression can contain the following constants:
  11997. @table @option
  11998. @item n
  11999. The (sequential) number of the filtered frame, starting from 0.
  12000. @item selected_n
  12001. The (sequential) number of the selected frame, starting from 0.
  12002. @item prev_selected_n
  12003. The sequential number of the last selected frame. It's NAN if undefined.
  12004. @item TB
  12005. The timebase of the input timestamps.
  12006. @item pts
  12007. The PTS (Presentation TimeStamp) of the filtered video frame,
  12008. expressed in @var{TB} units. It's NAN if undefined.
  12009. @item t
  12010. The PTS of the filtered video frame,
  12011. expressed in seconds. It's NAN if undefined.
  12012. @item prev_pts
  12013. The PTS of the previously filtered video frame. It's NAN if undefined.
  12014. @item prev_selected_pts
  12015. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12016. @item prev_selected_t
  12017. The PTS of the last previously selected video frame. It's NAN if undefined.
  12018. @item start_pts
  12019. The PTS of the first video frame in the video. It's NAN if undefined.
  12020. @item start_t
  12021. The time of the first video frame in the video. It's NAN if undefined.
  12022. @item pict_type @emph{(video only)}
  12023. The type of the filtered frame. It can assume one of the following
  12024. values:
  12025. @table @option
  12026. @item I
  12027. @item P
  12028. @item B
  12029. @item S
  12030. @item SI
  12031. @item SP
  12032. @item BI
  12033. @end table
  12034. @item interlace_type @emph{(video only)}
  12035. The frame interlace type. It can assume one of the following values:
  12036. @table @option
  12037. @item PROGRESSIVE
  12038. The frame is progressive (not interlaced).
  12039. @item TOPFIRST
  12040. The frame is top-field-first.
  12041. @item BOTTOMFIRST
  12042. The frame is bottom-field-first.
  12043. @end table
  12044. @item consumed_sample_n @emph{(audio only)}
  12045. the number of selected samples before the current frame
  12046. @item samples_n @emph{(audio only)}
  12047. the number of samples in the current frame
  12048. @item sample_rate @emph{(audio only)}
  12049. the input sample rate
  12050. @item key
  12051. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12052. @item pos
  12053. the position in the file of the filtered frame, -1 if the information
  12054. is not available (e.g. for synthetic video)
  12055. @item scene @emph{(video only)}
  12056. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12057. probability for the current frame to introduce a new scene, while a higher
  12058. value means the current frame is more likely to be one (see the example below)
  12059. @item concatdec_select
  12060. The concat demuxer can select only part of a concat input file by setting an
  12061. inpoint and an outpoint, but the output packets may not be entirely contained
  12062. in the selected interval. By using this variable, it is possible to skip frames
  12063. generated by the concat demuxer which are not exactly contained in the selected
  12064. interval.
  12065. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12066. and the @var{lavf.concat.duration} packet metadata values which are also
  12067. present in the decoded frames.
  12068. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12069. start_time and either the duration metadata is missing or the frame pts is less
  12070. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12071. missing.
  12072. That basically means that an input frame is selected if its pts is within the
  12073. interval set by the concat demuxer.
  12074. @end table
  12075. The default value of the select expression is "1".
  12076. @subsection Examples
  12077. @itemize
  12078. @item
  12079. Select all frames in input:
  12080. @example
  12081. select
  12082. @end example
  12083. The example above is the same as:
  12084. @example
  12085. select=1
  12086. @end example
  12087. @item
  12088. Skip all frames:
  12089. @example
  12090. select=0
  12091. @end example
  12092. @item
  12093. Select only I-frames:
  12094. @example
  12095. select='eq(pict_type\,I)'
  12096. @end example
  12097. @item
  12098. Select one frame every 100:
  12099. @example
  12100. select='not(mod(n\,100))'
  12101. @end example
  12102. @item
  12103. Select only frames contained in the 10-20 time interval:
  12104. @example
  12105. select=between(t\,10\,20)
  12106. @end example
  12107. @item
  12108. Select only I-frames contained in the 10-20 time interval:
  12109. @example
  12110. select=between(t\,10\,20)*eq(pict_type\,I)
  12111. @end example
  12112. @item
  12113. Select frames with a minimum distance of 10 seconds:
  12114. @example
  12115. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12116. @end example
  12117. @item
  12118. Use aselect to select only audio frames with samples number > 100:
  12119. @example
  12120. aselect='gt(samples_n\,100)'
  12121. @end example
  12122. @item
  12123. Create a mosaic of the first scenes:
  12124. @example
  12125. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12126. @end example
  12127. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12128. choice.
  12129. @item
  12130. Send even and odd frames to separate outputs, and compose them:
  12131. @example
  12132. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12133. @end example
  12134. @item
  12135. Select useful frames from an ffconcat file which is using inpoints and
  12136. outpoints but where the source files are not intra frame only.
  12137. @example
  12138. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12139. @end example
  12140. @end itemize
  12141. @section sendcmd, asendcmd
  12142. Send commands to filters in the filtergraph.
  12143. These filters read commands to be sent to other filters in the
  12144. filtergraph.
  12145. @code{sendcmd} must be inserted between two video filters,
  12146. @code{asendcmd} must be inserted between two audio filters, but apart
  12147. from that they act the same way.
  12148. The specification of commands can be provided in the filter arguments
  12149. with the @var{commands} option, or in a file specified by the
  12150. @var{filename} option.
  12151. These filters accept the following options:
  12152. @table @option
  12153. @item commands, c
  12154. Set the commands to be read and sent to the other filters.
  12155. @item filename, f
  12156. Set the filename of the commands to be read and sent to the other
  12157. filters.
  12158. @end table
  12159. @subsection Commands syntax
  12160. A commands description consists of a sequence of interval
  12161. specifications, comprising a list of commands to be executed when a
  12162. particular event related to that interval occurs. The occurring event
  12163. is typically the current frame time entering or leaving a given time
  12164. interval.
  12165. An interval is specified by the following syntax:
  12166. @example
  12167. @var{START}[-@var{END}] @var{COMMANDS};
  12168. @end example
  12169. The time interval is specified by the @var{START} and @var{END} times.
  12170. @var{END} is optional and defaults to the maximum time.
  12171. The current frame time is considered within the specified interval if
  12172. it is included in the interval [@var{START}, @var{END}), that is when
  12173. the time is greater or equal to @var{START} and is lesser than
  12174. @var{END}.
  12175. @var{COMMANDS} consists of a sequence of one or more command
  12176. specifications, separated by ",", relating to that interval. The
  12177. syntax of a command specification is given by:
  12178. @example
  12179. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12180. @end example
  12181. @var{FLAGS} is optional and specifies the type of events relating to
  12182. the time interval which enable sending the specified command, and must
  12183. be a non-null sequence of identifier flags separated by "+" or "|" and
  12184. enclosed between "[" and "]".
  12185. The following flags are recognized:
  12186. @table @option
  12187. @item enter
  12188. The command is sent when the current frame timestamp enters the
  12189. specified interval. In other words, the command is sent when the
  12190. previous frame timestamp was not in the given interval, and the
  12191. current is.
  12192. @item leave
  12193. The command is sent when the current frame timestamp leaves the
  12194. specified interval. In other words, the command is sent when the
  12195. previous frame timestamp was in the given interval, and the
  12196. current is not.
  12197. @end table
  12198. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12199. assumed.
  12200. @var{TARGET} specifies the target of the command, usually the name of
  12201. the filter class or a specific filter instance name.
  12202. @var{COMMAND} specifies the name of the command for the target filter.
  12203. @var{ARG} is optional and specifies the optional list of argument for
  12204. the given @var{COMMAND}.
  12205. Between one interval specification and another, whitespaces, or
  12206. sequences of characters starting with @code{#} until the end of line,
  12207. are ignored and can be used to annotate comments.
  12208. A simplified BNF description of the commands specification syntax
  12209. follows:
  12210. @example
  12211. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12212. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12213. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12214. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12215. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12216. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12217. @end example
  12218. @subsection Examples
  12219. @itemize
  12220. @item
  12221. Specify audio tempo change at second 4:
  12222. @example
  12223. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12224. @end example
  12225. @item
  12226. Specify a list of drawtext and hue commands in a file.
  12227. @example
  12228. # show text in the interval 5-10
  12229. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12230. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12231. # desaturate the image in the interval 15-20
  12232. 15.0-20.0 [enter] hue s 0,
  12233. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12234. [leave] hue s 1,
  12235. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12236. # apply an exponential saturation fade-out effect, starting from time 25
  12237. 25 [enter] hue s exp(25-t)
  12238. @end example
  12239. A filtergraph allowing to read and process the above command list
  12240. stored in a file @file{test.cmd}, can be specified with:
  12241. @example
  12242. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12243. @end example
  12244. @end itemize
  12245. @anchor{setpts}
  12246. @section setpts, asetpts
  12247. Change the PTS (presentation timestamp) of the input frames.
  12248. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12249. This filter accepts the following options:
  12250. @table @option
  12251. @item expr
  12252. The expression which is evaluated for each frame to construct its timestamp.
  12253. @end table
  12254. The expression is evaluated through the eval API and can contain the following
  12255. constants:
  12256. @table @option
  12257. @item FRAME_RATE
  12258. frame rate, only defined for constant frame-rate video
  12259. @item PTS
  12260. The presentation timestamp in input
  12261. @item N
  12262. The count of the input frame for video or the number of consumed samples,
  12263. not including the current frame for audio, starting from 0.
  12264. @item NB_CONSUMED_SAMPLES
  12265. The number of consumed samples, not including the current frame (only
  12266. audio)
  12267. @item NB_SAMPLES, S
  12268. The number of samples in the current frame (only audio)
  12269. @item SAMPLE_RATE, SR
  12270. The audio sample rate.
  12271. @item STARTPTS
  12272. The PTS of the first frame.
  12273. @item STARTT
  12274. the time in seconds of the first frame
  12275. @item INTERLACED
  12276. State whether the current frame is interlaced.
  12277. @item T
  12278. the time in seconds of the current frame
  12279. @item POS
  12280. original position in the file of the frame, or undefined if undefined
  12281. for the current frame
  12282. @item PREV_INPTS
  12283. The previous input PTS.
  12284. @item PREV_INT
  12285. previous input time in seconds
  12286. @item PREV_OUTPTS
  12287. The previous output PTS.
  12288. @item PREV_OUTT
  12289. previous output time in seconds
  12290. @item RTCTIME
  12291. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12292. instead.
  12293. @item RTCSTART
  12294. The wallclock (RTC) time at the start of the movie in microseconds.
  12295. @item TB
  12296. The timebase of the input timestamps.
  12297. @end table
  12298. @subsection Examples
  12299. @itemize
  12300. @item
  12301. Start counting PTS from zero
  12302. @example
  12303. setpts=PTS-STARTPTS
  12304. @end example
  12305. @item
  12306. Apply fast motion effect:
  12307. @example
  12308. setpts=0.5*PTS
  12309. @end example
  12310. @item
  12311. Apply slow motion effect:
  12312. @example
  12313. setpts=2.0*PTS
  12314. @end example
  12315. @item
  12316. Set fixed rate of 25 frames per second:
  12317. @example
  12318. setpts=N/(25*TB)
  12319. @end example
  12320. @item
  12321. Set fixed rate 25 fps with some jitter:
  12322. @example
  12323. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12324. @end example
  12325. @item
  12326. Apply an offset of 10 seconds to the input PTS:
  12327. @example
  12328. setpts=PTS+10/TB
  12329. @end example
  12330. @item
  12331. Generate timestamps from a "live source" and rebase onto the current timebase:
  12332. @example
  12333. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12334. @end example
  12335. @item
  12336. Generate timestamps by counting samples:
  12337. @example
  12338. asetpts=N/SR/TB
  12339. @end example
  12340. @end itemize
  12341. @section settb, asettb
  12342. Set the timebase to use for the output frames timestamps.
  12343. It is mainly useful for testing timebase configuration.
  12344. It accepts the following parameters:
  12345. @table @option
  12346. @item expr, tb
  12347. The expression which is evaluated into the output timebase.
  12348. @end table
  12349. The value for @option{tb} is an arithmetic expression representing a
  12350. rational. The expression can contain the constants "AVTB" (the default
  12351. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12352. audio only). Default value is "intb".
  12353. @subsection Examples
  12354. @itemize
  12355. @item
  12356. Set the timebase to 1/25:
  12357. @example
  12358. settb=expr=1/25
  12359. @end example
  12360. @item
  12361. Set the timebase to 1/10:
  12362. @example
  12363. settb=expr=0.1
  12364. @end example
  12365. @item
  12366. Set the timebase to 1001/1000:
  12367. @example
  12368. settb=1+0.001
  12369. @end example
  12370. @item
  12371. Set the timebase to 2*intb:
  12372. @example
  12373. settb=2*intb
  12374. @end example
  12375. @item
  12376. Set the default timebase value:
  12377. @example
  12378. settb=AVTB
  12379. @end example
  12380. @end itemize
  12381. @section showcqt
  12382. Convert input audio to a video output representing frequency spectrum
  12383. logarithmically using Brown-Puckette constant Q transform algorithm with
  12384. direct frequency domain coefficient calculation (but the transform itself
  12385. is not really constant Q, instead the Q factor is actually variable/clamped),
  12386. with musical tone scale, from E0 to D#10.
  12387. The filter accepts the following options:
  12388. @table @option
  12389. @item size, s
  12390. Specify the video size for the output. It must be even. For the syntax of this option,
  12391. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12392. Default value is @code{1920x1080}.
  12393. @item fps, rate, r
  12394. Set the output frame rate. Default value is @code{25}.
  12395. @item bar_h
  12396. Set the bargraph height. It must be even. Default value is @code{-1} which
  12397. computes the bargraph height automatically.
  12398. @item axis_h
  12399. Set the axis height. It must be even. Default value is @code{-1} which computes
  12400. the axis height automatically.
  12401. @item sono_h
  12402. Set the sonogram height. It must be even. Default value is @code{-1} which
  12403. computes the sonogram height automatically.
  12404. @item fullhd
  12405. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12406. instead. Default value is @code{1}.
  12407. @item sono_v, volume
  12408. Specify the sonogram volume expression. It can contain variables:
  12409. @table @option
  12410. @item bar_v
  12411. the @var{bar_v} evaluated expression
  12412. @item frequency, freq, f
  12413. the frequency where it is evaluated
  12414. @item timeclamp, tc
  12415. the value of @var{timeclamp} option
  12416. @end table
  12417. and functions:
  12418. @table @option
  12419. @item a_weighting(f)
  12420. A-weighting of equal loudness
  12421. @item b_weighting(f)
  12422. B-weighting of equal loudness
  12423. @item c_weighting(f)
  12424. C-weighting of equal loudness.
  12425. @end table
  12426. Default value is @code{16}.
  12427. @item bar_v, volume2
  12428. Specify the bargraph volume expression. It can contain variables:
  12429. @table @option
  12430. @item sono_v
  12431. the @var{sono_v} evaluated expression
  12432. @item frequency, freq, f
  12433. the frequency where it is evaluated
  12434. @item timeclamp, tc
  12435. the value of @var{timeclamp} option
  12436. @end table
  12437. and functions:
  12438. @table @option
  12439. @item a_weighting(f)
  12440. A-weighting of equal loudness
  12441. @item b_weighting(f)
  12442. B-weighting of equal loudness
  12443. @item c_weighting(f)
  12444. C-weighting of equal loudness.
  12445. @end table
  12446. Default value is @code{sono_v}.
  12447. @item sono_g, gamma
  12448. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12449. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12450. Acceptable range is @code{[1, 7]}.
  12451. @item bar_g, gamma2
  12452. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12453. @code{[1, 7]}.
  12454. @item timeclamp, tc
  12455. Specify the transform timeclamp. At low frequency, there is trade-off between
  12456. accuracy in time domain and frequency domain. If timeclamp is lower,
  12457. event in time domain is represented more accurately (such as fast bass drum),
  12458. otherwise event in frequency domain is represented more accurately
  12459. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12460. @item basefreq
  12461. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12462. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12463. @item endfreq
  12464. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12465. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12466. @item coeffclamp
  12467. This option is deprecated and ignored.
  12468. @item tlength
  12469. Specify the transform length in time domain. Use this option to control accuracy
  12470. trade-off between time domain and frequency domain at every frequency sample.
  12471. It can contain variables:
  12472. @table @option
  12473. @item frequency, freq, f
  12474. the frequency where it is evaluated
  12475. @item timeclamp, tc
  12476. the value of @var{timeclamp} option.
  12477. @end table
  12478. Default value is @code{384*tc/(384+tc*f)}.
  12479. @item count
  12480. Specify the transform count for every video frame. Default value is @code{6}.
  12481. Acceptable range is @code{[1, 30]}.
  12482. @item fcount
  12483. Specify the transform count for every single pixel. Default value is @code{0},
  12484. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12485. @item fontfile
  12486. Specify font file for use with freetype to draw the axis. If not specified,
  12487. use embedded font. Note that drawing with font file or embedded font is not
  12488. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12489. option instead.
  12490. @item fontcolor
  12491. Specify font color expression. This is arithmetic expression that should return
  12492. integer value 0xRRGGBB. It can contain variables:
  12493. @table @option
  12494. @item frequency, freq, f
  12495. the frequency where it is evaluated
  12496. @item timeclamp, tc
  12497. the value of @var{timeclamp} option
  12498. @end table
  12499. and functions:
  12500. @table @option
  12501. @item midi(f)
  12502. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12503. @item r(x), g(x), b(x)
  12504. red, green, and blue value of intensity x.
  12505. @end table
  12506. Default value is @code{st(0, (midi(f)-59.5)/12);
  12507. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12508. r(1-ld(1)) + b(ld(1))}.
  12509. @item axisfile
  12510. Specify image file to draw the axis. This option override @var{fontfile} and
  12511. @var{fontcolor} option.
  12512. @item axis, text
  12513. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12514. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12515. Default value is @code{1}.
  12516. @end table
  12517. @subsection Examples
  12518. @itemize
  12519. @item
  12520. Playing audio while showing the spectrum:
  12521. @example
  12522. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12523. @end example
  12524. @item
  12525. Same as above, but with frame rate 30 fps:
  12526. @example
  12527. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12528. @end example
  12529. @item
  12530. Playing at 1280x720:
  12531. @example
  12532. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12533. @end example
  12534. @item
  12535. Disable sonogram display:
  12536. @example
  12537. sono_h=0
  12538. @end example
  12539. @item
  12540. A1 and its harmonics: A1, A2, (near)E3, A3:
  12541. @example
  12542. 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),
  12543. asplit[a][out1]; [a] showcqt [out0]'
  12544. @end example
  12545. @item
  12546. Same as above, but with more accuracy in frequency domain:
  12547. @example
  12548. 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),
  12549. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12550. @end example
  12551. @item
  12552. Custom volume:
  12553. @example
  12554. bar_v=10:sono_v=bar_v*a_weighting(f)
  12555. @end example
  12556. @item
  12557. Custom gamma, now spectrum is linear to the amplitude.
  12558. @example
  12559. bar_g=2:sono_g=2
  12560. @end example
  12561. @item
  12562. Custom tlength equation:
  12563. @example
  12564. 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)))'
  12565. @end example
  12566. @item
  12567. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12568. @example
  12569. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12570. @end example
  12571. @item
  12572. Custom frequency range with custom axis using image file:
  12573. @example
  12574. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12575. @end example
  12576. @end itemize
  12577. @section showfreqs
  12578. Convert input audio to video output representing the audio power spectrum.
  12579. Audio amplitude is on Y-axis while frequency is on X-axis.
  12580. The filter accepts the following options:
  12581. @table @option
  12582. @item size, s
  12583. Specify size of video. For the syntax of this option, check the
  12584. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12585. Default is @code{1024x512}.
  12586. @item mode
  12587. Set display mode.
  12588. This set how each frequency bin will be represented.
  12589. It accepts the following values:
  12590. @table @samp
  12591. @item line
  12592. @item bar
  12593. @item dot
  12594. @end table
  12595. Default is @code{bar}.
  12596. @item ascale
  12597. Set amplitude scale.
  12598. It accepts the following values:
  12599. @table @samp
  12600. @item lin
  12601. Linear scale.
  12602. @item sqrt
  12603. Square root scale.
  12604. @item cbrt
  12605. Cubic root scale.
  12606. @item log
  12607. Logarithmic scale.
  12608. @end table
  12609. Default is @code{log}.
  12610. @item fscale
  12611. Set frequency scale.
  12612. It accepts the following values:
  12613. @table @samp
  12614. @item lin
  12615. Linear scale.
  12616. @item log
  12617. Logarithmic scale.
  12618. @item rlog
  12619. Reverse logarithmic scale.
  12620. @end table
  12621. Default is @code{lin}.
  12622. @item win_size
  12623. Set window size.
  12624. It accepts the following values:
  12625. @table @samp
  12626. @item w16
  12627. @item w32
  12628. @item w64
  12629. @item w128
  12630. @item w256
  12631. @item w512
  12632. @item w1024
  12633. @item w2048
  12634. @item w4096
  12635. @item w8192
  12636. @item w16384
  12637. @item w32768
  12638. @item w65536
  12639. @end table
  12640. Default is @code{w2048}
  12641. @item win_func
  12642. Set windowing function.
  12643. It accepts the following values:
  12644. @table @samp
  12645. @item rect
  12646. @item bartlett
  12647. @item hanning
  12648. @item hamming
  12649. @item blackman
  12650. @item welch
  12651. @item flattop
  12652. @item bharris
  12653. @item bnuttall
  12654. @item bhann
  12655. @item sine
  12656. @item nuttall
  12657. @item lanczos
  12658. @item gauss
  12659. @item tukey
  12660. @end table
  12661. Default is @code{hanning}.
  12662. @item overlap
  12663. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12664. which means optimal overlap for selected window function will be picked.
  12665. @item averaging
  12666. Set time averaging. Setting this to 0 will display current maximal peaks.
  12667. Default is @code{1}, which means time averaging is disabled.
  12668. @item colors
  12669. Specify list of colors separated by space or by '|' which will be used to
  12670. draw channel frequencies. Unrecognized or missing colors will be replaced
  12671. by white color.
  12672. @item cmode
  12673. Set channel display mode.
  12674. It accepts the following values:
  12675. @table @samp
  12676. @item combined
  12677. @item separate
  12678. @end table
  12679. Default is @code{combined}.
  12680. @end table
  12681. @anchor{showspectrum}
  12682. @section showspectrum
  12683. Convert input audio to a video output, representing the audio frequency
  12684. spectrum.
  12685. The filter accepts the following options:
  12686. @table @option
  12687. @item size, s
  12688. Specify the video size for the output. For the syntax of this option, check the
  12689. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12690. Default value is @code{640x512}.
  12691. @item slide
  12692. Specify how the spectrum should slide along the window.
  12693. It accepts the following values:
  12694. @table @samp
  12695. @item replace
  12696. the samples start again on the left when they reach the right
  12697. @item scroll
  12698. the samples scroll from right to left
  12699. @item rscroll
  12700. the samples scroll from left to right
  12701. @item fullframe
  12702. frames are only produced when the samples reach the right
  12703. @end table
  12704. Default value is @code{replace}.
  12705. @item mode
  12706. Specify display mode.
  12707. It accepts the following values:
  12708. @table @samp
  12709. @item combined
  12710. all channels are displayed in the same row
  12711. @item separate
  12712. all channels are displayed in separate rows
  12713. @end table
  12714. Default value is @samp{combined}.
  12715. @item color
  12716. Specify display color mode.
  12717. It accepts the following values:
  12718. @table @samp
  12719. @item channel
  12720. each channel is displayed in a separate color
  12721. @item intensity
  12722. each channel is displayed using the same color scheme
  12723. @item rainbow
  12724. each channel is displayed using the rainbow color scheme
  12725. @item moreland
  12726. each channel is displayed using the moreland color scheme
  12727. @item nebulae
  12728. each channel is displayed using the nebulae color scheme
  12729. @item fire
  12730. each channel is displayed using the fire color scheme
  12731. @item fiery
  12732. each channel is displayed using the fiery color scheme
  12733. @item fruit
  12734. each channel is displayed using the fruit color scheme
  12735. @item cool
  12736. each channel is displayed using the cool color scheme
  12737. @end table
  12738. Default value is @samp{channel}.
  12739. @item scale
  12740. Specify scale used for calculating intensity color values.
  12741. It accepts the following values:
  12742. @table @samp
  12743. @item lin
  12744. linear
  12745. @item sqrt
  12746. square root, default
  12747. @item cbrt
  12748. cubic root
  12749. @item 4thrt
  12750. 4th root
  12751. @item 5thrt
  12752. 5th root
  12753. @item log
  12754. logarithmic
  12755. @end table
  12756. Default value is @samp{sqrt}.
  12757. @item saturation
  12758. Set saturation modifier for displayed colors. Negative values provide
  12759. alternative color scheme. @code{0} is no saturation at all.
  12760. Saturation must be in [-10.0, 10.0] range.
  12761. Default value is @code{1}.
  12762. @item win_func
  12763. Set window function.
  12764. It accepts the following values:
  12765. @table @samp
  12766. @item rect
  12767. @item bartlett
  12768. @item hann
  12769. @item hanning
  12770. @item hamming
  12771. @item blackman
  12772. @item welch
  12773. @item flattop
  12774. @item bharris
  12775. @item bnuttall
  12776. @item bhann
  12777. @item sine
  12778. @item nuttall
  12779. @item lanczos
  12780. @item gauss
  12781. @item tukey
  12782. @end table
  12783. Default value is @code{hann}.
  12784. @item orientation
  12785. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12786. @code{horizontal}. Default is @code{vertical}.
  12787. @item overlap
  12788. Set ratio of overlap window. Default value is @code{0}.
  12789. When value is @code{1} overlap is set to recommended size for specific
  12790. window function currently used.
  12791. @item gain
  12792. Set scale gain for calculating intensity color values.
  12793. Default value is @code{1}.
  12794. @item data
  12795. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12796. @item rotation
  12797. Set color rotation, must be in [-1.0, 1.0] range.
  12798. Default value is @code{0}.
  12799. @end table
  12800. The usage is very similar to the showwaves filter; see the examples in that
  12801. section.
  12802. @subsection Examples
  12803. @itemize
  12804. @item
  12805. Large window with logarithmic color scaling:
  12806. @example
  12807. showspectrum=s=1280x480:scale=log
  12808. @end example
  12809. @item
  12810. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12811. @example
  12812. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12813. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12814. @end example
  12815. @end itemize
  12816. @section showspectrumpic
  12817. Convert input audio to a single video frame, representing the audio frequency
  12818. spectrum.
  12819. The filter accepts the following options:
  12820. @table @option
  12821. @item size, s
  12822. Specify the video size for the output. For the syntax of this option, check the
  12823. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12824. Default value is @code{4096x2048}.
  12825. @item mode
  12826. Specify display mode.
  12827. It accepts the following values:
  12828. @table @samp
  12829. @item combined
  12830. all channels are displayed in the same row
  12831. @item separate
  12832. all channels are displayed in separate rows
  12833. @end table
  12834. Default value is @samp{combined}.
  12835. @item color
  12836. Specify display color mode.
  12837. It accepts the following values:
  12838. @table @samp
  12839. @item channel
  12840. each channel is displayed in a separate color
  12841. @item intensity
  12842. each channel is displayed using the same color scheme
  12843. @item rainbow
  12844. each channel is displayed using the rainbow color scheme
  12845. @item moreland
  12846. each channel is displayed using the moreland color scheme
  12847. @item nebulae
  12848. each channel is displayed using the nebulae color scheme
  12849. @item fire
  12850. each channel is displayed using the fire color scheme
  12851. @item fiery
  12852. each channel is displayed using the fiery color scheme
  12853. @item fruit
  12854. each channel is displayed using the fruit color scheme
  12855. @item cool
  12856. each channel is displayed using the cool color scheme
  12857. @end table
  12858. Default value is @samp{intensity}.
  12859. @item scale
  12860. Specify scale used for calculating intensity color values.
  12861. It accepts the following values:
  12862. @table @samp
  12863. @item lin
  12864. linear
  12865. @item sqrt
  12866. square root, default
  12867. @item cbrt
  12868. cubic root
  12869. @item 4thrt
  12870. 4th root
  12871. @item 5thrt
  12872. 5th root
  12873. @item log
  12874. logarithmic
  12875. @end table
  12876. Default value is @samp{log}.
  12877. @item saturation
  12878. Set saturation modifier for displayed colors. Negative values provide
  12879. alternative color scheme. @code{0} is no saturation at all.
  12880. Saturation must be in [-10.0, 10.0] range.
  12881. Default value is @code{1}.
  12882. @item win_func
  12883. Set window function.
  12884. It accepts the following values:
  12885. @table @samp
  12886. @item rect
  12887. @item bartlett
  12888. @item hann
  12889. @item hanning
  12890. @item hamming
  12891. @item blackman
  12892. @item welch
  12893. @item flattop
  12894. @item bharris
  12895. @item bnuttall
  12896. @item bhann
  12897. @item sine
  12898. @item nuttall
  12899. @item lanczos
  12900. @item gauss
  12901. @item tukey
  12902. @end table
  12903. Default value is @code{hann}.
  12904. @item orientation
  12905. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12906. @code{horizontal}. Default is @code{vertical}.
  12907. @item gain
  12908. Set scale gain for calculating intensity color values.
  12909. Default value is @code{1}.
  12910. @item legend
  12911. Draw time and frequency axes and legends. Default is enabled.
  12912. @item rotation
  12913. Set color rotation, must be in [-1.0, 1.0] range.
  12914. Default value is @code{0}.
  12915. @end table
  12916. @subsection Examples
  12917. @itemize
  12918. @item
  12919. Extract an audio spectrogram of a whole audio track
  12920. in a 1024x1024 picture using @command{ffmpeg}:
  12921. @example
  12922. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12923. @end example
  12924. @end itemize
  12925. @section showvolume
  12926. Convert input audio volume to a video output.
  12927. The filter accepts the following options:
  12928. @table @option
  12929. @item rate, r
  12930. Set video rate.
  12931. @item b
  12932. Set border width, allowed range is [0, 5]. Default is 1.
  12933. @item w
  12934. Set channel width, allowed range is [80, 8192]. Default is 400.
  12935. @item h
  12936. Set channel height, allowed range is [1, 900]. Default is 20.
  12937. @item f
  12938. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12939. @item c
  12940. Set volume color expression.
  12941. The expression can use the following variables:
  12942. @table @option
  12943. @item VOLUME
  12944. Current max volume of channel in dB.
  12945. @item CHANNEL
  12946. Current channel number, starting from 0.
  12947. @end table
  12948. @item t
  12949. If set, displays channel names. Default is enabled.
  12950. @item v
  12951. If set, displays volume values. Default is enabled.
  12952. @item o
  12953. Set orientation, can be @code{horizontal} or @code{vertical},
  12954. default is @code{horizontal}.
  12955. @item s
  12956. Set step size, allowed range s [0, 5]. Default is 0, which means
  12957. step is disabled.
  12958. @end table
  12959. @section showwaves
  12960. Convert input audio to a video output, representing the samples waves.
  12961. The filter accepts the following options:
  12962. @table @option
  12963. @item size, s
  12964. Specify the video size for the output. For the syntax of this option, check the
  12965. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12966. Default value is @code{600x240}.
  12967. @item mode
  12968. Set display mode.
  12969. Available values are:
  12970. @table @samp
  12971. @item point
  12972. Draw a point for each sample.
  12973. @item line
  12974. Draw a vertical line for each sample.
  12975. @item p2p
  12976. Draw a point for each sample and a line between them.
  12977. @item cline
  12978. Draw a centered vertical line for each sample.
  12979. @end table
  12980. Default value is @code{point}.
  12981. @item n
  12982. Set the number of samples which are printed on the same column. A
  12983. larger value will decrease the frame rate. Must be a positive
  12984. integer. This option can be set only if the value for @var{rate}
  12985. is not explicitly specified.
  12986. @item rate, r
  12987. Set the (approximate) output frame rate. This is done by setting the
  12988. option @var{n}. Default value is "25".
  12989. @item split_channels
  12990. Set if channels should be drawn separately or overlap. Default value is 0.
  12991. @item colors
  12992. Set colors separated by '|' which are going to be used for drawing of each channel.
  12993. @item scale
  12994. Set amplitude scale.
  12995. Available values are:
  12996. @table @samp
  12997. @item lin
  12998. Linear.
  12999. @item log
  13000. Logarithmic.
  13001. @item sqrt
  13002. Square root.
  13003. @item cbrt
  13004. Cubic root.
  13005. @end table
  13006. Default is linear.
  13007. @end table
  13008. @subsection Examples
  13009. @itemize
  13010. @item
  13011. Output the input file audio and the corresponding video representation
  13012. at the same time:
  13013. @example
  13014. amovie=a.mp3,asplit[out0],showwaves[out1]
  13015. @end example
  13016. @item
  13017. Create a synthetic signal and show it with showwaves, forcing a
  13018. frame rate of 30 frames per second:
  13019. @example
  13020. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13021. @end example
  13022. @end itemize
  13023. @section showwavespic
  13024. Convert input audio to a single video frame, representing the samples waves.
  13025. The filter accepts the following options:
  13026. @table @option
  13027. @item size, s
  13028. Specify the video size for the output. For the syntax of this option, check the
  13029. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13030. Default value is @code{600x240}.
  13031. @item split_channels
  13032. Set if channels should be drawn separately or overlap. Default value is 0.
  13033. @item colors
  13034. Set colors separated by '|' which are going to be used for drawing of each channel.
  13035. @item scale
  13036. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13037. Default is linear.
  13038. @end table
  13039. @subsection Examples
  13040. @itemize
  13041. @item
  13042. Extract a channel split representation of the wave form of a whole audio track
  13043. in a 1024x800 picture using @command{ffmpeg}:
  13044. @example
  13045. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13046. @end example
  13047. @end itemize
  13048. @section spectrumsynth
  13049. Sythesize audio from 2 input video spectrums, first input stream represents
  13050. magnitude across time and second represents phase across time.
  13051. The filter will transform from frequency domain as displayed in videos back
  13052. to time domain as presented in audio output.
  13053. This filter is primarly created for reversing processed @ref{showspectrum}
  13054. filter outputs, but can synthesize sound from other spectrograms too.
  13055. But in such case results are going to be poor if the phase data is not
  13056. available, because in such cases phase data need to be recreated, usually
  13057. its just recreated from random noise.
  13058. For best results use gray only output (@code{channel} color mode in
  13059. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13060. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13061. @code{data} option. Inputs videos should generally use @code{fullframe}
  13062. slide mode as that saves resources needed for decoding video.
  13063. The filter accepts the following options:
  13064. @table @option
  13065. @item sample_rate
  13066. Specify sample rate of output audio, the sample rate of audio from which
  13067. spectrum was generated may differ.
  13068. @item channels
  13069. Set number of channels represented in input video spectrums.
  13070. @item scale
  13071. Set scale which was used when generating magnitude input spectrum.
  13072. Can be @code{lin} or @code{log}. Default is @code{log}.
  13073. @item slide
  13074. Set slide which was used when generating inputs spectrums.
  13075. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13076. Default is @code{fullframe}.
  13077. @item win_func
  13078. Set window function used for resynthesis.
  13079. @item overlap
  13080. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13081. which means optimal overlap for selected window function will be picked.
  13082. @item orientation
  13083. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13084. Default is @code{vertical}.
  13085. @end table
  13086. @subsection Examples
  13087. @itemize
  13088. @item
  13089. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13090. then resynthesize videos back to audio with spectrumsynth:
  13091. @example
  13092. 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
  13093. 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
  13094. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13095. @end example
  13096. @end itemize
  13097. @section split, asplit
  13098. Split input into several identical outputs.
  13099. @code{asplit} works with audio input, @code{split} with video.
  13100. The filter accepts a single parameter which specifies the number of outputs. If
  13101. unspecified, it defaults to 2.
  13102. @subsection Examples
  13103. @itemize
  13104. @item
  13105. Create two separate outputs from the same input:
  13106. @example
  13107. [in] split [out0][out1]
  13108. @end example
  13109. @item
  13110. To create 3 or more outputs, you need to specify the number of
  13111. outputs, like in:
  13112. @example
  13113. [in] asplit=3 [out0][out1][out2]
  13114. @end example
  13115. @item
  13116. Create two separate outputs from the same input, one cropped and
  13117. one padded:
  13118. @example
  13119. [in] split [splitout1][splitout2];
  13120. [splitout1] crop=100:100:0:0 [cropout];
  13121. [splitout2] pad=200:200:100:100 [padout];
  13122. @end example
  13123. @item
  13124. Create 5 copies of the input audio with @command{ffmpeg}:
  13125. @example
  13126. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13127. @end example
  13128. @end itemize
  13129. @section zmq, azmq
  13130. Receive commands sent through a libzmq client, and forward them to
  13131. filters in the filtergraph.
  13132. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13133. must be inserted between two video filters, @code{azmq} between two
  13134. audio filters.
  13135. To enable these filters you need to install the libzmq library and
  13136. headers and configure FFmpeg with @code{--enable-libzmq}.
  13137. For more information about libzmq see:
  13138. @url{http://www.zeromq.org/}
  13139. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13140. receives messages sent through a network interface defined by the
  13141. @option{bind_address} option.
  13142. The received message must be in the form:
  13143. @example
  13144. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13145. @end example
  13146. @var{TARGET} specifies the target of the command, usually the name of
  13147. the filter class or a specific filter instance name.
  13148. @var{COMMAND} specifies the name of the command for the target filter.
  13149. @var{ARG} is optional and specifies the optional argument list for the
  13150. given @var{COMMAND}.
  13151. Upon reception, the message is processed and the corresponding command
  13152. is injected into the filtergraph. Depending on the result, the filter
  13153. will send a reply to the client, adopting the format:
  13154. @example
  13155. @var{ERROR_CODE} @var{ERROR_REASON}
  13156. @var{MESSAGE}
  13157. @end example
  13158. @var{MESSAGE} is optional.
  13159. @subsection Examples
  13160. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13161. be used to send commands processed by these filters.
  13162. Consider the following filtergraph generated by @command{ffplay}
  13163. @example
  13164. ffplay -dumpgraph 1 -f lavfi "
  13165. color=s=100x100:c=red [l];
  13166. color=s=100x100:c=blue [r];
  13167. nullsrc=s=200x100, zmq [bg];
  13168. [bg][l] overlay [bg+l];
  13169. [bg+l][r] overlay=x=100 "
  13170. @end example
  13171. To change the color of the left side of the video, the following
  13172. command can be used:
  13173. @example
  13174. echo Parsed_color_0 c yellow | tools/zmqsend
  13175. @end example
  13176. To change the right side:
  13177. @example
  13178. echo Parsed_color_1 c pink | tools/zmqsend
  13179. @end example
  13180. @c man end MULTIMEDIA FILTERS
  13181. @chapter Multimedia Sources
  13182. @c man begin MULTIMEDIA SOURCES
  13183. Below is a description of the currently available multimedia sources.
  13184. @section amovie
  13185. This is the same as @ref{movie} source, except it selects an audio
  13186. stream by default.
  13187. @anchor{movie}
  13188. @section movie
  13189. Read audio and/or video stream(s) from a movie container.
  13190. It accepts the following parameters:
  13191. @table @option
  13192. @item filename
  13193. The name of the resource to read (not necessarily a file; it can also be a
  13194. device or a stream accessed through some protocol).
  13195. @item format_name, f
  13196. Specifies the format assumed for the movie to read, and can be either
  13197. the name of a container or an input device. If not specified, the
  13198. format is guessed from @var{movie_name} or by probing.
  13199. @item seek_point, sp
  13200. Specifies the seek point in seconds. The frames will be output
  13201. starting from this seek point. The parameter is evaluated with
  13202. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13203. postfix. The default value is "0".
  13204. @item streams, s
  13205. Specifies the streams to read. Several streams can be specified,
  13206. separated by "+". The source will then have as many outputs, in the
  13207. same order. The syntax is explained in the ``Stream specifiers''
  13208. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13209. respectively the default (best suited) video and audio stream. Default
  13210. is "dv", or "da" if the filter is called as "amovie".
  13211. @item stream_index, si
  13212. Specifies the index of the video stream to read. If the value is -1,
  13213. the most suitable video stream will be automatically selected. The default
  13214. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13215. audio instead of video.
  13216. @item loop
  13217. Specifies how many times to read the stream in sequence.
  13218. If the value is less than 1, the stream will be read again and again.
  13219. Default value is "1".
  13220. Note that when the movie is looped the source timestamps are not
  13221. changed, so it will generate non monotonically increasing timestamps.
  13222. @item discontinuity
  13223. Specifies the time difference between frames above which the point is
  13224. considered a timestamp discontinuity which is removed by adjusting the later
  13225. timestamps.
  13226. @end table
  13227. It allows overlaying a second video on top of the main input of
  13228. a filtergraph, as shown in this graph:
  13229. @example
  13230. input -----------> deltapts0 --> overlay --> output
  13231. ^
  13232. |
  13233. movie --> scale--> deltapts1 -------+
  13234. @end example
  13235. @subsection Examples
  13236. @itemize
  13237. @item
  13238. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13239. on top of the input labelled "in":
  13240. @example
  13241. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13242. [in] setpts=PTS-STARTPTS [main];
  13243. [main][over] overlay=16:16 [out]
  13244. @end example
  13245. @item
  13246. Read from a video4linux2 device, and overlay it on top of the input
  13247. labelled "in":
  13248. @example
  13249. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13250. [in] setpts=PTS-STARTPTS [main];
  13251. [main][over] overlay=16:16 [out]
  13252. @end example
  13253. @item
  13254. Read the first video stream and the audio stream with id 0x81 from
  13255. dvd.vob; the video is connected to the pad named "video" and the audio is
  13256. connected to the pad named "audio":
  13257. @example
  13258. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13259. @end example
  13260. @end itemize
  13261. @subsection Commands
  13262. Both movie and amovie support the following commands:
  13263. @table @option
  13264. @item seek
  13265. Perform seek using "av_seek_frame".
  13266. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13267. @itemize
  13268. @item
  13269. @var{stream_index}: If stream_index is -1, a default
  13270. stream is selected, and @var{timestamp} is automatically converted
  13271. from AV_TIME_BASE units to the stream specific time_base.
  13272. @item
  13273. @var{timestamp}: Timestamp in AVStream.time_base units
  13274. or, if no stream is specified, in AV_TIME_BASE units.
  13275. @item
  13276. @var{flags}: Flags which select direction and seeking mode.
  13277. @end itemize
  13278. @item get_duration
  13279. Get movie duration in AV_TIME_BASE units.
  13280. @end table
  13281. @c man end MULTIMEDIA SOURCES