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.

18242 lines
486KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. See @code{ffmpeg -filters} to view which filters have timeline support.
  248. @c man end FILTERGRAPH DESCRIPTION
  249. @chapter Audio Filters
  250. @c man begin AUDIO FILTERS
  251. When you configure your FFmpeg build, you can disable any of the
  252. existing filters using @code{--disable-filters}.
  253. The configure output will show the audio filters included in your
  254. build.
  255. Below is a description of the currently available audio filters.
  256. @section acompressor
  257. A compressor is mainly used to reduce the dynamic range of a signal.
  258. Especially modern music is mostly compressed at a high ratio to
  259. improve the overall loudness. It's done to get the highest attention
  260. of a listener, "fatten" the sound and bring more "power" to the track.
  261. If a signal is compressed too much it may sound dull or "dead"
  262. afterwards or it may start to "pump" (which could be a powerful effect
  263. but can also destroy a track completely).
  264. The right compression is the key to reach a professional sound and is
  265. the high art of mixing and mastering. Because of its complex settings
  266. it may take a long time to get the right feeling for this kind of effect.
  267. Compression is done by detecting the volume above a chosen level
  268. @code{threshold} and dividing it by the factor set with @code{ratio}.
  269. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  270. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  271. the signal would cause distortion of the waveform the reduction can be
  272. levelled over the time. This is done by setting "Attack" and "Release".
  273. @code{attack} determines how long the signal has to rise above the threshold
  274. before any reduction will occur and @code{release} sets the time the signal
  275. has to fall below the threshold to reduce the reduction again. Shorter signals
  276. than the chosen attack time will be left untouched.
  277. The overall reduction of the signal can be made up afterwards with the
  278. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  279. raising the makeup to this level results in a signal twice as loud than the
  280. source. To gain a softer entry in the compression the @code{knee} flattens the
  281. hard edge at the threshold in the range of the chosen decibels.
  282. The filter accepts the following options:
  283. @table @option
  284. @item level_in
  285. Set input gain. Default is 1. Range is between 0.015625 and 64.
  286. @item threshold
  287. If a signal of second stream rises above this level it will affect the gain
  288. reduction of the first stream.
  289. By default it is 0.125. Range is between 0.00097563 and 1.
  290. @item ratio
  291. Set a ratio by which the signal is reduced. 1:2 means that if the level
  292. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  293. Default is 2. Range is between 1 and 20.
  294. @item attack
  295. Amount of milliseconds the signal has to rise above the threshold before gain
  296. reduction starts. Default is 20. Range is between 0.01 and 2000.
  297. @item release
  298. Amount of milliseconds the signal has to fall below the threshold before
  299. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  300. @item makeup
  301. Set the amount by how much signal will be amplified after processing.
  302. Default is 2. Range is from 1 and 64.
  303. @item knee
  304. Curve the sharp knee around the threshold to enter gain reduction more softly.
  305. Default is 2.82843. Range is between 1 and 8.
  306. @item link
  307. Choose if the @code{average} level between all channels of input stream
  308. or the louder(@code{maximum}) channel of input stream affects the
  309. reduction. Default is @code{average}.
  310. @item detection
  311. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  312. of @code{rms}. Default is @code{rms} which is mostly smoother.
  313. @item mix
  314. How much to use compressed signal in output. Default is 1.
  315. Range is between 0 and 1.
  316. @end table
  317. @section acrossfade
  318. Apply cross fade from one input audio stream to another input audio stream.
  319. The cross fade is applied for specified duration near the end of first stream.
  320. The filter accepts the following options:
  321. @table @option
  322. @item nb_samples, ns
  323. Specify the number of samples for which the cross fade effect has to last.
  324. At the end of the cross fade effect the first input audio will be completely
  325. silent. Default is 44100.
  326. @item duration, d
  327. Specify the duration of the cross fade effect. See
  328. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  329. for the accepted syntax.
  330. By default the duration is determined by @var{nb_samples}.
  331. If set this option is used instead of @var{nb_samples}.
  332. @item overlap, o
  333. Should first stream end overlap with second stream start. Default is enabled.
  334. @item curve1
  335. Set curve for cross fade transition for first stream.
  336. @item curve2
  337. Set curve for cross fade transition for second stream.
  338. For description of available curve types see @ref{afade} filter description.
  339. @end table
  340. @subsection Examples
  341. @itemize
  342. @item
  343. Cross fade from one input to another:
  344. @example
  345. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  346. @end example
  347. @item
  348. Cross fade from one input to another but without overlapping:
  349. @example
  350. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  351. @end example
  352. @end itemize
  353. @section acrusher
  354. Reduce audio bit resolution.
  355. This filter is bit crusher with enhanced functionality. A bit crusher
  356. is used to audibly reduce number of bits an audio signal is sampled
  357. with. This doesn't change the bit depth at all, it just produces the
  358. effect. Material reduced in bit depth sounds more harsh and "digital".
  359. This filter is able to even round to continuous values instead of discrete
  360. bit depths.
  361. Additionally it has a D/C offset which results in different crushing of
  362. the lower and the upper half of the signal.
  363. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  364. Another feature of this filter is the logarithmic mode.
  365. This setting switches from linear distances between bits to logarithmic ones.
  366. The result is a much more "natural" sounding crusher which doesn't gate low
  367. signals for example. The human ear has a logarithmic perception, too
  368. so this kind of crushing is much more pleasant.
  369. Logarithmic crushing is also able to get anti-aliased.
  370. The filter accepts the following options:
  371. @table @option
  372. @item level_in
  373. Set level in.
  374. @item level_out
  375. Set level out.
  376. @item bits
  377. Set bit reduction.
  378. @item mix
  379. Set mixing amount.
  380. @item mode
  381. Can be linear: @code{lin} or logarithmic: @code{log}.
  382. @item dc
  383. Set DC.
  384. @item aa
  385. Set anti-aliasing.
  386. @item samples
  387. Set sample reduction.
  388. @item lfo
  389. Enable LFO. By default disabled.
  390. @item lforange
  391. Set LFO range.
  392. @item lforate
  393. Set LFO rate.
  394. @end table
  395. @section adelay
  396. Delay one or more audio channels.
  397. Samples in delayed channel are filled with silence.
  398. The filter accepts the following option:
  399. @table @option
  400. @item delays
  401. Set list of delays in milliseconds for each channel separated by '|'.
  402. At least one delay greater than 0 should be provided.
  403. Unused delays will be silently ignored. If number of given delays is
  404. smaller than number of channels all remaining channels will not be delayed.
  405. If you want to delay exact number of samples, append 'S' to number.
  406. @end table
  407. @subsection Examples
  408. @itemize
  409. @item
  410. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  411. the second channel (and any other channels that may be present) unchanged.
  412. @example
  413. adelay=1500|0|500
  414. @end example
  415. @item
  416. Delay second channel by 500 samples, the third channel by 700 samples and leave
  417. the first channel (and any other channels that may be present) unchanged.
  418. @example
  419. adelay=0|500S|700S
  420. @end example
  421. @end itemize
  422. @section aecho
  423. Apply echoing to the input audio.
  424. Echoes are reflected sound and can occur naturally amongst mountains
  425. (and sometimes large buildings) when talking or shouting; digital echo
  426. effects emulate this behaviour and are often used to help fill out the
  427. sound of a single instrument or vocal. The time difference between the
  428. original signal and the reflection is the @code{delay}, and the
  429. loudness of the reflected signal is the @code{decay}.
  430. Multiple echoes can have different delays and decays.
  431. A description of the accepted parameters follows.
  432. @table @option
  433. @item in_gain
  434. Set input gain of reflected signal. Default is @code{0.6}.
  435. @item out_gain
  436. Set output gain of reflected signal. Default is @code{0.3}.
  437. @item delays
  438. Set list of time intervals in milliseconds between original signal and reflections
  439. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  440. Default is @code{1000}.
  441. @item decays
  442. Set list of loudnesses of reflected signals separated by '|'.
  443. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  444. Default is @code{0.5}.
  445. @end table
  446. @subsection Examples
  447. @itemize
  448. @item
  449. Make it sound as if there are twice as many instruments as are actually playing:
  450. @example
  451. aecho=0.8:0.88:60:0.4
  452. @end example
  453. @item
  454. If delay is very short, then it sound like a (metallic) robot playing music:
  455. @example
  456. aecho=0.8:0.88:6:0.4
  457. @end example
  458. @item
  459. A longer delay will sound like an open air concert in the mountains:
  460. @example
  461. aecho=0.8:0.9:1000:0.3
  462. @end example
  463. @item
  464. Same as above but with one more mountain:
  465. @example
  466. aecho=0.8:0.9:1000|1800:0.3|0.25
  467. @end example
  468. @end itemize
  469. @section aemphasis
  470. Audio emphasis filter creates or restores material directly taken from LPs or
  471. emphased CDs with different filter curves. E.g. to store music on vinyl the
  472. signal has to be altered by a filter first to even out the disadvantages of
  473. this recording medium.
  474. Once the material is played back the inverse filter has to be applied to
  475. restore the distortion of the frequency response.
  476. The filter accepts the following options:
  477. @table @option
  478. @item level_in
  479. Set input gain.
  480. @item level_out
  481. Set output gain.
  482. @item mode
  483. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  484. use @code{production} mode. Default is @code{reproduction} mode.
  485. @item type
  486. Set filter type. Selects medium. Can be one of the following:
  487. @table @option
  488. @item col
  489. select Columbia.
  490. @item emi
  491. select EMI.
  492. @item bsi
  493. select BSI (78RPM).
  494. @item riaa
  495. select RIAA.
  496. @item cd
  497. select Compact Disc (CD).
  498. @item 50fm
  499. select 50µs (FM).
  500. @item 75fm
  501. select 75µs (FM).
  502. @item 50kf
  503. select 50µs (FM-KF).
  504. @item 75kf
  505. select 75µs (FM-KF).
  506. @end table
  507. @end table
  508. @section aeval
  509. Modify an audio signal according to the specified expressions.
  510. This filter accepts one or more expressions (one for each channel),
  511. which are evaluated and used to modify a corresponding audio signal.
  512. It accepts the following parameters:
  513. @table @option
  514. @item exprs
  515. Set the '|'-separated expressions list for each separate channel. If
  516. the number of input channels is greater than the number of
  517. expressions, the last specified expression is used for the remaining
  518. output channels.
  519. @item channel_layout, c
  520. Set output channel layout. If not specified, the channel layout is
  521. specified by the number of expressions. If set to @samp{same}, it will
  522. use by default the same input channel layout.
  523. @end table
  524. Each expression in @var{exprs} can contain the following constants and functions:
  525. @table @option
  526. @item ch
  527. channel number of the current expression
  528. @item n
  529. number of the evaluated sample, starting from 0
  530. @item s
  531. sample rate
  532. @item t
  533. time of the evaluated sample expressed in seconds
  534. @item nb_in_channels
  535. @item nb_out_channels
  536. input and output number of channels
  537. @item val(CH)
  538. the value of input channel with number @var{CH}
  539. @end table
  540. Note: this filter is slow. For faster processing you should use a
  541. dedicated filter.
  542. @subsection Examples
  543. @itemize
  544. @item
  545. Half volume:
  546. @example
  547. aeval=val(ch)/2:c=same
  548. @end example
  549. @item
  550. Invert phase of the second channel:
  551. @example
  552. aeval=val(0)|-val(1)
  553. @end example
  554. @end itemize
  555. @anchor{afade}
  556. @section afade
  557. Apply fade-in/out effect to input audio.
  558. A description of the accepted parameters follows.
  559. @table @option
  560. @item type, t
  561. Specify the effect type, can be either @code{in} for fade-in, or
  562. @code{out} for a fade-out effect. Default is @code{in}.
  563. @item start_sample, ss
  564. Specify the number of the start sample for starting to apply the fade
  565. effect. Default is 0.
  566. @item nb_samples, ns
  567. Specify the number of samples for which the fade effect has to last. At
  568. the end of the fade-in effect the output audio will have the same
  569. volume as the input audio, at the end of the fade-out transition
  570. the output audio will be silence. Default is 44100.
  571. @item start_time, st
  572. Specify the start time of the fade effect. Default is 0.
  573. The value must be specified as a time duration; see
  574. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  575. for the accepted syntax.
  576. If set this option is used instead of @var{start_sample}.
  577. @item duration, d
  578. Specify the duration of the fade effect. See
  579. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  580. for the accepted syntax.
  581. At the end of the fade-in effect the output audio will have the same
  582. volume as the input audio, at the end of the fade-out transition
  583. the output audio will be silence.
  584. By default the duration is determined by @var{nb_samples}.
  585. If set this option is used instead of @var{nb_samples}.
  586. @item curve
  587. Set curve for fade transition.
  588. It accepts the following values:
  589. @table @option
  590. @item tri
  591. select triangular, linear slope (default)
  592. @item qsin
  593. select quarter of sine wave
  594. @item hsin
  595. select half of sine wave
  596. @item esin
  597. select exponential sine wave
  598. @item log
  599. select logarithmic
  600. @item ipar
  601. select inverted parabola
  602. @item qua
  603. select quadratic
  604. @item cub
  605. select cubic
  606. @item squ
  607. select square root
  608. @item cbr
  609. select cubic root
  610. @item par
  611. select parabola
  612. @item exp
  613. select exponential
  614. @item iqsin
  615. select inverted quarter of sine wave
  616. @item ihsin
  617. select inverted half of sine wave
  618. @item dese
  619. select double-exponential seat
  620. @item desi
  621. select double-exponential sigmoid
  622. @end table
  623. @end table
  624. @subsection Examples
  625. @itemize
  626. @item
  627. Fade in first 15 seconds of audio:
  628. @example
  629. afade=t=in:ss=0:d=15
  630. @end example
  631. @item
  632. Fade out last 25 seconds of a 900 seconds audio:
  633. @example
  634. afade=t=out:st=875:d=25
  635. @end example
  636. @end itemize
  637. @section afftfilt
  638. Apply arbitrary expressions to samples in frequency domain.
  639. @table @option
  640. @item real
  641. Set frequency domain real expression for each separate channel separated
  642. by '|'. Default is "1".
  643. If the number of input channels is greater than the number of
  644. expressions, the last specified expression is used for the remaining
  645. output channels.
  646. @item imag
  647. Set frequency domain imaginary expression for each separate channel
  648. separated by '|'. If not set, @var{real} option is used.
  649. Each expression in @var{real} and @var{imag} can contain the following
  650. constants:
  651. @table @option
  652. @item sr
  653. sample rate
  654. @item b
  655. current frequency bin number
  656. @item nb
  657. number of available bins
  658. @item ch
  659. channel number of the current expression
  660. @item chs
  661. number of channels
  662. @item pts
  663. current frame pts
  664. @end table
  665. @item win_size
  666. Set window size.
  667. It accepts the following values:
  668. @table @samp
  669. @item w16
  670. @item w32
  671. @item w64
  672. @item w128
  673. @item w256
  674. @item w512
  675. @item w1024
  676. @item w2048
  677. @item w4096
  678. @item w8192
  679. @item w16384
  680. @item w32768
  681. @item w65536
  682. @end table
  683. Default is @code{w4096}
  684. @item win_func
  685. Set window function. Default is @code{hann}.
  686. @item overlap
  687. Set window overlap. If set to 1, the recommended overlap for selected
  688. window function will be picked. Default is @code{0.75}.
  689. @end table
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Leave almost only low frequencies in audio:
  694. @example
  695. afftfilt="1-clip((b/nb)*b,0,1)"
  696. @end example
  697. @end itemize
  698. @anchor{aformat}
  699. @section aformat
  700. Set output format constraints for the input audio. The framework will
  701. negotiate the most appropriate format to minimize conversions.
  702. It accepts the following parameters:
  703. @table @option
  704. @item sample_fmts
  705. A '|'-separated list of requested sample formats.
  706. @item sample_rates
  707. A '|'-separated list of requested sample rates.
  708. @item channel_layouts
  709. A '|'-separated list of requested channel layouts.
  710. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  711. for the required syntax.
  712. @end table
  713. If a parameter is omitted, all values are allowed.
  714. Force the output to either unsigned 8-bit or signed 16-bit stereo
  715. @example
  716. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  717. @end example
  718. @section agate
  719. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  720. processing reduces disturbing noise between useful signals.
  721. Gating is done by detecting the volume below a chosen level @var{threshold}
  722. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  723. floor is set via @var{range}. Because an exact manipulation of the signal
  724. would cause distortion of the waveform the reduction can be levelled over
  725. time. This is done by setting @var{attack} and @var{release}.
  726. @var{attack} determines how long the signal has to fall below the threshold
  727. before any reduction will occur and @var{release} sets the time the signal
  728. has to rise above the threshold to reduce the reduction again.
  729. Shorter signals than the chosen attack time will be left untouched.
  730. @table @option
  731. @item level_in
  732. Set input level before filtering.
  733. Default is 1. Allowed range is from 0.015625 to 64.
  734. @item range
  735. Set the level of gain reduction when the signal is below the threshold.
  736. Default is 0.06125. Allowed range is from 0 to 1.
  737. @item threshold
  738. If a signal rises above this level the gain reduction is released.
  739. Default is 0.125. Allowed range is from 0 to 1.
  740. @item ratio
  741. Set a ratio by which the signal is reduced.
  742. Default is 2. Allowed range is from 1 to 9000.
  743. @item attack
  744. Amount of milliseconds the signal has to rise above the threshold before gain
  745. reduction stops.
  746. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  747. @item release
  748. Amount of milliseconds the signal has to fall below the threshold before the
  749. reduction is increased again. Default is 250 milliseconds.
  750. Allowed range is from 0.01 to 9000.
  751. @item makeup
  752. Set amount of amplification of signal after processing.
  753. Default is 1. Allowed range is from 1 to 64.
  754. @item knee
  755. Curve the sharp knee around the threshold to enter gain reduction more softly.
  756. Default is 2.828427125. Allowed range is from 1 to 8.
  757. @item detection
  758. Choose if exact signal should be taken for detection or an RMS like one.
  759. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  760. @item link
  761. Choose if the average level between all channels or the louder channel affects
  762. the reduction.
  763. Default is @code{average}. Can be @code{average} or @code{maximum}.
  764. @end table
  765. @section alimiter
  766. The limiter prevents an input signal from rising over a desired threshold.
  767. This limiter uses lookahead technology to prevent your signal from distorting.
  768. It means that there is a small delay after the signal is processed. Keep in mind
  769. that the delay it produces is the attack time you set.
  770. The filter accepts the following options:
  771. @table @option
  772. @item level_in
  773. Set input gain. Default is 1.
  774. @item level_out
  775. Set output gain. Default is 1.
  776. @item limit
  777. Don't let signals above this level pass the limiter. Default is 1.
  778. @item attack
  779. The limiter will reach its attenuation level in this amount of time in
  780. milliseconds. Default is 5 milliseconds.
  781. @item release
  782. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  783. Default is 50 milliseconds.
  784. @item asc
  785. When gain reduction is always needed ASC takes care of releasing to an
  786. average reduction level rather than reaching a reduction of 0 in the release
  787. time.
  788. @item asc_level
  789. Select how much the release time is affected by ASC, 0 means nearly no changes
  790. in release time while 1 produces higher release times.
  791. @item level
  792. Auto level output signal. Default is enabled.
  793. This normalizes audio back to 0dB if enabled.
  794. @end table
  795. Depending on picked setting it is recommended to upsample input 2x or 4x times
  796. with @ref{aresample} before applying this filter.
  797. @section allpass
  798. Apply a two-pole all-pass filter with central frequency (in Hz)
  799. @var{frequency}, and filter-width @var{width}.
  800. An all-pass filter changes the audio's frequency to phase relationship
  801. without changing its frequency to amplitude relationship.
  802. The filter accepts the following options:
  803. @table @option
  804. @item frequency, f
  805. Set frequency in Hz.
  806. @item width_type
  807. Set method to specify band-width of filter.
  808. @table @option
  809. @item h
  810. Hz
  811. @item q
  812. Q-Factor
  813. @item o
  814. octave
  815. @item s
  816. slope
  817. @end table
  818. @item width, w
  819. Specify the band-width of a filter in width_type units.
  820. @end table
  821. @section aloop
  822. Loop audio samples.
  823. The filter accepts the following options:
  824. @table @option
  825. @item loop
  826. Set the number of loops.
  827. @item size
  828. Set maximal number of samples.
  829. @item start
  830. Set first sample of loop.
  831. @end table
  832. @anchor{amerge}
  833. @section amerge
  834. Merge two or more audio streams into a single multi-channel stream.
  835. The filter accepts the following options:
  836. @table @option
  837. @item inputs
  838. Set the number of inputs. Default is 2.
  839. @end table
  840. If the channel layouts of the inputs are disjoint, and therefore compatible,
  841. the channel layout of the output will be set accordingly and the channels
  842. will be reordered as necessary. If the channel layouts of the inputs are not
  843. disjoint, the output will have all the channels of the first input then all
  844. the channels of the second input, in that order, and the channel layout of
  845. the output will be the default value corresponding to the total number of
  846. channels.
  847. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  848. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  849. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  850. first input, b1 is the first channel of the second input).
  851. On the other hand, if both input are in stereo, the output channels will be
  852. in the default order: a1, a2, b1, b2, and the channel layout will be
  853. arbitrarily set to 4.0, which may or may not be the expected value.
  854. All inputs must have the same sample rate, and format.
  855. If inputs do not have the same duration, the output will stop with the
  856. shortest.
  857. @subsection Examples
  858. @itemize
  859. @item
  860. Merge two mono files into a stereo stream:
  861. @example
  862. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  863. @end example
  864. @item
  865. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  866. @example
  867. 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
  868. @end example
  869. @end itemize
  870. @section amix
  871. Mixes multiple audio inputs into a single output.
  872. Note that this filter only supports float samples (the @var{amerge}
  873. and @var{pan} audio filters support many formats). If the @var{amix}
  874. input has integer samples then @ref{aresample} will be automatically
  875. inserted to perform the conversion to float samples.
  876. For example
  877. @example
  878. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  879. @end example
  880. will mix 3 input audio streams to a single output with the same duration as the
  881. first input and a dropout transition time of 3 seconds.
  882. It accepts the following parameters:
  883. @table @option
  884. @item inputs
  885. The number of inputs. If unspecified, it defaults to 2.
  886. @item duration
  887. How to determine the end-of-stream.
  888. @table @option
  889. @item longest
  890. The duration of the longest input. (default)
  891. @item shortest
  892. The duration of the shortest input.
  893. @item first
  894. The duration of the first input.
  895. @end table
  896. @item dropout_transition
  897. The transition time, in seconds, for volume renormalization when an input
  898. stream ends. The default value is 2 seconds.
  899. @end table
  900. @section anequalizer
  901. High-order parametric multiband equalizer for each channel.
  902. It accepts the following parameters:
  903. @table @option
  904. @item params
  905. This option string is in format:
  906. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  907. Each equalizer band is separated by '|'.
  908. @table @option
  909. @item chn
  910. Set channel number to which equalization will be applied.
  911. If input doesn't have that channel the entry is ignored.
  912. @item f
  913. Set central frequency for band.
  914. If input doesn't have that frequency the entry is ignored.
  915. @item w
  916. Set band width in hertz.
  917. @item g
  918. Set band gain in dB.
  919. @item t
  920. Set filter type for band, optional, can be:
  921. @table @samp
  922. @item 0
  923. Butterworth, this is default.
  924. @item 1
  925. Chebyshev type 1.
  926. @item 2
  927. Chebyshev type 2.
  928. @end table
  929. @end table
  930. @item curves
  931. With this option activated frequency response of anequalizer is displayed
  932. in video stream.
  933. @item size
  934. Set video stream size. Only useful if curves option is activated.
  935. @item mgain
  936. Set max gain that will be displayed. Only useful if curves option is activated.
  937. Setting this to a reasonable value makes it possible to display gain which is derived from
  938. neighbour bands which are too close to each other and thus produce higher gain
  939. when both are activated.
  940. @item fscale
  941. Set frequency scale used to draw frequency response in video output.
  942. Can be linear or logarithmic. Default is logarithmic.
  943. @item colors
  944. Set color for each channel curve which is going to be displayed in video stream.
  945. This is list of color names separated by space or by '|'.
  946. Unrecognised or missing colors will be replaced by white color.
  947. @end table
  948. @subsection Examples
  949. @itemize
  950. @item
  951. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  952. for first 2 channels using Chebyshev type 1 filter:
  953. @example
  954. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  955. @end example
  956. @end itemize
  957. @subsection Commands
  958. This filter supports the following commands:
  959. @table @option
  960. @item change
  961. Alter existing filter parameters.
  962. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  963. @var{fN} is existing filter number, starting from 0, if no such filter is available
  964. error is returned.
  965. @var{freq} set new frequency parameter.
  966. @var{width} set new width parameter in herz.
  967. @var{gain} set new gain parameter in dB.
  968. Full filter invocation with asendcmd may look like this:
  969. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  970. @end table
  971. @section anull
  972. Pass the audio source unchanged to the output.
  973. @section apad
  974. Pad the end of an audio stream with silence.
  975. This can be used together with @command{ffmpeg} @option{-shortest} to
  976. extend audio streams to the same length as the video stream.
  977. A description of the accepted options follows.
  978. @table @option
  979. @item packet_size
  980. Set silence packet size. Default value is 4096.
  981. @item pad_len
  982. Set the number of samples of silence to add to the end. After the
  983. value is reached, the stream is terminated. This option is mutually
  984. exclusive with @option{whole_len}.
  985. @item whole_len
  986. Set the minimum total number of samples in the output audio stream. If
  987. the value is longer than the input audio length, silence is added to
  988. the end, until the value is reached. This option is mutually exclusive
  989. with @option{pad_len}.
  990. @end table
  991. If neither the @option{pad_len} nor the @option{whole_len} option is
  992. set, the filter will add silence to the end of the input stream
  993. indefinitely.
  994. @subsection Examples
  995. @itemize
  996. @item
  997. Add 1024 samples of silence to the end of the input:
  998. @example
  999. apad=pad_len=1024
  1000. @end example
  1001. @item
  1002. Make sure the audio output will contain at least 10000 samples, pad
  1003. the input with silence if required:
  1004. @example
  1005. apad=whole_len=10000
  1006. @end example
  1007. @item
  1008. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1009. video stream will always result the shortest and will be converted
  1010. until the end in the output file when using the @option{shortest}
  1011. option:
  1012. @example
  1013. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1014. @end example
  1015. @end itemize
  1016. @section aphaser
  1017. Add a phasing effect to the input audio.
  1018. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1019. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1020. A description of the accepted parameters follows.
  1021. @table @option
  1022. @item in_gain
  1023. Set input gain. Default is 0.4.
  1024. @item out_gain
  1025. Set output gain. Default is 0.74
  1026. @item delay
  1027. Set delay in milliseconds. Default is 3.0.
  1028. @item decay
  1029. Set decay. Default is 0.4.
  1030. @item speed
  1031. Set modulation speed in Hz. Default is 0.5.
  1032. @item type
  1033. Set modulation type. Default is triangular.
  1034. It accepts the following values:
  1035. @table @samp
  1036. @item triangular, t
  1037. @item sinusoidal, s
  1038. @end table
  1039. @end table
  1040. @section apulsator
  1041. Audio pulsator is something between an autopanner and a tremolo.
  1042. But it can produce funny stereo effects as well. Pulsator changes the volume
  1043. of the left and right channel based on a LFO (low frequency oscillator) with
  1044. different waveforms and shifted phases.
  1045. This filter have the ability to define an offset between left and right
  1046. channel. An offset of 0 means that both LFO shapes match each other.
  1047. The left and right channel are altered equally - a conventional tremolo.
  1048. An offset of 50% means that the shape of the right channel is exactly shifted
  1049. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1050. an autopanner. At 1 both curves match again. Every setting in between moves the
  1051. phase shift gapless between all stages and produces some "bypassing" sounds with
  1052. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1053. the 0.5) the faster the signal passes from the left to the right speaker.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item level_in
  1057. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1058. @item level_out
  1059. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1060. @item mode
  1061. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1062. sawup or sawdown. Default is sine.
  1063. @item amount
  1064. Set modulation. Define how much of original signal is affected by the LFO.
  1065. @item offset_l
  1066. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1067. @item offset_r
  1068. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1069. @item width
  1070. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1071. @item timing
  1072. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1073. @item bpm
  1074. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1075. is set to bpm.
  1076. @item ms
  1077. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1078. is set to ms.
  1079. @item hz
  1080. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1081. if timing is set to hz.
  1082. @end table
  1083. @anchor{aresample}
  1084. @section aresample
  1085. Resample the input audio to the specified parameters, using the
  1086. libswresample library. If none are specified then the filter will
  1087. automatically convert between its input and output.
  1088. This filter is also able to stretch/squeeze the audio data to make it match
  1089. the timestamps or to inject silence / cut out audio to make it match the
  1090. timestamps, do a combination of both or do neither.
  1091. The filter accepts the syntax
  1092. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1093. expresses a sample rate and @var{resampler_options} is a list of
  1094. @var{key}=@var{value} pairs, separated by ":". See the
  1095. @ref{Resampler Options,,the "Resampler Options" section in the
  1096. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1097. for the complete list of supported options.
  1098. @subsection Examples
  1099. @itemize
  1100. @item
  1101. Resample the input audio to 44100Hz:
  1102. @example
  1103. aresample=44100
  1104. @end example
  1105. @item
  1106. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1107. samples per second compensation:
  1108. @example
  1109. aresample=async=1000
  1110. @end example
  1111. @end itemize
  1112. @section areverse
  1113. Reverse an audio clip.
  1114. Warning: This filter requires memory to buffer the entire clip, so trimming
  1115. is suggested.
  1116. @subsection Examples
  1117. @itemize
  1118. @item
  1119. Take the first 5 seconds of a clip, and reverse it.
  1120. @example
  1121. atrim=end=5,areverse
  1122. @end example
  1123. @end itemize
  1124. @section asetnsamples
  1125. Set the number of samples per each output audio frame.
  1126. The last output packet may contain a different number of samples, as
  1127. the filter will flush all the remaining samples when the input audio
  1128. signals its end.
  1129. The filter accepts the following options:
  1130. @table @option
  1131. @item nb_out_samples, n
  1132. Set the number of frames per each output audio frame. The number is
  1133. intended as the number of samples @emph{per each channel}.
  1134. Default value is 1024.
  1135. @item pad, p
  1136. If set to 1, the filter will pad the last audio frame with zeroes, so
  1137. that the last frame will contain the same number of samples as the
  1138. previous ones. Default value is 1.
  1139. @end table
  1140. For example, to set the number of per-frame samples to 1234 and
  1141. disable padding for the last frame, use:
  1142. @example
  1143. asetnsamples=n=1234:p=0
  1144. @end example
  1145. @section asetrate
  1146. Set the sample rate without altering the PCM data.
  1147. This will result in a change of speed and pitch.
  1148. The filter accepts the following options:
  1149. @table @option
  1150. @item sample_rate, r
  1151. Set the output sample rate. Default is 44100 Hz.
  1152. @end table
  1153. @section ashowinfo
  1154. Show a line containing various information for each input audio frame.
  1155. The input audio is not modified.
  1156. The shown line contains a sequence of key/value pairs of the form
  1157. @var{key}:@var{value}.
  1158. The following values are shown in the output:
  1159. @table @option
  1160. @item n
  1161. The (sequential) number of the input frame, starting from 0.
  1162. @item pts
  1163. The presentation timestamp of the input frame, in time base units; the time base
  1164. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1165. @item pts_time
  1166. The presentation timestamp of the input frame in seconds.
  1167. @item pos
  1168. position of the frame in the input stream, -1 if this information in
  1169. unavailable and/or meaningless (for example in case of synthetic audio)
  1170. @item fmt
  1171. The sample format.
  1172. @item chlayout
  1173. The channel layout.
  1174. @item rate
  1175. The sample rate for the audio frame.
  1176. @item nb_samples
  1177. The number of samples (per channel) in the frame.
  1178. @item checksum
  1179. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1180. audio, the data is treated as if all the planes were concatenated.
  1181. @item plane_checksums
  1182. A list of Adler-32 checksums for each data plane.
  1183. @end table
  1184. @anchor{astats}
  1185. @section astats
  1186. Display time domain statistical information about the audio channels.
  1187. Statistics are calculated and displayed for each audio channel and,
  1188. where applicable, an overall figure is also given.
  1189. It accepts the following option:
  1190. @table @option
  1191. @item length
  1192. Short window length in seconds, used for peak and trough RMS measurement.
  1193. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1194. @item metadata
  1195. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1196. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1197. disabled.
  1198. Available keys for each channel are:
  1199. DC_offset
  1200. Min_level
  1201. Max_level
  1202. Min_difference
  1203. Max_difference
  1204. Mean_difference
  1205. Peak_level
  1206. RMS_peak
  1207. RMS_trough
  1208. Crest_factor
  1209. Flat_factor
  1210. Peak_count
  1211. Bit_depth
  1212. and for Overall:
  1213. DC_offset
  1214. Min_level
  1215. Max_level
  1216. Min_difference
  1217. Max_difference
  1218. Mean_difference
  1219. Peak_level
  1220. RMS_level
  1221. RMS_peak
  1222. RMS_trough
  1223. Flat_factor
  1224. Peak_count
  1225. Bit_depth
  1226. Number_of_samples
  1227. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1228. this @code{lavfi.astats.Overall.Peak_count}.
  1229. For description what each key means read below.
  1230. @item reset
  1231. Set number of frame after which stats are going to be recalculated.
  1232. Default is disabled.
  1233. @end table
  1234. A description of each shown parameter follows:
  1235. @table @option
  1236. @item DC offset
  1237. Mean amplitude displacement from zero.
  1238. @item Min level
  1239. Minimal sample level.
  1240. @item Max level
  1241. Maximal sample level.
  1242. @item Min difference
  1243. Minimal difference between two consecutive samples.
  1244. @item Max difference
  1245. Maximal difference between two consecutive samples.
  1246. @item Mean difference
  1247. Mean difference between two consecutive samples.
  1248. The average of each difference between two consecutive samples.
  1249. @item Peak level dB
  1250. @item RMS level dB
  1251. Standard peak and RMS level measured in dBFS.
  1252. @item RMS peak dB
  1253. @item RMS trough dB
  1254. Peak and trough values for RMS level measured over a short window.
  1255. @item Crest factor
  1256. Standard ratio of peak to RMS level (note: not in dB).
  1257. @item Flat factor
  1258. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1259. (i.e. either @var{Min level} or @var{Max level}).
  1260. @item Peak count
  1261. Number of occasions (not the number of samples) that the signal attained either
  1262. @var{Min level} or @var{Max level}.
  1263. @item Bit depth
  1264. Overall bit depth of audio. Number of bits used for each sample.
  1265. @end table
  1266. @section asyncts
  1267. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1268. dropping samples/adding silence when needed.
  1269. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1270. It accepts the following parameters:
  1271. @table @option
  1272. @item compensate
  1273. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1274. by default. When disabled, time gaps are covered with silence.
  1275. @item min_delta
  1276. The minimum difference between timestamps and audio data (in seconds) to trigger
  1277. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1278. sync with this filter, try setting this parameter to 0.
  1279. @item max_comp
  1280. The maximum compensation in samples per second. Only relevant with compensate=1.
  1281. The default value is 500.
  1282. @item first_pts
  1283. Assume that the first PTS should be this value. The time base is 1 / sample
  1284. rate. This allows for padding/trimming at the start of the stream. By default,
  1285. no assumption is made about the first frame's expected PTS, so no padding or
  1286. trimming is done. For example, this could be set to 0 to pad the beginning with
  1287. silence if an audio stream starts after the video stream or to trim any samples
  1288. with a negative PTS due to encoder delay.
  1289. @end table
  1290. @section atempo
  1291. Adjust audio tempo.
  1292. The filter accepts exactly one parameter, the audio tempo. If not
  1293. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1294. be in the [0.5, 2.0] range.
  1295. @subsection Examples
  1296. @itemize
  1297. @item
  1298. Slow down audio to 80% tempo:
  1299. @example
  1300. atempo=0.8
  1301. @end example
  1302. @item
  1303. To speed up audio to 125% tempo:
  1304. @example
  1305. atempo=1.25
  1306. @end example
  1307. @end itemize
  1308. @section atrim
  1309. Trim the input so that the output contains one continuous subpart of the input.
  1310. It accepts the following parameters:
  1311. @table @option
  1312. @item start
  1313. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1314. sample with the timestamp @var{start} will be the first sample in the output.
  1315. @item end
  1316. Specify time of the first audio sample that will be dropped, i.e. the
  1317. audio sample immediately preceding the one with the timestamp @var{end} will be
  1318. the last sample in the output.
  1319. @item start_pts
  1320. Same as @var{start}, except this option sets the start timestamp in samples
  1321. instead of seconds.
  1322. @item end_pts
  1323. Same as @var{end}, except this option sets the end timestamp in samples instead
  1324. of seconds.
  1325. @item duration
  1326. The maximum duration of the output in seconds.
  1327. @item start_sample
  1328. The number of the first sample that should be output.
  1329. @item end_sample
  1330. The number of the first sample that should be dropped.
  1331. @end table
  1332. @option{start}, @option{end}, and @option{duration} are expressed as time
  1333. duration specifications; see
  1334. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1335. Note that the first two sets of the start/end options and the @option{duration}
  1336. option look at the frame timestamp, while the _sample options simply count the
  1337. samples that pass through the filter. So start/end_pts and start/end_sample will
  1338. give different results when the timestamps are wrong, inexact or do not start at
  1339. zero. Also note that this filter does not modify the timestamps. If you wish
  1340. to have the output timestamps start at zero, insert the asetpts filter after the
  1341. atrim filter.
  1342. If multiple start or end options are set, this filter tries to be greedy and
  1343. keep all samples that match at least one of the specified constraints. To keep
  1344. only the part that matches all the constraints at once, chain multiple atrim
  1345. filters.
  1346. The defaults are such that all the input is kept. So it is possible to set e.g.
  1347. just the end values to keep everything before the specified time.
  1348. Examples:
  1349. @itemize
  1350. @item
  1351. Drop everything except the second minute of input:
  1352. @example
  1353. ffmpeg -i INPUT -af atrim=60:120
  1354. @end example
  1355. @item
  1356. Keep only the first 1000 samples:
  1357. @example
  1358. ffmpeg -i INPUT -af atrim=end_sample=1000
  1359. @end example
  1360. @end itemize
  1361. @section bandpass
  1362. Apply a two-pole Butterworth band-pass filter with central
  1363. frequency @var{frequency}, and (3dB-point) band-width width.
  1364. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1365. instead of the default: constant 0dB peak gain.
  1366. The filter roll off at 6dB per octave (20dB per decade).
  1367. The filter accepts the following options:
  1368. @table @option
  1369. @item frequency, f
  1370. Set the filter's central frequency. Default is @code{3000}.
  1371. @item csg
  1372. Constant skirt gain if set to 1. Defaults to 0.
  1373. @item width_type
  1374. Set method to specify band-width of filter.
  1375. @table @option
  1376. @item h
  1377. Hz
  1378. @item q
  1379. Q-Factor
  1380. @item o
  1381. octave
  1382. @item s
  1383. slope
  1384. @end table
  1385. @item width, w
  1386. Specify the band-width of a filter in width_type units.
  1387. @end table
  1388. @section bandreject
  1389. Apply a two-pole Butterworth band-reject filter with central
  1390. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1391. The filter roll off at 6dB per octave (20dB per decade).
  1392. The filter accepts the following options:
  1393. @table @option
  1394. @item frequency, f
  1395. Set the filter's central frequency. Default is @code{3000}.
  1396. @item width_type
  1397. Set method to specify band-width of filter.
  1398. @table @option
  1399. @item h
  1400. Hz
  1401. @item q
  1402. Q-Factor
  1403. @item o
  1404. octave
  1405. @item s
  1406. slope
  1407. @end table
  1408. @item width, w
  1409. Specify the band-width of a filter in width_type units.
  1410. @end table
  1411. @section bass
  1412. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1413. shelving filter with a response similar to that of a standard
  1414. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1415. The filter accepts the following options:
  1416. @table @option
  1417. @item gain, g
  1418. Give the gain at 0 Hz. Its useful range is about -20
  1419. (for a large cut) to +20 (for a large boost).
  1420. Beware of clipping when using a positive gain.
  1421. @item frequency, f
  1422. Set the filter's central frequency and so can be used
  1423. to extend or reduce the frequency range to be boosted or cut.
  1424. The default value is @code{100} Hz.
  1425. @item width_type
  1426. Set method to specify band-width of filter.
  1427. @table @option
  1428. @item h
  1429. Hz
  1430. @item q
  1431. Q-Factor
  1432. @item o
  1433. octave
  1434. @item s
  1435. slope
  1436. @end table
  1437. @item width, w
  1438. Determine how steep is the filter's shelf transition.
  1439. @end table
  1440. @section biquad
  1441. Apply a biquad IIR filter with the given coefficients.
  1442. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1443. are the numerator and denominator coefficients respectively.
  1444. @section bs2b
  1445. Bauer stereo to binaural transformation, which improves headphone listening of
  1446. stereo audio records.
  1447. It accepts the following parameters:
  1448. @table @option
  1449. @item profile
  1450. Pre-defined crossfeed level.
  1451. @table @option
  1452. @item default
  1453. Default level (fcut=700, feed=50).
  1454. @item cmoy
  1455. Chu Moy circuit (fcut=700, feed=60).
  1456. @item jmeier
  1457. Jan Meier circuit (fcut=650, feed=95).
  1458. @end table
  1459. @item fcut
  1460. Cut frequency (in Hz).
  1461. @item feed
  1462. Feed level (in Hz).
  1463. @end table
  1464. @section channelmap
  1465. Remap input channels to new locations.
  1466. It accepts the following parameters:
  1467. @table @option
  1468. @item map
  1469. Map channels from input to output. The argument is a '|'-separated list of
  1470. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1471. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1472. channel (e.g. FL for front left) or its index in the input channel layout.
  1473. @var{out_channel} is the name of the output channel or its index in the output
  1474. channel layout. If @var{out_channel} is not given then it is implicitly an
  1475. index, starting with zero and increasing by one for each mapping.
  1476. @item channel_layout
  1477. The channel layout of the output stream.
  1478. @end table
  1479. If no mapping is present, the filter will implicitly map input channels to
  1480. output channels, preserving indices.
  1481. For example, assuming a 5.1+downmix input MOV file,
  1482. @example
  1483. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1484. @end example
  1485. will create an output WAV file tagged as stereo from the downmix channels of
  1486. the input.
  1487. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1488. @example
  1489. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1490. @end example
  1491. @section channelsplit
  1492. Split each channel from an input audio stream into a separate output stream.
  1493. It accepts the following parameters:
  1494. @table @option
  1495. @item channel_layout
  1496. The channel layout of the input stream. The default is "stereo".
  1497. @end table
  1498. For example, assuming a stereo input MP3 file,
  1499. @example
  1500. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1501. @end example
  1502. will create an output Matroska file with two audio streams, one containing only
  1503. the left channel and the other the right channel.
  1504. Split a 5.1 WAV file into per-channel files:
  1505. @example
  1506. ffmpeg -i in.wav -filter_complex
  1507. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1508. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1509. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1510. side_right.wav
  1511. @end example
  1512. @section chorus
  1513. Add a chorus effect to the audio.
  1514. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1515. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1516. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1517. The modulation depth defines the range the modulated delay is played before or after
  1518. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1519. sound tuned around the original one, like in a chorus where some vocals are slightly
  1520. off key.
  1521. It accepts the following parameters:
  1522. @table @option
  1523. @item in_gain
  1524. Set input gain. Default is 0.4.
  1525. @item out_gain
  1526. Set output gain. Default is 0.4.
  1527. @item delays
  1528. Set delays. A typical delay is around 40ms to 60ms.
  1529. @item decays
  1530. Set decays.
  1531. @item speeds
  1532. Set speeds.
  1533. @item depths
  1534. Set depths.
  1535. @end table
  1536. @subsection Examples
  1537. @itemize
  1538. @item
  1539. A single delay:
  1540. @example
  1541. chorus=0.7:0.9:55:0.4:0.25:2
  1542. @end example
  1543. @item
  1544. Two delays:
  1545. @example
  1546. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1547. @end example
  1548. @item
  1549. Fuller sounding chorus with three delays:
  1550. @example
  1551. 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
  1552. @end example
  1553. @end itemize
  1554. @section compand
  1555. Compress or expand the audio's dynamic range.
  1556. It accepts the following parameters:
  1557. @table @option
  1558. @item attacks
  1559. @item decays
  1560. A list of times in seconds for each channel over which the instantaneous level
  1561. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1562. increase of volume and @var{decays} refers to decrease of volume. For most
  1563. situations, the attack time (response to the audio getting louder) should be
  1564. shorter than the decay time, because the human ear is more sensitive to sudden
  1565. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1566. a typical value for decay is 0.8 seconds.
  1567. If specified number of attacks & decays is lower than number of channels, the last
  1568. set attack/decay will be used for all remaining channels.
  1569. @item points
  1570. A list of points for the transfer function, specified in dB relative to the
  1571. maximum possible signal amplitude. Each key points list must be defined using
  1572. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1573. @code{x0/y0 x1/y1 x2/y2 ....}
  1574. The input values must be in strictly increasing order but the transfer function
  1575. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1576. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1577. function are @code{-70/-70|-60/-20}.
  1578. @item soft-knee
  1579. Set the curve radius in dB for all joints. It defaults to 0.01.
  1580. @item gain
  1581. Set the additional gain in dB to be applied at all points on the transfer
  1582. function. This allows for easy adjustment of the overall gain.
  1583. It defaults to 0.
  1584. @item volume
  1585. Set an initial volume, in dB, to be assumed for each channel when filtering
  1586. starts. This permits the user to supply a nominal level initially, so that, for
  1587. example, a very large gain is not applied to initial signal levels before the
  1588. companding has begun to operate. A typical value for audio which is initially
  1589. quiet is -90 dB. It defaults to 0.
  1590. @item delay
  1591. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1592. delayed before being fed to the volume adjuster. Specifying a delay
  1593. approximately equal to the attack/decay times allows the filter to effectively
  1594. operate in predictive rather than reactive mode. It defaults to 0.
  1595. @end table
  1596. @subsection Examples
  1597. @itemize
  1598. @item
  1599. Make music with both quiet and loud passages suitable for listening to in a
  1600. noisy environment:
  1601. @example
  1602. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1603. @end example
  1604. Another example for audio with whisper and explosion parts:
  1605. @example
  1606. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1607. @end example
  1608. @item
  1609. A noise gate for when the noise is at a lower level than the signal:
  1610. @example
  1611. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1612. @end example
  1613. @item
  1614. Here is another noise gate, this time for when the noise is at a higher level
  1615. than the signal (making it, in some ways, similar to squelch):
  1616. @example
  1617. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1618. @end example
  1619. @item
  1620. 2:1 compression starting at -6dB:
  1621. @example
  1622. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1623. @end example
  1624. @item
  1625. 2:1 compression starting at -9dB:
  1626. @example
  1627. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1628. @end example
  1629. @item
  1630. 2:1 compression starting at -12dB:
  1631. @example
  1632. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1633. @end example
  1634. @item
  1635. 2:1 compression starting at -18dB:
  1636. @example
  1637. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1638. @end example
  1639. @item
  1640. 3:1 compression starting at -15dB:
  1641. @example
  1642. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1643. @end example
  1644. @item
  1645. Compressor/Gate:
  1646. @example
  1647. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1648. @end example
  1649. @item
  1650. Expander:
  1651. @example
  1652. 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
  1653. @end example
  1654. @item
  1655. Hard limiter at -6dB:
  1656. @example
  1657. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1658. @end example
  1659. @item
  1660. Hard limiter at -12dB:
  1661. @example
  1662. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1663. @end example
  1664. @item
  1665. Hard noise gate at -35 dB:
  1666. @example
  1667. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1668. @end example
  1669. @item
  1670. Soft limiter:
  1671. @example
  1672. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1673. @end example
  1674. @end itemize
  1675. @section compensationdelay
  1676. Compensation Delay Line is a metric based delay to compensate differing
  1677. positions of microphones or speakers.
  1678. For example, you have recorded guitar with two microphones placed in
  1679. different location. Because the front of sound wave has fixed speed in
  1680. normal conditions, the phasing of microphones can vary and depends on
  1681. their location and interposition. The best sound mix can be achieved when
  1682. these microphones are in phase (synchronized). Note that distance of
  1683. ~30 cm between microphones makes one microphone to capture signal in
  1684. antiphase to another microphone. That makes the final mix sounding moody.
  1685. This filter helps to solve phasing problems by adding different delays
  1686. to each microphone track and make them synchronized.
  1687. The best result can be reached when you take one track as base and
  1688. synchronize other tracks one by one with it.
  1689. Remember that synchronization/delay tolerance depends on sample rate, too.
  1690. Higher sample rates will give more tolerance.
  1691. It accepts the following parameters:
  1692. @table @option
  1693. @item mm
  1694. Set millimeters distance. This is compensation distance for fine tuning.
  1695. Default is 0.
  1696. @item cm
  1697. Set cm distance. This is compensation distance for tightening distance setup.
  1698. Default is 0.
  1699. @item m
  1700. Set meters distance. This is compensation distance for hard distance setup.
  1701. Default is 0.
  1702. @item dry
  1703. Set dry amount. Amount of unprocessed (dry) signal.
  1704. Default is 0.
  1705. @item wet
  1706. Set wet amount. Amount of processed (wet) signal.
  1707. Default is 1.
  1708. @item temp
  1709. Set temperature degree in Celsius. This is the temperature of the environment.
  1710. Default is 20.
  1711. @end table
  1712. @section crystalizer
  1713. Simple algorithm to expand audio dynamic range.
  1714. The filter accepts the following options:
  1715. @table @option
  1716. @item i
  1717. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1718. (unchanged sound) to 10.0 (maximum effect).
  1719. @item c
  1720. Enable clipping. By default is enabled.
  1721. @end table
  1722. @section dcshift
  1723. Apply a DC shift to the audio.
  1724. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1725. in the recording chain) from the audio. The effect of a DC offset is reduced
  1726. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1727. a signal has a DC offset.
  1728. @table @option
  1729. @item shift
  1730. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1731. the audio.
  1732. @item limitergain
  1733. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1734. used to prevent clipping.
  1735. @end table
  1736. @section dynaudnorm
  1737. Dynamic Audio Normalizer.
  1738. This filter applies a certain amount of gain to the input audio in order
  1739. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1740. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1741. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1742. This allows for applying extra gain to the "quiet" sections of the audio
  1743. while avoiding distortions or clipping the "loud" sections. In other words:
  1744. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1745. sections, in the sense that the volume of each section is brought to the
  1746. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1747. this goal *without* applying "dynamic range compressing". It will retain 100%
  1748. of the dynamic range *within* each section of the audio file.
  1749. @table @option
  1750. @item f
  1751. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1752. Default is 500 milliseconds.
  1753. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1754. referred to as frames. This is required, because a peak magnitude has no
  1755. meaning for just a single sample value. Instead, we need to determine the
  1756. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1757. normalizer would simply use the peak magnitude of the complete file, the
  1758. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1759. frame. The length of a frame is specified in milliseconds. By default, the
  1760. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1761. been found to give good results with most files.
  1762. Note that the exact frame length, in number of samples, will be determined
  1763. automatically, based on the sampling rate of the individual input audio file.
  1764. @item g
  1765. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1766. number. Default is 31.
  1767. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1768. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1769. is specified in frames, centered around the current frame. For the sake of
  1770. simplicity, this must be an odd number. Consequently, the default value of 31
  1771. takes into account the current frame, as well as the 15 preceding frames and
  1772. the 15 subsequent frames. Using a larger window results in a stronger
  1773. smoothing effect and thus in less gain variation, i.e. slower gain
  1774. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1775. effect and thus in more gain variation, i.e. faster gain adaptation.
  1776. In other words, the more you increase this value, the more the Dynamic Audio
  1777. Normalizer will behave like a "traditional" normalization filter. On the
  1778. contrary, the more you decrease this value, the more the Dynamic Audio
  1779. Normalizer will behave like a dynamic range compressor.
  1780. @item p
  1781. Set the target peak value. This specifies the highest permissible magnitude
  1782. level for the normalized audio input. This filter will try to approach the
  1783. target peak magnitude as closely as possible, but at the same time it also
  1784. makes sure that the normalized signal will never exceed the peak magnitude.
  1785. A frame's maximum local gain factor is imposed directly by the target peak
  1786. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1787. It is not recommended to go above this value.
  1788. @item m
  1789. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1790. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1791. factor for each input frame, i.e. the maximum gain factor that does not
  1792. result in clipping or distortion. The maximum gain factor is determined by
  1793. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1794. additionally bounds the frame's maximum gain factor by a predetermined
  1795. (global) maximum gain factor. This is done in order to avoid excessive gain
  1796. factors in "silent" or almost silent frames. By default, the maximum gain
  1797. factor is 10.0, For most inputs the default value should be sufficient and
  1798. it usually is not recommended to increase this value. Though, for input
  1799. with an extremely low overall volume level, it may be necessary to allow even
  1800. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1801. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1802. Instead, a "sigmoid" threshold function will be applied. This way, the
  1803. gain factors will smoothly approach the threshold value, but never exceed that
  1804. value.
  1805. @item r
  1806. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1807. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1808. This means that the maximum local gain factor for each frame is defined
  1809. (only) by the frame's highest magnitude sample. This way, the samples can
  1810. be amplified as much as possible without exceeding the maximum signal
  1811. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1812. Normalizer can also take into account the frame's root mean square,
  1813. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1814. determine the power of a time-varying signal. It is therefore considered
  1815. that the RMS is a better approximation of the "perceived loudness" than
  1816. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1817. frames to a constant RMS value, a uniform "perceived loudness" can be
  1818. established. If a target RMS value has been specified, a frame's local gain
  1819. factor is defined as the factor that would result in exactly that RMS value.
  1820. Note, however, that the maximum local gain factor is still restricted by the
  1821. frame's highest magnitude sample, in order to prevent clipping.
  1822. @item n
  1823. Enable channels coupling. By default is enabled.
  1824. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1825. amount. This means the same gain factor will be applied to all channels, i.e.
  1826. the maximum possible gain factor is determined by the "loudest" channel.
  1827. However, in some recordings, it may happen that the volume of the different
  1828. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1829. In this case, this option can be used to disable the channel coupling. This way,
  1830. the gain factor will be determined independently for each channel, depending
  1831. only on the individual channel's highest magnitude sample. This allows for
  1832. harmonizing the volume of the different channels.
  1833. @item c
  1834. Enable DC bias correction. By default is disabled.
  1835. An audio signal (in the time domain) is a sequence of sample values.
  1836. In the Dynamic Audio Normalizer these sample values are represented in the
  1837. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1838. audio signal, or "waveform", should be centered around the zero point.
  1839. That means if we calculate the mean value of all samples in a file, or in a
  1840. single frame, then the result should be 0.0 or at least very close to that
  1841. value. If, however, there is a significant deviation of the mean value from
  1842. 0.0, in either positive or negative direction, this is referred to as a
  1843. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1844. Audio Normalizer provides optional DC bias correction.
  1845. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1846. the mean value, or "DC correction" offset, of each input frame and subtract
  1847. that value from all of the frame's sample values which ensures those samples
  1848. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1849. boundaries, the DC correction offset values will be interpolated smoothly
  1850. between neighbouring frames.
  1851. @item b
  1852. Enable alternative boundary mode. By default is disabled.
  1853. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1854. around each frame. This includes the preceding frames as well as the
  1855. subsequent frames. However, for the "boundary" frames, located at the very
  1856. beginning and at the very end of the audio file, not all neighbouring
  1857. frames are available. In particular, for the first few frames in the audio
  1858. file, the preceding frames are not known. And, similarly, for the last few
  1859. frames in the audio file, the subsequent frames are not known. Thus, the
  1860. question arises which gain factors should be assumed for the missing frames
  1861. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1862. to deal with this situation. The default boundary mode assumes a gain factor
  1863. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1864. "fade out" at the beginning and at the end of the input, respectively.
  1865. @item s
  1866. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1867. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1868. compression. This means that signal peaks will not be pruned and thus the
  1869. full dynamic range will be retained within each local neighbourhood. However,
  1870. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1871. normalization algorithm with a more "traditional" compression.
  1872. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1873. (thresholding) function. If (and only if) the compression feature is enabled,
  1874. all input frames will be processed by a soft knee thresholding function prior
  1875. to the actual normalization process. Put simply, the thresholding function is
  1876. going to prune all samples whose magnitude exceeds a certain threshold value.
  1877. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1878. value. Instead, the threshold value will be adjusted for each individual
  1879. frame.
  1880. In general, smaller parameters result in stronger compression, and vice versa.
  1881. Values below 3.0 are not recommended, because audible distortion may appear.
  1882. @end table
  1883. @section earwax
  1884. Make audio easier to listen to on headphones.
  1885. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1886. so that when listened to on headphones the stereo image is moved from
  1887. inside your head (standard for headphones) to outside and in front of
  1888. the listener (standard for speakers).
  1889. Ported from SoX.
  1890. @section equalizer
  1891. Apply a two-pole peaking equalisation (EQ) filter. With this
  1892. filter, the signal-level at and around a selected frequency can
  1893. be increased or decreased, whilst (unlike bandpass and bandreject
  1894. filters) that at all other frequencies is unchanged.
  1895. In order to produce complex equalisation curves, this filter can
  1896. be given several times, each with a different central frequency.
  1897. The filter accepts the following options:
  1898. @table @option
  1899. @item frequency, f
  1900. Set the filter's central frequency in Hz.
  1901. @item width_type
  1902. Set method to specify band-width of filter.
  1903. @table @option
  1904. @item h
  1905. Hz
  1906. @item q
  1907. Q-Factor
  1908. @item o
  1909. octave
  1910. @item s
  1911. slope
  1912. @end table
  1913. @item width, w
  1914. Specify the band-width of a filter in width_type units.
  1915. @item gain, g
  1916. Set the required gain or attenuation in dB.
  1917. Beware of clipping when using a positive gain.
  1918. @end table
  1919. @subsection Examples
  1920. @itemize
  1921. @item
  1922. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1923. @example
  1924. equalizer=f=1000:width_type=h:width=200:g=-10
  1925. @end example
  1926. @item
  1927. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1928. @example
  1929. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1930. @end example
  1931. @end itemize
  1932. @section extrastereo
  1933. Linearly increases the difference between left and right channels which
  1934. adds some sort of "live" effect to playback.
  1935. The filter accepts the following options:
  1936. @table @option
  1937. @item m
  1938. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1939. (average of both channels), with 1.0 sound will be unchanged, with
  1940. -1.0 left and right channels will be swapped.
  1941. @item c
  1942. Enable clipping. By default is enabled.
  1943. @end table
  1944. @section firequalizer
  1945. Apply FIR Equalization using arbitrary frequency response.
  1946. The filter accepts the following option:
  1947. @table @option
  1948. @item gain
  1949. Set gain curve equation (in dB). The expression can contain variables:
  1950. @table @option
  1951. @item f
  1952. the evaluated frequency
  1953. @item sr
  1954. sample rate
  1955. @item ch
  1956. channel number, set to 0 when multichannels evaluation is disabled
  1957. @item chid
  1958. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1959. multichannels evaluation is disabled
  1960. @item chs
  1961. number of channels
  1962. @item chlayout
  1963. channel_layout, see libavutil/channel_layout.h
  1964. @end table
  1965. and functions:
  1966. @table @option
  1967. @item gain_interpolate(f)
  1968. interpolate gain on frequency f based on gain_entry
  1969. @item cubic_interpolate(f)
  1970. same as gain_interpolate, but smoother
  1971. @end table
  1972. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1973. @item gain_entry
  1974. Set gain entry for gain_interpolate function. The expression can
  1975. contain functions:
  1976. @table @option
  1977. @item entry(f, g)
  1978. store gain entry at frequency f with value g
  1979. @end table
  1980. This option is also available as command.
  1981. @item delay
  1982. Set filter delay in seconds. Higher value means more accurate.
  1983. Default is @code{0.01}.
  1984. @item accuracy
  1985. Set filter accuracy in Hz. Lower value means more accurate.
  1986. Default is @code{5}.
  1987. @item wfunc
  1988. Set window function. Acceptable values are:
  1989. @table @option
  1990. @item rectangular
  1991. rectangular window, useful when gain curve is already smooth
  1992. @item hann
  1993. hann window (default)
  1994. @item hamming
  1995. hamming window
  1996. @item blackman
  1997. blackman window
  1998. @item nuttall3
  1999. 3-terms continuous 1st derivative nuttall window
  2000. @item mnuttall3
  2001. minimum 3-terms discontinuous nuttall window
  2002. @item nuttall
  2003. 4-terms continuous 1st derivative nuttall window
  2004. @item bnuttall
  2005. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2006. @item bharris
  2007. blackman-harris window
  2008. @item tukey
  2009. tukey window
  2010. @end table
  2011. @item fixed
  2012. If enabled, use fixed number of audio samples. This improves speed when
  2013. filtering with large delay. Default is disabled.
  2014. @item multi
  2015. Enable multichannels evaluation on gain. Default is disabled.
  2016. @item zero_phase
  2017. Enable zero phase mode by subtracting timestamp to compensate delay.
  2018. Default is disabled.
  2019. @item scale
  2020. Set scale used by gain. Acceptable values are:
  2021. @table @option
  2022. @item linlin
  2023. linear frequency, linear gain
  2024. @item linlog
  2025. linear frequency, logarithmic (in dB) gain (default)
  2026. @item loglin
  2027. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2028. @item loglog
  2029. logarithmic frequency, logarithmic gain
  2030. @end table
  2031. @item dumpfile
  2032. Set file for dumping, suitable for gnuplot.
  2033. @item dumpscale
  2034. Set scale for dumpfile. Acceptable values are same with scale option.
  2035. Default is linlog.
  2036. @item fft2
  2037. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2038. Default is disabled.
  2039. @end table
  2040. @subsection Examples
  2041. @itemize
  2042. @item
  2043. lowpass at 1000 Hz:
  2044. @example
  2045. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2046. @end example
  2047. @item
  2048. lowpass at 1000 Hz with gain_entry:
  2049. @example
  2050. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2051. @end example
  2052. @item
  2053. custom equalization:
  2054. @example
  2055. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2056. @end example
  2057. @item
  2058. higher delay with zero phase to compensate delay:
  2059. @example
  2060. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2061. @end example
  2062. @item
  2063. lowpass on left channel, highpass on right channel:
  2064. @example
  2065. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2066. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2067. @end example
  2068. @end itemize
  2069. @section flanger
  2070. Apply a flanging effect to the audio.
  2071. The filter accepts the following options:
  2072. @table @option
  2073. @item delay
  2074. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2075. @item depth
  2076. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2077. @item regen
  2078. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2079. Default value is 0.
  2080. @item width
  2081. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2082. Default value is 71.
  2083. @item speed
  2084. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2085. @item shape
  2086. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2087. Default value is @var{sinusoidal}.
  2088. @item phase
  2089. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2090. Default value is 25.
  2091. @item interp
  2092. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2093. Default is @var{linear}.
  2094. @end table
  2095. @section hdcd
  2096. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2097. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2098. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2099. of HDCD, and detects the Transient Filter flag.
  2100. @example
  2101. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2102. @end example
  2103. When using the filter with wav, note the default encoding for wav is 16-bit,
  2104. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2105. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2106. @example
  2107. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2108. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2109. @end example
  2110. The filter accepts the following options:
  2111. @table @option
  2112. @item disable_autoconvert
  2113. Disable any automatic format conversion or resampling in the filter graph.
  2114. @item process_stereo
  2115. Process the stereo channels together. If target_gain does not match between
  2116. channels, consider it invalid and use the last valid target_gain.
  2117. @item cdt_ms
  2118. Set the code detect timer period in ms.
  2119. @item force_pe
  2120. Always extend peaks above -3dBFS even if PE isn't signaled.
  2121. @item analyze_mode
  2122. Replace audio with a solid tone and adjust the amplitude to signal some
  2123. specific aspect of the decoding process. The output file can be loaded in
  2124. an audio editor alongside the original to aid analysis.
  2125. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2126. Modes are:
  2127. @table @samp
  2128. @item 0, off
  2129. Disabled
  2130. @item 1, lle
  2131. Gain adjustment level at each sample
  2132. @item 2, pe
  2133. Samples where peak extend occurs
  2134. @item 3, cdt
  2135. Samples where the code detect timer is active
  2136. @item 4, tgm
  2137. Samples where the target gain does not match between channels
  2138. @end table
  2139. @end table
  2140. @section highpass
  2141. Apply a high-pass filter with 3dB point frequency.
  2142. The filter can be either single-pole, or double-pole (the default).
  2143. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2144. The filter accepts the following options:
  2145. @table @option
  2146. @item frequency, f
  2147. Set frequency in Hz. Default is 3000.
  2148. @item poles, p
  2149. Set number of poles. Default is 2.
  2150. @item width_type
  2151. Set method to specify band-width of filter.
  2152. @table @option
  2153. @item h
  2154. Hz
  2155. @item q
  2156. Q-Factor
  2157. @item o
  2158. octave
  2159. @item s
  2160. slope
  2161. @end table
  2162. @item width, w
  2163. Specify the band-width of a filter in width_type units.
  2164. Applies only to double-pole filter.
  2165. The default is 0.707q and gives a Butterworth response.
  2166. @end table
  2167. @section join
  2168. Join multiple input streams into one multi-channel stream.
  2169. It accepts the following parameters:
  2170. @table @option
  2171. @item inputs
  2172. The number of input streams. It defaults to 2.
  2173. @item channel_layout
  2174. The desired output channel layout. It defaults to stereo.
  2175. @item map
  2176. Map channels from inputs to output. The argument is a '|'-separated list of
  2177. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2178. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2179. can be either the name of the input channel (e.g. FL for front left) or its
  2180. index in the specified input stream. @var{out_channel} is the name of the output
  2181. channel.
  2182. @end table
  2183. The filter will attempt to guess the mappings when they are not specified
  2184. explicitly. It does so by first trying to find an unused matching input channel
  2185. and if that fails it picks the first unused input channel.
  2186. Join 3 inputs (with properly set channel layouts):
  2187. @example
  2188. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2189. @end example
  2190. Build a 5.1 output from 6 single-channel streams:
  2191. @example
  2192. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2193. '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'
  2194. out
  2195. @end example
  2196. @section ladspa
  2197. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2198. To enable compilation of this filter you need to configure FFmpeg with
  2199. @code{--enable-ladspa}.
  2200. @table @option
  2201. @item file, f
  2202. Specifies the name of LADSPA plugin library to load. If the environment
  2203. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2204. each one of the directories specified by the colon separated list in
  2205. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2206. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2207. @file{/usr/lib/ladspa/}.
  2208. @item plugin, p
  2209. Specifies the plugin within the library. Some libraries contain only
  2210. one plugin, but others contain many of them. If this is not set filter
  2211. will list all available plugins within the specified library.
  2212. @item controls, c
  2213. Set the '|' separated list of controls which are zero or more floating point
  2214. values that determine the behavior of the loaded plugin (for example delay,
  2215. threshold or gain).
  2216. Controls need to be defined using the following syntax:
  2217. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2218. @var{valuei} is the value set on the @var{i}-th control.
  2219. Alternatively they can be also defined using the following syntax:
  2220. @var{value0}|@var{value1}|@var{value2}|..., where
  2221. @var{valuei} is the value set on the @var{i}-th control.
  2222. If @option{controls} is set to @code{help}, all available controls and
  2223. their valid ranges are printed.
  2224. @item sample_rate, s
  2225. Specify the sample rate, default to 44100. Only used if plugin have
  2226. zero inputs.
  2227. @item nb_samples, n
  2228. Set the number of samples per channel per each output frame, default
  2229. is 1024. Only used if plugin have zero inputs.
  2230. @item duration, d
  2231. Set the minimum duration of the sourced audio. See
  2232. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2233. for the accepted syntax.
  2234. Note that the resulting duration may be greater than the specified duration,
  2235. as the generated audio is always cut at the end of a complete frame.
  2236. If not specified, or the expressed duration is negative, the audio is
  2237. supposed to be generated forever.
  2238. Only used if plugin have zero inputs.
  2239. @end table
  2240. @subsection Examples
  2241. @itemize
  2242. @item
  2243. List all available plugins within amp (LADSPA example plugin) library:
  2244. @example
  2245. ladspa=file=amp
  2246. @end example
  2247. @item
  2248. List all available controls and their valid ranges for @code{vcf_notch}
  2249. plugin from @code{VCF} library:
  2250. @example
  2251. ladspa=f=vcf:p=vcf_notch:c=help
  2252. @end example
  2253. @item
  2254. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2255. plugin library:
  2256. @example
  2257. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2258. @end example
  2259. @item
  2260. Add reverberation to the audio using TAP-plugins
  2261. (Tom's Audio Processing plugins):
  2262. @example
  2263. ladspa=file=tap_reverb:tap_reverb
  2264. @end example
  2265. @item
  2266. Generate white noise, with 0.2 amplitude:
  2267. @example
  2268. ladspa=file=cmt:noise_source_white:c=c0=.2
  2269. @end example
  2270. @item
  2271. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2272. @code{C* Audio Plugin Suite} (CAPS) library:
  2273. @example
  2274. ladspa=file=caps:Click:c=c1=20'
  2275. @end example
  2276. @item
  2277. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2278. @example
  2279. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2280. @end example
  2281. @item
  2282. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2283. @code{SWH Plugins} collection:
  2284. @example
  2285. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2286. @end example
  2287. @item
  2288. Attenuate low frequencies using Multiband EQ from Steve Harris
  2289. @code{SWH Plugins} collection:
  2290. @example
  2291. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2292. @end example
  2293. @end itemize
  2294. @subsection Commands
  2295. This filter supports the following commands:
  2296. @table @option
  2297. @item cN
  2298. Modify the @var{N}-th control value.
  2299. If the specified value is not valid, it is ignored and prior one is kept.
  2300. @end table
  2301. @section loudnorm
  2302. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2303. Support for both single pass (livestreams, files) and double pass (files) modes.
  2304. This algorithm can target IL, LRA, and maximum true peak.
  2305. The filter accepts the following options:
  2306. @table @option
  2307. @item I, i
  2308. Set integrated loudness target.
  2309. Range is -70.0 - -5.0. Default value is -24.0.
  2310. @item LRA, lra
  2311. Set loudness range target.
  2312. Range is 1.0 - 20.0. Default value is 7.0.
  2313. @item TP, tp
  2314. Set maximum true peak.
  2315. Range is -9.0 - +0.0. Default value is -2.0.
  2316. @item measured_I, measured_i
  2317. Measured IL of input file.
  2318. Range is -99.0 - +0.0.
  2319. @item measured_LRA, measured_lra
  2320. Measured LRA of input file.
  2321. Range is 0.0 - 99.0.
  2322. @item measured_TP, measured_tp
  2323. Measured true peak of input file.
  2324. Range is -99.0 - +99.0.
  2325. @item measured_thresh
  2326. Measured threshold of input file.
  2327. Range is -99.0 - +0.0.
  2328. @item offset
  2329. Set offset gain. Gain is applied before the true-peak limiter.
  2330. Range is -99.0 - +99.0. Default is +0.0.
  2331. @item linear
  2332. Normalize linearly if possible.
  2333. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2334. to be specified in order to use this mode.
  2335. Options are true or false. Default is true.
  2336. @item dual_mono
  2337. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2338. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2339. If set to @code{true}, this option will compensate for this effect.
  2340. Multi-channel input files are not affected by this option.
  2341. Options are true or false. Default is false.
  2342. @item print_format
  2343. Set print format for stats. Options are summary, json, or none.
  2344. Default value is none.
  2345. @end table
  2346. @section lowpass
  2347. Apply a low-pass filter with 3dB point frequency.
  2348. The filter can be either single-pole or double-pole (the default).
  2349. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2350. The filter accepts the following options:
  2351. @table @option
  2352. @item frequency, f
  2353. Set frequency in Hz. Default is 500.
  2354. @item poles, p
  2355. Set number of poles. Default is 2.
  2356. @item width_type
  2357. Set method to specify band-width of filter.
  2358. @table @option
  2359. @item h
  2360. Hz
  2361. @item q
  2362. Q-Factor
  2363. @item o
  2364. octave
  2365. @item s
  2366. slope
  2367. @end table
  2368. @item width, w
  2369. Specify the band-width of a filter in width_type units.
  2370. Applies only to double-pole filter.
  2371. The default is 0.707q and gives a Butterworth response.
  2372. @end table
  2373. @anchor{pan}
  2374. @section pan
  2375. Mix channels with specific gain levels. The filter accepts the output
  2376. channel layout followed by a set of channels definitions.
  2377. This filter is also designed to efficiently remap the channels of an audio
  2378. stream.
  2379. The filter accepts parameters of the form:
  2380. "@var{l}|@var{outdef}|@var{outdef}|..."
  2381. @table @option
  2382. @item l
  2383. output channel layout or number of channels
  2384. @item outdef
  2385. output channel specification, of the form:
  2386. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2387. @item out_name
  2388. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2389. number (c0, c1, etc.)
  2390. @item gain
  2391. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2392. @item in_name
  2393. input channel to use, see out_name for details; it is not possible to mix
  2394. named and numbered input channels
  2395. @end table
  2396. If the `=' in a channel specification is replaced by `<', then the gains for
  2397. that specification will be renormalized so that the total is 1, thus
  2398. avoiding clipping noise.
  2399. @subsection Mixing examples
  2400. For example, if you want to down-mix from stereo to mono, but with a bigger
  2401. factor for the left channel:
  2402. @example
  2403. pan=1c|c0=0.9*c0+0.1*c1
  2404. @end example
  2405. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2406. 7-channels surround:
  2407. @example
  2408. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2409. @end example
  2410. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2411. that should be preferred (see "-ac" option) unless you have very specific
  2412. needs.
  2413. @subsection Remapping examples
  2414. The channel remapping will be effective if, and only if:
  2415. @itemize
  2416. @item gain coefficients are zeroes or ones,
  2417. @item only one input per channel output,
  2418. @end itemize
  2419. If all these conditions are satisfied, the filter will notify the user ("Pure
  2420. channel mapping detected"), and use an optimized and lossless method to do the
  2421. remapping.
  2422. For example, if you have a 5.1 source and want a stereo audio stream by
  2423. dropping the extra channels:
  2424. @example
  2425. pan="stereo| c0=FL | c1=FR"
  2426. @end example
  2427. Given the same source, you can also switch front left and front right channels
  2428. and keep the input channel layout:
  2429. @example
  2430. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2431. @end example
  2432. If the input is a stereo audio stream, you can mute the front left channel (and
  2433. still keep the stereo channel layout) with:
  2434. @example
  2435. pan="stereo|c1=c1"
  2436. @end example
  2437. Still with a stereo audio stream input, you can copy the right channel in both
  2438. front left and right:
  2439. @example
  2440. pan="stereo| c0=FR | c1=FR"
  2441. @end example
  2442. @section replaygain
  2443. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2444. outputs it unchanged.
  2445. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2446. @section resample
  2447. Convert the audio sample format, sample rate and channel layout. It is
  2448. not meant to be used directly.
  2449. @section rubberband
  2450. Apply time-stretching and pitch-shifting with librubberband.
  2451. The filter accepts the following options:
  2452. @table @option
  2453. @item tempo
  2454. Set tempo scale factor.
  2455. @item pitch
  2456. Set pitch scale factor.
  2457. @item transients
  2458. Set transients detector.
  2459. Possible values are:
  2460. @table @var
  2461. @item crisp
  2462. @item mixed
  2463. @item smooth
  2464. @end table
  2465. @item detector
  2466. Set detector.
  2467. Possible values are:
  2468. @table @var
  2469. @item compound
  2470. @item percussive
  2471. @item soft
  2472. @end table
  2473. @item phase
  2474. Set phase.
  2475. Possible values are:
  2476. @table @var
  2477. @item laminar
  2478. @item independent
  2479. @end table
  2480. @item window
  2481. Set processing window size.
  2482. Possible values are:
  2483. @table @var
  2484. @item standard
  2485. @item short
  2486. @item long
  2487. @end table
  2488. @item smoothing
  2489. Set smoothing.
  2490. Possible values are:
  2491. @table @var
  2492. @item off
  2493. @item on
  2494. @end table
  2495. @item formant
  2496. Enable formant preservation when shift pitching.
  2497. Possible values are:
  2498. @table @var
  2499. @item shifted
  2500. @item preserved
  2501. @end table
  2502. @item pitchq
  2503. Set pitch quality.
  2504. Possible values are:
  2505. @table @var
  2506. @item quality
  2507. @item speed
  2508. @item consistency
  2509. @end table
  2510. @item channels
  2511. Set channels.
  2512. Possible values are:
  2513. @table @var
  2514. @item apart
  2515. @item together
  2516. @end table
  2517. @end table
  2518. @section sidechaincompress
  2519. This filter acts like normal compressor but has the ability to compress
  2520. detected signal using second input signal.
  2521. It needs two input streams and returns one output stream.
  2522. First input stream will be processed depending on second stream signal.
  2523. The filtered signal then can be filtered with other filters in later stages of
  2524. processing. See @ref{pan} and @ref{amerge} filter.
  2525. The filter accepts the following options:
  2526. @table @option
  2527. @item level_in
  2528. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2529. @item threshold
  2530. If a signal of second stream raises above this level it will affect the gain
  2531. reduction of first stream.
  2532. By default is 0.125. Range is between 0.00097563 and 1.
  2533. @item ratio
  2534. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2535. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2536. Default is 2. Range is between 1 and 20.
  2537. @item attack
  2538. Amount of milliseconds the signal has to rise above the threshold before gain
  2539. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2540. @item release
  2541. Amount of milliseconds the signal has to fall below the threshold before
  2542. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2543. @item makeup
  2544. Set the amount by how much signal will be amplified after processing.
  2545. Default is 2. Range is from 1 and 64.
  2546. @item knee
  2547. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2548. Default is 2.82843. Range is between 1 and 8.
  2549. @item link
  2550. Choose if the @code{average} level between all channels of side-chain stream
  2551. or the louder(@code{maximum}) channel of side-chain stream affects the
  2552. reduction. Default is @code{average}.
  2553. @item detection
  2554. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2555. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2556. @item level_sc
  2557. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2558. @item mix
  2559. How much to use compressed signal in output. Default is 1.
  2560. Range is between 0 and 1.
  2561. @end table
  2562. @subsection Examples
  2563. @itemize
  2564. @item
  2565. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2566. depending on the signal of 2nd input and later compressed signal to be
  2567. merged with 2nd input:
  2568. @example
  2569. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2570. @end example
  2571. @end itemize
  2572. @section sidechaingate
  2573. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2574. filter the detected signal before sending it to the gain reduction stage.
  2575. Normally a gate uses the full range signal to detect a level above the
  2576. threshold.
  2577. For example: If you cut all lower frequencies from your sidechain signal
  2578. the gate will decrease the volume of your track only if not enough highs
  2579. appear. With this technique you are able to reduce the resonation of a
  2580. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2581. guitar.
  2582. It needs two input streams and returns one output stream.
  2583. First input stream will be processed depending on second stream signal.
  2584. The filter accepts the following options:
  2585. @table @option
  2586. @item level_in
  2587. Set input level before filtering.
  2588. Default is 1. Allowed range is from 0.015625 to 64.
  2589. @item range
  2590. Set the level of gain reduction when the signal is below the threshold.
  2591. Default is 0.06125. Allowed range is from 0 to 1.
  2592. @item threshold
  2593. If a signal rises above this level the gain reduction is released.
  2594. Default is 0.125. Allowed range is from 0 to 1.
  2595. @item ratio
  2596. Set a ratio about which the signal is reduced.
  2597. Default is 2. Allowed range is from 1 to 9000.
  2598. @item attack
  2599. Amount of milliseconds the signal has to rise above the threshold before gain
  2600. reduction stops.
  2601. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2602. @item release
  2603. Amount of milliseconds the signal has to fall below the threshold before the
  2604. reduction is increased again. Default is 250 milliseconds.
  2605. Allowed range is from 0.01 to 9000.
  2606. @item makeup
  2607. Set amount of amplification of signal after processing.
  2608. Default is 1. Allowed range is from 1 to 64.
  2609. @item knee
  2610. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2611. Default is 2.828427125. Allowed range is from 1 to 8.
  2612. @item detection
  2613. Choose if exact signal should be taken for detection or an RMS like one.
  2614. Default is rms. Can be peak or rms.
  2615. @item link
  2616. Choose if the average level between all channels or the louder channel affects
  2617. the reduction.
  2618. Default is average. Can be average or maximum.
  2619. @item level_sc
  2620. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2621. @end table
  2622. @section silencedetect
  2623. Detect silence in an audio stream.
  2624. This filter logs a message when it detects that the input audio volume is less
  2625. or equal to a noise tolerance value for a duration greater or equal to the
  2626. minimum detected noise duration.
  2627. The printed times and duration are expressed in seconds.
  2628. The filter accepts the following options:
  2629. @table @option
  2630. @item duration, d
  2631. Set silence duration until notification (default is 2 seconds).
  2632. @item noise, n
  2633. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2634. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2635. @end table
  2636. @subsection Examples
  2637. @itemize
  2638. @item
  2639. Detect 5 seconds of silence with -50dB noise tolerance:
  2640. @example
  2641. silencedetect=n=-50dB:d=5
  2642. @end example
  2643. @item
  2644. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2645. tolerance in @file{silence.mp3}:
  2646. @example
  2647. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2648. @end example
  2649. @end itemize
  2650. @section silenceremove
  2651. Remove silence from the beginning, middle or end of the audio.
  2652. The filter accepts the following options:
  2653. @table @option
  2654. @item start_periods
  2655. This value is used to indicate if audio should be trimmed at beginning of
  2656. the audio. A value of zero indicates no silence should be trimmed from the
  2657. beginning. When specifying a non-zero value, it trims audio up until it
  2658. finds non-silence. Normally, when trimming silence from beginning of audio
  2659. the @var{start_periods} will be @code{1} but it can be increased to higher
  2660. values to trim all audio up to specific count of non-silence periods.
  2661. Default value is @code{0}.
  2662. @item start_duration
  2663. Specify the amount of time that non-silence must be detected before it stops
  2664. trimming audio. By increasing the duration, bursts of noises can be treated
  2665. as silence and trimmed off. Default value is @code{0}.
  2666. @item start_threshold
  2667. This indicates what sample value should be treated as silence. For digital
  2668. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2669. you may wish to increase the value to account for background noise.
  2670. Can be specified in dB (in case "dB" is appended to the specified value)
  2671. or amplitude ratio. Default value is @code{0}.
  2672. @item stop_periods
  2673. Set the count for trimming silence from the end of audio.
  2674. To remove silence from the middle of a file, specify a @var{stop_periods}
  2675. that is negative. This value is then treated as a positive value and is
  2676. used to indicate the effect should restart processing as specified by
  2677. @var{start_periods}, making it suitable for removing periods of silence
  2678. in the middle of the audio.
  2679. Default value is @code{0}.
  2680. @item stop_duration
  2681. Specify a duration of silence that must exist before audio is not copied any
  2682. more. By specifying a higher duration, silence that is wanted can be left in
  2683. the audio.
  2684. Default value is @code{0}.
  2685. @item stop_threshold
  2686. This is the same as @option{start_threshold} but for trimming silence from
  2687. the end of audio.
  2688. Can be specified in dB (in case "dB" is appended to the specified value)
  2689. or amplitude ratio. Default value is @code{0}.
  2690. @item leave_silence
  2691. This indicates that @var{stop_duration} length of audio should be left intact
  2692. at the beginning of each period of silence.
  2693. For example, if you want to remove long pauses between words but do not want
  2694. to remove the pauses completely. Default value is @code{0}.
  2695. @item detection
  2696. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2697. and works better with digital silence which is exactly 0.
  2698. Default value is @code{rms}.
  2699. @item window
  2700. Set ratio used to calculate size of window for detecting silence.
  2701. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2702. @end table
  2703. @subsection Examples
  2704. @itemize
  2705. @item
  2706. The following example shows how this filter can be used to start a recording
  2707. that does not contain the delay at the start which usually occurs between
  2708. pressing the record button and the start of the performance:
  2709. @example
  2710. silenceremove=1:5:0.02
  2711. @end example
  2712. @item
  2713. Trim all silence encountered from beginning to end where there is more than 1
  2714. second of silence in audio:
  2715. @example
  2716. silenceremove=0:0:0:-1:1:-90dB
  2717. @end example
  2718. @end itemize
  2719. @section sofalizer
  2720. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2721. loudspeakers around the user for binaural listening via headphones (audio
  2722. formats up to 9 channels supported).
  2723. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2724. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2725. Austrian Academy of Sciences.
  2726. To enable compilation of this filter you need to configure FFmpeg with
  2727. @code{--enable-netcdf}.
  2728. The filter accepts the following options:
  2729. @table @option
  2730. @item sofa
  2731. Set the SOFA file used for rendering.
  2732. @item gain
  2733. Set gain applied to audio. Value is in dB. Default is 0.
  2734. @item rotation
  2735. Set rotation of virtual loudspeakers in deg. Default is 0.
  2736. @item elevation
  2737. Set elevation of virtual speakers in deg. Default is 0.
  2738. @item radius
  2739. Set distance in meters between loudspeakers and the listener with near-field
  2740. HRTFs. Default is 1.
  2741. @item type
  2742. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2743. processing audio in time domain which is slow.
  2744. @var{freq} is processing audio in frequency domain which is fast.
  2745. Default is @var{freq}.
  2746. @item speakers
  2747. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2748. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2749. Each virtual loudspeaker is described with short channel name following with
  2750. azimuth and elevation in degreees.
  2751. Each virtual loudspeaker description is separated by '|'.
  2752. For example to override front left and front right channel positions use:
  2753. 'speakers=FL 45 15|FR 345 15'.
  2754. Descriptions with unrecognised channel names are ignored.
  2755. @end table
  2756. @subsection Examples
  2757. @itemize
  2758. @item
  2759. Using ClubFritz6 sofa file:
  2760. @example
  2761. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2762. @end example
  2763. @item
  2764. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2765. @example
  2766. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2767. @end example
  2768. @item
  2769. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2770. and also with custom gain:
  2771. @example
  2772. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2773. @end example
  2774. @end itemize
  2775. @section stereotools
  2776. This filter has some handy utilities to manage stereo signals, for converting
  2777. M/S stereo recordings to L/R signal while having control over the parameters
  2778. or spreading the stereo image of master track.
  2779. The filter accepts the following options:
  2780. @table @option
  2781. @item level_in
  2782. Set input level before filtering for both channels. Defaults is 1.
  2783. Allowed range is from 0.015625 to 64.
  2784. @item level_out
  2785. Set output level after filtering for both channels. Defaults is 1.
  2786. Allowed range is from 0.015625 to 64.
  2787. @item balance_in
  2788. Set input balance between both channels. Default is 0.
  2789. Allowed range is from -1 to 1.
  2790. @item balance_out
  2791. Set output balance between both channels. Default is 0.
  2792. Allowed range is from -1 to 1.
  2793. @item softclip
  2794. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2795. clipping. Disabled by default.
  2796. @item mutel
  2797. Mute the left channel. Disabled by default.
  2798. @item muter
  2799. Mute the right channel. Disabled by default.
  2800. @item phasel
  2801. Change the phase of the left channel. Disabled by default.
  2802. @item phaser
  2803. Change the phase of the right channel. Disabled by default.
  2804. @item mode
  2805. Set stereo mode. Available values are:
  2806. @table @samp
  2807. @item lr>lr
  2808. Left/Right to Left/Right, this is default.
  2809. @item lr>ms
  2810. Left/Right to Mid/Side.
  2811. @item ms>lr
  2812. Mid/Side to Left/Right.
  2813. @item lr>ll
  2814. Left/Right to Left/Left.
  2815. @item lr>rr
  2816. Left/Right to Right/Right.
  2817. @item lr>l+r
  2818. Left/Right to Left + Right.
  2819. @item lr>rl
  2820. Left/Right to Right/Left.
  2821. @end table
  2822. @item slev
  2823. Set level of side signal. Default is 1.
  2824. Allowed range is from 0.015625 to 64.
  2825. @item sbal
  2826. Set balance of side signal. Default is 0.
  2827. Allowed range is from -1 to 1.
  2828. @item mlev
  2829. Set level of the middle signal. Default is 1.
  2830. Allowed range is from 0.015625 to 64.
  2831. @item mpan
  2832. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2833. @item base
  2834. Set stereo base between mono and inversed channels. Default is 0.
  2835. Allowed range is from -1 to 1.
  2836. @item delay
  2837. Set delay in milliseconds how much to delay left from right channel and
  2838. vice versa. Default is 0. Allowed range is from -20 to 20.
  2839. @item sclevel
  2840. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2841. @item phase
  2842. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2843. @end table
  2844. @subsection Examples
  2845. @itemize
  2846. @item
  2847. Apply karaoke like effect:
  2848. @example
  2849. stereotools=mlev=0.015625
  2850. @end example
  2851. @item
  2852. Convert M/S signal to L/R:
  2853. @example
  2854. "stereotools=mode=ms>lr"
  2855. @end example
  2856. @end itemize
  2857. @section stereowiden
  2858. This filter enhance the stereo effect by suppressing signal common to both
  2859. channels and by delaying the signal of left into right and vice versa,
  2860. thereby widening the stereo effect.
  2861. The filter accepts the following options:
  2862. @table @option
  2863. @item delay
  2864. Time in milliseconds of the delay of left signal into right and vice versa.
  2865. Default is 20 milliseconds.
  2866. @item feedback
  2867. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2868. effect of left signal in right output and vice versa which gives widening
  2869. effect. Default is 0.3.
  2870. @item crossfeed
  2871. Cross feed of left into right with inverted phase. This helps in suppressing
  2872. the mono. If the value is 1 it will cancel all the signal common to both
  2873. channels. Default is 0.3.
  2874. @item drymix
  2875. Set level of input signal of original channel. Default is 0.8.
  2876. @end table
  2877. @section treble
  2878. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2879. shelving filter with a response similar to that of a standard
  2880. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2881. The filter accepts the following options:
  2882. @table @option
  2883. @item gain, g
  2884. Give the gain at whichever is the lower of ~22 kHz and the
  2885. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2886. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2887. @item frequency, f
  2888. Set the filter's central frequency and so can be used
  2889. to extend or reduce the frequency range to be boosted or cut.
  2890. The default value is @code{3000} Hz.
  2891. @item width_type
  2892. Set method to specify band-width of filter.
  2893. @table @option
  2894. @item h
  2895. Hz
  2896. @item q
  2897. Q-Factor
  2898. @item o
  2899. octave
  2900. @item s
  2901. slope
  2902. @end table
  2903. @item width, w
  2904. Determine how steep is the filter's shelf transition.
  2905. @end table
  2906. @section tremolo
  2907. Sinusoidal amplitude modulation.
  2908. The filter accepts the following options:
  2909. @table @option
  2910. @item f
  2911. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2912. (20 Hz or lower) will result in a tremolo effect.
  2913. This filter may also be used as a ring modulator by specifying
  2914. a modulation frequency higher than 20 Hz.
  2915. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2916. @item d
  2917. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2918. Default value is 0.5.
  2919. @end table
  2920. @section vibrato
  2921. Sinusoidal phase modulation.
  2922. The filter accepts the following options:
  2923. @table @option
  2924. @item f
  2925. Modulation frequency in Hertz.
  2926. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2927. @item d
  2928. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2929. Default value is 0.5.
  2930. @end table
  2931. @section volume
  2932. Adjust the input audio volume.
  2933. It accepts the following parameters:
  2934. @table @option
  2935. @item volume
  2936. Set audio volume expression.
  2937. Output values are clipped to the maximum value.
  2938. The output audio volume is given by the relation:
  2939. @example
  2940. @var{output_volume} = @var{volume} * @var{input_volume}
  2941. @end example
  2942. The default value for @var{volume} is "1.0".
  2943. @item precision
  2944. This parameter represents the mathematical precision.
  2945. It determines which input sample formats will be allowed, which affects the
  2946. precision of the volume scaling.
  2947. @table @option
  2948. @item fixed
  2949. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2950. @item float
  2951. 32-bit floating-point; this limits input sample format to FLT. (default)
  2952. @item double
  2953. 64-bit floating-point; this limits input sample format to DBL.
  2954. @end table
  2955. @item replaygain
  2956. Choose the behaviour on encountering ReplayGain side data in input frames.
  2957. @table @option
  2958. @item drop
  2959. Remove ReplayGain side data, ignoring its contents (the default).
  2960. @item ignore
  2961. Ignore ReplayGain side data, but leave it in the frame.
  2962. @item track
  2963. Prefer the track gain, if present.
  2964. @item album
  2965. Prefer the album gain, if present.
  2966. @end table
  2967. @item replaygain_preamp
  2968. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2969. Default value for @var{replaygain_preamp} is 0.0.
  2970. @item eval
  2971. Set when the volume expression is evaluated.
  2972. It accepts the following values:
  2973. @table @samp
  2974. @item once
  2975. only evaluate expression once during the filter initialization, or
  2976. when the @samp{volume} command is sent
  2977. @item frame
  2978. evaluate expression for each incoming frame
  2979. @end table
  2980. Default value is @samp{once}.
  2981. @end table
  2982. The volume expression can contain the following parameters.
  2983. @table @option
  2984. @item n
  2985. frame number (starting at zero)
  2986. @item nb_channels
  2987. number of channels
  2988. @item nb_consumed_samples
  2989. number of samples consumed by the filter
  2990. @item nb_samples
  2991. number of samples in the current frame
  2992. @item pos
  2993. original frame position in the file
  2994. @item pts
  2995. frame PTS
  2996. @item sample_rate
  2997. sample rate
  2998. @item startpts
  2999. PTS at start of stream
  3000. @item startt
  3001. time at start of stream
  3002. @item t
  3003. frame time
  3004. @item tb
  3005. timestamp timebase
  3006. @item volume
  3007. last set volume value
  3008. @end table
  3009. Note that when @option{eval} is set to @samp{once} only the
  3010. @var{sample_rate} and @var{tb} variables are available, all other
  3011. variables will evaluate to NAN.
  3012. @subsection Commands
  3013. This filter supports the following commands:
  3014. @table @option
  3015. @item volume
  3016. Modify the volume expression.
  3017. The command accepts the same syntax of the corresponding option.
  3018. If the specified expression is not valid, it is kept at its current
  3019. value.
  3020. @item replaygain_noclip
  3021. Prevent clipping by limiting the gain applied.
  3022. Default value for @var{replaygain_noclip} is 1.
  3023. @end table
  3024. @subsection Examples
  3025. @itemize
  3026. @item
  3027. Halve the input audio volume:
  3028. @example
  3029. volume=volume=0.5
  3030. volume=volume=1/2
  3031. volume=volume=-6.0206dB
  3032. @end example
  3033. In all the above example the named key for @option{volume} can be
  3034. omitted, for example like in:
  3035. @example
  3036. volume=0.5
  3037. @end example
  3038. @item
  3039. Increase input audio power by 6 decibels using fixed-point precision:
  3040. @example
  3041. volume=volume=6dB:precision=fixed
  3042. @end example
  3043. @item
  3044. Fade volume after time 10 with an annihilation period of 5 seconds:
  3045. @example
  3046. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3047. @end example
  3048. @end itemize
  3049. @section volumedetect
  3050. Detect the volume of the input video.
  3051. The filter has no parameters. The input is not modified. Statistics about
  3052. the volume will be printed in the log when the input stream end is reached.
  3053. In particular it will show the mean volume (root mean square), maximum
  3054. volume (on a per-sample basis), and the beginning of a histogram of the
  3055. registered volume values (from the maximum value to a cumulated 1/1000 of
  3056. the samples).
  3057. All volumes are in decibels relative to the maximum PCM value.
  3058. @subsection Examples
  3059. Here is an excerpt of the output:
  3060. @example
  3061. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3062. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3063. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3064. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3065. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3066. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3067. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3068. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3069. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3070. @end example
  3071. It means that:
  3072. @itemize
  3073. @item
  3074. The mean square energy is approximately -27 dB, or 10^-2.7.
  3075. @item
  3076. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3077. @item
  3078. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3079. @end itemize
  3080. In other words, raising the volume by +4 dB does not cause any clipping,
  3081. raising it by +5 dB causes clipping for 6 samples, etc.
  3082. @c man end AUDIO FILTERS
  3083. @chapter Audio Sources
  3084. @c man begin AUDIO SOURCES
  3085. Below is a description of the currently available audio sources.
  3086. @section abuffer
  3087. Buffer audio frames, and make them available to the filter chain.
  3088. This source is mainly intended for a programmatic use, in particular
  3089. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3090. It accepts the following parameters:
  3091. @table @option
  3092. @item time_base
  3093. The timebase which will be used for timestamps of submitted frames. It must be
  3094. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3095. @item sample_rate
  3096. The sample rate of the incoming audio buffers.
  3097. @item sample_fmt
  3098. The sample format of the incoming audio buffers.
  3099. Either a sample format name or its corresponding integer representation from
  3100. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3101. @item channel_layout
  3102. The channel layout of the incoming audio buffers.
  3103. Either a channel layout name from channel_layout_map in
  3104. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3105. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3106. @item channels
  3107. The number of channels of the incoming audio buffers.
  3108. If both @var{channels} and @var{channel_layout} are specified, then they
  3109. must be consistent.
  3110. @end table
  3111. @subsection Examples
  3112. @example
  3113. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3114. @end example
  3115. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3116. Since the sample format with name "s16p" corresponds to the number
  3117. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3118. equivalent to:
  3119. @example
  3120. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3121. @end example
  3122. @section aevalsrc
  3123. Generate an audio signal specified by an expression.
  3124. This source accepts in input one or more expressions (one for each
  3125. channel), which are evaluated and used to generate a corresponding
  3126. audio signal.
  3127. This source accepts the following options:
  3128. @table @option
  3129. @item exprs
  3130. Set the '|'-separated expressions list for each separate channel. In case the
  3131. @option{channel_layout} option is not specified, the selected channel layout
  3132. depends on the number of provided expressions. Otherwise the last
  3133. specified expression is applied to the remaining output channels.
  3134. @item channel_layout, c
  3135. Set the channel layout. The number of channels in the specified layout
  3136. must be equal to the number of specified expressions.
  3137. @item duration, d
  3138. Set the minimum duration of the sourced audio. See
  3139. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3140. for the accepted syntax.
  3141. Note that the resulting duration may be greater than the specified
  3142. duration, as the generated audio is always cut at the end of a
  3143. complete frame.
  3144. If not specified, or the expressed duration is negative, the audio is
  3145. supposed to be generated forever.
  3146. @item nb_samples, n
  3147. Set the number of samples per channel per each output frame,
  3148. default to 1024.
  3149. @item sample_rate, s
  3150. Specify the sample rate, default to 44100.
  3151. @end table
  3152. Each expression in @var{exprs} can contain the following constants:
  3153. @table @option
  3154. @item n
  3155. number of the evaluated sample, starting from 0
  3156. @item t
  3157. time of the evaluated sample expressed in seconds, starting from 0
  3158. @item s
  3159. sample rate
  3160. @end table
  3161. @subsection Examples
  3162. @itemize
  3163. @item
  3164. Generate silence:
  3165. @example
  3166. aevalsrc=0
  3167. @end example
  3168. @item
  3169. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3170. 8000 Hz:
  3171. @example
  3172. aevalsrc="sin(440*2*PI*t):s=8000"
  3173. @end example
  3174. @item
  3175. Generate a two channels signal, specify the channel layout (Front
  3176. Center + Back Center) explicitly:
  3177. @example
  3178. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3179. @end example
  3180. @item
  3181. Generate white noise:
  3182. @example
  3183. aevalsrc="-2+random(0)"
  3184. @end example
  3185. @item
  3186. Generate an amplitude modulated signal:
  3187. @example
  3188. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3189. @end example
  3190. @item
  3191. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3192. @example
  3193. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3194. @end example
  3195. @end itemize
  3196. @section anullsrc
  3197. The null audio source, return unprocessed audio frames. It is mainly useful
  3198. as a template and to be employed in analysis / debugging tools, or as
  3199. the source for filters which ignore the input data (for example the sox
  3200. synth filter).
  3201. This source accepts the following options:
  3202. @table @option
  3203. @item channel_layout, cl
  3204. Specifies the channel layout, and can be either an integer or a string
  3205. representing a channel layout. The default value of @var{channel_layout}
  3206. is "stereo".
  3207. Check the channel_layout_map definition in
  3208. @file{libavutil/channel_layout.c} for the mapping between strings and
  3209. channel layout values.
  3210. @item sample_rate, r
  3211. Specifies the sample rate, and defaults to 44100.
  3212. @item nb_samples, n
  3213. Set the number of samples per requested frames.
  3214. @end table
  3215. @subsection Examples
  3216. @itemize
  3217. @item
  3218. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3219. @example
  3220. anullsrc=r=48000:cl=4
  3221. @end example
  3222. @item
  3223. Do the same operation with a more obvious syntax:
  3224. @example
  3225. anullsrc=r=48000:cl=mono
  3226. @end example
  3227. @end itemize
  3228. All the parameters need to be explicitly defined.
  3229. @section flite
  3230. Synthesize a voice utterance using the libflite library.
  3231. To enable compilation of this filter you need to configure FFmpeg with
  3232. @code{--enable-libflite}.
  3233. Note that the flite library is not thread-safe.
  3234. The filter accepts the following options:
  3235. @table @option
  3236. @item list_voices
  3237. If set to 1, list the names of the available voices and exit
  3238. immediately. Default value is 0.
  3239. @item nb_samples, n
  3240. Set the maximum number of samples per frame. Default value is 512.
  3241. @item textfile
  3242. Set the filename containing the text to speak.
  3243. @item text
  3244. Set the text to speak.
  3245. @item voice, v
  3246. Set the voice to use for the speech synthesis. Default value is
  3247. @code{kal}. See also the @var{list_voices} option.
  3248. @end table
  3249. @subsection Examples
  3250. @itemize
  3251. @item
  3252. Read from file @file{speech.txt}, and synthesize the text using the
  3253. standard flite voice:
  3254. @example
  3255. flite=textfile=speech.txt
  3256. @end example
  3257. @item
  3258. Read the specified text selecting the @code{slt} voice:
  3259. @example
  3260. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3261. @end example
  3262. @item
  3263. Input text to ffmpeg:
  3264. @example
  3265. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3266. @end example
  3267. @item
  3268. Make @file{ffplay} speak the specified text, using @code{flite} and
  3269. the @code{lavfi} device:
  3270. @example
  3271. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3272. @end example
  3273. @end itemize
  3274. For more information about libflite, check:
  3275. @url{http://www.speech.cs.cmu.edu/flite/}
  3276. @section anoisesrc
  3277. Generate a noise audio signal.
  3278. The filter accepts the following options:
  3279. @table @option
  3280. @item sample_rate, r
  3281. Specify the sample rate. Default value is 48000 Hz.
  3282. @item amplitude, a
  3283. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3284. is 1.0.
  3285. @item duration, d
  3286. Specify the duration of the generated audio stream. Not specifying this option
  3287. results in noise with an infinite length.
  3288. @item color, colour, c
  3289. Specify the color of noise. Available noise colors are white, pink, and brown.
  3290. Default color is white.
  3291. @item seed, s
  3292. Specify a value used to seed the PRNG.
  3293. @item nb_samples, n
  3294. Set the number of samples per each output frame, default is 1024.
  3295. @end table
  3296. @subsection Examples
  3297. @itemize
  3298. @item
  3299. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3300. @example
  3301. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3302. @end example
  3303. @end itemize
  3304. @section sine
  3305. Generate an audio signal made of a sine wave with amplitude 1/8.
  3306. The audio signal is bit-exact.
  3307. The filter accepts the following options:
  3308. @table @option
  3309. @item frequency, f
  3310. Set the carrier frequency. Default is 440 Hz.
  3311. @item beep_factor, b
  3312. Enable a periodic beep every second with frequency @var{beep_factor} times
  3313. the carrier frequency. Default is 0, meaning the beep is disabled.
  3314. @item sample_rate, r
  3315. Specify the sample rate, default is 44100.
  3316. @item duration, d
  3317. Specify the duration of the generated audio stream.
  3318. @item samples_per_frame
  3319. Set the number of samples per output frame.
  3320. The expression can contain the following constants:
  3321. @table @option
  3322. @item n
  3323. The (sequential) number of the output audio frame, starting from 0.
  3324. @item pts
  3325. The PTS (Presentation TimeStamp) of the output audio frame,
  3326. expressed in @var{TB} units.
  3327. @item t
  3328. The PTS of the output audio frame, expressed in seconds.
  3329. @item TB
  3330. The timebase of the output audio frames.
  3331. @end table
  3332. Default is @code{1024}.
  3333. @end table
  3334. @subsection Examples
  3335. @itemize
  3336. @item
  3337. Generate a simple 440 Hz sine wave:
  3338. @example
  3339. sine
  3340. @end example
  3341. @item
  3342. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3343. @example
  3344. sine=220:4:d=5
  3345. sine=f=220:b=4:d=5
  3346. sine=frequency=220:beep_factor=4:duration=5
  3347. @end example
  3348. @item
  3349. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3350. pattern:
  3351. @example
  3352. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3353. @end example
  3354. @end itemize
  3355. @c man end AUDIO SOURCES
  3356. @chapter Audio Sinks
  3357. @c man begin AUDIO SINKS
  3358. Below is a description of the currently available audio sinks.
  3359. @section abuffersink
  3360. Buffer audio frames, and make them available to the end of filter chain.
  3361. This sink is mainly intended for programmatic use, in particular
  3362. through the interface defined in @file{libavfilter/buffersink.h}
  3363. or the options system.
  3364. It accepts a pointer to an AVABufferSinkContext structure, which
  3365. defines the incoming buffers' formats, to be passed as the opaque
  3366. parameter to @code{avfilter_init_filter} for initialization.
  3367. @section anullsink
  3368. Null audio sink; do absolutely nothing with the input audio. It is
  3369. mainly useful as a template and for use in analysis / debugging
  3370. tools.
  3371. @c man end AUDIO SINKS
  3372. @chapter Video Filters
  3373. @c man begin VIDEO FILTERS
  3374. When you configure your FFmpeg build, you can disable any of the
  3375. existing filters using @code{--disable-filters}.
  3376. The configure output will show the video filters included in your
  3377. build.
  3378. Below is a description of the currently available video filters.
  3379. @section alphaextract
  3380. Extract the alpha component from the input as a grayscale video. This
  3381. is especially useful with the @var{alphamerge} filter.
  3382. @section alphamerge
  3383. Add or replace the alpha component of the primary input with the
  3384. grayscale value of a second input. This is intended for use with
  3385. @var{alphaextract} to allow the transmission or storage of frame
  3386. sequences that have alpha in a format that doesn't support an alpha
  3387. channel.
  3388. For example, to reconstruct full frames from a normal YUV-encoded video
  3389. and a separate video created with @var{alphaextract}, you might use:
  3390. @example
  3391. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3392. @end example
  3393. Since this filter is designed for reconstruction, it operates on frame
  3394. sequences without considering timestamps, and terminates when either
  3395. input reaches end of stream. This will cause problems if your encoding
  3396. pipeline drops frames. If you're trying to apply an image as an
  3397. overlay to a video stream, consider the @var{overlay} filter instead.
  3398. @section ass
  3399. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3400. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3401. Substation Alpha) subtitles files.
  3402. This filter accepts the following option in addition to the common options from
  3403. the @ref{subtitles} filter:
  3404. @table @option
  3405. @item shaping
  3406. Set the shaping engine
  3407. Available values are:
  3408. @table @samp
  3409. @item auto
  3410. The default libass shaping engine, which is the best available.
  3411. @item simple
  3412. Fast, font-agnostic shaper that can do only substitutions
  3413. @item complex
  3414. Slower shaper using OpenType for substitutions and positioning
  3415. @end table
  3416. The default is @code{auto}.
  3417. @end table
  3418. @section atadenoise
  3419. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3420. The filter accepts the following options:
  3421. @table @option
  3422. @item 0a
  3423. Set threshold A for 1st plane. Default is 0.02.
  3424. Valid range is 0 to 0.3.
  3425. @item 0b
  3426. Set threshold B for 1st plane. Default is 0.04.
  3427. Valid range is 0 to 5.
  3428. @item 1a
  3429. Set threshold A for 2nd plane. Default is 0.02.
  3430. Valid range is 0 to 0.3.
  3431. @item 1b
  3432. Set threshold B for 2nd plane. Default is 0.04.
  3433. Valid range is 0 to 5.
  3434. @item 2a
  3435. Set threshold A for 3rd plane. Default is 0.02.
  3436. Valid range is 0 to 0.3.
  3437. @item 2b
  3438. Set threshold B for 3rd plane. Default is 0.04.
  3439. Valid range is 0 to 5.
  3440. Threshold A is designed to react on abrupt changes in the input signal and
  3441. threshold B is designed to react on continuous changes in the input signal.
  3442. @item s
  3443. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3444. number in range [5, 129].
  3445. @item p
  3446. Set what planes of frame filter will use for averaging. Default is all.
  3447. @end table
  3448. @section avgblur
  3449. Apply average blur filter.
  3450. The filter accepts the following options:
  3451. @table @option
  3452. @item sizeX
  3453. Set horizontal kernel size.
  3454. @item planes
  3455. Set which planes to filter. By default all planes are filtered.
  3456. @item sizeY
  3457. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3458. Default is @code{0}.
  3459. @end table
  3460. @section bbox
  3461. Compute the bounding box for the non-black pixels in the input frame
  3462. luminance plane.
  3463. This filter computes the bounding box containing all the pixels with a
  3464. luminance value greater than the minimum allowed value.
  3465. The parameters describing the bounding box are printed on the filter
  3466. log.
  3467. The filter accepts the following option:
  3468. @table @option
  3469. @item min_val
  3470. Set the minimal luminance value. Default is @code{16}.
  3471. @end table
  3472. @section bitplanenoise
  3473. Show and measure bit plane noise.
  3474. The filter accepts the following options:
  3475. @table @option
  3476. @item bitplane
  3477. Set which plane to analyze. Default is @code{1}.
  3478. @item filter
  3479. Filter out noisy pixels from @code{bitplane} set above.
  3480. Default is disabled.
  3481. @end table
  3482. @section blackdetect
  3483. Detect video intervals that are (almost) completely black. Can be
  3484. useful to detect chapter transitions, commercials, or invalid
  3485. recordings. Output lines contains the time for the start, end and
  3486. duration of the detected black interval expressed in seconds.
  3487. In order to display the output lines, you need to set the loglevel at
  3488. least to the AV_LOG_INFO value.
  3489. The filter accepts the following options:
  3490. @table @option
  3491. @item black_min_duration, d
  3492. Set the minimum detected black duration expressed in seconds. It must
  3493. be a non-negative floating point number.
  3494. Default value is 2.0.
  3495. @item picture_black_ratio_th, pic_th
  3496. Set the threshold for considering a picture "black".
  3497. Express the minimum value for the ratio:
  3498. @example
  3499. @var{nb_black_pixels} / @var{nb_pixels}
  3500. @end example
  3501. for which a picture is considered black.
  3502. Default value is 0.98.
  3503. @item pixel_black_th, pix_th
  3504. Set the threshold for considering a pixel "black".
  3505. The threshold expresses the maximum pixel luminance value for which a
  3506. pixel is considered "black". The provided value is scaled according to
  3507. the following equation:
  3508. @example
  3509. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3510. @end example
  3511. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3512. the input video format, the range is [0-255] for YUV full-range
  3513. formats and [16-235] for YUV non full-range formats.
  3514. Default value is 0.10.
  3515. @end table
  3516. The following example sets the maximum pixel threshold to the minimum
  3517. value, and detects only black intervals of 2 or more seconds:
  3518. @example
  3519. blackdetect=d=2:pix_th=0.00
  3520. @end example
  3521. @section blackframe
  3522. Detect frames that are (almost) completely black. Can be useful to
  3523. detect chapter transitions or commercials. Output lines consist of
  3524. the frame number of the detected frame, the percentage of blackness,
  3525. the position in the file if known or -1 and the timestamp in seconds.
  3526. In order to display the output lines, you need to set the loglevel at
  3527. least to the AV_LOG_INFO value.
  3528. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3529. The value represents the percentage of pixels in the picture that
  3530. are below the threshold value.
  3531. It accepts the following parameters:
  3532. @table @option
  3533. @item amount
  3534. The percentage of the pixels that have to be below the threshold; it defaults to
  3535. @code{98}.
  3536. @item threshold, thresh
  3537. The threshold below which a pixel value is considered black; it defaults to
  3538. @code{32}.
  3539. @end table
  3540. @section blend, tblend
  3541. Blend two video frames into each other.
  3542. The @code{blend} filter takes two input streams and outputs one
  3543. stream, the first input is the "top" layer and second input is
  3544. "bottom" layer. By default, the output terminates when the longest input terminates.
  3545. The @code{tblend} (time blend) filter takes two consecutive frames
  3546. from one single stream, and outputs the result obtained by blending
  3547. the new frame on top of the old frame.
  3548. A description of the accepted options follows.
  3549. @table @option
  3550. @item c0_mode
  3551. @item c1_mode
  3552. @item c2_mode
  3553. @item c3_mode
  3554. @item all_mode
  3555. Set blend mode for specific pixel component or all pixel components in case
  3556. of @var{all_mode}. Default value is @code{normal}.
  3557. Available values for component modes are:
  3558. @table @samp
  3559. @item addition
  3560. @item addition128
  3561. @item and
  3562. @item average
  3563. @item burn
  3564. @item darken
  3565. @item difference
  3566. @item difference128
  3567. @item divide
  3568. @item dodge
  3569. @item freeze
  3570. @item exclusion
  3571. @item glow
  3572. @item hardlight
  3573. @item hardmix
  3574. @item heat
  3575. @item lighten
  3576. @item linearlight
  3577. @item multiply
  3578. @item multiply128
  3579. @item negation
  3580. @item normal
  3581. @item or
  3582. @item overlay
  3583. @item phoenix
  3584. @item pinlight
  3585. @item reflect
  3586. @item screen
  3587. @item softlight
  3588. @item subtract
  3589. @item vividlight
  3590. @item xor
  3591. @end table
  3592. @item c0_opacity
  3593. @item c1_opacity
  3594. @item c2_opacity
  3595. @item c3_opacity
  3596. @item all_opacity
  3597. Set blend opacity for specific pixel component or all pixel components in case
  3598. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3599. @item c0_expr
  3600. @item c1_expr
  3601. @item c2_expr
  3602. @item c3_expr
  3603. @item all_expr
  3604. Set blend expression for specific pixel component or all pixel components in case
  3605. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3606. The expressions can use the following variables:
  3607. @table @option
  3608. @item N
  3609. The sequential number of the filtered frame, starting from @code{0}.
  3610. @item X
  3611. @item Y
  3612. the coordinates of the current sample
  3613. @item W
  3614. @item H
  3615. the width and height of currently filtered plane
  3616. @item SW
  3617. @item SH
  3618. Width and height scale depending on the currently filtered plane. It is the
  3619. ratio between the corresponding luma plane number of pixels and the current
  3620. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3621. @code{0.5,0.5} for chroma planes.
  3622. @item T
  3623. Time of the current frame, expressed in seconds.
  3624. @item TOP, A
  3625. Value of pixel component at current location for first video frame (top layer).
  3626. @item BOTTOM, B
  3627. Value of pixel component at current location for second video frame (bottom layer).
  3628. @end table
  3629. @item shortest
  3630. Force termination when the shortest input terminates. Default is
  3631. @code{0}. This option is only defined for the @code{blend} filter.
  3632. @item repeatlast
  3633. Continue applying the last bottom frame after the end of the stream. A value of
  3634. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3635. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3636. @end table
  3637. @subsection Examples
  3638. @itemize
  3639. @item
  3640. Apply transition from bottom layer to top layer in first 10 seconds:
  3641. @example
  3642. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3643. @end example
  3644. @item
  3645. Apply 1x1 checkerboard effect:
  3646. @example
  3647. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3648. @end example
  3649. @item
  3650. Apply uncover left effect:
  3651. @example
  3652. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3653. @end example
  3654. @item
  3655. Apply uncover down effect:
  3656. @example
  3657. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3658. @end example
  3659. @item
  3660. Apply uncover up-left effect:
  3661. @example
  3662. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3663. @end example
  3664. @item
  3665. Split diagonally video and shows top and bottom layer on each side:
  3666. @example
  3667. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3668. @end example
  3669. @item
  3670. Display differences between the current and the previous frame:
  3671. @example
  3672. tblend=all_mode=difference128
  3673. @end example
  3674. @end itemize
  3675. @section boxblur
  3676. Apply a boxblur algorithm to the input video.
  3677. It accepts the following parameters:
  3678. @table @option
  3679. @item luma_radius, lr
  3680. @item luma_power, lp
  3681. @item chroma_radius, cr
  3682. @item chroma_power, cp
  3683. @item alpha_radius, ar
  3684. @item alpha_power, ap
  3685. @end table
  3686. A description of the accepted options follows.
  3687. @table @option
  3688. @item luma_radius, lr
  3689. @item chroma_radius, cr
  3690. @item alpha_radius, ar
  3691. Set an expression for the box radius in pixels used for blurring the
  3692. corresponding input plane.
  3693. The radius value must be a non-negative number, and must not be
  3694. greater than the value of the expression @code{min(w,h)/2} for the
  3695. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3696. planes.
  3697. Default value for @option{luma_radius} is "2". If not specified,
  3698. @option{chroma_radius} and @option{alpha_radius} default to the
  3699. corresponding value set for @option{luma_radius}.
  3700. The expressions can contain the following constants:
  3701. @table @option
  3702. @item w
  3703. @item h
  3704. The input width and height in pixels.
  3705. @item cw
  3706. @item ch
  3707. The input chroma image width and height in pixels.
  3708. @item hsub
  3709. @item vsub
  3710. The horizontal and vertical chroma subsample values. For example, for the
  3711. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3712. @end table
  3713. @item luma_power, lp
  3714. @item chroma_power, cp
  3715. @item alpha_power, ap
  3716. Specify how many times the boxblur filter is applied to the
  3717. corresponding plane.
  3718. Default value for @option{luma_power} is 2. If not specified,
  3719. @option{chroma_power} and @option{alpha_power} default to the
  3720. corresponding value set for @option{luma_power}.
  3721. A value of 0 will disable the effect.
  3722. @end table
  3723. @subsection Examples
  3724. @itemize
  3725. @item
  3726. Apply a boxblur filter with the luma, chroma, and alpha radii
  3727. set to 2:
  3728. @example
  3729. boxblur=luma_radius=2:luma_power=1
  3730. boxblur=2:1
  3731. @end example
  3732. @item
  3733. Set the luma radius to 2, and alpha and chroma radius to 0:
  3734. @example
  3735. boxblur=2:1:cr=0:ar=0
  3736. @end example
  3737. @item
  3738. Set the luma and chroma radii to a fraction of the video dimension:
  3739. @example
  3740. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3741. @end example
  3742. @end itemize
  3743. @section bwdif
  3744. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3745. Deinterlacing Filter").
  3746. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3747. interpolation algorithms.
  3748. It accepts the following parameters:
  3749. @table @option
  3750. @item mode
  3751. The interlacing mode to adopt. It accepts one of the following values:
  3752. @table @option
  3753. @item 0, send_frame
  3754. Output one frame for each frame.
  3755. @item 1, send_field
  3756. Output one frame for each field.
  3757. @end table
  3758. The default value is @code{send_field}.
  3759. @item parity
  3760. The picture field parity assumed for the input interlaced video. It accepts one
  3761. of the following values:
  3762. @table @option
  3763. @item 0, tff
  3764. Assume the top field is first.
  3765. @item 1, bff
  3766. Assume the bottom field is first.
  3767. @item -1, auto
  3768. Enable automatic detection of field parity.
  3769. @end table
  3770. The default value is @code{auto}.
  3771. If the interlacing is unknown or the decoder does not export this information,
  3772. top field first will be assumed.
  3773. @item deint
  3774. Specify which frames to deinterlace. Accept one of the following
  3775. values:
  3776. @table @option
  3777. @item 0, all
  3778. Deinterlace all frames.
  3779. @item 1, interlaced
  3780. Only deinterlace frames marked as interlaced.
  3781. @end table
  3782. The default value is @code{all}.
  3783. @end table
  3784. @section chromakey
  3785. YUV colorspace color/chroma keying.
  3786. The filter accepts the following options:
  3787. @table @option
  3788. @item color
  3789. The color which will be replaced with transparency.
  3790. @item similarity
  3791. Similarity percentage with the key color.
  3792. 0.01 matches only the exact key color, while 1.0 matches everything.
  3793. @item blend
  3794. Blend percentage.
  3795. 0.0 makes pixels either fully transparent, or not transparent at all.
  3796. Higher values result in semi-transparent pixels, with a higher transparency
  3797. the more similar the pixels color is to the key color.
  3798. @item yuv
  3799. Signals that the color passed is already in YUV instead of RGB.
  3800. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3801. This can be used to pass exact YUV values as hexadecimal numbers.
  3802. @end table
  3803. @subsection Examples
  3804. @itemize
  3805. @item
  3806. Make every green pixel in the input image transparent:
  3807. @example
  3808. ffmpeg -i input.png -vf chromakey=green out.png
  3809. @end example
  3810. @item
  3811. Overlay a greenscreen-video on top of a static black background.
  3812. @example
  3813. 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
  3814. @end example
  3815. @end itemize
  3816. @section ciescope
  3817. Display CIE color diagram with pixels overlaid onto it.
  3818. The filter accepts the following options:
  3819. @table @option
  3820. @item system
  3821. Set color system.
  3822. @table @samp
  3823. @item ntsc, 470m
  3824. @item ebu, 470bg
  3825. @item smpte
  3826. @item 240m
  3827. @item apple
  3828. @item widergb
  3829. @item cie1931
  3830. @item rec709, hdtv
  3831. @item uhdtv, rec2020
  3832. @end table
  3833. @item cie
  3834. Set CIE system.
  3835. @table @samp
  3836. @item xyy
  3837. @item ucs
  3838. @item luv
  3839. @end table
  3840. @item gamuts
  3841. Set what gamuts to draw.
  3842. See @code{system} option for available values.
  3843. @item size, s
  3844. Set ciescope size, by default set to 512.
  3845. @item intensity, i
  3846. Set intensity used to map input pixel values to CIE diagram.
  3847. @item contrast
  3848. Set contrast used to draw tongue colors that are out of active color system gamut.
  3849. @item corrgamma
  3850. Correct gamma displayed on scope, by default enabled.
  3851. @item showwhite
  3852. Show white point on CIE diagram, by default disabled.
  3853. @item gamma
  3854. Set input gamma. Used only with XYZ input color space.
  3855. @end table
  3856. @section codecview
  3857. Visualize information exported by some codecs.
  3858. Some codecs can export information through frames using side-data or other
  3859. means. For example, some MPEG based codecs export motion vectors through the
  3860. @var{export_mvs} flag in the codec @option{flags2} option.
  3861. The filter accepts the following option:
  3862. @table @option
  3863. @item mv
  3864. Set motion vectors to visualize.
  3865. Available flags for @var{mv} are:
  3866. @table @samp
  3867. @item pf
  3868. forward predicted MVs of P-frames
  3869. @item bf
  3870. forward predicted MVs of B-frames
  3871. @item bb
  3872. backward predicted MVs of B-frames
  3873. @end table
  3874. @item qp
  3875. Display quantization parameters using the chroma planes.
  3876. @item mv_type, mvt
  3877. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3878. Available flags for @var{mv_type} are:
  3879. @table @samp
  3880. @item fp
  3881. forward predicted MVs
  3882. @item bp
  3883. backward predicted MVs
  3884. @end table
  3885. @item frame_type, ft
  3886. Set frame type to visualize motion vectors of.
  3887. Available flags for @var{frame_type} are:
  3888. @table @samp
  3889. @item if
  3890. intra-coded frames (I-frames)
  3891. @item pf
  3892. predicted frames (P-frames)
  3893. @item bf
  3894. bi-directionally predicted frames (B-frames)
  3895. @end table
  3896. @end table
  3897. @subsection Examples
  3898. @itemize
  3899. @item
  3900. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3901. @example
  3902. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3903. @end example
  3904. @item
  3905. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3906. @example
  3907. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3908. @end example
  3909. @end itemize
  3910. @section colorbalance
  3911. Modify intensity of primary colors (red, green and blue) of input frames.
  3912. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3913. regions for the red-cyan, green-magenta or blue-yellow balance.
  3914. A positive adjustment value shifts the balance towards the primary color, a negative
  3915. value towards the complementary color.
  3916. The filter accepts the following options:
  3917. @table @option
  3918. @item rs
  3919. @item gs
  3920. @item bs
  3921. Adjust red, green and blue shadows (darkest pixels).
  3922. @item rm
  3923. @item gm
  3924. @item bm
  3925. Adjust red, green and blue midtones (medium pixels).
  3926. @item rh
  3927. @item gh
  3928. @item bh
  3929. Adjust red, green and blue highlights (brightest pixels).
  3930. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3931. @end table
  3932. @subsection Examples
  3933. @itemize
  3934. @item
  3935. Add red color cast to shadows:
  3936. @example
  3937. colorbalance=rs=.3
  3938. @end example
  3939. @end itemize
  3940. @section colorkey
  3941. RGB colorspace color keying.
  3942. The filter accepts the following options:
  3943. @table @option
  3944. @item color
  3945. The color which will be replaced with transparency.
  3946. @item similarity
  3947. Similarity percentage with the key color.
  3948. 0.01 matches only the exact key color, while 1.0 matches everything.
  3949. @item blend
  3950. Blend percentage.
  3951. 0.0 makes pixels either fully transparent, or not transparent at all.
  3952. Higher values result in semi-transparent pixels, with a higher transparency
  3953. the more similar the pixels color is to the key color.
  3954. @end table
  3955. @subsection Examples
  3956. @itemize
  3957. @item
  3958. Make every green pixel in the input image transparent:
  3959. @example
  3960. ffmpeg -i input.png -vf colorkey=green out.png
  3961. @end example
  3962. @item
  3963. Overlay a greenscreen-video on top of a static background image.
  3964. @example
  3965. 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
  3966. @end example
  3967. @end itemize
  3968. @section colorlevels
  3969. Adjust video input frames using levels.
  3970. The filter accepts the following options:
  3971. @table @option
  3972. @item rimin
  3973. @item gimin
  3974. @item bimin
  3975. @item aimin
  3976. Adjust red, green, blue and alpha input black point.
  3977. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3978. @item rimax
  3979. @item gimax
  3980. @item bimax
  3981. @item aimax
  3982. Adjust red, green, blue and alpha input white point.
  3983. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3984. Input levels are used to lighten highlights (bright tones), darken shadows
  3985. (dark tones), change the balance of bright and dark tones.
  3986. @item romin
  3987. @item gomin
  3988. @item bomin
  3989. @item aomin
  3990. Adjust red, green, blue and alpha output black point.
  3991. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3992. @item romax
  3993. @item gomax
  3994. @item bomax
  3995. @item aomax
  3996. Adjust red, green, blue and alpha output white point.
  3997. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3998. Output levels allows manual selection of a constrained output level range.
  3999. @end table
  4000. @subsection Examples
  4001. @itemize
  4002. @item
  4003. Make video output darker:
  4004. @example
  4005. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4006. @end example
  4007. @item
  4008. Increase contrast:
  4009. @example
  4010. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4011. @end example
  4012. @item
  4013. Make video output lighter:
  4014. @example
  4015. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4016. @end example
  4017. @item
  4018. Increase brightness:
  4019. @example
  4020. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4021. @end example
  4022. @end itemize
  4023. @section colorchannelmixer
  4024. Adjust video input frames by re-mixing color channels.
  4025. This filter modifies a color channel by adding the values associated to
  4026. the other channels of the same pixels. For example if the value to
  4027. modify is red, the output value will be:
  4028. @example
  4029. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4030. @end example
  4031. The filter accepts the following options:
  4032. @table @option
  4033. @item rr
  4034. @item rg
  4035. @item rb
  4036. @item ra
  4037. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4038. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4039. @item gr
  4040. @item gg
  4041. @item gb
  4042. @item ga
  4043. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4044. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4045. @item br
  4046. @item bg
  4047. @item bb
  4048. @item ba
  4049. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4050. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4051. @item ar
  4052. @item ag
  4053. @item ab
  4054. @item aa
  4055. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4056. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4057. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4058. @end table
  4059. @subsection Examples
  4060. @itemize
  4061. @item
  4062. Convert source to grayscale:
  4063. @example
  4064. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4065. @end example
  4066. @item
  4067. Simulate sepia tones:
  4068. @example
  4069. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4070. @end example
  4071. @end itemize
  4072. @section colormatrix
  4073. Convert color matrix.
  4074. The filter accepts the following options:
  4075. @table @option
  4076. @item src
  4077. @item dst
  4078. Specify the source and destination color matrix. Both values must be
  4079. specified.
  4080. The accepted values are:
  4081. @table @samp
  4082. @item bt709
  4083. BT.709
  4084. @item bt601
  4085. BT.601
  4086. @item smpte240m
  4087. SMPTE-240M
  4088. @item fcc
  4089. FCC
  4090. @item bt2020
  4091. BT.2020
  4092. @end table
  4093. @end table
  4094. For example to convert from BT.601 to SMPTE-240M, use the command:
  4095. @example
  4096. colormatrix=bt601:smpte240m
  4097. @end example
  4098. @section colorspace
  4099. Convert colorspace, transfer characteristics or color primaries.
  4100. Input video needs to have an even size.
  4101. The filter accepts the following options:
  4102. @table @option
  4103. @anchor{all}
  4104. @item all
  4105. Specify all color properties at once.
  4106. The accepted values are:
  4107. @table @samp
  4108. @item bt470m
  4109. BT.470M
  4110. @item bt470bg
  4111. BT.470BG
  4112. @item bt601-6-525
  4113. BT.601-6 525
  4114. @item bt601-6-625
  4115. BT.601-6 625
  4116. @item bt709
  4117. BT.709
  4118. @item smpte170m
  4119. SMPTE-170M
  4120. @item smpte240m
  4121. SMPTE-240M
  4122. @item bt2020
  4123. BT.2020
  4124. @end table
  4125. @anchor{space}
  4126. @item space
  4127. Specify output colorspace.
  4128. The accepted values are:
  4129. @table @samp
  4130. @item bt709
  4131. BT.709
  4132. @item fcc
  4133. FCC
  4134. @item bt470bg
  4135. BT.470BG or BT.601-6 625
  4136. @item smpte170m
  4137. SMPTE-170M or BT.601-6 525
  4138. @item smpte240m
  4139. SMPTE-240M
  4140. @item ycgco
  4141. YCgCo
  4142. @item bt2020ncl
  4143. BT.2020 with non-constant luminance
  4144. @end table
  4145. @anchor{trc}
  4146. @item trc
  4147. Specify output transfer characteristics.
  4148. The accepted values are:
  4149. @table @samp
  4150. @item bt709
  4151. BT.709
  4152. @item bt470m
  4153. BT.470M
  4154. @item bt470bg
  4155. BT.470BG
  4156. @item gamma22
  4157. Constant gamma of 2.2
  4158. @item gamma28
  4159. Constant gamma of 2.8
  4160. @item smpte170m
  4161. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4162. @item smpte240m
  4163. SMPTE-240M
  4164. @item srgb
  4165. SRGB
  4166. @item iec61966-2-1
  4167. iec61966-2-1
  4168. @item iec61966-2-4
  4169. iec61966-2-4
  4170. @item xvycc
  4171. xvycc
  4172. @item bt2020-10
  4173. BT.2020 for 10-bits content
  4174. @item bt2020-12
  4175. BT.2020 for 12-bits content
  4176. @end table
  4177. @anchor{primaries}
  4178. @item primaries
  4179. Specify output color primaries.
  4180. The accepted values are:
  4181. @table @samp
  4182. @item bt709
  4183. BT.709
  4184. @item bt470m
  4185. BT.470M
  4186. @item bt470bg
  4187. BT.470BG or BT.601-6 625
  4188. @item smpte170m
  4189. SMPTE-170M or BT.601-6 525
  4190. @item smpte240m
  4191. SMPTE-240M
  4192. @item film
  4193. film
  4194. @item smpte431
  4195. SMPTE-431
  4196. @item smpte432
  4197. SMPTE-432
  4198. @item bt2020
  4199. BT.2020
  4200. @end table
  4201. @anchor{range}
  4202. @item range
  4203. Specify output color range.
  4204. The accepted values are:
  4205. @table @samp
  4206. @item tv
  4207. TV (restricted) range
  4208. @item mpeg
  4209. MPEG (restricted) range
  4210. @item pc
  4211. PC (full) range
  4212. @item jpeg
  4213. JPEG (full) range
  4214. @end table
  4215. @item format
  4216. Specify output color format.
  4217. The accepted values are:
  4218. @table @samp
  4219. @item yuv420p
  4220. YUV 4:2:0 planar 8-bits
  4221. @item yuv420p10
  4222. YUV 4:2:0 planar 10-bits
  4223. @item yuv420p12
  4224. YUV 4:2:0 planar 12-bits
  4225. @item yuv422p
  4226. YUV 4:2:2 planar 8-bits
  4227. @item yuv422p10
  4228. YUV 4:2:2 planar 10-bits
  4229. @item yuv422p12
  4230. YUV 4:2:2 planar 12-bits
  4231. @item yuv444p
  4232. YUV 4:4:4 planar 8-bits
  4233. @item yuv444p10
  4234. YUV 4:4:4 planar 10-bits
  4235. @item yuv444p12
  4236. YUV 4:4:4 planar 12-bits
  4237. @end table
  4238. @item fast
  4239. Do a fast conversion, which skips gamma/primary correction. This will take
  4240. significantly less CPU, but will be mathematically incorrect. To get output
  4241. compatible with that produced by the colormatrix filter, use fast=1.
  4242. @item dither
  4243. Specify dithering mode.
  4244. The accepted values are:
  4245. @table @samp
  4246. @item none
  4247. No dithering
  4248. @item fsb
  4249. Floyd-Steinberg dithering
  4250. @end table
  4251. @item wpadapt
  4252. Whitepoint adaptation mode.
  4253. The accepted values are:
  4254. @table @samp
  4255. @item bradford
  4256. Bradford whitepoint adaptation
  4257. @item vonkries
  4258. von Kries whitepoint adaptation
  4259. @item identity
  4260. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4261. @end table
  4262. @item iall
  4263. Override all input properties at once. Same accepted values as @ref{all}.
  4264. @item ispace
  4265. Override input colorspace. Same accepted values as @ref{space}.
  4266. @item iprimaries
  4267. Override input color primaries. Same accepted values as @ref{primaries}.
  4268. @item itrc
  4269. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4270. @item irange
  4271. Override input color range. Same accepted values as @ref{range}.
  4272. @end table
  4273. The filter converts the transfer characteristics, color space and color
  4274. primaries to the specified user values. The output value, if not specified,
  4275. is set to a default value based on the "all" property. If that property is
  4276. also not specified, the filter will log an error. The output color range and
  4277. format default to the same value as the input color range and format. The
  4278. input transfer characteristics, color space, color primaries and color range
  4279. should be set on the input data. If any of these are missing, the filter will
  4280. log an error and no conversion will take place.
  4281. For example to convert the input to SMPTE-240M, use the command:
  4282. @example
  4283. colorspace=smpte240m
  4284. @end example
  4285. @section convolution
  4286. Apply convolution 3x3 or 5x5 filter.
  4287. The filter accepts the following options:
  4288. @table @option
  4289. @item 0m
  4290. @item 1m
  4291. @item 2m
  4292. @item 3m
  4293. Set matrix for each plane.
  4294. Matrix is sequence of 9 or 25 signed integers.
  4295. @item 0rdiv
  4296. @item 1rdiv
  4297. @item 2rdiv
  4298. @item 3rdiv
  4299. Set multiplier for calculated value for each plane.
  4300. @item 0bias
  4301. @item 1bias
  4302. @item 2bias
  4303. @item 3bias
  4304. Set bias for each plane. This value is added to the result of the multiplication.
  4305. Useful for making the overall image brighter or darker. Default is 0.0.
  4306. @end table
  4307. @subsection Examples
  4308. @itemize
  4309. @item
  4310. Apply sharpen:
  4311. @example
  4312. 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"
  4313. @end example
  4314. @item
  4315. Apply blur:
  4316. @example
  4317. 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"
  4318. @end example
  4319. @item
  4320. Apply edge enhance:
  4321. @example
  4322. 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"
  4323. @end example
  4324. @item
  4325. Apply edge detect:
  4326. @example
  4327. 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"
  4328. @end example
  4329. @item
  4330. Apply emboss:
  4331. @example
  4332. 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"
  4333. @end example
  4334. @end itemize
  4335. @section copy
  4336. Copy the input source unchanged to the output. This is mainly useful for
  4337. testing purposes.
  4338. @anchor{coreimage}
  4339. @section coreimage
  4340. Video filtering on GPU using Apple's CoreImage API on OSX.
  4341. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4342. processed by video hardware. However, software-based OpenGL implementations
  4343. exist which means there is no guarantee for hardware processing. It depends on
  4344. the respective OSX.
  4345. There are many filters and image generators provided by Apple that come with a
  4346. large variety of options. The filter has to be referenced by its name along
  4347. with its options.
  4348. The coreimage filter accepts the following options:
  4349. @table @option
  4350. @item list_filters
  4351. List all available filters and generators along with all their respective
  4352. options as well as possible minimum and maximum values along with the default
  4353. values.
  4354. @example
  4355. list_filters=true
  4356. @end example
  4357. @item filter
  4358. Specify all filters by their respective name and options.
  4359. Use @var{list_filters} to determine all valid filter names and options.
  4360. Numerical options are specified by a float value and are automatically clamped
  4361. to their respective value range. Vector and color options have to be specified
  4362. by a list of space separated float values. Character escaping has to be done.
  4363. A special option name @code{default} is available to use default options for a
  4364. filter.
  4365. It is required to specify either @code{default} or at least one of the filter options.
  4366. All omitted options are used with their default values.
  4367. The syntax of the filter string is as follows:
  4368. @example
  4369. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4370. @end example
  4371. @item output_rect
  4372. Specify a rectangle where the output of the filter chain is copied into the
  4373. input image. It is given by a list of space separated float values:
  4374. @example
  4375. output_rect=x\ y\ width\ height
  4376. @end example
  4377. If not given, the output rectangle equals the dimensions of the input image.
  4378. The output rectangle is automatically cropped at the borders of the input
  4379. image. Negative values are valid for each component.
  4380. @example
  4381. output_rect=25\ 25\ 100\ 100
  4382. @end example
  4383. @end table
  4384. Several filters can be chained for successive processing without GPU-HOST
  4385. transfers allowing for fast processing of complex filter chains.
  4386. Currently, only filters with zero (generators) or exactly one (filters) input
  4387. image and one output image are supported. Also, transition filters are not yet
  4388. usable as intended.
  4389. Some filters generate output images with additional padding depending on the
  4390. respective filter kernel. The padding is automatically removed to ensure the
  4391. filter output has the same size as the input image.
  4392. For image generators, the size of the output image is determined by the
  4393. previous output image of the filter chain or the input image of the whole
  4394. filterchain, respectively. The generators do not use the pixel information of
  4395. this image to generate their output. However, the generated output is
  4396. blended onto this image, resulting in partial or complete coverage of the
  4397. output image.
  4398. The @ref{coreimagesrc} video source can be used for generating input images
  4399. which are directly fed into the filter chain. By using it, providing input
  4400. images by another video source or an input video is not required.
  4401. @subsection Examples
  4402. @itemize
  4403. @item
  4404. List all filters available:
  4405. @example
  4406. coreimage=list_filters=true
  4407. @end example
  4408. @item
  4409. Use the CIBoxBlur filter with default options to blur an image:
  4410. @example
  4411. coreimage=filter=CIBoxBlur@@default
  4412. @end example
  4413. @item
  4414. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4415. its center at 100x100 and a radius of 50 pixels:
  4416. @example
  4417. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4418. @end example
  4419. @item
  4420. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4421. given as complete and escaped command-line for Apple's standard bash shell:
  4422. @example
  4423. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4424. @end example
  4425. @end itemize
  4426. @section crop
  4427. Crop the input video to given dimensions.
  4428. It accepts the following parameters:
  4429. @table @option
  4430. @item w, out_w
  4431. The width of the output video. It defaults to @code{iw}.
  4432. This expression is evaluated only once during the filter
  4433. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4434. @item h, out_h
  4435. The height of the output video. It defaults to @code{ih}.
  4436. This expression is evaluated only once during the filter
  4437. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4438. @item x
  4439. The horizontal position, in the input video, of the left edge of the output
  4440. video. It defaults to @code{(in_w-out_w)/2}.
  4441. This expression is evaluated per-frame.
  4442. @item y
  4443. The vertical position, in the input video, of the top edge of the output video.
  4444. It defaults to @code{(in_h-out_h)/2}.
  4445. This expression is evaluated per-frame.
  4446. @item keep_aspect
  4447. If set to 1 will force the output display aspect ratio
  4448. to be the same of the input, by changing the output sample aspect
  4449. ratio. It defaults to 0.
  4450. @item exact
  4451. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4452. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4453. It defaults to 0.
  4454. @end table
  4455. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4456. expressions containing the following constants:
  4457. @table @option
  4458. @item x
  4459. @item y
  4460. The computed values for @var{x} and @var{y}. They are evaluated for
  4461. each new frame.
  4462. @item in_w
  4463. @item in_h
  4464. The input width and height.
  4465. @item iw
  4466. @item ih
  4467. These are the same as @var{in_w} and @var{in_h}.
  4468. @item out_w
  4469. @item out_h
  4470. The output (cropped) width and height.
  4471. @item ow
  4472. @item oh
  4473. These are the same as @var{out_w} and @var{out_h}.
  4474. @item a
  4475. same as @var{iw} / @var{ih}
  4476. @item sar
  4477. input sample aspect ratio
  4478. @item dar
  4479. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4480. @item hsub
  4481. @item vsub
  4482. horizontal and vertical chroma subsample values. For example for the
  4483. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4484. @item n
  4485. The number of the input frame, starting from 0.
  4486. @item pos
  4487. the position in the file of the input frame, NAN if unknown
  4488. @item t
  4489. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4490. @end table
  4491. The expression for @var{out_w} may depend on the value of @var{out_h},
  4492. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4493. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4494. evaluated after @var{out_w} and @var{out_h}.
  4495. The @var{x} and @var{y} parameters specify the expressions for the
  4496. position of the top-left corner of the output (non-cropped) area. They
  4497. are evaluated for each frame. If the evaluated value is not valid, it
  4498. is approximated to the nearest valid value.
  4499. The expression for @var{x} may depend on @var{y}, and the expression
  4500. for @var{y} may depend on @var{x}.
  4501. @subsection Examples
  4502. @itemize
  4503. @item
  4504. Crop area with size 100x100 at position (12,34).
  4505. @example
  4506. crop=100:100:12:34
  4507. @end example
  4508. Using named options, the example above becomes:
  4509. @example
  4510. crop=w=100:h=100:x=12:y=34
  4511. @end example
  4512. @item
  4513. Crop the central input area with size 100x100:
  4514. @example
  4515. crop=100:100
  4516. @end example
  4517. @item
  4518. Crop the central input area with size 2/3 of the input video:
  4519. @example
  4520. crop=2/3*in_w:2/3*in_h
  4521. @end example
  4522. @item
  4523. Crop the input video central square:
  4524. @example
  4525. crop=out_w=in_h
  4526. crop=in_h
  4527. @end example
  4528. @item
  4529. Delimit the rectangle with the top-left corner placed at position
  4530. 100:100 and the right-bottom corner corresponding to the right-bottom
  4531. corner of the input image.
  4532. @example
  4533. crop=in_w-100:in_h-100:100:100
  4534. @end example
  4535. @item
  4536. Crop 10 pixels from the left and right borders, and 20 pixels from
  4537. the top and bottom borders
  4538. @example
  4539. crop=in_w-2*10:in_h-2*20
  4540. @end example
  4541. @item
  4542. Keep only the bottom right quarter of the input image:
  4543. @example
  4544. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4545. @end example
  4546. @item
  4547. Crop height for getting Greek harmony:
  4548. @example
  4549. crop=in_w:1/PHI*in_w
  4550. @end example
  4551. @item
  4552. Apply trembling effect:
  4553. @example
  4554. 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)
  4555. @end example
  4556. @item
  4557. Apply erratic camera effect depending on timestamp:
  4558. @example
  4559. 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)"
  4560. @end example
  4561. @item
  4562. Set x depending on the value of y:
  4563. @example
  4564. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4565. @end example
  4566. @end itemize
  4567. @subsection Commands
  4568. This filter supports the following commands:
  4569. @table @option
  4570. @item w, out_w
  4571. @item h, out_h
  4572. @item x
  4573. @item y
  4574. Set width/height of the output video and the horizontal/vertical position
  4575. in the input video.
  4576. The command accepts the same syntax of the corresponding option.
  4577. If the specified expression is not valid, it is kept at its current
  4578. value.
  4579. @end table
  4580. @section cropdetect
  4581. Auto-detect the crop size.
  4582. It calculates the necessary cropping parameters and prints the
  4583. recommended parameters via the logging system. The detected dimensions
  4584. correspond to the non-black area of the input video.
  4585. It accepts the following parameters:
  4586. @table @option
  4587. @item limit
  4588. Set higher black value threshold, which can be optionally specified
  4589. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4590. value greater to the set value is considered non-black. It defaults to 24.
  4591. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4592. on the bitdepth of the pixel format.
  4593. @item round
  4594. The value which the width/height should be divisible by. It defaults to
  4595. 16. The offset is automatically adjusted to center the video. Use 2 to
  4596. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4597. encoding to most video codecs.
  4598. @item reset_count, reset
  4599. Set the counter that determines after how many frames cropdetect will
  4600. reset the previously detected largest video area and start over to
  4601. detect the current optimal crop area. Default value is 0.
  4602. This can be useful when channel logos distort the video area. 0
  4603. indicates 'never reset', and returns the largest area encountered during
  4604. playback.
  4605. @end table
  4606. @anchor{curves}
  4607. @section curves
  4608. Apply color adjustments using curves.
  4609. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4610. component (red, green and blue) has its values defined by @var{N} key points
  4611. tied from each other using a smooth curve. The x-axis represents the pixel
  4612. values from the input frame, and the y-axis the new pixel values to be set for
  4613. the output frame.
  4614. By default, a component curve is defined by the two points @var{(0;0)} and
  4615. @var{(1;1)}. This creates a straight line where each original pixel value is
  4616. "adjusted" to its own value, which means no change to the image.
  4617. The filter allows you to redefine these two points and add some more. A new
  4618. curve (using a natural cubic spline interpolation) will be define to pass
  4619. smoothly through all these new coordinates. The new defined points needs to be
  4620. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4621. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4622. the vector spaces, the values will be clipped accordingly.
  4623. The filter accepts the following options:
  4624. @table @option
  4625. @item preset
  4626. Select one of the available color presets. This option can be used in addition
  4627. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4628. options takes priority on the preset values.
  4629. Available presets are:
  4630. @table @samp
  4631. @item none
  4632. @item color_negative
  4633. @item cross_process
  4634. @item darker
  4635. @item increase_contrast
  4636. @item lighter
  4637. @item linear_contrast
  4638. @item medium_contrast
  4639. @item negative
  4640. @item strong_contrast
  4641. @item vintage
  4642. @end table
  4643. Default is @code{none}.
  4644. @item master, m
  4645. Set the master key points. These points will define a second pass mapping. It
  4646. is sometimes called a "luminance" or "value" mapping. It can be used with
  4647. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4648. post-processing LUT.
  4649. @item red, r
  4650. Set the key points for the red component.
  4651. @item green, g
  4652. Set the key points for the green component.
  4653. @item blue, b
  4654. Set the key points for the blue component.
  4655. @item all
  4656. Set the key points for all components (not including master).
  4657. Can be used in addition to the other key points component
  4658. options. In this case, the unset component(s) will fallback on this
  4659. @option{all} setting.
  4660. @item psfile
  4661. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4662. @item plot
  4663. Save Gnuplot script of the curves in specified file.
  4664. @end table
  4665. To avoid some filtergraph syntax conflicts, each key points list need to be
  4666. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4667. @subsection Examples
  4668. @itemize
  4669. @item
  4670. Increase slightly the middle level of blue:
  4671. @example
  4672. curves=blue='0/0 0.5/0.58 1/1'
  4673. @end example
  4674. @item
  4675. Vintage effect:
  4676. @example
  4677. 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'
  4678. @end example
  4679. Here we obtain the following coordinates for each components:
  4680. @table @var
  4681. @item red
  4682. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4683. @item green
  4684. @code{(0;0) (0.50;0.48) (1;1)}
  4685. @item blue
  4686. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4687. @end table
  4688. @item
  4689. The previous example can also be achieved with the associated built-in preset:
  4690. @example
  4691. curves=preset=vintage
  4692. @end example
  4693. @item
  4694. Or simply:
  4695. @example
  4696. curves=vintage
  4697. @end example
  4698. @item
  4699. Use a Photoshop preset and redefine the points of the green component:
  4700. @example
  4701. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4702. @end example
  4703. @item
  4704. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4705. and @command{gnuplot}:
  4706. @example
  4707. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4708. gnuplot -p /tmp/curves.plt
  4709. @end example
  4710. @end itemize
  4711. @section datascope
  4712. Video data analysis filter.
  4713. This filter shows hexadecimal pixel values of part of video.
  4714. The filter accepts the following options:
  4715. @table @option
  4716. @item size, s
  4717. Set output video size.
  4718. @item x
  4719. Set x offset from where to pick pixels.
  4720. @item y
  4721. Set y offset from where to pick pixels.
  4722. @item mode
  4723. Set scope mode, can be one of the following:
  4724. @table @samp
  4725. @item mono
  4726. Draw hexadecimal pixel values with white color on black background.
  4727. @item color
  4728. Draw hexadecimal pixel values with input video pixel color on black
  4729. background.
  4730. @item color2
  4731. Draw hexadecimal pixel values on color background picked from input video,
  4732. the text color is picked in such way so its always visible.
  4733. @end table
  4734. @item axis
  4735. Draw rows and columns numbers on left and top of video.
  4736. @item opacity
  4737. Set background opacity.
  4738. @end table
  4739. @section dctdnoiz
  4740. Denoise frames using 2D DCT (frequency domain filtering).
  4741. This filter is not designed for real time.
  4742. The filter accepts the following options:
  4743. @table @option
  4744. @item sigma, s
  4745. Set the noise sigma constant.
  4746. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4747. coefficient (absolute value) below this threshold with be dropped.
  4748. If you need a more advanced filtering, see @option{expr}.
  4749. Default is @code{0}.
  4750. @item overlap
  4751. Set number overlapping pixels for each block. Since the filter can be slow, you
  4752. may want to reduce this value, at the cost of a less effective filter and the
  4753. risk of various artefacts.
  4754. If the overlapping value doesn't permit processing the whole input width or
  4755. height, a warning will be displayed and according borders won't be denoised.
  4756. Default value is @var{blocksize}-1, which is the best possible setting.
  4757. @item expr, e
  4758. Set the coefficient factor expression.
  4759. For each coefficient of a DCT block, this expression will be evaluated as a
  4760. multiplier value for the coefficient.
  4761. If this is option is set, the @option{sigma} option will be ignored.
  4762. The absolute value of the coefficient can be accessed through the @var{c}
  4763. variable.
  4764. @item n
  4765. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4766. @var{blocksize}, which is the width and height of the processed blocks.
  4767. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4768. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4769. on the speed processing. Also, a larger block size does not necessarily means a
  4770. better de-noising.
  4771. @end table
  4772. @subsection Examples
  4773. Apply a denoise with a @option{sigma} of @code{4.5}:
  4774. @example
  4775. dctdnoiz=4.5
  4776. @end example
  4777. The same operation can be achieved using the expression system:
  4778. @example
  4779. dctdnoiz=e='gte(c, 4.5*3)'
  4780. @end example
  4781. Violent denoise using a block size of @code{16x16}:
  4782. @example
  4783. dctdnoiz=15:n=4
  4784. @end example
  4785. @section deband
  4786. Remove banding artifacts from input video.
  4787. It works by replacing banded pixels with average value of referenced pixels.
  4788. The filter accepts the following options:
  4789. @table @option
  4790. @item 1thr
  4791. @item 2thr
  4792. @item 3thr
  4793. @item 4thr
  4794. Set banding detection threshold for each plane. Default is 0.02.
  4795. Valid range is 0.00003 to 0.5.
  4796. If difference between current pixel and reference pixel is less than threshold,
  4797. it will be considered as banded.
  4798. @item range, r
  4799. Banding detection range in pixels. Default is 16. If positive, random number
  4800. in range 0 to set value will be used. If negative, exact absolute value
  4801. will be used.
  4802. The range defines square of four pixels around current pixel.
  4803. @item direction, d
  4804. Set direction in radians from which four pixel will be compared. If positive,
  4805. random direction from 0 to set direction will be picked. If negative, exact of
  4806. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4807. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4808. column.
  4809. @item blur, b
  4810. If enabled, current pixel is compared with average value of all four
  4811. surrounding pixels. The default is enabled. If disabled current pixel is
  4812. compared with all four surrounding pixels. The pixel is considered banded
  4813. if only all four differences with surrounding pixels are less than threshold.
  4814. @item coupling, c
  4815. If enabled, current pixel is changed if and only if all pixel components are banded,
  4816. e.g. banding detection threshold is triggered for all color components.
  4817. The default is disabled.
  4818. @end table
  4819. @anchor{decimate}
  4820. @section decimate
  4821. Drop duplicated frames at regular intervals.
  4822. The filter accepts the following options:
  4823. @table @option
  4824. @item cycle
  4825. Set the number of frames from which one will be dropped. Setting this to
  4826. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4827. Default is @code{5}.
  4828. @item dupthresh
  4829. Set the threshold for duplicate detection. If the difference metric for a frame
  4830. is less than or equal to this value, then it is declared as duplicate. Default
  4831. is @code{1.1}
  4832. @item scthresh
  4833. Set scene change threshold. Default is @code{15}.
  4834. @item blockx
  4835. @item blocky
  4836. Set the size of the x and y-axis blocks used during metric calculations.
  4837. Larger blocks give better noise suppression, but also give worse detection of
  4838. small movements. Must be a power of two. Default is @code{32}.
  4839. @item ppsrc
  4840. Mark main input as a pre-processed input and activate clean source input
  4841. stream. This allows the input to be pre-processed with various filters to help
  4842. the metrics calculation while keeping the frame selection lossless. When set to
  4843. @code{1}, the first stream is for the pre-processed input, and the second
  4844. stream is the clean source from where the kept frames are chosen. Default is
  4845. @code{0}.
  4846. @item chroma
  4847. Set whether or not chroma is considered in the metric calculations. Default is
  4848. @code{1}.
  4849. @end table
  4850. @section deflate
  4851. Apply deflate effect to the video.
  4852. This filter replaces the pixel by the local(3x3) average by taking into account
  4853. only values lower than the pixel.
  4854. It accepts the following options:
  4855. @table @option
  4856. @item threshold0
  4857. @item threshold1
  4858. @item threshold2
  4859. @item threshold3
  4860. Limit the maximum change for each plane, default is 65535.
  4861. If 0, plane will remain unchanged.
  4862. @end table
  4863. @section dejudder
  4864. Remove judder produced by partially interlaced telecined content.
  4865. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4866. source was partially telecined content then the output of @code{pullup,dejudder}
  4867. will have a variable frame rate. May change the recorded frame rate of the
  4868. container. Aside from that change, this filter will not affect constant frame
  4869. rate video.
  4870. The option available in this filter is:
  4871. @table @option
  4872. @item cycle
  4873. Specify the length of the window over which the judder repeats.
  4874. Accepts any integer greater than 1. Useful values are:
  4875. @table @samp
  4876. @item 4
  4877. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4878. @item 5
  4879. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4880. @item 20
  4881. If a mixture of the two.
  4882. @end table
  4883. The default is @samp{4}.
  4884. @end table
  4885. @section delogo
  4886. Suppress a TV station logo by a simple interpolation of the surrounding
  4887. pixels. Just set a rectangle covering the logo and watch it disappear
  4888. (and sometimes something even uglier appear - your mileage may vary).
  4889. It accepts the following parameters:
  4890. @table @option
  4891. @item x
  4892. @item y
  4893. Specify the top left corner coordinates of the logo. They must be
  4894. specified.
  4895. @item w
  4896. @item h
  4897. Specify the width and height of the logo to clear. They must be
  4898. specified.
  4899. @item band, t
  4900. Specify the thickness of the fuzzy edge of the rectangle (added to
  4901. @var{w} and @var{h}). The default value is 1. This option is
  4902. deprecated, setting higher values should no longer be necessary and
  4903. is not recommended.
  4904. @item show
  4905. When set to 1, a green rectangle is drawn on the screen to simplify
  4906. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4907. The default value is 0.
  4908. The rectangle is drawn on the outermost pixels which will be (partly)
  4909. replaced with interpolated values. The values of the next pixels
  4910. immediately outside this rectangle in each direction will be used to
  4911. compute the interpolated pixel values inside the rectangle.
  4912. @end table
  4913. @subsection Examples
  4914. @itemize
  4915. @item
  4916. Set a rectangle covering the area with top left corner coordinates 0,0
  4917. and size 100x77, and a band of size 10:
  4918. @example
  4919. delogo=x=0:y=0:w=100:h=77:band=10
  4920. @end example
  4921. @end itemize
  4922. @section deshake
  4923. Attempt to fix small changes in horizontal and/or vertical shift. This
  4924. filter helps remove camera shake from hand-holding a camera, bumping a
  4925. tripod, moving on a vehicle, etc.
  4926. The filter accepts the following options:
  4927. @table @option
  4928. @item x
  4929. @item y
  4930. @item w
  4931. @item h
  4932. Specify a rectangular area where to limit the search for motion
  4933. vectors.
  4934. If desired the search for motion vectors can be limited to a
  4935. rectangular area of the frame defined by its top left corner, width
  4936. and height. These parameters have the same meaning as the drawbox
  4937. filter which can be used to visualise the position of the bounding
  4938. box.
  4939. This is useful when simultaneous movement of subjects within the frame
  4940. might be confused for camera motion by the motion vector search.
  4941. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4942. then the full frame is used. This allows later options to be set
  4943. without specifying the bounding box for the motion vector search.
  4944. Default - search the whole frame.
  4945. @item rx
  4946. @item ry
  4947. Specify the maximum extent of movement in x and y directions in the
  4948. range 0-64 pixels. Default 16.
  4949. @item edge
  4950. Specify how to generate pixels to fill blanks at the edge of the
  4951. frame. Available values are:
  4952. @table @samp
  4953. @item blank, 0
  4954. Fill zeroes at blank locations
  4955. @item original, 1
  4956. Original image at blank locations
  4957. @item clamp, 2
  4958. Extruded edge value at blank locations
  4959. @item mirror, 3
  4960. Mirrored edge at blank locations
  4961. @end table
  4962. Default value is @samp{mirror}.
  4963. @item blocksize
  4964. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4965. default 8.
  4966. @item contrast
  4967. Specify the contrast threshold for blocks. Only blocks with more than
  4968. the specified contrast (difference between darkest and lightest
  4969. pixels) will be considered. Range 1-255, default 125.
  4970. @item search
  4971. Specify the search strategy. Available values are:
  4972. @table @samp
  4973. @item exhaustive, 0
  4974. Set exhaustive search
  4975. @item less, 1
  4976. Set less exhaustive search.
  4977. @end table
  4978. Default value is @samp{exhaustive}.
  4979. @item filename
  4980. If set then a detailed log of the motion search is written to the
  4981. specified file.
  4982. @item opencl
  4983. If set to 1, specify using OpenCL capabilities, only available if
  4984. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4985. @end table
  4986. @section detelecine
  4987. Apply an exact inverse of the telecine operation. It requires a predefined
  4988. pattern specified using the pattern option which must be the same as that passed
  4989. to the telecine filter.
  4990. This filter accepts the following options:
  4991. @table @option
  4992. @item first_field
  4993. @table @samp
  4994. @item top, t
  4995. top field first
  4996. @item bottom, b
  4997. bottom field first
  4998. The default value is @code{top}.
  4999. @end table
  5000. @item pattern
  5001. A string of numbers representing the pulldown pattern you wish to apply.
  5002. The default value is @code{23}.
  5003. @item start_frame
  5004. A number representing position of the first frame with respect to the telecine
  5005. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5006. @end table
  5007. @section dilation
  5008. Apply dilation effect to the video.
  5009. This filter replaces the pixel by the local(3x3) maximum.
  5010. It accepts the following options:
  5011. @table @option
  5012. @item threshold0
  5013. @item threshold1
  5014. @item threshold2
  5015. @item threshold3
  5016. Limit the maximum change for each plane, default is 65535.
  5017. If 0, plane will remain unchanged.
  5018. @item coordinates
  5019. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5020. pixels are used.
  5021. Flags to local 3x3 coordinates maps like this:
  5022. 1 2 3
  5023. 4 5
  5024. 6 7 8
  5025. @end table
  5026. @section displace
  5027. Displace pixels as indicated by second and third input stream.
  5028. It takes three input streams and outputs one stream, the first input is the
  5029. source, and second and third input are displacement maps.
  5030. The second input specifies how much to displace pixels along the
  5031. x-axis, while the third input specifies how much to displace pixels
  5032. along the y-axis.
  5033. If one of displacement map streams terminates, last frame from that
  5034. displacement map will be used.
  5035. Note that once generated, displacements maps can be reused over and over again.
  5036. A description of the accepted options follows.
  5037. @table @option
  5038. @item edge
  5039. Set displace behavior for pixels that are out of range.
  5040. Available values are:
  5041. @table @samp
  5042. @item blank
  5043. Missing pixels are replaced by black pixels.
  5044. @item smear
  5045. Adjacent pixels will spread out to replace missing pixels.
  5046. @item wrap
  5047. Out of range pixels are wrapped so they point to pixels of other side.
  5048. @end table
  5049. Default is @samp{smear}.
  5050. @end table
  5051. @subsection Examples
  5052. @itemize
  5053. @item
  5054. Add ripple effect to rgb input of video size hd720:
  5055. @example
  5056. 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
  5057. @end example
  5058. @item
  5059. Add wave effect to rgb input of video size hd720:
  5060. @example
  5061. 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
  5062. @end example
  5063. @end itemize
  5064. @section drawbox
  5065. Draw a colored box on the input image.
  5066. It accepts the following parameters:
  5067. @table @option
  5068. @item x
  5069. @item y
  5070. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5071. @item width, w
  5072. @item height, h
  5073. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5074. the input width and height. It defaults to 0.
  5075. @item color, c
  5076. Specify the color of the box to write. For the general syntax of this option,
  5077. check the "Color" section in the ffmpeg-utils manual. If the special
  5078. value @code{invert} is used, the box edge color is the same as the
  5079. video with inverted luma.
  5080. @item thickness, t
  5081. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5082. See below for the list of accepted constants.
  5083. @end table
  5084. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5085. following constants:
  5086. @table @option
  5087. @item dar
  5088. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5089. @item hsub
  5090. @item vsub
  5091. horizontal and vertical chroma subsample values. For example for the
  5092. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5093. @item in_h, ih
  5094. @item in_w, iw
  5095. The input width and height.
  5096. @item sar
  5097. The input sample aspect ratio.
  5098. @item x
  5099. @item y
  5100. The x and y offset coordinates where the box is drawn.
  5101. @item w
  5102. @item h
  5103. The width and height of the drawn box.
  5104. @item t
  5105. The thickness of the drawn box.
  5106. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5107. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5108. @end table
  5109. @subsection Examples
  5110. @itemize
  5111. @item
  5112. Draw a black box around the edge of the input image:
  5113. @example
  5114. drawbox
  5115. @end example
  5116. @item
  5117. Draw a box with color red and an opacity of 50%:
  5118. @example
  5119. drawbox=10:20:200:60:red@@0.5
  5120. @end example
  5121. The previous example can be specified as:
  5122. @example
  5123. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5124. @end example
  5125. @item
  5126. Fill the box with pink color:
  5127. @example
  5128. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5129. @end example
  5130. @item
  5131. Draw a 2-pixel red 2.40:1 mask:
  5132. @example
  5133. 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
  5134. @end example
  5135. @end itemize
  5136. @section drawgrid
  5137. Draw a grid on the input image.
  5138. It accepts the following parameters:
  5139. @table @option
  5140. @item x
  5141. @item y
  5142. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5143. @item width, w
  5144. @item height, h
  5145. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5146. input width and height, respectively, minus @code{thickness}, so image gets
  5147. framed. Default to 0.
  5148. @item color, c
  5149. Specify the color of the grid. For the general syntax of this option,
  5150. check the "Color" section in the ffmpeg-utils manual. If the special
  5151. value @code{invert} is used, the grid color is the same as the
  5152. video with inverted luma.
  5153. @item thickness, t
  5154. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5155. See below for the list of accepted constants.
  5156. @end table
  5157. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5158. following constants:
  5159. @table @option
  5160. @item dar
  5161. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5162. @item hsub
  5163. @item vsub
  5164. horizontal and vertical chroma subsample values. For example for the
  5165. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5166. @item in_h, ih
  5167. @item in_w, iw
  5168. The input grid cell width and height.
  5169. @item sar
  5170. The input sample aspect ratio.
  5171. @item x
  5172. @item y
  5173. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5174. @item w
  5175. @item h
  5176. The width and height of the drawn cell.
  5177. @item t
  5178. The thickness of the drawn cell.
  5179. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5180. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5181. @end table
  5182. @subsection Examples
  5183. @itemize
  5184. @item
  5185. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5186. @example
  5187. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5188. @end example
  5189. @item
  5190. Draw a white 3x3 grid with an opacity of 50%:
  5191. @example
  5192. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5193. @end example
  5194. @end itemize
  5195. @anchor{drawtext}
  5196. @section drawtext
  5197. Draw a text string or text from a specified file on top of a video, using the
  5198. libfreetype library.
  5199. To enable compilation of this filter, you need to configure FFmpeg with
  5200. @code{--enable-libfreetype}.
  5201. To enable default font fallback and the @var{font} option you need to
  5202. configure FFmpeg with @code{--enable-libfontconfig}.
  5203. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5204. @code{--enable-libfribidi}.
  5205. @subsection Syntax
  5206. It accepts the following parameters:
  5207. @table @option
  5208. @item box
  5209. Used to draw a box around text using the background color.
  5210. The value must be either 1 (enable) or 0 (disable).
  5211. The default value of @var{box} is 0.
  5212. @item boxborderw
  5213. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5214. The default value of @var{boxborderw} is 0.
  5215. @item boxcolor
  5216. The color to be used for drawing box around text. For the syntax of this
  5217. option, check the "Color" section in the ffmpeg-utils manual.
  5218. The default value of @var{boxcolor} is "white".
  5219. @item line_spacing
  5220. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5221. The default value of @var{line_spacing} is 0.
  5222. @item borderw
  5223. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5224. The default value of @var{borderw} is 0.
  5225. @item bordercolor
  5226. Set the color to be used for drawing border around text. For the syntax of this
  5227. option, check the "Color" section in the ffmpeg-utils manual.
  5228. The default value of @var{bordercolor} is "black".
  5229. @item expansion
  5230. Select how the @var{text} is expanded. Can be either @code{none},
  5231. @code{strftime} (deprecated) or
  5232. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5233. below for details.
  5234. @item basetime
  5235. Set a start time for the count. Value is in microseconds. Only applied
  5236. in the deprecated strftime expansion mode. To emulate in normal expansion
  5237. mode use the @code{pts} function, supplying the start time (in seconds)
  5238. as the second argument.
  5239. @item fix_bounds
  5240. If true, check and fix text coords to avoid clipping.
  5241. @item fontcolor
  5242. The color to be used for drawing fonts. For the syntax of this option, check
  5243. the "Color" section in the ffmpeg-utils manual.
  5244. The default value of @var{fontcolor} is "black".
  5245. @item fontcolor_expr
  5246. String which is expanded the same way as @var{text} to obtain dynamic
  5247. @var{fontcolor} value. By default this option has empty value and is not
  5248. processed. When this option is set, it overrides @var{fontcolor} option.
  5249. @item font
  5250. The font family to be used for drawing text. By default Sans.
  5251. @item fontfile
  5252. The font file to be used for drawing text. The path must be included.
  5253. This parameter is mandatory if the fontconfig support is disabled.
  5254. @item alpha
  5255. Draw the text applying alpha blending. The value can
  5256. be a number between 0.0 and 1.0.
  5257. The expression accepts the same variables @var{x, y} as well.
  5258. The default value is 1.
  5259. Please see @var{fontcolor_expr}.
  5260. @item fontsize
  5261. The font size to be used for drawing text.
  5262. The default value of @var{fontsize} is 16.
  5263. @item text_shaping
  5264. If set to 1, attempt to shape the text (for example, reverse the order of
  5265. right-to-left text and join Arabic characters) before drawing it.
  5266. Otherwise, just draw the text exactly as given.
  5267. By default 1 (if supported).
  5268. @item ft_load_flags
  5269. The flags to be used for loading the fonts.
  5270. The flags map the corresponding flags supported by libfreetype, and are
  5271. a combination of the following values:
  5272. @table @var
  5273. @item default
  5274. @item no_scale
  5275. @item no_hinting
  5276. @item render
  5277. @item no_bitmap
  5278. @item vertical_layout
  5279. @item force_autohint
  5280. @item crop_bitmap
  5281. @item pedantic
  5282. @item ignore_global_advance_width
  5283. @item no_recurse
  5284. @item ignore_transform
  5285. @item monochrome
  5286. @item linear_design
  5287. @item no_autohint
  5288. @end table
  5289. Default value is "default".
  5290. For more information consult the documentation for the FT_LOAD_*
  5291. libfreetype flags.
  5292. @item shadowcolor
  5293. The color to be used for drawing a shadow behind the drawn text. For the
  5294. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5295. The default value of @var{shadowcolor} is "black".
  5296. @item shadowx
  5297. @item shadowy
  5298. The x and y offsets for the text shadow position with respect to the
  5299. position of the text. They can be either positive or negative
  5300. values. The default value for both is "0".
  5301. @item start_number
  5302. The starting frame number for the n/frame_num variable. The default value
  5303. is "0".
  5304. @item tabsize
  5305. The size in number of spaces to use for rendering the tab.
  5306. Default value is 4.
  5307. @item timecode
  5308. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5309. format. It can be used with or without text parameter. @var{timecode_rate}
  5310. option must be specified.
  5311. @item timecode_rate, rate, r
  5312. Set the timecode frame rate (timecode only).
  5313. @item tc24hmax
  5314. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5315. Default is 0 (disabled).
  5316. @item text
  5317. The text string to be drawn. The text must be a sequence of UTF-8
  5318. encoded characters.
  5319. This parameter is mandatory if no file is specified with the parameter
  5320. @var{textfile}.
  5321. @item textfile
  5322. A text file containing text to be drawn. The text must be a sequence
  5323. of UTF-8 encoded characters.
  5324. This parameter is mandatory if no text string is specified with the
  5325. parameter @var{text}.
  5326. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5327. @item reload
  5328. If set to 1, the @var{textfile} will be reloaded before each frame.
  5329. Be sure to update it atomically, or it may be read partially, or even fail.
  5330. @item x
  5331. @item y
  5332. The expressions which specify the offsets where text will be drawn
  5333. within the video frame. They are relative to the top/left border of the
  5334. output image.
  5335. The default value of @var{x} and @var{y} is "0".
  5336. See below for the list of accepted constants and functions.
  5337. @end table
  5338. The parameters for @var{x} and @var{y} are expressions containing the
  5339. following constants and functions:
  5340. @table @option
  5341. @item dar
  5342. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5343. @item hsub
  5344. @item vsub
  5345. horizontal and vertical chroma subsample values. For example for the
  5346. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5347. @item line_h, lh
  5348. the height of each text line
  5349. @item main_h, h, H
  5350. the input height
  5351. @item main_w, w, W
  5352. the input width
  5353. @item max_glyph_a, ascent
  5354. the maximum distance from the baseline to the highest/upper grid
  5355. coordinate used to place a glyph outline point, for all the rendered
  5356. glyphs.
  5357. It is a positive value, due to the grid's orientation with the Y axis
  5358. upwards.
  5359. @item max_glyph_d, descent
  5360. the maximum distance from the baseline to the lowest grid coordinate
  5361. used to place a glyph outline point, for all the rendered glyphs.
  5362. This is a negative value, due to the grid's orientation, with the Y axis
  5363. upwards.
  5364. @item max_glyph_h
  5365. maximum glyph height, that is the maximum height for all the glyphs
  5366. contained in the rendered text, it is equivalent to @var{ascent} -
  5367. @var{descent}.
  5368. @item max_glyph_w
  5369. maximum glyph width, that is the maximum width for all the glyphs
  5370. contained in the rendered text
  5371. @item n
  5372. the number of input frame, starting from 0
  5373. @item rand(min, max)
  5374. return a random number included between @var{min} and @var{max}
  5375. @item sar
  5376. The input sample aspect ratio.
  5377. @item t
  5378. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5379. @item text_h, th
  5380. the height of the rendered text
  5381. @item text_w, tw
  5382. the width of the rendered text
  5383. @item x
  5384. @item y
  5385. the x and y offset coordinates where the text is drawn.
  5386. These parameters allow the @var{x} and @var{y} expressions to refer
  5387. each other, so you can for example specify @code{y=x/dar}.
  5388. @end table
  5389. @anchor{drawtext_expansion}
  5390. @subsection Text expansion
  5391. If @option{expansion} is set to @code{strftime},
  5392. the filter recognizes strftime() sequences in the provided text and
  5393. expands them accordingly. Check the documentation of strftime(). This
  5394. feature is deprecated.
  5395. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5396. If @option{expansion} is set to @code{normal} (which is the default),
  5397. the following expansion mechanism is used.
  5398. The backslash character @samp{\}, followed by any character, always expands to
  5399. the second character.
  5400. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5401. braces is a function name, possibly followed by arguments separated by ':'.
  5402. If the arguments contain special characters or delimiters (':' or '@}'),
  5403. they should be escaped.
  5404. Note that they probably must also be escaped as the value for the
  5405. @option{text} option in the filter argument string and as the filter
  5406. argument in the filtergraph description, and possibly also for the shell,
  5407. that makes up to four levels of escaping; using a text file avoids these
  5408. problems.
  5409. The following functions are available:
  5410. @table @command
  5411. @item expr, e
  5412. The expression evaluation result.
  5413. It must take one argument specifying the expression to be evaluated,
  5414. which accepts the same constants and functions as the @var{x} and
  5415. @var{y} values. Note that not all constants should be used, for
  5416. example the text size is not known when evaluating the expression, so
  5417. the constants @var{text_w} and @var{text_h} will have an undefined
  5418. value.
  5419. @item expr_int_format, eif
  5420. Evaluate the expression's value and output as formatted integer.
  5421. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5422. The second argument specifies the output format. Allowed values are @samp{x},
  5423. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5424. @code{printf} function.
  5425. The third parameter is optional and sets the number of positions taken by the output.
  5426. It can be used to add padding with zeros from the left.
  5427. @item gmtime
  5428. The time at which the filter is running, expressed in UTC.
  5429. It can accept an argument: a strftime() format string.
  5430. @item localtime
  5431. The time at which the filter is running, expressed in the local time zone.
  5432. It can accept an argument: a strftime() format string.
  5433. @item metadata
  5434. Frame metadata. Takes one or two arguments.
  5435. The first argument is mandatory and specifies the metadata key.
  5436. The second argument is optional and specifies a default value, used when the
  5437. metadata key is not found or empty.
  5438. @item n, frame_num
  5439. The frame number, starting from 0.
  5440. @item pict_type
  5441. A 1 character description of the current picture type.
  5442. @item pts
  5443. The timestamp of the current frame.
  5444. It can take up to three arguments.
  5445. The first argument is the format of the timestamp; it defaults to @code{flt}
  5446. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5447. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5448. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5449. @code{localtime} stands for the timestamp of the frame formatted as
  5450. local time zone time.
  5451. The second argument is an offset added to the timestamp.
  5452. If the format is set to @code{localtime} or @code{gmtime},
  5453. a third argument may be supplied: a strftime() format string.
  5454. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5455. @end table
  5456. @subsection Examples
  5457. @itemize
  5458. @item
  5459. Draw "Test Text" with font FreeSerif, using the default values for the
  5460. optional parameters.
  5461. @example
  5462. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5463. @end example
  5464. @item
  5465. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5466. and y=50 (counting from the top-left corner of the screen), text is
  5467. yellow with a red box around it. Both the text and the box have an
  5468. opacity of 20%.
  5469. @example
  5470. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5471. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5472. @end example
  5473. Note that the double quotes are not necessary if spaces are not used
  5474. within the parameter list.
  5475. @item
  5476. Show the text at the center of the video frame:
  5477. @example
  5478. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5479. @end example
  5480. @item
  5481. Show the text at a random position, switching to a new position every 30 seconds:
  5482. @example
  5483. 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)"
  5484. @end example
  5485. @item
  5486. Show a text line sliding from right to left in the last row of the video
  5487. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5488. with no newlines.
  5489. @example
  5490. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5491. @end example
  5492. @item
  5493. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5494. @example
  5495. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5496. @end example
  5497. @item
  5498. Draw a single green letter "g", at the center of the input video.
  5499. The glyph baseline is placed at half screen height.
  5500. @example
  5501. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5502. @end example
  5503. @item
  5504. Show text for 1 second every 3 seconds:
  5505. @example
  5506. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5507. @end example
  5508. @item
  5509. Use fontconfig to set the font. Note that the colons need to be escaped.
  5510. @example
  5511. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5512. @end example
  5513. @item
  5514. Print the date of a real-time encoding (see strftime(3)):
  5515. @example
  5516. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5517. @end example
  5518. @item
  5519. Show text fading in and out (appearing/disappearing):
  5520. @example
  5521. #!/bin/sh
  5522. DS=1.0 # display start
  5523. DE=10.0 # display end
  5524. FID=1.5 # fade in duration
  5525. FOD=5 # fade out duration
  5526. 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 @}"
  5527. @end example
  5528. @item
  5529. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5530. and the @option{fontsize} value are included in the @option{y} offset.
  5531. @example
  5532. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5533. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5534. @end example
  5535. @end itemize
  5536. For more information about libfreetype, check:
  5537. @url{http://www.freetype.org/}.
  5538. For more information about fontconfig, check:
  5539. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5540. For more information about libfribidi, check:
  5541. @url{http://fribidi.org/}.
  5542. @section edgedetect
  5543. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5544. The filter accepts the following options:
  5545. @table @option
  5546. @item low
  5547. @item high
  5548. Set low and high threshold values used by the Canny thresholding
  5549. algorithm.
  5550. The high threshold selects the "strong" edge pixels, which are then
  5551. connected through 8-connectivity with the "weak" edge pixels selected
  5552. by the low threshold.
  5553. @var{low} and @var{high} threshold values must be chosen in the range
  5554. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5555. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5556. is @code{50/255}.
  5557. @item mode
  5558. Define the drawing mode.
  5559. @table @samp
  5560. @item wires
  5561. Draw white/gray wires on black background.
  5562. @item colormix
  5563. Mix the colors to create a paint/cartoon effect.
  5564. @end table
  5565. Default value is @var{wires}.
  5566. @end table
  5567. @subsection Examples
  5568. @itemize
  5569. @item
  5570. Standard edge detection with custom values for the hysteresis thresholding:
  5571. @example
  5572. edgedetect=low=0.1:high=0.4
  5573. @end example
  5574. @item
  5575. Painting effect without thresholding:
  5576. @example
  5577. edgedetect=mode=colormix:high=0
  5578. @end example
  5579. @end itemize
  5580. @section eq
  5581. Set brightness, contrast, saturation and approximate gamma adjustment.
  5582. The filter accepts the following options:
  5583. @table @option
  5584. @item contrast
  5585. Set the contrast expression. The value must be a float value in range
  5586. @code{-2.0} to @code{2.0}. The default value is "1".
  5587. @item brightness
  5588. Set the brightness expression. The value must be a float value in
  5589. range @code{-1.0} to @code{1.0}. The default value is "0".
  5590. @item saturation
  5591. Set the saturation expression. The value must be a float in
  5592. range @code{0.0} to @code{3.0}. The default value is "1".
  5593. @item gamma
  5594. Set the gamma expression. The value must be a float in range
  5595. @code{0.1} to @code{10.0}. The default value is "1".
  5596. @item gamma_r
  5597. Set the gamma expression for red. The value must be a float in
  5598. range @code{0.1} to @code{10.0}. The default value is "1".
  5599. @item gamma_g
  5600. Set the gamma expression for green. The value must be a float in range
  5601. @code{0.1} to @code{10.0}. The default value is "1".
  5602. @item gamma_b
  5603. Set the gamma expression for blue. The value must be a float in range
  5604. @code{0.1} to @code{10.0}. The default value is "1".
  5605. @item gamma_weight
  5606. Set the gamma weight expression. It can be used to reduce the effect
  5607. of a high gamma value on bright image areas, e.g. keep them from
  5608. getting overamplified and just plain white. The value must be a float
  5609. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5610. gamma correction all the way down while @code{1.0} leaves it at its
  5611. full strength. Default is "1".
  5612. @item eval
  5613. Set when the expressions for brightness, contrast, saturation and
  5614. gamma expressions are evaluated.
  5615. It accepts the following values:
  5616. @table @samp
  5617. @item init
  5618. only evaluate expressions once during the filter initialization or
  5619. when a command is processed
  5620. @item frame
  5621. evaluate expressions for each incoming frame
  5622. @end table
  5623. Default value is @samp{init}.
  5624. @end table
  5625. The expressions accept the following parameters:
  5626. @table @option
  5627. @item n
  5628. frame count of the input frame starting from 0
  5629. @item pos
  5630. byte position of the corresponding packet in the input file, NAN if
  5631. unspecified
  5632. @item r
  5633. frame rate of the input video, NAN if the input frame rate is unknown
  5634. @item t
  5635. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5636. @end table
  5637. @subsection Commands
  5638. The filter supports the following commands:
  5639. @table @option
  5640. @item contrast
  5641. Set the contrast expression.
  5642. @item brightness
  5643. Set the brightness expression.
  5644. @item saturation
  5645. Set the saturation expression.
  5646. @item gamma
  5647. Set the gamma expression.
  5648. @item gamma_r
  5649. Set the gamma_r expression.
  5650. @item gamma_g
  5651. Set gamma_g expression.
  5652. @item gamma_b
  5653. Set gamma_b expression.
  5654. @item gamma_weight
  5655. Set gamma_weight expression.
  5656. The command accepts the same syntax of the corresponding option.
  5657. If the specified expression is not valid, it is kept at its current
  5658. value.
  5659. @end table
  5660. @section erosion
  5661. Apply erosion effect to the video.
  5662. This filter replaces the pixel by the local(3x3) minimum.
  5663. It accepts the following options:
  5664. @table @option
  5665. @item threshold0
  5666. @item threshold1
  5667. @item threshold2
  5668. @item threshold3
  5669. Limit the maximum change for each plane, default is 65535.
  5670. If 0, plane will remain unchanged.
  5671. @item coordinates
  5672. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5673. pixels are used.
  5674. Flags to local 3x3 coordinates maps like this:
  5675. 1 2 3
  5676. 4 5
  5677. 6 7 8
  5678. @end table
  5679. @section extractplanes
  5680. Extract color channel components from input video stream into
  5681. separate grayscale video streams.
  5682. The filter accepts the following option:
  5683. @table @option
  5684. @item planes
  5685. Set plane(s) to extract.
  5686. Available values for planes are:
  5687. @table @samp
  5688. @item y
  5689. @item u
  5690. @item v
  5691. @item a
  5692. @item r
  5693. @item g
  5694. @item b
  5695. @end table
  5696. Choosing planes not available in the input will result in an error.
  5697. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5698. with @code{y}, @code{u}, @code{v} planes at same time.
  5699. @end table
  5700. @subsection Examples
  5701. @itemize
  5702. @item
  5703. Extract luma, u and v color channel component from input video frame
  5704. into 3 grayscale outputs:
  5705. @example
  5706. 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
  5707. @end example
  5708. @end itemize
  5709. @section elbg
  5710. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5711. For each input image, the filter will compute the optimal mapping from
  5712. the input to the output given the codebook length, that is the number
  5713. of distinct output colors.
  5714. This filter accepts the following options.
  5715. @table @option
  5716. @item codebook_length, l
  5717. Set codebook length. The value must be a positive integer, and
  5718. represents the number of distinct output colors. Default value is 256.
  5719. @item nb_steps, n
  5720. Set the maximum number of iterations to apply for computing the optimal
  5721. mapping. The higher the value the better the result and the higher the
  5722. computation time. Default value is 1.
  5723. @item seed, s
  5724. Set a random seed, must be an integer included between 0 and
  5725. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5726. will try to use a good random seed on a best effort basis.
  5727. @item pal8
  5728. Set pal8 output pixel format. This option does not work with codebook
  5729. length greater than 256.
  5730. @end table
  5731. @section fade
  5732. Apply a fade-in/out effect to the input video.
  5733. It accepts the following parameters:
  5734. @table @option
  5735. @item type, t
  5736. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5737. effect.
  5738. Default is @code{in}.
  5739. @item start_frame, s
  5740. Specify the number of the frame to start applying the fade
  5741. effect at. Default is 0.
  5742. @item nb_frames, n
  5743. The number of frames that the fade effect lasts. At the end of the
  5744. fade-in effect, the output video will have the same intensity as the input video.
  5745. At the end of the fade-out transition, the output video will be filled with the
  5746. selected @option{color}.
  5747. Default is 25.
  5748. @item alpha
  5749. If set to 1, fade only alpha channel, if one exists on the input.
  5750. Default value is 0.
  5751. @item start_time, st
  5752. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5753. effect. If both start_frame and start_time are specified, the fade will start at
  5754. whichever comes last. Default is 0.
  5755. @item duration, d
  5756. The number of seconds for which the fade effect has to last. At the end of the
  5757. fade-in effect the output video will have the same intensity as the input video,
  5758. at the end of the fade-out transition the output video will be filled with the
  5759. selected @option{color}.
  5760. If both duration and nb_frames are specified, duration is used. Default is 0
  5761. (nb_frames is used by default).
  5762. @item color, c
  5763. Specify the color of the fade. Default is "black".
  5764. @end table
  5765. @subsection Examples
  5766. @itemize
  5767. @item
  5768. Fade in the first 30 frames of video:
  5769. @example
  5770. fade=in:0:30
  5771. @end example
  5772. The command above is equivalent to:
  5773. @example
  5774. fade=t=in:s=0:n=30
  5775. @end example
  5776. @item
  5777. Fade out the last 45 frames of a 200-frame video:
  5778. @example
  5779. fade=out:155:45
  5780. fade=type=out:start_frame=155:nb_frames=45
  5781. @end example
  5782. @item
  5783. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5784. @example
  5785. fade=in:0:25, fade=out:975:25
  5786. @end example
  5787. @item
  5788. Make the first 5 frames yellow, then fade in from frame 5-24:
  5789. @example
  5790. fade=in:5:20:color=yellow
  5791. @end example
  5792. @item
  5793. Fade in alpha over first 25 frames of video:
  5794. @example
  5795. fade=in:0:25:alpha=1
  5796. @end example
  5797. @item
  5798. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5799. @example
  5800. fade=t=in:st=5.5:d=0.5
  5801. @end example
  5802. @end itemize
  5803. @section fftfilt
  5804. Apply arbitrary expressions to samples in frequency domain
  5805. @table @option
  5806. @item dc_Y
  5807. Adjust the dc value (gain) of the luma plane of the image. The filter
  5808. accepts an integer value in range @code{0} to @code{1000}. The default
  5809. value is set to @code{0}.
  5810. @item dc_U
  5811. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5812. filter accepts an integer value in range @code{0} to @code{1000}. The
  5813. default value is set to @code{0}.
  5814. @item dc_V
  5815. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5816. filter accepts an integer value in range @code{0} to @code{1000}. The
  5817. default value is set to @code{0}.
  5818. @item weight_Y
  5819. Set the frequency domain weight expression for the luma plane.
  5820. @item weight_U
  5821. Set the frequency domain weight expression for the 1st chroma plane.
  5822. @item weight_V
  5823. Set the frequency domain weight expression for the 2nd chroma plane.
  5824. The filter accepts the following variables:
  5825. @item X
  5826. @item Y
  5827. The coordinates of the current sample.
  5828. @item W
  5829. @item H
  5830. The width and height of the image.
  5831. @end table
  5832. @subsection Examples
  5833. @itemize
  5834. @item
  5835. High-pass:
  5836. @example
  5837. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5838. @end example
  5839. @item
  5840. Low-pass:
  5841. @example
  5842. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5843. @end example
  5844. @item
  5845. Sharpen:
  5846. @example
  5847. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5848. @end example
  5849. @item
  5850. Blur:
  5851. @example
  5852. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5853. @end example
  5854. @end itemize
  5855. @section field
  5856. Extract a single field from an interlaced image using stride
  5857. arithmetic to avoid wasting CPU time. The output frames are marked as
  5858. non-interlaced.
  5859. The filter accepts the following options:
  5860. @table @option
  5861. @item type
  5862. Specify whether to extract the top (if the value is @code{0} or
  5863. @code{top}) or the bottom field (if the value is @code{1} or
  5864. @code{bottom}).
  5865. @end table
  5866. @section fieldhint
  5867. Create new frames by copying the top and bottom fields from surrounding frames
  5868. supplied as numbers by the hint file.
  5869. @table @option
  5870. @item hint
  5871. Set file containing hints: absolute/relative frame numbers.
  5872. There must be one line for each frame in a clip. Each line must contain two
  5873. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5874. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5875. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5876. for @code{relative} mode. First number tells from which frame to pick up top
  5877. field and second number tells from which frame to pick up bottom field.
  5878. If optionally followed by @code{+} output frame will be marked as interlaced,
  5879. else if followed by @code{-} output frame will be marked as progressive, else
  5880. it will be marked same as input frame.
  5881. If line starts with @code{#} or @code{;} that line is skipped.
  5882. @item mode
  5883. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5884. @end table
  5885. Example of first several lines of @code{hint} file for @code{relative} mode:
  5886. @example
  5887. 0,0 - # first frame
  5888. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5889. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5890. 1,0 -
  5891. 0,0 -
  5892. 0,0 -
  5893. 1,0 -
  5894. 1,0 -
  5895. 1,0 -
  5896. 0,0 -
  5897. 0,0 -
  5898. 1,0 -
  5899. 1,0 -
  5900. 1,0 -
  5901. 0,0 -
  5902. @end example
  5903. @section fieldmatch
  5904. Field matching filter for inverse telecine. It is meant to reconstruct the
  5905. progressive frames from a telecined stream. The filter does not drop duplicated
  5906. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5907. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5908. The separation of the field matching and the decimation is notably motivated by
  5909. the possibility of inserting a de-interlacing filter fallback between the two.
  5910. If the source has mixed telecined and real interlaced content,
  5911. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5912. But these remaining combed frames will be marked as interlaced, and thus can be
  5913. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5914. In addition to the various configuration options, @code{fieldmatch} can take an
  5915. optional second stream, activated through the @option{ppsrc} option. If
  5916. enabled, the frames reconstruction will be based on the fields and frames from
  5917. this second stream. This allows the first input to be pre-processed in order to
  5918. help the various algorithms of the filter, while keeping the output lossless
  5919. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5920. or brightness/contrast adjustments can help.
  5921. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5922. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5923. which @code{fieldmatch} is based on. While the semantic and usage are very
  5924. close, some behaviour and options names can differ.
  5925. The @ref{decimate} filter currently only works for constant frame rate input.
  5926. If your input has mixed telecined (30fps) and progressive content with a lower
  5927. framerate like 24fps use the following filterchain to produce the necessary cfr
  5928. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5929. The filter accepts the following options:
  5930. @table @option
  5931. @item order
  5932. Specify the assumed field order of the input stream. Available values are:
  5933. @table @samp
  5934. @item auto
  5935. Auto detect parity (use FFmpeg's internal parity value).
  5936. @item bff
  5937. Assume bottom field first.
  5938. @item tff
  5939. Assume top field first.
  5940. @end table
  5941. Note that it is sometimes recommended not to trust the parity announced by the
  5942. stream.
  5943. Default value is @var{auto}.
  5944. @item mode
  5945. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5946. sense that it won't risk creating jerkiness due to duplicate frames when
  5947. possible, but if there are bad edits or blended fields it will end up
  5948. outputting combed frames when a good match might actually exist. On the other
  5949. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5950. but will almost always find a good frame if there is one. The other values are
  5951. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5952. jerkiness and creating duplicate frames versus finding good matches in sections
  5953. with bad edits, orphaned fields, blended fields, etc.
  5954. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5955. Available values are:
  5956. @table @samp
  5957. @item pc
  5958. 2-way matching (p/c)
  5959. @item pc_n
  5960. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5961. @item pc_u
  5962. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5963. @item pc_n_ub
  5964. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5965. still combed (p/c + n + u/b)
  5966. @item pcn
  5967. 3-way matching (p/c/n)
  5968. @item pcn_ub
  5969. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5970. detected as combed (p/c/n + u/b)
  5971. @end table
  5972. The parenthesis at the end indicate the matches that would be used for that
  5973. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5974. @var{top}).
  5975. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5976. the slowest.
  5977. Default value is @var{pc_n}.
  5978. @item ppsrc
  5979. Mark the main input stream as a pre-processed input, and enable the secondary
  5980. input stream as the clean source to pick the fields from. See the filter
  5981. introduction for more details. It is similar to the @option{clip2} feature from
  5982. VFM/TFM.
  5983. Default value is @code{0} (disabled).
  5984. @item field
  5985. Set the field to match from. It is recommended to set this to the same value as
  5986. @option{order} unless you experience matching failures with that setting. In
  5987. certain circumstances changing the field that is used to match from can have a
  5988. large impact on matching performance. Available values are:
  5989. @table @samp
  5990. @item auto
  5991. Automatic (same value as @option{order}).
  5992. @item bottom
  5993. Match from the bottom field.
  5994. @item top
  5995. Match from the top field.
  5996. @end table
  5997. Default value is @var{auto}.
  5998. @item mchroma
  5999. Set whether or not chroma is included during the match comparisons. In most
  6000. cases it is recommended to leave this enabled. You should set this to @code{0}
  6001. only if your clip has bad chroma problems such as heavy rainbowing or other
  6002. artifacts. Setting this to @code{0} could also be used to speed things up at
  6003. the cost of some accuracy.
  6004. Default value is @code{1}.
  6005. @item y0
  6006. @item y1
  6007. These define an exclusion band which excludes the lines between @option{y0} and
  6008. @option{y1} from being included in the field matching decision. An exclusion
  6009. band can be used to ignore subtitles, a logo, or other things that may
  6010. interfere with the matching. @option{y0} sets the starting scan line and
  6011. @option{y1} sets the ending line; all lines in between @option{y0} and
  6012. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6013. @option{y0} and @option{y1} to the same value will disable the feature.
  6014. @option{y0} and @option{y1} defaults to @code{0}.
  6015. @item scthresh
  6016. Set the scene change detection threshold as a percentage of maximum change on
  6017. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6018. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6019. @option{scthresh} is @code{[0.0, 100.0]}.
  6020. Default value is @code{12.0}.
  6021. @item combmatch
  6022. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6023. account the combed scores of matches when deciding what match to use as the
  6024. final match. Available values are:
  6025. @table @samp
  6026. @item none
  6027. No final matching based on combed scores.
  6028. @item sc
  6029. Combed scores are only used when a scene change is detected.
  6030. @item full
  6031. Use combed scores all the time.
  6032. @end table
  6033. Default is @var{sc}.
  6034. @item combdbg
  6035. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6036. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6037. Available values are:
  6038. @table @samp
  6039. @item none
  6040. No forced calculation.
  6041. @item pcn
  6042. Force p/c/n calculations.
  6043. @item pcnub
  6044. Force p/c/n/u/b calculations.
  6045. @end table
  6046. Default value is @var{none}.
  6047. @item cthresh
  6048. This is the area combing threshold used for combed frame detection. This
  6049. essentially controls how "strong" or "visible" combing must be to be detected.
  6050. Larger values mean combing must be more visible and smaller values mean combing
  6051. can be less visible or strong and still be detected. Valid settings are from
  6052. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6053. be detected as combed). This is basically a pixel difference value. A good
  6054. range is @code{[8, 12]}.
  6055. Default value is @code{9}.
  6056. @item chroma
  6057. Sets whether or not chroma is considered in the combed frame decision. Only
  6058. disable this if your source has chroma problems (rainbowing, etc.) that are
  6059. causing problems for the combed frame detection with chroma enabled. Actually,
  6060. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6061. where there is chroma only combing in the source.
  6062. Default value is @code{0}.
  6063. @item blockx
  6064. @item blocky
  6065. Respectively set the x-axis and y-axis size of the window used during combed
  6066. frame detection. This has to do with the size of the area in which
  6067. @option{combpel} pixels are required to be detected as combed for a frame to be
  6068. declared combed. See the @option{combpel} parameter description for more info.
  6069. Possible values are any number that is a power of 2 starting at 4 and going up
  6070. to 512.
  6071. Default value is @code{16}.
  6072. @item combpel
  6073. The number of combed pixels inside any of the @option{blocky} by
  6074. @option{blockx} size blocks on the frame for the frame to be detected as
  6075. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6076. setting controls "how much" combing there must be in any localized area (a
  6077. window defined by the @option{blockx} and @option{blocky} settings) on the
  6078. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6079. which point no frames will ever be detected as combed). This setting is known
  6080. as @option{MI} in TFM/VFM vocabulary.
  6081. Default value is @code{80}.
  6082. @end table
  6083. @anchor{p/c/n/u/b meaning}
  6084. @subsection p/c/n/u/b meaning
  6085. @subsubsection p/c/n
  6086. We assume the following telecined stream:
  6087. @example
  6088. Top fields: 1 2 2 3 4
  6089. Bottom fields: 1 2 3 4 4
  6090. @end example
  6091. The numbers correspond to the progressive frame the fields relate to. Here, the
  6092. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6093. When @code{fieldmatch} is configured to run a matching from bottom
  6094. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6095. @example
  6096. Input stream:
  6097. T 1 2 2 3 4
  6098. B 1 2 3 4 4 <-- matching reference
  6099. Matches: c c n n c
  6100. Output stream:
  6101. T 1 2 3 4 4
  6102. B 1 2 3 4 4
  6103. @end example
  6104. As a result of the field matching, we can see that some frames get duplicated.
  6105. To perform a complete inverse telecine, you need to rely on a decimation filter
  6106. after this operation. See for instance the @ref{decimate} filter.
  6107. The same operation now matching from top fields (@option{field}=@var{top})
  6108. looks like this:
  6109. @example
  6110. Input stream:
  6111. T 1 2 2 3 4 <-- matching reference
  6112. B 1 2 3 4 4
  6113. Matches: c c p p c
  6114. Output stream:
  6115. T 1 2 2 3 4
  6116. B 1 2 2 3 4
  6117. @end example
  6118. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6119. basically, they refer to the frame and field of the opposite parity:
  6120. @itemize
  6121. @item @var{p} matches the field of the opposite parity in the previous frame
  6122. @item @var{c} matches the field of the opposite parity in the current frame
  6123. @item @var{n} matches the field of the opposite parity in the next frame
  6124. @end itemize
  6125. @subsubsection u/b
  6126. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6127. from the opposite parity flag. In the following examples, we assume that we are
  6128. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6129. 'x' is placed above and below each matched fields.
  6130. With bottom matching (@option{field}=@var{bottom}):
  6131. @example
  6132. Match: c p n b u
  6133. x x x x x
  6134. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6135. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6136. x x x x x
  6137. Output frames:
  6138. 2 1 2 2 2
  6139. 2 2 2 1 3
  6140. @end example
  6141. With top matching (@option{field}=@var{top}):
  6142. @example
  6143. Match: c p n b u
  6144. x x x x x
  6145. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6146. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6147. x x x x x
  6148. Output frames:
  6149. 2 2 2 1 2
  6150. 2 1 3 2 2
  6151. @end example
  6152. @subsection Examples
  6153. Simple IVTC of a top field first telecined stream:
  6154. @example
  6155. fieldmatch=order=tff:combmatch=none, decimate
  6156. @end example
  6157. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6158. @example
  6159. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6160. @end example
  6161. @section fieldorder
  6162. Transform the field order of the input video.
  6163. It accepts the following parameters:
  6164. @table @option
  6165. @item order
  6166. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6167. for bottom field first.
  6168. @end table
  6169. The default value is @samp{tff}.
  6170. The transformation is done by shifting the picture content up or down
  6171. by one line, and filling the remaining line with appropriate picture content.
  6172. This method is consistent with most broadcast field order converters.
  6173. If the input video is not flagged as being interlaced, or it is already
  6174. flagged as being of the required output field order, then this filter does
  6175. not alter the incoming video.
  6176. It is very useful when converting to or from PAL DV material,
  6177. which is bottom field first.
  6178. For example:
  6179. @example
  6180. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6181. @end example
  6182. @section fifo, afifo
  6183. Buffer input images and send them when they are requested.
  6184. It is mainly useful when auto-inserted by the libavfilter
  6185. framework.
  6186. It does not take parameters.
  6187. @section find_rect
  6188. Find a rectangular object
  6189. It accepts the following options:
  6190. @table @option
  6191. @item object
  6192. Filepath of the object image, needs to be in gray8.
  6193. @item threshold
  6194. Detection threshold, default is 0.5.
  6195. @item mipmaps
  6196. Number of mipmaps, default is 3.
  6197. @item xmin, ymin, xmax, ymax
  6198. Specifies the rectangle in which to search.
  6199. @end table
  6200. @subsection Examples
  6201. @itemize
  6202. @item
  6203. Generate a representative palette of a given video using @command{ffmpeg}:
  6204. @example
  6205. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6206. @end example
  6207. @end itemize
  6208. @section cover_rect
  6209. Cover a rectangular object
  6210. It accepts the following options:
  6211. @table @option
  6212. @item cover
  6213. Filepath of the optional cover image, needs to be in yuv420.
  6214. @item mode
  6215. Set covering mode.
  6216. It accepts the following values:
  6217. @table @samp
  6218. @item cover
  6219. cover it by the supplied image
  6220. @item blur
  6221. cover it by interpolating the surrounding pixels
  6222. @end table
  6223. Default value is @var{blur}.
  6224. @end table
  6225. @subsection Examples
  6226. @itemize
  6227. @item
  6228. Generate a representative palette of a given video using @command{ffmpeg}:
  6229. @example
  6230. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6231. @end example
  6232. @end itemize
  6233. @anchor{format}
  6234. @section format
  6235. Convert the input video to one of the specified pixel formats.
  6236. Libavfilter will try to pick one that is suitable as input to
  6237. the next filter.
  6238. It accepts the following parameters:
  6239. @table @option
  6240. @item pix_fmts
  6241. A '|'-separated list of pixel format names, such as
  6242. "pix_fmts=yuv420p|monow|rgb24".
  6243. @end table
  6244. @subsection Examples
  6245. @itemize
  6246. @item
  6247. Convert the input video to the @var{yuv420p} format
  6248. @example
  6249. format=pix_fmts=yuv420p
  6250. @end example
  6251. Convert the input video to any of the formats in the list
  6252. @example
  6253. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6254. @end example
  6255. @end itemize
  6256. @anchor{fps}
  6257. @section fps
  6258. Convert the video to specified constant frame rate by duplicating or dropping
  6259. frames as necessary.
  6260. It accepts the following parameters:
  6261. @table @option
  6262. @item fps
  6263. The desired output frame rate. The default is @code{25}.
  6264. @item round
  6265. Rounding method.
  6266. Possible values are:
  6267. @table @option
  6268. @item zero
  6269. zero round towards 0
  6270. @item inf
  6271. round away from 0
  6272. @item down
  6273. round towards -infinity
  6274. @item up
  6275. round towards +infinity
  6276. @item near
  6277. round to nearest
  6278. @end table
  6279. The default is @code{near}.
  6280. @item start_time
  6281. Assume the first PTS should be the given value, in seconds. This allows for
  6282. padding/trimming at the start of stream. By default, no assumption is made
  6283. about the first frame's expected PTS, so no padding or trimming is done.
  6284. For example, this could be set to 0 to pad the beginning with duplicates of
  6285. the first frame if a video stream starts after the audio stream or to trim any
  6286. frames with a negative PTS.
  6287. @end table
  6288. Alternatively, the options can be specified as a flat string:
  6289. @var{fps}[:@var{round}].
  6290. See also the @ref{setpts} filter.
  6291. @subsection Examples
  6292. @itemize
  6293. @item
  6294. A typical usage in order to set the fps to 25:
  6295. @example
  6296. fps=fps=25
  6297. @end example
  6298. @item
  6299. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6300. @example
  6301. fps=fps=film:round=near
  6302. @end example
  6303. @end itemize
  6304. @section framepack
  6305. Pack two different video streams into a stereoscopic video, setting proper
  6306. metadata on supported codecs. The two views should have the same size and
  6307. framerate and processing will stop when the shorter video ends. Please note
  6308. that you may conveniently adjust view properties with the @ref{scale} and
  6309. @ref{fps} filters.
  6310. It accepts the following parameters:
  6311. @table @option
  6312. @item format
  6313. The desired packing format. Supported values are:
  6314. @table @option
  6315. @item sbs
  6316. The views are next to each other (default).
  6317. @item tab
  6318. The views are on top of each other.
  6319. @item lines
  6320. The views are packed by line.
  6321. @item columns
  6322. The views are packed by column.
  6323. @item frameseq
  6324. The views are temporally interleaved.
  6325. @end table
  6326. @end table
  6327. Some examples:
  6328. @example
  6329. # Convert left and right views into a frame-sequential video
  6330. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6331. # Convert views into a side-by-side video with the same output resolution as the input
  6332. 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
  6333. @end example
  6334. @section framerate
  6335. Change the frame rate by interpolating new video output frames from the source
  6336. frames.
  6337. This filter is not designed to function correctly with interlaced media. If
  6338. you wish to change the frame rate of interlaced media then you are required
  6339. to deinterlace before this filter and re-interlace after this filter.
  6340. A description of the accepted options follows.
  6341. @table @option
  6342. @item fps
  6343. Specify the output frames per second. This option can also be specified
  6344. as a value alone. The default is @code{50}.
  6345. @item interp_start
  6346. Specify the start of a range where the output frame will be created as a
  6347. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6348. the default is @code{15}.
  6349. @item interp_end
  6350. Specify the end of a range where the output frame will be created as a
  6351. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6352. the default is @code{240}.
  6353. @item scene
  6354. Specify the level at which a scene change is detected as a value between
  6355. 0 and 100 to indicate a new scene; a low value reflects a low
  6356. probability for the current frame to introduce a new scene, while a higher
  6357. value means the current frame is more likely to be one.
  6358. The default is @code{7}.
  6359. @item flags
  6360. Specify flags influencing the filter process.
  6361. Available value for @var{flags} is:
  6362. @table @option
  6363. @item scene_change_detect, scd
  6364. Enable scene change detection using the value of the option @var{scene}.
  6365. This flag is enabled by default.
  6366. @end table
  6367. @end table
  6368. @section framestep
  6369. Select one frame every N-th frame.
  6370. This filter accepts the following option:
  6371. @table @option
  6372. @item step
  6373. Select frame after every @code{step} frames.
  6374. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6375. @end table
  6376. @anchor{frei0r}
  6377. @section frei0r
  6378. Apply a frei0r effect to the input video.
  6379. To enable the compilation of this filter, you need to install the frei0r
  6380. header and configure FFmpeg with @code{--enable-frei0r}.
  6381. It accepts the following parameters:
  6382. @table @option
  6383. @item filter_name
  6384. The name of the frei0r effect to load. If the environment variable
  6385. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6386. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6387. Otherwise, the standard frei0r paths are searched, in this order:
  6388. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6389. @file{/usr/lib/frei0r-1/}.
  6390. @item filter_params
  6391. A '|'-separated list of parameters to pass to the frei0r effect.
  6392. @end table
  6393. A frei0r effect parameter can be a boolean (its value is either
  6394. "y" or "n"), a double, a color (specified as
  6395. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6396. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6397. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6398. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6399. The number and types of parameters depend on the loaded effect. If an
  6400. effect parameter is not specified, the default value is set.
  6401. @subsection Examples
  6402. @itemize
  6403. @item
  6404. Apply the distort0r effect, setting the first two double parameters:
  6405. @example
  6406. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6407. @end example
  6408. @item
  6409. Apply the colordistance effect, taking a color as the first parameter:
  6410. @example
  6411. frei0r=colordistance:0.2/0.3/0.4
  6412. frei0r=colordistance:violet
  6413. frei0r=colordistance:0x112233
  6414. @end example
  6415. @item
  6416. Apply the perspective effect, specifying the top left and top right image
  6417. positions:
  6418. @example
  6419. frei0r=perspective:0.2/0.2|0.8/0.2
  6420. @end example
  6421. @end itemize
  6422. For more information, see
  6423. @url{http://frei0r.dyne.org}
  6424. @section fspp
  6425. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6426. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6427. processing filter, one of them is performed once per block, not per pixel.
  6428. This allows for much higher speed.
  6429. The filter accepts the following options:
  6430. @table @option
  6431. @item quality
  6432. Set quality. This option defines the number of levels for averaging. It accepts
  6433. an integer in the range 4-5. Default value is @code{4}.
  6434. @item qp
  6435. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6436. If not set, the filter will use the QP from the video stream (if available).
  6437. @item strength
  6438. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6439. more details but also more artifacts, while higher values make the image smoother
  6440. but also blurrier. Default value is @code{0} − PSNR optimal.
  6441. @item use_bframe_qp
  6442. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6443. option may cause flicker since the B-Frames have often larger QP. Default is
  6444. @code{0} (not enabled).
  6445. @end table
  6446. @section gblur
  6447. Apply Gaussian blur filter.
  6448. The filter accepts the following options:
  6449. @table @option
  6450. @item sigma
  6451. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6452. @item steps
  6453. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6454. @item planes
  6455. Set which planes to filter. By default all planes are filtered.
  6456. @item sigmaV
  6457. Set vertical sigma, if negative it will be same as @code{sigma}.
  6458. Default is @code{-1}.
  6459. @end table
  6460. @section geq
  6461. The filter accepts the following options:
  6462. @table @option
  6463. @item lum_expr, lum
  6464. Set the luminance expression.
  6465. @item cb_expr, cb
  6466. Set the chrominance blue expression.
  6467. @item cr_expr, cr
  6468. Set the chrominance red expression.
  6469. @item alpha_expr, a
  6470. Set the alpha expression.
  6471. @item red_expr, r
  6472. Set the red expression.
  6473. @item green_expr, g
  6474. Set the green expression.
  6475. @item blue_expr, b
  6476. Set the blue expression.
  6477. @end table
  6478. The colorspace is selected according to the specified options. If one
  6479. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6480. options is specified, the filter will automatically select a YCbCr
  6481. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6482. @option{blue_expr} options is specified, it will select an RGB
  6483. colorspace.
  6484. If one of the chrominance expression is not defined, it falls back on the other
  6485. one. If no alpha expression is specified it will evaluate to opaque value.
  6486. If none of chrominance expressions are specified, they will evaluate
  6487. to the luminance expression.
  6488. The expressions can use the following variables and functions:
  6489. @table @option
  6490. @item N
  6491. The sequential number of the filtered frame, starting from @code{0}.
  6492. @item X
  6493. @item Y
  6494. The coordinates of the current sample.
  6495. @item W
  6496. @item H
  6497. The width and height of the image.
  6498. @item SW
  6499. @item SH
  6500. Width and height scale depending on the currently filtered plane. It is the
  6501. ratio between the corresponding luma plane number of pixels and the current
  6502. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6503. @code{0.5,0.5} for chroma planes.
  6504. @item T
  6505. Time of the current frame, expressed in seconds.
  6506. @item p(x, y)
  6507. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6508. plane.
  6509. @item lum(x, y)
  6510. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6511. plane.
  6512. @item cb(x, y)
  6513. Return the value of the pixel at location (@var{x},@var{y}) of the
  6514. blue-difference chroma plane. Return 0 if there is no such plane.
  6515. @item cr(x, y)
  6516. Return the value of the pixel at location (@var{x},@var{y}) of the
  6517. red-difference chroma plane. Return 0 if there is no such plane.
  6518. @item r(x, y)
  6519. @item g(x, y)
  6520. @item b(x, y)
  6521. Return the value of the pixel at location (@var{x},@var{y}) of the
  6522. red/green/blue component. Return 0 if there is no such component.
  6523. @item alpha(x, y)
  6524. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6525. plane. Return 0 if there is no such plane.
  6526. @end table
  6527. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6528. automatically clipped to the closer edge.
  6529. @subsection Examples
  6530. @itemize
  6531. @item
  6532. Flip the image horizontally:
  6533. @example
  6534. geq=p(W-X\,Y)
  6535. @end example
  6536. @item
  6537. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6538. wavelength of 100 pixels:
  6539. @example
  6540. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6541. @end example
  6542. @item
  6543. Generate a fancy enigmatic moving light:
  6544. @example
  6545. 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
  6546. @end example
  6547. @item
  6548. Generate a quick emboss effect:
  6549. @example
  6550. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6551. @end example
  6552. @item
  6553. Modify RGB components depending on pixel position:
  6554. @example
  6555. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6556. @end example
  6557. @item
  6558. Create a radial gradient that is the same size as the input (also see
  6559. the @ref{vignette} filter):
  6560. @example
  6561. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6562. @end example
  6563. @end itemize
  6564. @section gradfun
  6565. Fix the banding artifacts that are sometimes introduced into nearly flat
  6566. regions by truncation to 8-bit color depth.
  6567. Interpolate the gradients that should go where the bands are, and
  6568. dither them.
  6569. It is designed for playback only. Do not use it prior to
  6570. lossy compression, because compression tends to lose the dither and
  6571. bring back the bands.
  6572. It accepts the following parameters:
  6573. @table @option
  6574. @item strength
  6575. The maximum amount by which the filter will change any one pixel. This is also
  6576. the threshold for detecting nearly flat regions. Acceptable values range from
  6577. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6578. valid range.
  6579. @item radius
  6580. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6581. gradients, but also prevents the filter from modifying the pixels near detailed
  6582. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6583. values will be clipped to the valid range.
  6584. @end table
  6585. Alternatively, the options can be specified as a flat string:
  6586. @var{strength}[:@var{radius}]
  6587. @subsection Examples
  6588. @itemize
  6589. @item
  6590. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6591. @example
  6592. gradfun=3.5:8
  6593. @end example
  6594. @item
  6595. Specify radius, omitting the strength (which will fall-back to the default
  6596. value):
  6597. @example
  6598. gradfun=radius=8
  6599. @end example
  6600. @end itemize
  6601. @anchor{haldclut}
  6602. @section haldclut
  6603. Apply a Hald CLUT to a video stream.
  6604. First input is the video stream to process, and second one is the Hald CLUT.
  6605. The Hald CLUT input can be a simple picture or a complete video stream.
  6606. The filter accepts the following options:
  6607. @table @option
  6608. @item shortest
  6609. Force termination when the shortest input terminates. Default is @code{0}.
  6610. @item repeatlast
  6611. Continue applying the last CLUT after the end of the stream. A value of
  6612. @code{0} disable the filter after the last frame of the CLUT is reached.
  6613. Default is @code{1}.
  6614. @end table
  6615. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6616. filters share the same internals).
  6617. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6618. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6619. @subsection Workflow examples
  6620. @subsubsection Hald CLUT video stream
  6621. Generate an identity Hald CLUT stream altered with various effects:
  6622. @example
  6623. 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
  6624. @end example
  6625. Note: make sure you use a lossless codec.
  6626. Then use it with @code{haldclut} to apply it on some random stream:
  6627. @example
  6628. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6629. @end example
  6630. The Hald CLUT will be applied to the 10 first seconds (duration of
  6631. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6632. to the remaining frames of the @code{mandelbrot} stream.
  6633. @subsubsection Hald CLUT with preview
  6634. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6635. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6636. biggest possible square starting at the top left of the picture. The remaining
  6637. padding pixels (bottom or right) will be ignored. This area can be used to add
  6638. a preview of the Hald CLUT.
  6639. Typically, the following generated Hald CLUT will be supported by the
  6640. @code{haldclut} filter:
  6641. @example
  6642. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6643. pad=iw+320 [padded_clut];
  6644. smptebars=s=320x256, split [a][b];
  6645. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6646. [main][b] overlay=W-320" -frames:v 1 clut.png
  6647. @end example
  6648. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6649. bars are displayed on the right-top, and below the same color bars processed by
  6650. the color changes.
  6651. Then, the effect of this Hald CLUT can be visualized with:
  6652. @example
  6653. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6654. @end example
  6655. @section hflip
  6656. Flip the input video horizontally.
  6657. For example, to horizontally flip the input video with @command{ffmpeg}:
  6658. @example
  6659. ffmpeg -i in.avi -vf "hflip" out.avi
  6660. @end example
  6661. @section histeq
  6662. This filter applies a global color histogram equalization on a
  6663. per-frame basis.
  6664. It can be used to correct video that has a compressed range of pixel
  6665. intensities. The filter redistributes the pixel intensities to
  6666. equalize their distribution across the intensity range. It may be
  6667. viewed as an "automatically adjusting contrast filter". This filter is
  6668. useful only for correcting degraded or poorly captured source
  6669. video.
  6670. The filter accepts the following options:
  6671. @table @option
  6672. @item strength
  6673. Determine the amount of equalization to be applied. As the strength
  6674. is reduced, the distribution of pixel intensities more-and-more
  6675. approaches that of the input frame. The value must be a float number
  6676. in the range [0,1] and defaults to 0.200.
  6677. @item intensity
  6678. Set the maximum intensity that can generated and scale the output
  6679. values appropriately. The strength should be set as desired and then
  6680. the intensity can be limited if needed to avoid washing-out. The value
  6681. must be a float number in the range [0,1] and defaults to 0.210.
  6682. @item antibanding
  6683. Set the antibanding level. If enabled the filter will randomly vary
  6684. the luminance of output pixels by a small amount to avoid banding of
  6685. the histogram. Possible values are @code{none}, @code{weak} or
  6686. @code{strong}. It defaults to @code{none}.
  6687. @end table
  6688. @section histogram
  6689. Compute and draw a color distribution histogram for the input video.
  6690. The computed histogram is a representation of the color component
  6691. distribution in an image.
  6692. Standard histogram displays the color components distribution in an image.
  6693. Displays color graph for each color component. Shows distribution of
  6694. the Y, U, V, A or R, G, B components, depending on input format, in the
  6695. current frame. Below each graph a color component scale meter is shown.
  6696. The filter accepts the following options:
  6697. @table @option
  6698. @item level_height
  6699. Set height of level. Default value is @code{200}.
  6700. Allowed range is [50, 2048].
  6701. @item scale_height
  6702. Set height of color scale. Default value is @code{12}.
  6703. Allowed range is [0, 40].
  6704. @item display_mode
  6705. Set display mode.
  6706. It accepts the following values:
  6707. @table @samp
  6708. @item parade
  6709. Per color component graphs are placed below each other.
  6710. @item overlay
  6711. Presents information identical to that in the @code{parade}, except
  6712. that the graphs representing color components are superimposed directly
  6713. over one another.
  6714. @end table
  6715. Default is @code{parade}.
  6716. @item levels_mode
  6717. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6718. Default is @code{linear}.
  6719. @item components
  6720. Set what color components to display.
  6721. Default is @code{7}.
  6722. @item fgopacity
  6723. Set foreground opacity. Default is @code{0.7}.
  6724. @item bgopacity
  6725. Set background opacity. Default is @code{0.5}.
  6726. @end table
  6727. @subsection Examples
  6728. @itemize
  6729. @item
  6730. Calculate and draw histogram:
  6731. @example
  6732. ffplay -i input -vf histogram
  6733. @end example
  6734. @end itemize
  6735. @anchor{hqdn3d}
  6736. @section hqdn3d
  6737. This is a high precision/quality 3d denoise filter. It aims to reduce
  6738. image noise, producing smooth images and making still images really
  6739. still. It should enhance compressibility.
  6740. It accepts the following optional parameters:
  6741. @table @option
  6742. @item luma_spatial
  6743. A non-negative floating point number which specifies spatial luma strength.
  6744. It defaults to 4.0.
  6745. @item chroma_spatial
  6746. A non-negative floating point number which specifies spatial chroma strength.
  6747. It defaults to 3.0*@var{luma_spatial}/4.0.
  6748. @item luma_tmp
  6749. A floating point number which specifies luma temporal strength. It defaults to
  6750. 6.0*@var{luma_spatial}/4.0.
  6751. @item chroma_tmp
  6752. A floating point number which specifies chroma temporal strength. It defaults to
  6753. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6754. @end table
  6755. @anchor{hwupload_cuda}
  6756. @section hwupload_cuda
  6757. Upload system memory frames to a CUDA device.
  6758. It accepts the following optional parameters:
  6759. @table @option
  6760. @item device
  6761. The number of the CUDA device to use
  6762. @end table
  6763. @section hqx
  6764. Apply a high-quality magnification filter designed for pixel art. This filter
  6765. was originally created by Maxim Stepin.
  6766. It accepts the following option:
  6767. @table @option
  6768. @item n
  6769. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6770. @code{hq3x} and @code{4} for @code{hq4x}.
  6771. Default is @code{3}.
  6772. @end table
  6773. @section hstack
  6774. Stack input videos horizontally.
  6775. All streams must be of same pixel format and of same height.
  6776. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6777. to create same output.
  6778. The filter accept the following option:
  6779. @table @option
  6780. @item inputs
  6781. Set number of input streams. Default is 2.
  6782. @item shortest
  6783. If set to 1, force the output to terminate when the shortest input
  6784. terminates. Default value is 0.
  6785. @end table
  6786. @section hue
  6787. Modify the hue and/or the saturation of the input.
  6788. It accepts the following parameters:
  6789. @table @option
  6790. @item h
  6791. Specify the hue angle as a number of degrees. It accepts an expression,
  6792. and defaults to "0".
  6793. @item s
  6794. Specify the saturation in the [-10,10] range. It accepts an expression and
  6795. defaults to "1".
  6796. @item H
  6797. Specify the hue angle as a number of radians. It accepts an
  6798. expression, and defaults to "0".
  6799. @item b
  6800. Specify the brightness in the [-10,10] range. It accepts an expression and
  6801. defaults to "0".
  6802. @end table
  6803. @option{h} and @option{H} are mutually exclusive, and can't be
  6804. specified at the same time.
  6805. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6806. expressions containing the following constants:
  6807. @table @option
  6808. @item n
  6809. frame count of the input frame starting from 0
  6810. @item pts
  6811. presentation timestamp of the input frame expressed in time base units
  6812. @item r
  6813. frame rate of the input video, NAN if the input frame rate is unknown
  6814. @item t
  6815. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6816. @item tb
  6817. time base of the input video
  6818. @end table
  6819. @subsection Examples
  6820. @itemize
  6821. @item
  6822. Set the hue to 90 degrees and the saturation to 1.0:
  6823. @example
  6824. hue=h=90:s=1
  6825. @end example
  6826. @item
  6827. Same command but expressing the hue in radians:
  6828. @example
  6829. hue=H=PI/2:s=1
  6830. @end example
  6831. @item
  6832. Rotate hue and make the saturation swing between 0
  6833. and 2 over a period of 1 second:
  6834. @example
  6835. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6836. @end example
  6837. @item
  6838. Apply a 3 seconds saturation fade-in effect starting at 0:
  6839. @example
  6840. hue="s=min(t/3\,1)"
  6841. @end example
  6842. The general fade-in expression can be written as:
  6843. @example
  6844. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6845. @end example
  6846. @item
  6847. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6848. @example
  6849. hue="s=max(0\, min(1\, (8-t)/3))"
  6850. @end example
  6851. The general fade-out expression can be written as:
  6852. @example
  6853. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6854. @end example
  6855. @end itemize
  6856. @subsection Commands
  6857. This filter supports the following commands:
  6858. @table @option
  6859. @item b
  6860. @item s
  6861. @item h
  6862. @item H
  6863. Modify the hue and/or the saturation and/or brightness of the input video.
  6864. The command accepts the same syntax of the corresponding option.
  6865. If the specified expression is not valid, it is kept at its current
  6866. value.
  6867. @end table
  6868. @section hysteresis
  6869. Grow first stream into second stream by connecting components.
  6870. This makes it possible to build more robust edge masks.
  6871. This filter accepts the following options:
  6872. @table @option
  6873. @item planes
  6874. Set which planes will be processed as bitmap, unprocessed planes will be
  6875. copied from first stream.
  6876. By default value 0xf, all planes will be processed.
  6877. @item threshold
  6878. Set threshold which is used in filtering. If pixel component value is higher than
  6879. this value filter algorithm for connecting components is activated.
  6880. By default value is 0.
  6881. @end table
  6882. @section idet
  6883. Detect video interlacing type.
  6884. This filter tries to detect if the input frames are interlaced, progressive,
  6885. top or bottom field first. It will also try to detect fields that are
  6886. repeated between adjacent frames (a sign of telecine).
  6887. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6888. Multiple frame detection incorporates the classification history of previous frames.
  6889. The filter will log these metadata values:
  6890. @table @option
  6891. @item single.current_frame
  6892. Detected type of current frame using single-frame detection. One of:
  6893. ``tff'' (top field first), ``bff'' (bottom field first),
  6894. ``progressive'', or ``undetermined''
  6895. @item single.tff
  6896. Cumulative number of frames detected as top field first using single-frame detection.
  6897. @item multiple.tff
  6898. Cumulative number of frames detected as top field first using multiple-frame detection.
  6899. @item single.bff
  6900. Cumulative number of frames detected as bottom field first using single-frame detection.
  6901. @item multiple.current_frame
  6902. Detected type of current frame using multiple-frame detection. One of:
  6903. ``tff'' (top field first), ``bff'' (bottom field first),
  6904. ``progressive'', or ``undetermined''
  6905. @item multiple.bff
  6906. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6907. @item single.progressive
  6908. Cumulative number of frames detected as progressive using single-frame detection.
  6909. @item multiple.progressive
  6910. Cumulative number of frames detected as progressive using multiple-frame detection.
  6911. @item single.undetermined
  6912. Cumulative number of frames that could not be classified using single-frame detection.
  6913. @item multiple.undetermined
  6914. Cumulative number of frames that could not be classified using multiple-frame detection.
  6915. @item repeated.current_frame
  6916. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6917. @item repeated.neither
  6918. Cumulative number of frames with no repeated field.
  6919. @item repeated.top
  6920. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6921. @item repeated.bottom
  6922. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6923. @end table
  6924. The filter accepts the following options:
  6925. @table @option
  6926. @item intl_thres
  6927. Set interlacing threshold.
  6928. @item prog_thres
  6929. Set progressive threshold.
  6930. @item rep_thres
  6931. Threshold for repeated field detection.
  6932. @item half_life
  6933. Number of frames after which a given frame's contribution to the
  6934. statistics is halved (i.e., it contributes only 0.5 to its
  6935. classification). The default of 0 means that all frames seen are given
  6936. full weight of 1.0 forever.
  6937. @item analyze_interlaced_flag
  6938. When this is not 0 then idet will use the specified number of frames to determine
  6939. if the interlaced flag is accurate, it will not count undetermined frames.
  6940. If the flag is found to be accurate it will be used without any further
  6941. computations, if it is found to be inaccurate it will be cleared without any
  6942. further computations. This allows inserting the idet filter as a low computational
  6943. method to clean up the interlaced flag
  6944. @end table
  6945. @section il
  6946. Deinterleave or interleave fields.
  6947. This filter allows one to process interlaced images fields without
  6948. deinterlacing them. Deinterleaving splits the input frame into 2
  6949. fields (so called half pictures). Odd lines are moved to the top
  6950. half of the output image, even lines to the bottom half.
  6951. You can process (filter) them independently and then re-interleave them.
  6952. The filter accepts the following options:
  6953. @table @option
  6954. @item luma_mode, l
  6955. @item chroma_mode, c
  6956. @item alpha_mode, a
  6957. Available values for @var{luma_mode}, @var{chroma_mode} and
  6958. @var{alpha_mode} are:
  6959. @table @samp
  6960. @item none
  6961. Do nothing.
  6962. @item deinterleave, d
  6963. Deinterleave fields, placing one above the other.
  6964. @item interleave, i
  6965. Interleave fields. Reverse the effect of deinterleaving.
  6966. @end table
  6967. Default value is @code{none}.
  6968. @item luma_swap, ls
  6969. @item chroma_swap, cs
  6970. @item alpha_swap, as
  6971. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6972. @end table
  6973. @section inflate
  6974. Apply inflate effect to the video.
  6975. This filter replaces the pixel by the local(3x3) average by taking into account
  6976. only values higher than the pixel.
  6977. It accepts the following options:
  6978. @table @option
  6979. @item threshold0
  6980. @item threshold1
  6981. @item threshold2
  6982. @item threshold3
  6983. Limit the maximum change for each plane, default is 65535.
  6984. If 0, plane will remain unchanged.
  6985. @end table
  6986. @section interlace
  6987. Simple interlacing filter from progressive contents. This interleaves upper (or
  6988. lower) lines from odd frames with lower (or upper) lines from even frames,
  6989. halving the frame rate and preserving image height.
  6990. @example
  6991. Original Original New Frame
  6992. Frame 'j' Frame 'j+1' (tff)
  6993. ========== =========== ==================
  6994. Line 0 --------------------> Frame 'j' Line 0
  6995. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6996. Line 2 ---------------------> Frame 'j' Line 2
  6997. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6998. ... ... ...
  6999. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7000. @end example
  7001. It accepts the following optional parameters:
  7002. @table @option
  7003. @item scan
  7004. This determines whether the interlaced frame is taken from the even
  7005. (tff - default) or odd (bff) lines of the progressive frame.
  7006. @item lowpass
  7007. Enable (default) or disable the vertical lowpass filter to avoid twitter
  7008. interlacing and reduce moire patterns.
  7009. @end table
  7010. @section kerndeint
  7011. Deinterlace input video by applying Donald Graft's adaptive kernel
  7012. deinterling. Work on interlaced parts of a video to produce
  7013. progressive frames.
  7014. The description of the accepted parameters follows.
  7015. @table @option
  7016. @item thresh
  7017. Set the threshold which affects the filter's tolerance when
  7018. determining if a pixel line must be processed. It must be an integer
  7019. in the range [0,255] and defaults to 10. A value of 0 will result in
  7020. applying the process on every pixels.
  7021. @item map
  7022. Paint pixels exceeding the threshold value to white if set to 1.
  7023. Default is 0.
  7024. @item order
  7025. Set the fields order. Swap fields if set to 1, leave fields alone if
  7026. 0. Default is 0.
  7027. @item sharp
  7028. Enable additional sharpening if set to 1. Default is 0.
  7029. @item twoway
  7030. Enable twoway sharpening if set to 1. Default is 0.
  7031. @end table
  7032. @subsection Examples
  7033. @itemize
  7034. @item
  7035. Apply default values:
  7036. @example
  7037. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7038. @end example
  7039. @item
  7040. Enable additional sharpening:
  7041. @example
  7042. kerndeint=sharp=1
  7043. @end example
  7044. @item
  7045. Paint processed pixels in white:
  7046. @example
  7047. kerndeint=map=1
  7048. @end example
  7049. @end itemize
  7050. @section lenscorrection
  7051. Correct radial lens distortion
  7052. This filter can be used to correct for radial distortion as can result from the use
  7053. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7054. one can use tools available for example as part of opencv or simply trial-and-error.
  7055. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7056. and extract the k1 and k2 coefficients from the resulting matrix.
  7057. Note that effectively the same filter is available in the open-source tools Krita and
  7058. Digikam from the KDE project.
  7059. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7060. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7061. brightness distribution, so you may want to use both filters together in certain
  7062. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7063. be applied before or after lens correction.
  7064. @subsection Options
  7065. The filter accepts the following options:
  7066. @table @option
  7067. @item cx
  7068. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7069. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7070. width.
  7071. @item cy
  7072. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7073. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7074. height.
  7075. @item k1
  7076. Coefficient of the quadratic correction term. 0.5 means no correction.
  7077. @item k2
  7078. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7079. @end table
  7080. The formula that generates the correction is:
  7081. @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)
  7082. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7083. distances from the focal point in the source and target images, respectively.
  7084. @section loop
  7085. Loop video frames.
  7086. The filter accepts the following options:
  7087. @table @option
  7088. @item loop
  7089. Set the number of loops.
  7090. @item size
  7091. Set maximal size in number of frames.
  7092. @item start
  7093. Set first frame of loop.
  7094. @end table
  7095. @anchor{lut3d}
  7096. @section lut3d
  7097. Apply a 3D LUT to an input video.
  7098. The filter accepts the following options:
  7099. @table @option
  7100. @item file
  7101. Set the 3D LUT file name.
  7102. Currently supported formats:
  7103. @table @samp
  7104. @item 3dl
  7105. AfterEffects
  7106. @item cube
  7107. Iridas
  7108. @item dat
  7109. DaVinci
  7110. @item m3d
  7111. Pandora
  7112. @end table
  7113. @item interp
  7114. Select interpolation mode.
  7115. Available values are:
  7116. @table @samp
  7117. @item nearest
  7118. Use values from the nearest defined point.
  7119. @item trilinear
  7120. Interpolate values using the 8 points defining a cube.
  7121. @item tetrahedral
  7122. Interpolate values using a tetrahedron.
  7123. @end table
  7124. @end table
  7125. @section lut, lutrgb, lutyuv
  7126. Compute a look-up table for binding each pixel component input value
  7127. to an output value, and apply it to the input video.
  7128. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7129. to an RGB input video.
  7130. These filters accept the following parameters:
  7131. @table @option
  7132. @item c0
  7133. set first pixel component expression
  7134. @item c1
  7135. set second pixel component expression
  7136. @item c2
  7137. set third pixel component expression
  7138. @item c3
  7139. set fourth pixel component expression, corresponds to the alpha component
  7140. @item r
  7141. set red component expression
  7142. @item g
  7143. set green component expression
  7144. @item b
  7145. set blue component expression
  7146. @item a
  7147. alpha component expression
  7148. @item y
  7149. set Y/luminance component expression
  7150. @item u
  7151. set U/Cb component expression
  7152. @item v
  7153. set V/Cr component expression
  7154. @end table
  7155. Each of them specifies the expression to use for computing the lookup table for
  7156. the corresponding pixel component values.
  7157. The exact component associated to each of the @var{c*} options depends on the
  7158. format in input.
  7159. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7160. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7161. The expressions can contain the following constants and functions:
  7162. @table @option
  7163. @item w
  7164. @item h
  7165. The input width and height.
  7166. @item val
  7167. The input value for the pixel component.
  7168. @item clipval
  7169. The input value, clipped to the @var{minval}-@var{maxval} range.
  7170. @item maxval
  7171. The maximum value for the pixel component.
  7172. @item minval
  7173. The minimum value for the pixel component.
  7174. @item negval
  7175. The negated value for the pixel component value, clipped to the
  7176. @var{minval}-@var{maxval} range; it corresponds to the expression
  7177. "maxval-clipval+minval".
  7178. @item clip(val)
  7179. The computed value in @var{val}, clipped to the
  7180. @var{minval}-@var{maxval} range.
  7181. @item gammaval(gamma)
  7182. The computed gamma correction value of the pixel component value,
  7183. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7184. expression
  7185. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7186. @end table
  7187. All expressions default to "val".
  7188. @subsection Examples
  7189. @itemize
  7190. @item
  7191. Negate input video:
  7192. @example
  7193. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7194. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7195. @end example
  7196. The above is the same as:
  7197. @example
  7198. lutrgb="r=negval:g=negval:b=negval"
  7199. lutyuv="y=negval:u=negval:v=negval"
  7200. @end example
  7201. @item
  7202. Negate luminance:
  7203. @example
  7204. lutyuv=y=negval
  7205. @end example
  7206. @item
  7207. Remove chroma components, turning the video into a graytone image:
  7208. @example
  7209. lutyuv="u=128:v=128"
  7210. @end example
  7211. @item
  7212. Apply a luma burning effect:
  7213. @example
  7214. lutyuv="y=2*val"
  7215. @end example
  7216. @item
  7217. Remove green and blue components:
  7218. @example
  7219. lutrgb="g=0:b=0"
  7220. @end example
  7221. @item
  7222. Set a constant alpha channel value on input:
  7223. @example
  7224. format=rgba,lutrgb=a="maxval-minval/2"
  7225. @end example
  7226. @item
  7227. Correct luminance gamma by a factor of 0.5:
  7228. @example
  7229. lutyuv=y=gammaval(0.5)
  7230. @end example
  7231. @item
  7232. Discard least significant bits of luma:
  7233. @example
  7234. lutyuv=y='bitand(val, 128+64+32)'
  7235. @end example
  7236. @item
  7237. Technicolor like effect:
  7238. @example
  7239. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7240. @end example
  7241. @end itemize
  7242. @section lut2
  7243. Compute and apply a lookup table from two video inputs.
  7244. This filter accepts the following parameters:
  7245. @table @option
  7246. @item c0
  7247. set first pixel component expression
  7248. @item c1
  7249. set second pixel component expression
  7250. @item c2
  7251. set third pixel component expression
  7252. @item c3
  7253. set fourth pixel component expression, corresponds to the alpha component
  7254. @end table
  7255. Each of them specifies the expression to use for computing the lookup table for
  7256. the corresponding pixel component values.
  7257. The exact component associated to each of the @var{c*} options depends on the
  7258. format in inputs.
  7259. The expressions can contain the following constants:
  7260. @table @option
  7261. @item w
  7262. @item h
  7263. The input width and height.
  7264. @item x
  7265. The first input value for the pixel component.
  7266. @item y
  7267. The second input value for the pixel component.
  7268. @item bdx
  7269. The first input video bit depth.
  7270. @item bdy
  7271. The second input video bit depth.
  7272. @end table
  7273. All expressions default to "x".
  7274. @subsection Examples
  7275. @itemize
  7276. @item
  7277. Highlight differences between two RGB video streams:
  7278. @example
  7279. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  7280. @end example
  7281. @item
  7282. Highlight differences between two YUV video streams:
  7283. @example
  7284. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  7285. @end example
  7286. @end itemize
  7287. @section maskedclamp
  7288. Clamp the first input stream with the second input and third input stream.
  7289. Returns the value of first stream to be between second input
  7290. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7291. This filter accepts the following options:
  7292. @table @option
  7293. @item undershoot
  7294. Default value is @code{0}.
  7295. @item overshoot
  7296. Default value is @code{0}.
  7297. @item planes
  7298. Set which planes will be processed as bitmap, unprocessed planes will be
  7299. copied from first stream.
  7300. By default value 0xf, all planes will be processed.
  7301. @end table
  7302. @section maskedmerge
  7303. Merge the first input stream with the second input stream using per pixel
  7304. weights in the third input stream.
  7305. A value of 0 in the third stream pixel component means that pixel component
  7306. from first stream is returned unchanged, while maximum value (eg. 255 for
  7307. 8-bit videos) means that pixel component from second stream is returned
  7308. unchanged. Intermediate values define the amount of merging between both
  7309. input stream's pixel components.
  7310. This filter accepts the following options:
  7311. @table @option
  7312. @item planes
  7313. Set which planes will be processed as bitmap, unprocessed planes will be
  7314. copied from first stream.
  7315. By default value 0xf, all planes will be processed.
  7316. @end table
  7317. @section mcdeint
  7318. Apply motion-compensation deinterlacing.
  7319. It needs one field per frame as input and must thus be used together
  7320. with yadif=1/3 or equivalent.
  7321. This filter accepts the following options:
  7322. @table @option
  7323. @item mode
  7324. Set the deinterlacing mode.
  7325. It accepts one of the following values:
  7326. @table @samp
  7327. @item fast
  7328. @item medium
  7329. @item slow
  7330. use iterative motion estimation
  7331. @item extra_slow
  7332. like @samp{slow}, but use multiple reference frames.
  7333. @end table
  7334. Default value is @samp{fast}.
  7335. @item parity
  7336. Set the picture field parity assumed for the input video. It must be
  7337. one of the following values:
  7338. @table @samp
  7339. @item 0, tff
  7340. assume top field first
  7341. @item 1, bff
  7342. assume bottom field first
  7343. @end table
  7344. Default value is @samp{bff}.
  7345. @item qp
  7346. Set per-block quantization parameter (QP) used by the internal
  7347. encoder.
  7348. Higher values should result in a smoother motion vector field but less
  7349. optimal individual vectors. Default value is 1.
  7350. @end table
  7351. @section mergeplanes
  7352. Merge color channel components from several video streams.
  7353. The filter accepts up to 4 input streams, and merge selected input
  7354. planes to the output video.
  7355. This filter accepts the following options:
  7356. @table @option
  7357. @item mapping
  7358. Set input to output plane mapping. Default is @code{0}.
  7359. The mappings is specified as a bitmap. It should be specified as a
  7360. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7361. mapping for the first plane of the output stream. 'A' sets the number of
  7362. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7363. corresponding input to use (from 0 to 3). The rest of the mappings is
  7364. similar, 'Bb' describes the mapping for the output stream second
  7365. plane, 'Cc' describes the mapping for the output stream third plane and
  7366. 'Dd' describes the mapping for the output stream fourth plane.
  7367. @item format
  7368. Set output pixel format. Default is @code{yuva444p}.
  7369. @end table
  7370. @subsection Examples
  7371. @itemize
  7372. @item
  7373. Merge three gray video streams of same width and height into single video stream:
  7374. @example
  7375. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7376. @end example
  7377. @item
  7378. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7379. @example
  7380. [a0][a1]mergeplanes=0x00010210:yuva444p
  7381. @end example
  7382. @item
  7383. Swap Y and A plane in yuva444p stream:
  7384. @example
  7385. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7386. @end example
  7387. @item
  7388. Swap U and V plane in yuv420p stream:
  7389. @example
  7390. format=yuv420p,mergeplanes=0x000201:yuv420p
  7391. @end example
  7392. @item
  7393. Cast a rgb24 clip to yuv444p:
  7394. @example
  7395. format=rgb24,mergeplanes=0x000102:yuv444p
  7396. @end example
  7397. @end itemize
  7398. @section mestimate
  7399. Estimate and export motion vectors using block matching algorithms.
  7400. Motion vectors are stored in frame side data to be used by other filters.
  7401. This filter accepts the following options:
  7402. @table @option
  7403. @item method
  7404. Specify the motion estimation method. Accepts one of the following values:
  7405. @table @samp
  7406. @item esa
  7407. Exhaustive search algorithm.
  7408. @item tss
  7409. Three step search algorithm.
  7410. @item tdls
  7411. Two dimensional logarithmic search algorithm.
  7412. @item ntss
  7413. New three step search algorithm.
  7414. @item fss
  7415. Four step search algorithm.
  7416. @item ds
  7417. Diamond search algorithm.
  7418. @item hexbs
  7419. Hexagon-based search algorithm.
  7420. @item epzs
  7421. Enhanced predictive zonal search algorithm.
  7422. @item umh
  7423. Uneven multi-hexagon search algorithm.
  7424. @end table
  7425. Default value is @samp{esa}.
  7426. @item mb_size
  7427. Macroblock size. Default @code{16}.
  7428. @item search_param
  7429. Search parameter. Default @code{7}.
  7430. @end table
  7431. @section midequalizer
  7432. Apply Midway Image Equalization effect using two video streams.
  7433. Midway Image Equalization adjusts a pair of images to have the same
  7434. histogram, while maintaining their dynamics as much as possible. It's
  7435. useful for e.g. matching exposures from a pair of stereo cameras.
  7436. This filter has two inputs and one output, which must be of same pixel format, but
  7437. may be of different sizes. The output of filter is first input adjusted with
  7438. midway histogram of both inputs.
  7439. This filter accepts the following option:
  7440. @table @option
  7441. @item planes
  7442. Set which planes to process. Default is @code{15}, which is all available planes.
  7443. @end table
  7444. @section minterpolate
  7445. Convert the video to specified frame rate using motion interpolation.
  7446. This filter accepts the following options:
  7447. @table @option
  7448. @item fps
  7449. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  7450. @item mi_mode
  7451. Motion interpolation mode. Following values are accepted:
  7452. @table @samp
  7453. @item dup
  7454. Duplicate previous or next frame for interpolating new ones.
  7455. @item blend
  7456. Blend source frames. Interpolated frame is mean of previous and next frames.
  7457. @item mci
  7458. Motion compensated interpolation. Following options are effective when this mode is selected:
  7459. @table @samp
  7460. @item mc_mode
  7461. Motion compensation mode. Following values are accepted:
  7462. @table @samp
  7463. @item obmc
  7464. Overlapped block motion compensation.
  7465. @item aobmc
  7466. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7467. @end table
  7468. Default mode is @samp{obmc}.
  7469. @item me_mode
  7470. Motion estimation mode. Following values are accepted:
  7471. @table @samp
  7472. @item bidir
  7473. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7474. @item bilat
  7475. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7476. @end table
  7477. Default mode is @samp{bilat}.
  7478. @item me
  7479. The algorithm to be used for motion estimation. Following values are accepted:
  7480. @table @samp
  7481. @item esa
  7482. Exhaustive search algorithm.
  7483. @item tss
  7484. Three step search algorithm.
  7485. @item tdls
  7486. Two dimensional logarithmic search algorithm.
  7487. @item ntss
  7488. New three step search algorithm.
  7489. @item fss
  7490. Four step search algorithm.
  7491. @item ds
  7492. Diamond search algorithm.
  7493. @item hexbs
  7494. Hexagon-based search algorithm.
  7495. @item epzs
  7496. Enhanced predictive zonal search algorithm.
  7497. @item umh
  7498. Uneven multi-hexagon search algorithm.
  7499. @end table
  7500. Default algorithm is @samp{epzs}.
  7501. @item mb_size
  7502. Macroblock size. Default @code{16}.
  7503. @item search_param
  7504. Motion estimation search parameter. Default @code{32}.
  7505. @item vsbmc
  7506. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  7507. @end table
  7508. @end table
  7509. @item scd
  7510. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  7511. @table @samp
  7512. @item none
  7513. Disable scene change detection.
  7514. @item fdiff
  7515. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7516. @end table
  7517. Default method is @samp{fdiff}.
  7518. @item scd_threshold
  7519. Scene change detection threshold. Default is @code{5.0}.
  7520. @end table
  7521. @section mpdecimate
  7522. Drop frames that do not differ greatly from the previous frame in
  7523. order to reduce frame rate.
  7524. The main use of this filter is for very-low-bitrate encoding
  7525. (e.g. streaming over dialup modem), but it could in theory be used for
  7526. fixing movies that were inverse-telecined incorrectly.
  7527. A description of the accepted options follows.
  7528. @table @option
  7529. @item max
  7530. Set the maximum number of consecutive frames which can be dropped (if
  7531. positive), or the minimum interval between dropped frames (if
  7532. negative). If the value is 0, the frame is dropped unregarding the
  7533. number of previous sequentially dropped frames.
  7534. Default value is 0.
  7535. @item hi
  7536. @item lo
  7537. @item frac
  7538. Set the dropping threshold values.
  7539. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7540. represent actual pixel value differences, so a threshold of 64
  7541. corresponds to 1 unit of difference for each pixel, or the same spread
  7542. out differently over the block.
  7543. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7544. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7545. meaning the whole image) differ by more than a threshold of @option{lo}.
  7546. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7547. 64*5, and default value for @option{frac} is 0.33.
  7548. @end table
  7549. @section negate
  7550. Negate input video.
  7551. It accepts an integer in input; if non-zero it negates the
  7552. alpha component (if available). The default value in input is 0.
  7553. @section nlmeans
  7554. Denoise frames using Non-Local Means algorithm.
  7555. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7556. context similarity is defined by comparing their surrounding patches of size
  7557. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7558. around the pixel.
  7559. Note that the research area defines centers for patches, which means some
  7560. patches will be made of pixels outside that research area.
  7561. The filter accepts the following options.
  7562. @table @option
  7563. @item s
  7564. Set denoising strength.
  7565. @item p
  7566. Set patch size.
  7567. @item pc
  7568. Same as @option{p} but for chroma planes.
  7569. The default value is @var{0} and means automatic.
  7570. @item r
  7571. Set research size.
  7572. @item rc
  7573. Same as @option{r} but for chroma planes.
  7574. The default value is @var{0} and means automatic.
  7575. @end table
  7576. @section nnedi
  7577. Deinterlace video using neural network edge directed interpolation.
  7578. This filter accepts the following options:
  7579. @table @option
  7580. @item weights
  7581. Mandatory option, without binary file filter can not work.
  7582. Currently file can be found here:
  7583. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7584. @item deint
  7585. Set which frames to deinterlace, by default it is @code{all}.
  7586. Can be @code{all} or @code{interlaced}.
  7587. @item field
  7588. Set mode of operation.
  7589. Can be one of the following:
  7590. @table @samp
  7591. @item af
  7592. Use frame flags, both fields.
  7593. @item a
  7594. Use frame flags, single field.
  7595. @item t
  7596. Use top field only.
  7597. @item b
  7598. Use bottom field only.
  7599. @item tf
  7600. Use both fields, top first.
  7601. @item bf
  7602. Use both fields, bottom first.
  7603. @end table
  7604. @item planes
  7605. Set which planes to process, by default filter process all frames.
  7606. @item nsize
  7607. Set size of local neighborhood around each pixel, used by the predictor neural
  7608. network.
  7609. Can be one of the following:
  7610. @table @samp
  7611. @item s8x6
  7612. @item s16x6
  7613. @item s32x6
  7614. @item s48x6
  7615. @item s8x4
  7616. @item s16x4
  7617. @item s32x4
  7618. @end table
  7619. @item nns
  7620. Set the number of neurons in predicctor neural network.
  7621. Can be one of the following:
  7622. @table @samp
  7623. @item n16
  7624. @item n32
  7625. @item n64
  7626. @item n128
  7627. @item n256
  7628. @end table
  7629. @item qual
  7630. Controls the number of different neural network predictions that are blended
  7631. together to compute the final output value. Can be @code{fast}, default or
  7632. @code{slow}.
  7633. @item etype
  7634. Set which set of weights to use in the predictor.
  7635. Can be one of the following:
  7636. @table @samp
  7637. @item a
  7638. weights trained to minimize absolute error
  7639. @item s
  7640. weights trained to minimize squared error
  7641. @end table
  7642. @item pscrn
  7643. Controls whether or not the prescreener neural network is used to decide
  7644. which pixels should be processed by the predictor neural network and which
  7645. can be handled by simple cubic interpolation.
  7646. The prescreener is trained to know whether cubic interpolation will be
  7647. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7648. The computational complexity of the prescreener nn is much less than that of
  7649. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7650. using the prescreener generally results in much faster processing.
  7651. The prescreener is pretty accurate, so the difference between using it and not
  7652. using it is almost always unnoticeable.
  7653. Can be one of the following:
  7654. @table @samp
  7655. @item none
  7656. @item original
  7657. @item new
  7658. @end table
  7659. Default is @code{new}.
  7660. @item fapprox
  7661. Set various debugging flags.
  7662. @end table
  7663. @section noformat
  7664. Force libavfilter not to use any of the specified pixel formats for the
  7665. input to the next filter.
  7666. It accepts the following parameters:
  7667. @table @option
  7668. @item pix_fmts
  7669. A '|'-separated list of pixel format names, such as
  7670. apix_fmts=yuv420p|monow|rgb24".
  7671. @end table
  7672. @subsection Examples
  7673. @itemize
  7674. @item
  7675. Force libavfilter to use a format different from @var{yuv420p} for the
  7676. input to the vflip filter:
  7677. @example
  7678. noformat=pix_fmts=yuv420p,vflip
  7679. @end example
  7680. @item
  7681. Convert the input video to any of the formats not contained in the list:
  7682. @example
  7683. noformat=yuv420p|yuv444p|yuv410p
  7684. @end example
  7685. @end itemize
  7686. @section noise
  7687. Add noise on video input frame.
  7688. The filter accepts the following options:
  7689. @table @option
  7690. @item all_seed
  7691. @item c0_seed
  7692. @item c1_seed
  7693. @item c2_seed
  7694. @item c3_seed
  7695. Set noise seed for specific pixel component or all pixel components in case
  7696. of @var{all_seed}. Default value is @code{123457}.
  7697. @item all_strength, alls
  7698. @item c0_strength, c0s
  7699. @item c1_strength, c1s
  7700. @item c2_strength, c2s
  7701. @item c3_strength, c3s
  7702. Set noise strength for specific pixel component or all pixel components in case
  7703. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7704. @item all_flags, allf
  7705. @item c0_flags, c0f
  7706. @item c1_flags, c1f
  7707. @item c2_flags, c2f
  7708. @item c3_flags, c3f
  7709. Set pixel component flags or set flags for all components if @var{all_flags}.
  7710. Available values for component flags are:
  7711. @table @samp
  7712. @item a
  7713. averaged temporal noise (smoother)
  7714. @item p
  7715. mix random noise with a (semi)regular pattern
  7716. @item t
  7717. temporal noise (noise pattern changes between frames)
  7718. @item u
  7719. uniform noise (gaussian otherwise)
  7720. @end table
  7721. @end table
  7722. @subsection Examples
  7723. Add temporal and uniform noise to input video:
  7724. @example
  7725. noise=alls=20:allf=t+u
  7726. @end example
  7727. @section null
  7728. Pass the video source unchanged to the output.
  7729. @section ocr
  7730. Optical Character Recognition
  7731. This filter uses Tesseract for optical character recognition.
  7732. It accepts the following options:
  7733. @table @option
  7734. @item datapath
  7735. Set datapath to tesseract data. Default is to use whatever was
  7736. set at installation.
  7737. @item language
  7738. Set language, default is "eng".
  7739. @item whitelist
  7740. Set character whitelist.
  7741. @item blacklist
  7742. Set character blacklist.
  7743. @end table
  7744. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7745. @section ocv
  7746. Apply a video transform using libopencv.
  7747. To enable this filter, install the libopencv library and headers and
  7748. configure FFmpeg with @code{--enable-libopencv}.
  7749. It accepts the following parameters:
  7750. @table @option
  7751. @item filter_name
  7752. The name of the libopencv filter to apply.
  7753. @item filter_params
  7754. The parameters to pass to the libopencv filter. If not specified, the default
  7755. values are assumed.
  7756. @end table
  7757. Refer to the official libopencv documentation for more precise
  7758. information:
  7759. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7760. Several libopencv filters are supported; see the following subsections.
  7761. @anchor{dilate}
  7762. @subsection dilate
  7763. Dilate an image by using a specific structuring element.
  7764. It corresponds to the libopencv function @code{cvDilate}.
  7765. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7766. @var{struct_el} represents a structuring element, and has the syntax:
  7767. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7768. @var{cols} and @var{rows} represent the number of columns and rows of
  7769. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7770. point, and @var{shape} the shape for the structuring element. @var{shape}
  7771. must be "rect", "cross", "ellipse", or "custom".
  7772. If the value for @var{shape} is "custom", it must be followed by a
  7773. string of the form "=@var{filename}". The file with name
  7774. @var{filename} is assumed to represent a binary image, with each
  7775. printable character corresponding to a bright pixel. When a custom
  7776. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7777. or columns and rows of the read file are assumed instead.
  7778. The default value for @var{struct_el} is "3x3+0x0/rect".
  7779. @var{nb_iterations} specifies the number of times the transform is
  7780. applied to the image, and defaults to 1.
  7781. Some examples:
  7782. @example
  7783. # Use the default values
  7784. ocv=dilate
  7785. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7786. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7787. # Read the shape from the file diamond.shape, iterating two times.
  7788. # The file diamond.shape may contain a pattern of characters like this
  7789. # *
  7790. # ***
  7791. # *****
  7792. # ***
  7793. # *
  7794. # The specified columns and rows are ignored
  7795. # but the anchor point coordinates are not
  7796. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7797. @end example
  7798. @subsection erode
  7799. Erode an image by using a specific structuring element.
  7800. It corresponds to the libopencv function @code{cvErode}.
  7801. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7802. with the same syntax and semantics as the @ref{dilate} filter.
  7803. @subsection smooth
  7804. Smooth the input video.
  7805. The filter takes the following parameters:
  7806. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7807. @var{type} is the type of smooth filter to apply, and must be one of
  7808. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7809. or "bilateral". The default value is "gaussian".
  7810. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7811. depend on the smooth type. @var{param1} and
  7812. @var{param2} accept integer positive values or 0. @var{param3} and
  7813. @var{param4} accept floating point values.
  7814. The default value for @var{param1} is 3. The default value for the
  7815. other parameters is 0.
  7816. These parameters correspond to the parameters assigned to the
  7817. libopencv function @code{cvSmooth}.
  7818. @anchor{overlay}
  7819. @section overlay
  7820. Overlay one video on top of another.
  7821. It takes two inputs and has one output. The first input is the "main"
  7822. video on which the second input is overlaid.
  7823. It accepts the following parameters:
  7824. A description of the accepted options follows.
  7825. @table @option
  7826. @item x
  7827. @item y
  7828. Set the expression for the x and y coordinates of the overlaid video
  7829. on the main video. Default value is "0" for both expressions. In case
  7830. the expression is invalid, it is set to a huge value (meaning that the
  7831. overlay will not be displayed within the output visible area).
  7832. @item eof_action
  7833. The action to take when EOF is encountered on the secondary input; it accepts
  7834. one of the following values:
  7835. @table @option
  7836. @item repeat
  7837. Repeat the last frame (the default).
  7838. @item endall
  7839. End both streams.
  7840. @item pass
  7841. Pass the main input through.
  7842. @end table
  7843. @item eval
  7844. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7845. It accepts the following values:
  7846. @table @samp
  7847. @item init
  7848. only evaluate expressions once during the filter initialization or
  7849. when a command is processed
  7850. @item frame
  7851. evaluate expressions for each incoming frame
  7852. @end table
  7853. Default value is @samp{frame}.
  7854. @item shortest
  7855. If set to 1, force the output to terminate when the shortest input
  7856. terminates. Default value is 0.
  7857. @item format
  7858. Set the format for the output video.
  7859. It accepts the following values:
  7860. @table @samp
  7861. @item yuv420
  7862. force YUV420 output
  7863. @item yuv422
  7864. force YUV422 output
  7865. @item yuv444
  7866. force YUV444 output
  7867. @item rgb
  7868. force packed RGB output
  7869. @item gbrp
  7870. force planar RGB output
  7871. @end table
  7872. Default value is @samp{yuv420}.
  7873. @item rgb @emph{(deprecated)}
  7874. If set to 1, force the filter to accept inputs in the RGB
  7875. color space. Default value is 0. This option is deprecated, use
  7876. @option{format} instead.
  7877. @item repeatlast
  7878. If set to 1, force the filter to draw the last overlay frame over the
  7879. main input until the end of the stream. A value of 0 disables this
  7880. behavior. Default value is 1.
  7881. @end table
  7882. The @option{x}, and @option{y} expressions can contain the following
  7883. parameters.
  7884. @table @option
  7885. @item main_w, W
  7886. @item main_h, H
  7887. The main input width and height.
  7888. @item overlay_w, w
  7889. @item overlay_h, h
  7890. The overlay input width and height.
  7891. @item x
  7892. @item y
  7893. The computed values for @var{x} and @var{y}. They are evaluated for
  7894. each new frame.
  7895. @item hsub
  7896. @item vsub
  7897. horizontal and vertical chroma subsample values of the output
  7898. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7899. @var{vsub} is 1.
  7900. @item n
  7901. the number of input frame, starting from 0
  7902. @item pos
  7903. the position in the file of the input frame, NAN if unknown
  7904. @item t
  7905. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7906. @end table
  7907. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7908. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7909. when @option{eval} is set to @samp{init}.
  7910. Be aware that frames are taken from each input video in timestamp
  7911. order, hence, if their initial timestamps differ, it is a good idea
  7912. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7913. have them begin in the same zero timestamp, as the example for
  7914. the @var{movie} filter does.
  7915. You can chain together more overlays but you should test the
  7916. efficiency of such approach.
  7917. @subsection Commands
  7918. This filter supports the following commands:
  7919. @table @option
  7920. @item x
  7921. @item y
  7922. Modify the x and y of the overlay input.
  7923. The command accepts the same syntax of the corresponding option.
  7924. If the specified expression is not valid, it is kept at its current
  7925. value.
  7926. @end table
  7927. @subsection Examples
  7928. @itemize
  7929. @item
  7930. Draw the overlay at 10 pixels from the bottom right corner of the main
  7931. video:
  7932. @example
  7933. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7934. @end example
  7935. Using named options the example above becomes:
  7936. @example
  7937. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7938. @end example
  7939. @item
  7940. Insert a transparent PNG logo in the bottom left corner of the input,
  7941. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7942. @example
  7943. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7944. @end example
  7945. @item
  7946. Insert 2 different transparent PNG logos (second logo on bottom
  7947. right corner) using the @command{ffmpeg} tool:
  7948. @example
  7949. 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
  7950. @end example
  7951. @item
  7952. Add a transparent color layer on top of the main video; @code{WxH}
  7953. must specify the size of the main input to the overlay filter:
  7954. @example
  7955. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7956. @end example
  7957. @item
  7958. Play an original video and a filtered version (here with the deshake
  7959. filter) side by side using the @command{ffplay} tool:
  7960. @example
  7961. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7962. @end example
  7963. The above command is the same as:
  7964. @example
  7965. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7966. @end example
  7967. @item
  7968. Make a sliding overlay appearing from the left to the right top part of the
  7969. screen starting since time 2:
  7970. @example
  7971. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7972. @end example
  7973. @item
  7974. Compose output by putting two input videos side to side:
  7975. @example
  7976. ffmpeg -i left.avi -i right.avi -filter_complex "
  7977. nullsrc=size=200x100 [background];
  7978. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7979. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7980. [background][left] overlay=shortest=1 [background+left];
  7981. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7982. "
  7983. @end example
  7984. @item
  7985. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7986. @example
  7987. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7988. -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]'
  7989. masked.avi
  7990. @end example
  7991. @item
  7992. Chain several overlays in cascade:
  7993. @example
  7994. nullsrc=s=200x200 [bg];
  7995. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7996. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7997. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7998. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7999. [in3] null, [mid2] overlay=100:100 [out0]
  8000. @end example
  8001. @end itemize
  8002. @section owdenoise
  8003. Apply Overcomplete Wavelet denoiser.
  8004. The filter accepts the following options:
  8005. @table @option
  8006. @item depth
  8007. Set depth.
  8008. Larger depth values will denoise lower frequency components more, but
  8009. slow down filtering.
  8010. Must be an int in the range 8-16, default is @code{8}.
  8011. @item luma_strength, ls
  8012. Set luma strength.
  8013. Must be a double value in the range 0-1000, default is @code{1.0}.
  8014. @item chroma_strength, cs
  8015. Set chroma strength.
  8016. Must be a double value in the range 0-1000, default is @code{1.0}.
  8017. @end table
  8018. @anchor{pad}
  8019. @section pad
  8020. Add paddings to the input image, and place the original input at the
  8021. provided @var{x}, @var{y} coordinates.
  8022. It accepts the following parameters:
  8023. @table @option
  8024. @item width, w
  8025. @item height, h
  8026. Specify an expression for the size of the output image with the
  8027. paddings added. If the value for @var{width} or @var{height} is 0, the
  8028. corresponding input size is used for the output.
  8029. The @var{width} expression can reference the value set by the
  8030. @var{height} expression, and vice versa.
  8031. The default value of @var{width} and @var{height} is 0.
  8032. @item x
  8033. @item y
  8034. Specify the offsets to place the input image at within the padded area,
  8035. with respect to the top/left border of the output image.
  8036. The @var{x} expression can reference the value set by the @var{y}
  8037. expression, and vice versa.
  8038. The default value of @var{x} and @var{y} is 0.
  8039. @item color
  8040. Specify the color of the padded area. For the syntax of this option,
  8041. check the "Color" section in the ffmpeg-utils manual.
  8042. The default value of @var{color} is "black".
  8043. @item eval
  8044. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8045. It accepts the following values:
  8046. @table @samp
  8047. @item init
  8048. Only evaluate expressions once during the filter initialization or when
  8049. a command is processed.
  8050. @item frame
  8051. Evaluate expressions for each incoming frame.
  8052. @end table
  8053. Default value is @samp{init}.
  8054. @end table
  8055. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8056. options are expressions containing the following constants:
  8057. @table @option
  8058. @item in_w
  8059. @item in_h
  8060. The input video width and height.
  8061. @item iw
  8062. @item ih
  8063. These are the same as @var{in_w} and @var{in_h}.
  8064. @item out_w
  8065. @item out_h
  8066. The output width and height (the size of the padded area), as
  8067. specified by the @var{width} and @var{height} expressions.
  8068. @item ow
  8069. @item oh
  8070. These are the same as @var{out_w} and @var{out_h}.
  8071. @item x
  8072. @item y
  8073. The x and y offsets as specified by the @var{x} and @var{y}
  8074. expressions, or NAN if not yet specified.
  8075. @item a
  8076. same as @var{iw} / @var{ih}
  8077. @item sar
  8078. input sample aspect ratio
  8079. @item dar
  8080. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8081. @item hsub
  8082. @item vsub
  8083. The horizontal and vertical chroma subsample values. For example for the
  8084. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8085. @end table
  8086. @subsection Examples
  8087. @itemize
  8088. @item
  8089. Add paddings with the color "violet" to the input video. The output video
  8090. size is 640x480, and the top-left corner of the input video is placed at
  8091. column 0, row 40
  8092. @example
  8093. pad=640:480:0:40:violet
  8094. @end example
  8095. The example above is equivalent to the following command:
  8096. @example
  8097. pad=width=640:height=480:x=0:y=40:color=violet
  8098. @end example
  8099. @item
  8100. Pad the input to get an output with dimensions increased by 3/2,
  8101. and put the input video at the center of the padded area:
  8102. @example
  8103. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8104. @end example
  8105. @item
  8106. Pad the input to get a squared output with size equal to the maximum
  8107. value between the input width and height, and put the input video at
  8108. the center of the padded area:
  8109. @example
  8110. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8111. @end example
  8112. @item
  8113. Pad the input to get a final w/h ratio of 16:9:
  8114. @example
  8115. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8116. @end example
  8117. @item
  8118. In case of anamorphic video, in order to set the output display aspect
  8119. correctly, it is necessary to use @var{sar} in the expression,
  8120. according to the relation:
  8121. @example
  8122. (ih * X / ih) * sar = output_dar
  8123. X = output_dar / sar
  8124. @end example
  8125. Thus the previous example needs to be modified to:
  8126. @example
  8127. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8128. @end example
  8129. @item
  8130. Double the output size and put the input video in the bottom-right
  8131. corner of the output padded area:
  8132. @example
  8133. pad="2*iw:2*ih:ow-iw:oh-ih"
  8134. @end example
  8135. @end itemize
  8136. @anchor{palettegen}
  8137. @section palettegen
  8138. Generate one palette for a whole video stream.
  8139. It accepts the following options:
  8140. @table @option
  8141. @item max_colors
  8142. Set the maximum number of colors to quantize in the palette.
  8143. Note: the palette will still contain 256 colors; the unused palette entries
  8144. will be black.
  8145. @item reserve_transparent
  8146. Create a palette of 255 colors maximum and reserve the last one for
  8147. transparency. Reserving the transparency color is useful for GIF optimization.
  8148. If not set, the maximum of colors in the palette will be 256. You probably want
  8149. to disable this option for a standalone image.
  8150. Set by default.
  8151. @item stats_mode
  8152. Set statistics mode.
  8153. It accepts the following values:
  8154. @table @samp
  8155. @item full
  8156. Compute full frame histograms.
  8157. @item diff
  8158. Compute histograms only for the part that differs from previous frame. This
  8159. might be relevant to give more importance to the moving part of your input if
  8160. the background is static.
  8161. @item single
  8162. Compute new histogram for each frame.
  8163. @end table
  8164. Default value is @var{full}.
  8165. @end table
  8166. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8167. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8168. color quantization of the palette. This information is also visible at
  8169. @var{info} logging level.
  8170. @subsection Examples
  8171. @itemize
  8172. @item
  8173. Generate a representative palette of a given video using @command{ffmpeg}:
  8174. @example
  8175. ffmpeg -i input.mkv -vf palettegen palette.png
  8176. @end example
  8177. @end itemize
  8178. @section paletteuse
  8179. Use a palette to downsample an input video stream.
  8180. The filter takes two inputs: one video stream and a palette. The palette must
  8181. be a 256 pixels image.
  8182. It accepts the following options:
  8183. @table @option
  8184. @item dither
  8185. Select dithering mode. Available algorithms are:
  8186. @table @samp
  8187. @item bayer
  8188. Ordered 8x8 bayer dithering (deterministic)
  8189. @item heckbert
  8190. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8191. Note: this dithering is sometimes considered "wrong" and is included as a
  8192. reference.
  8193. @item floyd_steinberg
  8194. Floyd and Steingberg dithering (error diffusion)
  8195. @item sierra2
  8196. Frankie Sierra dithering v2 (error diffusion)
  8197. @item sierra2_4a
  8198. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8199. @end table
  8200. Default is @var{sierra2_4a}.
  8201. @item bayer_scale
  8202. When @var{bayer} dithering is selected, this option defines the scale of the
  8203. pattern (how much the crosshatch pattern is visible). A low value means more
  8204. visible pattern for less banding, and higher value means less visible pattern
  8205. at the cost of more banding.
  8206. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8207. @item diff_mode
  8208. If set, define the zone to process
  8209. @table @samp
  8210. @item rectangle
  8211. Only the changing rectangle will be reprocessed. This is similar to GIF
  8212. cropping/offsetting compression mechanism. This option can be useful for speed
  8213. if only a part of the image is changing, and has use cases such as limiting the
  8214. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8215. moving scene (it leads to more deterministic output if the scene doesn't change
  8216. much, and as a result less moving noise and better GIF compression).
  8217. @end table
  8218. Default is @var{none}.
  8219. @item new
  8220. Take new palette for each output frame.
  8221. @end table
  8222. @subsection Examples
  8223. @itemize
  8224. @item
  8225. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8226. using @command{ffmpeg}:
  8227. @example
  8228. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8229. @end example
  8230. @end itemize
  8231. @section perspective
  8232. Correct perspective of video not recorded perpendicular to the screen.
  8233. A description of the accepted parameters follows.
  8234. @table @option
  8235. @item x0
  8236. @item y0
  8237. @item x1
  8238. @item y1
  8239. @item x2
  8240. @item y2
  8241. @item x3
  8242. @item y3
  8243. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8244. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8245. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8246. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8247. then the corners of the source will be sent to the specified coordinates.
  8248. The expressions can use the following variables:
  8249. @table @option
  8250. @item W
  8251. @item H
  8252. the width and height of video frame.
  8253. @item in
  8254. Input frame count.
  8255. @item on
  8256. Output frame count.
  8257. @end table
  8258. @item interpolation
  8259. Set interpolation for perspective correction.
  8260. It accepts the following values:
  8261. @table @samp
  8262. @item linear
  8263. @item cubic
  8264. @end table
  8265. Default value is @samp{linear}.
  8266. @item sense
  8267. Set interpretation of coordinate options.
  8268. It accepts the following values:
  8269. @table @samp
  8270. @item 0, source
  8271. Send point in the source specified by the given coordinates to
  8272. the corners of the destination.
  8273. @item 1, destination
  8274. Send the corners of the source to the point in the destination specified
  8275. by the given coordinates.
  8276. Default value is @samp{source}.
  8277. @end table
  8278. @item eval
  8279. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8280. It accepts the following values:
  8281. @table @samp
  8282. @item init
  8283. only evaluate expressions once during the filter initialization or
  8284. when a command is processed
  8285. @item frame
  8286. evaluate expressions for each incoming frame
  8287. @end table
  8288. Default value is @samp{init}.
  8289. @end table
  8290. @section phase
  8291. Delay interlaced video by one field time so that the field order changes.
  8292. The intended use is to fix PAL movies that have been captured with the
  8293. opposite field order to the film-to-video transfer.
  8294. A description of the accepted parameters follows.
  8295. @table @option
  8296. @item mode
  8297. Set phase mode.
  8298. It accepts the following values:
  8299. @table @samp
  8300. @item t
  8301. Capture field order top-first, transfer bottom-first.
  8302. Filter will delay the bottom field.
  8303. @item b
  8304. Capture field order bottom-first, transfer top-first.
  8305. Filter will delay the top field.
  8306. @item p
  8307. Capture and transfer with the same field order. This mode only exists
  8308. for the documentation of the other options to refer to, but if you
  8309. actually select it, the filter will faithfully do nothing.
  8310. @item a
  8311. Capture field order determined automatically by field flags, transfer
  8312. opposite.
  8313. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8314. basis using field flags. If no field information is available,
  8315. then this works just like @samp{u}.
  8316. @item u
  8317. Capture unknown or varying, transfer opposite.
  8318. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8319. analyzing the images and selecting the alternative that produces best
  8320. match between the fields.
  8321. @item T
  8322. Capture top-first, transfer unknown or varying.
  8323. Filter selects among @samp{t} and @samp{p} using image analysis.
  8324. @item B
  8325. Capture bottom-first, transfer unknown or varying.
  8326. Filter selects among @samp{b} and @samp{p} using image analysis.
  8327. @item A
  8328. Capture determined by field flags, transfer unknown or varying.
  8329. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8330. image analysis. If no field information is available, then this works just
  8331. like @samp{U}. This is the default mode.
  8332. @item U
  8333. Both capture and transfer unknown or varying.
  8334. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8335. @end table
  8336. @end table
  8337. @section pixdesctest
  8338. Pixel format descriptor test filter, mainly useful for internal
  8339. testing. The output video should be equal to the input video.
  8340. For example:
  8341. @example
  8342. format=monow, pixdesctest
  8343. @end example
  8344. can be used to test the monowhite pixel format descriptor definition.
  8345. @section pp
  8346. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8347. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8348. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8349. Each subfilter and some options have a short and a long name that can be used
  8350. interchangeably, i.e. dr/dering are the same.
  8351. The filters accept the following options:
  8352. @table @option
  8353. @item subfilters
  8354. Set postprocessing subfilters string.
  8355. @end table
  8356. All subfilters share common options to determine their scope:
  8357. @table @option
  8358. @item a/autoq
  8359. Honor the quality commands for this subfilter.
  8360. @item c/chrom
  8361. Do chrominance filtering, too (default).
  8362. @item y/nochrom
  8363. Do luminance filtering only (no chrominance).
  8364. @item n/noluma
  8365. Do chrominance filtering only (no luminance).
  8366. @end table
  8367. These options can be appended after the subfilter name, separated by a '|'.
  8368. Available subfilters are:
  8369. @table @option
  8370. @item hb/hdeblock[|difference[|flatness]]
  8371. Horizontal deblocking filter
  8372. @table @option
  8373. @item difference
  8374. Difference factor where higher values mean more deblocking (default: @code{32}).
  8375. @item flatness
  8376. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8377. @end table
  8378. @item vb/vdeblock[|difference[|flatness]]
  8379. Vertical deblocking filter
  8380. @table @option
  8381. @item difference
  8382. Difference factor where higher values mean more deblocking (default: @code{32}).
  8383. @item flatness
  8384. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8385. @end table
  8386. @item ha/hadeblock[|difference[|flatness]]
  8387. Accurate horizontal deblocking filter
  8388. @table @option
  8389. @item difference
  8390. Difference factor where higher values mean more deblocking (default: @code{32}).
  8391. @item flatness
  8392. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8393. @end table
  8394. @item va/vadeblock[|difference[|flatness]]
  8395. Accurate vertical deblocking filter
  8396. @table @option
  8397. @item difference
  8398. Difference factor where higher values mean more deblocking (default: @code{32}).
  8399. @item flatness
  8400. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8401. @end table
  8402. @end table
  8403. The horizontal and vertical deblocking filters share the difference and
  8404. flatness values so you cannot set different horizontal and vertical
  8405. thresholds.
  8406. @table @option
  8407. @item h1/x1hdeblock
  8408. Experimental horizontal deblocking filter
  8409. @item v1/x1vdeblock
  8410. Experimental vertical deblocking filter
  8411. @item dr/dering
  8412. Deringing filter
  8413. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8414. @table @option
  8415. @item threshold1
  8416. larger -> stronger filtering
  8417. @item threshold2
  8418. larger -> stronger filtering
  8419. @item threshold3
  8420. larger -> stronger filtering
  8421. @end table
  8422. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8423. @table @option
  8424. @item f/fullyrange
  8425. Stretch luminance to @code{0-255}.
  8426. @end table
  8427. @item lb/linblenddeint
  8428. Linear blend deinterlacing filter that deinterlaces the given block by
  8429. filtering all lines with a @code{(1 2 1)} filter.
  8430. @item li/linipoldeint
  8431. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8432. linearly interpolating every second line.
  8433. @item ci/cubicipoldeint
  8434. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8435. cubically interpolating every second line.
  8436. @item md/mediandeint
  8437. Median deinterlacing filter that deinterlaces the given block by applying a
  8438. median filter to every second line.
  8439. @item fd/ffmpegdeint
  8440. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8441. second line with a @code{(-1 4 2 4 -1)} filter.
  8442. @item l5/lowpass5
  8443. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8444. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8445. @item fq/forceQuant[|quantizer]
  8446. Overrides the quantizer table from the input with the constant quantizer you
  8447. specify.
  8448. @table @option
  8449. @item quantizer
  8450. Quantizer to use
  8451. @end table
  8452. @item de/default
  8453. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8454. @item fa/fast
  8455. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8456. @item ac
  8457. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8458. @end table
  8459. @subsection Examples
  8460. @itemize
  8461. @item
  8462. Apply horizontal and vertical deblocking, deringing and automatic
  8463. brightness/contrast:
  8464. @example
  8465. pp=hb/vb/dr/al
  8466. @end example
  8467. @item
  8468. Apply default filters without brightness/contrast correction:
  8469. @example
  8470. pp=de/-al
  8471. @end example
  8472. @item
  8473. Apply default filters and temporal denoiser:
  8474. @example
  8475. pp=default/tmpnoise|1|2|3
  8476. @end example
  8477. @item
  8478. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8479. automatically depending on available CPU time:
  8480. @example
  8481. pp=hb|y/vb|a
  8482. @end example
  8483. @end itemize
  8484. @section pp7
  8485. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8486. similar to spp = 6 with 7 point DCT, where only the center sample is
  8487. used after IDCT.
  8488. The filter accepts the following options:
  8489. @table @option
  8490. @item qp
  8491. Force a constant quantization parameter. It accepts an integer in range
  8492. 0 to 63. If not set, the filter will use the QP from the video stream
  8493. (if available).
  8494. @item mode
  8495. Set thresholding mode. Available modes are:
  8496. @table @samp
  8497. @item hard
  8498. Set hard thresholding.
  8499. @item soft
  8500. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8501. @item medium
  8502. Set medium thresholding (good results, default).
  8503. @end table
  8504. @end table
  8505. @section premultiply
  8506. Apply alpha premultiply effect to input video stream using first plane
  8507. of second stream as alpha.
  8508. Both streams must have same dimensions and same pixel format.
  8509. @section prewitt
  8510. Apply prewitt operator to input video stream.
  8511. The filter accepts the following option:
  8512. @table @option
  8513. @item planes
  8514. Set which planes will be processed, unprocessed planes will be copied.
  8515. By default value 0xf, all planes will be processed.
  8516. @item scale
  8517. Set value which will be multiplied with filtered result.
  8518. @item delta
  8519. Set value which will be added to filtered result.
  8520. @end table
  8521. @section psnr
  8522. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8523. Ratio) between two input videos.
  8524. This filter takes in input two input videos, the first input is
  8525. considered the "main" source and is passed unchanged to the
  8526. output. The second input is used as a "reference" video for computing
  8527. the PSNR.
  8528. Both video inputs must have the same resolution and pixel format for
  8529. this filter to work correctly. Also it assumes that both inputs
  8530. have the same number of frames, which are compared one by one.
  8531. The obtained average PSNR is printed through the logging system.
  8532. The filter stores the accumulated MSE (mean squared error) of each
  8533. frame, and at the end of the processing it is averaged across all frames
  8534. equally, and the following formula is applied to obtain the PSNR:
  8535. @example
  8536. PSNR = 10*log10(MAX^2/MSE)
  8537. @end example
  8538. Where MAX is the average of the maximum values of each component of the
  8539. image.
  8540. The description of the accepted parameters follows.
  8541. @table @option
  8542. @item stats_file, f
  8543. If specified the filter will use the named file to save the PSNR of
  8544. each individual frame. When filename equals "-" the data is sent to
  8545. standard output.
  8546. @item stats_version
  8547. Specifies which version of the stats file format to use. Details of
  8548. each format are written below.
  8549. Default value is 1.
  8550. @item stats_add_max
  8551. Determines whether the max value is output to the stats log.
  8552. Default value is 0.
  8553. Requires stats_version >= 2. If this is set and stats_version < 2,
  8554. the filter will return an error.
  8555. @end table
  8556. The file printed if @var{stats_file} is selected, contains a sequence of
  8557. key/value pairs of the form @var{key}:@var{value} for each compared
  8558. couple of frames.
  8559. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8560. the list of per-frame-pair stats, with key value pairs following the frame
  8561. format with the following parameters:
  8562. @table @option
  8563. @item psnr_log_version
  8564. The version of the log file format. Will match @var{stats_version}.
  8565. @item fields
  8566. A comma separated list of the per-frame-pair parameters included in
  8567. the log.
  8568. @end table
  8569. A description of each shown per-frame-pair parameter follows:
  8570. @table @option
  8571. @item n
  8572. sequential number of the input frame, starting from 1
  8573. @item mse_avg
  8574. Mean Square Error pixel-by-pixel average difference of the compared
  8575. frames, averaged over all the image components.
  8576. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8577. Mean Square Error pixel-by-pixel average difference of the compared
  8578. frames for the component specified by the suffix.
  8579. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8580. Peak Signal to Noise ratio of the compared frames for the component
  8581. specified by the suffix.
  8582. @item max_avg, max_y, max_u, max_v
  8583. Maximum allowed value for each channel, and average over all
  8584. channels.
  8585. @end table
  8586. For example:
  8587. @example
  8588. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8589. [main][ref] psnr="stats_file=stats.log" [out]
  8590. @end example
  8591. On this example the input file being processed is compared with the
  8592. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8593. is stored in @file{stats.log}.
  8594. @anchor{pullup}
  8595. @section pullup
  8596. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8597. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8598. content.
  8599. The pullup filter is designed to take advantage of future context in making
  8600. its decisions. This filter is stateless in the sense that it does not lock
  8601. onto a pattern to follow, but it instead looks forward to the following
  8602. fields in order to identify matches and rebuild progressive frames.
  8603. To produce content with an even framerate, insert the fps filter after
  8604. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8605. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8606. The filter accepts the following options:
  8607. @table @option
  8608. @item jl
  8609. @item jr
  8610. @item jt
  8611. @item jb
  8612. These options set the amount of "junk" to ignore at the left, right, top, and
  8613. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8614. while top and bottom are in units of 2 lines.
  8615. The default is 8 pixels on each side.
  8616. @item sb
  8617. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8618. filter generating an occasional mismatched frame, but it may also cause an
  8619. excessive number of frames to be dropped during high motion sequences.
  8620. Conversely, setting it to -1 will make filter match fields more easily.
  8621. This may help processing of video where there is slight blurring between
  8622. the fields, but may also cause there to be interlaced frames in the output.
  8623. Default value is @code{0}.
  8624. @item mp
  8625. Set the metric plane to use. It accepts the following values:
  8626. @table @samp
  8627. @item l
  8628. Use luma plane.
  8629. @item u
  8630. Use chroma blue plane.
  8631. @item v
  8632. Use chroma red plane.
  8633. @end table
  8634. This option may be set to use chroma plane instead of the default luma plane
  8635. for doing filter's computations. This may improve accuracy on very clean
  8636. source material, but more likely will decrease accuracy, especially if there
  8637. is chroma noise (rainbow effect) or any grayscale video.
  8638. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8639. load and make pullup usable in realtime on slow machines.
  8640. @end table
  8641. For best results (without duplicated frames in the output file) it is
  8642. necessary to change the output frame rate. For example, to inverse
  8643. telecine NTSC input:
  8644. @example
  8645. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8646. @end example
  8647. @section qp
  8648. Change video quantization parameters (QP).
  8649. The filter accepts the following option:
  8650. @table @option
  8651. @item qp
  8652. Set expression for quantization parameter.
  8653. @end table
  8654. The expression is evaluated through the eval API and can contain, among others,
  8655. the following constants:
  8656. @table @var
  8657. @item known
  8658. 1 if index is not 129, 0 otherwise.
  8659. @item qp
  8660. Sequentional index starting from -129 to 128.
  8661. @end table
  8662. @subsection Examples
  8663. @itemize
  8664. @item
  8665. Some equation like:
  8666. @example
  8667. qp=2+2*sin(PI*qp)
  8668. @end example
  8669. @end itemize
  8670. @section random
  8671. Flush video frames from internal cache of frames into a random order.
  8672. No frame is discarded.
  8673. Inspired by @ref{frei0r} nervous filter.
  8674. @table @option
  8675. @item frames
  8676. Set size in number of frames of internal cache, in range from @code{2} to
  8677. @code{512}. Default is @code{30}.
  8678. @item seed
  8679. Set seed for random number generator, must be an integer included between
  8680. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8681. less than @code{0}, the filter will try to use a good random seed on a
  8682. best effort basis.
  8683. @end table
  8684. @section readeia608
  8685. Read closed captioning (EIA-608) information from the top lines of a video frame.
  8686. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  8687. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  8688. with EIA-608 data (starting from 0). A description of each metadata value follows:
  8689. @table @option
  8690. @item lavfi.readeia608.X.cc
  8691. The two bytes stored as EIA-608 data (printed in hexadecimal).
  8692. @item lavfi.readeia608.X.line
  8693. The number of the line on which the EIA-608 data was identified and read.
  8694. @end table
  8695. This filter accepts the following options:
  8696. @table @option
  8697. @item scan_min
  8698. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  8699. @item scan_max
  8700. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  8701. @item mac
  8702. Set minimal acceptable amplitude change for sync codes detection.
  8703. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  8704. @item spw
  8705. Set the ratio of width reserved for sync code detection.
  8706. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  8707. @item mhd
  8708. Set the max peaks height difference for sync code detection.
  8709. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8710. @item mpd
  8711. Set max peaks period difference for sync code detection.
  8712. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8713. @item msd
  8714. Set the first two max start code bits differences.
  8715. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  8716. @item bhd
  8717. Set the minimum ratio of bits height compared to 3rd start code bit.
  8718. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  8719. @item th_w
  8720. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  8721. @item th_b
  8722. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  8723. @item chp
  8724. Enable checking the parity bit. In the event of a parity error, the filter will output
  8725. @code{0x00} for that character. Default is false.
  8726. @end table
  8727. @subsection Examples
  8728. @itemize
  8729. @item
  8730. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  8731. @example
  8732. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  8733. @end example
  8734. @end itemize
  8735. @section readvitc
  8736. Read vertical interval timecode (VITC) information from the top lines of a
  8737. video frame.
  8738. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8739. timecode value, if a valid timecode has been detected. Further metadata key
  8740. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8741. timecode data has been found or not.
  8742. This filter accepts the following options:
  8743. @table @option
  8744. @item scan_max
  8745. Set the maximum number of lines to scan for VITC data. If the value is set to
  8746. @code{-1} the full video frame is scanned. Default is @code{45}.
  8747. @item thr_b
  8748. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8749. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8750. @item thr_w
  8751. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8752. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8753. @end table
  8754. @subsection Examples
  8755. @itemize
  8756. @item
  8757. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8758. draw @code{--:--:--:--} as a placeholder:
  8759. @example
  8760. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8761. @end example
  8762. @end itemize
  8763. @section remap
  8764. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8765. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8766. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8767. value for pixel will be used for destination pixel.
  8768. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8769. will have Xmap/Ymap video stream dimensions.
  8770. Xmap and Ymap input video streams are 16bit depth, single channel.
  8771. @section removegrain
  8772. The removegrain filter is a spatial denoiser for progressive video.
  8773. @table @option
  8774. @item m0
  8775. Set mode for the first plane.
  8776. @item m1
  8777. Set mode for the second plane.
  8778. @item m2
  8779. Set mode for the third plane.
  8780. @item m3
  8781. Set mode for the fourth plane.
  8782. @end table
  8783. Range of mode is from 0 to 24. Description of each mode follows:
  8784. @table @var
  8785. @item 0
  8786. Leave input plane unchanged. Default.
  8787. @item 1
  8788. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8789. @item 2
  8790. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8791. @item 3
  8792. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8793. @item 4
  8794. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8795. This is equivalent to a median filter.
  8796. @item 5
  8797. Line-sensitive clipping giving the minimal change.
  8798. @item 6
  8799. Line-sensitive clipping, intermediate.
  8800. @item 7
  8801. Line-sensitive clipping, intermediate.
  8802. @item 8
  8803. Line-sensitive clipping, intermediate.
  8804. @item 9
  8805. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8806. @item 10
  8807. Replaces the target pixel with the closest neighbour.
  8808. @item 11
  8809. [1 2 1] horizontal and vertical kernel blur.
  8810. @item 12
  8811. Same as mode 11.
  8812. @item 13
  8813. Bob mode, interpolates top field from the line where the neighbours
  8814. pixels are the closest.
  8815. @item 14
  8816. Bob mode, interpolates bottom field from the line where the neighbours
  8817. pixels are the closest.
  8818. @item 15
  8819. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8820. interpolation formula.
  8821. @item 16
  8822. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8823. interpolation formula.
  8824. @item 17
  8825. Clips the pixel with the minimum and maximum of respectively the maximum and
  8826. minimum of each pair of opposite neighbour pixels.
  8827. @item 18
  8828. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8829. the current pixel is minimal.
  8830. @item 19
  8831. Replaces the pixel with the average of its 8 neighbours.
  8832. @item 20
  8833. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8834. @item 21
  8835. Clips pixels using the averages of opposite neighbour.
  8836. @item 22
  8837. Same as mode 21 but simpler and faster.
  8838. @item 23
  8839. Small edge and halo removal, but reputed useless.
  8840. @item 24
  8841. Similar as 23.
  8842. @end table
  8843. @section removelogo
  8844. Suppress a TV station logo, using an image file to determine which
  8845. pixels comprise the logo. It works by filling in the pixels that
  8846. comprise the logo with neighboring pixels.
  8847. The filter accepts the following options:
  8848. @table @option
  8849. @item filename, f
  8850. Set the filter bitmap file, which can be any image format supported by
  8851. libavformat. The width and height of the image file must match those of the
  8852. video stream being processed.
  8853. @end table
  8854. Pixels in the provided bitmap image with a value of zero are not
  8855. considered part of the logo, non-zero pixels are considered part of
  8856. the logo. If you use white (255) for the logo and black (0) for the
  8857. rest, you will be safe. For making the filter bitmap, it is
  8858. recommended to take a screen capture of a black frame with the logo
  8859. visible, and then using a threshold filter followed by the erode
  8860. filter once or twice.
  8861. If needed, little splotches can be fixed manually. Remember that if
  8862. logo pixels are not covered, the filter quality will be much
  8863. reduced. Marking too many pixels as part of the logo does not hurt as
  8864. much, but it will increase the amount of blurring needed to cover over
  8865. the image and will destroy more information than necessary, and extra
  8866. pixels will slow things down on a large logo.
  8867. @section repeatfields
  8868. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8869. fields based on its value.
  8870. @section reverse
  8871. Reverse a video clip.
  8872. Warning: This filter requires memory to buffer the entire clip, so trimming
  8873. is suggested.
  8874. @subsection Examples
  8875. @itemize
  8876. @item
  8877. Take the first 5 seconds of a clip, and reverse it.
  8878. @example
  8879. trim=end=5,reverse
  8880. @end example
  8881. @end itemize
  8882. @section rotate
  8883. Rotate video by an arbitrary angle expressed in radians.
  8884. The filter accepts the following options:
  8885. A description of the optional parameters follows.
  8886. @table @option
  8887. @item angle, a
  8888. Set an expression for the angle by which to rotate the input video
  8889. clockwise, expressed as a number of radians. A negative value will
  8890. result in a counter-clockwise rotation. By default it is set to "0".
  8891. This expression is evaluated for each frame.
  8892. @item out_w, ow
  8893. Set the output width expression, default value is "iw".
  8894. This expression is evaluated just once during configuration.
  8895. @item out_h, oh
  8896. Set the output height expression, default value is "ih".
  8897. This expression is evaluated just once during configuration.
  8898. @item bilinear
  8899. Enable bilinear interpolation if set to 1, a value of 0 disables
  8900. it. Default value is 1.
  8901. @item fillcolor, c
  8902. Set the color used to fill the output area not covered by the rotated
  8903. image. For the general syntax of this option, check the "Color" section in the
  8904. ffmpeg-utils manual. If the special value "none" is selected then no
  8905. background is printed (useful for example if the background is never shown).
  8906. Default value is "black".
  8907. @end table
  8908. The expressions for the angle and the output size can contain the
  8909. following constants and functions:
  8910. @table @option
  8911. @item n
  8912. sequential number of the input frame, starting from 0. It is always NAN
  8913. before the first frame is filtered.
  8914. @item t
  8915. time in seconds of the input frame, it is set to 0 when the filter is
  8916. configured. It is always NAN before the first frame is filtered.
  8917. @item hsub
  8918. @item vsub
  8919. horizontal and vertical chroma subsample values. For example for the
  8920. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8921. @item in_w, iw
  8922. @item in_h, ih
  8923. the input video width and height
  8924. @item out_w, ow
  8925. @item out_h, oh
  8926. the output width and height, that is the size of the padded area as
  8927. specified by the @var{width} and @var{height} expressions
  8928. @item rotw(a)
  8929. @item roth(a)
  8930. the minimal width/height required for completely containing the input
  8931. video rotated by @var{a} radians.
  8932. These are only available when computing the @option{out_w} and
  8933. @option{out_h} expressions.
  8934. @end table
  8935. @subsection Examples
  8936. @itemize
  8937. @item
  8938. Rotate the input by PI/6 radians clockwise:
  8939. @example
  8940. rotate=PI/6
  8941. @end example
  8942. @item
  8943. Rotate the input by PI/6 radians counter-clockwise:
  8944. @example
  8945. rotate=-PI/6
  8946. @end example
  8947. @item
  8948. Rotate the input by 45 degrees clockwise:
  8949. @example
  8950. rotate=45*PI/180
  8951. @end example
  8952. @item
  8953. Apply a constant rotation with period T, starting from an angle of PI/3:
  8954. @example
  8955. rotate=PI/3+2*PI*t/T
  8956. @end example
  8957. @item
  8958. Make the input video rotation oscillating with a period of T
  8959. seconds and an amplitude of A radians:
  8960. @example
  8961. rotate=A*sin(2*PI/T*t)
  8962. @end example
  8963. @item
  8964. Rotate the video, output size is chosen so that the whole rotating
  8965. input video is always completely contained in the output:
  8966. @example
  8967. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8968. @end example
  8969. @item
  8970. Rotate the video, reduce the output size so that no background is ever
  8971. shown:
  8972. @example
  8973. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8974. @end example
  8975. @end itemize
  8976. @subsection Commands
  8977. The filter supports the following commands:
  8978. @table @option
  8979. @item a, angle
  8980. Set the angle expression.
  8981. The command accepts the same syntax of the corresponding option.
  8982. If the specified expression is not valid, it is kept at its current
  8983. value.
  8984. @end table
  8985. @section sab
  8986. Apply Shape Adaptive Blur.
  8987. The filter accepts the following options:
  8988. @table @option
  8989. @item luma_radius, lr
  8990. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8991. value is 1.0. A greater value will result in a more blurred image, and
  8992. in slower processing.
  8993. @item luma_pre_filter_radius, lpfr
  8994. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8995. value is 1.0.
  8996. @item luma_strength, ls
  8997. Set luma maximum difference between pixels to still be considered, must
  8998. be a value in the 0.1-100.0 range, default value is 1.0.
  8999. @item chroma_radius, cr
  9000. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9001. greater value will result in a more blurred image, and in slower
  9002. processing.
  9003. @item chroma_pre_filter_radius, cpfr
  9004. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9005. @item chroma_strength, cs
  9006. Set chroma maximum difference between pixels to still be considered,
  9007. must be a value in the -0.9-100.0 range.
  9008. @end table
  9009. Each chroma option value, if not explicitly specified, is set to the
  9010. corresponding luma option value.
  9011. @anchor{scale}
  9012. @section scale
  9013. Scale (resize) the input video, using the libswscale library.
  9014. The scale filter forces the output display aspect ratio to be the same
  9015. of the input, by changing the output sample aspect ratio.
  9016. If the input image format is different from the format requested by
  9017. the next filter, the scale filter will convert the input to the
  9018. requested format.
  9019. @subsection Options
  9020. The filter accepts the following options, or any of the options
  9021. supported by the libswscale scaler.
  9022. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9023. the complete list of scaler options.
  9024. @table @option
  9025. @item width, w
  9026. @item height, h
  9027. Set the output video dimension expression. Default value is the input
  9028. dimension.
  9029. If the value is 0, the input width is used for the output.
  9030. If one of the values is -1, the scale filter will use a value that
  9031. maintains the aspect ratio of the input image, calculated from the
  9032. other specified dimension. If both of them are -1, the input size is
  9033. used
  9034. If one of the values is -n with n > 1, the scale filter will also use a value
  9035. that maintains the aspect ratio of the input image, calculated from the other
  9036. specified dimension. After that it will, however, make sure that the calculated
  9037. dimension is divisible by n and adjust the value if necessary.
  9038. See below for the list of accepted constants for use in the dimension
  9039. expression.
  9040. @item eval
  9041. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9042. @table @samp
  9043. @item init
  9044. Only evaluate expressions once during the filter initialization or when a command is processed.
  9045. @item frame
  9046. Evaluate expressions for each incoming frame.
  9047. @end table
  9048. Default value is @samp{init}.
  9049. @item interl
  9050. Set the interlacing mode. It accepts the following values:
  9051. @table @samp
  9052. @item 1
  9053. Force interlaced aware scaling.
  9054. @item 0
  9055. Do not apply interlaced scaling.
  9056. @item -1
  9057. Select interlaced aware scaling depending on whether the source frames
  9058. are flagged as interlaced or not.
  9059. @end table
  9060. Default value is @samp{0}.
  9061. @item flags
  9062. Set libswscale scaling flags. See
  9063. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9064. complete list of values. If not explicitly specified the filter applies
  9065. the default flags.
  9066. @item param0, param1
  9067. Set libswscale input parameters for scaling algorithms that need them. See
  9068. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9069. complete documentation. If not explicitly specified the filter applies
  9070. empty parameters.
  9071. @item size, s
  9072. Set the video size. For the syntax of this option, check the
  9073. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9074. @item in_color_matrix
  9075. @item out_color_matrix
  9076. Set in/output YCbCr color space type.
  9077. This allows the autodetected value to be overridden as well as allows forcing
  9078. a specific value used for the output and encoder.
  9079. If not specified, the color space type depends on the pixel format.
  9080. Possible values:
  9081. @table @samp
  9082. @item auto
  9083. Choose automatically.
  9084. @item bt709
  9085. Format conforming to International Telecommunication Union (ITU)
  9086. Recommendation BT.709.
  9087. @item fcc
  9088. Set color space conforming to the United States Federal Communications
  9089. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9090. @item bt601
  9091. Set color space conforming to:
  9092. @itemize
  9093. @item
  9094. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9095. @item
  9096. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9097. @item
  9098. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9099. @end itemize
  9100. @item smpte240m
  9101. Set color space conforming to SMPTE ST 240:1999.
  9102. @end table
  9103. @item in_range
  9104. @item out_range
  9105. Set in/output YCbCr sample range.
  9106. This allows the autodetected value to be overridden as well as allows forcing
  9107. a specific value used for the output and encoder. If not specified, the
  9108. range depends on the pixel format. Possible values:
  9109. @table @samp
  9110. @item auto
  9111. Choose automatically.
  9112. @item jpeg/full/pc
  9113. Set full range (0-255 in case of 8-bit luma).
  9114. @item mpeg/tv
  9115. Set "MPEG" range (16-235 in case of 8-bit luma).
  9116. @end table
  9117. @item force_original_aspect_ratio
  9118. Enable decreasing or increasing output video width or height if necessary to
  9119. keep the original aspect ratio. Possible values:
  9120. @table @samp
  9121. @item disable
  9122. Scale the video as specified and disable this feature.
  9123. @item decrease
  9124. The output video dimensions will automatically be decreased if needed.
  9125. @item increase
  9126. The output video dimensions will automatically be increased if needed.
  9127. @end table
  9128. One useful instance of this option is that when you know a specific device's
  9129. maximum allowed resolution, you can use this to limit the output video to
  9130. that, while retaining the aspect ratio. For example, device A allows
  9131. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9132. decrease) and specifying 1280x720 to the command line makes the output
  9133. 1280x533.
  9134. Please note that this is a different thing than specifying -1 for @option{w}
  9135. or @option{h}, you still need to specify the output resolution for this option
  9136. to work.
  9137. @end table
  9138. The values of the @option{w} and @option{h} options are expressions
  9139. containing the following constants:
  9140. @table @var
  9141. @item in_w
  9142. @item in_h
  9143. The input width and height
  9144. @item iw
  9145. @item ih
  9146. These are the same as @var{in_w} and @var{in_h}.
  9147. @item out_w
  9148. @item out_h
  9149. The output (scaled) width and height
  9150. @item ow
  9151. @item oh
  9152. These are the same as @var{out_w} and @var{out_h}
  9153. @item a
  9154. The same as @var{iw} / @var{ih}
  9155. @item sar
  9156. input sample aspect ratio
  9157. @item dar
  9158. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9159. @item hsub
  9160. @item vsub
  9161. horizontal and vertical input chroma subsample values. For example for the
  9162. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9163. @item ohsub
  9164. @item ovsub
  9165. horizontal and vertical output chroma subsample values. For example for the
  9166. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9167. @end table
  9168. @subsection Examples
  9169. @itemize
  9170. @item
  9171. Scale the input video to a size of 200x100
  9172. @example
  9173. scale=w=200:h=100
  9174. @end example
  9175. This is equivalent to:
  9176. @example
  9177. scale=200:100
  9178. @end example
  9179. or:
  9180. @example
  9181. scale=200x100
  9182. @end example
  9183. @item
  9184. Specify a size abbreviation for the output size:
  9185. @example
  9186. scale=qcif
  9187. @end example
  9188. which can also be written as:
  9189. @example
  9190. scale=size=qcif
  9191. @end example
  9192. @item
  9193. Scale the input to 2x:
  9194. @example
  9195. scale=w=2*iw:h=2*ih
  9196. @end example
  9197. @item
  9198. The above is the same as:
  9199. @example
  9200. scale=2*in_w:2*in_h
  9201. @end example
  9202. @item
  9203. Scale the input to 2x with forced interlaced scaling:
  9204. @example
  9205. scale=2*iw:2*ih:interl=1
  9206. @end example
  9207. @item
  9208. Scale the input to half size:
  9209. @example
  9210. scale=w=iw/2:h=ih/2
  9211. @end example
  9212. @item
  9213. Increase the width, and set the height to the same size:
  9214. @example
  9215. scale=3/2*iw:ow
  9216. @end example
  9217. @item
  9218. Seek Greek harmony:
  9219. @example
  9220. scale=iw:1/PHI*iw
  9221. scale=ih*PHI:ih
  9222. @end example
  9223. @item
  9224. Increase the height, and set the width to 3/2 of the height:
  9225. @example
  9226. scale=w=3/2*oh:h=3/5*ih
  9227. @end example
  9228. @item
  9229. Increase the size, making the size a multiple of the chroma
  9230. subsample values:
  9231. @example
  9232. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9233. @end example
  9234. @item
  9235. Increase the width to a maximum of 500 pixels,
  9236. keeping the same aspect ratio as the input:
  9237. @example
  9238. scale=w='min(500\, iw*3/2):h=-1'
  9239. @end example
  9240. @end itemize
  9241. @subsection Commands
  9242. This filter supports the following commands:
  9243. @table @option
  9244. @item width, w
  9245. @item height, h
  9246. Set the output video dimension expression.
  9247. The command accepts the same syntax of the corresponding option.
  9248. If the specified expression is not valid, it is kept at its current
  9249. value.
  9250. @end table
  9251. @section scale_npp
  9252. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9253. format conversion on CUDA video frames. Setting the output width and height
  9254. works in the same way as for the @var{scale} filter.
  9255. The following additional options are accepted:
  9256. @table @option
  9257. @item format
  9258. The pixel format of the output CUDA frames. If set to the string "same" (the
  9259. default), the input format will be kept. Note that automatic format negotiation
  9260. and conversion is not yet supported for hardware frames
  9261. @item interp_algo
  9262. The interpolation algorithm used for resizing. One of the following:
  9263. @table @option
  9264. @item nn
  9265. Nearest neighbour.
  9266. @item linear
  9267. @item cubic
  9268. @item cubic2p_bspline
  9269. 2-parameter cubic (B=1, C=0)
  9270. @item cubic2p_catmullrom
  9271. 2-parameter cubic (B=0, C=1/2)
  9272. @item cubic2p_b05c03
  9273. 2-parameter cubic (B=1/2, C=3/10)
  9274. @item super
  9275. Supersampling
  9276. @item lanczos
  9277. @end table
  9278. @end table
  9279. @section scale2ref
  9280. Scale (resize) the input video, based on a reference video.
  9281. See the scale filter for available options, scale2ref supports the same but
  9282. uses the reference video instead of the main input as basis.
  9283. @subsection Examples
  9284. @itemize
  9285. @item
  9286. Scale a subtitle stream to match the main video in size before overlaying
  9287. @example
  9288. 'scale2ref[b][a];[a][b]overlay'
  9289. @end example
  9290. @end itemize
  9291. @anchor{selectivecolor}
  9292. @section selectivecolor
  9293. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9294. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9295. by the "purity" of the color (that is, how saturated it already is).
  9296. This filter is similar to the Adobe Photoshop Selective Color tool.
  9297. The filter accepts the following options:
  9298. @table @option
  9299. @item correction_method
  9300. Select color correction method.
  9301. Available values are:
  9302. @table @samp
  9303. @item absolute
  9304. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9305. component value).
  9306. @item relative
  9307. Specified adjustments are relative to the original component value.
  9308. @end table
  9309. Default is @code{absolute}.
  9310. @item reds
  9311. Adjustments for red pixels (pixels where the red component is the maximum)
  9312. @item yellows
  9313. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9314. @item greens
  9315. Adjustments for green pixels (pixels where the green component is the maximum)
  9316. @item cyans
  9317. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9318. @item blues
  9319. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9320. @item magentas
  9321. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9322. @item whites
  9323. Adjustments for white pixels (pixels where all components are greater than 128)
  9324. @item neutrals
  9325. Adjustments for all pixels except pure black and pure white
  9326. @item blacks
  9327. Adjustments for black pixels (pixels where all components are lesser than 128)
  9328. @item psfile
  9329. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9330. @end table
  9331. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9332. 4 space separated floating point adjustment values in the [-1,1] range,
  9333. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9334. pixels of its range.
  9335. @subsection Examples
  9336. @itemize
  9337. @item
  9338. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9339. increase magenta by 27% in blue areas:
  9340. @example
  9341. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9342. @end example
  9343. @item
  9344. Use a Photoshop selective color preset:
  9345. @example
  9346. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9347. @end example
  9348. @end itemize
  9349. @anchor{separatefields}
  9350. @section separatefields
  9351. The @code{separatefields} takes a frame-based video input and splits
  9352. each frame into its components fields, producing a new half height clip
  9353. with twice the frame rate and twice the frame count.
  9354. This filter use field-dominance information in frame to decide which
  9355. of each pair of fields to place first in the output.
  9356. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9357. @section setdar, setsar
  9358. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9359. output video.
  9360. This is done by changing the specified Sample (aka Pixel) Aspect
  9361. Ratio, according to the following equation:
  9362. @example
  9363. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9364. @end example
  9365. Keep in mind that the @code{setdar} filter does not modify the pixel
  9366. dimensions of the video frame. Also, the display aspect ratio set by
  9367. this filter may be changed by later filters in the filterchain,
  9368. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9369. applied.
  9370. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9371. the filter output video.
  9372. Note that as a consequence of the application of this filter, the
  9373. output display aspect ratio will change according to the equation
  9374. above.
  9375. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9376. filter may be changed by later filters in the filterchain, e.g. if
  9377. another "setsar" or a "setdar" filter is applied.
  9378. It accepts the following parameters:
  9379. @table @option
  9380. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9381. Set the aspect ratio used by the filter.
  9382. The parameter can be a floating point number string, an expression, or
  9383. a string of the form @var{num}:@var{den}, where @var{num} and
  9384. @var{den} are the numerator and denominator of the aspect ratio. If
  9385. the parameter is not specified, it is assumed the value "0".
  9386. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9387. should be escaped.
  9388. @item max
  9389. Set the maximum integer value to use for expressing numerator and
  9390. denominator when reducing the expressed aspect ratio to a rational.
  9391. Default value is @code{100}.
  9392. @end table
  9393. The parameter @var{sar} is an expression containing
  9394. the following constants:
  9395. @table @option
  9396. @item E, PI, PHI
  9397. These are approximated values for the mathematical constants e
  9398. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9399. @item w, h
  9400. The input width and height.
  9401. @item a
  9402. These are the same as @var{w} / @var{h}.
  9403. @item sar
  9404. The input sample aspect ratio.
  9405. @item dar
  9406. The input display aspect ratio. It is the same as
  9407. (@var{w} / @var{h}) * @var{sar}.
  9408. @item hsub, vsub
  9409. Horizontal and vertical chroma subsample values. For example, for the
  9410. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9411. @end table
  9412. @subsection Examples
  9413. @itemize
  9414. @item
  9415. To change the display aspect ratio to 16:9, specify one of the following:
  9416. @example
  9417. setdar=dar=1.77777
  9418. setdar=dar=16/9
  9419. @end example
  9420. @item
  9421. To change the sample aspect ratio to 10:11, specify:
  9422. @example
  9423. setsar=sar=10/11
  9424. @end example
  9425. @item
  9426. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9427. 1000 in the aspect ratio reduction, use the command:
  9428. @example
  9429. setdar=ratio=16/9:max=1000
  9430. @end example
  9431. @end itemize
  9432. @anchor{setfield}
  9433. @section setfield
  9434. Force field for the output video frame.
  9435. The @code{setfield} filter marks the interlace type field for the
  9436. output frames. It does not change the input frame, but only sets the
  9437. corresponding property, which affects how the frame is treated by
  9438. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9439. The filter accepts the following options:
  9440. @table @option
  9441. @item mode
  9442. Available values are:
  9443. @table @samp
  9444. @item auto
  9445. Keep the same field property.
  9446. @item bff
  9447. Mark the frame as bottom-field-first.
  9448. @item tff
  9449. Mark the frame as top-field-first.
  9450. @item prog
  9451. Mark the frame as progressive.
  9452. @end table
  9453. @end table
  9454. @section showinfo
  9455. Show a line containing various information for each input video frame.
  9456. The input video is not modified.
  9457. The shown line contains a sequence of key/value pairs of the form
  9458. @var{key}:@var{value}.
  9459. The following values are shown in the output:
  9460. @table @option
  9461. @item n
  9462. The (sequential) number of the input frame, starting from 0.
  9463. @item pts
  9464. The Presentation TimeStamp of the input frame, expressed as a number of
  9465. time base units. The time base unit depends on the filter input pad.
  9466. @item pts_time
  9467. The Presentation TimeStamp of the input frame, expressed as a number of
  9468. seconds.
  9469. @item pos
  9470. The position of the frame in the input stream, or -1 if this information is
  9471. unavailable and/or meaningless (for example in case of synthetic video).
  9472. @item fmt
  9473. The pixel format name.
  9474. @item sar
  9475. The sample aspect ratio of the input frame, expressed in the form
  9476. @var{num}/@var{den}.
  9477. @item s
  9478. The size of the input frame. For the syntax of this option, check the
  9479. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9480. @item i
  9481. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9482. for bottom field first).
  9483. @item iskey
  9484. This is 1 if the frame is a key frame, 0 otherwise.
  9485. @item type
  9486. The picture type of the input frame ("I" for an I-frame, "P" for a
  9487. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9488. Also refer to the documentation of the @code{AVPictureType} enum and of
  9489. the @code{av_get_picture_type_char} function defined in
  9490. @file{libavutil/avutil.h}.
  9491. @item checksum
  9492. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9493. @item plane_checksum
  9494. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9495. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9496. @end table
  9497. @section showpalette
  9498. Displays the 256 colors palette of each frame. This filter is only relevant for
  9499. @var{pal8} pixel format frames.
  9500. It accepts the following option:
  9501. @table @option
  9502. @item s
  9503. Set the size of the box used to represent one palette color entry. Default is
  9504. @code{30} (for a @code{30x30} pixel box).
  9505. @end table
  9506. @section shuffleframes
  9507. Reorder and/or duplicate and/or drop video frames.
  9508. It accepts the following parameters:
  9509. @table @option
  9510. @item mapping
  9511. Set the destination indexes of input frames.
  9512. This is space or '|' separated list of indexes that maps input frames to output
  9513. frames. Number of indexes also sets maximal value that each index may have.
  9514. '-1' index have special meaning and that is to drop frame.
  9515. @end table
  9516. The first frame has the index 0. The default is to keep the input unchanged.
  9517. @subsection Examples
  9518. @itemize
  9519. @item
  9520. Swap second and third frame of every three frames of the input:
  9521. @example
  9522. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9523. @end example
  9524. @item
  9525. Swap 10th and 1st frame of every ten frames of the input:
  9526. @example
  9527. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9528. @end example
  9529. @end itemize
  9530. @section shuffleplanes
  9531. Reorder and/or duplicate video planes.
  9532. It accepts the following parameters:
  9533. @table @option
  9534. @item map0
  9535. The index of the input plane to be used as the first output plane.
  9536. @item map1
  9537. The index of the input plane to be used as the second output plane.
  9538. @item map2
  9539. The index of the input plane to be used as the third output plane.
  9540. @item map3
  9541. The index of the input plane to be used as the fourth output plane.
  9542. @end table
  9543. The first plane has the index 0. The default is to keep the input unchanged.
  9544. @subsection Examples
  9545. @itemize
  9546. @item
  9547. Swap the second and third planes of the input:
  9548. @example
  9549. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9550. @end example
  9551. @end itemize
  9552. @anchor{signalstats}
  9553. @section signalstats
  9554. Evaluate various visual metrics that assist in determining issues associated
  9555. with the digitization of analog video media.
  9556. By default the filter will log these metadata values:
  9557. @table @option
  9558. @item YMIN
  9559. Display the minimal Y value contained within the input frame. Expressed in
  9560. range of [0-255].
  9561. @item YLOW
  9562. Display the Y value at the 10% percentile within the input frame. Expressed in
  9563. range of [0-255].
  9564. @item YAVG
  9565. Display the average Y value within the input frame. Expressed in range of
  9566. [0-255].
  9567. @item YHIGH
  9568. Display the Y value at the 90% percentile within the input frame. Expressed in
  9569. range of [0-255].
  9570. @item YMAX
  9571. Display the maximum Y value contained within the input frame. Expressed in
  9572. range of [0-255].
  9573. @item UMIN
  9574. Display the minimal U value contained within the input frame. Expressed in
  9575. range of [0-255].
  9576. @item ULOW
  9577. Display the U value at the 10% percentile within the input frame. Expressed in
  9578. range of [0-255].
  9579. @item UAVG
  9580. Display the average U value within the input frame. Expressed in range of
  9581. [0-255].
  9582. @item UHIGH
  9583. Display the U value at the 90% percentile within the input frame. Expressed in
  9584. range of [0-255].
  9585. @item UMAX
  9586. Display the maximum U value contained within the input frame. Expressed in
  9587. range of [0-255].
  9588. @item VMIN
  9589. Display the minimal V value contained within the input frame. Expressed in
  9590. range of [0-255].
  9591. @item VLOW
  9592. Display the V value at the 10% percentile within the input frame. Expressed in
  9593. range of [0-255].
  9594. @item VAVG
  9595. Display the average V value within the input frame. Expressed in range of
  9596. [0-255].
  9597. @item VHIGH
  9598. Display the V value at the 90% percentile within the input frame. Expressed in
  9599. range of [0-255].
  9600. @item VMAX
  9601. Display the maximum V value contained within the input frame. Expressed in
  9602. range of [0-255].
  9603. @item SATMIN
  9604. Display the minimal saturation value contained within the input frame.
  9605. Expressed in range of [0-~181.02].
  9606. @item SATLOW
  9607. Display the saturation value at the 10% percentile within the input frame.
  9608. Expressed in range of [0-~181.02].
  9609. @item SATAVG
  9610. Display the average saturation value within the input frame. Expressed in range
  9611. of [0-~181.02].
  9612. @item SATHIGH
  9613. Display the saturation value at the 90% percentile within the input frame.
  9614. Expressed in range of [0-~181.02].
  9615. @item SATMAX
  9616. Display the maximum saturation value contained within the input frame.
  9617. Expressed in range of [0-~181.02].
  9618. @item HUEMED
  9619. Display the median value for hue within the input frame. Expressed in range of
  9620. [0-360].
  9621. @item HUEAVG
  9622. Display the average value for hue within the input frame. Expressed in range of
  9623. [0-360].
  9624. @item YDIF
  9625. Display the average of sample value difference between all values of the Y
  9626. plane in the current frame and corresponding values of the previous input frame.
  9627. Expressed in range of [0-255].
  9628. @item UDIF
  9629. Display the average of sample value difference between all values of the U
  9630. plane in the current frame and corresponding values of the previous input frame.
  9631. Expressed in range of [0-255].
  9632. @item VDIF
  9633. Display the average of sample value difference between all values of the V
  9634. plane in the current frame and corresponding values of the previous input frame.
  9635. Expressed in range of [0-255].
  9636. @item YBITDEPTH
  9637. Display bit depth of Y plane in current frame.
  9638. Expressed in range of [0-16].
  9639. @item UBITDEPTH
  9640. Display bit depth of U plane in current frame.
  9641. Expressed in range of [0-16].
  9642. @item VBITDEPTH
  9643. Display bit depth of V plane in current frame.
  9644. Expressed in range of [0-16].
  9645. @end table
  9646. The filter accepts the following options:
  9647. @table @option
  9648. @item stat
  9649. @item out
  9650. @option{stat} specify an additional form of image analysis.
  9651. @option{out} output video with the specified type of pixel highlighted.
  9652. Both options accept the following values:
  9653. @table @samp
  9654. @item tout
  9655. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9656. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9657. include the results of video dropouts, head clogs, or tape tracking issues.
  9658. @item vrep
  9659. Identify @var{vertical line repetition}. Vertical line repetition includes
  9660. similar rows of pixels within a frame. In born-digital video vertical line
  9661. repetition is common, but this pattern is uncommon in video digitized from an
  9662. analog source. When it occurs in video that results from the digitization of an
  9663. analog source it can indicate concealment from a dropout compensator.
  9664. @item brng
  9665. Identify pixels that fall outside of legal broadcast range.
  9666. @end table
  9667. @item color, c
  9668. Set the highlight color for the @option{out} option. The default color is
  9669. yellow.
  9670. @end table
  9671. @subsection Examples
  9672. @itemize
  9673. @item
  9674. Output data of various video metrics:
  9675. @example
  9676. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9677. @end example
  9678. @item
  9679. Output specific data about the minimum and maximum values of the Y plane per frame:
  9680. @example
  9681. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9682. @end example
  9683. @item
  9684. Playback video while highlighting pixels that are outside of broadcast range in red.
  9685. @example
  9686. ffplay example.mov -vf signalstats="out=brng:color=red"
  9687. @end example
  9688. @item
  9689. Playback video with signalstats metadata drawn over the frame.
  9690. @example
  9691. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9692. @end example
  9693. The contents of signalstat_drawtext.txt used in the command are:
  9694. @example
  9695. time %@{pts:hms@}
  9696. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9697. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9698. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9699. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9700. @end example
  9701. @end itemize
  9702. @anchor{smartblur}
  9703. @section smartblur
  9704. Blur the input video without impacting the outlines.
  9705. It accepts the following options:
  9706. @table @option
  9707. @item luma_radius, lr
  9708. Set the luma radius. The option value must be a float number in
  9709. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9710. used to blur the image (slower if larger). Default value is 1.0.
  9711. @item luma_strength, ls
  9712. Set the luma strength. The option value must be a float number
  9713. in the range [-1.0,1.0] that configures the blurring. A value included
  9714. in [0.0,1.0] will blur the image whereas a value included in
  9715. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9716. @item luma_threshold, lt
  9717. Set the luma threshold used as a coefficient to determine
  9718. whether a pixel should be blurred or not. The option value must be an
  9719. integer in the range [-30,30]. A value of 0 will filter all the image,
  9720. a value included in [0,30] will filter flat areas and a value included
  9721. in [-30,0] will filter edges. Default value is 0.
  9722. @item chroma_radius, cr
  9723. Set the chroma radius. The option value must be a float number in
  9724. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9725. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  9726. @item chroma_strength, cs
  9727. Set the chroma strength. The option value must be a float number
  9728. in the range [-1.0,1.0] that configures the blurring. A value included
  9729. in [0.0,1.0] will blur the image whereas a value included in
  9730. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  9731. @item chroma_threshold, ct
  9732. Set the chroma threshold used as a coefficient to determine
  9733. whether a pixel should be blurred or not. The option value must be an
  9734. integer in the range [-30,30]. A value of 0 will filter all the image,
  9735. a value included in [0,30] will filter flat areas and a value included
  9736. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  9737. @end table
  9738. If a chroma option is not explicitly set, the corresponding luma value
  9739. is set.
  9740. @section ssim
  9741. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9742. This filter takes in input two input videos, the first input is
  9743. considered the "main" source and is passed unchanged to the
  9744. output. The second input is used as a "reference" video for computing
  9745. the SSIM.
  9746. Both video inputs must have the same resolution and pixel format for
  9747. this filter to work correctly. Also it assumes that both inputs
  9748. have the same number of frames, which are compared one by one.
  9749. The filter stores the calculated SSIM of each frame.
  9750. The description of the accepted parameters follows.
  9751. @table @option
  9752. @item stats_file, f
  9753. If specified the filter will use the named file to save the SSIM of
  9754. each individual frame. When filename equals "-" the data is sent to
  9755. standard output.
  9756. @end table
  9757. The file printed if @var{stats_file} is selected, contains a sequence of
  9758. key/value pairs of the form @var{key}:@var{value} for each compared
  9759. couple of frames.
  9760. A description of each shown parameter follows:
  9761. @table @option
  9762. @item n
  9763. sequential number of the input frame, starting from 1
  9764. @item Y, U, V, R, G, B
  9765. SSIM of the compared frames for the component specified by the suffix.
  9766. @item All
  9767. SSIM of the compared frames for the whole frame.
  9768. @item dB
  9769. Same as above but in dB representation.
  9770. @end table
  9771. For example:
  9772. @example
  9773. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9774. [main][ref] ssim="stats_file=stats.log" [out]
  9775. @end example
  9776. On this example the input file being processed is compared with the
  9777. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9778. is stored in @file{stats.log}.
  9779. Another example with both psnr and ssim at same time:
  9780. @example
  9781. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9782. @end example
  9783. @section stereo3d
  9784. Convert between different stereoscopic image formats.
  9785. The filters accept the following options:
  9786. @table @option
  9787. @item in
  9788. Set stereoscopic image format of input.
  9789. Available values for input image formats are:
  9790. @table @samp
  9791. @item sbsl
  9792. side by side parallel (left eye left, right eye right)
  9793. @item sbsr
  9794. side by side crosseye (right eye left, left eye right)
  9795. @item sbs2l
  9796. side by side parallel with half width resolution
  9797. (left eye left, right eye right)
  9798. @item sbs2r
  9799. side by side crosseye with half width resolution
  9800. (right eye left, left eye right)
  9801. @item abl
  9802. above-below (left eye above, right eye below)
  9803. @item abr
  9804. above-below (right eye above, left eye below)
  9805. @item ab2l
  9806. above-below with half height resolution
  9807. (left eye above, right eye below)
  9808. @item ab2r
  9809. above-below with half height resolution
  9810. (right eye above, left eye below)
  9811. @item al
  9812. alternating frames (left eye first, right eye second)
  9813. @item ar
  9814. alternating frames (right eye first, left eye second)
  9815. @item irl
  9816. interleaved rows (left eye has top row, right eye starts on next row)
  9817. @item irr
  9818. interleaved rows (right eye has top row, left eye starts on next row)
  9819. @item icl
  9820. interleaved columns, left eye first
  9821. @item icr
  9822. interleaved columns, right eye first
  9823. Default value is @samp{sbsl}.
  9824. @end table
  9825. @item out
  9826. Set stereoscopic image format of output.
  9827. @table @samp
  9828. @item sbsl
  9829. side by side parallel (left eye left, right eye right)
  9830. @item sbsr
  9831. side by side crosseye (right eye left, left eye right)
  9832. @item sbs2l
  9833. side by side parallel with half width resolution
  9834. (left eye left, right eye right)
  9835. @item sbs2r
  9836. side by side crosseye with half width resolution
  9837. (right eye left, left eye right)
  9838. @item abl
  9839. above-below (left eye above, right eye below)
  9840. @item abr
  9841. above-below (right eye above, left eye below)
  9842. @item ab2l
  9843. above-below with half height resolution
  9844. (left eye above, right eye below)
  9845. @item ab2r
  9846. above-below with half height resolution
  9847. (right eye above, left eye below)
  9848. @item al
  9849. alternating frames (left eye first, right eye second)
  9850. @item ar
  9851. alternating frames (right eye first, left eye second)
  9852. @item irl
  9853. interleaved rows (left eye has top row, right eye starts on next row)
  9854. @item irr
  9855. interleaved rows (right eye has top row, left eye starts on next row)
  9856. @item arbg
  9857. anaglyph red/blue gray
  9858. (red filter on left eye, blue filter on right eye)
  9859. @item argg
  9860. anaglyph red/green gray
  9861. (red filter on left eye, green filter on right eye)
  9862. @item arcg
  9863. anaglyph red/cyan gray
  9864. (red filter on left eye, cyan filter on right eye)
  9865. @item arch
  9866. anaglyph red/cyan half colored
  9867. (red filter on left eye, cyan filter on right eye)
  9868. @item arcc
  9869. anaglyph red/cyan color
  9870. (red filter on left eye, cyan filter on right eye)
  9871. @item arcd
  9872. anaglyph red/cyan color optimized with the least squares projection of dubois
  9873. (red filter on left eye, cyan filter on right eye)
  9874. @item agmg
  9875. anaglyph green/magenta gray
  9876. (green filter on left eye, magenta filter on right eye)
  9877. @item agmh
  9878. anaglyph green/magenta half colored
  9879. (green filter on left eye, magenta filter on right eye)
  9880. @item agmc
  9881. anaglyph green/magenta colored
  9882. (green filter on left eye, magenta filter on right eye)
  9883. @item agmd
  9884. anaglyph green/magenta color optimized with the least squares projection of dubois
  9885. (green filter on left eye, magenta filter on right eye)
  9886. @item aybg
  9887. anaglyph yellow/blue gray
  9888. (yellow filter on left eye, blue filter on right eye)
  9889. @item aybh
  9890. anaglyph yellow/blue half colored
  9891. (yellow filter on left eye, blue filter on right eye)
  9892. @item aybc
  9893. anaglyph yellow/blue colored
  9894. (yellow filter on left eye, blue filter on right eye)
  9895. @item aybd
  9896. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9897. (yellow filter on left eye, blue filter on right eye)
  9898. @item ml
  9899. mono output (left eye only)
  9900. @item mr
  9901. mono output (right eye only)
  9902. @item chl
  9903. checkerboard, left eye first
  9904. @item chr
  9905. checkerboard, right eye first
  9906. @item icl
  9907. interleaved columns, left eye first
  9908. @item icr
  9909. interleaved columns, right eye first
  9910. @item hdmi
  9911. HDMI frame pack
  9912. @end table
  9913. Default value is @samp{arcd}.
  9914. @end table
  9915. @subsection Examples
  9916. @itemize
  9917. @item
  9918. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9919. @example
  9920. stereo3d=sbsl:aybd
  9921. @end example
  9922. @item
  9923. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9924. @example
  9925. stereo3d=abl:sbsr
  9926. @end example
  9927. @end itemize
  9928. @section streamselect, astreamselect
  9929. Select video or audio streams.
  9930. The filter accepts the following options:
  9931. @table @option
  9932. @item inputs
  9933. Set number of inputs. Default is 2.
  9934. @item map
  9935. Set input indexes to remap to outputs.
  9936. @end table
  9937. @subsection Commands
  9938. The @code{streamselect} and @code{astreamselect} filter supports the following
  9939. commands:
  9940. @table @option
  9941. @item map
  9942. Set input indexes to remap to outputs.
  9943. @end table
  9944. @subsection Examples
  9945. @itemize
  9946. @item
  9947. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9948. @example
  9949. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9950. @end example
  9951. @item
  9952. Same as above, but for audio:
  9953. @example
  9954. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9955. @end example
  9956. @end itemize
  9957. @section sobel
  9958. Apply sobel operator to input video stream.
  9959. The filter accepts the following option:
  9960. @table @option
  9961. @item planes
  9962. Set which planes will be processed, unprocessed planes will be copied.
  9963. By default value 0xf, all planes will be processed.
  9964. @item scale
  9965. Set value which will be multiplied with filtered result.
  9966. @item delta
  9967. Set value which will be added to filtered result.
  9968. @end table
  9969. @anchor{spp}
  9970. @section spp
  9971. Apply a simple postprocessing filter that compresses and decompresses the image
  9972. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9973. and average the results.
  9974. The filter accepts the following options:
  9975. @table @option
  9976. @item quality
  9977. Set quality. This option defines the number of levels for averaging. It accepts
  9978. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9979. effect. A value of @code{6} means the higher quality. For each increment of
  9980. that value the speed drops by a factor of approximately 2. Default value is
  9981. @code{3}.
  9982. @item qp
  9983. Force a constant quantization parameter. If not set, the filter will use the QP
  9984. from the video stream (if available).
  9985. @item mode
  9986. Set thresholding mode. Available modes are:
  9987. @table @samp
  9988. @item hard
  9989. Set hard thresholding (default).
  9990. @item soft
  9991. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9992. @end table
  9993. @item use_bframe_qp
  9994. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9995. option may cause flicker since the B-Frames have often larger QP. Default is
  9996. @code{0} (not enabled).
  9997. @end table
  9998. @anchor{subtitles}
  9999. @section subtitles
  10000. Draw subtitles on top of input video using the libass library.
  10001. To enable compilation of this filter you need to configure FFmpeg with
  10002. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10003. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10004. Alpha) subtitles format.
  10005. The filter accepts the following options:
  10006. @table @option
  10007. @item filename, f
  10008. Set the filename of the subtitle file to read. It must be specified.
  10009. @item original_size
  10010. Specify the size of the original video, the video for which the ASS file
  10011. was composed. For the syntax of this option, check the
  10012. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10013. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10014. correctly scale the fonts if the aspect ratio has been changed.
  10015. @item fontsdir
  10016. Set a directory path containing fonts that can be used by the filter.
  10017. These fonts will be used in addition to whatever the font provider uses.
  10018. @item charenc
  10019. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10020. useful if not UTF-8.
  10021. @item stream_index, si
  10022. Set subtitles stream index. @code{subtitles} filter only.
  10023. @item force_style
  10024. Override default style or script info parameters of the subtitles. It accepts a
  10025. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10026. @end table
  10027. If the first key is not specified, it is assumed that the first value
  10028. specifies the @option{filename}.
  10029. For example, to render the file @file{sub.srt} on top of the input
  10030. video, use the command:
  10031. @example
  10032. subtitles=sub.srt
  10033. @end example
  10034. which is equivalent to:
  10035. @example
  10036. subtitles=filename=sub.srt
  10037. @end example
  10038. To render the default subtitles stream from file @file{video.mkv}, use:
  10039. @example
  10040. subtitles=video.mkv
  10041. @end example
  10042. To render the second subtitles stream from that file, use:
  10043. @example
  10044. subtitles=video.mkv:si=1
  10045. @end example
  10046. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10047. @code{DejaVu Serif}, use:
  10048. @example
  10049. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10050. @end example
  10051. @section super2xsai
  10052. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10053. Interpolate) pixel art scaling algorithm.
  10054. Useful for enlarging pixel art images without reducing sharpness.
  10055. @section swaprect
  10056. Swap two rectangular objects in video.
  10057. This filter accepts the following options:
  10058. @table @option
  10059. @item w
  10060. Set object width.
  10061. @item h
  10062. Set object height.
  10063. @item x1
  10064. Set 1st rect x coordinate.
  10065. @item y1
  10066. Set 1st rect y coordinate.
  10067. @item x2
  10068. Set 2nd rect x coordinate.
  10069. @item y2
  10070. Set 2nd rect y coordinate.
  10071. All expressions are evaluated once for each frame.
  10072. @end table
  10073. The all options are expressions containing the following constants:
  10074. @table @option
  10075. @item w
  10076. @item h
  10077. The input width and height.
  10078. @item a
  10079. same as @var{w} / @var{h}
  10080. @item sar
  10081. input sample aspect ratio
  10082. @item dar
  10083. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10084. @item n
  10085. The number of the input frame, starting from 0.
  10086. @item t
  10087. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10088. @item pos
  10089. the position in the file of the input frame, NAN if unknown
  10090. @end table
  10091. @section swapuv
  10092. Swap U & V plane.
  10093. @section telecine
  10094. Apply telecine process to the video.
  10095. This filter accepts the following options:
  10096. @table @option
  10097. @item first_field
  10098. @table @samp
  10099. @item top, t
  10100. top field first
  10101. @item bottom, b
  10102. bottom field first
  10103. The default value is @code{top}.
  10104. @end table
  10105. @item pattern
  10106. A string of numbers representing the pulldown pattern you wish to apply.
  10107. The default value is @code{23}.
  10108. @end table
  10109. @example
  10110. Some typical patterns:
  10111. NTSC output (30i):
  10112. 27.5p: 32222
  10113. 24p: 23 (classic)
  10114. 24p: 2332 (preferred)
  10115. 20p: 33
  10116. 18p: 334
  10117. 16p: 3444
  10118. PAL output (25i):
  10119. 27.5p: 12222
  10120. 24p: 222222222223 ("Euro pulldown")
  10121. 16.67p: 33
  10122. 16p: 33333334
  10123. @end example
  10124. @section threshold
  10125. Apply threshold effect to video stream.
  10126. This filter needs four video streams to perform thresholding.
  10127. First stream is stream we are filtering.
  10128. Second stream is holding threshold values, third stream is holding min values,
  10129. and last, fourth stream is holding max values.
  10130. The filter accepts the following option:
  10131. @table @option
  10132. @item planes
  10133. Set which planes will be processed, unprocessed planes will be copied.
  10134. By default value 0xf, all planes will be processed.
  10135. @end table
  10136. For example if first stream pixel's component value is less then threshold value
  10137. of pixel component from 2nd threshold stream, third stream value will picked,
  10138. otherwise fourth stream pixel component value will be picked.
  10139. Using color source filter one can perform various types of thresholding:
  10140. @subsection Examples
  10141. @itemize
  10142. @item
  10143. Binary threshold, using gray color as threshold:
  10144. @example
  10145. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10146. @end example
  10147. @item
  10148. Inverted binary threshold, using gray color as threshold:
  10149. @example
  10150. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10151. @end example
  10152. @item
  10153. Truncate binary threshold, using gray color as threshold:
  10154. @example
  10155. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10156. @end example
  10157. @item
  10158. Threshold to zero, using gray color as threshold:
  10159. @example
  10160. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10161. @end example
  10162. @item
  10163. Inverted threshold to zero, using gray color as threshold:
  10164. @example
  10165. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10166. @end example
  10167. @end itemize
  10168. @section thumbnail
  10169. Select the most representative frame in a given sequence of consecutive frames.
  10170. The filter accepts the following options:
  10171. @table @option
  10172. @item n
  10173. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10174. will pick one of them, and then handle the next batch of @var{n} frames until
  10175. the end. Default is @code{100}.
  10176. @end table
  10177. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10178. value will result in a higher memory usage, so a high value is not recommended.
  10179. @subsection Examples
  10180. @itemize
  10181. @item
  10182. Extract one picture each 50 frames:
  10183. @example
  10184. thumbnail=50
  10185. @end example
  10186. @item
  10187. Complete example of a thumbnail creation with @command{ffmpeg}:
  10188. @example
  10189. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10190. @end example
  10191. @end itemize
  10192. @section tile
  10193. Tile several successive frames together.
  10194. The filter accepts the following options:
  10195. @table @option
  10196. @item layout
  10197. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10198. this option, check the
  10199. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10200. @item nb_frames
  10201. Set the maximum number of frames to render in the given area. It must be less
  10202. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10203. the area will be used.
  10204. @item margin
  10205. Set the outer border margin in pixels.
  10206. @item padding
  10207. Set the inner border thickness (i.e. the number of pixels between frames). For
  10208. more advanced padding options (such as having different values for the edges),
  10209. refer to the pad video filter.
  10210. @item color
  10211. Specify the color of the unused area. For the syntax of this option, check the
  10212. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10213. is "black".
  10214. @end table
  10215. @subsection Examples
  10216. @itemize
  10217. @item
  10218. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10219. @example
  10220. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10221. @end example
  10222. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10223. duplicating each output frame to accommodate the originally detected frame
  10224. rate.
  10225. @item
  10226. Display @code{5} pictures in an area of @code{3x2} frames,
  10227. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10228. mixed flat and named options:
  10229. @example
  10230. tile=3x2:nb_frames=5:padding=7:margin=2
  10231. @end example
  10232. @end itemize
  10233. @section tinterlace
  10234. Perform various types of temporal field interlacing.
  10235. Frames are counted starting from 1, so the first input frame is
  10236. considered odd.
  10237. The filter accepts the following options:
  10238. @table @option
  10239. @item mode
  10240. Specify the mode of the interlacing. This option can also be specified
  10241. as a value alone. See below for a list of values for this option.
  10242. Available values are:
  10243. @table @samp
  10244. @item merge, 0
  10245. Move odd frames into the upper field, even into the lower field,
  10246. generating a double height frame at half frame rate.
  10247. @example
  10248. ------> time
  10249. Input:
  10250. Frame 1 Frame 2 Frame 3 Frame 4
  10251. 11111 22222 33333 44444
  10252. 11111 22222 33333 44444
  10253. 11111 22222 33333 44444
  10254. 11111 22222 33333 44444
  10255. Output:
  10256. 11111 33333
  10257. 22222 44444
  10258. 11111 33333
  10259. 22222 44444
  10260. 11111 33333
  10261. 22222 44444
  10262. 11111 33333
  10263. 22222 44444
  10264. @end example
  10265. @item drop_even, 1
  10266. Only output odd frames, even frames are dropped, generating a frame with
  10267. unchanged height at half frame rate.
  10268. @example
  10269. ------> time
  10270. Input:
  10271. Frame 1 Frame 2 Frame 3 Frame 4
  10272. 11111 22222 33333 44444
  10273. 11111 22222 33333 44444
  10274. 11111 22222 33333 44444
  10275. 11111 22222 33333 44444
  10276. Output:
  10277. 11111 33333
  10278. 11111 33333
  10279. 11111 33333
  10280. 11111 33333
  10281. @end example
  10282. @item drop_odd, 2
  10283. Only output even frames, odd frames are dropped, generating a frame with
  10284. unchanged height at half frame rate.
  10285. @example
  10286. ------> time
  10287. Input:
  10288. Frame 1 Frame 2 Frame 3 Frame 4
  10289. 11111 22222 33333 44444
  10290. 11111 22222 33333 44444
  10291. 11111 22222 33333 44444
  10292. 11111 22222 33333 44444
  10293. Output:
  10294. 22222 44444
  10295. 22222 44444
  10296. 22222 44444
  10297. 22222 44444
  10298. @end example
  10299. @item pad, 3
  10300. Expand each frame to full height, but pad alternate lines with black,
  10301. generating a frame with double height at the same input frame rate.
  10302. @example
  10303. ------> time
  10304. Input:
  10305. Frame 1 Frame 2 Frame 3 Frame 4
  10306. 11111 22222 33333 44444
  10307. 11111 22222 33333 44444
  10308. 11111 22222 33333 44444
  10309. 11111 22222 33333 44444
  10310. Output:
  10311. 11111 ..... 33333 .....
  10312. ..... 22222 ..... 44444
  10313. 11111 ..... 33333 .....
  10314. ..... 22222 ..... 44444
  10315. 11111 ..... 33333 .....
  10316. ..... 22222 ..... 44444
  10317. 11111 ..... 33333 .....
  10318. ..... 22222 ..... 44444
  10319. @end example
  10320. @item interleave_top, 4
  10321. Interleave the upper field from odd frames with the lower field from
  10322. even frames, generating a frame with unchanged height at half frame rate.
  10323. @example
  10324. ------> time
  10325. Input:
  10326. Frame 1 Frame 2 Frame 3 Frame 4
  10327. 11111<- 22222 33333<- 44444
  10328. 11111 22222<- 33333 44444<-
  10329. 11111<- 22222 33333<- 44444
  10330. 11111 22222<- 33333 44444<-
  10331. Output:
  10332. 11111 33333
  10333. 22222 44444
  10334. 11111 33333
  10335. 22222 44444
  10336. @end example
  10337. @item interleave_bottom, 5
  10338. Interleave the lower field from odd frames with the upper field from
  10339. even frames, generating a frame with unchanged height at half frame rate.
  10340. @example
  10341. ------> time
  10342. Input:
  10343. Frame 1 Frame 2 Frame 3 Frame 4
  10344. 11111 22222<- 33333 44444<-
  10345. 11111<- 22222 33333<- 44444
  10346. 11111 22222<- 33333 44444<-
  10347. 11111<- 22222 33333<- 44444
  10348. Output:
  10349. 22222 44444
  10350. 11111 33333
  10351. 22222 44444
  10352. 11111 33333
  10353. @end example
  10354. @item interlacex2, 6
  10355. Double frame rate with unchanged height. Frames are inserted each
  10356. containing the second temporal field from the previous input frame and
  10357. the first temporal field from the next input frame. This mode relies on
  10358. the top_field_first flag. Useful for interlaced video displays with no
  10359. field synchronisation.
  10360. @example
  10361. ------> time
  10362. Input:
  10363. Frame 1 Frame 2 Frame 3 Frame 4
  10364. 11111 22222 33333 44444
  10365. 11111 22222 33333 44444
  10366. 11111 22222 33333 44444
  10367. 11111 22222 33333 44444
  10368. Output:
  10369. 11111 22222 22222 33333 33333 44444 44444
  10370. 11111 11111 22222 22222 33333 33333 44444
  10371. 11111 22222 22222 33333 33333 44444 44444
  10372. 11111 11111 22222 22222 33333 33333 44444
  10373. @end example
  10374. @item mergex2, 7
  10375. Move odd frames into the upper field, even into the lower field,
  10376. generating a double height frame at same frame rate.
  10377. @example
  10378. ------> time
  10379. Input:
  10380. Frame 1 Frame 2 Frame 3 Frame 4
  10381. 11111 22222 33333 44444
  10382. 11111 22222 33333 44444
  10383. 11111 22222 33333 44444
  10384. 11111 22222 33333 44444
  10385. Output:
  10386. 11111 33333 33333 55555
  10387. 22222 22222 44444 44444
  10388. 11111 33333 33333 55555
  10389. 22222 22222 44444 44444
  10390. 11111 33333 33333 55555
  10391. 22222 22222 44444 44444
  10392. 11111 33333 33333 55555
  10393. 22222 22222 44444 44444
  10394. @end example
  10395. @end table
  10396. Numeric values are deprecated but are accepted for backward
  10397. compatibility reasons.
  10398. Default mode is @code{merge}.
  10399. @item flags
  10400. Specify flags influencing the filter process.
  10401. Available value for @var{flags} is:
  10402. @table @option
  10403. @item low_pass_filter, vlfp
  10404. Enable vertical low-pass filtering in the filter.
  10405. Vertical low-pass filtering is required when creating an interlaced
  10406. destination from a progressive source which contains high-frequency
  10407. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10408. patterning.
  10409. Vertical low-pass filtering can only be enabled for @option{mode}
  10410. @var{interleave_top} and @var{interleave_bottom}.
  10411. @end table
  10412. @end table
  10413. @section transpose
  10414. Transpose rows with columns in the input video and optionally flip it.
  10415. It accepts the following parameters:
  10416. @table @option
  10417. @item dir
  10418. Specify the transposition direction.
  10419. Can assume the following values:
  10420. @table @samp
  10421. @item 0, 4, cclock_flip
  10422. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10423. @example
  10424. L.R L.l
  10425. . . -> . .
  10426. l.r R.r
  10427. @end example
  10428. @item 1, 5, clock
  10429. Rotate by 90 degrees clockwise, that is:
  10430. @example
  10431. L.R l.L
  10432. . . -> . .
  10433. l.r r.R
  10434. @end example
  10435. @item 2, 6, cclock
  10436. Rotate by 90 degrees counterclockwise, that is:
  10437. @example
  10438. L.R R.r
  10439. . . -> . .
  10440. l.r L.l
  10441. @end example
  10442. @item 3, 7, clock_flip
  10443. Rotate by 90 degrees clockwise and vertically flip, that is:
  10444. @example
  10445. L.R r.R
  10446. . . -> . .
  10447. l.r l.L
  10448. @end example
  10449. @end table
  10450. For values between 4-7, the transposition is only done if the input
  10451. video geometry is portrait and not landscape. These values are
  10452. deprecated, the @code{passthrough} option should be used instead.
  10453. Numerical values are deprecated, and should be dropped in favor of
  10454. symbolic constants.
  10455. @item passthrough
  10456. Do not apply the transposition if the input geometry matches the one
  10457. specified by the specified value. It accepts the following values:
  10458. @table @samp
  10459. @item none
  10460. Always apply transposition.
  10461. @item portrait
  10462. Preserve portrait geometry (when @var{height} >= @var{width}).
  10463. @item landscape
  10464. Preserve landscape geometry (when @var{width} >= @var{height}).
  10465. @end table
  10466. Default value is @code{none}.
  10467. @end table
  10468. For example to rotate by 90 degrees clockwise and preserve portrait
  10469. layout:
  10470. @example
  10471. transpose=dir=1:passthrough=portrait
  10472. @end example
  10473. The command above can also be specified as:
  10474. @example
  10475. transpose=1:portrait
  10476. @end example
  10477. @section trim
  10478. Trim the input so that the output contains one continuous subpart of the input.
  10479. It accepts the following parameters:
  10480. @table @option
  10481. @item start
  10482. Specify the time of the start of the kept section, i.e. the frame with the
  10483. timestamp @var{start} will be the first frame in the output.
  10484. @item end
  10485. Specify the time of the first frame that will be dropped, i.e. the frame
  10486. immediately preceding the one with the timestamp @var{end} will be the last
  10487. frame in the output.
  10488. @item start_pts
  10489. This is the same as @var{start}, except this option sets the start timestamp
  10490. in timebase units instead of seconds.
  10491. @item end_pts
  10492. This is the same as @var{end}, except this option sets the end timestamp
  10493. in timebase units instead of seconds.
  10494. @item duration
  10495. The maximum duration of the output in seconds.
  10496. @item start_frame
  10497. The number of the first frame that should be passed to the output.
  10498. @item end_frame
  10499. The number of the first frame that should be dropped.
  10500. @end table
  10501. @option{start}, @option{end}, and @option{duration} are expressed as time
  10502. duration specifications; see
  10503. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10504. for the accepted syntax.
  10505. Note that the first two sets of the start/end options and the @option{duration}
  10506. option look at the frame timestamp, while the _frame variants simply count the
  10507. frames that pass through the filter. Also note that this filter does not modify
  10508. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10509. setpts filter after the trim filter.
  10510. If multiple start or end options are set, this filter tries to be greedy and
  10511. keep all the frames that match at least one of the specified constraints. To keep
  10512. only the part that matches all the constraints at once, chain multiple trim
  10513. filters.
  10514. The defaults are such that all the input is kept. So it is possible to set e.g.
  10515. just the end values to keep everything before the specified time.
  10516. Examples:
  10517. @itemize
  10518. @item
  10519. Drop everything except the second minute of input:
  10520. @example
  10521. ffmpeg -i INPUT -vf trim=60:120
  10522. @end example
  10523. @item
  10524. Keep only the first second:
  10525. @example
  10526. ffmpeg -i INPUT -vf trim=duration=1
  10527. @end example
  10528. @end itemize
  10529. @anchor{unsharp}
  10530. @section unsharp
  10531. Sharpen or blur the input video.
  10532. It accepts the following parameters:
  10533. @table @option
  10534. @item luma_msize_x, lx
  10535. Set the luma matrix horizontal size. It must be an odd integer between
  10536. 3 and 23. The default value is 5.
  10537. @item luma_msize_y, ly
  10538. Set the luma matrix vertical size. It must be an odd integer between 3
  10539. and 23. The default value is 5.
  10540. @item luma_amount, la
  10541. Set the luma effect strength. It must be a floating point number, reasonable
  10542. values lay between -1.5 and 1.5.
  10543. Negative values will blur the input video, while positive values will
  10544. sharpen it, a value of zero will disable the effect.
  10545. Default value is 1.0.
  10546. @item chroma_msize_x, cx
  10547. Set the chroma matrix horizontal size. It must be an odd integer
  10548. between 3 and 23. The default value is 5.
  10549. @item chroma_msize_y, cy
  10550. Set the chroma matrix vertical size. It must be an odd integer
  10551. between 3 and 23. The default value is 5.
  10552. @item chroma_amount, ca
  10553. Set the chroma effect strength. It must be a floating point number, reasonable
  10554. values lay between -1.5 and 1.5.
  10555. Negative values will blur the input video, while positive values will
  10556. sharpen it, a value of zero will disable the effect.
  10557. Default value is 0.0.
  10558. @item opencl
  10559. If set to 1, specify using OpenCL capabilities, only available if
  10560. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10561. @end table
  10562. All parameters are optional and default to the equivalent of the
  10563. string '5:5:1.0:5:5:0.0'.
  10564. @subsection Examples
  10565. @itemize
  10566. @item
  10567. Apply strong luma sharpen effect:
  10568. @example
  10569. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10570. @end example
  10571. @item
  10572. Apply a strong blur of both luma and chroma parameters:
  10573. @example
  10574. unsharp=7:7:-2:7:7:-2
  10575. @end example
  10576. @end itemize
  10577. @section uspp
  10578. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10579. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10580. shifts and average the results.
  10581. The way this differs from the behavior of spp is that uspp actually encodes &
  10582. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10583. DCT similar to MJPEG.
  10584. The filter accepts the following options:
  10585. @table @option
  10586. @item quality
  10587. Set quality. This option defines the number of levels for averaging. It accepts
  10588. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10589. effect. A value of @code{8} means the higher quality. For each increment of
  10590. that value the speed drops by a factor of approximately 2. Default value is
  10591. @code{3}.
  10592. @item qp
  10593. Force a constant quantization parameter. If not set, the filter will use the QP
  10594. from the video stream (if available).
  10595. @end table
  10596. @section vaguedenoiser
  10597. Apply a wavelet based denoiser.
  10598. It transforms each frame from the video input into the wavelet domain,
  10599. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10600. the obtained coefficients. It does an inverse wavelet transform after.
  10601. Due to wavelet properties, it should give a nice smoothed result, and
  10602. reduced noise, without blurring picture features.
  10603. This filter accepts the following options:
  10604. @table @option
  10605. @item threshold
  10606. The filtering strength. The higher, the more filtered the video will be.
  10607. Hard thresholding can use a higher threshold than soft thresholding
  10608. before the video looks overfiltered.
  10609. @item method
  10610. The filtering method the filter will use.
  10611. It accepts the following values:
  10612. @table @samp
  10613. @item hard
  10614. All values under the threshold will be zeroed.
  10615. @item soft
  10616. All values under the threshold will be zeroed. All values above will be
  10617. reduced by the threshold.
  10618. @item garrote
  10619. Scales or nullifies coefficients - intermediary between (more) soft and
  10620. (less) hard thresholding.
  10621. @end table
  10622. @item nsteps
  10623. Number of times, the wavelet will decompose the picture. Picture can't
  10624. be decomposed beyond a particular point (typically, 8 for a 640x480
  10625. frame - as 2^9 = 512 > 480)
  10626. @item percent
  10627. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10628. @item planes
  10629. A list of the planes to process. By default all planes are processed.
  10630. @end table
  10631. @section vectorscope
  10632. Display 2 color component values in the two dimensional graph (which is called
  10633. a vectorscope).
  10634. This filter accepts the following options:
  10635. @table @option
  10636. @item mode, m
  10637. Set vectorscope mode.
  10638. It accepts the following values:
  10639. @table @samp
  10640. @item gray
  10641. Gray values are displayed on graph, higher brightness means more pixels have
  10642. same component color value on location in graph. This is the default mode.
  10643. @item color
  10644. Gray values are displayed on graph. Surrounding pixels values which are not
  10645. present in video frame are drawn in gradient of 2 color components which are
  10646. set by option @code{x} and @code{y}. The 3rd color component is static.
  10647. @item color2
  10648. Actual color components values present in video frame are displayed on graph.
  10649. @item color3
  10650. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10651. on graph increases value of another color component, which is luminance by
  10652. default values of @code{x} and @code{y}.
  10653. @item color4
  10654. Actual colors present in video frame are displayed on graph. If two different
  10655. colors map to same position on graph then color with higher value of component
  10656. not present in graph is picked.
  10657. @item color5
  10658. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10659. component picked from radial gradient.
  10660. @end table
  10661. @item x
  10662. Set which color component will be represented on X-axis. Default is @code{1}.
  10663. @item y
  10664. Set which color component will be represented on Y-axis. Default is @code{2}.
  10665. @item intensity, i
  10666. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10667. of color component which represents frequency of (X, Y) location in graph.
  10668. @item envelope, e
  10669. @table @samp
  10670. @item none
  10671. No envelope, this is default.
  10672. @item instant
  10673. Instant envelope, even darkest single pixel will be clearly highlighted.
  10674. @item peak
  10675. Hold maximum and minimum values presented in graph over time. This way you
  10676. can still spot out of range values without constantly looking at vectorscope.
  10677. @item peak+instant
  10678. Peak and instant envelope combined together.
  10679. @end table
  10680. @item graticule, g
  10681. Set what kind of graticule to draw.
  10682. @table @samp
  10683. @item none
  10684. @item green
  10685. @item color
  10686. @end table
  10687. @item opacity, o
  10688. Set graticule opacity.
  10689. @item flags, f
  10690. Set graticule flags.
  10691. @table @samp
  10692. @item white
  10693. Draw graticule for white point.
  10694. @item black
  10695. Draw graticule for black point.
  10696. @item name
  10697. Draw color points short names.
  10698. @end table
  10699. @item bgopacity, b
  10700. Set background opacity.
  10701. @item lthreshold, l
  10702. Set low threshold for color component not represented on X or Y axis.
  10703. Values lower than this value will be ignored. Default is 0.
  10704. Note this value is multiplied with actual max possible value one pixel component
  10705. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10706. is 0.1 * 255 = 25.
  10707. @item hthreshold, h
  10708. Set high threshold for color component not represented on X or Y axis.
  10709. Values higher than this value will be ignored. Default is 1.
  10710. Note this value is multiplied with actual max possible value one pixel component
  10711. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10712. is 0.9 * 255 = 230.
  10713. @item colorspace, c
  10714. Set what kind of colorspace to use when drawing graticule.
  10715. @table @samp
  10716. @item auto
  10717. @item 601
  10718. @item 709
  10719. @end table
  10720. Default is auto.
  10721. @end table
  10722. @anchor{vidstabdetect}
  10723. @section vidstabdetect
  10724. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10725. @ref{vidstabtransform} for pass 2.
  10726. This filter generates a file with relative translation and rotation
  10727. transform information about subsequent frames, which is then used by
  10728. the @ref{vidstabtransform} filter.
  10729. To enable compilation of this filter you need to configure FFmpeg with
  10730. @code{--enable-libvidstab}.
  10731. This filter accepts the following options:
  10732. @table @option
  10733. @item result
  10734. Set the path to the file used to write the transforms information.
  10735. Default value is @file{transforms.trf}.
  10736. @item shakiness
  10737. Set how shaky the video is and how quick the camera is. It accepts an
  10738. integer in the range 1-10, a value of 1 means little shakiness, a
  10739. value of 10 means strong shakiness. Default value is 5.
  10740. @item accuracy
  10741. Set the accuracy of the detection process. It must be a value in the
  10742. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10743. accuracy. Default value is 15.
  10744. @item stepsize
  10745. Set stepsize of the search process. The region around minimum is
  10746. scanned with 1 pixel resolution. Default value is 6.
  10747. @item mincontrast
  10748. Set minimum contrast. Below this value a local measurement field is
  10749. discarded. Must be a floating point value in the range 0-1. Default
  10750. value is 0.3.
  10751. @item tripod
  10752. Set reference frame number for tripod mode.
  10753. If enabled, the motion of the frames is compared to a reference frame
  10754. in the filtered stream, identified by the specified number. The idea
  10755. is to compensate all movements in a more-or-less static scene and keep
  10756. the camera view absolutely still.
  10757. If set to 0, it is disabled. The frames are counted starting from 1.
  10758. @item show
  10759. Show fields and transforms in the resulting frames. It accepts an
  10760. integer in the range 0-2. Default value is 0, which disables any
  10761. visualization.
  10762. @end table
  10763. @subsection Examples
  10764. @itemize
  10765. @item
  10766. Use default values:
  10767. @example
  10768. vidstabdetect
  10769. @end example
  10770. @item
  10771. Analyze strongly shaky movie and put the results in file
  10772. @file{mytransforms.trf}:
  10773. @example
  10774. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10775. @end example
  10776. @item
  10777. Visualize the result of internal transformations in the resulting
  10778. video:
  10779. @example
  10780. vidstabdetect=show=1
  10781. @end example
  10782. @item
  10783. Analyze a video with medium shakiness using @command{ffmpeg}:
  10784. @example
  10785. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10786. @end example
  10787. @end itemize
  10788. @anchor{vidstabtransform}
  10789. @section vidstabtransform
  10790. Video stabilization/deshaking: pass 2 of 2,
  10791. see @ref{vidstabdetect} for pass 1.
  10792. Read a file with transform information for each frame and
  10793. apply/compensate them. Together with the @ref{vidstabdetect}
  10794. filter this can be used to deshake videos. See also
  10795. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10796. the @ref{unsharp} filter, see below.
  10797. To enable compilation of this filter you need to configure FFmpeg with
  10798. @code{--enable-libvidstab}.
  10799. @subsection Options
  10800. @table @option
  10801. @item input
  10802. Set path to the file used to read the transforms. Default value is
  10803. @file{transforms.trf}.
  10804. @item smoothing
  10805. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10806. camera movements. Default value is 10.
  10807. For example a number of 10 means that 21 frames are used (10 in the
  10808. past and 10 in the future) to smoothen the motion in the video. A
  10809. larger value leads to a smoother video, but limits the acceleration of
  10810. the camera (pan/tilt movements). 0 is a special case where a static
  10811. camera is simulated.
  10812. @item optalgo
  10813. Set the camera path optimization algorithm.
  10814. Accepted values are:
  10815. @table @samp
  10816. @item gauss
  10817. gaussian kernel low-pass filter on camera motion (default)
  10818. @item avg
  10819. averaging on transformations
  10820. @end table
  10821. @item maxshift
  10822. Set maximal number of pixels to translate frames. Default value is -1,
  10823. meaning no limit.
  10824. @item maxangle
  10825. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10826. value is -1, meaning no limit.
  10827. @item crop
  10828. Specify how to deal with borders that may be visible due to movement
  10829. compensation.
  10830. Available values are:
  10831. @table @samp
  10832. @item keep
  10833. keep image information from previous frame (default)
  10834. @item black
  10835. fill the border black
  10836. @end table
  10837. @item invert
  10838. Invert transforms if set to 1. Default value is 0.
  10839. @item relative
  10840. Consider transforms as relative to previous frame if set to 1,
  10841. absolute if set to 0. Default value is 0.
  10842. @item zoom
  10843. Set percentage to zoom. A positive value will result in a zoom-in
  10844. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10845. zoom).
  10846. @item optzoom
  10847. Set optimal zooming to avoid borders.
  10848. Accepted values are:
  10849. @table @samp
  10850. @item 0
  10851. disabled
  10852. @item 1
  10853. optimal static zoom value is determined (only very strong movements
  10854. will lead to visible borders) (default)
  10855. @item 2
  10856. optimal adaptive zoom value is determined (no borders will be
  10857. visible), see @option{zoomspeed}
  10858. @end table
  10859. Note that the value given at zoom is added to the one calculated here.
  10860. @item zoomspeed
  10861. Set percent to zoom maximally each frame (enabled when
  10862. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10863. 0.25.
  10864. @item interpol
  10865. Specify type of interpolation.
  10866. Available values are:
  10867. @table @samp
  10868. @item no
  10869. no interpolation
  10870. @item linear
  10871. linear only horizontal
  10872. @item bilinear
  10873. linear in both directions (default)
  10874. @item bicubic
  10875. cubic in both directions (slow)
  10876. @end table
  10877. @item tripod
  10878. Enable virtual tripod mode if set to 1, which is equivalent to
  10879. @code{relative=0:smoothing=0}. Default value is 0.
  10880. Use also @code{tripod} option of @ref{vidstabdetect}.
  10881. @item debug
  10882. Increase log verbosity if set to 1. Also the detected global motions
  10883. are written to the temporary file @file{global_motions.trf}. Default
  10884. value is 0.
  10885. @end table
  10886. @subsection Examples
  10887. @itemize
  10888. @item
  10889. Use @command{ffmpeg} for a typical stabilization with default values:
  10890. @example
  10891. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10892. @end example
  10893. Note the use of the @ref{unsharp} filter which is always recommended.
  10894. @item
  10895. Zoom in a bit more and load transform data from a given file:
  10896. @example
  10897. vidstabtransform=zoom=5:input="mytransforms.trf"
  10898. @end example
  10899. @item
  10900. Smoothen the video even more:
  10901. @example
  10902. vidstabtransform=smoothing=30
  10903. @end example
  10904. @end itemize
  10905. @section vflip
  10906. Flip the input video vertically.
  10907. For example, to vertically flip a video with @command{ffmpeg}:
  10908. @example
  10909. ffmpeg -i in.avi -vf "vflip" out.avi
  10910. @end example
  10911. @anchor{vignette}
  10912. @section vignette
  10913. Make or reverse a natural vignetting effect.
  10914. The filter accepts the following options:
  10915. @table @option
  10916. @item angle, a
  10917. Set lens angle expression as a number of radians.
  10918. The value is clipped in the @code{[0,PI/2]} range.
  10919. Default value: @code{"PI/5"}
  10920. @item x0
  10921. @item y0
  10922. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10923. by default.
  10924. @item mode
  10925. Set forward/backward mode.
  10926. Available modes are:
  10927. @table @samp
  10928. @item forward
  10929. The larger the distance from the central point, the darker the image becomes.
  10930. @item backward
  10931. The larger the distance from the central point, the brighter the image becomes.
  10932. This can be used to reverse a vignette effect, though there is no automatic
  10933. detection to extract the lens @option{angle} and other settings (yet). It can
  10934. also be used to create a burning effect.
  10935. @end table
  10936. Default value is @samp{forward}.
  10937. @item eval
  10938. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10939. It accepts the following values:
  10940. @table @samp
  10941. @item init
  10942. Evaluate expressions only once during the filter initialization.
  10943. @item frame
  10944. Evaluate expressions for each incoming frame. This is way slower than the
  10945. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10946. allows advanced dynamic expressions.
  10947. @end table
  10948. Default value is @samp{init}.
  10949. @item dither
  10950. Set dithering to reduce the circular banding effects. Default is @code{1}
  10951. (enabled).
  10952. @item aspect
  10953. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10954. Setting this value to the SAR of the input will make a rectangular vignetting
  10955. following the dimensions of the video.
  10956. Default is @code{1/1}.
  10957. @end table
  10958. @subsection Expressions
  10959. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10960. following parameters.
  10961. @table @option
  10962. @item w
  10963. @item h
  10964. input width and height
  10965. @item n
  10966. the number of input frame, starting from 0
  10967. @item pts
  10968. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10969. @var{TB} units, NAN if undefined
  10970. @item r
  10971. frame rate of the input video, NAN if the input frame rate is unknown
  10972. @item t
  10973. the PTS (Presentation TimeStamp) of the filtered video frame,
  10974. expressed in seconds, NAN if undefined
  10975. @item tb
  10976. time base of the input video
  10977. @end table
  10978. @subsection Examples
  10979. @itemize
  10980. @item
  10981. Apply simple strong vignetting effect:
  10982. @example
  10983. vignette=PI/4
  10984. @end example
  10985. @item
  10986. Make a flickering vignetting:
  10987. @example
  10988. vignette='PI/4+random(1)*PI/50':eval=frame
  10989. @end example
  10990. @end itemize
  10991. @section vstack
  10992. Stack input videos vertically.
  10993. All streams must be of same pixel format and of same width.
  10994. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10995. to create same output.
  10996. The filter accept the following option:
  10997. @table @option
  10998. @item inputs
  10999. Set number of input streams. Default is 2.
  11000. @item shortest
  11001. If set to 1, force the output to terminate when the shortest input
  11002. terminates. Default value is 0.
  11003. @end table
  11004. @section w3fdif
  11005. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11006. Deinterlacing Filter").
  11007. Based on the process described by Martin Weston for BBC R&D, and
  11008. implemented based on the de-interlace algorithm written by Jim
  11009. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11010. uses filter coefficients calculated by BBC R&D.
  11011. There are two sets of filter coefficients, so called "simple":
  11012. and "complex". Which set of filter coefficients is used can
  11013. be set by passing an optional parameter:
  11014. @table @option
  11015. @item filter
  11016. Set the interlacing filter coefficients. Accepts one of the following values:
  11017. @table @samp
  11018. @item simple
  11019. Simple filter coefficient set.
  11020. @item complex
  11021. More-complex filter coefficient set.
  11022. @end table
  11023. Default value is @samp{complex}.
  11024. @item deint
  11025. Specify which frames to deinterlace. Accept one of the following values:
  11026. @table @samp
  11027. @item all
  11028. Deinterlace all frames,
  11029. @item interlaced
  11030. Only deinterlace frames marked as interlaced.
  11031. @end table
  11032. Default value is @samp{all}.
  11033. @end table
  11034. @section waveform
  11035. Video waveform monitor.
  11036. The waveform monitor plots color component intensity. By default luminance
  11037. only. Each column of the waveform corresponds to a column of pixels in the
  11038. source video.
  11039. It accepts the following options:
  11040. @table @option
  11041. @item mode, m
  11042. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11043. In row mode, the graph on the left side represents color component value 0 and
  11044. the right side represents value = 255. In column mode, the top side represents
  11045. color component value = 0 and bottom side represents value = 255.
  11046. @item intensity, i
  11047. Set intensity. Smaller values are useful to find out how many values of the same
  11048. luminance are distributed across input rows/columns.
  11049. Default value is @code{0.04}. Allowed range is [0, 1].
  11050. @item mirror, r
  11051. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11052. In mirrored mode, higher values will be represented on the left
  11053. side for @code{row} mode and at the top for @code{column} mode. Default is
  11054. @code{1} (mirrored).
  11055. @item display, d
  11056. Set display mode.
  11057. It accepts the following values:
  11058. @table @samp
  11059. @item overlay
  11060. Presents information identical to that in the @code{parade}, except
  11061. that the graphs representing color components are superimposed directly
  11062. over one another.
  11063. This display mode makes it easier to spot relative differences or similarities
  11064. in overlapping areas of the color components that are supposed to be identical,
  11065. such as neutral whites, grays, or blacks.
  11066. @item stack
  11067. Display separate graph for the color components side by side in
  11068. @code{row} mode or one below the other in @code{column} mode.
  11069. @item parade
  11070. Display separate graph for the color components side by side in
  11071. @code{column} mode or one below the other in @code{row} mode.
  11072. Using this display mode makes it easy to spot color casts in the highlights
  11073. and shadows of an image, by comparing the contours of the top and the bottom
  11074. graphs of each waveform. Since whites, grays, and blacks are characterized
  11075. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11076. should display three waveforms of roughly equal width/height. If not, the
  11077. correction is easy to perform by making level adjustments the three waveforms.
  11078. @end table
  11079. Default is @code{stack}.
  11080. @item components, c
  11081. Set which color components to display. Default is 1, which means only luminance
  11082. or red color component if input is in RGB colorspace. If is set for example to
  11083. 7 it will display all 3 (if) available color components.
  11084. @item envelope, e
  11085. @table @samp
  11086. @item none
  11087. No envelope, this is default.
  11088. @item instant
  11089. Instant envelope, minimum and maximum values presented in graph will be easily
  11090. visible even with small @code{step} value.
  11091. @item peak
  11092. Hold minimum and maximum values presented in graph across time. This way you
  11093. can still spot out of range values without constantly looking at waveforms.
  11094. @item peak+instant
  11095. Peak and instant envelope combined together.
  11096. @end table
  11097. @item filter, f
  11098. @table @samp
  11099. @item lowpass
  11100. No filtering, this is default.
  11101. @item flat
  11102. Luma and chroma combined together.
  11103. @item aflat
  11104. Similar as above, but shows difference between blue and red chroma.
  11105. @item chroma
  11106. Displays only chroma.
  11107. @item color
  11108. Displays actual color value on waveform.
  11109. @item acolor
  11110. Similar as above, but with luma showing frequency of chroma values.
  11111. @end table
  11112. @item graticule, g
  11113. Set which graticule to display.
  11114. @table @samp
  11115. @item none
  11116. Do not display graticule.
  11117. @item green
  11118. Display green graticule showing legal broadcast ranges.
  11119. @end table
  11120. @item opacity, o
  11121. Set graticule opacity.
  11122. @item flags, fl
  11123. Set graticule flags.
  11124. @table @samp
  11125. @item numbers
  11126. Draw numbers above lines. By default enabled.
  11127. @item dots
  11128. Draw dots instead of lines.
  11129. @end table
  11130. @item scale, s
  11131. Set scale used for displaying graticule.
  11132. @table @samp
  11133. @item digital
  11134. @item millivolts
  11135. @item ire
  11136. @end table
  11137. Default is digital.
  11138. @item bgopacity, b
  11139. Set background opacity.
  11140. @end table
  11141. @section weave
  11142. The @code{weave} takes a field-based video input and join
  11143. each two sequential fields into single frame, producing a new double
  11144. height clip with half the frame rate and half the frame count.
  11145. It accepts the following option:
  11146. @table @option
  11147. @item first_field
  11148. Set first field. Available values are:
  11149. @table @samp
  11150. @item top, t
  11151. Set the frame as top-field-first.
  11152. @item bottom, b
  11153. Set the frame as bottom-field-first.
  11154. @end table
  11155. @end table
  11156. @subsection Examples
  11157. @itemize
  11158. @item
  11159. Interlace video using @ref{select} and @ref{separatefields} filter:
  11160. @example
  11161. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11162. @end example
  11163. @end itemize
  11164. @section xbr
  11165. Apply the xBR high-quality magnification filter which is designed for pixel
  11166. art. It follows a set of edge-detection rules, see
  11167. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11168. It accepts the following option:
  11169. @table @option
  11170. @item n
  11171. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11172. @code{3xBR} and @code{4} for @code{4xBR}.
  11173. Default is @code{3}.
  11174. @end table
  11175. @anchor{yadif}
  11176. @section yadif
  11177. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11178. filter").
  11179. It accepts the following parameters:
  11180. @table @option
  11181. @item mode
  11182. The interlacing mode to adopt. It accepts one of the following values:
  11183. @table @option
  11184. @item 0, send_frame
  11185. Output one frame for each frame.
  11186. @item 1, send_field
  11187. Output one frame for each field.
  11188. @item 2, send_frame_nospatial
  11189. Like @code{send_frame}, but it skips the spatial interlacing check.
  11190. @item 3, send_field_nospatial
  11191. Like @code{send_field}, but it skips the spatial interlacing check.
  11192. @end table
  11193. The default value is @code{send_frame}.
  11194. @item parity
  11195. The picture field parity assumed for the input interlaced video. It accepts one
  11196. of the following values:
  11197. @table @option
  11198. @item 0, tff
  11199. Assume the top field is first.
  11200. @item 1, bff
  11201. Assume the bottom field is first.
  11202. @item -1, auto
  11203. Enable automatic detection of field parity.
  11204. @end table
  11205. The default value is @code{auto}.
  11206. If the interlacing is unknown or the decoder does not export this information,
  11207. top field first will be assumed.
  11208. @item deint
  11209. Specify which frames to deinterlace. Accept one of the following
  11210. values:
  11211. @table @option
  11212. @item 0, all
  11213. Deinterlace all frames.
  11214. @item 1, interlaced
  11215. Only deinterlace frames marked as interlaced.
  11216. @end table
  11217. The default value is @code{all}.
  11218. @end table
  11219. @section zoompan
  11220. Apply Zoom & Pan effect.
  11221. This filter accepts the following options:
  11222. @table @option
  11223. @item zoom, z
  11224. Set the zoom expression. Default is 1.
  11225. @item x
  11226. @item y
  11227. Set the x and y expression. Default is 0.
  11228. @item d
  11229. Set the duration expression in number of frames.
  11230. This sets for how many number of frames effect will last for
  11231. single input image.
  11232. @item s
  11233. Set the output image size, default is 'hd720'.
  11234. @item fps
  11235. Set the output frame rate, default is '25'.
  11236. @end table
  11237. Each expression can contain the following constants:
  11238. @table @option
  11239. @item in_w, iw
  11240. Input width.
  11241. @item in_h, ih
  11242. Input height.
  11243. @item out_w, ow
  11244. Output width.
  11245. @item out_h, oh
  11246. Output height.
  11247. @item in
  11248. Input frame count.
  11249. @item on
  11250. Output frame count.
  11251. @item x
  11252. @item y
  11253. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11254. for current input frame.
  11255. @item px
  11256. @item py
  11257. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11258. not yet such frame (first input frame).
  11259. @item zoom
  11260. Last calculated zoom from 'z' expression for current input frame.
  11261. @item pzoom
  11262. Last calculated zoom of last output frame of previous input frame.
  11263. @item duration
  11264. Number of output frames for current input frame. Calculated from 'd' expression
  11265. for each input frame.
  11266. @item pduration
  11267. number of output frames created for previous input frame
  11268. @item a
  11269. Rational number: input width / input height
  11270. @item sar
  11271. sample aspect ratio
  11272. @item dar
  11273. display aspect ratio
  11274. @end table
  11275. @subsection Examples
  11276. @itemize
  11277. @item
  11278. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11279. @example
  11280. 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
  11281. @end example
  11282. @item
  11283. Zoom-in up to 1.5 and pan always at center of picture:
  11284. @example
  11285. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11286. @end example
  11287. @item
  11288. Same as above but without pausing:
  11289. @example
  11290. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11291. @end example
  11292. @end itemize
  11293. @section zscale
  11294. Scale (resize) the input video, using the z.lib library:
  11295. https://github.com/sekrit-twc/zimg.
  11296. The zscale filter forces the output display aspect ratio to be the same
  11297. as the input, by changing the output sample aspect ratio.
  11298. If the input image format is different from the format requested by
  11299. the next filter, the zscale filter will convert the input to the
  11300. requested format.
  11301. @subsection Options
  11302. The filter accepts the following options.
  11303. @table @option
  11304. @item width, w
  11305. @item height, h
  11306. Set the output video dimension expression. Default value is the input
  11307. dimension.
  11308. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11309. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11310. If one of the values is -1, the zscale filter will use a value that
  11311. maintains the aspect ratio of the input image, calculated from the
  11312. other specified dimension. If both of them are -1, the input size is
  11313. used
  11314. If one of the values is -n with n > 1, the zscale filter will also use a value
  11315. that maintains the aspect ratio of the input image, calculated from the other
  11316. specified dimension. After that it will, however, make sure that the calculated
  11317. dimension is divisible by n and adjust the value if necessary.
  11318. See below for the list of accepted constants for use in the dimension
  11319. expression.
  11320. @item size, s
  11321. Set the video size. For the syntax of this option, check the
  11322. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11323. @item dither, d
  11324. Set the dither type.
  11325. Possible values are:
  11326. @table @var
  11327. @item none
  11328. @item ordered
  11329. @item random
  11330. @item error_diffusion
  11331. @end table
  11332. Default is none.
  11333. @item filter, f
  11334. Set the resize filter type.
  11335. Possible values are:
  11336. @table @var
  11337. @item point
  11338. @item bilinear
  11339. @item bicubic
  11340. @item spline16
  11341. @item spline36
  11342. @item lanczos
  11343. @end table
  11344. Default is bilinear.
  11345. @item range, r
  11346. Set the color range.
  11347. Possible values are:
  11348. @table @var
  11349. @item input
  11350. @item limited
  11351. @item full
  11352. @end table
  11353. Default is same as input.
  11354. @item primaries, p
  11355. Set the color primaries.
  11356. Possible values are:
  11357. @table @var
  11358. @item input
  11359. @item 709
  11360. @item unspecified
  11361. @item 170m
  11362. @item 240m
  11363. @item 2020
  11364. @end table
  11365. Default is same as input.
  11366. @item transfer, t
  11367. Set the transfer characteristics.
  11368. Possible values are:
  11369. @table @var
  11370. @item input
  11371. @item 709
  11372. @item unspecified
  11373. @item 601
  11374. @item linear
  11375. @item 2020_10
  11376. @item 2020_12
  11377. @item smpte2084
  11378. @item iec61966-2-1
  11379. @item arib-std-b67
  11380. @end table
  11381. Default is same as input.
  11382. @item matrix, m
  11383. Set the colorspace matrix.
  11384. Possible value are:
  11385. @table @var
  11386. @item input
  11387. @item 709
  11388. @item unspecified
  11389. @item 470bg
  11390. @item 170m
  11391. @item 2020_ncl
  11392. @item 2020_cl
  11393. @end table
  11394. Default is same as input.
  11395. @item rangein, rin
  11396. Set the input color range.
  11397. Possible values are:
  11398. @table @var
  11399. @item input
  11400. @item limited
  11401. @item full
  11402. @end table
  11403. Default is same as input.
  11404. @item primariesin, pin
  11405. Set the input color primaries.
  11406. Possible values are:
  11407. @table @var
  11408. @item input
  11409. @item 709
  11410. @item unspecified
  11411. @item 170m
  11412. @item 240m
  11413. @item 2020
  11414. @end table
  11415. Default is same as input.
  11416. @item transferin, tin
  11417. Set the input transfer characteristics.
  11418. Possible values are:
  11419. @table @var
  11420. @item input
  11421. @item 709
  11422. @item unspecified
  11423. @item 601
  11424. @item linear
  11425. @item 2020_10
  11426. @item 2020_12
  11427. @end table
  11428. Default is same as input.
  11429. @item matrixin, min
  11430. Set the input colorspace matrix.
  11431. Possible value are:
  11432. @table @var
  11433. @item input
  11434. @item 709
  11435. @item unspecified
  11436. @item 470bg
  11437. @item 170m
  11438. @item 2020_ncl
  11439. @item 2020_cl
  11440. @end table
  11441. @item chromal, c
  11442. Set the output chroma location.
  11443. Possible values are:
  11444. @table @var
  11445. @item input
  11446. @item left
  11447. @item center
  11448. @item topleft
  11449. @item top
  11450. @item bottomleft
  11451. @item bottom
  11452. @end table
  11453. @item chromalin, cin
  11454. Set the input chroma location.
  11455. Possible values are:
  11456. @table @var
  11457. @item input
  11458. @item left
  11459. @item center
  11460. @item topleft
  11461. @item top
  11462. @item bottomleft
  11463. @item bottom
  11464. @end table
  11465. @item npl
  11466. Set the nominal peak luminance.
  11467. @end table
  11468. The values of the @option{w} and @option{h} options are expressions
  11469. containing the following constants:
  11470. @table @var
  11471. @item in_w
  11472. @item in_h
  11473. The input width and height
  11474. @item iw
  11475. @item ih
  11476. These are the same as @var{in_w} and @var{in_h}.
  11477. @item out_w
  11478. @item out_h
  11479. The output (scaled) width and height
  11480. @item ow
  11481. @item oh
  11482. These are the same as @var{out_w} and @var{out_h}
  11483. @item a
  11484. The same as @var{iw} / @var{ih}
  11485. @item sar
  11486. input sample aspect ratio
  11487. @item dar
  11488. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11489. @item hsub
  11490. @item vsub
  11491. horizontal and vertical input chroma subsample values. For example for the
  11492. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11493. @item ohsub
  11494. @item ovsub
  11495. horizontal and vertical output chroma subsample values. For example for the
  11496. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11497. @end table
  11498. @table @option
  11499. @end table
  11500. @c man end VIDEO FILTERS
  11501. @chapter Video Sources
  11502. @c man begin VIDEO SOURCES
  11503. Below is a description of the currently available video sources.
  11504. @section buffer
  11505. Buffer video frames, and make them available to the filter chain.
  11506. This source is mainly intended for a programmatic use, in particular
  11507. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11508. It accepts the following parameters:
  11509. @table @option
  11510. @item video_size
  11511. Specify the size (width and height) of the buffered video frames. For the
  11512. syntax of this option, check the
  11513. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11514. @item width
  11515. The input video width.
  11516. @item height
  11517. The input video height.
  11518. @item pix_fmt
  11519. A string representing the pixel format of the buffered video frames.
  11520. It may be a number corresponding to a pixel format, or a pixel format
  11521. name.
  11522. @item time_base
  11523. Specify the timebase assumed by the timestamps of the buffered frames.
  11524. @item frame_rate
  11525. Specify the frame rate expected for the video stream.
  11526. @item pixel_aspect, sar
  11527. The sample (pixel) aspect ratio of the input video.
  11528. @item sws_param
  11529. Specify the optional parameters to be used for the scale filter which
  11530. is automatically inserted when an input change is detected in the
  11531. input size or format.
  11532. @item hw_frames_ctx
  11533. When using a hardware pixel format, this should be a reference to an
  11534. AVHWFramesContext describing input frames.
  11535. @end table
  11536. For example:
  11537. @example
  11538. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11539. @end example
  11540. will instruct the source to accept video frames with size 320x240 and
  11541. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11542. square pixels (1:1 sample aspect ratio).
  11543. Since the pixel format with name "yuv410p" corresponds to the number 6
  11544. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11545. this example corresponds to:
  11546. @example
  11547. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11548. @end example
  11549. Alternatively, the options can be specified as a flat string, but this
  11550. syntax is deprecated:
  11551. @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}]
  11552. @section cellauto
  11553. Create a pattern generated by an elementary cellular automaton.
  11554. The initial state of the cellular automaton can be defined through the
  11555. @option{filename} and @option{pattern} options. If such options are
  11556. not specified an initial state is created randomly.
  11557. At each new frame a new row in the video is filled with the result of
  11558. the cellular automaton next generation. The behavior when the whole
  11559. frame is filled is defined by the @option{scroll} option.
  11560. This source accepts the following options:
  11561. @table @option
  11562. @item filename, f
  11563. Read the initial cellular automaton state, i.e. the starting row, from
  11564. the specified file.
  11565. In the file, each non-whitespace character is considered an alive
  11566. cell, a newline will terminate the row, and further characters in the
  11567. file will be ignored.
  11568. @item pattern, p
  11569. Read the initial cellular automaton state, i.e. the starting row, from
  11570. the specified string.
  11571. Each non-whitespace character in the string is considered an alive
  11572. cell, a newline will terminate the row, and further characters in the
  11573. string will be ignored.
  11574. @item rate, r
  11575. Set the video rate, that is the number of frames generated per second.
  11576. Default is 25.
  11577. @item random_fill_ratio, ratio
  11578. Set the random fill ratio for the initial cellular automaton row. It
  11579. is a floating point number value ranging from 0 to 1, defaults to
  11580. 1/PHI.
  11581. This option is ignored when a file or a pattern is specified.
  11582. @item random_seed, seed
  11583. Set the seed for filling randomly the initial row, must be an integer
  11584. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11585. set to -1, the filter will try to use a good random seed on a best
  11586. effort basis.
  11587. @item rule
  11588. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11589. Default value is 110.
  11590. @item size, s
  11591. Set the size of the output video. For the syntax of this option, check the
  11592. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11593. If @option{filename} or @option{pattern} is specified, the size is set
  11594. by default to the width of the specified initial state row, and the
  11595. height is set to @var{width} * PHI.
  11596. If @option{size} is set, it must contain the width of the specified
  11597. pattern string, and the specified pattern will be centered in the
  11598. larger row.
  11599. If a filename or a pattern string is not specified, the size value
  11600. defaults to "320x518" (used for a randomly generated initial state).
  11601. @item scroll
  11602. If set to 1, scroll the output upward when all the rows in the output
  11603. have been already filled. If set to 0, the new generated row will be
  11604. written over the top row just after the bottom row is filled.
  11605. Defaults to 1.
  11606. @item start_full, full
  11607. If set to 1, completely fill the output with generated rows before
  11608. outputting the first frame.
  11609. This is the default behavior, for disabling set the value to 0.
  11610. @item stitch
  11611. If set to 1, stitch the left and right row edges together.
  11612. This is the default behavior, for disabling set the value to 0.
  11613. @end table
  11614. @subsection Examples
  11615. @itemize
  11616. @item
  11617. Read the initial state from @file{pattern}, and specify an output of
  11618. size 200x400.
  11619. @example
  11620. cellauto=f=pattern:s=200x400
  11621. @end example
  11622. @item
  11623. Generate a random initial row with a width of 200 cells, with a fill
  11624. ratio of 2/3:
  11625. @example
  11626. cellauto=ratio=2/3:s=200x200
  11627. @end example
  11628. @item
  11629. Create a pattern generated by rule 18 starting by a single alive cell
  11630. centered on an initial row with width 100:
  11631. @example
  11632. cellauto=p=@@:s=100x400:full=0:rule=18
  11633. @end example
  11634. @item
  11635. Specify a more elaborated initial pattern:
  11636. @example
  11637. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11638. @end example
  11639. @end itemize
  11640. @anchor{coreimagesrc}
  11641. @section coreimagesrc
  11642. Video source generated on GPU using Apple's CoreImage API on OSX.
  11643. This video source is a specialized version of the @ref{coreimage} video filter.
  11644. Use a core image generator at the beginning of the applied filterchain to
  11645. generate the content.
  11646. The coreimagesrc video source accepts the following options:
  11647. @table @option
  11648. @item list_generators
  11649. List all available generators along with all their respective options as well as
  11650. possible minimum and maximum values along with the default values.
  11651. @example
  11652. list_generators=true
  11653. @end example
  11654. @item size, s
  11655. Specify the size of the sourced video. For the syntax of this option, check the
  11656. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11657. The default value is @code{320x240}.
  11658. @item rate, r
  11659. Specify the frame rate of the sourced video, as the number of frames
  11660. generated per second. It has to be a string in the format
  11661. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11662. number or a valid video frame rate abbreviation. The default value is
  11663. "25".
  11664. @item sar
  11665. Set the sample aspect ratio of the sourced video.
  11666. @item duration, d
  11667. Set the duration of the sourced video. See
  11668. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11669. for the accepted syntax.
  11670. If not specified, or the expressed duration is negative, the video is
  11671. supposed to be generated forever.
  11672. @end table
  11673. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11674. A complete filterchain can be used for further processing of the
  11675. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11676. and examples for details.
  11677. @subsection Examples
  11678. @itemize
  11679. @item
  11680. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11681. given as complete and escaped command-line for Apple's standard bash shell:
  11682. @example
  11683. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11684. @end example
  11685. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11686. need for a nullsrc video source.
  11687. @end itemize
  11688. @section mandelbrot
  11689. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11690. point specified with @var{start_x} and @var{start_y}.
  11691. This source accepts the following options:
  11692. @table @option
  11693. @item end_pts
  11694. Set the terminal pts value. Default value is 400.
  11695. @item end_scale
  11696. Set the terminal scale value.
  11697. Must be a floating point value. Default value is 0.3.
  11698. @item inner
  11699. Set the inner coloring mode, that is the algorithm used to draw the
  11700. Mandelbrot fractal internal region.
  11701. It shall assume one of the following values:
  11702. @table @option
  11703. @item black
  11704. Set black mode.
  11705. @item convergence
  11706. Show time until convergence.
  11707. @item mincol
  11708. Set color based on point closest to the origin of the iterations.
  11709. @item period
  11710. Set period mode.
  11711. @end table
  11712. Default value is @var{mincol}.
  11713. @item bailout
  11714. Set the bailout value. Default value is 10.0.
  11715. @item maxiter
  11716. Set the maximum of iterations performed by the rendering
  11717. algorithm. Default value is 7189.
  11718. @item outer
  11719. Set outer coloring mode.
  11720. It shall assume one of following values:
  11721. @table @option
  11722. @item iteration_count
  11723. Set iteration cound mode.
  11724. @item normalized_iteration_count
  11725. set normalized iteration count mode.
  11726. @end table
  11727. Default value is @var{normalized_iteration_count}.
  11728. @item rate, r
  11729. Set frame rate, expressed as number of frames per second. Default
  11730. value is "25".
  11731. @item size, s
  11732. Set frame size. For the syntax of this option, check the "Video
  11733. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11734. @item start_scale
  11735. Set the initial scale value. Default value is 3.0.
  11736. @item start_x
  11737. Set the initial x position. Must be a floating point value between
  11738. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11739. @item start_y
  11740. Set the initial y position. Must be a floating point value between
  11741. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11742. @end table
  11743. @section mptestsrc
  11744. Generate various test patterns, as generated by the MPlayer test filter.
  11745. The size of the generated video is fixed, and is 256x256.
  11746. This source is useful in particular for testing encoding features.
  11747. This source accepts the following options:
  11748. @table @option
  11749. @item rate, r
  11750. Specify the frame rate of the sourced video, as the number of frames
  11751. generated per second. It has to be a string in the format
  11752. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11753. number or a valid video frame rate abbreviation. The default value is
  11754. "25".
  11755. @item duration, d
  11756. Set the duration of the sourced video. See
  11757. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11758. for the accepted syntax.
  11759. If not specified, or the expressed duration is negative, the video is
  11760. supposed to be generated forever.
  11761. @item test, t
  11762. Set the number or the name of the test to perform. Supported tests are:
  11763. @table @option
  11764. @item dc_luma
  11765. @item dc_chroma
  11766. @item freq_luma
  11767. @item freq_chroma
  11768. @item amp_luma
  11769. @item amp_chroma
  11770. @item cbp
  11771. @item mv
  11772. @item ring1
  11773. @item ring2
  11774. @item all
  11775. @end table
  11776. Default value is "all", which will cycle through the list of all tests.
  11777. @end table
  11778. Some examples:
  11779. @example
  11780. mptestsrc=t=dc_luma
  11781. @end example
  11782. will generate a "dc_luma" test pattern.
  11783. @section frei0r_src
  11784. Provide a frei0r source.
  11785. To enable compilation of this filter you need to install the frei0r
  11786. header and configure FFmpeg with @code{--enable-frei0r}.
  11787. This source accepts the following parameters:
  11788. @table @option
  11789. @item size
  11790. The size of the video to generate. For the syntax of this option, check the
  11791. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11792. @item framerate
  11793. The framerate of the generated video. It may be a string of the form
  11794. @var{num}/@var{den} or a frame rate abbreviation.
  11795. @item filter_name
  11796. The name to the frei0r source to load. For more information regarding frei0r and
  11797. how to set the parameters, read the @ref{frei0r} section in the video filters
  11798. documentation.
  11799. @item filter_params
  11800. A '|'-separated list of parameters to pass to the frei0r source.
  11801. @end table
  11802. For example, to generate a frei0r partik0l source with size 200x200
  11803. and frame rate 10 which is overlaid on the overlay filter main input:
  11804. @example
  11805. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11806. @end example
  11807. @section life
  11808. Generate a life pattern.
  11809. This source is based on a generalization of John Conway's life game.
  11810. The sourced input represents a life grid, each pixel represents a cell
  11811. which can be in one of two possible states, alive or dead. Every cell
  11812. interacts with its eight neighbours, which are the cells that are
  11813. horizontally, vertically, or diagonally adjacent.
  11814. At each interaction the grid evolves according to the adopted rule,
  11815. which specifies the number of neighbor alive cells which will make a
  11816. cell stay alive or born. The @option{rule} option allows one to specify
  11817. the rule to adopt.
  11818. This source accepts the following options:
  11819. @table @option
  11820. @item filename, f
  11821. Set the file from which to read the initial grid state. In the file,
  11822. each non-whitespace character is considered an alive cell, and newline
  11823. is used to delimit the end of each row.
  11824. If this option is not specified, the initial grid is generated
  11825. randomly.
  11826. @item rate, r
  11827. Set the video rate, that is the number of frames generated per second.
  11828. Default is 25.
  11829. @item random_fill_ratio, ratio
  11830. Set the random fill ratio for the initial random grid. It is a
  11831. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11832. It is ignored when a file is specified.
  11833. @item random_seed, seed
  11834. Set the seed for filling the initial random grid, must be an integer
  11835. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11836. set to -1, the filter will try to use a good random seed on a best
  11837. effort basis.
  11838. @item rule
  11839. Set the life rule.
  11840. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11841. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11842. @var{NS} specifies the number of alive neighbor cells which make a
  11843. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11844. which make a dead cell to become alive (i.e. to "born").
  11845. "s" and "b" can be used in place of "S" and "B", respectively.
  11846. Alternatively a rule can be specified by an 18-bits integer. The 9
  11847. high order bits are used to encode the next cell state if it is alive
  11848. for each number of neighbor alive cells, the low order bits specify
  11849. the rule for "borning" new cells. Higher order bits encode for an
  11850. higher number of neighbor cells.
  11851. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11852. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11853. Default value is "S23/B3", which is the original Conway's game of life
  11854. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11855. cells, and will born a new cell if there are three alive cells around
  11856. a dead cell.
  11857. @item size, s
  11858. Set the size of the output video. For the syntax of this option, check the
  11859. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11860. If @option{filename} is specified, the size is set by default to the
  11861. same size of the input file. If @option{size} is set, it must contain
  11862. the size specified in the input file, and the initial grid defined in
  11863. that file is centered in the larger resulting area.
  11864. If a filename is not specified, the size value defaults to "320x240"
  11865. (used for a randomly generated initial grid).
  11866. @item stitch
  11867. If set to 1, stitch the left and right grid edges together, and the
  11868. top and bottom edges also. Defaults to 1.
  11869. @item mold
  11870. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11871. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11872. value from 0 to 255.
  11873. @item life_color
  11874. Set the color of living (or new born) cells.
  11875. @item death_color
  11876. Set the color of dead cells. If @option{mold} is set, this is the first color
  11877. used to represent a dead cell.
  11878. @item mold_color
  11879. Set mold color, for definitely dead and moldy cells.
  11880. For the syntax of these 3 color options, check the "Color" section in the
  11881. ffmpeg-utils manual.
  11882. @end table
  11883. @subsection Examples
  11884. @itemize
  11885. @item
  11886. Read a grid from @file{pattern}, and center it on a grid of size
  11887. 300x300 pixels:
  11888. @example
  11889. life=f=pattern:s=300x300
  11890. @end example
  11891. @item
  11892. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11893. @example
  11894. life=ratio=2/3:s=200x200
  11895. @end example
  11896. @item
  11897. Specify a custom rule for evolving a randomly generated grid:
  11898. @example
  11899. life=rule=S14/B34
  11900. @end example
  11901. @item
  11902. Full example with slow death effect (mold) using @command{ffplay}:
  11903. @example
  11904. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11905. @end example
  11906. @end itemize
  11907. @anchor{allrgb}
  11908. @anchor{allyuv}
  11909. @anchor{color}
  11910. @anchor{haldclutsrc}
  11911. @anchor{nullsrc}
  11912. @anchor{rgbtestsrc}
  11913. @anchor{smptebars}
  11914. @anchor{smptehdbars}
  11915. @anchor{testsrc}
  11916. @anchor{testsrc2}
  11917. @anchor{yuvtestsrc}
  11918. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  11919. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11920. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11921. The @code{color} source provides an uniformly colored input.
  11922. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11923. @ref{haldclut} filter.
  11924. The @code{nullsrc} source returns unprocessed video frames. It is
  11925. mainly useful to be employed in analysis / debugging tools, or as the
  11926. source for filters which ignore the input data.
  11927. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11928. detecting RGB vs BGR issues. You should see a red, green and blue
  11929. stripe from top to bottom.
  11930. The @code{smptebars} source generates a color bars pattern, based on
  11931. the SMPTE Engineering Guideline EG 1-1990.
  11932. The @code{smptehdbars} source generates a color bars pattern, based on
  11933. the SMPTE RP 219-2002.
  11934. The @code{testsrc} source generates a test video pattern, showing a
  11935. color pattern, a scrolling gradient and a timestamp. This is mainly
  11936. intended for testing purposes.
  11937. The @code{testsrc2} source is similar to testsrc, but supports more
  11938. pixel formats instead of just @code{rgb24}. This allows using it as an
  11939. input for other tests without requiring a format conversion.
  11940. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  11941. see a y, cb and cr stripe from top to bottom.
  11942. The sources accept the following parameters:
  11943. @table @option
  11944. @item color, c
  11945. Specify the color of the source, only available in the @code{color}
  11946. source. For the syntax of this option, check the "Color" section in the
  11947. ffmpeg-utils manual.
  11948. @item level
  11949. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11950. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11951. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11952. coded on a @code{1/(N*N)} scale.
  11953. @item size, s
  11954. Specify the size of the sourced video. For the syntax of this option, check the
  11955. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11956. The default value is @code{320x240}.
  11957. This option is not available with the @code{haldclutsrc} filter.
  11958. @item rate, r
  11959. Specify the frame rate of the sourced video, as the number of frames
  11960. generated per second. It has to be a string in the format
  11961. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11962. number or a valid video frame rate abbreviation. The default value is
  11963. "25".
  11964. @item sar
  11965. Set the sample aspect ratio of the sourced video.
  11966. @item duration, d
  11967. Set the duration of the sourced video. See
  11968. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11969. for the accepted syntax.
  11970. If not specified, or the expressed duration is negative, the video is
  11971. supposed to be generated forever.
  11972. @item decimals, n
  11973. Set the number of decimals to show in the timestamp, only available in the
  11974. @code{testsrc} source.
  11975. The displayed timestamp value will correspond to the original
  11976. timestamp value multiplied by the power of 10 of the specified
  11977. value. Default value is 0.
  11978. @end table
  11979. For example the following:
  11980. @example
  11981. testsrc=duration=5.3:size=qcif:rate=10
  11982. @end example
  11983. will generate a video with a duration of 5.3 seconds, with size
  11984. 176x144 and a frame rate of 10 frames per second.
  11985. The following graph description will generate a red source
  11986. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11987. frames per second.
  11988. @example
  11989. color=c=red@@0.2:s=qcif:r=10
  11990. @end example
  11991. If the input content is to be ignored, @code{nullsrc} can be used. The
  11992. following command generates noise in the luminance plane by employing
  11993. the @code{geq} filter:
  11994. @example
  11995. nullsrc=s=256x256, geq=random(1)*255:128:128
  11996. @end example
  11997. @subsection Commands
  11998. The @code{color} source supports the following commands:
  11999. @table @option
  12000. @item c, color
  12001. Set the color of the created image. Accepts the same syntax of the
  12002. corresponding @option{color} option.
  12003. @end table
  12004. @c man end VIDEO SOURCES
  12005. @chapter Video Sinks
  12006. @c man begin VIDEO SINKS
  12007. Below is a description of the currently available video sinks.
  12008. @section buffersink
  12009. Buffer video frames, and make them available to the end of the filter
  12010. graph.
  12011. This sink is mainly intended for programmatic use, in particular
  12012. through the interface defined in @file{libavfilter/buffersink.h}
  12013. or the options system.
  12014. It accepts a pointer to an AVBufferSinkContext structure, which
  12015. defines the incoming buffers' formats, to be passed as the opaque
  12016. parameter to @code{avfilter_init_filter} for initialization.
  12017. @section nullsink
  12018. Null video sink: do absolutely nothing with the input video. It is
  12019. mainly useful as a template and for use in analysis / debugging
  12020. tools.
  12021. @c man end VIDEO SINKS
  12022. @chapter Multimedia Filters
  12023. @c man begin MULTIMEDIA FILTERS
  12024. Below is a description of the currently available multimedia filters.
  12025. @section abitscope
  12026. Convert input audio to a video output, displaying the audio bit scope.
  12027. The filter accepts the following options:
  12028. @table @option
  12029. @item rate, r
  12030. Set frame rate, expressed as number of frames per second. Default
  12031. value is "25".
  12032. @item size, s
  12033. Specify the video size for the output. For the syntax of this option, check the
  12034. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12035. Default value is @code{1024x256}.
  12036. @item colors
  12037. Specify list of colors separated by space or by '|' which will be used to
  12038. draw channels. Unrecognized or missing colors will be replaced
  12039. by white color.
  12040. @end table
  12041. @section ahistogram
  12042. Convert input audio to a video output, displaying the volume histogram.
  12043. The filter accepts the following options:
  12044. @table @option
  12045. @item dmode
  12046. Specify how histogram is calculated.
  12047. It accepts the following values:
  12048. @table @samp
  12049. @item single
  12050. Use single histogram for all channels.
  12051. @item separate
  12052. Use separate histogram for each channel.
  12053. @end table
  12054. Default is @code{single}.
  12055. @item rate, r
  12056. Set frame rate, expressed as number of frames per second. Default
  12057. value is "25".
  12058. @item size, s
  12059. Specify the video size for the output. For the syntax of this option, check the
  12060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12061. Default value is @code{hd720}.
  12062. @item scale
  12063. Set display scale.
  12064. It accepts the following values:
  12065. @table @samp
  12066. @item log
  12067. logarithmic
  12068. @item sqrt
  12069. square root
  12070. @item cbrt
  12071. cubic root
  12072. @item lin
  12073. linear
  12074. @item rlog
  12075. reverse logarithmic
  12076. @end table
  12077. Default is @code{log}.
  12078. @item ascale
  12079. Set amplitude scale.
  12080. It accepts the following values:
  12081. @table @samp
  12082. @item log
  12083. logarithmic
  12084. @item lin
  12085. linear
  12086. @end table
  12087. Default is @code{log}.
  12088. @item acount
  12089. Set how much frames to accumulate in histogram.
  12090. Defauls is 1. Setting this to -1 accumulates all frames.
  12091. @item rheight
  12092. Set histogram ratio of window height.
  12093. @item slide
  12094. Set sonogram sliding.
  12095. It accepts the following values:
  12096. @table @samp
  12097. @item replace
  12098. replace old rows with new ones.
  12099. @item scroll
  12100. scroll from top to bottom.
  12101. @end table
  12102. Default is @code{replace}.
  12103. @end table
  12104. @section aphasemeter
  12105. Convert input audio to a video output, displaying the audio phase.
  12106. The filter accepts the following options:
  12107. @table @option
  12108. @item rate, r
  12109. Set the output frame rate. Default value is @code{25}.
  12110. @item size, s
  12111. Set the video size for the output. For the syntax of this option, check the
  12112. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12113. Default value is @code{800x400}.
  12114. @item rc
  12115. @item gc
  12116. @item bc
  12117. Specify the red, green, blue contrast. Default values are @code{2},
  12118. @code{7} and @code{1}.
  12119. Allowed range is @code{[0, 255]}.
  12120. @item mpc
  12121. Set color which will be used for drawing median phase. If color is
  12122. @code{none} which is default, no median phase value will be drawn.
  12123. @item video
  12124. Enable video output. Default is enabled.
  12125. @end table
  12126. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12127. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12128. The @code{-1} means left and right channels are completely out of phase and
  12129. @code{1} means channels are in phase.
  12130. @section avectorscope
  12131. Convert input audio to a video output, representing the audio vector
  12132. scope.
  12133. The filter is used to measure the difference between channels of stereo
  12134. audio stream. A monoaural signal, consisting of identical left and right
  12135. signal, results in straight vertical line. Any stereo separation is visible
  12136. as a deviation from this line, creating a Lissajous figure.
  12137. If the straight (or deviation from it) but horizontal line appears this
  12138. indicates that the left and right channels are out of phase.
  12139. The filter accepts the following options:
  12140. @table @option
  12141. @item mode, m
  12142. Set the vectorscope mode.
  12143. Available values are:
  12144. @table @samp
  12145. @item lissajous
  12146. Lissajous rotated by 45 degrees.
  12147. @item lissajous_xy
  12148. Same as above but not rotated.
  12149. @item polar
  12150. Shape resembling half of circle.
  12151. @end table
  12152. Default value is @samp{lissajous}.
  12153. @item size, s
  12154. Set the video size for the output. For the syntax of this option, check the
  12155. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12156. Default value is @code{400x400}.
  12157. @item rate, r
  12158. Set the output frame rate. Default value is @code{25}.
  12159. @item rc
  12160. @item gc
  12161. @item bc
  12162. @item ac
  12163. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12164. @code{160}, @code{80} and @code{255}.
  12165. Allowed range is @code{[0, 255]}.
  12166. @item rf
  12167. @item gf
  12168. @item bf
  12169. @item af
  12170. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12171. @code{10}, @code{5} and @code{5}.
  12172. Allowed range is @code{[0, 255]}.
  12173. @item zoom
  12174. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12175. @item draw
  12176. Set the vectorscope drawing mode.
  12177. Available values are:
  12178. @table @samp
  12179. @item dot
  12180. Draw dot for each sample.
  12181. @item line
  12182. Draw line between previous and current sample.
  12183. @end table
  12184. Default value is @samp{dot}.
  12185. @item scale
  12186. Specify amplitude scale of audio samples.
  12187. Available values are:
  12188. @table @samp
  12189. @item lin
  12190. Linear.
  12191. @item sqrt
  12192. Square root.
  12193. @item cbrt
  12194. Cubic root.
  12195. @item log
  12196. Logarithmic.
  12197. @end table
  12198. @end table
  12199. @subsection Examples
  12200. @itemize
  12201. @item
  12202. Complete example using @command{ffplay}:
  12203. @example
  12204. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12205. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12206. @end example
  12207. @end itemize
  12208. @section bench, abench
  12209. Benchmark part of a filtergraph.
  12210. The filter accepts the following options:
  12211. @table @option
  12212. @item action
  12213. Start or stop a timer.
  12214. Available values are:
  12215. @table @samp
  12216. @item start
  12217. Get the current time, set it as frame metadata (using the key
  12218. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12219. @item stop
  12220. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12221. the input frame metadata to get the time difference. Time difference, average,
  12222. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12223. @code{min}) are then printed. The timestamps are expressed in seconds.
  12224. @end table
  12225. @end table
  12226. @subsection Examples
  12227. @itemize
  12228. @item
  12229. Benchmark @ref{selectivecolor} filter:
  12230. @example
  12231. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12232. @end example
  12233. @end itemize
  12234. @section concat
  12235. Concatenate audio and video streams, joining them together one after the
  12236. other.
  12237. The filter works on segments of synchronized video and audio streams. All
  12238. segments must have the same number of streams of each type, and that will
  12239. also be the number of streams at output.
  12240. The filter accepts the following options:
  12241. @table @option
  12242. @item n
  12243. Set the number of segments. Default is 2.
  12244. @item v
  12245. Set the number of output video streams, that is also the number of video
  12246. streams in each segment. Default is 1.
  12247. @item a
  12248. Set the number of output audio streams, that is also the number of audio
  12249. streams in each segment. Default is 0.
  12250. @item unsafe
  12251. Activate unsafe mode: do not fail if segments have a different format.
  12252. @end table
  12253. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12254. @var{a} audio outputs.
  12255. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12256. segment, in the same order as the outputs, then the inputs for the second
  12257. segment, etc.
  12258. Related streams do not always have exactly the same duration, for various
  12259. reasons including codec frame size or sloppy authoring. For that reason,
  12260. related synchronized streams (e.g. a video and its audio track) should be
  12261. concatenated at once. The concat filter will use the duration of the longest
  12262. stream in each segment (except the last one), and if necessary pad shorter
  12263. audio streams with silence.
  12264. For this filter to work correctly, all segments must start at timestamp 0.
  12265. All corresponding streams must have the same parameters in all segments; the
  12266. filtering system will automatically select a common pixel format for video
  12267. streams, and a common sample format, sample rate and channel layout for
  12268. audio streams, but other settings, such as resolution, must be converted
  12269. explicitly by the user.
  12270. Different frame rates are acceptable but will result in variable frame rate
  12271. at output; be sure to configure the output file to handle it.
  12272. @subsection Examples
  12273. @itemize
  12274. @item
  12275. Concatenate an opening, an episode and an ending, all in bilingual version
  12276. (video in stream 0, audio in streams 1 and 2):
  12277. @example
  12278. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12279. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12280. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12281. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12282. @end example
  12283. @item
  12284. Concatenate two parts, handling audio and video separately, using the
  12285. (a)movie sources, and adjusting the resolution:
  12286. @example
  12287. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12288. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12289. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12290. @end example
  12291. Note that a desync will happen at the stitch if the audio and video streams
  12292. do not have exactly the same duration in the first file.
  12293. @end itemize
  12294. @section drawgraph, adrawgraph
  12295. Draw a graph using input video or audio metadata.
  12296. It accepts the following parameters:
  12297. @table @option
  12298. @item m1
  12299. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12300. @item fg1
  12301. Set 1st foreground color expression.
  12302. @item m2
  12303. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12304. @item fg2
  12305. Set 2nd foreground color expression.
  12306. @item m3
  12307. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12308. @item fg3
  12309. Set 3rd foreground color expression.
  12310. @item m4
  12311. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12312. @item fg4
  12313. Set 4th foreground color expression.
  12314. @item min
  12315. Set minimal value of metadata value.
  12316. @item max
  12317. Set maximal value of metadata value.
  12318. @item bg
  12319. Set graph background color. Default is white.
  12320. @item mode
  12321. Set graph mode.
  12322. Available values for mode is:
  12323. @table @samp
  12324. @item bar
  12325. @item dot
  12326. @item line
  12327. @end table
  12328. Default is @code{line}.
  12329. @item slide
  12330. Set slide mode.
  12331. Available values for slide is:
  12332. @table @samp
  12333. @item frame
  12334. Draw new frame when right border is reached.
  12335. @item replace
  12336. Replace old columns with new ones.
  12337. @item scroll
  12338. Scroll from right to left.
  12339. @item rscroll
  12340. Scroll from left to right.
  12341. @item picture
  12342. Draw single picture.
  12343. @end table
  12344. Default is @code{frame}.
  12345. @item size
  12346. Set size of graph video. For the syntax of this option, check the
  12347. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12348. The default value is @code{900x256}.
  12349. The foreground color expressions can use the following variables:
  12350. @table @option
  12351. @item MIN
  12352. Minimal value of metadata value.
  12353. @item MAX
  12354. Maximal value of metadata value.
  12355. @item VAL
  12356. Current metadata key value.
  12357. @end table
  12358. The color is defined as 0xAABBGGRR.
  12359. @end table
  12360. Example using metadata from @ref{signalstats} filter:
  12361. @example
  12362. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12363. @end example
  12364. Example using metadata from @ref{ebur128} filter:
  12365. @example
  12366. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12367. @end example
  12368. @anchor{ebur128}
  12369. @section ebur128
  12370. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12371. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12372. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12373. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12374. The filter also has a video output (see the @var{video} option) with a real
  12375. time graph to observe the loudness evolution. The graphic contains the logged
  12376. message mentioned above, so it is not printed anymore when this option is set,
  12377. unless the verbose logging is set. The main graphing area contains the
  12378. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12379. the momentary loudness (400 milliseconds).
  12380. More information about the Loudness Recommendation EBU R128 on
  12381. @url{http://tech.ebu.ch/loudness}.
  12382. The filter accepts the following options:
  12383. @table @option
  12384. @item video
  12385. Activate the video output. The audio stream is passed unchanged whether this
  12386. option is set or no. The video stream will be the first output stream if
  12387. activated. Default is @code{0}.
  12388. @item size
  12389. Set the video size. This option is for video only. For the syntax of this
  12390. option, check the
  12391. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12392. Default and minimum resolution is @code{640x480}.
  12393. @item meter
  12394. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12395. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12396. other integer value between this range is allowed.
  12397. @item metadata
  12398. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12399. into 100ms output frames, each of them containing various loudness information
  12400. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12401. Default is @code{0}.
  12402. @item framelog
  12403. Force the frame logging level.
  12404. Available values are:
  12405. @table @samp
  12406. @item info
  12407. information logging level
  12408. @item verbose
  12409. verbose logging level
  12410. @end table
  12411. By default, the logging level is set to @var{info}. If the @option{video} or
  12412. the @option{metadata} options are set, it switches to @var{verbose}.
  12413. @item peak
  12414. Set peak mode(s).
  12415. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12416. values are:
  12417. @table @samp
  12418. @item none
  12419. Disable any peak mode (default).
  12420. @item sample
  12421. Enable sample-peak mode.
  12422. Simple peak mode looking for the higher sample value. It logs a message
  12423. for sample-peak (identified by @code{SPK}).
  12424. @item true
  12425. Enable true-peak mode.
  12426. If enabled, the peak lookup is done on an over-sampled version of the input
  12427. stream for better peak accuracy. It logs a message for true-peak.
  12428. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12429. This mode requires a build with @code{libswresample}.
  12430. @end table
  12431. @item dualmono
  12432. Treat mono input files as "dual mono". If a mono file is intended for playback
  12433. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12434. If set to @code{true}, this option will compensate for this effect.
  12435. Multi-channel input files are not affected by this option.
  12436. @item panlaw
  12437. Set a specific pan law to be used for the measurement of dual mono files.
  12438. This parameter is optional, and has a default value of -3.01dB.
  12439. @end table
  12440. @subsection Examples
  12441. @itemize
  12442. @item
  12443. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12444. @example
  12445. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12446. @end example
  12447. @item
  12448. Run an analysis with @command{ffmpeg}:
  12449. @example
  12450. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12451. @end example
  12452. @end itemize
  12453. @section interleave, ainterleave
  12454. Temporally interleave frames from several inputs.
  12455. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12456. These filters read frames from several inputs and send the oldest
  12457. queued frame to the output.
  12458. Input streams must have well defined, monotonically increasing frame
  12459. timestamp values.
  12460. In order to submit one frame to output, these filters need to enqueue
  12461. at least one frame for each input, so they cannot work in case one
  12462. input is not yet terminated and will not receive incoming frames.
  12463. For example consider the case when one input is a @code{select} filter
  12464. which always drops input frames. The @code{interleave} filter will keep
  12465. reading from that input, but it will never be able to send new frames
  12466. to output until the input sends an end-of-stream signal.
  12467. Also, depending on inputs synchronization, the filters will drop
  12468. frames in case one input receives more frames than the other ones, and
  12469. the queue is already filled.
  12470. These filters accept the following options:
  12471. @table @option
  12472. @item nb_inputs, n
  12473. Set the number of different inputs, it is 2 by default.
  12474. @end table
  12475. @subsection Examples
  12476. @itemize
  12477. @item
  12478. Interleave frames belonging to different streams using @command{ffmpeg}:
  12479. @example
  12480. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12481. @end example
  12482. @item
  12483. Add flickering blur effect:
  12484. @example
  12485. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12486. @end example
  12487. @end itemize
  12488. @section metadata, ametadata
  12489. Manipulate frame metadata.
  12490. This filter accepts the following options:
  12491. @table @option
  12492. @item mode
  12493. Set mode of operation of the filter.
  12494. Can be one of the following:
  12495. @table @samp
  12496. @item select
  12497. If both @code{value} and @code{key} is set, select frames
  12498. which have such metadata. If only @code{key} is set, select
  12499. every frame that has such key in metadata.
  12500. @item add
  12501. Add new metadata @code{key} and @code{value}. If key is already available
  12502. do nothing.
  12503. @item modify
  12504. Modify value of already present key.
  12505. @item delete
  12506. If @code{value} is set, delete only keys that have such value.
  12507. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12508. the frame.
  12509. @item print
  12510. Print key and its value if metadata was found. If @code{key} is not set print all
  12511. metadata values available in frame.
  12512. @end table
  12513. @item key
  12514. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12515. @item value
  12516. Set metadata value which will be used. This option is mandatory for
  12517. @code{modify} and @code{add} mode.
  12518. @item function
  12519. Which function to use when comparing metadata value and @code{value}.
  12520. Can be one of following:
  12521. @table @samp
  12522. @item same_str
  12523. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12524. @item starts_with
  12525. Values are interpreted as strings, returns true if metadata value starts with
  12526. the @code{value} option string.
  12527. @item less
  12528. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12529. @item equal
  12530. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12531. @item greater
  12532. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12533. @item expr
  12534. Values are interpreted as floats, returns true if expression from option @code{expr}
  12535. evaluates to true.
  12536. @end table
  12537. @item expr
  12538. Set expression which is used when @code{function} is set to @code{expr}.
  12539. The expression is evaluated through the eval API and can contain the following
  12540. constants:
  12541. @table @option
  12542. @item VALUE1
  12543. Float representation of @code{value} from metadata key.
  12544. @item VALUE2
  12545. Float representation of @code{value} as supplied by user in @code{value} option.
  12546. @end table
  12547. @item file
  12548. If specified in @code{print} mode, output is written to the named file. Instead of
  12549. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12550. for standard output. If @code{file} option is not set, output is written to the log
  12551. with AV_LOG_INFO loglevel.
  12552. @end table
  12553. @subsection Examples
  12554. @itemize
  12555. @item
  12556. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12557. between 0 and 1.
  12558. @example
  12559. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12560. @end example
  12561. @item
  12562. Print silencedetect output to file @file{metadata.txt}.
  12563. @example
  12564. silencedetect,ametadata=mode=print:file=metadata.txt
  12565. @end example
  12566. @item
  12567. Direct all metadata to a pipe with file descriptor 4.
  12568. @example
  12569. metadata=mode=print:file='pipe\:4'
  12570. @end example
  12571. @end itemize
  12572. @section perms, aperms
  12573. Set read/write permissions for the output frames.
  12574. These filters are mainly aimed at developers to test direct path in the
  12575. following filter in the filtergraph.
  12576. The filters accept the following options:
  12577. @table @option
  12578. @item mode
  12579. Select the permissions mode.
  12580. It accepts the following values:
  12581. @table @samp
  12582. @item none
  12583. Do nothing. This is the default.
  12584. @item ro
  12585. Set all the output frames read-only.
  12586. @item rw
  12587. Set all the output frames directly writable.
  12588. @item toggle
  12589. Make the frame read-only if writable, and writable if read-only.
  12590. @item random
  12591. Set each output frame read-only or writable randomly.
  12592. @end table
  12593. @item seed
  12594. Set the seed for the @var{random} mode, must be an integer included between
  12595. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12596. @code{-1}, the filter will try to use a good random seed on a best effort
  12597. basis.
  12598. @end table
  12599. Note: in case of auto-inserted filter between the permission filter and the
  12600. following one, the permission might not be received as expected in that
  12601. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12602. perms/aperms filter can avoid this problem.
  12603. @section realtime, arealtime
  12604. Slow down filtering to match real time approximatively.
  12605. These filters will pause the filtering for a variable amount of time to
  12606. match the output rate with the input timestamps.
  12607. They are similar to the @option{re} option to @code{ffmpeg}.
  12608. They accept the following options:
  12609. @table @option
  12610. @item limit
  12611. Time limit for the pauses. Any pause longer than that will be considered
  12612. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12613. @end table
  12614. @anchor{select}
  12615. @section select, aselect
  12616. Select frames to pass in output.
  12617. This filter accepts the following options:
  12618. @table @option
  12619. @item expr, e
  12620. Set expression, which is evaluated for each input frame.
  12621. If the expression is evaluated to zero, the frame is discarded.
  12622. If the evaluation result is negative or NaN, the frame is sent to the
  12623. first output; otherwise it is sent to the output with index
  12624. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12625. For example a value of @code{1.2} corresponds to the output with index
  12626. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12627. @item outputs, n
  12628. Set the number of outputs. The output to which to send the selected
  12629. frame is based on the result of the evaluation. Default value is 1.
  12630. @end table
  12631. The expression can contain the following constants:
  12632. @table @option
  12633. @item n
  12634. The (sequential) number of the filtered frame, starting from 0.
  12635. @item selected_n
  12636. The (sequential) number of the selected frame, starting from 0.
  12637. @item prev_selected_n
  12638. The sequential number of the last selected frame. It's NAN if undefined.
  12639. @item TB
  12640. The timebase of the input timestamps.
  12641. @item pts
  12642. The PTS (Presentation TimeStamp) of the filtered video frame,
  12643. expressed in @var{TB} units. It's NAN if undefined.
  12644. @item t
  12645. The PTS of the filtered video frame,
  12646. expressed in seconds. It's NAN if undefined.
  12647. @item prev_pts
  12648. The PTS of the previously filtered video frame. It's NAN if undefined.
  12649. @item prev_selected_pts
  12650. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12651. @item prev_selected_t
  12652. The PTS of the last previously selected video frame. It's NAN if undefined.
  12653. @item start_pts
  12654. The PTS of the first video frame in the video. It's NAN if undefined.
  12655. @item start_t
  12656. The time of the first video frame in the video. It's NAN if undefined.
  12657. @item pict_type @emph{(video only)}
  12658. The type of the filtered frame. It can assume one of the following
  12659. values:
  12660. @table @option
  12661. @item I
  12662. @item P
  12663. @item B
  12664. @item S
  12665. @item SI
  12666. @item SP
  12667. @item BI
  12668. @end table
  12669. @item interlace_type @emph{(video only)}
  12670. The frame interlace type. It can assume one of the following values:
  12671. @table @option
  12672. @item PROGRESSIVE
  12673. The frame is progressive (not interlaced).
  12674. @item TOPFIRST
  12675. The frame is top-field-first.
  12676. @item BOTTOMFIRST
  12677. The frame is bottom-field-first.
  12678. @end table
  12679. @item consumed_sample_n @emph{(audio only)}
  12680. the number of selected samples before the current frame
  12681. @item samples_n @emph{(audio only)}
  12682. the number of samples in the current frame
  12683. @item sample_rate @emph{(audio only)}
  12684. the input sample rate
  12685. @item key
  12686. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12687. @item pos
  12688. the position in the file of the filtered frame, -1 if the information
  12689. is not available (e.g. for synthetic video)
  12690. @item scene @emph{(video only)}
  12691. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12692. probability for the current frame to introduce a new scene, while a higher
  12693. value means the current frame is more likely to be one (see the example below)
  12694. @item concatdec_select
  12695. The concat demuxer can select only part of a concat input file by setting an
  12696. inpoint and an outpoint, but the output packets may not be entirely contained
  12697. in the selected interval. By using this variable, it is possible to skip frames
  12698. generated by the concat demuxer which are not exactly contained in the selected
  12699. interval.
  12700. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12701. and the @var{lavf.concat.duration} packet metadata values which are also
  12702. present in the decoded frames.
  12703. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12704. start_time and either the duration metadata is missing or the frame pts is less
  12705. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12706. missing.
  12707. That basically means that an input frame is selected if its pts is within the
  12708. interval set by the concat demuxer.
  12709. @end table
  12710. The default value of the select expression is "1".
  12711. @subsection Examples
  12712. @itemize
  12713. @item
  12714. Select all frames in input:
  12715. @example
  12716. select
  12717. @end example
  12718. The example above is the same as:
  12719. @example
  12720. select=1
  12721. @end example
  12722. @item
  12723. Skip all frames:
  12724. @example
  12725. select=0
  12726. @end example
  12727. @item
  12728. Select only I-frames:
  12729. @example
  12730. select='eq(pict_type\,I)'
  12731. @end example
  12732. @item
  12733. Select one frame every 100:
  12734. @example
  12735. select='not(mod(n\,100))'
  12736. @end example
  12737. @item
  12738. Select only frames contained in the 10-20 time interval:
  12739. @example
  12740. select=between(t\,10\,20)
  12741. @end example
  12742. @item
  12743. Select only I-frames contained in the 10-20 time interval:
  12744. @example
  12745. select=between(t\,10\,20)*eq(pict_type\,I)
  12746. @end example
  12747. @item
  12748. Select frames with a minimum distance of 10 seconds:
  12749. @example
  12750. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12751. @end example
  12752. @item
  12753. Use aselect to select only audio frames with samples number > 100:
  12754. @example
  12755. aselect='gt(samples_n\,100)'
  12756. @end example
  12757. @item
  12758. Create a mosaic of the first scenes:
  12759. @example
  12760. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12761. @end example
  12762. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12763. choice.
  12764. @item
  12765. Send even and odd frames to separate outputs, and compose them:
  12766. @example
  12767. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12768. @end example
  12769. @item
  12770. Select useful frames from an ffconcat file which is using inpoints and
  12771. outpoints but where the source files are not intra frame only.
  12772. @example
  12773. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12774. @end example
  12775. @end itemize
  12776. @section sendcmd, asendcmd
  12777. Send commands to filters in the filtergraph.
  12778. These filters read commands to be sent to other filters in the
  12779. filtergraph.
  12780. @code{sendcmd} must be inserted between two video filters,
  12781. @code{asendcmd} must be inserted between two audio filters, but apart
  12782. from that they act the same way.
  12783. The specification of commands can be provided in the filter arguments
  12784. with the @var{commands} option, or in a file specified by the
  12785. @var{filename} option.
  12786. These filters accept the following options:
  12787. @table @option
  12788. @item commands, c
  12789. Set the commands to be read and sent to the other filters.
  12790. @item filename, f
  12791. Set the filename of the commands to be read and sent to the other
  12792. filters.
  12793. @end table
  12794. @subsection Commands syntax
  12795. A commands description consists of a sequence of interval
  12796. specifications, comprising a list of commands to be executed when a
  12797. particular event related to that interval occurs. The occurring event
  12798. is typically the current frame time entering or leaving a given time
  12799. interval.
  12800. An interval is specified by the following syntax:
  12801. @example
  12802. @var{START}[-@var{END}] @var{COMMANDS};
  12803. @end example
  12804. The time interval is specified by the @var{START} and @var{END} times.
  12805. @var{END} is optional and defaults to the maximum time.
  12806. The current frame time is considered within the specified interval if
  12807. it is included in the interval [@var{START}, @var{END}), that is when
  12808. the time is greater or equal to @var{START} and is lesser than
  12809. @var{END}.
  12810. @var{COMMANDS} consists of a sequence of one or more command
  12811. specifications, separated by ",", relating to that interval. The
  12812. syntax of a command specification is given by:
  12813. @example
  12814. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12815. @end example
  12816. @var{FLAGS} is optional and specifies the type of events relating to
  12817. the time interval which enable sending the specified command, and must
  12818. be a non-null sequence of identifier flags separated by "+" or "|" and
  12819. enclosed between "[" and "]".
  12820. The following flags are recognized:
  12821. @table @option
  12822. @item enter
  12823. The command is sent when the current frame timestamp enters the
  12824. specified interval. In other words, the command is sent when the
  12825. previous frame timestamp was not in the given interval, and the
  12826. current is.
  12827. @item leave
  12828. The command is sent when the current frame timestamp leaves the
  12829. specified interval. In other words, the command is sent when the
  12830. previous frame timestamp was in the given interval, and the
  12831. current is not.
  12832. @end table
  12833. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12834. assumed.
  12835. @var{TARGET} specifies the target of the command, usually the name of
  12836. the filter class or a specific filter instance name.
  12837. @var{COMMAND} specifies the name of the command for the target filter.
  12838. @var{ARG} is optional and specifies the optional list of argument for
  12839. the given @var{COMMAND}.
  12840. Between one interval specification and another, whitespaces, or
  12841. sequences of characters starting with @code{#} until the end of line,
  12842. are ignored and can be used to annotate comments.
  12843. A simplified BNF description of the commands specification syntax
  12844. follows:
  12845. @example
  12846. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12847. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12848. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12849. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12850. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12851. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12852. @end example
  12853. @subsection Examples
  12854. @itemize
  12855. @item
  12856. Specify audio tempo change at second 4:
  12857. @example
  12858. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12859. @end example
  12860. @item
  12861. Specify a list of drawtext and hue commands in a file.
  12862. @example
  12863. # show text in the interval 5-10
  12864. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12865. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12866. # desaturate the image in the interval 15-20
  12867. 15.0-20.0 [enter] hue s 0,
  12868. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12869. [leave] hue s 1,
  12870. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12871. # apply an exponential saturation fade-out effect, starting from time 25
  12872. 25 [enter] hue s exp(25-t)
  12873. @end example
  12874. A filtergraph allowing to read and process the above command list
  12875. stored in a file @file{test.cmd}, can be specified with:
  12876. @example
  12877. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12878. @end example
  12879. @end itemize
  12880. @anchor{setpts}
  12881. @section setpts, asetpts
  12882. Change the PTS (presentation timestamp) of the input frames.
  12883. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12884. This filter accepts the following options:
  12885. @table @option
  12886. @item expr
  12887. The expression which is evaluated for each frame to construct its timestamp.
  12888. @end table
  12889. The expression is evaluated through the eval API and can contain the following
  12890. constants:
  12891. @table @option
  12892. @item FRAME_RATE
  12893. frame rate, only defined for constant frame-rate video
  12894. @item PTS
  12895. The presentation timestamp in input
  12896. @item N
  12897. The count of the input frame for video or the number of consumed samples,
  12898. not including the current frame for audio, starting from 0.
  12899. @item NB_CONSUMED_SAMPLES
  12900. The number of consumed samples, not including the current frame (only
  12901. audio)
  12902. @item NB_SAMPLES, S
  12903. The number of samples in the current frame (only audio)
  12904. @item SAMPLE_RATE, SR
  12905. The audio sample rate.
  12906. @item STARTPTS
  12907. The PTS of the first frame.
  12908. @item STARTT
  12909. the time in seconds of the first frame
  12910. @item INTERLACED
  12911. State whether the current frame is interlaced.
  12912. @item T
  12913. the time in seconds of the current frame
  12914. @item POS
  12915. original position in the file of the frame, or undefined if undefined
  12916. for the current frame
  12917. @item PREV_INPTS
  12918. The previous input PTS.
  12919. @item PREV_INT
  12920. previous input time in seconds
  12921. @item PREV_OUTPTS
  12922. The previous output PTS.
  12923. @item PREV_OUTT
  12924. previous output time in seconds
  12925. @item RTCTIME
  12926. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12927. instead.
  12928. @item RTCSTART
  12929. The wallclock (RTC) time at the start of the movie in microseconds.
  12930. @item TB
  12931. The timebase of the input timestamps.
  12932. @end table
  12933. @subsection Examples
  12934. @itemize
  12935. @item
  12936. Start counting PTS from zero
  12937. @example
  12938. setpts=PTS-STARTPTS
  12939. @end example
  12940. @item
  12941. Apply fast motion effect:
  12942. @example
  12943. setpts=0.5*PTS
  12944. @end example
  12945. @item
  12946. Apply slow motion effect:
  12947. @example
  12948. setpts=2.0*PTS
  12949. @end example
  12950. @item
  12951. Set fixed rate of 25 frames per second:
  12952. @example
  12953. setpts=N/(25*TB)
  12954. @end example
  12955. @item
  12956. Set fixed rate 25 fps with some jitter:
  12957. @example
  12958. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12959. @end example
  12960. @item
  12961. Apply an offset of 10 seconds to the input PTS:
  12962. @example
  12963. setpts=PTS+10/TB
  12964. @end example
  12965. @item
  12966. Generate timestamps from a "live source" and rebase onto the current timebase:
  12967. @example
  12968. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12969. @end example
  12970. @item
  12971. Generate timestamps by counting samples:
  12972. @example
  12973. asetpts=N/SR/TB
  12974. @end example
  12975. @end itemize
  12976. @section settb, asettb
  12977. Set the timebase to use for the output frames timestamps.
  12978. It is mainly useful for testing timebase configuration.
  12979. It accepts the following parameters:
  12980. @table @option
  12981. @item expr, tb
  12982. The expression which is evaluated into the output timebase.
  12983. @end table
  12984. The value for @option{tb} is an arithmetic expression representing a
  12985. rational. The expression can contain the constants "AVTB" (the default
  12986. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12987. audio only). Default value is "intb".
  12988. @subsection Examples
  12989. @itemize
  12990. @item
  12991. Set the timebase to 1/25:
  12992. @example
  12993. settb=expr=1/25
  12994. @end example
  12995. @item
  12996. Set the timebase to 1/10:
  12997. @example
  12998. settb=expr=0.1
  12999. @end example
  13000. @item
  13001. Set the timebase to 1001/1000:
  13002. @example
  13003. settb=1+0.001
  13004. @end example
  13005. @item
  13006. Set the timebase to 2*intb:
  13007. @example
  13008. settb=2*intb
  13009. @end example
  13010. @item
  13011. Set the default timebase value:
  13012. @example
  13013. settb=AVTB
  13014. @end example
  13015. @end itemize
  13016. @section showcqt
  13017. Convert input audio to a video output representing frequency spectrum
  13018. logarithmically using Brown-Puckette constant Q transform algorithm with
  13019. direct frequency domain coefficient calculation (but the transform itself
  13020. is not really constant Q, instead the Q factor is actually variable/clamped),
  13021. with musical tone scale, from E0 to D#10.
  13022. The filter accepts the following options:
  13023. @table @option
  13024. @item size, s
  13025. Specify the video size for the output. It must be even. For the syntax of this option,
  13026. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13027. Default value is @code{1920x1080}.
  13028. @item fps, rate, r
  13029. Set the output frame rate. Default value is @code{25}.
  13030. @item bar_h
  13031. Set the bargraph height. It must be even. Default value is @code{-1} which
  13032. computes the bargraph height automatically.
  13033. @item axis_h
  13034. Set the axis height. It must be even. Default value is @code{-1} which computes
  13035. the axis height automatically.
  13036. @item sono_h
  13037. Set the sonogram height. It must be even. Default value is @code{-1} which
  13038. computes the sonogram height automatically.
  13039. @item fullhd
  13040. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13041. instead. Default value is @code{1}.
  13042. @item sono_v, volume
  13043. Specify the sonogram volume expression. It can contain variables:
  13044. @table @option
  13045. @item bar_v
  13046. the @var{bar_v} evaluated expression
  13047. @item frequency, freq, f
  13048. the frequency where it is evaluated
  13049. @item timeclamp, tc
  13050. the value of @var{timeclamp} option
  13051. @end table
  13052. and functions:
  13053. @table @option
  13054. @item a_weighting(f)
  13055. A-weighting of equal loudness
  13056. @item b_weighting(f)
  13057. B-weighting of equal loudness
  13058. @item c_weighting(f)
  13059. C-weighting of equal loudness.
  13060. @end table
  13061. Default value is @code{16}.
  13062. @item bar_v, volume2
  13063. Specify the bargraph volume expression. It can contain variables:
  13064. @table @option
  13065. @item sono_v
  13066. the @var{sono_v} evaluated expression
  13067. @item frequency, freq, f
  13068. the frequency where it is evaluated
  13069. @item timeclamp, tc
  13070. the value of @var{timeclamp} option
  13071. @end table
  13072. and functions:
  13073. @table @option
  13074. @item a_weighting(f)
  13075. A-weighting of equal loudness
  13076. @item b_weighting(f)
  13077. B-weighting of equal loudness
  13078. @item c_weighting(f)
  13079. C-weighting of equal loudness.
  13080. @end table
  13081. Default value is @code{sono_v}.
  13082. @item sono_g, gamma
  13083. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13084. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13085. Acceptable range is @code{[1, 7]}.
  13086. @item bar_g, gamma2
  13087. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13088. @code{[1, 7]}.
  13089. @item bar_t
  13090. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13091. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13092. @item timeclamp, tc
  13093. Specify the transform timeclamp. At low frequency, there is trade-off between
  13094. accuracy in time domain and frequency domain. If timeclamp is lower,
  13095. event in time domain is represented more accurately (such as fast bass drum),
  13096. otherwise event in frequency domain is represented more accurately
  13097. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13098. @item basefreq
  13099. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13100. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13101. @item endfreq
  13102. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13103. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13104. @item coeffclamp
  13105. This option is deprecated and ignored.
  13106. @item tlength
  13107. Specify the transform length in time domain. Use this option to control accuracy
  13108. trade-off between time domain and frequency domain at every frequency sample.
  13109. It can contain variables:
  13110. @table @option
  13111. @item frequency, freq, f
  13112. the frequency where it is evaluated
  13113. @item timeclamp, tc
  13114. the value of @var{timeclamp} option.
  13115. @end table
  13116. Default value is @code{384*tc/(384+tc*f)}.
  13117. @item count
  13118. Specify the transform count for every video frame. Default value is @code{6}.
  13119. Acceptable range is @code{[1, 30]}.
  13120. @item fcount
  13121. Specify the transform count for every single pixel. Default value is @code{0},
  13122. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13123. @item fontfile
  13124. Specify font file for use with freetype to draw the axis. If not specified,
  13125. use embedded font. Note that drawing with font file or embedded font is not
  13126. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13127. option instead.
  13128. @item font
  13129. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13130. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13131. @item fontcolor
  13132. Specify font color expression. This is arithmetic expression that should return
  13133. integer value 0xRRGGBB. It can contain variables:
  13134. @table @option
  13135. @item frequency, freq, f
  13136. the frequency where it is evaluated
  13137. @item timeclamp, tc
  13138. the value of @var{timeclamp} option
  13139. @end table
  13140. and functions:
  13141. @table @option
  13142. @item midi(f)
  13143. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13144. @item r(x), g(x), b(x)
  13145. red, green, and blue value of intensity x.
  13146. @end table
  13147. Default value is @code{st(0, (midi(f)-59.5)/12);
  13148. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13149. r(1-ld(1)) + b(ld(1))}.
  13150. @item axisfile
  13151. Specify image file to draw the axis. This option override @var{fontfile} and
  13152. @var{fontcolor} option.
  13153. @item axis, text
  13154. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13155. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13156. Default value is @code{1}.
  13157. @item csp
  13158. Set colorspace. The accepted values are:
  13159. @table @samp
  13160. @item unspecified
  13161. Unspecified (default)
  13162. @item bt709
  13163. BT.709
  13164. @item fcc
  13165. FCC
  13166. @item bt470bg
  13167. BT.470BG or BT.601-6 625
  13168. @item smpte170m
  13169. SMPTE-170M or BT.601-6 525
  13170. @item smpte240m
  13171. SMPTE-240M
  13172. @item bt2020ncl
  13173. BT.2020 with non-constant luminance
  13174. @end table
  13175. @item cscheme
  13176. Set spectrogram color scheme. This is list of floating point values with format
  13177. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13178. The default is @code{1|0.5|0|0|0.5|1}.
  13179. @end table
  13180. @subsection Examples
  13181. @itemize
  13182. @item
  13183. Playing audio while showing the spectrum:
  13184. @example
  13185. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13186. @end example
  13187. @item
  13188. Same as above, but with frame rate 30 fps:
  13189. @example
  13190. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13191. @end example
  13192. @item
  13193. Playing at 1280x720:
  13194. @example
  13195. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13196. @end example
  13197. @item
  13198. Disable sonogram display:
  13199. @example
  13200. sono_h=0
  13201. @end example
  13202. @item
  13203. A1 and its harmonics: A1, A2, (near)E3, A3:
  13204. @example
  13205. 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),
  13206. asplit[a][out1]; [a] showcqt [out0]'
  13207. @end example
  13208. @item
  13209. Same as above, but with more accuracy in frequency domain:
  13210. @example
  13211. 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),
  13212. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13213. @end example
  13214. @item
  13215. Custom volume:
  13216. @example
  13217. bar_v=10:sono_v=bar_v*a_weighting(f)
  13218. @end example
  13219. @item
  13220. Custom gamma, now spectrum is linear to the amplitude.
  13221. @example
  13222. bar_g=2:sono_g=2
  13223. @end example
  13224. @item
  13225. Custom tlength equation:
  13226. @example
  13227. 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)))'
  13228. @end example
  13229. @item
  13230. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13231. @example
  13232. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13233. @end example
  13234. @item
  13235. Custom font using fontconfig:
  13236. @example
  13237. font='Courier New,Monospace,mono|bold'
  13238. @end example
  13239. @item
  13240. Custom frequency range with custom axis using image file:
  13241. @example
  13242. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13243. @end example
  13244. @end itemize
  13245. @section showfreqs
  13246. Convert input audio to video output representing the audio power spectrum.
  13247. Audio amplitude is on Y-axis while frequency is on X-axis.
  13248. The filter accepts the following options:
  13249. @table @option
  13250. @item size, s
  13251. Specify size of video. For the syntax of this option, check the
  13252. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13253. Default is @code{1024x512}.
  13254. @item mode
  13255. Set display mode.
  13256. This set how each frequency bin will be represented.
  13257. It accepts the following values:
  13258. @table @samp
  13259. @item line
  13260. @item bar
  13261. @item dot
  13262. @end table
  13263. Default is @code{bar}.
  13264. @item ascale
  13265. Set amplitude scale.
  13266. It accepts the following values:
  13267. @table @samp
  13268. @item lin
  13269. Linear scale.
  13270. @item sqrt
  13271. Square root scale.
  13272. @item cbrt
  13273. Cubic root scale.
  13274. @item log
  13275. Logarithmic scale.
  13276. @end table
  13277. Default is @code{log}.
  13278. @item fscale
  13279. Set frequency scale.
  13280. It accepts the following values:
  13281. @table @samp
  13282. @item lin
  13283. Linear scale.
  13284. @item log
  13285. Logarithmic scale.
  13286. @item rlog
  13287. Reverse logarithmic scale.
  13288. @end table
  13289. Default is @code{lin}.
  13290. @item win_size
  13291. Set window size.
  13292. It accepts the following values:
  13293. @table @samp
  13294. @item w16
  13295. @item w32
  13296. @item w64
  13297. @item w128
  13298. @item w256
  13299. @item w512
  13300. @item w1024
  13301. @item w2048
  13302. @item w4096
  13303. @item w8192
  13304. @item w16384
  13305. @item w32768
  13306. @item w65536
  13307. @end table
  13308. Default is @code{w2048}
  13309. @item win_func
  13310. Set windowing function.
  13311. It accepts the following values:
  13312. @table @samp
  13313. @item rect
  13314. @item bartlett
  13315. @item hanning
  13316. @item hamming
  13317. @item blackman
  13318. @item welch
  13319. @item flattop
  13320. @item bharris
  13321. @item bnuttall
  13322. @item bhann
  13323. @item sine
  13324. @item nuttall
  13325. @item lanczos
  13326. @item gauss
  13327. @item tukey
  13328. @item dolph
  13329. @item cauchy
  13330. @item parzen
  13331. @item poisson
  13332. @end table
  13333. Default is @code{hanning}.
  13334. @item overlap
  13335. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13336. which means optimal overlap for selected window function will be picked.
  13337. @item averaging
  13338. Set time averaging. Setting this to 0 will display current maximal peaks.
  13339. Default is @code{1}, which means time averaging is disabled.
  13340. @item colors
  13341. Specify list of colors separated by space or by '|' which will be used to
  13342. draw channel frequencies. Unrecognized or missing colors will be replaced
  13343. by white color.
  13344. @item cmode
  13345. Set channel display mode.
  13346. It accepts the following values:
  13347. @table @samp
  13348. @item combined
  13349. @item separate
  13350. @end table
  13351. Default is @code{combined}.
  13352. @item minamp
  13353. Set minimum amplitude used in @code{log} amplitude scaler.
  13354. @end table
  13355. @anchor{showspectrum}
  13356. @section showspectrum
  13357. Convert input audio to a video output, representing the audio frequency
  13358. spectrum.
  13359. The filter accepts the following options:
  13360. @table @option
  13361. @item size, s
  13362. Specify the video size for the output. For the syntax of this option, check the
  13363. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13364. Default value is @code{640x512}.
  13365. @item slide
  13366. Specify how the spectrum should slide along the window.
  13367. It accepts the following values:
  13368. @table @samp
  13369. @item replace
  13370. the samples start again on the left when they reach the right
  13371. @item scroll
  13372. the samples scroll from right to left
  13373. @item fullframe
  13374. frames are only produced when the samples reach the right
  13375. @item rscroll
  13376. the samples scroll from left to right
  13377. @end table
  13378. Default value is @code{replace}.
  13379. @item mode
  13380. Specify display mode.
  13381. It accepts the following values:
  13382. @table @samp
  13383. @item combined
  13384. all channels are displayed in the same row
  13385. @item separate
  13386. all channels are displayed in separate rows
  13387. @end table
  13388. Default value is @samp{combined}.
  13389. @item color
  13390. Specify display color mode.
  13391. It accepts the following values:
  13392. @table @samp
  13393. @item channel
  13394. each channel is displayed in a separate color
  13395. @item intensity
  13396. each channel is displayed using the same color scheme
  13397. @item rainbow
  13398. each channel is displayed using the rainbow color scheme
  13399. @item moreland
  13400. each channel is displayed using the moreland color scheme
  13401. @item nebulae
  13402. each channel is displayed using the nebulae color scheme
  13403. @item fire
  13404. each channel is displayed using the fire color scheme
  13405. @item fiery
  13406. each channel is displayed using the fiery color scheme
  13407. @item fruit
  13408. each channel is displayed using the fruit color scheme
  13409. @item cool
  13410. each channel is displayed using the cool color scheme
  13411. @end table
  13412. Default value is @samp{channel}.
  13413. @item scale
  13414. Specify scale used for calculating intensity color values.
  13415. It accepts the following values:
  13416. @table @samp
  13417. @item lin
  13418. linear
  13419. @item sqrt
  13420. square root, default
  13421. @item cbrt
  13422. cubic root
  13423. @item log
  13424. logarithmic
  13425. @item 4thrt
  13426. 4th root
  13427. @item 5thrt
  13428. 5th root
  13429. @end table
  13430. Default value is @samp{sqrt}.
  13431. @item saturation
  13432. Set saturation modifier for displayed colors. Negative values provide
  13433. alternative color scheme. @code{0} is no saturation at all.
  13434. Saturation must be in [-10.0, 10.0] range.
  13435. Default value is @code{1}.
  13436. @item win_func
  13437. Set window function.
  13438. It accepts the following values:
  13439. @table @samp
  13440. @item rect
  13441. @item bartlett
  13442. @item hann
  13443. @item hanning
  13444. @item hamming
  13445. @item blackman
  13446. @item welch
  13447. @item flattop
  13448. @item bharris
  13449. @item bnuttall
  13450. @item bhann
  13451. @item sine
  13452. @item nuttall
  13453. @item lanczos
  13454. @item gauss
  13455. @item tukey
  13456. @item dolph
  13457. @item cauchy
  13458. @item parzen
  13459. @item poisson
  13460. @end table
  13461. Default value is @code{hann}.
  13462. @item orientation
  13463. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13464. @code{horizontal}. Default is @code{vertical}.
  13465. @item overlap
  13466. Set ratio of overlap window. Default value is @code{0}.
  13467. When value is @code{1} overlap is set to recommended size for specific
  13468. window function currently used.
  13469. @item gain
  13470. Set scale gain for calculating intensity color values.
  13471. Default value is @code{1}.
  13472. @item data
  13473. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13474. @item rotation
  13475. Set color rotation, must be in [-1.0, 1.0] range.
  13476. Default value is @code{0}.
  13477. @end table
  13478. The usage is very similar to the showwaves filter; see the examples in that
  13479. section.
  13480. @subsection Examples
  13481. @itemize
  13482. @item
  13483. Large window with logarithmic color scaling:
  13484. @example
  13485. showspectrum=s=1280x480:scale=log
  13486. @end example
  13487. @item
  13488. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13489. @example
  13490. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13491. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13492. @end example
  13493. @end itemize
  13494. @section showspectrumpic
  13495. Convert input audio to a single video frame, representing the audio frequency
  13496. spectrum.
  13497. The filter accepts the following options:
  13498. @table @option
  13499. @item size, s
  13500. Specify the video size for the output. For the syntax of this option, check the
  13501. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13502. Default value is @code{4096x2048}.
  13503. @item mode
  13504. Specify display mode.
  13505. It accepts the following values:
  13506. @table @samp
  13507. @item combined
  13508. all channels are displayed in the same row
  13509. @item separate
  13510. all channels are displayed in separate rows
  13511. @end table
  13512. Default value is @samp{combined}.
  13513. @item color
  13514. Specify display color mode.
  13515. It accepts the following values:
  13516. @table @samp
  13517. @item channel
  13518. each channel is displayed in a separate color
  13519. @item intensity
  13520. each channel is displayed using the same color scheme
  13521. @item rainbow
  13522. each channel is displayed using the rainbow color scheme
  13523. @item moreland
  13524. each channel is displayed using the moreland color scheme
  13525. @item nebulae
  13526. each channel is displayed using the nebulae color scheme
  13527. @item fire
  13528. each channel is displayed using the fire color scheme
  13529. @item fiery
  13530. each channel is displayed using the fiery color scheme
  13531. @item fruit
  13532. each channel is displayed using the fruit color scheme
  13533. @item cool
  13534. each channel is displayed using the cool color scheme
  13535. @end table
  13536. Default value is @samp{intensity}.
  13537. @item scale
  13538. Specify scale used for calculating intensity color values.
  13539. It accepts the following values:
  13540. @table @samp
  13541. @item lin
  13542. linear
  13543. @item sqrt
  13544. square root, default
  13545. @item cbrt
  13546. cubic root
  13547. @item log
  13548. logarithmic
  13549. @item 4thrt
  13550. 4th root
  13551. @item 5thrt
  13552. 5th root
  13553. @end table
  13554. Default value is @samp{log}.
  13555. @item saturation
  13556. Set saturation modifier for displayed colors. Negative values provide
  13557. alternative color scheme. @code{0} is no saturation at all.
  13558. Saturation must be in [-10.0, 10.0] range.
  13559. Default value is @code{1}.
  13560. @item win_func
  13561. Set window function.
  13562. It accepts the following values:
  13563. @table @samp
  13564. @item rect
  13565. @item bartlett
  13566. @item hann
  13567. @item hanning
  13568. @item hamming
  13569. @item blackman
  13570. @item welch
  13571. @item flattop
  13572. @item bharris
  13573. @item bnuttall
  13574. @item bhann
  13575. @item sine
  13576. @item nuttall
  13577. @item lanczos
  13578. @item gauss
  13579. @item tukey
  13580. @item dolph
  13581. @item cauchy
  13582. @item parzen
  13583. @item poisson
  13584. @end table
  13585. Default value is @code{hann}.
  13586. @item orientation
  13587. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13588. @code{horizontal}. Default is @code{vertical}.
  13589. @item gain
  13590. Set scale gain for calculating intensity color values.
  13591. Default value is @code{1}.
  13592. @item legend
  13593. Draw time and frequency axes and legends. Default is enabled.
  13594. @item rotation
  13595. Set color rotation, must be in [-1.0, 1.0] range.
  13596. Default value is @code{0}.
  13597. @end table
  13598. @subsection Examples
  13599. @itemize
  13600. @item
  13601. Extract an audio spectrogram of a whole audio track
  13602. in a 1024x1024 picture using @command{ffmpeg}:
  13603. @example
  13604. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13605. @end example
  13606. @end itemize
  13607. @section showvolume
  13608. Convert input audio volume to a video output.
  13609. The filter accepts the following options:
  13610. @table @option
  13611. @item rate, r
  13612. Set video rate.
  13613. @item b
  13614. Set border width, allowed range is [0, 5]. Default is 1.
  13615. @item w
  13616. Set channel width, allowed range is [80, 8192]. Default is 400.
  13617. @item h
  13618. Set channel height, allowed range is [1, 900]. Default is 20.
  13619. @item f
  13620. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13621. @item c
  13622. Set volume color expression.
  13623. The expression can use the following variables:
  13624. @table @option
  13625. @item VOLUME
  13626. Current max volume of channel in dB.
  13627. @item PEAK
  13628. Current peak.
  13629. @item CHANNEL
  13630. Current channel number, starting from 0.
  13631. @end table
  13632. @item t
  13633. If set, displays channel names. Default is enabled.
  13634. @item v
  13635. If set, displays volume values. Default is enabled.
  13636. @item o
  13637. Set orientation, can be @code{horizontal} or @code{vertical},
  13638. default is @code{horizontal}.
  13639. @item s
  13640. Set step size, allowed range s [0, 5]. Default is 0, which means
  13641. step is disabled.
  13642. @end table
  13643. @section showwaves
  13644. Convert input audio to a video output, representing the samples waves.
  13645. The filter accepts the following options:
  13646. @table @option
  13647. @item size, s
  13648. Specify the video size for the output. For the syntax of this option, check the
  13649. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13650. Default value is @code{600x240}.
  13651. @item mode
  13652. Set display mode.
  13653. Available values are:
  13654. @table @samp
  13655. @item point
  13656. Draw a point for each sample.
  13657. @item line
  13658. Draw a vertical line for each sample.
  13659. @item p2p
  13660. Draw a point for each sample and a line between them.
  13661. @item cline
  13662. Draw a centered vertical line for each sample.
  13663. @end table
  13664. Default value is @code{point}.
  13665. @item n
  13666. Set the number of samples which are printed on the same column. A
  13667. larger value will decrease the frame rate. Must be a positive
  13668. integer. This option can be set only if the value for @var{rate}
  13669. is not explicitly specified.
  13670. @item rate, r
  13671. Set the (approximate) output frame rate. This is done by setting the
  13672. option @var{n}. Default value is "25".
  13673. @item split_channels
  13674. Set if channels should be drawn separately or overlap. Default value is 0.
  13675. @item colors
  13676. Set colors separated by '|' which are going to be used for drawing of each channel.
  13677. @item scale
  13678. Set amplitude scale.
  13679. Available values are:
  13680. @table @samp
  13681. @item lin
  13682. Linear.
  13683. @item log
  13684. Logarithmic.
  13685. @item sqrt
  13686. Square root.
  13687. @item cbrt
  13688. Cubic root.
  13689. @end table
  13690. Default is linear.
  13691. @end table
  13692. @subsection Examples
  13693. @itemize
  13694. @item
  13695. Output the input file audio and the corresponding video representation
  13696. at the same time:
  13697. @example
  13698. amovie=a.mp3,asplit[out0],showwaves[out1]
  13699. @end example
  13700. @item
  13701. Create a synthetic signal and show it with showwaves, forcing a
  13702. frame rate of 30 frames per second:
  13703. @example
  13704. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13705. @end example
  13706. @end itemize
  13707. @section showwavespic
  13708. Convert input audio to a single video frame, representing the samples waves.
  13709. The filter accepts the following options:
  13710. @table @option
  13711. @item size, s
  13712. Specify the video size for the output. For the syntax of this option, check the
  13713. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13714. Default value is @code{600x240}.
  13715. @item split_channels
  13716. Set if channels should be drawn separately or overlap. Default value is 0.
  13717. @item colors
  13718. Set colors separated by '|' which are going to be used for drawing of each channel.
  13719. @item scale
  13720. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13721. Default is linear.
  13722. @end table
  13723. @subsection Examples
  13724. @itemize
  13725. @item
  13726. Extract a channel split representation of the wave form of a whole audio track
  13727. in a 1024x800 picture using @command{ffmpeg}:
  13728. @example
  13729. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13730. @end example
  13731. @end itemize
  13732. @section sidedata, asidedata
  13733. Delete frame side data, or select frames based on it.
  13734. This filter accepts the following options:
  13735. @table @option
  13736. @item mode
  13737. Set mode of operation of the filter.
  13738. Can be one of the following:
  13739. @table @samp
  13740. @item select
  13741. Select every frame with side data of @code{type}.
  13742. @item delete
  13743. Delete side data of @code{type}. If @code{type} is not set, delete all side
  13744. data in the frame.
  13745. @end table
  13746. @item type
  13747. Set side data type used with all modes. Must be set for @code{select} mode. For
  13748. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  13749. in @file{libavutil/frame.h}. For example, to choose
  13750. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  13751. @end table
  13752. @section spectrumsynth
  13753. Sythesize audio from 2 input video spectrums, first input stream represents
  13754. magnitude across time and second represents phase across time.
  13755. The filter will transform from frequency domain as displayed in videos back
  13756. to time domain as presented in audio output.
  13757. This filter is primarily created for reversing processed @ref{showspectrum}
  13758. filter outputs, but can synthesize sound from other spectrograms too.
  13759. But in such case results are going to be poor if the phase data is not
  13760. available, because in such cases phase data need to be recreated, usually
  13761. its just recreated from random noise.
  13762. For best results use gray only output (@code{channel} color mode in
  13763. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13764. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13765. @code{data} option. Inputs videos should generally use @code{fullframe}
  13766. slide mode as that saves resources needed for decoding video.
  13767. The filter accepts the following options:
  13768. @table @option
  13769. @item sample_rate
  13770. Specify sample rate of output audio, the sample rate of audio from which
  13771. spectrum was generated may differ.
  13772. @item channels
  13773. Set number of channels represented in input video spectrums.
  13774. @item scale
  13775. Set scale which was used when generating magnitude input spectrum.
  13776. Can be @code{lin} or @code{log}. Default is @code{log}.
  13777. @item slide
  13778. Set slide which was used when generating inputs spectrums.
  13779. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13780. Default is @code{fullframe}.
  13781. @item win_func
  13782. Set window function used for resynthesis.
  13783. @item overlap
  13784. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13785. which means optimal overlap for selected window function will be picked.
  13786. @item orientation
  13787. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13788. Default is @code{vertical}.
  13789. @end table
  13790. @subsection Examples
  13791. @itemize
  13792. @item
  13793. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13794. then resynthesize videos back to audio with spectrumsynth:
  13795. @example
  13796. 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
  13797. 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
  13798. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13799. @end example
  13800. @end itemize
  13801. @section split, asplit
  13802. Split input into several identical outputs.
  13803. @code{asplit} works with audio input, @code{split} with video.
  13804. The filter accepts a single parameter which specifies the number of outputs. If
  13805. unspecified, it defaults to 2.
  13806. @subsection Examples
  13807. @itemize
  13808. @item
  13809. Create two separate outputs from the same input:
  13810. @example
  13811. [in] split [out0][out1]
  13812. @end example
  13813. @item
  13814. To create 3 or more outputs, you need to specify the number of
  13815. outputs, like in:
  13816. @example
  13817. [in] asplit=3 [out0][out1][out2]
  13818. @end example
  13819. @item
  13820. Create two separate outputs from the same input, one cropped and
  13821. one padded:
  13822. @example
  13823. [in] split [splitout1][splitout2];
  13824. [splitout1] crop=100:100:0:0 [cropout];
  13825. [splitout2] pad=200:200:100:100 [padout];
  13826. @end example
  13827. @item
  13828. Create 5 copies of the input audio with @command{ffmpeg}:
  13829. @example
  13830. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13831. @end example
  13832. @end itemize
  13833. @section zmq, azmq
  13834. Receive commands sent through a libzmq client, and forward them to
  13835. filters in the filtergraph.
  13836. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13837. must be inserted between two video filters, @code{azmq} between two
  13838. audio filters.
  13839. To enable these filters you need to install the libzmq library and
  13840. headers and configure FFmpeg with @code{--enable-libzmq}.
  13841. For more information about libzmq see:
  13842. @url{http://www.zeromq.org/}
  13843. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13844. receives messages sent through a network interface defined by the
  13845. @option{bind_address} option.
  13846. The received message must be in the form:
  13847. @example
  13848. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13849. @end example
  13850. @var{TARGET} specifies the target of the command, usually the name of
  13851. the filter class or a specific filter instance name.
  13852. @var{COMMAND} specifies the name of the command for the target filter.
  13853. @var{ARG} is optional and specifies the optional argument list for the
  13854. given @var{COMMAND}.
  13855. Upon reception, the message is processed and the corresponding command
  13856. is injected into the filtergraph. Depending on the result, the filter
  13857. will send a reply to the client, adopting the format:
  13858. @example
  13859. @var{ERROR_CODE} @var{ERROR_REASON}
  13860. @var{MESSAGE}
  13861. @end example
  13862. @var{MESSAGE} is optional.
  13863. @subsection Examples
  13864. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13865. be used to send commands processed by these filters.
  13866. Consider the following filtergraph generated by @command{ffplay}
  13867. @example
  13868. ffplay -dumpgraph 1 -f lavfi "
  13869. color=s=100x100:c=red [l];
  13870. color=s=100x100:c=blue [r];
  13871. nullsrc=s=200x100, zmq [bg];
  13872. [bg][l] overlay [bg+l];
  13873. [bg+l][r] overlay=x=100 "
  13874. @end example
  13875. To change the color of the left side of the video, the following
  13876. command can be used:
  13877. @example
  13878. echo Parsed_color_0 c yellow | tools/zmqsend
  13879. @end example
  13880. To change the right side:
  13881. @example
  13882. echo Parsed_color_1 c pink | tools/zmqsend
  13883. @end example
  13884. @c man end MULTIMEDIA FILTERS
  13885. @chapter Multimedia Sources
  13886. @c man begin MULTIMEDIA SOURCES
  13887. Below is a description of the currently available multimedia sources.
  13888. @section amovie
  13889. This is the same as @ref{movie} source, except it selects an audio
  13890. stream by default.
  13891. @anchor{movie}
  13892. @section movie
  13893. Read audio and/or video stream(s) from a movie container.
  13894. It accepts the following parameters:
  13895. @table @option
  13896. @item filename
  13897. The name of the resource to read (not necessarily a file; it can also be a
  13898. device or a stream accessed through some protocol).
  13899. @item format_name, f
  13900. Specifies the format assumed for the movie to read, and can be either
  13901. the name of a container or an input device. If not specified, the
  13902. format is guessed from @var{movie_name} or by probing.
  13903. @item seek_point, sp
  13904. Specifies the seek point in seconds. The frames will be output
  13905. starting from this seek point. The parameter is evaluated with
  13906. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13907. postfix. The default value is "0".
  13908. @item streams, s
  13909. Specifies the streams to read. Several streams can be specified,
  13910. separated by "+". The source will then have as many outputs, in the
  13911. same order. The syntax is explained in the ``Stream specifiers''
  13912. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13913. respectively the default (best suited) video and audio stream. Default
  13914. is "dv", or "da" if the filter is called as "amovie".
  13915. @item stream_index, si
  13916. Specifies the index of the video stream to read. If the value is -1,
  13917. the most suitable video stream will be automatically selected. The default
  13918. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13919. audio instead of video.
  13920. @item loop
  13921. Specifies how many times to read the stream in sequence.
  13922. If the value is 0, the stream will be looped infinitely.
  13923. Default value is "1".
  13924. Note that when the movie is looped the source timestamps are not
  13925. changed, so it will generate non monotonically increasing timestamps.
  13926. @item discontinuity
  13927. Specifies the time difference between frames above which the point is
  13928. considered a timestamp discontinuity which is removed by adjusting the later
  13929. timestamps.
  13930. @end table
  13931. It allows overlaying a second video on top of the main input of
  13932. a filtergraph, as shown in this graph:
  13933. @example
  13934. input -----------> deltapts0 --> overlay --> output
  13935. ^
  13936. |
  13937. movie --> scale--> deltapts1 -------+
  13938. @end example
  13939. @subsection Examples
  13940. @itemize
  13941. @item
  13942. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13943. on top of the input labelled "in":
  13944. @example
  13945. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13946. [in] setpts=PTS-STARTPTS [main];
  13947. [main][over] overlay=16:16 [out]
  13948. @end example
  13949. @item
  13950. Read from a video4linux2 device, and overlay it on top of the input
  13951. labelled "in":
  13952. @example
  13953. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13954. [in] setpts=PTS-STARTPTS [main];
  13955. [main][over] overlay=16:16 [out]
  13956. @end example
  13957. @item
  13958. Read the first video stream and the audio stream with id 0x81 from
  13959. dvd.vob; the video is connected to the pad named "video" and the audio is
  13960. connected to the pad named "audio":
  13961. @example
  13962. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13963. @end example
  13964. @end itemize
  13965. @subsection Commands
  13966. Both movie and amovie support the following commands:
  13967. @table @option
  13968. @item seek
  13969. Perform seek using "av_seek_frame".
  13970. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13971. @itemize
  13972. @item
  13973. @var{stream_index}: If stream_index is -1, a default
  13974. stream is selected, and @var{timestamp} is automatically converted
  13975. from AV_TIME_BASE units to the stream specific time_base.
  13976. @item
  13977. @var{timestamp}: Timestamp in AVStream.time_base units
  13978. or, if no stream is specified, in AV_TIME_BASE units.
  13979. @item
  13980. @var{flags}: Flags which select direction and seeking mode.
  13981. @end itemize
  13982. @item get_duration
  13983. Get movie duration in AV_TIME_BASE units.
  13984. @end table
  13985. @c man end MULTIMEDIA SOURCES