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.

18972 lines
504KB

  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{id}=@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 optionally followed by "@@@var{id}".
  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{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @chapter Audio Filters
  251. @c man begin AUDIO FILTERS
  252. When you configure your FFmpeg build, you can disable any of the
  253. existing filters using @code{--disable-filters}.
  254. The configure output will show the audio filters included in your
  255. build.
  256. Below is a description of the currently available audio filters.
  257. @section acompressor
  258. A compressor is mainly used to reduce the dynamic range of a signal.
  259. Especially modern music is mostly compressed at a high ratio to
  260. improve the overall loudness. It's done to get the highest attention
  261. of a listener, "fatten" the sound and bring more "power" to the track.
  262. If a signal is compressed too much it may sound dull or "dead"
  263. afterwards or it may start to "pump" (which could be a powerful effect
  264. but can also destroy a track completely).
  265. The right compression is the key to reach a professional sound and is
  266. the high art of mixing and mastering. Because of its complex settings
  267. it may take a long time to get the right feeling for this kind of effect.
  268. Compression is done by detecting the volume above a chosen level
  269. @code{threshold} and dividing it by the factor set with @code{ratio}.
  270. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  271. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  272. the signal would cause distortion of the waveform the reduction can be
  273. levelled over the time. This is done by setting "Attack" and "Release".
  274. @code{attack} determines how long the signal has to rise above the threshold
  275. before any reduction will occur and @code{release} sets the time the signal
  276. has to fall below the threshold to reduce the reduction again. Shorter signals
  277. than the chosen attack time will be left untouched.
  278. The overall reduction of the signal can be made up afterwards with the
  279. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  280. raising the makeup to this level results in a signal twice as loud than the
  281. source. To gain a softer entry in the compression the @code{knee} flattens the
  282. hard edge at the threshold in the range of the chosen decibels.
  283. The filter accepts the following options:
  284. @table @option
  285. @item level_in
  286. Set input gain. Default is 1. Range is between 0.015625 and 64.
  287. @item threshold
  288. If a signal of stream rises above this level it will affect the gain
  289. reduction.
  290. By default it is 0.125. Range is between 0.00097563 and 1.
  291. @item ratio
  292. Set a ratio by which the signal is reduced. 1:2 means that if the level
  293. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  294. Default is 2. Range is between 1 and 20.
  295. @item attack
  296. Amount of milliseconds the signal has to rise above the threshold before gain
  297. reduction starts. Default is 20. Range is between 0.01 and 2000.
  298. @item release
  299. Amount of milliseconds the signal has to fall below the threshold before
  300. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  301. @item makeup
  302. Set the amount by how much signal will be amplified after processing.
  303. Default is 1. Range is from 1 to 64.
  304. @item knee
  305. Curve the sharp knee around the threshold to enter gain reduction more softly.
  306. Default is 2.82843. Range is between 1 and 8.
  307. @item link
  308. Choose if the @code{average} level between all channels of input stream
  309. or the louder(@code{maximum}) channel of input stream affects the
  310. reduction. Default is @code{average}.
  311. @item detection
  312. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  313. of @code{rms}. Default is @code{rms} which is mostly smoother.
  314. @item mix
  315. How much to use compressed signal in output. Default is 1.
  316. Range is between 0 and 1.
  317. @end table
  318. @section acopy
  319. Copy the input audio source unchanged to the output. This is mainly useful for
  320. testing purposes.
  321. @section acrossfade
  322. Apply cross fade from one input audio stream to another input audio stream.
  323. The cross fade is applied for specified duration near the end of first stream.
  324. The filter accepts the following options:
  325. @table @option
  326. @item nb_samples, ns
  327. Specify the number of samples for which the cross fade effect has to last.
  328. At the end of the cross fade effect the first input audio will be completely
  329. silent. Default is 44100.
  330. @item duration, d
  331. Specify the duration of the cross fade effect. See
  332. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  333. for the accepted syntax.
  334. By default the duration is determined by @var{nb_samples}.
  335. If set this option is used instead of @var{nb_samples}.
  336. @item overlap, o
  337. Should first stream end overlap with second stream start. Default is enabled.
  338. @item curve1
  339. Set curve for cross fade transition for first stream.
  340. @item curve2
  341. Set curve for cross fade transition for second stream.
  342. For description of available curve types see @ref{afade} filter description.
  343. @end table
  344. @subsection Examples
  345. @itemize
  346. @item
  347. Cross fade from one input to another:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  350. @end example
  351. @item
  352. Cross fade from one input to another but without overlapping:
  353. @example
  354. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  355. @end example
  356. @end itemize
  357. @section acrusher
  358. Reduce audio bit resolution.
  359. This filter is bit crusher with enhanced functionality. A bit crusher
  360. is used to audibly reduce number of bits an audio signal is sampled
  361. with. This doesn't change the bit depth at all, it just produces the
  362. effect. Material reduced in bit depth sounds more harsh and "digital".
  363. This filter is able to even round to continuous values instead of discrete
  364. bit depths.
  365. Additionally it has a D/C offset which results in different crushing of
  366. the lower and the upper half of the signal.
  367. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  368. Another feature of this filter is the logarithmic mode.
  369. This setting switches from linear distances between bits to logarithmic ones.
  370. The result is a much more "natural" sounding crusher which doesn't gate low
  371. signals for example. The human ear has a logarithmic perception, too
  372. so this kind of crushing is much more pleasant.
  373. Logarithmic crushing is also able to get anti-aliased.
  374. The filter accepts the following options:
  375. @table @option
  376. @item level_in
  377. Set level in.
  378. @item level_out
  379. Set level out.
  380. @item bits
  381. Set bit reduction.
  382. @item mix
  383. Set mixing amount.
  384. @item mode
  385. Can be linear: @code{lin} or logarithmic: @code{log}.
  386. @item dc
  387. Set DC.
  388. @item aa
  389. Set anti-aliasing.
  390. @item samples
  391. Set sample reduction.
  392. @item lfo
  393. Enable LFO. By default disabled.
  394. @item lforange
  395. Set LFO range.
  396. @item lforate
  397. Set LFO rate.
  398. @end table
  399. @section adelay
  400. Delay one or more audio channels.
  401. Samples in delayed channel are filled with silence.
  402. The filter accepts the following option:
  403. @table @option
  404. @item delays
  405. Set list of delays in milliseconds for each channel separated by '|'.
  406. At least one delay greater than 0 should be provided.
  407. Unused delays will be silently ignored. If number of given delays is
  408. smaller than number of channels all remaining channels will not be delayed.
  409. If you want to delay exact number of samples, append 'S' to number.
  410. @end table
  411. @subsection Examples
  412. @itemize
  413. @item
  414. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  415. the second channel (and any other channels that may be present) unchanged.
  416. @example
  417. adelay=1500|0|500
  418. @end example
  419. @item
  420. Delay second channel by 500 samples, the third channel by 700 samples and leave
  421. the first channel (and any other channels that may be present) unchanged.
  422. @example
  423. adelay=0|500S|700S
  424. @end example
  425. @end itemize
  426. @section aecho
  427. Apply echoing to the input audio.
  428. Echoes are reflected sound and can occur naturally amongst mountains
  429. (and sometimes large buildings) when talking or shouting; digital echo
  430. effects emulate this behaviour and are often used to help fill out the
  431. sound of a single instrument or vocal. The time difference between the
  432. original signal and the reflection is the @code{delay}, and the
  433. loudness of the reflected signal is the @code{decay}.
  434. Multiple echoes can have different delays and decays.
  435. A description of the accepted parameters follows.
  436. @table @option
  437. @item in_gain
  438. Set input gain of reflected signal. Default is @code{0.6}.
  439. @item out_gain
  440. Set output gain of reflected signal. Default is @code{0.3}.
  441. @item delays
  442. Set list of time intervals in milliseconds between original signal and reflections
  443. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  444. Default is @code{1000}.
  445. @item decays
  446. Set list of loudnesses of reflected signals separated by '|'.
  447. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  448. Default is @code{0.5}.
  449. @end table
  450. @subsection Examples
  451. @itemize
  452. @item
  453. Make it sound as if there are twice as many instruments as are actually playing:
  454. @example
  455. aecho=0.8:0.88:60:0.4
  456. @end example
  457. @item
  458. If delay is very short, then it sound like a (metallic) robot playing music:
  459. @example
  460. aecho=0.8:0.88:6:0.4
  461. @end example
  462. @item
  463. A longer delay will sound like an open air concert in the mountains:
  464. @example
  465. aecho=0.8:0.9:1000:0.3
  466. @end example
  467. @item
  468. Same as above but with one more mountain:
  469. @example
  470. aecho=0.8:0.9:1000|1800:0.3|0.25
  471. @end example
  472. @end itemize
  473. @section aemphasis
  474. Audio emphasis filter creates or restores material directly taken from LPs or
  475. emphased CDs with different filter curves. E.g. to store music on vinyl the
  476. signal has to be altered by a filter first to even out the disadvantages of
  477. this recording medium.
  478. Once the material is played back the inverse filter has to be applied to
  479. restore the distortion of the frequency response.
  480. The filter accepts the following options:
  481. @table @option
  482. @item level_in
  483. Set input gain.
  484. @item level_out
  485. Set output gain.
  486. @item mode
  487. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  488. use @code{production} mode. Default is @code{reproduction} mode.
  489. @item type
  490. Set filter type. Selects medium. Can be one of the following:
  491. @table @option
  492. @item col
  493. select Columbia.
  494. @item emi
  495. select EMI.
  496. @item bsi
  497. select BSI (78RPM).
  498. @item riaa
  499. select RIAA.
  500. @item cd
  501. select Compact Disc (CD).
  502. @item 50fm
  503. select 50µs (FM).
  504. @item 75fm
  505. select 75µs (FM).
  506. @item 50kf
  507. select 50µs (FM-KF).
  508. @item 75kf
  509. select 75µs (FM-KF).
  510. @end table
  511. @end table
  512. @section aeval
  513. Modify an audio signal according to the specified expressions.
  514. This filter accepts one or more expressions (one for each channel),
  515. which are evaluated and used to modify a corresponding audio signal.
  516. It accepts the following parameters:
  517. @table @option
  518. @item exprs
  519. Set the '|'-separated expressions list for each separate channel. If
  520. the number of input channels is greater than the number of
  521. expressions, the last specified expression is used for the remaining
  522. output channels.
  523. @item channel_layout, c
  524. Set output channel layout. If not specified, the channel layout is
  525. specified by the number of expressions. If set to @samp{same}, it will
  526. use by default the same input channel layout.
  527. @end table
  528. Each expression in @var{exprs} can contain the following constants and functions:
  529. @table @option
  530. @item ch
  531. channel number of the current expression
  532. @item n
  533. number of the evaluated sample, starting from 0
  534. @item s
  535. sample rate
  536. @item t
  537. time of the evaluated sample expressed in seconds
  538. @item nb_in_channels
  539. @item nb_out_channels
  540. input and output number of channels
  541. @item val(CH)
  542. the value of input channel with number @var{CH}
  543. @end table
  544. Note: this filter is slow. For faster processing you should use a
  545. dedicated filter.
  546. @subsection Examples
  547. @itemize
  548. @item
  549. Half volume:
  550. @example
  551. aeval=val(ch)/2:c=same
  552. @end example
  553. @item
  554. Invert phase of the second channel:
  555. @example
  556. aeval=val(0)|-val(1)
  557. @end example
  558. @end itemize
  559. @anchor{afade}
  560. @section afade
  561. Apply fade-in/out effect to input audio.
  562. A description of the accepted parameters follows.
  563. @table @option
  564. @item type, t
  565. Specify the effect type, can be either @code{in} for fade-in, or
  566. @code{out} for a fade-out effect. Default is @code{in}.
  567. @item start_sample, ss
  568. Specify the number of the start sample for starting to apply the fade
  569. effect. Default is 0.
  570. @item nb_samples, ns
  571. Specify the number of samples for which the fade effect has to last. At
  572. the end of the fade-in effect the output audio will have the same
  573. volume as the input audio, at the end of the fade-out transition
  574. the output audio will be silence. Default is 44100.
  575. @item start_time, st
  576. Specify the start time of the fade effect. Default is 0.
  577. The value must be specified as a time duration; see
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. If set this option is used instead of @var{start_sample}.
  581. @item duration, d
  582. Specify the duration of the fade effect. See
  583. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  584. for the accepted syntax.
  585. At the end of the fade-in effect the output audio will have the same
  586. volume as the input audio, at the end of the fade-out transition
  587. the output audio will be silence.
  588. By default the duration is determined by @var{nb_samples}.
  589. If set this option is used instead of @var{nb_samples}.
  590. @item curve
  591. Set curve for fade transition.
  592. It accepts the following values:
  593. @table @option
  594. @item tri
  595. select triangular, linear slope (default)
  596. @item qsin
  597. select quarter of sine wave
  598. @item hsin
  599. select half of sine wave
  600. @item esin
  601. select exponential sine wave
  602. @item log
  603. select logarithmic
  604. @item ipar
  605. select inverted parabola
  606. @item qua
  607. select quadratic
  608. @item cub
  609. select cubic
  610. @item squ
  611. select square root
  612. @item cbr
  613. select cubic root
  614. @item par
  615. select parabola
  616. @item exp
  617. select exponential
  618. @item iqsin
  619. select inverted quarter of sine wave
  620. @item ihsin
  621. select inverted half of sine wave
  622. @item dese
  623. select double-exponential seat
  624. @item desi
  625. select double-exponential sigmoid
  626. @end table
  627. @end table
  628. @subsection Examples
  629. @itemize
  630. @item
  631. Fade in first 15 seconds of audio:
  632. @example
  633. afade=t=in:ss=0:d=15
  634. @end example
  635. @item
  636. Fade out last 25 seconds of a 900 seconds audio:
  637. @example
  638. afade=t=out:st=875:d=25
  639. @end example
  640. @end itemize
  641. @section afftfilt
  642. Apply arbitrary expressions to samples in frequency domain.
  643. @table @option
  644. @item real
  645. Set frequency domain real expression for each separate channel separated
  646. by '|'. Default is "1".
  647. If the number of input channels is greater than the number of
  648. expressions, the last specified expression is used for the remaining
  649. output channels.
  650. @item imag
  651. Set frequency domain imaginary expression for each separate channel
  652. separated by '|'. If not set, @var{real} option is used.
  653. Each expression in @var{real} and @var{imag} can contain the following
  654. constants:
  655. @table @option
  656. @item sr
  657. sample rate
  658. @item b
  659. current frequency bin number
  660. @item nb
  661. number of available bins
  662. @item ch
  663. channel number of the current expression
  664. @item chs
  665. number of channels
  666. @item pts
  667. current frame pts
  668. @end table
  669. @item win_size
  670. Set window size.
  671. It accepts the following values:
  672. @table @samp
  673. @item w16
  674. @item w32
  675. @item w64
  676. @item w128
  677. @item w256
  678. @item w512
  679. @item w1024
  680. @item w2048
  681. @item w4096
  682. @item w8192
  683. @item w16384
  684. @item w32768
  685. @item w65536
  686. @end table
  687. Default is @code{w4096}
  688. @item win_func
  689. Set window function. Default is @code{hann}.
  690. @item overlap
  691. Set window overlap. If set to 1, the recommended overlap for selected
  692. window function will be picked. Default is @code{0.75}.
  693. @end table
  694. @subsection Examples
  695. @itemize
  696. @item
  697. Leave almost only low frequencies in audio:
  698. @example
  699. afftfilt="1-clip((b/nb)*b,0,1)"
  700. @end example
  701. @end itemize
  702. @section afir
  703. Apply an arbitrary Frequency Impulse Response filter.
  704. This filter is designed for applying long FIR filters,
  705. up to 30 seconds long.
  706. It can be used as component for digital crossover filters,
  707. room equalization, cross talk cancellation, wavefield synthesis,
  708. auralization, ambiophonics and ambisonics.
  709. This filter uses second stream as FIR coefficients.
  710. If second stream holds single channel, it will be used
  711. for all input channels in first stream, otherwise
  712. number of channels in second stream must be same as
  713. number of channels in first stream.
  714. It accepts the following parameters:
  715. @table @option
  716. @item dry
  717. Set dry gain. This sets input gain.
  718. @item wet
  719. Set wet gain. This sets final output gain.
  720. @item length
  721. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  722. @item again
  723. Enable applying gain measured from power of IR.
  724. @end table
  725. @subsection Examples
  726. @itemize
  727. @item
  728. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  729. @example
  730. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  731. @end example
  732. @end itemize
  733. @anchor{aformat}
  734. @section aformat
  735. Set output format constraints for the input audio. The framework will
  736. negotiate the most appropriate format to minimize conversions.
  737. It accepts the following parameters:
  738. @table @option
  739. @item sample_fmts
  740. A '|'-separated list of requested sample formats.
  741. @item sample_rates
  742. A '|'-separated list of requested sample rates.
  743. @item channel_layouts
  744. A '|'-separated list of requested channel layouts.
  745. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  746. for the required syntax.
  747. @end table
  748. If a parameter is omitted, all values are allowed.
  749. Force the output to either unsigned 8-bit or signed 16-bit stereo
  750. @example
  751. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  752. @end example
  753. @section agate
  754. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  755. processing reduces disturbing noise between useful signals.
  756. Gating is done by detecting the volume below a chosen level @var{threshold}
  757. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  758. floor is set via @var{range}. Because an exact manipulation of the signal
  759. would cause distortion of the waveform the reduction can be levelled over
  760. time. This is done by setting @var{attack} and @var{release}.
  761. @var{attack} determines how long the signal has to fall below the threshold
  762. before any reduction will occur and @var{release} sets the time the signal
  763. has to rise above the threshold to reduce the reduction again.
  764. Shorter signals than the chosen attack time will be left untouched.
  765. @table @option
  766. @item level_in
  767. Set input level before filtering.
  768. Default is 1. Allowed range is from 0.015625 to 64.
  769. @item range
  770. Set the level of gain reduction when the signal is below the threshold.
  771. Default is 0.06125. Allowed range is from 0 to 1.
  772. @item threshold
  773. If a signal rises above this level the gain reduction is released.
  774. Default is 0.125. Allowed range is from 0 to 1.
  775. @item ratio
  776. Set a ratio by which the signal is reduced.
  777. Default is 2. Allowed range is from 1 to 9000.
  778. @item attack
  779. Amount of milliseconds the signal has to rise above the threshold before gain
  780. reduction stops.
  781. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  782. @item release
  783. Amount of milliseconds the signal has to fall below the threshold before the
  784. reduction is increased again. Default is 250 milliseconds.
  785. Allowed range is from 0.01 to 9000.
  786. @item makeup
  787. Set amount of amplification of signal after processing.
  788. Default is 1. Allowed range is from 1 to 64.
  789. @item knee
  790. Curve the sharp knee around the threshold to enter gain reduction more softly.
  791. Default is 2.828427125. Allowed range is from 1 to 8.
  792. @item detection
  793. Choose if exact signal should be taken for detection or an RMS like one.
  794. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  795. @item link
  796. Choose if the average level between all channels or the louder channel affects
  797. the reduction.
  798. Default is @code{average}. Can be @code{average} or @code{maximum}.
  799. @end table
  800. @section alimiter
  801. The limiter prevents an input signal from rising over a desired threshold.
  802. This limiter uses lookahead technology to prevent your signal from distorting.
  803. It means that there is a small delay after the signal is processed. Keep in mind
  804. that the delay it produces is the attack time you set.
  805. The filter accepts the following options:
  806. @table @option
  807. @item level_in
  808. Set input gain. Default is 1.
  809. @item level_out
  810. Set output gain. Default is 1.
  811. @item limit
  812. Don't let signals above this level pass the limiter. Default is 1.
  813. @item attack
  814. The limiter will reach its attenuation level in this amount of time in
  815. milliseconds. Default is 5 milliseconds.
  816. @item release
  817. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  818. Default is 50 milliseconds.
  819. @item asc
  820. When gain reduction is always needed ASC takes care of releasing to an
  821. average reduction level rather than reaching a reduction of 0 in the release
  822. time.
  823. @item asc_level
  824. Select how much the release time is affected by ASC, 0 means nearly no changes
  825. in release time while 1 produces higher release times.
  826. @item level
  827. Auto level output signal. Default is enabled.
  828. This normalizes audio back to 0dB if enabled.
  829. @end table
  830. Depending on picked setting it is recommended to upsample input 2x or 4x times
  831. with @ref{aresample} before applying this filter.
  832. @section allpass
  833. Apply a two-pole all-pass filter with central frequency (in Hz)
  834. @var{frequency}, and filter-width @var{width}.
  835. An all-pass filter changes the audio's frequency to phase relationship
  836. without changing its frequency to amplitude relationship.
  837. The filter accepts the following options:
  838. @table @option
  839. @item frequency, f
  840. Set frequency in Hz.
  841. @item width_type, t
  842. Set method to specify band-width of filter.
  843. @table @option
  844. @item h
  845. Hz
  846. @item q
  847. Q-Factor
  848. @item o
  849. octave
  850. @item s
  851. slope
  852. @end table
  853. @item width, w
  854. Specify the band-width of a filter in width_type units.
  855. @item channels, c
  856. Specify which channels to filter, by default all available are filtered.
  857. @end table
  858. @section aloop
  859. Loop audio samples.
  860. The filter accepts the following options:
  861. @table @option
  862. @item loop
  863. Set the number of loops.
  864. @item size
  865. Set maximal number of samples.
  866. @item start
  867. Set first sample of loop.
  868. @end table
  869. @anchor{amerge}
  870. @section amerge
  871. Merge two or more audio streams into a single multi-channel stream.
  872. The filter accepts the following options:
  873. @table @option
  874. @item inputs
  875. Set the number of inputs. Default is 2.
  876. @end table
  877. If the channel layouts of the inputs are disjoint, and therefore compatible,
  878. the channel layout of the output will be set accordingly and the channels
  879. will be reordered as necessary. If the channel layouts of the inputs are not
  880. disjoint, the output will have all the channels of the first input then all
  881. the channels of the second input, in that order, and the channel layout of
  882. the output will be the default value corresponding to the total number of
  883. channels.
  884. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  885. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  886. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  887. first input, b1 is the first channel of the second input).
  888. On the other hand, if both input are in stereo, the output channels will be
  889. in the default order: a1, a2, b1, b2, and the channel layout will be
  890. arbitrarily set to 4.0, which may or may not be the expected value.
  891. All inputs must have the same sample rate, and format.
  892. If inputs do not have the same duration, the output will stop with the
  893. shortest.
  894. @subsection Examples
  895. @itemize
  896. @item
  897. Merge two mono files into a stereo stream:
  898. @example
  899. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  900. @end example
  901. @item
  902. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  903. @example
  904. 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
  905. @end example
  906. @end itemize
  907. @section amix
  908. Mixes multiple audio inputs into a single output.
  909. Note that this filter only supports float samples (the @var{amerge}
  910. and @var{pan} audio filters support many formats). If the @var{amix}
  911. input has integer samples then @ref{aresample} will be automatically
  912. inserted to perform the conversion to float samples.
  913. For example
  914. @example
  915. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  916. @end example
  917. will mix 3 input audio streams to a single output with the same duration as the
  918. first input and a dropout transition time of 3 seconds.
  919. It accepts the following parameters:
  920. @table @option
  921. @item inputs
  922. The number of inputs. If unspecified, it defaults to 2.
  923. @item duration
  924. How to determine the end-of-stream.
  925. @table @option
  926. @item longest
  927. The duration of the longest input. (default)
  928. @item shortest
  929. The duration of the shortest input.
  930. @item first
  931. The duration of the first input.
  932. @end table
  933. @item dropout_transition
  934. The transition time, in seconds, for volume renormalization when an input
  935. stream ends. The default value is 2 seconds.
  936. @end table
  937. @section anequalizer
  938. High-order parametric multiband equalizer for each channel.
  939. It accepts the following parameters:
  940. @table @option
  941. @item params
  942. This option string is in format:
  943. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  944. Each equalizer band is separated by '|'.
  945. @table @option
  946. @item chn
  947. Set channel number to which equalization will be applied.
  948. If input doesn't have that channel the entry is ignored.
  949. @item f
  950. Set central frequency for band.
  951. If input doesn't have that frequency the entry is ignored.
  952. @item w
  953. Set band width in hertz.
  954. @item g
  955. Set band gain in dB.
  956. @item t
  957. Set filter type for band, optional, can be:
  958. @table @samp
  959. @item 0
  960. Butterworth, this is default.
  961. @item 1
  962. Chebyshev type 1.
  963. @item 2
  964. Chebyshev type 2.
  965. @end table
  966. @end table
  967. @item curves
  968. With this option activated frequency response of anequalizer is displayed
  969. in video stream.
  970. @item size
  971. Set video stream size. Only useful if curves option is activated.
  972. @item mgain
  973. Set max gain that will be displayed. Only useful if curves option is activated.
  974. Setting this to a reasonable value makes it possible to display gain which is derived from
  975. neighbour bands which are too close to each other and thus produce higher gain
  976. when both are activated.
  977. @item fscale
  978. Set frequency scale used to draw frequency response in video output.
  979. Can be linear or logarithmic. Default is logarithmic.
  980. @item colors
  981. Set color for each channel curve which is going to be displayed in video stream.
  982. This is list of color names separated by space or by '|'.
  983. Unrecognised or missing colors will be replaced by white color.
  984. @end table
  985. @subsection Examples
  986. @itemize
  987. @item
  988. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  989. for first 2 channels using Chebyshev type 1 filter:
  990. @example
  991. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  992. @end example
  993. @end itemize
  994. @subsection Commands
  995. This filter supports the following commands:
  996. @table @option
  997. @item change
  998. Alter existing filter parameters.
  999. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1000. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1001. error is returned.
  1002. @var{freq} set new frequency parameter.
  1003. @var{width} set new width parameter in herz.
  1004. @var{gain} set new gain parameter in dB.
  1005. Full filter invocation with asendcmd may look like this:
  1006. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1007. @end table
  1008. @section anull
  1009. Pass the audio source unchanged to the output.
  1010. @section apad
  1011. Pad the end of an audio stream with silence.
  1012. This can be used together with @command{ffmpeg} @option{-shortest} to
  1013. extend audio streams to the same length as the video stream.
  1014. A description of the accepted options follows.
  1015. @table @option
  1016. @item packet_size
  1017. Set silence packet size. Default value is 4096.
  1018. @item pad_len
  1019. Set the number of samples of silence to add to the end. After the
  1020. value is reached, the stream is terminated. This option is mutually
  1021. exclusive with @option{whole_len}.
  1022. @item whole_len
  1023. Set the minimum total number of samples in the output audio stream. If
  1024. the value is longer than the input audio length, silence is added to
  1025. the end, until the value is reached. This option is mutually exclusive
  1026. with @option{pad_len}.
  1027. @end table
  1028. If neither the @option{pad_len} nor the @option{whole_len} option is
  1029. set, the filter will add silence to the end of the input stream
  1030. indefinitely.
  1031. @subsection Examples
  1032. @itemize
  1033. @item
  1034. Add 1024 samples of silence to the end of the input:
  1035. @example
  1036. apad=pad_len=1024
  1037. @end example
  1038. @item
  1039. Make sure the audio output will contain at least 10000 samples, pad
  1040. the input with silence if required:
  1041. @example
  1042. apad=whole_len=10000
  1043. @end example
  1044. @item
  1045. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1046. video stream will always result the shortest and will be converted
  1047. until the end in the output file when using the @option{shortest}
  1048. option:
  1049. @example
  1050. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1051. @end example
  1052. @end itemize
  1053. @section aphaser
  1054. Add a phasing effect to the input audio.
  1055. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1056. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1057. A description of the accepted parameters follows.
  1058. @table @option
  1059. @item in_gain
  1060. Set input gain. Default is 0.4.
  1061. @item out_gain
  1062. Set output gain. Default is 0.74
  1063. @item delay
  1064. Set delay in milliseconds. Default is 3.0.
  1065. @item decay
  1066. Set decay. Default is 0.4.
  1067. @item speed
  1068. Set modulation speed in Hz. Default is 0.5.
  1069. @item type
  1070. Set modulation type. Default is triangular.
  1071. It accepts the following values:
  1072. @table @samp
  1073. @item triangular, t
  1074. @item sinusoidal, s
  1075. @end table
  1076. @end table
  1077. @section apulsator
  1078. Audio pulsator is something between an autopanner and a tremolo.
  1079. But it can produce funny stereo effects as well. Pulsator changes the volume
  1080. of the left and right channel based on a LFO (low frequency oscillator) with
  1081. different waveforms and shifted phases.
  1082. This filter have the ability to define an offset between left and right
  1083. channel. An offset of 0 means that both LFO shapes match each other.
  1084. The left and right channel are altered equally - a conventional tremolo.
  1085. An offset of 50% means that the shape of the right channel is exactly shifted
  1086. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1087. an autopanner. At 1 both curves match again. Every setting in between moves the
  1088. phase shift gapless between all stages and produces some "bypassing" sounds with
  1089. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1090. the 0.5) the faster the signal passes from the left to the right speaker.
  1091. The filter accepts the following options:
  1092. @table @option
  1093. @item level_in
  1094. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1095. @item level_out
  1096. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1097. @item mode
  1098. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1099. sawup or sawdown. Default is sine.
  1100. @item amount
  1101. Set modulation. Define how much of original signal is affected by the LFO.
  1102. @item offset_l
  1103. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1104. @item offset_r
  1105. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1106. @item width
  1107. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1108. @item timing
  1109. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1110. @item bpm
  1111. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1112. is set to bpm.
  1113. @item ms
  1114. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1115. is set to ms.
  1116. @item hz
  1117. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1118. if timing is set to hz.
  1119. @end table
  1120. @anchor{aresample}
  1121. @section aresample
  1122. Resample the input audio to the specified parameters, using the
  1123. libswresample library. If none are specified then the filter will
  1124. automatically convert between its input and output.
  1125. This filter is also able to stretch/squeeze the audio data to make it match
  1126. the timestamps or to inject silence / cut out audio to make it match the
  1127. timestamps, do a combination of both or do neither.
  1128. The filter accepts the syntax
  1129. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1130. expresses a sample rate and @var{resampler_options} is a list of
  1131. @var{key}=@var{value} pairs, separated by ":". See the
  1132. @ref{Resampler Options,,the "Resampler Options" section in the
  1133. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1134. for the complete list of supported options.
  1135. @subsection Examples
  1136. @itemize
  1137. @item
  1138. Resample the input audio to 44100Hz:
  1139. @example
  1140. aresample=44100
  1141. @end example
  1142. @item
  1143. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1144. samples per second compensation:
  1145. @example
  1146. aresample=async=1000
  1147. @end example
  1148. @end itemize
  1149. @section areverse
  1150. Reverse an audio clip.
  1151. Warning: This filter requires memory to buffer the entire clip, so trimming
  1152. is suggested.
  1153. @subsection Examples
  1154. @itemize
  1155. @item
  1156. Take the first 5 seconds of a clip, and reverse it.
  1157. @example
  1158. atrim=end=5,areverse
  1159. @end example
  1160. @end itemize
  1161. @section asetnsamples
  1162. Set the number of samples per each output audio frame.
  1163. The last output packet may contain a different number of samples, as
  1164. the filter will flush all the remaining samples when the input audio
  1165. signals its end.
  1166. The filter accepts the following options:
  1167. @table @option
  1168. @item nb_out_samples, n
  1169. Set the number of frames per each output audio frame. The number is
  1170. intended as the number of samples @emph{per each channel}.
  1171. Default value is 1024.
  1172. @item pad, p
  1173. If set to 1, the filter will pad the last audio frame with zeroes, so
  1174. that the last frame will contain the same number of samples as the
  1175. previous ones. Default value is 1.
  1176. @end table
  1177. For example, to set the number of per-frame samples to 1234 and
  1178. disable padding for the last frame, use:
  1179. @example
  1180. asetnsamples=n=1234:p=0
  1181. @end example
  1182. @section asetrate
  1183. Set the sample rate without altering the PCM data.
  1184. This will result in a change of speed and pitch.
  1185. The filter accepts the following options:
  1186. @table @option
  1187. @item sample_rate, r
  1188. Set the output sample rate. Default is 44100 Hz.
  1189. @end table
  1190. @section ashowinfo
  1191. Show a line containing various information for each input audio frame.
  1192. The input audio is not modified.
  1193. The shown line contains a sequence of key/value pairs of the form
  1194. @var{key}:@var{value}.
  1195. The following values are shown in the output:
  1196. @table @option
  1197. @item n
  1198. The (sequential) number of the input frame, starting from 0.
  1199. @item pts
  1200. The presentation timestamp of the input frame, in time base units; the time base
  1201. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1202. @item pts_time
  1203. The presentation timestamp of the input frame in seconds.
  1204. @item pos
  1205. position of the frame in the input stream, -1 if this information in
  1206. unavailable and/or meaningless (for example in case of synthetic audio)
  1207. @item fmt
  1208. The sample format.
  1209. @item chlayout
  1210. The channel layout.
  1211. @item rate
  1212. The sample rate for the audio frame.
  1213. @item nb_samples
  1214. The number of samples (per channel) in the frame.
  1215. @item checksum
  1216. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1217. audio, the data is treated as if all the planes were concatenated.
  1218. @item plane_checksums
  1219. A list of Adler-32 checksums for each data plane.
  1220. @end table
  1221. @anchor{astats}
  1222. @section astats
  1223. Display time domain statistical information about the audio channels.
  1224. Statistics are calculated and displayed for each audio channel and,
  1225. where applicable, an overall figure is also given.
  1226. It accepts the following option:
  1227. @table @option
  1228. @item length
  1229. Short window length in seconds, used for peak and trough RMS measurement.
  1230. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1231. @item metadata
  1232. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1233. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1234. disabled.
  1235. Available keys for each channel are:
  1236. DC_offset
  1237. Min_level
  1238. Max_level
  1239. Min_difference
  1240. Max_difference
  1241. Mean_difference
  1242. RMS_difference
  1243. Peak_level
  1244. RMS_peak
  1245. RMS_trough
  1246. Crest_factor
  1247. Flat_factor
  1248. Peak_count
  1249. Bit_depth
  1250. and for Overall:
  1251. DC_offset
  1252. Min_level
  1253. Max_level
  1254. Min_difference
  1255. Max_difference
  1256. Mean_difference
  1257. RMS_difference
  1258. Peak_level
  1259. RMS_level
  1260. RMS_peak
  1261. RMS_trough
  1262. Flat_factor
  1263. Peak_count
  1264. Bit_depth
  1265. Number_of_samples
  1266. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1267. this @code{lavfi.astats.Overall.Peak_count}.
  1268. For description what each key means read below.
  1269. @item reset
  1270. Set number of frame after which stats are going to be recalculated.
  1271. Default is disabled.
  1272. @end table
  1273. A description of each shown parameter follows:
  1274. @table @option
  1275. @item DC offset
  1276. Mean amplitude displacement from zero.
  1277. @item Min level
  1278. Minimal sample level.
  1279. @item Max level
  1280. Maximal sample level.
  1281. @item Min difference
  1282. Minimal difference between two consecutive samples.
  1283. @item Max difference
  1284. Maximal difference between two consecutive samples.
  1285. @item Mean difference
  1286. Mean difference between two consecutive samples.
  1287. The average of each difference between two consecutive samples.
  1288. @item RMS difference
  1289. Root Mean Square difference between two consecutive samples.
  1290. @item Peak level dB
  1291. @item RMS level dB
  1292. Standard peak and RMS level measured in dBFS.
  1293. @item RMS peak dB
  1294. @item RMS trough dB
  1295. Peak and trough values for RMS level measured over a short window.
  1296. @item Crest factor
  1297. Standard ratio of peak to RMS level (note: not in dB).
  1298. @item Flat factor
  1299. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1300. (i.e. either @var{Min level} or @var{Max level}).
  1301. @item Peak count
  1302. Number of occasions (not the number of samples) that the signal attained either
  1303. @var{Min level} or @var{Max level}.
  1304. @item Bit depth
  1305. Overall bit depth of audio. Number of bits used for each sample.
  1306. @end table
  1307. @section atempo
  1308. Adjust audio tempo.
  1309. The filter accepts exactly one parameter, the audio tempo. If not
  1310. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1311. be in the [0.5, 2.0] range.
  1312. @subsection Examples
  1313. @itemize
  1314. @item
  1315. Slow down audio to 80% tempo:
  1316. @example
  1317. atempo=0.8
  1318. @end example
  1319. @item
  1320. To speed up audio to 125% tempo:
  1321. @example
  1322. atempo=1.25
  1323. @end example
  1324. @end itemize
  1325. @section atrim
  1326. Trim the input so that the output contains one continuous subpart of the input.
  1327. It accepts the following parameters:
  1328. @table @option
  1329. @item start
  1330. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1331. sample with the timestamp @var{start} will be the first sample in the output.
  1332. @item end
  1333. Specify time of the first audio sample that will be dropped, i.e. the
  1334. audio sample immediately preceding the one with the timestamp @var{end} will be
  1335. the last sample in the output.
  1336. @item start_pts
  1337. Same as @var{start}, except this option sets the start timestamp in samples
  1338. instead of seconds.
  1339. @item end_pts
  1340. Same as @var{end}, except this option sets the end timestamp in samples instead
  1341. of seconds.
  1342. @item duration
  1343. The maximum duration of the output in seconds.
  1344. @item start_sample
  1345. The number of the first sample that should be output.
  1346. @item end_sample
  1347. The number of the first sample that should be dropped.
  1348. @end table
  1349. @option{start}, @option{end}, and @option{duration} are expressed as time
  1350. duration specifications; see
  1351. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1352. Note that the first two sets of the start/end options and the @option{duration}
  1353. option look at the frame timestamp, while the _sample options simply count the
  1354. samples that pass through the filter. So start/end_pts and start/end_sample will
  1355. give different results when the timestamps are wrong, inexact or do not start at
  1356. zero. Also note that this filter does not modify the timestamps. If you wish
  1357. to have the output timestamps start at zero, insert the asetpts filter after the
  1358. atrim filter.
  1359. If multiple start or end options are set, this filter tries to be greedy and
  1360. keep all samples that match at least one of the specified constraints. To keep
  1361. only the part that matches all the constraints at once, chain multiple atrim
  1362. filters.
  1363. The defaults are such that all the input is kept. So it is possible to set e.g.
  1364. just the end values to keep everything before the specified time.
  1365. Examples:
  1366. @itemize
  1367. @item
  1368. Drop everything except the second minute of input:
  1369. @example
  1370. ffmpeg -i INPUT -af atrim=60:120
  1371. @end example
  1372. @item
  1373. Keep only the first 1000 samples:
  1374. @example
  1375. ffmpeg -i INPUT -af atrim=end_sample=1000
  1376. @end example
  1377. @end itemize
  1378. @section bandpass
  1379. Apply a two-pole Butterworth band-pass filter with central
  1380. frequency @var{frequency}, and (3dB-point) band-width width.
  1381. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1382. instead of the default: constant 0dB peak gain.
  1383. The filter roll off at 6dB per octave (20dB per decade).
  1384. The filter accepts the following options:
  1385. @table @option
  1386. @item frequency, f
  1387. Set the filter's central frequency. Default is @code{3000}.
  1388. @item csg
  1389. Constant skirt gain if set to 1. Defaults to 0.
  1390. @item width_type, t
  1391. Set method to specify band-width of filter.
  1392. @table @option
  1393. @item h
  1394. Hz
  1395. @item q
  1396. Q-Factor
  1397. @item o
  1398. octave
  1399. @item s
  1400. slope
  1401. @end table
  1402. @item width, w
  1403. Specify the band-width of a filter in width_type units.
  1404. @item channels, c
  1405. Specify which channels to filter, by default all available are filtered.
  1406. @end table
  1407. @section bandreject
  1408. Apply a two-pole Butterworth band-reject filter with central
  1409. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1410. The filter roll off at 6dB per octave (20dB per decade).
  1411. The filter accepts the following options:
  1412. @table @option
  1413. @item frequency, f
  1414. Set the filter's central frequency. Default is @code{3000}.
  1415. @item width_type, t
  1416. Set method to specify band-width of filter.
  1417. @table @option
  1418. @item h
  1419. Hz
  1420. @item q
  1421. Q-Factor
  1422. @item o
  1423. octave
  1424. @item s
  1425. slope
  1426. @end table
  1427. @item width, w
  1428. Specify the band-width of a filter in width_type units.
  1429. @item channels, c
  1430. Specify which channels to filter, by default all available are filtered.
  1431. @end table
  1432. @section bass
  1433. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1434. shelving filter with a response similar to that of a standard
  1435. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1436. The filter accepts the following options:
  1437. @table @option
  1438. @item gain, g
  1439. Give the gain at 0 Hz. Its useful range is about -20
  1440. (for a large cut) to +20 (for a large boost).
  1441. Beware of clipping when using a positive gain.
  1442. @item frequency, f
  1443. Set the filter's central frequency and so can be used
  1444. to extend or reduce the frequency range to be boosted or cut.
  1445. The default value is @code{100} Hz.
  1446. @item width_type, t
  1447. Set method to specify band-width of filter.
  1448. @table @option
  1449. @item h
  1450. Hz
  1451. @item q
  1452. Q-Factor
  1453. @item o
  1454. octave
  1455. @item s
  1456. slope
  1457. @end table
  1458. @item width, w
  1459. Determine how steep is the filter's shelf transition.
  1460. @item channels, c
  1461. Specify which channels to filter, by default all available are filtered.
  1462. @end table
  1463. @section biquad
  1464. Apply a biquad IIR filter with the given coefficients.
  1465. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1466. are the numerator and denominator coefficients respectively.
  1467. and @var{channels}, @var{c} specify which channels to filter, by default all
  1468. available are filtered.
  1469. @section bs2b
  1470. Bauer stereo to binaural transformation, which improves headphone listening of
  1471. stereo audio records.
  1472. To enable compilation of this filter you need to configure FFmpeg with
  1473. @code{--enable-libbs2b}.
  1474. It accepts the following parameters:
  1475. @table @option
  1476. @item profile
  1477. Pre-defined crossfeed level.
  1478. @table @option
  1479. @item default
  1480. Default level (fcut=700, feed=50).
  1481. @item cmoy
  1482. Chu Moy circuit (fcut=700, feed=60).
  1483. @item jmeier
  1484. Jan Meier circuit (fcut=650, feed=95).
  1485. @end table
  1486. @item fcut
  1487. Cut frequency (in Hz).
  1488. @item feed
  1489. Feed level (in Hz).
  1490. @end table
  1491. @section channelmap
  1492. Remap input channels to new locations.
  1493. It accepts the following parameters:
  1494. @table @option
  1495. @item map
  1496. Map channels from input to output. The argument is a '|'-separated list of
  1497. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1498. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1499. channel (e.g. FL for front left) or its index in the input channel layout.
  1500. @var{out_channel} is the name of the output channel or its index in the output
  1501. channel layout. If @var{out_channel} is not given then it is implicitly an
  1502. index, starting with zero and increasing by one for each mapping.
  1503. @item channel_layout
  1504. The channel layout of the output stream.
  1505. @end table
  1506. If no mapping is present, the filter will implicitly map input channels to
  1507. output channels, preserving indices.
  1508. For example, assuming a 5.1+downmix input MOV file,
  1509. @example
  1510. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1511. @end example
  1512. will create an output WAV file tagged as stereo from the downmix channels of
  1513. the input.
  1514. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1515. @example
  1516. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1517. @end example
  1518. @section channelsplit
  1519. Split each channel from an input audio stream into a separate output stream.
  1520. It accepts the following parameters:
  1521. @table @option
  1522. @item channel_layout
  1523. The channel layout of the input stream. The default is "stereo".
  1524. @end table
  1525. For example, assuming a stereo input MP3 file,
  1526. @example
  1527. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1528. @end example
  1529. will create an output Matroska file with two audio streams, one containing only
  1530. the left channel and the other the right channel.
  1531. Split a 5.1 WAV file into per-channel files:
  1532. @example
  1533. ffmpeg -i in.wav -filter_complex
  1534. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1535. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1536. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1537. side_right.wav
  1538. @end example
  1539. @section chorus
  1540. Add a chorus effect to the audio.
  1541. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1542. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1543. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1544. The modulation depth defines the range the modulated delay is played before or after
  1545. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1546. sound tuned around the original one, like in a chorus where some vocals are slightly
  1547. off key.
  1548. It accepts the following parameters:
  1549. @table @option
  1550. @item in_gain
  1551. Set input gain. Default is 0.4.
  1552. @item out_gain
  1553. Set output gain. Default is 0.4.
  1554. @item delays
  1555. Set delays. A typical delay is around 40ms to 60ms.
  1556. @item decays
  1557. Set decays.
  1558. @item speeds
  1559. Set speeds.
  1560. @item depths
  1561. Set depths.
  1562. @end table
  1563. @subsection Examples
  1564. @itemize
  1565. @item
  1566. A single delay:
  1567. @example
  1568. chorus=0.7:0.9:55:0.4:0.25:2
  1569. @end example
  1570. @item
  1571. Two delays:
  1572. @example
  1573. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1574. @end example
  1575. @item
  1576. Fuller sounding chorus with three delays:
  1577. @example
  1578. 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
  1579. @end example
  1580. @end itemize
  1581. @section compand
  1582. Compress or expand the audio's dynamic range.
  1583. It accepts the following parameters:
  1584. @table @option
  1585. @item attacks
  1586. @item decays
  1587. A list of times in seconds for each channel over which the instantaneous level
  1588. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1589. increase of volume and @var{decays} refers to decrease of volume. For most
  1590. situations, the attack time (response to the audio getting louder) should be
  1591. shorter than the decay time, because the human ear is more sensitive to sudden
  1592. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1593. a typical value for decay is 0.8 seconds.
  1594. If specified number of attacks & decays is lower than number of channels, the last
  1595. set attack/decay will be used for all remaining channels.
  1596. @item points
  1597. A list of points for the transfer function, specified in dB relative to the
  1598. maximum possible signal amplitude. Each key points list must be defined using
  1599. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1600. @code{x0/y0 x1/y1 x2/y2 ....}
  1601. The input values must be in strictly increasing order but the transfer function
  1602. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1603. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1604. function are @code{-70/-70|-60/-20|1/0}.
  1605. @item soft-knee
  1606. Set the curve radius in dB for all joints. It defaults to 0.01.
  1607. @item gain
  1608. Set the additional gain in dB to be applied at all points on the transfer
  1609. function. This allows for easy adjustment of the overall gain.
  1610. It defaults to 0.
  1611. @item volume
  1612. Set an initial volume, in dB, to be assumed for each channel when filtering
  1613. starts. This permits the user to supply a nominal level initially, so that, for
  1614. example, a very large gain is not applied to initial signal levels before the
  1615. companding has begun to operate. A typical value for audio which is initially
  1616. quiet is -90 dB. It defaults to 0.
  1617. @item delay
  1618. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1619. delayed before being fed to the volume adjuster. Specifying a delay
  1620. approximately equal to the attack/decay times allows the filter to effectively
  1621. operate in predictive rather than reactive mode. It defaults to 0.
  1622. @end table
  1623. @subsection Examples
  1624. @itemize
  1625. @item
  1626. Make music with both quiet and loud passages suitable for listening to in a
  1627. noisy environment:
  1628. @example
  1629. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1630. @end example
  1631. Another example for audio with whisper and explosion parts:
  1632. @example
  1633. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1634. @end example
  1635. @item
  1636. A noise gate for when the noise is at a lower level than the signal:
  1637. @example
  1638. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1639. @end example
  1640. @item
  1641. Here is another noise gate, this time for when the noise is at a higher level
  1642. than the signal (making it, in some ways, similar to squelch):
  1643. @example
  1644. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1645. @end example
  1646. @item
  1647. 2:1 compression starting at -6dB:
  1648. @example
  1649. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1650. @end example
  1651. @item
  1652. 2:1 compression starting at -9dB:
  1653. @example
  1654. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1655. @end example
  1656. @item
  1657. 2:1 compression starting at -12dB:
  1658. @example
  1659. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1660. @end example
  1661. @item
  1662. 2:1 compression starting at -18dB:
  1663. @example
  1664. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1665. @end example
  1666. @item
  1667. 3:1 compression starting at -15dB:
  1668. @example
  1669. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1670. @end example
  1671. @item
  1672. Compressor/Gate:
  1673. @example
  1674. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1675. @end example
  1676. @item
  1677. Expander:
  1678. @example
  1679. 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
  1680. @end example
  1681. @item
  1682. Hard limiter at -6dB:
  1683. @example
  1684. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1685. @end example
  1686. @item
  1687. Hard limiter at -12dB:
  1688. @example
  1689. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1690. @end example
  1691. @item
  1692. Hard noise gate at -35 dB:
  1693. @example
  1694. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1695. @end example
  1696. @item
  1697. Soft limiter:
  1698. @example
  1699. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1700. @end example
  1701. @end itemize
  1702. @section compensationdelay
  1703. Compensation Delay Line is a metric based delay to compensate differing
  1704. positions of microphones or speakers.
  1705. For example, you have recorded guitar with two microphones placed in
  1706. different location. Because the front of sound wave has fixed speed in
  1707. normal conditions, the phasing of microphones can vary and depends on
  1708. their location and interposition. The best sound mix can be achieved when
  1709. these microphones are in phase (synchronized). Note that distance of
  1710. ~30 cm between microphones makes one microphone to capture signal in
  1711. antiphase to another microphone. That makes the final mix sounding moody.
  1712. This filter helps to solve phasing problems by adding different delays
  1713. to each microphone track and make them synchronized.
  1714. The best result can be reached when you take one track as base and
  1715. synchronize other tracks one by one with it.
  1716. Remember that synchronization/delay tolerance depends on sample rate, too.
  1717. Higher sample rates will give more tolerance.
  1718. It accepts the following parameters:
  1719. @table @option
  1720. @item mm
  1721. Set millimeters distance. This is compensation distance for fine tuning.
  1722. Default is 0.
  1723. @item cm
  1724. Set cm distance. This is compensation distance for tightening distance setup.
  1725. Default is 0.
  1726. @item m
  1727. Set meters distance. This is compensation distance for hard distance setup.
  1728. Default is 0.
  1729. @item dry
  1730. Set dry amount. Amount of unprocessed (dry) signal.
  1731. Default is 0.
  1732. @item wet
  1733. Set wet amount. Amount of processed (wet) signal.
  1734. Default is 1.
  1735. @item temp
  1736. Set temperature degree in Celsius. This is the temperature of the environment.
  1737. Default is 20.
  1738. @end table
  1739. @section crossfeed
  1740. Apply headphone crossfeed filter.
  1741. Crossfeed is the process of blending the left and right channels of stereo
  1742. audio recording.
  1743. It is mainly used to reduce extreme stereo separation of low frequencies.
  1744. The intent is to produce more speaker like sound to the listener.
  1745. The filter accepts the following options:
  1746. @table @option
  1747. @item strength
  1748. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1749. This sets gain of low shelf filter for side part of stereo image.
  1750. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1751. @item range
  1752. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1753. This sets cut off frequency of low shelf filter. Default is cut off near
  1754. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1755. @item level_in
  1756. Set input gain. Default is 0.9.
  1757. @item level_out
  1758. Set output gain. Default is 1.
  1759. @end table
  1760. @section crystalizer
  1761. Simple algorithm to expand audio dynamic range.
  1762. The filter accepts the following options:
  1763. @table @option
  1764. @item i
  1765. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1766. (unchanged sound) to 10.0 (maximum effect).
  1767. @item c
  1768. Enable clipping. By default is enabled.
  1769. @end table
  1770. @section dcshift
  1771. Apply a DC shift to the audio.
  1772. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1773. in the recording chain) from the audio. The effect of a DC offset is reduced
  1774. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1775. a signal has a DC offset.
  1776. @table @option
  1777. @item shift
  1778. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1779. the audio.
  1780. @item limitergain
  1781. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1782. used to prevent clipping.
  1783. @end table
  1784. @section dynaudnorm
  1785. Dynamic Audio Normalizer.
  1786. This filter applies a certain amount of gain to the input audio in order
  1787. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1788. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1789. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1790. This allows for applying extra gain to the "quiet" sections of the audio
  1791. while avoiding distortions or clipping the "loud" sections. In other words:
  1792. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1793. sections, in the sense that the volume of each section is brought to the
  1794. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1795. this goal *without* applying "dynamic range compressing". It will retain 100%
  1796. of the dynamic range *within* each section of the audio file.
  1797. @table @option
  1798. @item f
  1799. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1800. Default is 500 milliseconds.
  1801. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1802. referred to as frames. This is required, because a peak magnitude has no
  1803. meaning for just a single sample value. Instead, we need to determine the
  1804. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1805. normalizer would simply use the peak magnitude of the complete file, the
  1806. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1807. frame. The length of a frame is specified in milliseconds. By default, the
  1808. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1809. been found to give good results with most files.
  1810. Note that the exact frame length, in number of samples, will be determined
  1811. automatically, based on the sampling rate of the individual input audio file.
  1812. @item g
  1813. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1814. number. Default is 31.
  1815. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1816. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1817. is specified in frames, centered around the current frame. For the sake of
  1818. simplicity, this must be an odd number. Consequently, the default value of 31
  1819. takes into account the current frame, as well as the 15 preceding frames and
  1820. the 15 subsequent frames. Using a larger window results in a stronger
  1821. smoothing effect and thus in less gain variation, i.e. slower gain
  1822. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1823. effect and thus in more gain variation, i.e. faster gain adaptation.
  1824. In other words, the more you increase this value, the more the Dynamic Audio
  1825. Normalizer will behave like a "traditional" normalization filter. On the
  1826. contrary, the more you decrease this value, the more the Dynamic Audio
  1827. Normalizer will behave like a dynamic range compressor.
  1828. @item p
  1829. Set the target peak value. This specifies the highest permissible magnitude
  1830. level for the normalized audio input. This filter will try to approach the
  1831. target peak magnitude as closely as possible, but at the same time it also
  1832. makes sure that the normalized signal will never exceed the peak magnitude.
  1833. A frame's maximum local gain factor is imposed directly by the target peak
  1834. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1835. It is not recommended to go above this value.
  1836. @item m
  1837. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1838. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1839. factor for each input frame, i.e. the maximum gain factor that does not
  1840. result in clipping or distortion. The maximum gain factor is determined by
  1841. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1842. additionally bounds the frame's maximum gain factor by a predetermined
  1843. (global) maximum gain factor. This is done in order to avoid excessive gain
  1844. factors in "silent" or almost silent frames. By default, the maximum gain
  1845. factor is 10.0, For most inputs the default value should be sufficient and
  1846. it usually is not recommended to increase this value. Though, for input
  1847. with an extremely low overall volume level, it may be necessary to allow even
  1848. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1849. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1850. Instead, a "sigmoid" threshold function will be applied. This way, the
  1851. gain factors will smoothly approach the threshold value, but never exceed that
  1852. value.
  1853. @item r
  1854. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1855. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1856. This means that the maximum local gain factor for each frame is defined
  1857. (only) by the frame's highest magnitude sample. This way, the samples can
  1858. be amplified as much as possible without exceeding the maximum signal
  1859. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1860. Normalizer can also take into account the frame's root mean square,
  1861. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1862. determine the power of a time-varying signal. It is therefore considered
  1863. that the RMS is a better approximation of the "perceived loudness" than
  1864. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1865. frames to a constant RMS value, a uniform "perceived loudness" can be
  1866. established. If a target RMS value has been specified, a frame's local gain
  1867. factor is defined as the factor that would result in exactly that RMS value.
  1868. Note, however, that the maximum local gain factor is still restricted by the
  1869. frame's highest magnitude sample, in order to prevent clipping.
  1870. @item n
  1871. Enable channels coupling. By default is enabled.
  1872. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1873. amount. This means the same gain factor will be applied to all channels, i.e.
  1874. the maximum possible gain factor is determined by the "loudest" channel.
  1875. However, in some recordings, it may happen that the volume of the different
  1876. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1877. In this case, this option can be used to disable the channel coupling. This way,
  1878. the gain factor will be determined independently for each channel, depending
  1879. only on the individual channel's highest magnitude sample. This allows for
  1880. harmonizing the volume of the different channels.
  1881. @item c
  1882. Enable DC bias correction. By default is disabled.
  1883. An audio signal (in the time domain) is a sequence of sample values.
  1884. In the Dynamic Audio Normalizer these sample values are represented in the
  1885. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1886. audio signal, or "waveform", should be centered around the zero point.
  1887. That means if we calculate the mean value of all samples in a file, or in a
  1888. single frame, then the result should be 0.0 or at least very close to that
  1889. value. If, however, there is a significant deviation of the mean value from
  1890. 0.0, in either positive or negative direction, this is referred to as a
  1891. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1892. Audio Normalizer provides optional DC bias correction.
  1893. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1894. the mean value, or "DC correction" offset, of each input frame and subtract
  1895. that value from all of the frame's sample values which ensures those samples
  1896. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1897. boundaries, the DC correction offset values will be interpolated smoothly
  1898. between neighbouring frames.
  1899. @item b
  1900. Enable alternative boundary mode. By default is disabled.
  1901. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1902. around each frame. This includes the preceding frames as well as the
  1903. subsequent frames. However, for the "boundary" frames, located at the very
  1904. beginning and at the very end of the audio file, not all neighbouring
  1905. frames are available. In particular, for the first few frames in the audio
  1906. file, the preceding frames are not known. And, similarly, for the last few
  1907. frames in the audio file, the subsequent frames are not known. Thus, the
  1908. question arises which gain factors should be assumed for the missing frames
  1909. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1910. to deal with this situation. The default boundary mode assumes a gain factor
  1911. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1912. "fade out" at the beginning and at the end of the input, respectively.
  1913. @item s
  1914. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1915. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1916. compression. This means that signal peaks will not be pruned and thus the
  1917. full dynamic range will be retained within each local neighbourhood. However,
  1918. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1919. normalization algorithm with a more "traditional" compression.
  1920. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1921. (thresholding) function. If (and only if) the compression feature is enabled,
  1922. all input frames will be processed by a soft knee thresholding function prior
  1923. to the actual normalization process. Put simply, the thresholding function is
  1924. going to prune all samples whose magnitude exceeds a certain threshold value.
  1925. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1926. value. Instead, the threshold value will be adjusted for each individual
  1927. frame.
  1928. In general, smaller parameters result in stronger compression, and vice versa.
  1929. Values below 3.0 are not recommended, because audible distortion may appear.
  1930. @end table
  1931. @section earwax
  1932. Make audio easier to listen to on headphones.
  1933. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1934. so that when listened to on headphones the stereo image is moved from
  1935. inside your head (standard for headphones) to outside and in front of
  1936. the listener (standard for speakers).
  1937. Ported from SoX.
  1938. @section equalizer
  1939. Apply a two-pole peaking equalisation (EQ) filter. With this
  1940. filter, the signal-level at and around a selected frequency can
  1941. be increased or decreased, whilst (unlike bandpass and bandreject
  1942. filters) that at all other frequencies is unchanged.
  1943. In order to produce complex equalisation curves, this filter can
  1944. be given several times, each with a different central frequency.
  1945. The filter accepts the following options:
  1946. @table @option
  1947. @item frequency, f
  1948. Set the filter's central frequency in Hz.
  1949. @item width_type, t
  1950. Set method to specify band-width of filter.
  1951. @table @option
  1952. @item h
  1953. Hz
  1954. @item q
  1955. Q-Factor
  1956. @item o
  1957. octave
  1958. @item s
  1959. slope
  1960. @end table
  1961. @item width, w
  1962. Specify the band-width of a filter in width_type units.
  1963. @item gain, g
  1964. Set the required gain or attenuation in dB.
  1965. Beware of clipping when using a positive gain.
  1966. @item channels, c
  1967. Specify which channels to filter, by default all available are filtered.
  1968. @end table
  1969. @subsection Examples
  1970. @itemize
  1971. @item
  1972. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1973. @example
  1974. equalizer=f=1000:t=h:width=200:g=-10
  1975. @end example
  1976. @item
  1977. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1978. @example
  1979. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  1980. @end example
  1981. @end itemize
  1982. @section extrastereo
  1983. Linearly increases the difference between left and right channels which
  1984. adds some sort of "live" effect to playback.
  1985. The filter accepts the following options:
  1986. @table @option
  1987. @item m
  1988. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1989. (average of both channels), with 1.0 sound will be unchanged, with
  1990. -1.0 left and right channels will be swapped.
  1991. @item c
  1992. Enable clipping. By default is enabled.
  1993. @end table
  1994. @section firequalizer
  1995. Apply FIR Equalization using arbitrary frequency response.
  1996. The filter accepts the following option:
  1997. @table @option
  1998. @item gain
  1999. Set gain curve equation (in dB). The expression can contain variables:
  2000. @table @option
  2001. @item f
  2002. the evaluated frequency
  2003. @item sr
  2004. sample rate
  2005. @item ch
  2006. channel number, set to 0 when multichannels evaluation is disabled
  2007. @item chid
  2008. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2009. multichannels evaluation is disabled
  2010. @item chs
  2011. number of channels
  2012. @item chlayout
  2013. channel_layout, see libavutil/channel_layout.h
  2014. @end table
  2015. and functions:
  2016. @table @option
  2017. @item gain_interpolate(f)
  2018. interpolate gain on frequency f based on gain_entry
  2019. @item cubic_interpolate(f)
  2020. same as gain_interpolate, but smoother
  2021. @end table
  2022. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2023. @item gain_entry
  2024. Set gain entry for gain_interpolate function. The expression can
  2025. contain functions:
  2026. @table @option
  2027. @item entry(f, g)
  2028. store gain entry at frequency f with value g
  2029. @end table
  2030. This option is also available as command.
  2031. @item delay
  2032. Set filter delay in seconds. Higher value means more accurate.
  2033. Default is @code{0.01}.
  2034. @item accuracy
  2035. Set filter accuracy in Hz. Lower value means more accurate.
  2036. Default is @code{5}.
  2037. @item wfunc
  2038. Set window function. Acceptable values are:
  2039. @table @option
  2040. @item rectangular
  2041. rectangular window, useful when gain curve is already smooth
  2042. @item hann
  2043. hann window (default)
  2044. @item hamming
  2045. hamming window
  2046. @item blackman
  2047. blackman window
  2048. @item nuttall3
  2049. 3-terms continuous 1st derivative nuttall window
  2050. @item mnuttall3
  2051. minimum 3-terms discontinuous nuttall window
  2052. @item nuttall
  2053. 4-terms continuous 1st derivative nuttall window
  2054. @item bnuttall
  2055. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2056. @item bharris
  2057. blackman-harris window
  2058. @item tukey
  2059. tukey window
  2060. @end table
  2061. @item fixed
  2062. If enabled, use fixed number of audio samples. This improves speed when
  2063. filtering with large delay. Default is disabled.
  2064. @item multi
  2065. Enable multichannels evaluation on gain. Default is disabled.
  2066. @item zero_phase
  2067. Enable zero phase mode by subtracting timestamp to compensate delay.
  2068. Default is disabled.
  2069. @item scale
  2070. Set scale used by gain. Acceptable values are:
  2071. @table @option
  2072. @item linlin
  2073. linear frequency, linear gain
  2074. @item linlog
  2075. linear frequency, logarithmic (in dB) gain (default)
  2076. @item loglin
  2077. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2078. @item loglog
  2079. logarithmic frequency, logarithmic gain
  2080. @end table
  2081. @item dumpfile
  2082. Set file for dumping, suitable for gnuplot.
  2083. @item dumpscale
  2084. Set scale for dumpfile. Acceptable values are same with scale option.
  2085. Default is linlog.
  2086. @item fft2
  2087. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2088. Default is disabled.
  2089. @end table
  2090. @subsection Examples
  2091. @itemize
  2092. @item
  2093. lowpass at 1000 Hz:
  2094. @example
  2095. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2096. @end example
  2097. @item
  2098. lowpass at 1000 Hz with gain_entry:
  2099. @example
  2100. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2101. @end example
  2102. @item
  2103. custom equalization:
  2104. @example
  2105. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2106. @end example
  2107. @item
  2108. higher delay with zero phase to compensate delay:
  2109. @example
  2110. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2111. @end example
  2112. @item
  2113. lowpass on left channel, highpass on right channel:
  2114. @example
  2115. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2116. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2117. @end example
  2118. @end itemize
  2119. @section flanger
  2120. Apply a flanging effect to the audio.
  2121. The filter accepts the following options:
  2122. @table @option
  2123. @item delay
  2124. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2125. @item depth
  2126. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2127. @item regen
  2128. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2129. Default value is 0.
  2130. @item width
  2131. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2132. Default value is 71.
  2133. @item speed
  2134. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2135. @item shape
  2136. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2137. Default value is @var{sinusoidal}.
  2138. @item phase
  2139. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2140. Default value is 25.
  2141. @item interp
  2142. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2143. Default is @var{linear}.
  2144. @end table
  2145. @section hdcd
  2146. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2147. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2148. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2149. of HDCD, and detects the Transient Filter flag.
  2150. @example
  2151. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2152. @end example
  2153. When using the filter with wav, note the default encoding for wav is 16-bit,
  2154. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2155. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2156. @example
  2157. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2158. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2159. @end example
  2160. The filter accepts the following options:
  2161. @table @option
  2162. @item disable_autoconvert
  2163. Disable any automatic format conversion or resampling in the filter graph.
  2164. @item process_stereo
  2165. Process the stereo channels together. If target_gain does not match between
  2166. channels, consider it invalid and use the last valid target_gain.
  2167. @item cdt_ms
  2168. Set the code detect timer period in ms.
  2169. @item force_pe
  2170. Always extend peaks above -3dBFS even if PE isn't signaled.
  2171. @item analyze_mode
  2172. Replace audio with a solid tone and adjust the amplitude to signal some
  2173. specific aspect of the decoding process. The output file can be loaded in
  2174. an audio editor alongside the original to aid analysis.
  2175. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2176. Modes are:
  2177. @table @samp
  2178. @item 0, off
  2179. Disabled
  2180. @item 1, lle
  2181. Gain adjustment level at each sample
  2182. @item 2, pe
  2183. Samples where peak extend occurs
  2184. @item 3, cdt
  2185. Samples where the code detect timer is active
  2186. @item 4, tgm
  2187. Samples where the target gain does not match between channels
  2188. @end table
  2189. @end table
  2190. @section headphone
  2191. Apply head-related transfer functions (HRTFs) to create virtual
  2192. loudspeakers around the user for binaural listening via headphones.
  2193. The HRIRs are provided via additional streams, for each channel
  2194. one stereo input stream is needed.
  2195. The filter accepts the following options:
  2196. @table @option
  2197. @item map
  2198. Set mapping of input streams for convolution.
  2199. The argument is a '|'-separated list of channel names in order as they
  2200. are given as additional stream inputs for filter.
  2201. This also specify number of input streams. Number of input streams
  2202. must be not less than number of channels in first stream plus one.
  2203. @item gain
  2204. Set gain applied to audio. Value is in dB. Default is 0.
  2205. @item type
  2206. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2207. processing audio in time domain which is slow.
  2208. @var{freq} is processing audio in frequency domain which is fast.
  2209. Default is @var{freq}.
  2210. @item lfe
  2211. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2212. @end table
  2213. @subsection Examples
  2214. @itemize
  2215. @item
  2216. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2217. each amovie filter use stereo file with IR coefficients as input.
  2218. The files give coefficients for each position of virtual loudspeaker:
  2219. @example
  2220. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2221. output.wav
  2222. @end example
  2223. @end itemize
  2224. @section highpass
  2225. Apply a high-pass filter with 3dB point frequency.
  2226. The filter can be either single-pole, or double-pole (the default).
  2227. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2228. The filter accepts the following options:
  2229. @table @option
  2230. @item frequency, f
  2231. Set frequency in Hz. Default is 3000.
  2232. @item poles, p
  2233. Set number of poles. Default is 2.
  2234. @item width_type, t
  2235. Set method to specify band-width of filter.
  2236. @table @option
  2237. @item h
  2238. Hz
  2239. @item q
  2240. Q-Factor
  2241. @item o
  2242. octave
  2243. @item s
  2244. slope
  2245. @end table
  2246. @item width, w
  2247. Specify the band-width of a filter in width_type units.
  2248. Applies only to double-pole filter.
  2249. The default is 0.707q and gives a Butterworth response.
  2250. @item channels, c
  2251. Specify which channels to filter, by default all available are filtered.
  2252. @end table
  2253. @section join
  2254. Join multiple input streams into one multi-channel stream.
  2255. It accepts the following parameters:
  2256. @table @option
  2257. @item inputs
  2258. The number of input streams. It defaults to 2.
  2259. @item channel_layout
  2260. The desired output channel layout. It defaults to stereo.
  2261. @item map
  2262. Map channels from inputs to output. The argument is a '|'-separated list of
  2263. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2264. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2265. can be either the name of the input channel (e.g. FL for front left) or its
  2266. index in the specified input stream. @var{out_channel} is the name of the output
  2267. channel.
  2268. @end table
  2269. The filter will attempt to guess the mappings when they are not specified
  2270. explicitly. It does so by first trying to find an unused matching input channel
  2271. and if that fails it picks the first unused input channel.
  2272. Join 3 inputs (with properly set channel layouts):
  2273. @example
  2274. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2275. @end example
  2276. Build a 5.1 output from 6 single-channel streams:
  2277. @example
  2278. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2279. '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'
  2280. out
  2281. @end example
  2282. @section ladspa
  2283. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2284. To enable compilation of this filter you need to configure FFmpeg with
  2285. @code{--enable-ladspa}.
  2286. @table @option
  2287. @item file, f
  2288. Specifies the name of LADSPA plugin library to load. If the environment
  2289. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2290. each one of the directories specified by the colon separated list in
  2291. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2292. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2293. @file{/usr/lib/ladspa/}.
  2294. @item plugin, p
  2295. Specifies the plugin within the library. Some libraries contain only
  2296. one plugin, but others contain many of them. If this is not set filter
  2297. will list all available plugins within the specified library.
  2298. @item controls, c
  2299. Set the '|' separated list of controls which are zero or more floating point
  2300. values that determine the behavior of the loaded plugin (for example delay,
  2301. threshold or gain).
  2302. Controls need to be defined using the following syntax:
  2303. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2304. @var{valuei} is the value set on the @var{i}-th control.
  2305. Alternatively they can be also defined using the following syntax:
  2306. @var{value0}|@var{value1}|@var{value2}|..., where
  2307. @var{valuei} is the value set on the @var{i}-th control.
  2308. If @option{controls} is set to @code{help}, all available controls and
  2309. their valid ranges are printed.
  2310. @item sample_rate, s
  2311. Specify the sample rate, default to 44100. Only used if plugin have
  2312. zero inputs.
  2313. @item nb_samples, n
  2314. Set the number of samples per channel per each output frame, default
  2315. is 1024. Only used if plugin have zero inputs.
  2316. @item duration, d
  2317. Set the minimum duration of the sourced audio. See
  2318. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2319. for the accepted syntax.
  2320. Note that the resulting duration may be greater than the specified duration,
  2321. as the generated audio is always cut at the end of a complete frame.
  2322. If not specified, or the expressed duration is negative, the audio is
  2323. supposed to be generated forever.
  2324. Only used if plugin have zero inputs.
  2325. @end table
  2326. @subsection Examples
  2327. @itemize
  2328. @item
  2329. List all available plugins within amp (LADSPA example plugin) library:
  2330. @example
  2331. ladspa=file=amp
  2332. @end example
  2333. @item
  2334. List all available controls and their valid ranges for @code{vcf_notch}
  2335. plugin from @code{VCF} library:
  2336. @example
  2337. ladspa=f=vcf:p=vcf_notch:c=help
  2338. @end example
  2339. @item
  2340. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2341. plugin library:
  2342. @example
  2343. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2344. @end example
  2345. @item
  2346. Add reverberation to the audio using TAP-plugins
  2347. (Tom's Audio Processing plugins):
  2348. @example
  2349. ladspa=file=tap_reverb:tap_reverb
  2350. @end example
  2351. @item
  2352. Generate white noise, with 0.2 amplitude:
  2353. @example
  2354. ladspa=file=cmt:noise_source_white:c=c0=.2
  2355. @end example
  2356. @item
  2357. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2358. @code{C* Audio Plugin Suite} (CAPS) library:
  2359. @example
  2360. ladspa=file=caps:Click:c=c1=20'
  2361. @end example
  2362. @item
  2363. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2364. @example
  2365. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2366. @end example
  2367. @item
  2368. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2369. @code{SWH Plugins} collection:
  2370. @example
  2371. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2372. @end example
  2373. @item
  2374. Attenuate low frequencies using Multiband EQ from Steve Harris
  2375. @code{SWH Plugins} collection:
  2376. @example
  2377. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2378. @end example
  2379. @item
  2380. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2381. (CAPS) library:
  2382. @example
  2383. ladspa=caps:Narrower
  2384. @end example
  2385. @item
  2386. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2387. @example
  2388. ladspa=caps:White:.2
  2389. @end example
  2390. @item
  2391. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2392. @example
  2393. ladspa=caps:Fractal:c=c1=1
  2394. @end example
  2395. @item
  2396. Dynamic volume normalization using @code{VLevel} plugin:
  2397. @example
  2398. ladspa=vlevel-ladspa:vlevel_mono
  2399. @end example
  2400. @end itemize
  2401. @subsection Commands
  2402. This filter supports the following commands:
  2403. @table @option
  2404. @item cN
  2405. Modify the @var{N}-th control value.
  2406. If the specified value is not valid, it is ignored and prior one is kept.
  2407. @end table
  2408. @section loudnorm
  2409. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2410. Support for both single pass (livestreams, files) and double pass (files) modes.
  2411. This algorithm can target IL, LRA, and maximum true peak.
  2412. The filter accepts the following options:
  2413. @table @option
  2414. @item I, i
  2415. Set integrated loudness target.
  2416. Range is -70.0 - -5.0. Default value is -24.0.
  2417. @item LRA, lra
  2418. Set loudness range target.
  2419. Range is 1.0 - 20.0. Default value is 7.0.
  2420. @item TP, tp
  2421. Set maximum true peak.
  2422. Range is -9.0 - +0.0. Default value is -2.0.
  2423. @item measured_I, measured_i
  2424. Measured IL of input file.
  2425. Range is -99.0 - +0.0.
  2426. @item measured_LRA, measured_lra
  2427. Measured LRA of input file.
  2428. Range is 0.0 - 99.0.
  2429. @item measured_TP, measured_tp
  2430. Measured true peak of input file.
  2431. Range is -99.0 - +99.0.
  2432. @item measured_thresh
  2433. Measured threshold of input file.
  2434. Range is -99.0 - +0.0.
  2435. @item offset
  2436. Set offset gain. Gain is applied before the true-peak limiter.
  2437. Range is -99.0 - +99.0. Default is +0.0.
  2438. @item linear
  2439. Normalize linearly if possible.
  2440. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2441. to be specified in order to use this mode.
  2442. Options are true or false. Default is true.
  2443. @item dual_mono
  2444. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2445. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2446. If set to @code{true}, this option will compensate for this effect.
  2447. Multi-channel input files are not affected by this option.
  2448. Options are true or false. Default is false.
  2449. @item print_format
  2450. Set print format for stats. Options are summary, json, or none.
  2451. Default value is none.
  2452. @end table
  2453. @section lowpass
  2454. Apply a low-pass filter with 3dB point frequency.
  2455. The filter can be either single-pole or double-pole (the default).
  2456. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2457. The filter accepts the following options:
  2458. @table @option
  2459. @item frequency, f
  2460. Set frequency in Hz. Default is 500.
  2461. @item poles, p
  2462. Set number of poles. Default is 2.
  2463. @item width_type, t
  2464. Set method to specify band-width of filter.
  2465. @table @option
  2466. @item h
  2467. Hz
  2468. @item q
  2469. Q-Factor
  2470. @item o
  2471. octave
  2472. @item s
  2473. slope
  2474. @end table
  2475. @item width, w
  2476. Specify the band-width of a filter in width_type units.
  2477. Applies only to double-pole filter.
  2478. The default is 0.707q and gives a Butterworth response.
  2479. @item channels, c
  2480. Specify which channels to filter, by default all available are filtered.
  2481. @end table
  2482. @subsection Examples
  2483. @itemize
  2484. @item
  2485. Lowpass only LFE channel, it LFE is not present it does nothing:
  2486. @example
  2487. lowpass=c=LFE
  2488. @end example
  2489. @end itemize
  2490. @anchor{pan}
  2491. @section pan
  2492. Mix channels with specific gain levels. The filter accepts the output
  2493. channel layout followed by a set of channels definitions.
  2494. This filter is also designed to efficiently remap the channels of an audio
  2495. stream.
  2496. The filter accepts parameters of the form:
  2497. "@var{l}|@var{outdef}|@var{outdef}|..."
  2498. @table @option
  2499. @item l
  2500. output channel layout or number of channels
  2501. @item outdef
  2502. output channel specification, of the form:
  2503. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2504. @item out_name
  2505. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2506. number (c0, c1, etc.)
  2507. @item gain
  2508. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2509. @item in_name
  2510. input channel to use, see out_name for details; it is not possible to mix
  2511. named and numbered input channels
  2512. @end table
  2513. If the `=' in a channel specification is replaced by `<', then the gains for
  2514. that specification will be renormalized so that the total is 1, thus
  2515. avoiding clipping noise.
  2516. @subsection Mixing examples
  2517. For example, if you want to down-mix from stereo to mono, but with a bigger
  2518. factor for the left channel:
  2519. @example
  2520. pan=1c|c0=0.9*c0+0.1*c1
  2521. @end example
  2522. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2523. 7-channels surround:
  2524. @example
  2525. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2526. @end example
  2527. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2528. that should be preferred (see "-ac" option) unless you have very specific
  2529. needs.
  2530. @subsection Remapping examples
  2531. The channel remapping will be effective if, and only if:
  2532. @itemize
  2533. @item gain coefficients are zeroes or ones,
  2534. @item only one input per channel output,
  2535. @end itemize
  2536. If all these conditions are satisfied, the filter will notify the user ("Pure
  2537. channel mapping detected"), and use an optimized and lossless method to do the
  2538. remapping.
  2539. For example, if you have a 5.1 source and want a stereo audio stream by
  2540. dropping the extra channels:
  2541. @example
  2542. pan="stereo| c0=FL | c1=FR"
  2543. @end example
  2544. Given the same source, you can also switch front left and front right channels
  2545. and keep the input channel layout:
  2546. @example
  2547. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2548. @end example
  2549. If the input is a stereo audio stream, you can mute the front left channel (and
  2550. still keep the stereo channel layout) with:
  2551. @example
  2552. pan="stereo|c1=c1"
  2553. @end example
  2554. Still with a stereo audio stream input, you can copy the right channel in both
  2555. front left and right:
  2556. @example
  2557. pan="stereo| c0=FR | c1=FR"
  2558. @end example
  2559. @section replaygain
  2560. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2561. outputs it unchanged.
  2562. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2563. @section resample
  2564. Convert the audio sample format, sample rate and channel layout. It is
  2565. not meant to be used directly.
  2566. @section rubberband
  2567. Apply time-stretching and pitch-shifting with librubberband.
  2568. The filter accepts the following options:
  2569. @table @option
  2570. @item tempo
  2571. Set tempo scale factor.
  2572. @item pitch
  2573. Set pitch scale factor.
  2574. @item transients
  2575. Set transients detector.
  2576. Possible values are:
  2577. @table @var
  2578. @item crisp
  2579. @item mixed
  2580. @item smooth
  2581. @end table
  2582. @item detector
  2583. Set detector.
  2584. Possible values are:
  2585. @table @var
  2586. @item compound
  2587. @item percussive
  2588. @item soft
  2589. @end table
  2590. @item phase
  2591. Set phase.
  2592. Possible values are:
  2593. @table @var
  2594. @item laminar
  2595. @item independent
  2596. @end table
  2597. @item window
  2598. Set processing window size.
  2599. Possible values are:
  2600. @table @var
  2601. @item standard
  2602. @item short
  2603. @item long
  2604. @end table
  2605. @item smoothing
  2606. Set smoothing.
  2607. Possible values are:
  2608. @table @var
  2609. @item off
  2610. @item on
  2611. @end table
  2612. @item formant
  2613. Enable formant preservation when shift pitching.
  2614. Possible values are:
  2615. @table @var
  2616. @item shifted
  2617. @item preserved
  2618. @end table
  2619. @item pitchq
  2620. Set pitch quality.
  2621. Possible values are:
  2622. @table @var
  2623. @item quality
  2624. @item speed
  2625. @item consistency
  2626. @end table
  2627. @item channels
  2628. Set channels.
  2629. Possible values are:
  2630. @table @var
  2631. @item apart
  2632. @item together
  2633. @end table
  2634. @end table
  2635. @section sidechaincompress
  2636. This filter acts like normal compressor but has the ability to compress
  2637. detected signal using second input signal.
  2638. It needs two input streams and returns one output stream.
  2639. First input stream will be processed depending on second stream signal.
  2640. The filtered signal then can be filtered with other filters in later stages of
  2641. processing. See @ref{pan} and @ref{amerge} filter.
  2642. The filter accepts the following options:
  2643. @table @option
  2644. @item level_in
  2645. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2646. @item threshold
  2647. If a signal of second stream raises above this level it will affect the gain
  2648. reduction of first stream.
  2649. By default is 0.125. Range is between 0.00097563 and 1.
  2650. @item ratio
  2651. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2652. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2653. Default is 2. Range is between 1 and 20.
  2654. @item attack
  2655. Amount of milliseconds the signal has to rise above the threshold before gain
  2656. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2657. @item release
  2658. Amount of milliseconds the signal has to fall below the threshold before
  2659. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2660. @item makeup
  2661. Set the amount by how much signal will be amplified after processing.
  2662. Default is 1. Range is from 1 to 64.
  2663. @item knee
  2664. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2665. Default is 2.82843. Range is between 1 and 8.
  2666. @item link
  2667. Choose if the @code{average} level between all channels of side-chain stream
  2668. or the louder(@code{maximum}) channel of side-chain stream affects the
  2669. reduction. Default is @code{average}.
  2670. @item detection
  2671. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2672. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2673. @item level_sc
  2674. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2675. @item mix
  2676. How much to use compressed signal in output. Default is 1.
  2677. Range is between 0 and 1.
  2678. @end table
  2679. @subsection Examples
  2680. @itemize
  2681. @item
  2682. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2683. depending on the signal of 2nd input and later compressed signal to be
  2684. merged with 2nd input:
  2685. @example
  2686. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2687. @end example
  2688. @end itemize
  2689. @section sidechaingate
  2690. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2691. filter the detected signal before sending it to the gain reduction stage.
  2692. Normally a gate uses the full range signal to detect a level above the
  2693. threshold.
  2694. For example: If you cut all lower frequencies from your sidechain signal
  2695. the gate will decrease the volume of your track only if not enough highs
  2696. appear. With this technique you are able to reduce the resonation of a
  2697. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2698. guitar.
  2699. It needs two input streams and returns one output stream.
  2700. First input stream will be processed depending on second stream signal.
  2701. The filter accepts the following options:
  2702. @table @option
  2703. @item level_in
  2704. Set input level before filtering.
  2705. Default is 1. Allowed range is from 0.015625 to 64.
  2706. @item range
  2707. Set the level of gain reduction when the signal is below the threshold.
  2708. Default is 0.06125. Allowed range is from 0 to 1.
  2709. @item threshold
  2710. If a signal rises above this level the gain reduction is released.
  2711. Default is 0.125. Allowed range is from 0 to 1.
  2712. @item ratio
  2713. Set a ratio about which the signal is reduced.
  2714. Default is 2. Allowed range is from 1 to 9000.
  2715. @item attack
  2716. Amount of milliseconds the signal has to rise above the threshold before gain
  2717. reduction stops.
  2718. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2719. @item release
  2720. Amount of milliseconds the signal has to fall below the threshold before the
  2721. reduction is increased again. Default is 250 milliseconds.
  2722. Allowed range is from 0.01 to 9000.
  2723. @item makeup
  2724. Set amount of amplification of signal after processing.
  2725. Default is 1. Allowed range is from 1 to 64.
  2726. @item knee
  2727. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2728. Default is 2.828427125. Allowed range is from 1 to 8.
  2729. @item detection
  2730. Choose if exact signal should be taken for detection or an RMS like one.
  2731. Default is rms. Can be peak or rms.
  2732. @item link
  2733. Choose if the average level between all channels or the louder channel affects
  2734. the reduction.
  2735. Default is average. Can be average or maximum.
  2736. @item level_sc
  2737. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2738. @end table
  2739. @section silencedetect
  2740. Detect silence in an audio stream.
  2741. This filter logs a message when it detects that the input audio volume is less
  2742. or equal to a noise tolerance value for a duration greater or equal to the
  2743. minimum detected noise duration.
  2744. The printed times and duration are expressed in seconds.
  2745. The filter accepts the following options:
  2746. @table @option
  2747. @item duration, d
  2748. Set silence duration until notification (default is 2 seconds).
  2749. @item noise, n
  2750. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2751. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2752. @end table
  2753. @subsection Examples
  2754. @itemize
  2755. @item
  2756. Detect 5 seconds of silence with -50dB noise tolerance:
  2757. @example
  2758. silencedetect=n=-50dB:d=5
  2759. @end example
  2760. @item
  2761. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2762. tolerance in @file{silence.mp3}:
  2763. @example
  2764. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2765. @end example
  2766. @end itemize
  2767. @section silenceremove
  2768. Remove silence from the beginning, middle or end of the audio.
  2769. The filter accepts the following options:
  2770. @table @option
  2771. @item start_periods
  2772. This value is used to indicate if audio should be trimmed at beginning of
  2773. the audio. A value of zero indicates no silence should be trimmed from the
  2774. beginning. When specifying a non-zero value, it trims audio up until it
  2775. finds non-silence. Normally, when trimming silence from beginning of audio
  2776. the @var{start_periods} will be @code{1} but it can be increased to higher
  2777. values to trim all audio up to specific count of non-silence periods.
  2778. Default value is @code{0}.
  2779. @item start_duration
  2780. Specify the amount of time that non-silence must be detected before it stops
  2781. trimming audio. By increasing the duration, bursts of noises can be treated
  2782. as silence and trimmed off. Default value is @code{0}.
  2783. @item start_threshold
  2784. This indicates what sample value should be treated as silence. For digital
  2785. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2786. you may wish to increase the value to account for background noise.
  2787. Can be specified in dB (in case "dB" is appended to the specified value)
  2788. or amplitude ratio. Default value is @code{0}.
  2789. @item stop_periods
  2790. Set the count for trimming silence from the end of audio.
  2791. To remove silence from the middle of a file, specify a @var{stop_periods}
  2792. that is negative. This value is then treated as a positive value and is
  2793. used to indicate the effect should restart processing as specified by
  2794. @var{start_periods}, making it suitable for removing periods of silence
  2795. in the middle of the audio.
  2796. Default value is @code{0}.
  2797. @item stop_duration
  2798. Specify a duration of silence that must exist before audio is not copied any
  2799. more. By specifying a higher duration, silence that is wanted can be left in
  2800. the audio.
  2801. Default value is @code{0}.
  2802. @item stop_threshold
  2803. This is the same as @option{start_threshold} but for trimming silence from
  2804. the end of audio.
  2805. Can be specified in dB (in case "dB" is appended to the specified value)
  2806. or amplitude ratio. Default value is @code{0}.
  2807. @item leave_silence
  2808. This indicates that @var{stop_duration} length of audio should be left intact
  2809. at the beginning of each period of silence.
  2810. For example, if you want to remove long pauses between words but do not want
  2811. to remove the pauses completely. Default value is @code{0}.
  2812. @item detection
  2813. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2814. and works better with digital silence which is exactly 0.
  2815. Default value is @code{rms}.
  2816. @item window
  2817. Set ratio used to calculate size of window for detecting silence.
  2818. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2819. @end table
  2820. @subsection Examples
  2821. @itemize
  2822. @item
  2823. The following example shows how this filter can be used to start a recording
  2824. that does not contain the delay at the start which usually occurs between
  2825. pressing the record button and the start of the performance:
  2826. @example
  2827. silenceremove=1:5:0.02
  2828. @end example
  2829. @item
  2830. Trim all silence encountered from beginning to end where there is more than 1
  2831. second of silence in audio:
  2832. @example
  2833. silenceremove=0:0:0:-1:1:-90dB
  2834. @end example
  2835. @end itemize
  2836. @section sofalizer
  2837. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2838. loudspeakers around the user for binaural listening via headphones (audio
  2839. formats up to 9 channels supported).
  2840. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2841. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2842. Austrian Academy of Sciences.
  2843. To enable compilation of this filter you need to configure FFmpeg with
  2844. @code{--enable-libmysofa}.
  2845. The filter accepts the following options:
  2846. @table @option
  2847. @item sofa
  2848. Set the SOFA file used for rendering.
  2849. @item gain
  2850. Set gain applied to audio. Value is in dB. Default is 0.
  2851. @item rotation
  2852. Set rotation of virtual loudspeakers in deg. Default is 0.
  2853. @item elevation
  2854. Set elevation of virtual speakers in deg. Default is 0.
  2855. @item radius
  2856. Set distance in meters between loudspeakers and the listener with near-field
  2857. HRTFs. Default is 1.
  2858. @item type
  2859. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2860. processing audio in time domain which is slow.
  2861. @var{freq} is processing audio in frequency domain which is fast.
  2862. Default is @var{freq}.
  2863. @item speakers
  2864. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2865. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2866. Each virtual loudspeaker is described with short channel name following with
  2867. azimuth and elevation in degreees.
  2868. Each virtual loudspeaker description is separated by '|'.
  2869. For example to override front left and front right channel positions use:
  2870. 'speakers=FL 45 15|FR 345 15'.
  2871. Descriptions with unrecognised channel names are ignored.
  2872. @item lfegain
  2873. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2874. @end table
  2875. @subsection Examples
  2876. @itemize
  2877. @item
  2878. Using ClubFritz6 sofa file:
  2879. @example
  2880. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2881. @end example
  2882. @item
  2883. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2884. @example
  2885. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2886. @end example
  2887. @item
  2888. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2889. and also with custom gain:
  2890. @example
  2891. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2892. @end example
  2893. @end itemize
  2894. @section stereotools
  2895. This filter has some handy utilities to manage stereo signals, for converting
  2896. M/S stereo recordings to L/R signal while having control over the parameters
  2897. or spreading the stereo image of master track.
  2898. The filter accepts the following options:
  2899. @table @option
  2900. @item level_in
  2901. Set input level before filtering for both channels. Defaults is 1.
  2902. Allowed range is from 0.015625 to 64.
  2903. @item level_out
  2904. Set output level after filtering for both channels. Defaults is 1.
  2905. Allowed range is from 0.015625 to 64.
  2906. @item balance_in
  2907. Set input balance between both channels. Default is 0.
  2908. Allowed range is from -1 to 1.
  2909. @item balance_out
  2910. Set output balance between both channels. Default is 0.
  2911. Allowed range is from -1 to 1.
  2912. @item softclip
  2913. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2914. clipping. Disabled by default.
  2915. @item mutel
  2916. Mute the left channel. Disabled by default.
  2917. @item muter
  2918. Mute the right channel. Disabled by default.
  2919. @item phasel
  2920. Change the phase of the left channel. Disabled by default.
  2921. @item phaser
  2922. Change the phase of the right channel. Disabled by default.
  2923. @item mode
  2924. Set stereo mode. Available values are:
  2925. @table @samp
  2926. @item lr>lr
  2927. Left/Right to Left/Right, this is default.
  2928. @item lr>ms
  2929. Left/Right to Mid/Side.
  2930. @item ms>lr
  2931. Mid/Side to Left/Right.
  2932. @item lr>ll
  2933. Left/Right to Left/Left.
  2934. @item lr>rr
  2935. Left/Right to Right/Right.
  2936. @item lr>l+r
  2937. Left/Right to Left + Right.
  2938. @item lr>rl
  2939. Left/Right to Right/Left.
  2940. @item ms>ll
  2941. Mid/Side to Left/Left.
  2942. @item ms>rr
  2943. Mid/Side to Right/Right.
  2944. @end table
  2945. @item slev
  2946. Set level of side signal. Default is 1.
  2947. Allowed range is from 0.015625 to 64.
  2948. @item sbal
  2949. Set balance of side signal. Default is 0.
  2950. Allowed range is from -1 to 1.
  2951. @item mlev
  2952. Set level of the middle signal. Default is 1.
  2953. Allowed range is from 0.015625 to 64.
  2954. @item mpan
  2955. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2956. @item base
  2957. Set stereo base between mono and inversed channels. Default is 0.
  2958. Allowed range is from -1 to 1.
  2959. @item delay
  2960. Set delay in milliseconds how much to delay left from right channel and
  2961. vice versa. Default is 0. Allowed range is from -20 to 20.
  2962. @item sclevel
  2963. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2964. @item phase
  2965. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2966. @item bmode_in, bmode_out
  2967. Set balance mode for balance_in/balance_out option.
  2968. Can be one of the following:
  2969. @table @samp
  2970. @item balance
  2971. Classic balance mode. Attenuate one channel at time.
  2972. Gain is raised up to 1.
  2973. @item amplitude
  2974. Similar as classic mode above but gain is raised up to 2.
  2975. @item power
  2976. Equal power distribution, from -6dB to +6dB range.
  2977. @end table
  2978. @end table
  2979. @subsection Examples
  2980. @itemize
  2981. @item
  2982. Apply karaoke like effect:
  2983. @example
  2984. stereotools=mlev=0.015625
  2985. @end example
  2986. @item
  2987. Convert M/S signal to L/R:
  2988. @example
  2989. "stereotools=mode=ms>lr"
  2990. @end example
  2991. @end itemize
  2992. @section stereowiden
  2993. This filter enhance the stereo effect by suppressing signal common to both
  2994. channels and by delaying the signal of left into right and vice versa,
  2995. thereby widening the stereo effect.
  2996. The filter accepts the following options:
  2997. @table @option
  2998. @item delay
  2999. Time in milliseconds of the delay of left signal into right and vice versa.
  3000. Default is 20 milliseconds.
  3001. @item feedback
  3002. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3003. effect of left signal in right output and vice versa which gives widening
  3004. effect. Default is 0.3.
  3005. @item crossfeed
  3006. Cross feed of left into right with inverted phase. This helps in suppressing
  3007. the mono. If the value is 1 it will cancel all the signal common to both
  3008. channels. Default is 0.3.
  3009. @item drymix
  3010. Set level of input signal of original channel. Default is 0.8.
  3011. @end table
  3012. @section superequalizer
  3013. Apply 18 band equalizer.
  3014. The filter accepts the following options:
  3015. @table @option
  3016. @item 1b
  3017. Set 65Hz band gain.
  3018. @item 2b
  3019. Set 92Hz band gain.
  3020. @item 3b
  3021. Set 131Hz band gain.
  3022. @item 4b
  3023. Set 185Hz band gain.
  3024. @item 5b
  3025. Set 262Hz band gain.
  3026. @item 6b
  3027. Set 370Hz band gain.
  3028. @item 7b
  3029. Set 523Hz band gain.
  3030. @item 8b
  3031. Set 740Hz band gain.
  3032. @item 9b
  3033. Set 1047Hz band gain.
  3034. @item 10b
  3035. Set 1480Hz band gain.
  3036. @item 11b
  3037. Set 2093Hz band gain.
  3038. @item 12b
  3039. Set 2960Hz band gain.
  3040. @item 13b
  3041. Set 4186Hz band gain.
  3042. @item 14b
  3043. Set 5920Hz band gain.
  3044. @item 15b
  3045. Set 8372Hz band gain.
  3046. @item 16b
  3047. Set 11840Hz band gain.
  3048. @item 17b
  3049. Set 16744Hz band gain.
  3050. @item 18b
  3051. Set 20000Hz band gain.
  3052. @end table
  3053. @section surround
  3054. Apply audio surround upmix filter.
  3055. This filter allows to produce multichannel output from audio stream.
  3056. The filter accepts the following options:
  3057. @table @option
  3058. @item chl_out
  3059. Set output channel layout. By default, this is @var{5.1}.
  3060. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3061. for the required syntax.
  3062. @item chl_in
  3063. Set input channel layout. By default, this is @var{stereo}.
  3064. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3065. for the required syntax.
  3066. @item level_in
  3067. Set input volume level. By default, this is @var{1}.
  3068. @item level_out
  3069. Set output volume level. By default, this is @var{1}.
  3070. @item lfe
  3071. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3072. @item lfe_low
  3073. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3074. @item lfe_high
  3075. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3076. @end table
  3077. @section treble
  3078. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3079. shelving filter with a response similar to that of a standard
  3080. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3081. The filter accepts the following options:
  3082. @table @option
  3083. @item gain, g
  3084. Give the gain at whichever is the lower of ~22 kHz and the
  3085. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3086. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3087. @item frequency, f
  3088. Set the filter's central frequency and so can be used
  3089. to extend or reduce the frequency range to be boosted or cut.
  3090. The default value is @code{3000} Hz.
  3091. @item width_type, t
  3092. Set method to specify band-width of filter.
  3093. @table @option
  3094. @item h
  3095. Hz
  3096. @item q
  3097. Q-Factor
  3098. @item o
  3099. octave
  3100. @item s
  3101. slope
  3102. @end table
  3103. @item width, w
  3104. Determine how steep is the filter's shelf transition.
  3105. @item channels, c
  3106. Specify which channels to filter, by default all available are filtered.
  3107. @end table
  3108. @section tremolo
  3109. Sinusoidal amplitude modulation.
  3110. The filter accepts the following options:
  3111. @table @option
  3112. @item f
  3113. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3114. (20 Hz or lower) will result in a tremolo effect.
  3115. This filter may also be used as a ring modulator by specifying
  3116. a modulation frequency higher than 20 Hz.
  3117. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3118. @item d
  3119. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3120. Default value is 0.5.
  3121. @end table
  3122. @section vibrato
  3123. Sinusoidal phase modulation.
  3124. The filter accepts the following options:
  3125. @table @option
  3126. @item f
  3127. Modulation frequency in Hertz.
  3128. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3129. @item d
  3130. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3131. Default value is 0.5.
  3132. @end table
  3133. @section volume
  3134. Adjust the input audio volume.
  3135. It accepts the following parameters:
  3136. @table @option
  3137. @item volume
  3138. Set audio volume expression.
  3139. Output values are clipped to the maximum value.
  3140. The output audio volume is given by the relation:
  3141. @example
  3142. @var{output_volume} = @var{volume} * @var{input_volume}
  3143. @end example
  3144. The default value for @var{volume} is "1.0".
  3145. @item precision
  3146. This parameter represents the mathematical precision.
  3147. It determines which input sample formats will be allowed, which affects the
  3148. precision of the volume scaling.
  3149. @table @option
  3150. @item fixed
  3151. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3152. @item float
  3153. 32-bit floating-point; this limits input sample format to FLT. (default)
  3154. @item double
  3155. 64-bit floating-point; this limits input sample format to DBL.
  3156. @end table
  3157. @item replaygain
  3158. Choose the behaviour on encountering ReplayGain side data in input frames.
  3159. @table @option
  3160. @item drop
  3161. Remove ReplayGain side data, ignoring its contents (the default).
  3162. @item ignore
  3163. Ignore ReplayGain side data, but leave it in the frame.
  3164. @item track
  3165. Prefer the track gain, if present.
  3166. @item album
  3167. Prefer the album gain, if present.
  3168. @end table
  3169. @item replaygain_preamp
  3170. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3171. Default value for @var{replaygain_preamp} is 0.0.
  3172. @item eval
  3173. Set when the volume expression is evaluated.
  3174. It accepts the following values:
  3175. @table @samp
  3176. @item once
  3177. only evaluate expression once during the filter initialization, or
  3178. when the @samp{volume} command is sent
  3179. @item frame
  3180. evaluate expression for each incoming frame
  3181. @end table
  3182. Default value is @samp{once}.
  3183. @end table
  3184. The volume expression can contain the following parameters.
  3185. @table @option
  3186. @item n
  3187. frame number (starting at zero)
  3188. @item nb_channels
  3189. number of channels
  3190. @item nb_consumed_samples
  3191. number of samples consumed by the filter
  3192. @item nb_samples
  3193. number of samples in the current frame
  3194. @item pos
  3195. original frame position in the file
  3196. @item pts
  3197. frame PTS
  3198. @item sample_rate
  3199. sample rate
  3200. @item startpts
  3201. PTS at start of stream
  3202. @item startt
  3203. time at start of stream
  3204. @item t
  3205. frame time
  3206. @item tb
  3207. timestamp timebase
  3208. @item volume
  3209. last set volume value
  3210. @end table
  3211. Note that when @option{eval} is set to @samp{once} only the
  3212. @var{sample_rate} and @var{tb} variables are available, all other
  3213. variables will evaluate to NAN.
  3214. @subsection Commands
  3215. This filter supports the following commands:
  3216. @table @option
  3217. @item volume
  3218. Modify the volume expression.
  3219. The command accepts the same syntax of the corresponding option.
  3220. If the specified expression is not valid, it is kept at its current
  3221. value.
  3222. @item replaygain_noclip
  3223. Prevent clipping by limiting the gain applied.
  3224. Default value for @var{replaygain_noclip} is 1.
  3225. @end table
  3226. @subsection Examples
  3227. @itemize
  3228. @item
  3229. Halve the input audio volume:
  3230. @example
  3231. volume=volume=0.5
  3232. volume=volume=1/2
  3233. volume=volume=-6.0206dB
  3234. @end example
  3235. In all the above example the named key for @option{volume} can be
  3236. omitted, for example like in:
  3237. @example
  3238. volume=0.5
  3239. @end example
  3240. @item
  3241. Increase input audio power by 6 decibels using fixed-point precision:
  3242. @example
  3243. volume=volume=6dB:precision=fixed
  3244. @end example
  3245. @item
  3246. Fade volume after time 10 with an annihilation period of 5 seconds:
  3247. @example
  3248. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3249. @end example
  3250. @end itemize
  3251. @section volumedetect
  3252. Detect the volume of the input video.
  3253. The filter has no parameters. The input is not modified. Statistics about
  3254. the volume will be printed in the log when the input stream end is reached.
  3255. In particular it will show the mean volume (root mean square), maximum
  3256. volume (on a per-sample basis), and the beginning of a histogram of the
  3257. registered volume values (from the maximum value to a cumulated 1/1000 of
  3258. the samples).
  3259. All volumes are in decibels relative to the maximum PCM value.
  3260. @subsection Examples
  3261. Here is an excerpt of the output:
  3262. @example
  3263. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3264. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3265. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3266. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3267. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3268. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3269. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3270. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3271. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3272. @end example
  3273. It means that:
  3274. @itemize
  3275. @item
  3276. The mean square energy is approximately -27 dB, or 10^-2.7.
  3277. @item
  3278. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3279. @item
  3280. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3281. @end itemize
  3282. In other words, raising the volume by +4 dB does not cause any clipping,
  3283. raising it by +5 dB causes clipping for 6 samples, etc.
  3284. @c man end AUDIO FILTERS
  3285. @chapter Audio Sources
  3286. @c man begin AUDIO SOURCES
  3287. Below is a description of the currently available audio sources.
  3288. @section abuffer
  3289. Buffer audio frames, and make them available to the filter chain.
  3290. This source is mainly intended for a programmatic use, in particular
  3291. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3292. It accepts the following parameters:
  3293. @table @option
  3294. @item time_base
  3295. The timebase which will be used for timestamps of submitted frames. It must be
  3296. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3297. @item sample_rate
  3298. The sample rate of the incoming audio buffers.
  3299. @item sample_fmt
  3300. The sample format of the incoming audio buffers.
  3301. Either a sample format name or its corresponding integer representation from
  3302. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3303. @item channel_layout
  3304. The channel layout of the incoming audio buffers.
  3305. Either a channel layout name from channel_layout_map in
  3306. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3307. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3308. @item channels
  3309. The number of channels of the incoming audio buffers.
  3310. If both @var{channels} and @var{channel_layout} are specified, then they
  3311. must be consistent.
  3312. @end table
  3313. @subsection Examples
  3314. @example
  3315. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3316. @end example
  3317. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3318. Since the sample format with name "s16p" corresponds to the number
  3319. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3320. equivalent to:
  3321. @example
  3322. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3323. @end example
  3324. @section aevalsrc
  3325. Generate an audio signal specified by an expression.
  3326. This source accepts in input one or more expressions (one for each
  3327. channel), which are evaluated and used to generate a corresponding
  3328. audio signal.
  3329. This source accepts the following options:
  3330. @table @option
  3331. @item exprs
  3332. Set the '|'-separated expressions list for each separate channel. In case the
  3333. @option{channel_layout} option is not specified, the selected channel layout
  3334. depends on the number of provided expressions. Otherwise the last
  3335. specified expression is applied to the remaining output channels.
  3336. @item channel_layout, c
  3337. Set the channel layout. The number of channels in the specified layout
  3338. must be equal to the number of specified expressions.
  3339. @item duration, d
  3340. Set the minimum duration of the sourced audio. See
  3341. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3342. for the accepted syntax.
  3343. Note that the resulting duration may be greater than the specified
  3344. duration, as the generated audio is always cut at the end of a
  3345. complete frame.
  3346. If not specified, or the expressed duration is negative, the audio is
  3347. supposed to be generated forever.
  3348. @item nb_samples, n
  3349. Set the number of samples per channel per each output frame,
  3350. default to 1024.
  3351. @item sample_rate, s
  3352. Specify the sample rate, default to 44100.
  3353. @end table
  3354. Each expression in @var{exprs} can contain the following constants:
  3355. @table @option
  3356. @item n
  3357. number of the evaluated sample, starting from 0
  3358. @item t
  3359. time of the evaluated sample expressed in seconds, starting from 0
  3360. @item s
  3361. sample rate
  3362. @end table
  3363. @subsection Examples
  3364. @itemize
  3365. @item
  3366. Generate silence:
  3367. @example
  3368. aevalsrc=0
  3369. @end example
  3370. @item
  3371. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3372. 8000 Hz:
  3373. @example
  3374. aevalsrc="sin(440*2*PI*t):s=8000"
  3375. @end example
  3376. @item
  3377. Generate a two channels signal, specify the channel layout (Front
  3378. Center + Back Center) explicitly:
  3379. @example
  3380. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3381. @end example
  3382. @item
  3383. Generate white noise:
  3384. @example
  3385. aevalsrc="-2+random(0)"
  3386. @end example
  3387. @item
  3388. Generate an amplitude modulated signal:
  3389. @example
  3390. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3391. @end example
  3392. @item
  3393. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3394. @example
  3395. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3396. @end example
  3397. @end itemize
  3398. @section anullsrc
  3399. The null audio source, return unprocessed audio frames. It is mainly useful
  3400. as a template and to be employed in analysis / debugging tools, or as
  3401. the source for filters which ignore the input data (for example the sox
  3402. synth filter).
  3403. This source accepts the following options:
  3404. @table @option
  3405. @item channel_layout, cl
  3406. Specifies the channel layout, and can be either an integer or a string
  3407. representing a channel layout. The default value of @var{channel_layout}
  3408. is "stereo".
  3409. Check the channel_layout_map definition in
  3410. @file{libavutil/channel_layout.c} for the mapping between strings and
  3411. channel layout values.
  3412. @item sample_rate, r
  3413. Specifies the sample rate, and defaults to 44100.
  3414. @item nb_samples, n
  3415. Set the number of samples per requested frames.
  3416. @end table
  3417. @subsection Examples
  3418. @itemize
  3419. @item
  3420. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3421. @example
  3422. anullsrc=r=48000:cl=4
  3423. @end example
  3424. @item
  3425. Do the same operation with a more obvious syntax:
  3426. @example
  3427. anullsrc=r=48000:cl=mono
  3428. @end example
  3429. @end itemize
  3430. All the parameters need to be explicitly defined.
  3431. @section flite
  3432. Synthesize a voice utterance using the libflite library.
  3433. To enable compilation of this filter you need to configure FFmpeg with
  3434. @code{--enable-libflite}.
  3435. Note that the flite library is not thread-safe.
  3436. The filter accepts the following options:
  3437. @table @option
  3438. @item list_voices
  3439. If set to 1, list the names of the available voices and exit
  3440. immediately. Default value is 0.
  3441. @item nb_samples, n
  3442. Set the maximum number of samples per frame. Default value is 512.
  3443. @item textfile
  3444. Set the filename containing the text to speak.
  3445. @item text
  3446. Set the text to speak.
  3447. @item voice, v
  3448. Set the voice to use for the speech synthesis. Default value is
  3449. @code{kal}. See also the @var{list_voices} option.
  3450. @end table
  3451. @subsection Examples
  3452. @itemize
  3453. @item
  3454. Read from file @file{speech.txt}, and synthesize the text using the
  3455. standard flite voice:
  3456. @example
  3457. flite=textfile=speech.txt
  3458. @end example
  3459. @item
  3460. Read the specified text selecting the @code{slt} voice:
  3461. @example
  3462. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3463. @end example
  3464. @item
  3465. Input text to ffmpeg:
  3466. @example
  3467. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3468. @end example
  3469. @item
  3470. Make @file{ffplay} speak the specified text, using @code{flite} and
  3471. the @code{lavfi} device:
  3472. @example
  3473. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3474. @end example
  3475. @end itemize
  3476. For more information about libflite, check:
  3477. @url{http://www.speech.cs.cmu.edu/flite/}
  3478. @section anoisesrc
  3479. Generate a noise audio signal.
  3480. The filter accepts the following options:
  3481. @table @option
  3482. @item sample_rate, r
  3483. Specify the sample rate. Default value is 48000 Hz.
  3484. @item amplitude, a
  3485. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3486. is 1.0.
  3487. @item duration, d
  3488. Specify the duration of the generated audio stream. Not specifying this option
  3489. results in noise with an infinite length.
  3490. @item color, colour, c
  3491. Specify the color of noise. Available noise colors are white, pink, and brown.
  3492. Default color is white.
  3493. @item seed, s
  3494. Specify a value used to seed the PRNG.
  3495. @item nb_samples, n
  3496. Set the number of samples per each output frame, default is 1024.
  3497. @end table
  3498. @subsection Examples
  3499. @itemize
  3500. @item
  3501. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3502. @example
  3503. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3504. @end example
  3505. @end itemize
  3506. @section sine
  3507. Generate an audio signal made of a sine wave with amplitude 1/8.
  3508. The audio signal is bit-exact.
  3509. The filter accepts the following options:
  3510. @table @option
  3511. @item frequency, f
  3512. Set the carrier frequency. Default is 440 Hz.
  3513. @item beep_factor, b
  3514. Enable a periodic beep every second with frequency @var{beep_factor} times
  3515. the carrier frequency. Default is 0, meaning the beep is disabled.
  3516. @item sample_rate, r
  3517. Specify the sample rate, default is 44100.
  3518. @item duration, d
  3519. Specify the duration of the generated audio stream.
  3520. @item samples_per_frame
  3521. Set the number of samples per output frame.
  3522. The expression can contain the following constants:
  3523. @table @option
  3524. @item n
  3525. The (sequential) number of the output audio frame, starting from 0.
  3526. @item pts
  3527. The PTS (Presentation TimeStamp) of the output audio frame,
  3528. expressed in @var{TB} units.
  3529. @item t
  3530. The PTS of the output audio frame, expressed in seconds.
  3531. @item TB
  3532. The timebase of the output audio frames.
  3533. @end table
  3534. Default is @code{1024}.
  3535. @end table
  3536. @subsection Examples
  3537. @itemize
  3538. @item
  3539. Generate a simple 440 Hz sine wave:
  3540. @example
  3541. sine
  3542. @end example
  3543. @item
  3544. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3545. @example
  3546. sine=220:4:d=5
  3547. sine=f=220:b=4:d=5
  3548. sine=frequency=220:beep_factor=4:duration=5
  3549. @end example
  3550. @item
  3551. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3552. pattern:
  3553. @example
  3554. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3555. @end example
  3556. @end itemize
  3557. @c man end AUDIO SOURCES
  3558. @chapter Audio Sinks
  3559. @c man begin AUDIO SINKS
  3560. Below is a description of the currently available audio sinks.
  3561. @section abuffersink
  3562. Buffer audio frames, and make them available to the end of filter chain.
  3563. This sink is mainly intended for programmatic use, in particular
  3564. through the interface defined in @file{libavfilter/buffersink.h}
  3565. or the options system.
  3566. It accepts a pointer to an AVABufferSinkContext structure, which
  3567. defines the incoming buffers' formats, to be passed as the opaque
  3568. parameter to @code{avfilter_init_filter} for initialization.
  3569. @section anullsink
  3570. Null audio sink; do absolutely nothing with the input audio. It is
  3571. mainly useful as a template and for use in analysis / debugging
  3572. tools.
  3573. @c man end AUDIO SINKS
  3574. @chapter Video Filters
  3575. @c man begin VIDEO FILTERS
  3576. When you configure your FFmpeg build, you can disable any of the
  3577. existing filters using @code{--disable-filters}.
  3578. The configure output will show the video filters included in your
  3579. build.
  3580. Below is a description of the currently available video filters.
  3581. @section alphaextract
  3582. Extract the alpha component from the input as a grayscale video. This
  3583. is especially useful with the @var{alphamerge} filter.
  3584. @section alphamerge
  3585. Add or replace the alpha component of the primary input with the
  3586. grayscale value of a second input. This is intended for use with
  3587. @var{alphaextract} to allow the transmission or storage of frame
  3588. sequences that have alpha in a format that doesn't support an alpha
  3589. channel.
  3590. For example, to reconstruct full frames from a normal YUV-encoded video
  3591. and a separate video created with @var{alphaextract}, you might use:
  3592. @example
  3593. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3594. @end example
  3595. Since this filter is designed for reconstruction, it operates on frame
  3596. sequences without considering timestamps, and terminates when either
  3597. input reaches end of stream. This will cause problems if your encoding
  3598. pipeline drops frames. If you're trying to apply an image as an
  3599. overlay to a video stream, consider the @var{overlay} filter instead.
  3600. @section ass
  3601. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3602. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3603. Substation Alpha) subtitles files.
  3604. This filter accepts the following option in addition to the common options from
  3605. the @ref{subtitles} filter:
  3606. @table @option
  3607. @item shaping
  3608. Set the shaping engine
  3609. Available values are:
  3610. @table @samp
  3611. @item auto
  3612. The default libass shaping engine, which is the best available.
  3613. @item simple
  3614. Fast, font-agnostic shaper that can do only substitutions
  3615. @item complex
  3616. Slower shaper using OpenType for substitutions and positioning
  3617. @end table
  3618. The default is @code{auto}.
  3619. @end table
  3620. @section atadenoise
  3621. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3622. The filter accepts the following options:
  3623. @table @option
  3624. @item 0a
  3625. Set threshold A for 1st plane. Default is 0.02.
  3626. Valid range is 0 to 0.3.
  3627. @item 0b
  3628. Set threshold B for 1st plane. Default is 0.04.
  3629. Valid range is 0 to 5.
  3630. @item 1a
  3631. Set threshold A for 2nd plane. Default is 0.02.
  3632. Valid range is 0 to 0.3.
  3633. @item 1b
  3634. Set threshold B for 2nd plane. Default is 0.04.
  3635. Valid range is 0 to 5.
  3636. @item 2a
  3637. Set threshold A for 3rd plane. Default is 0.02.
  3638. Valid range is 0 to 0.3.
  3639. @item 2b
  3640. Set threshold B for 3rd plane. Default is 0.04.
  3641. Valid range is 0 to 5.
  3642. Threshold A is designed to react on abrupt changes in the input signal and
  3643. threshold B is designed to react on continuous changes in the input signal.
  3644. @item s
  3645. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3646. number in range [5, 129].
  3647. @item p
  3648. Set what planes of frame filter will use for averaging. Default is all.
  3649. @end table
  3650. @section avgblur
  3651. Apply average blur filter.
  3652. The filter accepts the following options:
  3653. @table @option
  3654. @item sizeX
  3655. Set horizontal kernel size.
  3656. @item planes
  3657. Set which planes to filter. By default all planes are filtered.
  3658. @item sizeY
  3659. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3660. Default is @code{0}.
  3661. @end table
  3662. @section bbox
  3663. Compute the bounding box for the non-black pixels in the input frame
  3664. luminance plane.
  3665. This filter computes the bounding box containing all the pixels with a
  3666. luminance value greater than the minimum allowed value.
  3667. The parameters describing the bounding box are printed on the filter
  3668. log.
  3669. The filter accepts the following option:
  3670. @table @option
  3671. @item min_val
  3672. Set the minimal luminance value. Default is @code{16}.
  3673. @end table
  3674. @section bitplanenoise
  3675. Show and measure bit plane noise.
  3676. The filter accepts the following options:
  3677. @table @option
  3678. @item bitplane
  3679. Set which plane to analyze. Default is @code{1}.
  3680. @item filter
  3681. Filter out noisy pixels from @code{bitplane} set above.
  3682. Default is disabled.
  3683. @end table
  3684. @section blackdetect
  3685. Detect video intervals that are (almost) completely black. Can be
  3686. useful to detect chapter transitions, commercials, or invalid
  3687. recordings. Output lines contains the time for the start, end and
  3688. duration of the detected black interval expressed in seconds.
  3689. In order to display the output lines, you need to set the loglevel at
  3690. least to the AV_LOG_INFO value.
  3691. The filter accepts the following options:
  3692. @table @option
  3693. @item black_min_duration, d
  3694. Set the minimum detected black duration expressed in seconds. It must
  3695. be a non-negative floating point number.
  3696. Default value is 2.0.
  3697. @item picture_black_ratio_th, pic_th
  3698. Set the threshold for considering a picture "black".
  3699. Express the minimum value for the ratio:
  3700. @example
  3701. @var{nb_black_pixels} / @var{nb_pixels}
  3702. @end example
  3703. for which a picture is considered black.
  3704. Default value is 0.98.
  3705. @item pixel_black_th, pix_th
  3706. Set the threshold for considering a pixel "black".
  3707. The threshold expresses the maximum pixel luminance value for which a
  3708. pixel is considered "black". The provided value is scaled according to
  3709. the following equation:
  3710. @example
  3711. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3712. @end example
  3713. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3714. the input video format, the range is [0-255] for YUV full-range
  3715. formats and [16-235] for YUV non full-range formats.
  3716. Default value is 0.10.
  3717. @end table
  3718. The following example sets the maximum pixel threshold to the minimum
  3719. value, and detects only black intervals of 2 or more seconds:
  3720. @example
  3721. blackdetect=d=2:pix_th=0.00
  3722. @end example
  3723. @section blackframe
  3724. Detect frames that are (almost) completely black. Can be useful to
  3725. detect chapter transitions or commercials. Output lines consist of
  3726. the frame number of the detected frame, the percentage of blackness,
  3727. the position in the file if known or -1 and the timestamp in seconds.
  3728. In order to display the output lines, you need to set the loglevel at
  3729. least to the AV_LOG_INFO value.
  3730. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3731. The value represents the percentage of pixels in the picture that
  3732. are below the threshold value.
  3733. It accepts the following parameters:
  3734. @table @option
  3735. @item amount
  3736. The percentage of the pixels that have to be below the threshold; it defaults to
  3737. @code{98}.
  3738. @item threshold, thresh
  3739. The threshold below which a pixel value is considered black; it defaults to
  3740. @code{32}.
  3741. @end table
  3742. @section blend, tblend
  3743. Blend two video frames into each other.
  3744. The @code{blend} filter takes two input streams and outputs one
  3745. stream, the first input is the "top" layer and second input is
  3746. "bottom" layer. By default, the output terminates when the longest input terminates.
  3747. The @code{tblend} (time blend) filter takes two consecutive frames
  3748. from one single stream, and outputs the result obtained by blending
  3749. the new frame on top of the old frame.
  3750. A description of the accepted options follows.
  3751. @table @option
  3752. @item c0_mode
  3753. @item c1_mode
  3754. @item c2_mode
  3755. @item c3_mode
  3756. @item all_mode
  3757. Set blend mode for specific pixel component or all pixel components in case
  3758. of @var{all_mode}. Default value is @code{normal}.
  3759. Available values for component modes are:
  3760. @table @samp
  3761. @item addition
  3762. @item addition128
  3763. @item and
  3764. @item average
  3765. @item burn
  3766. @item darken
  3767. @item difference
  3768. @item difference128
  3769. @item divide
  3770. @item dodge
  3771. @item freeze
  3772. @item exclusion
  3773. @item glow
  3774. @item hardlight
  3775. @item hardmix
  3776. @item heat
  3777. @item lighten
  3778. @item linearlight
  3779. @item multiply
  3780. @item multiply128
  3781. @item negation
  3782. @item normal
  3783. @item or
  3784. @item overlay
  3785. @item phoenix
  3786. @item pinlight
  3787. @item reflect
  3788. @item screen
  3789. @item softlight
  3790. @item subtract
  3791. @item vividlight
  3792. @item xor
  3793. @end table
  3794. @item c0_opacity
  3795. @item c1_opacity
  3796. @item c2_opacity
  3797. @item c3_opacity
  3798. @item all_opacity
  3799. Set blend opacity for specific pixel component or all pixel components in case
  3800. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3801. @item c0_expr
  3802. @item c1_expr
  3803. @item c2_expr
  3804. @item c3_expr
  3805. @item all_expr
  3806. Set blend expression for specific pixel component or all pixel components in case
  3807. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3808. The expressions can use the following variables:
  3809. @table @option
  3810. @item N
  3811. The sequential number of the filtered frame, starting from @code{0}.
  3812. @item X
  3813. @item Y
  3814. the coordinates of the current sample
  3815. @item W
  3816. @item H
  3817. the width and height of currently filtered plane
  3818. @item SW
  3819. @item SH
  3820. Width and height scale depending on the currently filtered plane. It is the
  3821. ratio between the corresponding luma plane number of pixels and the current
  3822. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3823. @code{0.5,0.5} for chroma planes.
  3824. @item T
  3825. Time of the current frame, expressed in seconds.
  3826. @item TOP, A
  3827. Value of pixel component at current location for first video frame (top layer).
  3828. @item BOTTOM, B
  3829. Value of pixel component at current location for second video frame (bottom layer).
  3830. @end table
  3831. @item shortest
  3832. Force termination when the shortest input terminates. Default is
  3833. @code{0}. This option is only defined for the @code{blend} filter.
  3834. @item repeatlast
  3835. Continue applying the last bottom frame after the end of the stream. A value of
  3836. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3837. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3838. @end table
  3839. @subsection Examples
  3840. @itemize
  3841. @item
  3842. Apply transition from bottom layer to top layer in first 10 seconds:
  3843. @example
  3844. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3845. @end example
  3846. @item
  3847. Apply 1x1 checkerboard effect:
  3848. @example
  3849. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3850. @end example
  3851. @item
  3852. Apply uncover left effect:
  3853. @example
  3854. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3855. @end example
  3856. @item
  3857. Apply uncover down effect:
  3858. @example
  3859. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3860. @end example
  3861. @item
  3862. Apply uncover up-left effect:
  3863. @example
  3864. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3865. @end example
  3866. @item
  3867. Split diagonally video and shows top and bottom layer on each side:
  3868. @example
  3869. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3870. @end example
  3871. @item
  3872. Display differences between the current and the previous frame:
  3873. @example
  3874. tblend=all_mode=difference128
  3875. @end example
  3876. @end itemize
  3877. @section boxblur
  3878. Apply a boxblur algorithm to the input video.
  3879. It accepts the following parameters:
  3880. @table @option
  3881. @item luma_radius, lr
  3882. @item luma_power, lp
  3883. @item chroma_radius, cr
  3884. @item chroma_power, cp
  3885. @item alpha_radius, ar
  3886. @item alpha_power, ap
  3887. @end table
  3888. A description of the accepted options follows.
  3889. @table @option
  3890. @item luma_radius, lr
  3891. @item chroma_radius, cr
  3892. @item alpha_radius, ar
  3893. Set an expression for the box radius in pixels used for blurring the
  3894. corresponding input plane.
  3895. The radius value must be a non-negative number, and must not be
  3896. greater than the value of the expression @code{min(w,h)/2} for the
  3897. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3898. planes.
  3899. Default value for @option{luma_radius} is "2". If not specified,
  3900. @option{chroma_radius} and @option{alpha_radius} default to the
  3901. corresponding value set for @option{luma_radius}.
  3902. The expressions can contain the following constants:
  3903. @table @option
  3904. @item w
  3905. @item h
  3906. The input width and height in pixels.
  3907. @item cw
  3908. @item ch
  3909. The input chroma image width and height in pixels.
  3910. @item hsub
  3911. @item vsub
  3912. The horizontal and vertical chroma subsample values. For example, for the
  3913. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3914. @end table
  3915. @item luma_power, lp
  3916. @item chroma_power, cp
  3917. @item alpha_power, ap
  3918. Specify how many times the boxblur filter is applied to the
  3919. corresponding plane.
  3920. Default value for @option{luma_power} is 2. If not specified,
  3921. @option{chroma_power} and @option{alpha_power} default to the
  3922. corresponding value set for @option{luma_power}.
  3923. A value of 0 will disable the effect.
  3924. @end table
  3925. @subsection Examples
  3926. @itemize
  3927. @item
  3928. Apply a boxblur filter with the luma, chroma, and alpha radii
  3929. set to 2:
  3930. @example
  3931. boxblur=luma_radius=2:luma_power=1
  3932. boxblur=2:1
  3933. @end example
  3934. @item
  3935. Set the luma radius to 2, and alpha and chroma radius to 0:
  3936. @example
  3937. boxblur=2:1:cr=0:ar=0
  3938. @end example
  3939. @item
  3940. Set the luma and chroma radii to a fraction of the video dimension:
  3941. @example
  3942. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3943. @end example
  3944. @end itemize
  3945. @section bwdif
  3946. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3947. Deinterlacing Filter").
  3948. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3949. interpolation algorithms.
  3950. It accepts the following parameters:
  3951. @table @option
  3952. @item mode
  3953. The interlacing mode to adopt. It accepts one of the following values:
  3954. @table @option
  3955. @item 0, send_frame
  3956. Output one frame for each frame.
  3957. @item 1, send_field
  3958. Output one frame for each field.
  3959. @end table
  3960. The default value is @code{send_field}.
  3961. @item parity
  3962. The picture field parity assumed for the input interlaced video. It accepts one
  3963. of the following values:
  3964. @table @option
  3965. @item 0, tff
  3966. Assume the top field is first.
  3967. @item 1, bff
  3968. Assume the bottom field is first.
  3969. @item -1, auto
  3970. Enable automatic detection of field parity.
  3971. @end table
  3972. The default value is @code{auto}.
  3973. If the interlacing is unknown or the decoder does not export this information,
  3974. top field first will be assumed.
  3975. @item deint
  3976. Specify which frames to deinterlace. Accept one of the following
  3977. values:
  3978. @table @option
  3979. @item 0, all
  3980. Deinterlace all frames.
  3981. @item 1, interlaced
  3982. Only deinterlace frames marked as interlaced.
  3983. @end table
  3984. The default value is @code{all}.
  3985. @end table
  3986. @section chromakey
  3987. YUV colorspace color/chroma keying.
  3988. The filter accepts the following options:
  3989. @table @option
  3990. @item color
  3991. The color which will be replaced with transparency.
  3992. @item similarity
  3993. Similarity percentage with the key color.
  3994. 0.01 matches only the exact key color, while 1.0 matches everything.
  3995. @item blend
  3996. Blend percentage.
  3997. 0.0 makes pixels either fully transparent, or not transparent at all.
  3998. Higher values result in semi-transparent pixels, with a higher transparency
  3999. the more similar the pixels color is to the key color.
  4000. @item yuv
  4001. Signals that the color passed is already in YUV instead of RGB.
  4002. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  4003. This can be used to pass exact YUV values as hexadecimal numbers.
  4004. @end table
  4005. @subsection Examples
  4006. @itemize
  4007. @item
  4008. Make every green pixel in the input image transparent:
  4009. @example
  4010. ffmpeg -i input.png -vf chromakey=green out.png
  4011. @end example
  4012. @item
  4013. Overlay a greenscreen-video on top of a static black background.
  4014. @example
  4015. 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
  4016. @end example
  4017. @end itemize
  4018. @section ciescope
  4019. Display CIE color diagram with pixels overlaid onto it.
  4020. The filter accepts the following options:
  4021. @table @option
  4022. @item system
  4023. Set color system.
  4024. @table @samp
  4025. @item ntsc, 470m
  4026. @item ebu, 470bg
  4027. @item smpte
  4028. @item 240m
  4029. @item apple
  4030. @item widergb
  4031. @item cie1931
  4032. @item rec709, hdtv
  4033. @item uhdtv, rec2020
  4034. @end table
  4035. @item cie
  4036. Set CIE system.
  4037. @table @samp
  4038. @item xyy
  4039. @item ucs
  4040. @item luv
  4041. @end table
  4042. @item gamuts
  4043. Set what gamuts to draw.
  4044. See @code{system} option for available values.
  4045. @item size, s
  4046. Set ciescope size, by default set to 512.
  4047. @item intensity, i
  4048. Set intensity used to map input pixel values to CIE diagram.
  4049. @item contrast
  4050. Set contrast used to draw tongue colors that are out of active color system gamut.
  4051. @item corrgamma
  4052. Correct gamma displayed on scope, by default enabled.
  4053. @item showwhite
  4054. Show white point on CIE diagram, by default disabled.
  4055. @item gamma
  4056. Set input gamma. Used only with XYZ input color space.
  4057. @end table
  4058. @section codecview
  4059. Visualize information exported by some codecs.
  4060. Some codecs can export information through frames using side-data or other
  4061. means. For example, some MPEG based codecs export motion vectors through the
  4062. @var{export_mvs} flag in the codec @option{flags2} option.
  4063. The filter accepts the following option:
  4064. @table @option
  4065. @item mv
  4066. Set motion vectors to visualize.
  4067. Available flags for @var{mv} are:
  4068. @table @samp
  4069. @item pf
  4070. forward predicted MVs of P-frames
  4071. @item bf
  4072. forward predicted MVs of B-frames
  4073. @item bb
  4074. backward predicted MVs of B-frames
  4075. @end table
  4076. @item qp
  4077. Display quantization parameters using the chroma planes.
  4078. @item mv_type, mvt
  4079. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4080. Available flags for @var{mv_type} are:
  4081. @table @samp
  4082. @item fp
  4083. forward predicted MVs
  4084. @item bp
  4085. backward predicted MVs
  4086. @end table
  4087. @item frame_type, ft
  4088. Set frame type to visualize motion vectors of.
  4089. Available flags for @var{frame_type} are:
  4090. @table @samp
  4091. @item if
  4092. intra-coded frames (I-frames)
  4093. @item pf
  4094. predicted frames (P-frames)
  4095. @item bf
  4096. bi-directionally predicted frames (B-frames)
  4097. @end table
  4098. @end table
  4099. @subsection Examples
  4100. @itemize
  4101. @item
  4102. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4103. @example
  4104. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4105. @end example
  4106. @item
  4107. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4108. @example
  4109. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4110. @end example
  4111. @end itemize
  4112. @section colorbalance
  4113. Modify intensity of primary colors (red, green and blue) of input frames.
  4114. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4115. regions for the red-cyan, green-magenta or blue-yellow balance.
  4116. A positive adjustment value shifts the balance towards the primary color, a negative
  4117. value towards the complementary color.
  4118. The filter accepts the following options:
  4119. @table @option
  4120. @item rs
  4121. @item gs
  4122. @item bs
  4123. Adjust red, green and blue shadows (darkest pixels).
  4124. @item rm
  4125. @item gm
  4126. @item bm
  4127. Adjust red, green and blue midtones (medium pixels).
  4128. @item rh
  4129. @item gh
  4130. @item bh
  4131. Adjust red, green and blue highlights (brightest pixels).
  4132. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4133. @end table
  4134. @subsection Examples
  4135. @itemize
  4136. @item
  4137. Add red color cast to shadows:
  4138. @example
  4139. colorbalance=rs=.3
  4140. @end example
  4141. @end itemize
  4142. @section colorkey
  4143. RGB colorspace color keying.
  4144. The filter accepts the following options:
  4145. @table @option
  4146. @item color
  4147. The color which will be replaced with transparency.
  4148. @item similarity
  4149. Similarity percentage with the key color.
  4150. 0.01 matches only the exact key color, while 1.0 matches everything.
  4151. @item blend
  4152. Blend percentage.
  4153. 0.0 makes pixels either fully transparent, or not transparent at all.
  4154. Higher values result in semi-transparent pixels, with a higher transparency
  4155. the more similar the pixels color is to the key color.
  4156. @end table
  4157. @subsection Examples
  4158. @itemize
  4159. @item
  4160. Make every green pixel in the input image transparent:
  4161. @example
  4162. ffmpeg -i input.png -vf colorkey=green out.png
  4163. @end example
  4164. @item
  4165. Overlay a greenscreen-video on top of a static background image.
  4166. @example
  4167. 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
  4168. @end example
  4169. @end itemize
  4170. @section colorlevels
  4171. Adjust video input frames using levels.
  4172. The filter accepts the following options:
  4173. @table @option
  4174. @item rimin
  4175. @item gimin
  4176. @item bimin
  4177. @item aimin
  4178. Adjust red, green, blue and alpha input black point.
  4179. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4180. @item rimax
  4181. @item gimax
  4182. @item bimax
  4183. @item aimax
  4184. Adjust red, green, blue and alpha input white point.
  4185. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4186. Input levels are used to lighten highlights (bright tones), darken shadows
  4187. (dark tones), change the balance of bright and dark tones.
  4188. @item romin
  4189. @item gomin
  4190. @item bomin
  4191. @item aomin
  4192. Adjust red, green, blue and alpha output black point.
  4193. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4194. @item romax
  4195. @item gomax
  4196. @item bomax
  4197. @item aomax
  4198. Adjust red, green, blue and alpha output white point.
  4199. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4200. Output levels allows manual selection of a constrained output level range.
  4201. @end table
  4202. @subsection Examples
  4203. @itemize
  4204. @item
  4205. Make video output darker:
  4206. @example
  4207. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4208. @end example
  4209. @item
  4210. Increase contrast:
  4211. @example
  4212. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4213. @end example
  4214. @item
  4215. Make video output lighter:
  4216. @example
  4217. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4218. @end example
  4219. @item
  4220. Increase brightness:
  4221. @example
  4222. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4223. @end example
  4224. @end itemize
  4225. @section colorchannelmixer
  4226. Adjust video input frames by re-mixing color channels.
  4227. This filter modifies a color channel by adding the values associated to
  4228. the other channels of the same pixels. For example if the value to
  4229. modify is red, the output value will be:
  4230. @example
  4231. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4232. @end example
  4233. The filter accepts the following options:
  4234. @table @option
  4235. @item rr
  4236. @item rg
  4237. @item rb
  4238. @item ra
  4239. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4240. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4241. @item gr
  4242. @item gg
  4243. @item gb
  4244. @item ga
  4245. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4246. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4247. @item br
  4248. @item bg
  4249. @item bb
  4250. @item ba
  4251. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4252. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4253. @item ar
  4254. @item ag
  4255. @item ab
  4256. @item aa
  4257. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4258. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4259. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4260. @end table
  4261. @subsection Examples
  4262. @itemize
  4263. @item
  4264. Convert source to grayscale:
  4265. @example
  4266. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4267. @end example
  4268. @item
  4269. Simulate sepia tones:
  4270. @example
  4271. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4272. @end example
  4273. @end itemize
  4274. @section colormatrix
  4275. Convert color matrix.
  4276. The filter accepts the following options:
  4277. @table @option
  4278. @item src
  4279. @item dst
  4280. Specify the source and destination color matrix. Both values must be
  4281. specified.
  4282. The accepted values are:
  4283. @table @samp
  4284. @item bt709
  4285. BT.709
  4286. @item fcc
  4287. FCC
  4288. @item bt601
  4289. BT.601
  4290. @item bt470
  4291. BT.470
  4292. @item bt470bg
  4293. BT.470BG
  4294. @item smpte170m
  4295. SMPTE-170M
  4296. @item smpte240m
  4297. SMPTE-240M
  4298. @item bt2020
  4299. BT.2020
  4300. @end table
  4301. @end table
  4302. For example to convert from BT.601 to SMPTE-240M, use the command:
  4303. @example
  4304. colormatrix=bt601:smpte240m
  4305. @end example
  4306. @section colorspace
  4307. Convert colorspace, transfer characteristics or color primaries.
  4308. Input video needs to have an even size.
  4309. The filter accepts the following options:
  4310. @table @option
  4311. @anchor{all}
  4312. @item all
  4313. Specify all color properties at once.
  4314. The accepted values are:
  4315. @table @samp
  4316. @item bt470m
  4317. BT.470M
  4318. @item bt470bg
  4319. BT.470BG
  4320. @item bt601-6-525
  4321. BT.601-6 525
  4322. @item bt601-6-625
  4323. BT.601-6 625
  4324. @item bt709
  4325. BT.709
  4326. @item smpte170m
  4327. SMPTE-170M
  4328. @item smpte240m
  4329. SMPTE-240M
  4330. @item bt2020
  4331. BT.2020
  4332. @end table
  4333. @anchor{space}
  4334. @item space
  4335. Specify output colorspace.
  4336. The accepted values are:
  4337. @table @samp
  4338. @item bt709
  4339. BT.709
  4340. @item fcc
  4341. FCC
  4342. @item bt470bg
  4343. BT.470BG or BT.601-6 625
  4344. @item smpte170m
  4345. SMPTE-170M or BT.601-6 525
  4346. @item smpte240m
  4347. SMPTE-240M
  4348. @item ycgco
  4349. YCgCo
  4350. @item bt2020ncl
  4351. BT.2020 with non-constant luminance
  4352. @end table
  4353. @anchor{trc}
  4354. @item trc
  4355. Specify output transfer characteristics.
  4356. The accepted values are:
  4357. @table @samp
  4358. @item bt709
  4359. BT.709
  4360. @item bt470m
  4361. BT.470M
  4362. @item bt470bg
  4363. BT.470BG
  4364. @item gamma22
  4365. Constant gamma of 2.2
  4366. @item gamma28
  4367. Constant gamma of 2.8
  4368. @item smpte170m
  4369. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4370. @item smpte240m
  4371. SMPTE-240M
  4372. @item srgb
  4373. SRGB
  4374. @item iec61966-2-1
  4375. iec61966-2-1
  4376. @item iec61966-2-4
  4377. iec61966-2-4
  4378. @item xvycc
  4379. xvycc
  4380. @item bt2020-10
  4381. BT.2020 for 10-bits content
  4382. @item bt2020-12
  4383. BT.2020 for 12-bits content
  4384. @end table
  4385. @anchor{primaries}
  4386. @item primaries
  4387. Specify output color primaries.
  4388. The accepted values are:
  4389. @table @samp
  4390. @item bt709
  4391. BT.709
  4392. @item bt470m
  4393. BT.470M
  4394. @item bt470bg
  4395. BT.470BG or BT.601-6 625
  4396. @item smpte170m
  4397. SMPTE-170M or BT.601-6 525
  4398. @item smpte240m
  4399. SMPTE-240M
  4400. @item film
  4401. film
  4402. @item smpte431
  4403. SMPTE-431
  4404. @item smpte432
  4405. SMPTE-432
  4406. @item bt2020
  4407. BT.2020
  4408. @item jedec-p22
  4409. JEDEC P22 phosphors
  4410. @end table
  4411. @anchor{range}
  4412. @item range
  4413. Specify output color range.
  4414. The accepted values are:
  4415. @table @samp
  4416. @item tv
  4417. TV (restricted) range
  4418. @item mpeg
  4419. MPEG (restricted) range
  4420. @item pc
  4421. PC (full) range
  4422. @item jpeg
  4423. JPEG (full) range
  4424. @end table
  4425. @item format
  4426. Specify output color format.
  4427. The accepted values are:
  4428. @table @samp
  4429. @item yuv420p
  4430. YUV 4:2:0 planar 8-bits
  4431. @item yuv420p10
  4432. YUV 4:2:0 planar 10-bits
  4433. @item yuv420p12
  4434. YUV 4:2:0 planar 12-bits
  4435. @item yuv422p
  4436. YUV 4:2:2 planar 8-bits
  4437. @item yuv422p10
  4438. YUV 4:2:2 planar 10-bits
  4439. @item yuv422p12
  4440. YUV 4:2:2 planar 12-bits
  4441. @item yuv444p
  4442. YUV 4:4:4 planar 8-bits
  4443. @item yuv444p10
  4444. YUV 4:4:4 planar 10-bits
  4445. @item yuv444p12
  4446. YUV 4:4:4 planar 12-bits
  4447. @end table
  4448. @item fast
  4449. Do a fast conversion, which skips gamma/primary correction. This will take
  4450. significantly less CPU, but will be mathematically incorrect. To get output
  4451. compatible with that produced by the colormatrix filter, use fast=1.
  4452. @item dither
  4453. Specify dithering mode.
  4454. The accepted values are:
  4455. @table @samp
  4456. @item none
  4457. No dithering
  4458. @item fsb
  4459. Floyd-Steinberg dithering
  4460. @end table
  4461. @item wpadapt
  4462. Whitepoint adaptation mode.
  4463. The accepted values are:
  4464. @table @samp
  4465. @item bradford
  4466. Bradford whitepoint adaptation
  4467. @item vonkries
  4468. von Kries whitepoint adaptation
  4469. @item identity
  4470. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4471. @end table
  4472. @item iall
  4473. Override all input properties at once. Same accepted values as @ref{all}.
  4474. @item ispace
  4475. Override input colorspace. Same accepted values as @ref{space}.
  4476. @item iprimaries
  4477. Override input color primaries. Same accepted values as @ref{primaries}.
  4478. @item itrc
  4479. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4480. @item irange
  4481. Override input color range. Same accepted values as @ref{range}.
  4482. @end table
  4483. The filter converts the transfer characteristics, color space and color
  4484. primaries to the specified user values. The output value, if not specified,
  4485. is set to a default value based on the "all" property. If that property is
  4486. also not specified, the filter will log an error. The output color range and
  4487. format default to the same value as the input color range and format. The
  4488. input transfer characteristics, color space, color primaries and color range
  4489. should be set on the input data. If any of these are missing, the filter will
  4490. log an error and no conversion will take place.
  4491. For example to convert the input to SMPTE-240M, use the command:
  4492. @example
  4493. colorspace=smpte240m
  4494. @end example
  4495. @section convolution
  4496. Apply convolution 3x3 or 5x5 filter.
  4497. The filter accepts the following options:
  4498. @table @option
  4499. @item 0m
  4500. @item 1m
  4501. @item 2m
  4502. @item 3m
  4503. Set matrix for each plane.
  4504. Matrix is sequence of 9 or 25 signed integers.
  4505. @item 0rdiv
  4506. @item 1rdiv
  4507. @item 2rdiv
  4508. @item 3rdiv
  4509. Set multiplier for calculated value for each plane.
  4510. @item 0bias
  4511. @item 1bias
  4512. @item 2bias
  4513. @item 3bias
  4514. Set bias for each plane. This value is added to the result of the multiplication.
  4515. Useful for making the overall image brighter or darker. Default is 0.0.
  4516. @end table
  4517. @subsection Examples
  4518. @itemize
  4519. @item
  4520. Apply sharpen:
  4521. @example
  4522. 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"
  4523. @end example
  4524. @item
  4525. Apply blur:
  4526. @example
  4527. 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"
  4528. @end example
  4529. @item
  4530. Apply edge enhance:
  4531. @example
  4532. 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"
  4533. @end example
  4534. @item
  4535. Apply edge detect:
  4536. @example
  4537. 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"
  4538. @end example
  4539. @item
  4540. Apply emboss:
  4541. @example
  4542. 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"
  4543. @end example
  4544. @end itemize
  4545. @section copy
  4546. Copy the input video source unchanged to the output. This is mainly useful for
  4547. testing purposes.
  4548. @anchor{coreimage}
  4549. @section coreimage
  4550. Video filtering on GPU using Apple's CoreImage API on OSX.
  4551. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4552. processed by video hardware. However, software-based OpenGL implementations
  4553. exist which means there is no guarantee for hardware processing. It depends on
  4554. the respective OSX.
  4555. There are many filters and image generators provided by Apple that come with a
  4556. large variety of options. The filter has to be referenced by its name along
  4557. with its options.
  4558. The coreimage filter accepts the following options:
  4559. @table @option
  4560. @item list_filters
  4561. List all available filters and generators along with all their respective
  4562. options as well as possible minimum and maximum values along with the default
  4563. values.
  4564. @example
  4565. list_filters=true
  4566. @end example
  4567. @item filter
  4568. Specify all filters by their respective name and options.
  4569. Use @var{list_filters} to determine all valid filter names and options.
  4570. Numerical options are specified by a float value and are automatically clamped
  4571. to their respective value range. Vector and color options have to be specified
  4572. by a list of space separated float values. Character escaping has to be done.
  4573. A special option name @code{default} is available to use default options for a
  4574. filter.
  4575. It is required to specify either @code{default} or at least one of the filter options.
  4576. All omitted options are used with their default values.
  4577. The syntax of the filter string is as follows:
  4578. @example
  4579. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4580. @end example
  4581. @item output_rect
  4582. Specify a rectangle where the output of the filter chain is copied into the
  4583. input image. It is given by a list of space separated float values:
  4584. @example
  4585. output_rect=x\ y\ width\ height
  4586. @end example
  4587. If not given, the output rectangle equals the dimensions of the input image.
  4588. The output rectangle is automatically cropped at the borders of the input
  4589. image. Negative values are valid for each component.
  4590. @example
  4591. output_rect=25\ 25\ 100\ 100
  4592. @end example
  4593. @end table
  4594. Several filters can be chained for successive processing without GPU-HOST
  4595. transfers allowing for fast processing of complex filter chains.
  4596. Currently, only filters with zero (generators) or exactly one (filters) input
  4597. image and one output image are supported. Also, transition filters are not yet
  4598. usable as intended.
  4599. Some filters generate output images with additional padding depending on the
  4600. respective filter kernel. The padding is automatically removed to ensure the
  4601. filter output has the same size as the input image.
  4602. For image generators, the size of the output image is determined by the
  4603. previous output image of the filter chain or the input image of the whole
  4604. filterchain, respectively. The generators do not use the pixel information of
  4605. this image to generate their output. However, the generated output is
  4606. blended onto this image, resulting in partial or complete coverage of the
  4607. output image.
  4608. The @ref{coreimagesrc} video source can be used for generating input images
  4609. which are directly fed into the filter chain. By using it, providing input
  4610. images by another video source or an input video is not required.
  4611. @subsection Examples
  4612. @itemize
  4613. @item
  4614. List all filters available:
  4615. @example
  4616. coreimage=list_filters=true
  4617. @end example
  4618. @item
  4619. Use the CIBoxBlur filter with default options to blur an image:
  4620. @example
  4621. coreimage=filter=CIBoxBlur@@default
  4622. @end example
  4623. @item
  4624. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4625. its center at 100x100 and a radius of 50 pixels:
  4626. @example
  4627. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4628. @end example
  4629. @item
  4630. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4631. given as complete and escaped command-line for Apple's standard bash shell:
  4632. @example
  4633. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4634. @end example
  4635. @end itemize
  4636. @section crop
  4637. Crop the input video to given dimensions.
  4638. It accepts the following parameters:
  4639. @table @option
  4640. @item w, out_w
  4641. The width of the output video. It defaults to @code{iw}.
  4642. This expression is evaluated only once during the filter
  4643. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4644. @item h, out_h
  4645. The height of the output video. It defaults to @code{ih}.
  4646. This expression is evaluated only once during the filter
  4647. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4648. @item x
  4649. The horizontal position, in the input video, of the left edge of the output
  4650. video. It defaults to @code{(in_w-out_w)/2}.
  4651. This expression is evaluated per-frame.
  4652. @item y
  4653. The vertical position, in the input video, of the top edge of the output video.
  4654. It defaults to @code{(in_h-out_h)/2}.
  4655. This expression is evaluated per-frame.
  4656. @item keep_aspect
  4657. If set to 1 will force the output display aspect ratio
  4658. to be the same of the input, by changing the output sample aspect
  4659. ratio. It defaults to 0.
  4660. @item exact
  4661. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4662. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4663. It defaults to 0.
  4664. @end table
  4665. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4666. expressions containing the following constants:
  4667. @table @option
  4668. @item x
  4669. @item y
  4670. The computed values for @var{x} and @var{y}. They are evaluated for
  4671. each new frame.
  4672. @item in_w
  4673. @item in_h
  4674. The input width and height.
  4675. @item iw
  4676. @item ih
  4677. These are the same as @var{in_w} and @var{in_h}.
  4678. @item out_w
  4679. @item out_h
  4680. The output (cropped) width and height.
  4681. @item ow
  4682. @item oh
  4683. These are the same as @var{out_w} and @var{out_h}.
  4684. @item a
  4685. same as @var{iw} / @var{ih}
  4686. @item sar
  4687. input sample aspect ratio
  4688. @item dar
  4689. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4690. @item hsub
  4691. @item vsub
  4692. horizontal and vertical chroma subsample values. For example for the
  4693. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4694. @item n
  4695. The number of the input frame, starting from 0.
  4696. @item pos
  4697. the position in the file of the input frame, NAN if unknown
  4698. @item t
  4699. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4700. @end table
  4701. The expression for @var{out_w} may depend on the value of @var{out_h},
  4702. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4703. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4704. evaluated after @var{out_w} and @var{out_h}.
  4705. The @var{x} and @var{y} parameters specify the expressions for the
  4706. position of the top-left corner of the output (non-cropped) area. They
  4707. are evaluated for each frame. If the evaluated value is not valid, it
  4708. is approximated to the nearest valid value.
  4709. The expression for @var{x} may depend on @var{y}, and the expression
  4710. for @var{y} may depend on @var{x}.
  4711. @subsection Examples
  4712. @itemize
  4713. @item
  4714. Crop area with size 100x100 at position (12,34).
  4715. @example
  4716. crop=100:100:12:34
  4717. @end example
  4718. Using named options, the example above becomes:
  4719. @example
  4720. crop=w=100:h=100:x=12:y=34
  4721. @end example
  4722. @item
  4723. Crop the central input area with size 100x100:
  4724. @example
  4725. crop=100:100
  4726. @end example
  4727. @item
  4728. Crop the central input area with size 2/3 of the input video:
  4729. @example
  4730. crop=2/3*in_w:2/3*in_h
  4731. @end example
  4732. @item
  4733. Crop the input video central square:
  4734. @example
  4735. crop=out_w=in_h
  4736. crop=in_h
  4737. @end example
  4738. @item
  4739. Delimit the rectangle with the top-left corner placed at position
  4740. 100:100 and the right-bottom corner corresponding to the right-bottom
  4741. corner of the input image.
  4742. @example
  4743. crop=in_w-100:in_h-100:100:100
  4744. @end example
  4745. @item
  4746. Crop 10 pixels from the left and right borders, and 20 pixels from
  4747. the top and bottom borders
  4748. @example
  4749. crop=in_w-2*10:in_h-2*20
  4750. @end example
  4751. @item
  4752. Keep only the bottom right quarter of the input image:
  4753. @example
  4754. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4755. @end example
  4756. @item
  4757. Crop height for getting Greek harmony:
  4758. @example
  4759. crop=in_w:1/PHI*in_w
  4760. @end example
  4761. @item
  4762. Apply trembling effect:
  4763. @example
  4764. 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)
  4765. @end example
  4766. @item
  4767. Apply erratic camera effect depending on timestamp:
  4768. @example
  4769. 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)"
  4770. @end example
  4771. @item
  4772. Set x depending on the value of y:
  4773. @example
  4774. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4775. @end example
  4776. @end itemize
  4777. @subsection Commands
  4778. This filter supports the following commands:
  4779. @table @option
  4780. @item w, out_w
  4781. @item h, out_h
  4782. @item x
  4783. @item y
  4784. Set width/height of the output video and the horizontal/vertical position
  4785. in the input video.
  4786. The command accepts the same syntax of the corresponding option.
  4787. If the specified expression is not valid, it is kept at its current
  4788. value.
  4789. @end table
  4790. @section cropdetect
  4791. Auto-detect the crop size.
  4792. It calculates the necessary cropping parameters and prints the
  4793. recommended parameters via the logging system. The detected dimensions
  4794. correspond to the non-black area of the input video.
  4795. It accepts the following parameters:
  4796. @table @option
  4797. @item limit
  4798. Set higher black value threshold, which can be optionally specified
  4799. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4800. value greater to the set value is considered non-black. It defaults to 24.
  4801. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4802. on the bitdepth of the pixel format.
  4803. @item round
  4804. The value which the width/height should be divisible by. It defaults to
  4805. 16. The offset is automatically adjusted to center the video. Use 2 to
  4806. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4807. encoding to most video codecs.
  4808. @item reset_count, reset
  4809. Set the counter that determines after how many frames cropdetect will
  4810. reset the previously detected largest video area and start over to
  4811. detect the current optimal crop area. Default value is 0.
  4812. This can be useful when channel logos distort the video area. 0
  4813. indicates 'never reset', and returns the largest area encountered during
  4814. playback.
  4815. @end table
  4816. @anchor{curves}
  4817. @section curves
  4818. Apply color adjustments using curves.
  4819. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4820. component (red, green and blue) has its values defined by @var{N} key points
  4821. tied from each other using a smooth curve. The x-axis represents the pixel
  4822. values from the input frame, and the y-axis the new pixel values to be set for
  4823. the output frame.
  4824. By default, a component curve is defined by the two points @var{(0;0)} and
  4825. @var{(1;1)}. This creates a straight line where each original pixel value is
  4826. "adjusted" to its own value, which means no change to the image.
  4827. The filter allows you to redefine these two points and add some more. A new
  4828. curve (using a natural cubic spline interpolation) will be define to pass
  4829. smoothly through all these new coordinates. The new defined points needs to be
  4830. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4831. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4832. the vector spaces, the values will be clipped accordingly.
  4833. The filter accepts the following options:
  4834. @table @option
  4835. @item preset
  4836. Select one of the available color presets. This option can be used in addition
  4837. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4838. options takes priority on the preset values.
  4839. Available presets are:
  4840. @table @samp
  4841. @item none
  4842. @item color_negative
  4843. @item cross_process
  4844. @item darker
  4845. @item increase_contrast
  4846. @item lighter
  4847. @item linear_contrast
  4848. @item medium_contrast
  4849. @item negative
  4850. @item strong_contrast
  4851. @item vintage
  4852. @end table
  4853. Default is @code{none}.
  4854. @item master, m
  4855. Set the master key points. These points will define a second pass mapping. It
  4856. is sometimes called a "luminance" or "value" mapping. It can be used with
  4857. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4858. post-processing LUT.
  4859. @item red, r
  4860. Set the key points for the red component.
  4861. @item green, g
  4862. Set the key points for the green component.
  4863. @item blue, b
  4864. Set the key points for the blue component.
  4865. @item all
  4866. Set the key points for all components (not including master).
  4867. Can be used in addition to the other key points component
  4868. options. In this case, the unset component(s) will fallback on this
  4869. @option{all} setting.
  4870. @item psfile
  4871. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4872. @item plot
  4873. Save Gnuplot script of the curves in specified file.
  4874. @end table
  4875. To avoid some filtergraph syntax conflicts, each key points list need to be
  4876. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4877. @subsection Examples
  4878. @itemize
  4879. @item
  4880. Increase slightly the middle level of blue:
  4881. @example
  4882. curves=blue='0/0 0.5/0.58 1/1'
  4883. @end example
  4884. @item
  4885. Vintage effect:
  4886. @example
  4887. 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'
  4888. @end example
  4889. Here we obtain the following coordinates for each components:
  4890. @table @var
  4891. @item red
  4892. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4893. @item green
  4894. @code{(0;0) (0.50;0.48) (1;1)}
  4895. @item blue
  4896. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4897. @end table
  4898. @item
  4899. The previous example can also be achieved with the associated built-in preset:
  4900. @example
  4901. curves=preset=vintage
  4902. @end example
  4903. @item
  4904. Or simply:
  4905. @example
  4906. curves=vintage
  4907. @end example
  4908. @item
  4909. Use a Photoshop preset and redefine the points of the green component:
  4910. @example
  4911. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4912. @end example
  4913. @item
  4914. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4915. and @command{gnuplot}:
  4916. @example
  4917. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4918. gnuplot -p /tmp/curves.plt
  4919. @end example
  4920. @end itemize
  4921. @section datascope
  4922. Video data analysis filter.
  4923. This filter shows hexadecimal pixel values of part of video.
  4924. The filter accepts the following options:
  4925. @table @option
  4926. @item size, s
  4927. Set output video size.
  4928. @item x
  4929. Set x offset from where to pick pixels.
  4930. @item y
  4931. Set y offset from where to pick pixels.
  4932. @item mode
  4933. Set scope mode, can be one of the following:
  4934. @table @samp
  4935. @item mono
  4936. Draw hexadecimal pixel values with white color on black background.
  4937. @item color
  4938. Draw hexadecimal pixel values with input video pixel color on black
  4939. background.
  4940. @item color2
  4941. Draw hexadecimal pixel values on color background picked from input video,
  4942. the text color is picked in such way so its always visible.
  4943. @end table
  4944. @item axis
  4945. Draw rows and columns numbers on left and top of video.
  4946. @item opacity
  4947. Set background opacity.
  4948. @end table
  4949. @section dctdnoiz
  4950. Denoise frames using 2D DCT (frequency domain filtering).
  4951. This filter is not designed for real time.
  4952. The filter accepts the following options:
  4953. @table @option
  4954. @item sigma, s
  4955. Set the noise sigma constant.
  4956. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4957. coefficient (absolute value) below this threshold with be dropped.
  4958. If you need a more advanced filtering, see @option{expr}.
  4959. Default is @code{0}.
  4960. @item overlap
  4961. Set number overlapping pixels for each block. Since the filter can be slow, you
  4962. may want to reduce this value, at the cost of a less effective filter and the
  4963. risk of various artefacts.
  4964. If the overlapping value doesn't permit processing the whole input width or
  4965. height, a warning will be displayed and according borders won't be denoised.
  4966. Default value is @var{blocksize}-1, which is the best possible setting.
  4967. @item expr, e
  4968. Set the coefficient factor expression.
  4969. For each coefficient of a DCT block, this expression will be evaluated as a
  4970. multiplier value for the coefficient.
  4971. If this is option is set, the @option{sigma} option will be ignored.
  4972. The absolute value of the coefficient can be accessed through the @var{c}
  4973. variable.
  4974. @item n
  4975. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4976. @var{blocksize}, which is the width and height of the processed blocks.
  4977. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4978. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4979. on the speed processing. Also, a larger block size does not necessarily means a
  4980. better de-noising.
  4981. @end table
  4982. @subsection Examples
  4983. Apply a denoise with a @option{sigma} of @code{4.5}:
  4984. @example
  4985. dctdnoiz=4.5
  4986. @end example
  4987. The same operation can be achieved using the expression system:
  4988. @example
  4989. dctdnoiz=e='gte(c, 4.5*3)'
  4990. @end example
  4991. Violent denoise using a block size of @code{16x16}:
  4992. @example
  4993. dctdnoiz=15:n=4
  4994. @end example
  4995. @section deband
  4996. Remove banding artifacts from input video.
  4997. It works by replacing banded pixels with average value of referenced pixels.
  4998. The filter accepts the following options:
  4999. @table @option
  5000. @item 1thr
  5001. @item 2thr
  5002. @item 3thr
  5003. @item 4thr
  5004. Set banding detection threshold for each plane. Default is 0.02.
  5005. Valid range is 0.00003 to 0.5.
  5006. If difference between current pixel and reference pixel is less than threshold,
  5007. it will be considered as banded.
  5008. @item range, r
  5009. Banding detection range in pixels. Default is 16. If positive, random number
  5010. in range 0 to set value will be used. If negative, exact absolute value
  5011. will be used.
  5012. The range defines square of four pixels around current pixel.
  5013. @item direction, d
  5014. Set direction in radians from which four pixel will be compared. If positive,
  5015. random direction from 0 to set direction will be picked. If negative, exact of
  5016. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5017. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5018. column.
  5019. @item blur, b
  5020. If enabled, current pixel is compared with average value of all four
  5021. surrounding pixels. The default is enabled. If disabled current pixel is
  5022. compared with all four surrounding pixels. The pixel is considered banded
  5023. if only all four differences with surrounding pixels are less than threshold.
  5024. @item coupling, c
  5025. If enabled, current pixel is changed if and only if all pixel components are banded,
  5026. e.g. banding detection threshold is triggered for all color components.
  5027. The default is disabled.
  5028. @end table
  5029. @anchor{decimate}
  5030. @section decimate
  5031. Drop duplicated frames at regular intervals.
  5032. The filter accepts the following options:
  5033. @table @option
  5034. @item cycle
  5035. Set the number of frames from which one will be dropped. Setting this to
  5036. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5037. Default is @code{5}.
  5038. @item dupthresh
  5039. Set the threshold for duplicate detection. If the difference metric for a frame
  5040. is less than or equal to this value, then it is declared as duplicate. Default
  5041. is @code{1.1}
  5042. @item scthresh
  5043. Set scene change threshold. Default is @code{15}.
  5044. @item blockx
  5045. @item blocky
  5046. Set the size of the x and y-axis blocks used during metric calculations.
  5047. Larger blocks give better noise suppression, but also give worse detection of
  5048. small movements. Must be a power of two. Default is @code{32}.
  5049. @item ppsrc
  5050. Mark main input as a pre-processed input and activate clean source input
  5051. stream. This allows the input to be pre-processed with various filters to help
  5052. the metrics calculation while keeping the frame selection lossless. When set to
  5053. @code{1}, the first stream is for the pre-processed input, and the second
  5054. stream is the clean source from where the kept frames are chosen. Default is
  5055. @code{0}.
  5056. @item chroma
  5057. Set whether or not chroma is considered in the metric calculations. Default is
  5058. @code{1}.
  5059. @end table
  5060. @section deflate
  5061. Apply deflate effect to the video.
  5062. This filter replaces the pixel by the local(3x3) average by taking into account
  5063. only values lower than the pixel.
  5064. It accepts the following options:
  5065. @table @option
  5066. @item threshold0
  5067. @item threshold1
  5068. @item threshold2
  5069. @item threshold3
  5070. Limit the maximum change for each plane, default is 65535.
  5071. If 0, plane will remain unchanged.
  5072. @end table
  5073. @section deflicker
  5074. Remove temporal frame luminance variations.
  5075. It accepts the following options:
  5076. @table @option
  5077. @item size, s
  5078. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5079. @item mode, m
  5080. Set averaging mode to smooth temporal luminance variations.
  5081. Available values are:
  5082. @table @samp
  5083. @item am
  5084. Arithmetic mean
  5085. @item gm
  5086. Geometric mean
  5087. @item hm
  5088. Harmonic mean
  5089. @item qm
  5090. Quadratic mean
  5091. @item cm
  5092. Cubic mean
  5093. @item pm
  5094. Power mean
  5095. @item median
  5096. Median
  5097. @end table
  5098. @item bypass
  5099. Do not actually modify frame. Useful when one only wants metadata.
  5100. @end table
  5101. @section dejudder
  5102. Remove judder produced by partially interlaced telecined content.
  5103. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5104. source was partially telecined content then the output of @code{pullup,dejudder}
  5105. will have a variable frame rate. May change the recorded frame rate of the
  5106. container. Aside from that change, this filter will not affect constant frame
  5107. rate video.
  5108. The option available in this filter is:
  5109. @table @option
  5110. @item cycle
  5111. Specify the length of the window over which the judder repeats.
  5112. Accepts any integer greater than 1. Useful values are:
  5113. @table @samp
  5114. @item 4
  5115. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5116. @item 5
  5117. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5118. @item 20
  5119. If a mixture of the two.
  5120. @end table
  5121. The default is @samp{4}.
  5122. @end table
  5123. @section delogo
  5124. Suppress a TV station logo by a simple interpolation of the surrounding
  5125. pixels. Just set a rectangle covering the logo and watch it disappear
  5126. (and sometimes something even uglier appear - your mileage may vary).
  5127. It accepts the following parameters:
  5128. @table @option
  5129. @item x
  5130. @item y
  5131. Specify the top left corner coordinates of the logo. They must be
  5132. specified.
  5133. @item w
  5134. @item h
  5135. Specify the width and height of the logo to clear. They must be
  5136. specified.
  5137. @item band, t
  5138. Specify the thickness of the fuzzy edge of the rectangle (added to
  5139. @var{w} and @var{h}). The default value is 1. This option is
  5140. deprecated, setting higher values should no longer be necessary and
  5141. is not recommended.
  5142. @item show
  5143. When set to 1, a green rectangle is drawn on the screen to simplify
  5144. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5145. The default value is 0.
  5146. The rectangle is drawn on the outermost pixels which will be (partly)
  5147. replaced with interpolated values. The values of the next pixels
  5148. immediately outside this rectangle in each direction will be used to
  5149. compute the interpolated pixel values inside the rectangle.
  5150. @end table
  5151. @subsection Examples
  5152. @itemize
  5153. @item
  5154. Set a rectangle covering the area with top left corner coordinates 0,0
  5155. and size 100x77, and a band of size 10:
  5156. @example
  5157. delogo=x=0:y=0:w=100:h=77:band=10
  5158. @end example
  5159. @end itemize
  5160. @section deshake
  5161. Attempt to fix small changes in horizontal and/or vertical shift. This
  5162. filter helps remove camera shake from hand-holding a camera, bumping a
  5163. tripod, moving on a vehicle, etc.
  5164. The filter accepts the following options:
  5165. @table @option
  5166. @item x
  5167. @item y
  5168. @item w
  5169. @item h
  5170. Specify a rectangular area where to limit the search for motion
  5171. vectors.
  5172. If desired the search for motion vectors can be limited to a
  5173. rectangular area of the frame defined by its top left corner, width
  5174. and height. These parameters have the same meaning as the drawbox
  5175. filter which can be used to visualise the position of the bounding
  5176. box.
  5177. This is useful when simultaneous movement of subjects within the frame
  5178. might be confused for camera motion by the motion vector search.
  5179. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5180. then the full frame is used. This allows later options to be set
  5181. without specifying the bounding box for the motion vector search.
  5182. Default - search the whole frame.
  5183. @item rx
  5184. @item ry
  5185. Specify the maximum extent of movement in x and y directions in the
  5186. range 0-64 pixels. Default 16.
  5187. @item edge
  5188. Specify how to generate pixels to fill blanks at the edge of the
  5189. frame. Available values are:
  5190. @table @samp
  5191. @item blank, 0
  5192. Fill zeroes at blank locations
  5193. @item original, 1
  5194. Original image at blank locations
  5195. @item clamp, 2
  5196. Extruded edge value at blank locations
  5197. @item mirror, 3
  5198. Mirrored edge at blank locations
  5199. @end table
  5200. Default value is @samp{mirror}.
  5201. @item blocksize
  5202. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5203. default 8.
  5204. @item contrast
  5205. Specify the contrast threshold for blocks. Only blocks with more than
  5206. the specified contrast (difference between darkest and lightest
  5207. pixels) will be considered. Range 1-255, default 125.
  5208. @item search
  5209. Specify the search strategy. Available values are:
  5210. @table @samp
  5211. @item exhaustive, 0
  5212. Set exhaustive search
  5213. @item less, 1
  5214. Set less exhaustive search.
  5215. @end table
  5216. Default value is @samp{exhaustive}.
  5217. @item filename
  5218. If set then a detailed log of the motion search is written to the
  5219. specified file.
  5220. @item opencl
  5221. If set to 1, specify using OpenCL capabilities, only available if
  5222. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5223. @end table
  5224. @section detelecine
  5225. Apply an exact inverse of the telecine operation. It requires a predefined
  5226. pattern specified using the pattern option which must be the same as that passed
  5227. to the telecine filter.
  5228. This filter accepts the following options:
  5229. @table @option
  5230. @item first_field
  5231. @table @samp
  5232. @item top, t
  5233. top field first
  5234. @item bottom, b
  5235. bottom field first
  5236. The default value is @code{top}.
  5237. @end table
  5238. @item pattern
  5239. A string of numbers representing the pulldown pattern you wish to apply.
  5240. The default value is @code{23}.
  5241. @item start_frame
  5242. A number representing position of the first frame with respect to the telecine
  5243. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5244. @end table
  5245. @section dilation
  5246. Apply dilation effect to the video.
  5247. This filter replaces the pixel by the local(3x3) maximum.
  5248. It accepts the following options:
  5249. @table @option
  5250. @item threshold0
  5251. @item threshold1
  5252. @item threshold2
  5253. @item threshold3
  5254. Limit the maximum change for each plane, default is 65535.
  5255. If 0, plane will remain unchanged.
  5256. @item coordinates
  5257. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5258. pixels are used.
  5259. Flags to local 3x3 coordinates maps like this:
  5260. 1 2 3
  5261. 4 5
  5262. 6 7 8
  5263. @end table
  5264. @section displace
  5265. Displace pixels as indicated by second and third input stream.
  5266. It takes three input streams and outputs one stream, the first input is the
  5267. source, and second and third input are displacement maps.
  5268. The second input specifies how much to displace pixels along the
  5269. x-axis, while the third input specifies how much to displace pixels
  5270. along the y-axis.
  5271. If one of displacement map streams terminates, last frame from that
  5272. displacement map will be used.
  5273. Note that once generated, displacements maps can be reused over and over again.
  5274. A description of the accepted options follows.
  5275. @table @option
  5276. @item edge
  5277. Set displace behavior for pixels that are out of range.
  5278. Available values are:
  5279. @table @samp
  5280. @item blank
  5281. Missing pixels are replaced by black pixels.
  5282. @item smear
  5283. Adjacent pixels will spread out to replace missing pixels.
  5284. @item wrap
  5285. Out of range pixels are wrapped so they point to pixels of other side.
  5286. @end table
  5287. Default is @samp{smear}.
  5288. @end table
  5289. @subsection Examples
  5290. @itemize
  5291. @item
  5292. Add ripple effect to rgb input of video size hd720:
  5293. @example
  5294. 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
  5295. @end example
  5296. @item
  5297. Add wave effect to rgb input of video size hd720:
  5298. @example
  5299. 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
  5300. @end example
  5301. @end itemize
  5302. @section drawbox
  5303. Draw a colored box on the input image.
  5304. It accepts the following parameters:
  5305. @table @option
  5306. @item x
  5307. @item y
  5308. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5309. @item width, w
  5310. @item height, h
  5311. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5312. the input width and height. It defaults to 0.
  5313. @item color, c
  5314. Specify the color of the box to write. For the general syntax of this option,
  5315. check the "Color" section in the ffmpeg-utils manual. If the special
  5316. value @code{invert} is used, the box edge color is the same as the
  5317. video with inverted luma.
  5318. @item thickness, t
  5319. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5320. See below for the list of accepted constants.
  5321. @end table
  5322. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5323. following constants:
  5324. @table @option
  5325. @item dar
  5326. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5327. @item hsub
  5328. @item vsub
  5329. horizontal and vertical chroma subsample values. For example for the
  5330. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5331. @item in_h, ih
  5332. @item in_w, iw
  5333. The input width and height.
  5334. @item sar
  5335. The input sample aspect ratio.
  5336. @item x
  5337. @item y
  5338. The x and y offset coordinates where the box is drawn.
  5339. @item w
  5340. @item h
  5341. The width and height of the drawn box.
  5342. @item t
  5343. The thickness of the drawn box.
  5344. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5345. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5346. @end table
  5347. @subsection Examples
  5348. @itemize
  5349. @item
  5350. Draw a black box around the edge of the input image:
  5351. @example
  5352. drawbox
  5353. @end example
  5354. @item
  5355. Draw a box with color red and an opacity of 50%:
  5356. @example
  5357. drawbox=10:20:200:60:red@@0.5
  5358. @end example
  5359. The previous example can be specified as:
  5360. @example
  5361. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5362. @end example
  5363. @item
  5364. Fill the box with pink color:
  5365. @example
  5366. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5367. @end example
  5368. @item
  5369. Draw a 2-pixel red 2.40:1 mask:
  5370. @example
  5371. 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
  5372. @end example
  5373. @end itemize
  5374. @section drawgrid
  5375. Draw a grid on the input image.
  5376. It accepts the following parameters:
  5377. @table @option
  5378. @item x
  5379. @item y
  5380. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5381. @item width, w
  5382. @item height, h
  5383. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5384. input width and height, respectively, minus @code{thickness}, so image gets
  5385. framed. Default to 0.
  5386. @item color, c
  5387. Specify the color of the grid. For the general syntax of this option,
  5388. check the "Color" section in the ffmpeg-utils manual. If the special
  5389. value @code{invert} is used, the grid color is the same as the
  5390. video with inverted luma.
  5391. @item thickness, t
  5392. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5393. See below for the list of accepted constants.
  5394. @end table
  5395. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5396. following constants:
  5397. @table @option
  5398. @item dar
  5399. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5400. @item hsub
  5401. @item vsub
  5402. horizontal and vertical chroma subsample values. For example for the
  5403. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5404. @item in_h, ih
  5405. @item in_w, iw
  5406. The input grid cell width and height.
  5407. @item sar
  5408. The input sample aspect ratio.
  5409. @item x
  5410. @item y
  5411. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5412. @item w
  5413. @item h
  5414. The width and height of the drawn cell.
  5415. @item t
  5416. The thickness of the drawn cell.
  5417. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5418. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5419. @end table
  5420. @subsection Examples
  5421. @itemize
  5422. @item
  5423. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5424. @example
  5425. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5426. @end example
  5427. @item
  5428. Draw a white 3x3 grid with an opacity of 50%:
  5429. @example
  5430. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5431. @end example
  5432. @end itemize
  5433. @anchor{drawtext}
  5434. @section drawtext
  5435. Draw a text string or text from a specified file on top of a video, using the
  5436. libfreetype library.
  5437. To enable compilation of this filter, you need to configure FFmpeg with
  5438. @code{--enable-libfreetype}.
  5439. To enable default font fallback and the @var{font} option you need to
  5440. configure FFmpeg with @code{--enable-libfontconfig}.
  5441. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5442. @code{--enable-libfribidi}.
  5443. @subsection Syntax
  5444. It accepts the following parameters:
  5445. @table @option
  5446. @item box
  5447. Used to draw a box around text using the background color.
  5448. The value must be either 1 (enable) or 0 (disable).
  5449. The default value of @var{box} is 0.
  5450. @item boxborderw
  5451. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5452. The default value of @var{boxborderw} is 0.
  5453. @item boxcolor
  5454. The color to be used for drawing box around text. For the syntax of this
  5455. option, check the "Color" section in the ffmpeg-utils manual.
  5456. The default value of @var{boxcolor} is "white".
  5457. @item line_spacing
  5458. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5459. The default value of @var{line_spacing} is 0.
  5460. @item borderw
  5461. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5462. The default value of @var{borderw} is 0.
  5463. @item bordercolor
  5464. Set the color to be used for drawing border around text. For the syntax of this
  5465. option, check the "Color" section in the ffmpeg-utils manual.
  5466. The default value of @var{bordercolor} is "black".
  5467. @item expansion
  5468. Select how the @var{text} is expanded. Can be either @code{none},
  5469. @code{strftime} (deprecated) or
  5470. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5471. below for details.
  5472. @item basetime
  5473. Set a start time for the count. Value is in microseconds. Only applied
  5474. in the deprecated strftime expansion mode. To emulate in normal expansion
  5475. mode use the @code{pts} function, supplying the start time (in seconds)
  5476. as the second argument.
  5477. @item fix_bounds
  5478. If true, check and fix text coords to avoid clipping.
  5479. @item fontcolor
  5480. The color to be used for drawing fonts. For the syntax of this option, check
  5481. the "Color" section in the ffmpeg-utils manual.
  5482. The default value of @var{fontcolor} is "black".
  5483. @item fontcolor_expr
  5484. String which is expanded the same way as @var{text} to obtain dynamic
  5485. @var{fontcolor} value. By default this option has empty value and is not
  5486. processed. When this option is set, it overrides @var{fontcolor} option.
  5487. @item font
  5488. The font family to be used for drawing text. By default Sans.
  5489. @item fontfile
  5490. The font file to be used for drawing text. The path must be included.
  5491. This parameter is mandatory if the fontconfig support is disabled.
  5492. @item alpha
  5493. Draw the text applying alpha blending. The value can
  5494. be a number between 0.0 and 1.0.
  5495. The expression accepts the same variables @var{x, y} as well.
  5496. The default value is 1.
  5497. Please see @var{fontcolor_expr}.
  5498. @item fontsize
  5499. The font size to be used for drawing text.
  5500. The default value of @var{fontsize} is 16.
  5501. @item text_shaping
  5502. If set to 1, attempt to shape the text (for example, reverse the order of
  5503. right-to-left text and join Arabic characters) before drawing it.
  5504. Otherwise, just draw the text exactly as given.
  5505. By default 1 (if supported).
  5506. @item ft_load_flags
  5507. The flags to be used for loading the fonts.
  5508. The flags map the corresponding flags supported by libfreetype, and are
  5509. a combination of the following values:
  5510. @table @var
  5511. @item default
  5512. @item no_scale
  5513. @item no_hinting
  5514. @item render
  5515. @item no_bitmap
  5516. @item vertical_layout
  5517. @item force_autohint
  5518. @item crop_bitmap
  5519. @item pedantic
  5520. @item ignore_global_advance_width
  5521. @item no_recurse
  5522. @item ignore_transform
  5523. @item monochrome
  5524. @item linear_design
  5525. @item no_autohint
  5526. @end table
  5527. Default value is "default".
  5528. For more information consult the documentation for the FT_LOAD_*
  5529. libfreetype flags.
  5530. @item shadowcolor
  5531. The color to be used for drawing a shadow behind the drawn text. For the
  5532. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5533. The default value of @var{shadowcolor} is "black".
  5534. @item shadowx
  5535. @item shadowy
  5536. The x and y offsets for the text shadow position with respect to the
  5537. position of the text. They can be either positive or negative
  5538. values. The default value for both is "0".
  5539. @item start_number
  5540. The starting frame number for the n/frame_num variable. The default value
  5541. is "0".
  5542. @item tabsize
  5543. The size in number of spaces to use for rendering the tab.
  5544. Default value is 4.
  5545. @item timecode
  5546. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5547. format. It can be used with or without text parameter. @var{timecode_rate}
  5548. option must be specified.
  5549. @item timecode_rate, rate, r
  5550. Set the timecode frame rate (timecode only).
  5551. @item tc24hmax
  5552. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5553. Default is 0 (disabled).
  5554. @item text
  5555. The text string to be drawn. The text must be a sequence of UTF-8
  5556. encoded characters.
  5557. This parameter is mandatory if no file is specified with the parameter
  5558. @var{textfile}.
  5559. @item textfile
  5560. A text file containing text to be drawn. The text must be a sequence
  5561. of UTF-8 encoded characters.
  5562. This parameter is mandatory if no text string is specified with the
  5563. parameter @var{text}.
  5564. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5565. @item reload
  5566. If set to 1, the @var{textfile} will be reloaded before each frame.
  5567. Be sure to update it atomically, or it may be read partially, or even fail.
  5568. @item x
  5569. @item y
  5570. The expressions which specify the offsets where text will be drawn
  5571. within the video frame. They are relative to the top/left border of the
  5572. output image.
  5573. The default value of @var{x} and @var{y} is "0".
  5574. See below for the list of accepted constants and functions.
  5575. @end table
  5576. The parameters for @var{x} and @var{y} are expressions containing the
  5577. following constants and functions:
  5578. @table @option
  5579. @item dar
  5580. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5581. @item hsub
  5582. @item vsub
  5583. horizontal and vertical chroma subsample values. For example for the
  5584. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5585. @item line_h, lh
  5586. the height of each text line
  5587. @item main_h, h, H
  5588. the input height
  5589. @item main_w, w, W
  5590. the input width
  5591. @item max_glyph_a, ascent
  5592. the maximum distance from the baseline to the highest/upper grid
  5593. coordinate used to place a glyph outline point, for all the rendered
  5594. glyphs.
  5595. It is a positive value, due to the grid's orientation with the Y axis
  5596. upwards.
  5597. @item max_glyph_d, descent
  5598. the maximum distance from the baseline to the lowest grid coordinate
  5599. used to place a glyph outline point, for all the rendered glyphs.
  5600. This is a negative value, due to the grid's orientation, with the Y axis
  5601. upwards.
  5602. @item max_glyph_h
  5603. maximum glyph height, that is the maximum height for all the glyphs
  5604. contained in the rendered text, it is equivalent to @var{ascent} -
  5605. @var{descent}.
  5606. @item max_glyph_w
  5607. maximum glyph width, that is the maximum width for all the glyphs
  5608. contained in the rendered text
  5609. @item n
  5610. the number of input frame, starting from 0
  5611. @item rand(min, max)
  5612. return a random number included between @var{min} and @var{max}
  5613. @item sar
  5614. The input sample aspect ratio.
  5615. @item t
  5616. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5617. @item text_h, th
  5618. the height of the rendered text
  5619. @item text_w, tw
  5620. the width of the rendered text
  5621. @item x
  5622. @item y
  5623. the x and y offset coordinates where the text is drawn.
  5624. These parameters allow the @var{x} and @var{y} expressions to refer
  5625. each other, so you can for example specify @code{y=x/dar}.
  5626. @end table
  5627. @anchor{drawtext_expansion}
  5628. @subsection Text expansion
  5629. If @option{expansion} is set to @code{strftime},
  5630. the filter recognizes strftime() sequences in the provided text and
  5631. expands them accordingly. Check the documentation of strftime(). This
  5632. feature is deprecated.
  5633. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5634. If @option{expansion} is set to @code{normal} (which is the default),
  5635. the following expansion mechanism is used.
  5636. The backslash character @samp{\}, followed by any character, always expands to
  5637. the second character.
  5638. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5639. braces is a function name, possibly followed by arguments separated by ':'.
  5640. If the arguments contain special characters or delimiters (':' or '@}'),
  5641. they should be escaped.
  5642. Note that they probably must also be escaped as the value for the
  5643. @option{text} option in the filter argument string and as the filter
  5644. argument in the filtergraph description, and possibly also for the shell,
  5645. that makes up to four levels of escaping; using a text file avoids these
  5646. problems.
  5647. The following functions are available:
  5648. @table @command
  5649. @item expr, e
  5650. The expression evaluation result.
  5651. It must take one argument specifying the expression to be evaluated,
  5652. which accepts the same constants and functions as the @var{x} and
  5653. @var{y} values. Note that not all constants should be used, for
  5654. example the text size is not known when evaluating the expression, so
  5655. the constants @var{text_w} and @var{text_h} will have an undefined
  5656. value.
  5657. @item expr_int_format, eif
  5658. Evaluate the expression's value and output as formatted integer.
  5659. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5660. The second argument specifies the output format. Allowed values are @samp{x},
  5661. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5662. @code{printf} function.
  5663. The third parameter is optional and sets the number of positions taken by the output.
  5664. It can be used to add padding with zeros from the left.
  5665. @item gmtime
  5666. The time at which the filter is running, expressed in UTC.
  5667. It can accept an argument: a strftime() format string.
  5668. @item localtime
  5669. The time at which the filter is running, expressed in the local time zone.
  5670. It can accept an argument: a strftime() format string.
  5671. @item metadata
  5672. Frame metadata. Takes one or two arguments.
  5673. The first argument is mandatory and specifies the metadata key.
  5674. The second argument is optional and specifies a default value, used when the
  5675. metadata key is not found or empty.
  5676. @item n, frame_num
  5677. The frame number, starting from 0.
  5678. @item pict_type
  5679. A 1 character description of the current picture type.
  5680. @item pts
  5681. The timestamp of the current frame.
  5682. It can take up to three arguments.
  5683. The first argument is the format of the timestamp; it defaults to @code{flt}
  5684. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5685. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5686. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5687. @code{localtime} stands for the timestamp of the frame formatted as
  5688. local time zone time.
  5689. The second argument is an offset added to the timestamp.
  5690. If the format is set to @code{localtime} or @code{gmtime},
  5691. a third argument may be supplied: a strftime() format string.
  5692. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5693. @end table
  5694. @subsection Examples
  5695. @itemize
  5696. @item
  5697. Draw "Test Text" with font FreeSerif, using the default values for the
  5698. optional parameters.
  5699. @example
  5700. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5701. @end example
  5702. @item
  5703. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5704. and y=50 (counting from the top-left corner of the screen), text is
  5705. yellow with a red box around it. Both the text and the box have an
  5706. opacity of 20%.
  5707. @example
  5708. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5709. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5710. @end example
  5711. Note that the double quotes are not necessary if spaces are not used
  5712. within the parameter list.
  5713. @item
  5714. Show the text at the center of the video frame:
  5715. @example
  5716. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5717. @end example
  5718. @item
  5719. Show the text at a random position, switching to a new position every 30 seconds:
  5720. @example
  5721. 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)"
  5722. @end example
  5723. @item
  5724. Show a text line sliding from right to left in the last row of the video
  5725. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5726. with no newlines.
  5727. @example
  5728. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5729. @end example
  5730. @item
  5731. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5732. @example
  5733. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5734. @end example
  5735. @item
  5736. Draw a single green letter "g", at the center of the input video.
  5737. The glyph baseline is placed at half screen height.
  5738. @example
  5739. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5740. @end example
  5741. @item
  5742. Show text for 1 second every 3 seconds:
  5743. @example
  5744. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5745. @end example
  5746. @item
  5747. Use fontconfig to set the font. Note that the colons need to be escaped.
  5748. @example
  5749. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5750. @end example
  5751. @item
  5752. Print the date of a real-time encoding (see strftime(3)):
  5753. @example
  5754. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5755. @end example
  5756. @item
  5757. Show text fading in and out (appearing/disappearing):
  5758. @example
  5759. #!/bin/sh
  5760. DS=1.0 # display start
  5761. DE=10.0 # display end
  5762. FID=1.5 # fade in duration
  5763. FOD=5 # fade out duration
  5764. 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 @}"
  5765. @end example
  5766. @item
  5767. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5768. and the @option{fontsize} value are included in the @option{y} offset.
  5769. @example
  5770. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5771. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5772. @end example
  5773. @end itemize
  5774. For more information about libfreetype, check:
  5775. @url{http://www.freetype.org/}.
  5776. For more information about fontconfig, check:
  5777. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5778. For more information about libfribidi, check:
  5779. @url{http://fribidi.org/}.
  5780. @section edgedetect
  5781. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5782. The filter accepts the following options:
  5783. @table @option
  5784. @item low
  5785. @item high
  5786. Set low and high threshold values used by the Canny thresholding
  5787. algorithm.
  5788. The high threshold selects the "strong" edge pixels, which are then
  5789. connected through 8-connectivity with the "weak" edge pixels selected
  5790. by the low threshold.
  5791. @var{low} and @var{high} threshold values must be chosen in the range
  5792. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5793. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5794. is @code{50/255}.
  5795. @item mode
  5796. Define the drawing mode.
  5797. @table @samp
  5798. @item wires
  5799. Draw white/gray wires on black background.
  5800. @item colormix
  5801. Mix the colors to create a paint/cartoon effect.
  5802. @end table
  5803. Default value is @var{wires}.
  5804. @end table
  5805. @subsection Examples
  5806. @itemize
  5807. @item
  5808. Standard edge detection with custom values for the hysteresis thresholding:
  5809. @example
  5810. edgedetect=low=0.1:high=0.4
  5811. @end example
  5812. @item
  5813. Painting effect without thresholding:
  5814. @example
  5815. edgedetect=mode=colormix:high=0
  5816. @end example
  5817. @end itemize
  5818. @section eq
  5819. Set brightness, contrast, saturation and approximate gamma adjustment.
  5820. The filter accepts the following options:
  5821. @table @option
  5822. @item contrast
  5823. Set the contrast expression. The value must be a float value in range
  5824. @code{-2.0} to @code{2.0}. The default value is "1".
  5825. @item brightness
  5826. Set the brightness expression. The value must be a float value in
  5827. range @code{-1.0} to @code{1.0}. The default value is "0".
  5828. @item saturation
  5829. Set the saturation expression. The value must be a float in
  5830. range @code{0.0} to @code{3.0}. The default value is "1".
  5831. @item gamma
  5832. Set the gamma expression. The value must be a float in range
  5833. @code{0.1} to @code{10.0}. The default value is "1".
  5834. @item gamma_r
  5835. Set the gamma expression for red. The value must be a float in
  5836. range @code{0.1} to @code{10.0}. The default value is "1".
  5837. @item gamma_g
  5838. Set the gamma expression for green. The value must be a float in range
  5839. @code{0.1} to @code{10.0}. The default value is "1".
  5840. @item gamma_b
  5841. Set the gamma expression for blue. The value must be a float in range
  5842. @code{0.1} to @code{10.0}. The default value is "1".
  5843. @item gamma_weight
  5844. Set the gamma weight expression. It can be used to reduce the effect
  5845. of a high gamma value on bright image areas, e.g. keep them from
  5846. getting overamplified and just plain white. The value must be a float
  5847. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5848. gamma correction all the way down while @code{1.0} leaves it at its
  5849. full strength. Default is "1".
  5850. @item eval
  5851. Set when the expressions for brightness, contrast, saturation and
  5852. gamma expressions are evaluated.
  5853. It accepts the following values:
  5854. @table @samp
  5855. @item init
  5856. only evaluate expressions once during the filter initialization or
  5857. when a command is processed
  5858. @item frame
  5859. evaluate expressions for each incoming frame
  5860. @end table
  5861. Default value is @samp{init}.
  5862. @end table
  5863. The expressions accept the following parameters:
  5864. @table @option
  5865. @item n
  5866. frame count of the input frame starting from 0
  5867. @item pos
  5868. byte position of the corresponding packet in the input file, NAN if
  5869. unspecified
  5870. @item r
  5871. frame rate of the input video, NAN if the input frame rate is unknown
  5872. @item t
  5873. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5874. @end table
  5875. @subsection Commands
  5876. The filter supports the following commands:
  5877. @table @option
  5878. @item contrast
  5879. Set the contrast expression.
  5880. @item brightness
  5881. Set the brightness expression.
  5882. @item saturation
  5883. Set the saturation expression.
  5884. @item gamma
  5885. Set the gamma expression.
  5886. @item gamma_r
  5887. Set the gamma_r expression.
  5888. @item gamma_g
  5889. Set gamma_g expression.
  5890. @item gamma_b
  5891. Set gamma_b expression.
  5892. @item gamma_weight
  5893. Set gamma_weight expression.
  5894. The command accepts the same syntax of the corresponding option.
  5895. If the specified expression is not valid, it is kept at its current
  5896. value.
  5897. @end table
  5898. @section erosion
  5899. Apply erosion effect to the video.
  5900. This filter replaces the pixel by the local(3x3) minimum.
  5901. It accepts the following options:
  5902. @table @option
  5903. @item threshold0
  5904. @item threshold1
  5905. @item threshold2
  5906. @item threshold3
  5907. Limit the maximum change for each plane, default is 65535.
  5908. If 0, plane will remain unchanged.
  5909. @item coordinates
  5910. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5911. pixels are used.
  5912. Flags to local 3x3 coordinates maps like this:
  5913. 1 2 3
  5914. 4 5
  5915. 6 7 8
  5916. @end table
  5917. @section extractplanes
  5918. Extract color channel components from input video stream into
  5919. separate grayscale video streams.
  5920. The filter accepts the following option:
  5921. @table @option
  5922. @item planes
  5923. Set plane(s) to extract.
  5924. Available values for planes are:
  5925. @table @samp
  5926. @item y
  5927. @item u
  5928. @item v
  5929. @item a
  5930. @item r
  5931. @item g
  5932. @item b
  5933. @end table
  5934. Choosing planes not available in the input will result in an error.
  5935. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5936. with @code{y}, @code{u}, @code{v} planes at same time.
  5937. @end table
  5938. @subsection Examples
  5939. @itemize
  5940. @item
  5941. Extract luma, u and v color channel component from input video frame
  5942. into 3 grayscale outputs:
  5943. @example
  5944. 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
  5945. @end example
  5946. @end itemize
  5947. @section elbg
  5948. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5949. For each input image, the filter will compute the optimal mapping from
  5950. the input to the output given the codebook length, that is the number
  5951. of distinct output colors.
  5952. This filter accepts the following options.
  5953. @table @option
  5954. @item codebook_length, l
  5955. Set codebook length. The value must be a positive integer, and
  5956. represents the number of distinct output colors. Default value is 256.
  5957. @item nb_steps, n
  5958. Set the maximum number of iterations to apply for computing the optimal
  5959. mapping. The higher the value the better the result and the higher the
  5960. computation time. Default value is 1.
  5961. @item seed, s
  5962. Set a random seed, must be an integer included between 0 and
  5963. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5964. will try to use a good random seed on a best effort basis.
  5965. @item pal8
  5966. Set pal8 output pixel format. This option does not work with codebook
  5967. length greater than 256.
  5968. @end table
  5969. @section fade
  5970. Apply a fade-in/out effect to the input video.
  5971. It accepts the following parameters:
  5972. @table @option
  5973. @item type, t
  5974. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5975. effect.
  5976. Default is @code{in}.
  5977. @item start_frame, s
  5978. Specify the number of the frame to start applying the fade
  5979. effect at. Default is 0.
  5980. @item nb_frames, n
  5981. The number of frames that the fade effect lasts. At the end of the
  5982. fade-in effect, the output video will have the same intensity as the input video.
  5983. At the end of the fade-out transition, the output video will be filled with the
  5984. selected @option{color}.
  5985. Default is 25.
  5986. @item alpha
  5987. If set to 1, fade only alpha channel, if one exists on the input.
  5988. Default value is 0.
  5989. @item start_time, st
  5990. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5991. effect. If both start_frame and start_time are specified, the fade will start at
  5992. whichever comes last. Default is 0.
  5993. @item duration, d
  5994. The number of seconds for which the fade effect has to last. At the end of the
  5995. fade-in effect the output video will have the same intensity as the input video,
  5996. at the end of the fade-out transition the output video will be filled with the
  5997. selected @option{color}.
  5998. If both duration and nb_frames are specified, duration is used. Default is 0
  5999. (nb_frames is used by default).
  6000. @item color, c
  6001. Specify the color of the fade. Default is "black".
  6002. @end table
  6003. @subsection Examples
  6004. @itemize
  6005. @item
  6006. Fade in the first 30 frames of video:
  6007. @example
  6008. fade=in:0:30
  6009. @end example
  6010. The command above is equivalent to:
  6011. @example
  6012. fade=t=in:s=0:n=30
  6013. @end example
  6014. @item
  6015. Fade out the last 45 frames of a 200-frame video:
  6016. @example
  6017. fade=out:155:45
  6018. fade=type=out:start_frame=155:nb_frames=45
  6019. @end example
  6020. @item
  6021. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6022. @example
  6023. fade=in:0:25, fade=out:975:25
  6024. @end example
  6025. @item
  6026. Make the first 5 frames yellow, then fade in from frame 5-24:
  6027. @example
  6028. fade=in:5:20:color=yellow
  6029. @end example
  6030. @item
  6031. Fade in alpha over first 25 frames of video:
  6032. @example
  6033. fade=in:0:25:alpha=1
  6034. @end example
  6035. @item
  6036. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6037. @example
  6038. fade=t=in:st=5.5:d=0.5
  6039. @end example
  6040. @end itemize
  6041. @section fftfilt
  6042. Apply arbitrary expressions to samples in frequency domain
  6043. @table @option
  6044. @item dc_Y
  6045. Adjust the dc value (gain) of the luma plane of the image. The filter
  6046. accepts an integer value in range @code{0} to @code{1000}. The default
  6047. value is set to @code{0}.
  6048. @item dc_U
  6049. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6050. filter accepts an integer value in range @code{0} to @code{1000}. The
  6051. default value is set to @code{0}.
  6052. @item dc_V
  6053. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6054. filter accepts an integer value in range @code{0} to @code{1000}. The
  6055. default value is set to @code{0}.
  6056. @item weight_Y
  6057. Set the frequency domain weight expression for the luma plane.
  6058. @item weight_U
  6059. Set the frequency domain weight expression for the 1st chroma plane.
  6060. @item weight_V
  6061. Set the frequency domain weight expression for the 2nd chroma plane.
  6062. The filter accepts the following variables:
  6063. @item X
  6064. @item Y
  6065. The coordinates of the current sample.
  6066. @item W
  6067. @item H
  6068. The width and height of the image.
  6069. @end table
  6070. @subsection Examples
  6071. @itemize
  6072. @item
  6073. High-pass:
  6074. @example
  6075. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6076. @end example
  6077. @item
  6078. Low-pass:
  6079. @example
  6080. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6081. @end example
  6082. @item
  6083. Sharpen:
  6084. @example
  6085. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6086. @end example
  6087. @item
  6088. Blur:
  6089. @example
  6090. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6091. @end example
  6092. @end itemize
  6093. @section field
  6094. Extract a single field from an interlaced image using stride
  6095. arithmetic to avoid wasting CPU time. The output frames are marked as
  6096. non-interlaced.
  6097. The filter accepts the following options:
  6098. @table @option
  6099. @item type
  6100. Specify whether to extract the top (if the value is @code{0} or
  6101. @code{top}) or the bottom field (if the value is @code{1} or
  6102. @code{bottom}).
  6103. @end table
  6104. @section fieldhint
  6105. Create new frames by copying the top and bottom fields from surrounding frames
  6106. supplied as numbers by the hint file.
  6107. @table @option
  6108. @item hint
  6109. Set file containing hints: absolute/relative frame numbers.
  6110. There must be one line for each frame in a clip. Each line must contain two
  6111. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6112. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6113. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6114. for @code{relative} mode. First number tells from which frame to pick up top
  6115. field and second number tells from which frame to pick up bottom field.
  6116. If optionally followed by @code{+} output frame will be marked as interlaced,
  6117. else if followed by @code{-} output frame will be marked as progressive, else
  6118. it will be marked same as input frame.
  6119. If line starts with @code{#} or @code{;} that line is skipped.
  6120. @item mode
  6121. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6122. @end table
  6123. Example of first several lines of @code{hint} file for @code{relative} mode:
  6124. @example
  6125. 0,0 - # first frame
  6126. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6127. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6128. 1,0 -
  6129. 0,0 -
  6130. 0,0 -
  6131. 1,0 -
  6132. 1,0 -
  6133. 1,0 -
  6134. 0,0 -
  6135. 0,0 -
  6136. 1,0 -
  6137. 1,0 -
  6138. 1,0 -
  6139. 0,0 -
  6140. @end example
  6141. @section fieldmatch
  6142. Field matching filter for inverse telecine. It is meant to reconstruct the
  6143. progressive frames from a telecined stream. The filter does not drop duplicated
  6144. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6145. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6146. The separation of the field matching and the decimation is notably motivated by
  6147. the possibility of inserting a de-interlacing filter fallback between the two.
  6148. If the source has mixed telecined and real interlaced content,
  6149. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6150. But these remaining combed frames will be marked as interlaced, and thus can be
  6151. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6152. In addition to the various configuration options, @code{fieldmatch} can take an
  6153. optional second stream, activated through the @option{ppsrc} option. If
  6154. enabled, the frames reconstruction will be based on the fields and frames from
  6155. this second stream. This allows the first input to be pre-processed in order to
  6156. help the various algorithms of the filter, while keeping the output lossless
  6157. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6158. or brightness/contrast adjustments can help.
  6159. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6160. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6161. which @code{fieldmatch} is based on. While the semantic and usage are very
  6162. close, some behaviour and options names can differ.
  6163. The @ref{decimate} filter currently only works for constant frame rate input.
  6164. If your input has mixed telecined (30fps) and progressive content with a lower
  6165. framerate like 24fps use the following filterchain to produce the necessary cfr
  6166. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6167. The filter accepts the following options:
  6168. @table @option
  6169. @item order
  6170. Specify the assumed field order of the input stream. Available values are:
  6171. @table @samp
  6172. @item auto
  6173. Auto detect parity (use FFmpeg's internal parity value).
  6174. @item bff
  6175. Assume bottom field first.
  6176. @item tff
  6177. Assume top field first.
  6178. @end table
  6179. Note that it is sometimes recommended not to trust the parity announced by the
  6180. stream.
  6181. Default value is @var{auto}.
  6182. @item mode
  6183. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6184. sense that it won't risk creating jerkiness due to duplicate frames when
  6185. possible, but if there are bad edits or blended fields it will end up
  6186. outputting combed frames when a good match might actually exist. On the other
  6187. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6188. but will almost always find a good frame if there is one. The other values are
  6189. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6190. jerkiness and creating duplicate frames versus finding good matches in sections
  6191. with bad edits, orphaned fields, blended fields, etc.
  6192. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6193. Available values are:
  6194. @table @samp
  6195. @item pc
  6196. 2-way matching (p/c)
  6197. @item pc_n
  6198. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6199. @item pc_u
  6200. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6201. @item pc_n_ub
  6202. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6203. still combed (p/c + n + u/b)
  6204. @item pcn
  6205. 3-way matching (p/c/n)
  6206. @item pcn_ub
  6207. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6208. detected as combed (p/c/n + u/b)
  6209. @end table
  6210. The parenthesis at the end indicate the matches that would be used for that
  6211. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6212. @var{top}).
  6213. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6214. the slowest.
  6215. Default value is @var{pc_n}.
  6216. @item ppsrc
  6217. Mark the main input stream as a pre-processed input, and enable the secondary
  6218. input stream as the clean source to pick the fields from. See the filter
  6219. introduction for more details. It is similar to the @option{clip2} feature from
  6220. VFM/TFM.
  6221. Default value is @code{0} (disabled).
  6222. @item field
  6223. Set the field to match from. It is recommended to set this to the same value as
  6224. @option{order} unless you experience matching failures with that setting. In
  6225. certain circumstances changing the field that is used to match from can have a
  6226. large impact on matching performance. Available values are:
  6227. @table @samp
  6228. @item auto
  6229. Automatic (same value as @option{order}).
  6230. @item bottom
  6231. Match from the bottom field.
  6232. @item top
  6233. Match from the top field.
  6234. @end table
  6235. Default value is @var{auto}.
  6236. @item mchroma
  6237. Set whether or not chroma is included during the match comparisons. In most
  6238. cases it is recommended to leave this enabled. You should set this to @code{0}
  6239. only if your clip has bad chroma problems such as heavy rainbowing or other
  6240. artifacts. Setting this to @code{0} could also be used to speed things up at
  6241. the cost of some accuracy.
  6242. Default value is @code{1}.
  6243. @item y0
  6244. @item y1
  6245. These define an exclusion band which excludes the lines between @option{y0} and
  6246. @option{y1} from being included in the field matching decision. An exclusion
  6247. band can be used to ignore subtitles, a logo, or other things that may
  6248. interfere with the matching. @option{y0} sets the starting scan line and
  6249. @option{y1} sets the ending line; all lines in between @option{y0} and
  6250. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6251. @option{y0} and @option{y1} to the same value will disable the feature.
  6252. @option{y0} and @option{y1} defaults to @code{0}.
  6253. @item scthresh
  6254. Set the scene change detection threshold as a percentage of maximum change on
  6255. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6256. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6257. @option{scthresh} is @code{[0.0, 100.0]}.
  6258. Default value is @code{12.0}.
  6259. @item combmatch
  6260. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6261. account the combed scores of matches when deciding what match to use as the
  6262. final match. Available values are:
  6263. @table @samp
  6264. @item none
  6265. No final matching based on combed scores.
  6266. @item sc
  6267. Combed scores are only used when a scene change is detected.
  6268. @item full
  6269. Use combed scores all the time.
  6270. @end table
  6271. Default is @var{sc}.
  6272. @item combdbg
  6273. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6274. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6275. Available values are:
  6276. @table @samp
  6277. @item none
  6278. No forced calculation.
  6279. @item pcn
  6280. Force p/c/n calculations.
  6281. @item pcnub
  6282. Force p/c/n/u/b calculations.
  6283. @end table
  6284. Default value is @var{none}.
  6285. @item cthresh
  6286. This is the area combing threshold used for combed frame detection. This
  6287. essentially controls how "strong" or "visible" combing must be to be detected.
  6288. Larger values mean combing must be more visible and smaller values mean combing
  6289. can be less visible or strong and still be detected. Valid settings are from
  6290. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6291. be detected as combed). This is basically a pixel difference value. A good
  6292. range is @code{[8, 12]}.
  6293. Default value is @code{9}.
  6294. @item chroma
  6295. Sets whether or not chroma is considered in the combed frame decision. Only
  6296. disable this if your source has chroma problems (rainbowing, etc.) that are
  6297. causing problems for the combed frame detection with chroma enabled. Actually,
  6298. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6299. where there is chroma only combing in the source.
  6300. Default value is @code{0}.
  6301. @item blockx
  6302. @item blocky
  6303. Respectively set the x-axis and y-axis size of the window used during combed
  6304. frame detection. This has to do with the size of the area in which
  6305. @option{combpel} pixels are required to be detected as combed for a frame to be
  6306. declared combed. See the @option{combpel} parameter description for more info.
  6307. Possible values are any number that is a power of 2 starting at 4 and going up
  6308. to 512.
  6309. Default value is @code{16}.
  6310. @item combpel
  6311. The number of combed pixels inside any of the @option{blocky} by
  6312. @option{blockx} size blocks on the frame for the frame to be detected as
  6313. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6314. setting controls "how much" combing there must be in any localized area (a
  6315. window defined by the @option{blockx} and @option{blocky} settings) on the
  6316. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6317. which point no frames will ever be detected as combed). This setting is known
  6318. as @option{MI} in TFM/VFM vocabulary.
  6319. Default value is @code{80}.
  6320. @end table
  6321. @anchor{p/c/n/u/b meaning}
  6322. @subsection p/c/n/u/b meaning
  6323. @subsubsection p/c/n
  6324. We assume the following telecined stream:
  6325. @example
  6326. Top fields: 1 2 2 3 4
  6327. Bottom fields: 1 2 3 4 4
  6328. @end example
  6329. The numbers correspond to the progressive frame the fields relate to. Here, the
  6330. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6331. When @code{fieldmatch} is configured to run a matching from bottom
  6332. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6333. @example
  6334. Input stream:
  6335. T 1 2 2 3 4
  6336. B 1 2 3 4 4 <-- matching reference
  6337. Matches: c c n n c
  6338. Output stream:
  6339. T 1 2 3 4 4
  6340. B 1 2 3 4 4
  6341. @end example
  6342. As a result of the field matching, we can see that some frames get duplicated.
  6343. To perform a complete inverse telecine, you need to rely on a decimation filter
  6344. after this operation. See for instance the @ref{decimate} filter.
  6345. The same operation now matching from top fields (@option{field}=@var{top})
  6346. looks like this:
  6347. @example
  6348. Input stream:
  6349. T 1 2 2 3 4 <-- matching reference
  6350. B 1 2 3 4 4
  6351. Matches: c c p p c
  6352. Output stream:
  6353. T 1 2 2 3 4
  6354. B 1 2 2 3 4
  6355. @end example
  6356. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6357. basically, they refer to the frame and field of the opposite parity:
  6358. @itemize
  6359. @item @var{p} matches the field of the opposite parity in the previous frame
  6360. @item @var{c} matches the field of the opposite parity in the current frame
  6361. @item @var{n} matches the field of the opposite parity in the next frame
  6362. @end itemize
  6363. @subsubsection u/b
  6364. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6365. from the opposite parity flag. In the following examples, we assume that we are
  6366. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6367. 'x' is placed above and below each matched fields.
  6368. With bottom matching (@option{field}=@var{bottom}):
  6369. @example
  6370. Match: c p n b u
  6371. x x x x x
  6372. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6373. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6374. x x x x x
  6375. Output frames:
  6376. 2 1 2 2 2
  6377. 2 2 2 1 3
  6378. @end example
  6379. With top matching (@option{field}=@var{top}):
  6380. @example
  6381. Match: c p n b u
  6382. x x x x x
  6383. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6384. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6385. x x x x x
  6386. Output frames:
  6387. 2 2 2 1 2
  6388. 2 1 3 2 2
  6389. @end example
  6390. @subsection Examples
  6391. Simple IVTC of a top field first telecined stream:
  6392. @example
  6393. fieldmatch=order=tff:combmatch=none, decimate
  6394. @end example
  6395. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6396. @example
  6397. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6398. @end example
  6399. @section fieldorder
  6400. Transform the field order of the input video.
  6401. It accepts the following parameters:
  6402. @table @option
  6403. @item order
  6404. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6405. for bottom field first.
  6406. @end table
  6407. The default value is @samp{tff}.
  6408. The transformation is done by shifting the picture content up or down
  6409. by one line, and filling the remaining line with appropriate picture content.
  6410. This method is consistent with most broadcast field order converters.
  6411. If the input video is not flagged as being interlaced, or it is already
  6412. flagged as being of the required output field order, then this filter does
  6413. not alter the incoming video.
  6414. It is very useful when converting to or from PAL DV material,
  6415. which is bottom field first.
  6416. For example:
  6417. @example
  6418. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6419. @end example
  6420. @section fifo, afifo
  6421. Buffer input images and send them when they are requested.
  6422. It is mainly useful when auto-inserted by the libavfilter
  6423. framework.
  6424. It does not take parameters.
  6425. @section find_rect
  6426. Find a rectangular object
  6427. It accepts the following options:
  6428. @table @option
  6429. @item object
  6430. Filepath of the object image, needs to be in gray8.
  6431. @item threshold
  6432. Detection threshold, default is 0.5.
  6433. @item mipmaps
  6434. Number of mipmaps, default is 3.
  6435. @item xmin, ymin, xmax, ymax
  6436. Specifies the rectangle in which to search.
  6437. @end table
  6438. @subsection Examples
  6439. @itemize
  6440. @item
  6441. Generate a representative palette of a given video using @command{ffmpeg}:
  6442. @example
  6443. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6444. @end example
  6445. @end itemize
  6446. @section cover_rect
  6447. Cover a rectangular object
  6448. It accepts the following options:
  6449. @table @option
  6450. @item cover
  6451. Filepath of the optional cover image, needs to be in yuv420.
  6452. @item mode
  6453. Set covering mode.
  6454. It accepts the following values:
  6455. @table @samp
  6456. @item cover
  6457. cover it by the supplied image
  6458. @item blur
  6459. cover it by interpolating the surrounding pixels
  6460. @end table
  6461. Default value is @var{blur}.
  6462. @end table
  6463. @subsection Examples
  6464. @itemize
  6465. @item
  6466. Generate a representative palette of a given video using @command{ffmpeg}:
  6467. @example
  6468. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6469. @end example
  6470. @end itemize
  6471. @anchor{format}
  6472. @section format
  6473. Convert the input video to one of the specified pixel formats.
  6474. Libavfilter will try to pick one that is suitable as input to
  6475. the next filter.
  6476. It accepts the following parameters:
  6477. @table @option
  6478. @item pix_fmts
  6479. A '|'-separated list of pixel format names, such as
  6480. "pix_fmts=yuv420p|monow|rgb24".
  6481. @end table
  6482. @subsection Examples
  6483. @itemize
  6484. @item
  6485. Convert the input video to the @var{yuv420p} format
  6486. @example
  6487. format=pix_fmts=yuv420p
  6488. @end example
  6489. Convert the input video to any of the formats in the list
  6490. @example
  6491. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6492. @end example
  6493. @end itemize
  6494. @anchor{fps}
  6495. @section fps
  6496. Convert the video to specified constant frame rate by duplicating or dropping
  6497. frames as necessary.
  6498. It accepts the following parameters:
  6499. @table @option
  6500. @item fps
  6501. The desired output frame rate. The default is @code{25}.
  6502. @item round
  6503. Rounding method.
  6504. Possible values are:
  6505. @table @option
  6506. @item zero
  6507. zero round towards 0
  6508. @item inf
  6509. round away from 0
  6510. @item down
  6511. round towards -infinity
  6512. @item up
  6513. round towards +infinity
  6514. @item near
  6515. round to nearest
  6516. @end table
  6517. The default is @code{near}.
  6518. @item start_time
  6519. Assume the first PTS should be the given value, in seconds. This allows for
  6520. padding/trimming at the start of stream. By default, no assumption is made
  6521. about the first frame's expected PTS, so no padding or trimming is done.
  6522. For example, this could be set to 0 to pad the beginning with duplicates of
  6523. the first frame if a video stream starts after the audio stream or to trim any
  6524. frames with a negative PTS.
  6525. @end table
  6526. Alternatively, the options can be specified as a flat string:
  6527. @var{fps}[:@var{round}].
  6528. See also the @ref{setpts} filter.
  6529. @subsection Examples
  6530. @itemize
  6531. @item
  6532. A typical usage in order to set the fps to 25:
  6533. @example
  6534. fps=fps=25
  6535. @end example
  6536. @item
  6537. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6538. @example
  6539. fps=fps=film:round=near
  6540. @end example
  6541. @end itemize
  6542. @section framepack
  6543. Pack two different video streams into a stereoscopic video, setting proper
  6544. metadata on supported codecs. The two views should have the same size and
  6545. framerate and processing will stop when the shorter video ends. Please note
  6546. that you may conveniently adjust view properties with the @ref{scale} and
  6547. @ref{fps} filters.
  6548. It accepts the following parameters:
  6549. @table @option
  6550. @item format
  6551. The desired packing format. Supported values are:
  6552. @table @option
  6553. @item sbs
  6554. The views are next to each other (default).
  6555. @item tab
  6556. The views are on top of each other.
  6557. @item lines
  6558. The views are packed by line.
  6559. @item columns
  6560. The views are packed by column.
  6561. @item frameseq
  6562. The views are temporally interleaved.
  6563. @end table
  6564. @end table
  6565. Some examples:
  6566. @example
  6567. # Convert left and right views into a frame-sequential video
  6568. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6569. # Convert views into a side-by-side video with the same output resolution as the input
  6570. 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
  6571. @end example
  6572. @section framerate
  6573. Change the frame rate by interpolating new video output frames from the source
  6574. frames.
  6575. This filter is not designed to function correctly with interlaced media. If
  6576. you wish to change the frame rate of interlaced media then you are required
  6577. to deinterlace before this filter and re-interlace after this filter.
  6578. A description of the accepted options follows.
  6579. @table @option
  6580. @item fps
  6581. Specify the output frames per second. This option can also be specified
  6582. as a value alone. The default is @code{50}.
  6583. @item interp_start
  6584. Specify the start of a range where the output frame will be created as a
  6585. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6586. the default is @code{15}.
  6587. @item interp_end
  6588. Specify the end of a range where the output frame will be created as a
  6589. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6590. the default is @code{240}.
  6591. @item scene
  6592. Specify the level at which a scene change is detected as a value between
  6593. 0 and 100 to indicate a new scene; a low value reflects a low
  6594. probability for the current frame to introduce a new scene, while a higher
  6595. value means the current frame is more likely to be one.
  6596. The default is @code{7}.
  6597. @item flags
  6598. Specify flags influencing the filter process.
  6599. Available value for @var{flags} is:
  6600. @table @option
  6601. @item scene_change_detect, scd
  6602. Enable scene change detection using the value of the option @var{scene}.
  6603. This flag is enabled by default.
  6604. @end table
  6605. @end table
  6606. @section framestep
  6607. Select one frame every N-th frame.
  6608. This filter accepts the following option:
  6609. @table @option
  6610. @item step
  6611. Select frame after every @code{step} frames.
  6612. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6613. @end table
  6614. @anchor{frei0r}
  6615. @section frei0r
  6616. Apply a frei0r effect to the input video.
  6617. To enable the compilation of this filter, you need to install the frei0r
  6618. header and configure FFmpeg with @code{--enable-frei0r}.
  6619. It accepts the following parameters:
  6620. @table @option
  6621. @item filter_name
  6622. The name of the frei0r effect to load. If the environment variable
  6623. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6624. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6625. Otherwise, the standard frei0r paths are searched, in this order:
  6626. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6627. @file{/usr/lib/frei0r-1/}.
  6628. @item filter_params
  6629. A '|'-separated list of parameters to pass to the frei0r effect.
  6630. @end table
  6631. A frei0r effect parameter can be a boolean (its value is either
  6632. "y" or "n"), a double, a color (specified as
  6633. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6634. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6635. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6636. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6637. The number and types of parameters depend on the loaded effect. If an
  6638. effect parameter is not specified, the default value is set.
  6639. @subsection Examples
  6640. @itemize
  6641. @item
  6642. Apply the distort0r effect, setting the first two double parameters:
  6643. @example
  6644. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6645. @end example
  6646. @item
  6647. Apply the colordistance effect, taking a color as the first parameter:
  6648. @example
  6649. frei0r=colordistance:0.2/0.3/0.4
  6650. frei0r=colordistance:violet
  6651. frei0r=colordistance:0x112233
  6652. @end example
  6653. @item
  6654. Apply the perspective effect, specifying the top left and top right image
  6655. positions:
  6656. @example
  6657. frei0r=perspective:0.2/0.2|0.8/0.2
  6658. @end example
  6659. @end itemize
  6660. For more information, see
  6661. @url{http://frei0r.dyne.org}
  6662. @section fspp
  6663. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6664. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6665. processing filter, one of them is performed once per block, not per pixel.
  6666. This allows for much higher speed.
  6667. The filter accepts the following options:
  6668. @table @option
  6669. @item quality
  6670. Set quality. This option defines the number of levels for averaging. It accepts
  6671. an integer in the range 4-5. Default value is @code{4}.
  6672. @item qp
  6673. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6674. If not set, the filter will use the QP from the video stream (if available).
  6675. @item strength
  6676. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6677. more details but also more artifacts, while higher values make the image smoother
  6678. but also blurrier. Default value is @code{0} − PSNR optimal.
  6679. @item use_bframe_qp
  6680. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6681. option may cause flicker since the B-Frames have often larger QP. Default is
  6682. @code{0} (not enabled).
  6683. @end table
  6684. @section gblur
  6685. Apply Gaussian blur filter.
  6686. The filter accepts the following options:
  6687. @table @option
  6688. @item sigma
  6689. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6690. @item steps
  6691. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6692. @item planes
  6693. Set which planes to filter. By default all planes are filtered.
  6694. @item sigmaV
  6695. Set vertical sigma, if negative it will be same as @code{sigma}.
  6696. Default is @code{-1}.
  6697. @end table
  6698. @section geq
  6699. The filter accepts the following options:
  6700. @table @option
  6701. @item lum_expr, lum
  6702. Set the luminance expression.
  6703. @item cb_expr, cb
  6704. Set the chrominance blue expression.
  6705. @item cr_expr, cr
  6706. Set the chrominance red expression.
  6707. @item alpha_expr, a
  6708. Set the alpha expression.
  6709. @item red_expr, r
  6710. Set the red expression.
  6711. @item green_expr, g
  6712. Set the green expression.
  6713. @item blue_expr, b
  6714. Set the blue expression.
  6715. @end table
  6716. The colorspace is selected according to the specified options. If one
  6717. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6718. options is specified, the filter will automatically select a YCbCr
  6719. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6720. @option{blue_expr} options is specified, it will select an RGB
  6721. colorspace.
  6722. If one of the chrominance expression is not defined, it falls back on the other
  6723. one. If no alpha expression is specified it will evaluate to opaque value.
  6724. If none of chrominance expressions are specified, they will evaluate
  6725. to the luminance expression.
  6726. The expressions can use the following variables and functions:
  6727. @table @option
  6728. @item N
  6729. The sequential number of the filtered frame, starting from @code{0}.
  6730. @item X
  6731. @item Y
  6732. The coordinates of the current sample.
  6733. @item W
  6734. @item H
  6735. The width and height of the image.
  6736. @item SW
  6737. @item SH
  6738. Width and height scale depending on the currently filtered plane. It is the
  6739. ratio between the corresponding luma plane number of pixels and the current
  6740. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6741. @code{0.5,0.5} for chroma planes.
  6742. @item T
  6743. Time of the current frame, expressed in seconds.
  6744. @item p(x, y)
  6745. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6746. plane.
  6747. @item lum(x, y)
  6748. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6749. plane.
  6750. @item cb(x, y)
  6751. Return the value of the pixel at location (@var{x},@var{y}) of the
  6752. blue-difference chroma plane. Return 0 if there is no such plane.
  6753. @item cr(x, y)
  6754. Return the value of the pixel at location (@var{x},@var{y}) of the
  6755. red-difference chroma plane. Return 0 if there is no such plane.
  6756. @item r(x, y)
  6757. @item g(x, y)
  6758. @item b(x, y)
  6759. Return the value of the pixel at location (@var{x},@var{y}) of the
  6760. red/green/blue component. Return 0 if there is no such component.
  6761. @item alpha(x, y)
  6762. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6763. plane. Return 0 if there is no such plane.
  6764. @end table
  6765. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6766. automatically clipped to the closer edge.
  6767. @subsection Examples
  6768. @itemize
  6769. @item
  6770. Flip the image horizontally:
  6771. @example
  6772. geq=p(W-X\,Y)
  6773. @end example
  6774. @item
  6775. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6776. wavelength of 100 pixels:
  6777. @example
  6778. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6779. @end example
  6780. @item
  6781. Generate a fancy enigmatic moving light:
  6782. @example
  6783. 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
  6784. @end example
  6785. @item
  6786. Generate a quick emboss effect:
  6787. @example
  6788. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6789. @end example
  6790. @item
  6791. Modify RGB components depending on pixel position:
  6792. @example
  6793. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6794. @end example
  6795. @item
  6796. Create a radial gradient that is the same size as the input (also see
  6797. the @ref{vignette} filter):
  6798. @example
  6799. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6800. @end example
  6801. @end itemize
  6802. @section gradfun
  6803. Fix the banding artifacts that are sometimes introduced into nearly flat
  6804. regions by truncation to 8-bit color depth.
  6805. Interpolate the gradients that should go where the bands are, and
  6806. dither them.
  6807. It is designed for playback only. Do not use it prior to
  6808. lossy compression, because compression tends to lose the dither and
  6809. bring back the bands.
  6810. It accepts the following parameters:
  6811. @table @option
  6812. @item strength
  6813. The maximum amount by which the filter will change any one pixel. This is also
  6814. the threshold for detecting nearly flat regions. Acceptable values range from
  6815. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6816. valid range.
  6817. @item radius
  6818. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6819. gradients, but also prevents the filter from modifying the pixels near detailed
  6820. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6821. values will be clipped to the valid range.
  6822. @end table
  6823. Alternatively, the options can be specified as a flat string:
  6824. @var{strength}[:@var{radius}]
  6825. @subsection Examples
  6826. @itemize
  6827. @item
  6828. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6829. @example
  6830. gradfun=3.5:8
  6831. @end example
  6832. @item
  6833. Specify radius, omitting the strength (which will fall-back to the default
  6834. value):
  6835. @example
  6836. gradfun=radius=8
  6837. @end example
  6838. @end itemize
  6839. @anchor{haldclut}
  6840. @section haldclut
  6841. Apply a Hald CLUT to a video stream.
  6842. First input is the video stream to process, and second one is the Hald CLUT.
  6843. The Hald CLUT input can be a simple picture or a complete video stream.
  6844. The filter accepts the following options:
  6845. @table @option
  6846. @item shortest
  6847. Force termination when the shortest input terminates. Default is @code{0}.
  6848. @item repeatlast
  6849. Continue applying the last CLUT after the end of the stream. A value of
  6850. @code{0} disable the filter after the last frame of the CLUT is reached.
  6851. Default is @code{1}.
  6852. @end table
  6853. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6854. filters share the same internals).
  6855. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6856. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6857. @subsection Workflow examples
  6858. @subsubsection Hald CLUT video stream
  6859. Generate an identity Hald CLUT stream altered with various effects:
  6860. @example
  6861. 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
  6862. @end example
  6863. Note: make sure you use a lossless codec.
  6864. Then use it with @code{haldclut} to apply it on some random stream:
  6865. @example
  6866. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6867. @end example
  6868. The Hald CLUT will be applied to the 10 first seconds (duration of
  6869. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6870. to the remaining frames of the @code{mandelbrot} stream.
  6871. @subsubsection Hald CLUT with preview
  6872. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6873. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6874. biggest possible square starting at the top left of the picture. The remaining
  6875. padding pixels (bottom or right) will be ignored. This area can be used to add
  6876. a preview of the Hald CLUT.
  6877. Typically, the following generated Hald CLUT will be supported by the
  6878. @code{haldclut} filter:
  6879. @example
  6880. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6881. pad=iw+320 [padded_clut];
  6882. smptebars=s=320x256, split [a][b];
  6883. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6884. [main][b] overlay=W-320" -frames:v 1 clut.png
  6885. @end example
  6886. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6887. bars are displayed on the right-top, and below the same color bars processed by
  6888. the color changes.
  6889. Then, the effect of this Hald CLUT can be visualized with:
  6890. @example
  6891. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6892. @end example
  6893. @section hflip
  6894. Flip the input video horizontally.
  6895. For example, to horizontally flip the input video with @command{ffmpeg}:
  6896. @example
  6897. ffmpeg -i in.avi -vf "hflip" out.avi
  6898. @end example
  6899. @section histeq
  6900. This filter applies a global color histogram equalization on a
  6901. per-frame basis.
  6902. It can be used to correct video that has a compressed range of pixel
  6903. intensities. The filter redistributes the pixel intensities to
  6904. equalize their distribution across the intensity range. It may be
  6905. viewed as an "automatically adjusting contrast filter". This filter is
  6906. useful only for correcting degraded or poorly captured source
  6907. video.
  6908. The filter accepts the following options:
  6909. @table @option
  6910. @item strength
  6911. Determine the amount of equalization to be applied. As the strength
  6912. is reduced, the distribution of pixel intensities more-and-more
  6913. approaches that of the input frame. The value must be a float number
  6914. in the range [0,1] and defaults to 0.200.
  6915. @item intensity
  6916. Set the maximum intensity that can generated and scale the output
  6917. values appropriately. The strength should be set as desired and then
  6918. the intensity can be limited if needed to avoid washing-out. The value
  6919. must be a float number in the range [0,1] and defaults to 0.210.
  6920. @item antibanding
  6921. Set the antibanding level. If enabled the filter will randomly vary
  6922. the luminance of output pixels by a small amount to avoid banding of
  6923. the histogram. Possible values are @code{none}, @code{weak} or
  6924. @code{strong}. It defaults to @code{none}.
  6925. @end table
  6926. @section histogram
  6927. Compute and draw a color distribution histogram for the input video.
  6928. The computed histogram is a representation of the color component
  6929. distribution in an image.
  6930. Standard histogram displays the color components distribution in an image.
  6931. Displays color graph for each color component. Shows distribution of
  6932. the Y, U, V, A or R, G, B components, depending on input format, in the
  6933. current frame. Below each graph a color component scale meter is shown.
  6934. The filter accepts the following options:
  6935. @table @option
  6936. @item level_height
  6937. Set height of level. Default value is @code{200}.
  6938. Allowed range is [50, 2048].
  6939. @item scale_height
  6940. Set height of color scale. Default value is @code{12}.
  6941. Allowed range is [0, 40].
  6942. @item display_mode
  6943. Set display mode.
  6944. It accepts the following values:
  6945. @table @samp
  6946. @item stack
  6947. Per color component graphs are placed below each other.
  6948. @item parade
  6949. Per color component graphs are placed side by side.
  6950. @item overlay
  6951. Presents information identical to that in the @code{parade}, except
  6952. that the graphs representing color components are superimposed directly
  6953. over one another.
  6954. @end table
  6955. Default is @code{stack}.
  6956. @item levels_mode
  6957. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6958. Default is @code{linear}.
  6959. @item components
  6960. Set what color components to display.
  6961. Default is @code{7}.
  6962. @item fgopacity
  6963. Set foreground opacity. Default is @code{0.7}.
  6964. @item bgopacity
  6965. Set background opacity. Default is @code{0.5}.
  6966. @end table
  6967. @subsection Examples
  6968. @itemize
  6969. @item
  6970. Calculate and draw histogram:
  6971. @example
  6972. ffplay -i input -vf histogram
  6973. @end example
  6974. @end itemize
  6975. @anchor{hqdn3d}
  6976. @section hqdn3d
  6977. This is a high precision/quality 3d denoise filter. It aims to reduce
  6978. image noise, producing smooth images and making still images really
  6979. still. It should enhance compressibility.
  6980. It accepts the following optional parameters:
  6981. @table @option
  6982. @item luma_spatial
  6983. A non-negative floating point number which specifies spatial luma strength.
  6984. It defaults to 4.0.
  6985. @item chroma_spatial
  6986. A non-negative floating point number which specifies spatial chroma strength.
  6987. It defaults to 3.0*@var{luma_spatial}/4.0.
  6988. @item luma_tmp
  6989. A floating point number which specifies luma temporal strength. It defaults to
  6990. 6.0*@var{luma_spatial}/4.0.
  6991. @item chroma_tmp
  6992. A floating point number which specifies chroma temporal strength. It defaults to
  6993. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6994. @end table
  6995. @section hwdownload
  6996. Download hardware frames to system memory.
  6997. The input must be in hardware frames, and the output a non-hardware format.
  6998. Not all formats will be supported on the output - it may be necessary to insert
  6999. an additional @option{format} filter immediately following in the graph to get
  7000. the output in a supported format.
  7001. @section hwmap
  7002. Map hardware frames to system memory or to another device.
  7003. This filter has several different modes of operation; which one is used depends
  7004. on the input and output formats:
  7005. @itemize
  7006. @item
  7007. Hardware frame input, normal frame output
  7008. Map the input frames to system memory and pass them to the output. If the
  7009. original hardware frame is later required (for example, after overlaying
  7010. something else on part of it), the @option{hwmap} filter can be used again
  7011. in the next mode to retrieve it.
  7012. @item
  7013. Normal frame input, hardware frame output
  7014. If the input is actually a software-mapped hardware frame, then unmap it -
  7015. that is, return the original hardware frame.
  7016. Otherwise, a device must be provided. Create new hardware surfaces on that
  7017. device for the output, then map them back to the software format at the input
  7018. and give those frames to the preceding filter. This will then act like the
  7019. @option{hwupload} filter, but may be able to avoid an additional copy when
  7020. the input is already in a compatible format.
  7021. @item
  7022. Hardware frame input and output
  7023. A device must be supplied for the output, either directly or with the
  7024. @option{derive_device} option. The input and output devices must be of
  7025. different types and compatible - the exact meaning of this is
  7026. system-dependent, but typically it means that they must refer to the same
  7027. underlying hardware context (for example, refer to the same graphics card).
  7028. If the input frames were originally created on the output device, then unmap
  7029. to retrieve the original frames.
  7030. Otherwise, map the frames to the output device - create new hardware frames
  7031. on the output corresponding to the frames on the input.
  7032. @end itemize
  7033. The following additional parameters are accepted:
  7034. @table @option
  7035. @item mode
  7036. Set the frame mapping mode. Some combination of:
  7037. @table @var
  7038. @item read
  7039. The mapped frame should be readable.
  7040. @item write
  7041. The mapped frame should be writeable.
  7042. @item overwrite
  7043. The mapping will always overwrite the entire frame.
  7044. This may improve performance in some cases, as the original contents of the
  7045. frame need not be loaded.
  7046. @item direct
  7047. The mapping must not involve any copying.
  7048. Indirect mappings to copies of frames are created in some cases where either
  7049. direct mapping is not possible or it would have unexpected properties.
  7050. Setting this flag ensures that the mapping is direct and will fail if that is
  7051. not possible.
  7052. @end table
  7053. Defaults to @var{read+write} if not specified.
  7054. @item derive_device @var{type}
  7055. Rather than using the device supplied at initialisation, instead derive a new
  7056. device of type @var{type} from the device the input frames exist on.
  7057. @item reverse
  7058. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7059. and map them back to the source. This may be necessary in some cases where
  7060. a mapping in one direction is required but only the opposite direction is
  7061. supported by the devices being used.
  7062. This option is dangerous - it may break the preceding filter in undefined
  7063. ways if there are any additional constraints on that filter's output.
  7064. Do not use it without fully understanding the implications of its use.
  7065. @end table
  7066. @section hwupload
  7067. Upload system memory frames to hardware surfaces.
  7068. The device to upload to must be supplied when the filter is initialised. If
  7069. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7070. option.
  7071. @anchor{hwupload_cuda}
  7072. @section hwupload_cuda
  7073. Upload system memory frames to a CUDA device.
  7074. It accepts the following optional parameters:
  7075. @table @option
  7076. @item device
  7077. The number of the CUDA device to use
  7078. @end table
  7079. @section hqx
  7080. Apply a high-quality magnification filter designed for pixel art. This filter
  7081. was originally created by Maxim Stepin.
  7082. It accepts the following option:
  7083. @table @option
  7084. @item n
  7085. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7086. @code{hq3x} and @code{4} for @code{hq4x}.
  7087. Default is @code{3}.
  7088. @end table
  7089. @section hstack
  7090. Stack input videos horizontally.
  7091. All streams must be of same pixel format and of same height.
  7092. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7093. to create same output.
  7094. The filter accept the following option:
  7095. @table @option
  7096. @item inputs
  7097. Set number of input streams. Default is 2.
  7098. @item shortest
  7099. If set to 1, force the output to terminate when the shortest input
  7100. terminates. Default value is 0.
  7101. @end table
  7102. @section hue
  7103. Modify the hue and/or the saturation of the input.
  7104. It accepts the following parameters:
  7105. @table @option
  7106. @item h
  7107. Specify the hue angle as a number of degrees. It accepts an expression,
  7108. and defaults to "0".
  7109. @item s
  7110. Specify the saturation in the [-10,10] range. It accepts an expression and
  7111. defaults to "1".
  7112. @item H
  7113. Specify the hue angle as a number of radians. It accepts an
  7114. expression, and defaults to "0".
  7115. @item b
  7116. Specify the brightness in the [-10,10] range. It accepts an expression and
  7117. defaults to "0".
  7118. @end table
  7119. @option{h} and @option{H} are mutually exclusive, and can't be
  7120. specified at the same time.
  7121. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7122. expressions containing the following constants:
  7123. @table @option
  7124. @item n
  7125. frame count of the input frame starting from 0
  7126. @item pts
  7127. presentation timestamp of the input frame expressed in time base units
  7128. @item r
  7129. frame rate of the input video, NAN if the input frame rate is unknown
  7130. @item t
  7131. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7132. @item tb
  7133. time base of the input video
  7134. @end table
  7135. @subsection Examples
  7136. @itemize
  7137. @item
  7138. Set the hue to 90 degrees and the saturation to 1.0:
  7139. @example
  7140. hue=h=90:s=1
  7141. @end example
  7142. @item
  7143. Same command but expressing the hue in radians:
  7144. @example
  7145. hue=H=PI/2:s=1
  7146. @end example
  7147. @item
  7148. Rotate hue and make the saturation swing between 0
  7149. and 2 over a period of 1 second:
  7150. @example
  7151. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7152. @end example
  7153. @item
  7154. Apply a 3 seconds saturation fade-in effect starting at 0:
  7155. @example
  7156. hue="s=min(t/3\,1)"
  7157. @end example
  7158. The general fade-in expression can be written as:
  7159. @example
  7160. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7161. @end example
  7162. @item
  7163. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7164. @example
  7165. hue="s=max(0\, min(1\, (8-t)/3))"
  7166. @end example
  7167. The general fade-out expression can be written as:
  7168. @example
  7169. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7170. @end example
  7171. @end itemize
  7172. @subsection Commands
  7173. This filter supports the following commands:
  7174. @table @option
  7175. @item b
  7176. @item s
  7177. @item h
  7178. @item H
  7179. Modify the hue and/or the saturation and/or brightness of the input video.
  7180. The command accepts the same syntax of the corresponding option.
  7181. If the specified expression is not valid, it is kept at its current
  7182. value.
  7183. @end table
  7184. @section hysteresis
  7185. Grow first stream into second stream by connecting components.
  7186. This makes it possible to build more robust edge masks.
  7187. This filter accepts the following options:
  7188. @table @option
  7189. @item planes
  7190. Set which planes will be processed as bitmap, unprocessed planes will be
  7191. copied from first stream.
  7192. By default value 0xf, all planes will be processed.
  7193. @item threshold
  7194. Set threshold which is used in filtering. If pixel component value is higher than
  7195. this value filter algorithm for connecting components is activated.
  7196. By default value is 0.
  7197. @end table
  7198. @section idet
  7199. Detect video interlacing type.
  7200. This filter tries to detect if the input frames are interlaced, progressive,
  7201. top or bottom field first. It will also try to detect fields that are
  7202. repeated between adjacent frames (a sign of telecine).
  7203. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7204. Multiple frame detection incorporates the classification history of previous frames.
  7205. The filter will log these metadata values:
  7206. @table @option
  7207. @item single.current_frame
  7208. Detected type of current frame using single-frame detection. One of:
  7209. ``tff'' (top field first), ``bff'' (bottom field first),
  7210. ``progressive'', or ``undetermined''
  7211. @item single.tff
  7212. Cumulative number of frames detected as top field first using single-frame detection.
  7213. @item multiple.tff
  7214. Cumulative number of frames detected as top field first using multiple-frame detection.
  7215. @item single.bff
  7216. Cumulative number of frames detected as bottom field first using single-frame detection.
  7217. @item multiple.current_frame
  7218. Detected type of current frame using multiple-frame detection. One of:
  7219. ``tff'' (top field first), ``bff'' (bottom field first),
  7220. ``progressive'', or ``undetermined''
  7221. @item multiple.bff
  7222. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7223. @item single.progressive
  7224. Cumulative number of frames detected as progressive using single-frame detection.
  7225. @item multiple.progressive
  7226. Cumulative number of frames detected as progressive using multiple-frame detection.
  7227. @item single.undetermined
  7228. Cumulative number of frames that could not be classified using single-frame detection.
  7229. @item multiple.undetermined
  7230. Cumulative number of frames that could not be classified using multiple-frame detection.
  7231. @item repeated.current_frame
  7232. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7233. @item repeated.neither
  7234. Cumulative number of frames with no repeated field.
  7235. @item repeated.top
  7236. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7237. @item repeated.bottom
  7238. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7239. @end table
  7240. The filter accepts the following options:
  7241. @table @option
  7242. @item intl_thres
  7243. Set interlacing threshold.
  7244. @item prog_thres
  7245. Set progressive threshold.
  7246. @item rep_thres
  7247. Threshold for repeated field detection.
  7248. @item half_life
  7249. Number of frames after which a given frame's contribution to the
  7250. statistics is halved (i.e., it contributes only 0.5 to its
  7251. classification). The default of 0 means that all frames seen are given
  7252. full weight of 1.0 forever.
  7253. @item analyze_interlaced_flag
  7254. When this is not 0 then idet will use the specified number of frames to determine
  7255. if the interlaced flag is accurate, it will not count undetermined frames.
  7256. If the flag is found to be accurate it will be used without any further
  7257. computations, if it is found to be inaccurate it will be cleared without any
  7258. further computations. This allows inserting the idet filter as a low computational
  7259. method to clean up the interlaced flag
  7260. @end table
  7261. @section il
  7262. Deinterleave or interleave fields.
  7263. This filter allows one to process interlaced images fields without
  7264. deinterlacing them. Deinterleaving splits the input frame into 2
  7265. fields (so called half pictures). Odd lines are moved to the top
  7266. half of the output image, even lines to the bottom half.
  7267. You can process (filter) them independently and then re-interleave them.
  7268. The filter accepts the following options:
  7269. @table @option
  7270. @item luma_mode, l
  7271. @item chroma_mode, c
  7272. @item alpha_mode, a
  7273. Available values for @var{luma_mode}, @var{chroma_mode} and
  7274. @var{alpha_mode} are:
  7275. @table @samp
  7276. @item none
  7277. Do nothing.
  7278. @item deinterleave, d
  7279. Deinterleave fields, placing one above the other.
  7280. @item interleave, i
  7281. Interleave fields. Reverse the effect of deinterleaving.
  7282. @end table
  7283. Default value is @code{none}.
  7284. @item luma_swap, ls
  7285. @item chroma_swap, cs
  7286. @item alpha_swap, as
  7287. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7288. @end table
  7289. @section inflate
  7290. Apply inflate effect to the video.
  7291. This filter replaces the pixel by the local(3x3) average by taking into account
  7292. only values higher than the pixel.
  7293. It accepts the following options:
  7294. @table @option
  7295. @item threshold0
  7296. @item threshold1
  7297. @item threshold2
  7298. @item threshold3
  7299. Limit the maximum change for each plane, default is 65535.
  7300. If 0, plane will remain unchanged.
  7301. @end table
  7302. @section interlace
  7303. Simple interlacing filter from progressive contents. This interleaves upper (or
  7304. lower) lines from odd frames with lower (or upper) lines from even frames,
  7305. halving the frame rate and preserving image height.
  7306. @example
  7307. Original Original New Frame
  7308. Frame 'j' Frame 'j+1' (tff)
  7309. ========== =========== ==================
  7310. Line 0 --------------------> Frame 'j' Line 0
  7311. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7312. Line 2 ---------------------> Frame 'j' Line 2
  7313. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7314. ... ... ...
  7315. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7316. @end example
  7317. It accepts the following optional parameters:
  7318. @table @option
  7319. @item scan
  7320. This determines whether the interlaced frame is taken from the even
  7321. (tff - default) or odd (bff) lines of the progressive frame.
  7322. @item lowpass
  7323. Vertical lowpass filter to avoid twitter interlacing and
  7324. reduce moire patterns.
  7325. @table @samp
  7326. @item 0, off
  7327. Disable vertical lowpass filter
  7328. @item 1, linear
  7329. Enable linear filter (default)
  7330. @item 2, complex
  7331. Enable complex filter. This will slightly less reduce twitter and moire
  7332. but better retain detail and subjective sharpness impression.
  7333. @end table
  7334. @end table
  7335. @section kerndeint
  7336. Deinterlace input video by applying Donald Graft's adaptive kernel
  7337. deinterling. Work on interlaced parts of a video to produce
  7338. progressive frames.
  7339. The description of the accepted parameters follows.
  7340. @table @option
  7341. @item thresh
  7342. Set the threshold which affects the filter's tolerance when
  7343. determining if a pixel line must be processed. It must be an integer
  7344. in the range [0,255] and defaults to 10. A value of 0 will result in
  7345. applying the process on every pixels.
  7346. @item map
  7347. Paint pixels exceeding the threshold value to white if set to 1.
  7348. Default is 0.
  7349. @item order
  7350. Set the fields order. Swap fields if set to 1, leave fields alone if
  7351. 0. Default is 0.
  7352. @item sharp
  7353. Enable additional sharpening if set to 1. Default is 0.
  7354. @item twoway
  7355. Enable twoway sharpening if set to 1. Default is 0.
  7356. @end table
  7357. @subsection Examples
  7358. @itemize
  7359. @item
  7360. Apply default values:
  7361. @example
  7362. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7363. @end example
  7364. @item
  7365. Enable additional sharpening:
  7366. @example
  7367. kerndeint=sharp=1
  7368. @end example
  7369. @item
  7370. Paint processed pixels in white:
  7371. @example
  7372. kerndeint=map=1
  7373. @end example
  7374. @end itemize
  7375. @section lenscorrection
  7376. Correct radial lens distortion
  7377. This filter can be used to correct for radial distortion as can result from the use
  7378. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7379. one can use tools available for example as part of opencv or simply trial-and-error.
  7380. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7381. and extract the k1 and k2 coefficients from the resulting matrix.
  7382. Note that effectively the same filter is available in the open-source tools Krita and
  7383. Digikam from the KDE project.
  7384. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7385. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7386. brightness distribution, so you may want to use both filters together in certain
  7387. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7388. be applied before or after lens correction.
  7389. @subsection Options
  7390. The filter accepts the following options:
  7391. @table @option
  7392. @item cx
  7393. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7394. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7395. width.
  7396. @item cy
  7397. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7398. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7399. height.
  7400. @item k1
  7401. Coefficient of the quadratic correction term. 0.5 means no correction.
  7402. @item k2
  7403. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7404. @end table
  7405. The formula that generates the correction is:
  7406. @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)
  7407. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7408. distances from the focal point in the source and target images, respectively.
  7409. @section loop
  7410. Loop video frames.
  7411. The filter accepts the following options:
  7412. @table @option
  7413. @item loop
  7414. Set the number of loops.
  7415. @item size
  7416. Set maximal size in number of frames.
  7417. @item start
  7418. Set first frame of loop.
  7419. @end table
  7420. @anchor{lut3d}
  7421. @section lut3d
  7422. Apply a 3D LUT to an input video.
  7423. The filter accepts the following options:
  7424. @table @option
  7425. @item file
  7426. Set the 3D LUT file name.
  7427. Currently supported formats:
  7428. @table @samp
  7429. @item 3dl
  7430. AfterEffects
  7431. @item cube
  7432. Iridas
  7433. @item dat
  7434. DaVinci
  7435. @item m3d
  7436. Pandora
  7437. @end table
  7438. @item interp
  7439. Select interpolation mode.
  7440. Available values are:
  7441. @table @samp
  7442. @item nearest
  7443. Use values from the nearest defined point.
  7444. @item trilinear
  7445. Interpolate values using the 8 points defining a cube.
  7446. @item tetrahedral
  7447. Interpolate values using a tetrahedron.
  7448. @end table
  7449. @end table
  7450. @section lumakey
  7451. Turn certain luma values into transparency.
  7452. The filter accepts the following options:
  7453. @table @option
  7454. @item threshold
  7455. Set the luma which will be used as base for transparency.
  7456. Default value is @code{0}.
  7457. @item tolerance
  7458. Set the range of luma values to be keyed out.
  7459. Default value is @code{0}.
  7460. @item softness
  7461. Set the range of softness. Default value is @code{0}.
  7462. Use this to control gradual transition from zero to full transparency.
  7463. @end table
  7464. @section lut, lutrgb, lutyuv
  7465. Compute a look-up table for binding each pixel component input value
  7466. to an output value, and apply it to the input video.
  7467. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7468. to an RGB input video.
  7469. These filters accept the following parameters:
  7470. @table @option
  7471. @item c0
  7472. set first pixel component expression
  7473. @item c1
  7474. set second pixel component expression
  7475. @item c2
  7476. set third pixel component expression
  7477. @item c3
  7478. set fourth pixel component expression, corresponds to the alpha component
  7479. @item r
  7480. set red component expression
  7481. @item g
  7482. set green component expression
  7483. @item b
  7484. set blue component expression
  7485. @item a
  7486. alpha component expression
  7487. @item y
  7488. set Y/luminance component expression
  7489. @item u
  7490. set U/Cb component expression
  7491. @item v
  7492. set V/Cr component expression
  7493. @end table
  7494. Each of them specifies the expression to use for computing the lookup table for
  7495. the corresponding pixel component values.
  7496. The exact component associated to each of the @var{c*} options depends on the
  7497. format in input.
  7498. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7499. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7500. The expressions can contain the following constants and functions:
  7501. @table @option
  7502. @item w
  7503. @item h
  7504. The input width and height.
  7505. @item val
  7506. The input value for the pixel component.
  7507. @item clipval
  7508. The input value, clipped to the @var{minval}-@var{maxval} range.
  7509. @item maxval
  7510. The maximum value for the pixel component.
  7511. @item minval
  7512. The minimum value for the pixel component.
  7513. @item negval
  7514. The negated value for the pixel component value, clipped to the
  7515. @var{minval}-@var{maxval} range; it corresponds to the expression
  7516. "maxval-clipval+minval".
  7517. @item clip(val)
  7518. The computed value in @var{val}, clipped to the
  7519. @var{minval}-@var{maxval} range.
  7520. @item gammaval(gamma)
  7521. The computed gamma correction value of the pixel component value,
  7522. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7523. expression
  7524. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7525. @end table
  7526. All expressions default to "val".
  7527. @subsection Examples
  7528. @itemize
  7529. @item
  7530. Negate input video:
  7531. @example
  7532. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7533. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7534. @end example
  7535. The above is the same as:
  7536. @example
  7537. lutrgb="r=negval:g=negval:b=negval"
  7538. lutyuv="y=negval:u=negval:v=negval"
  7539. @end example
  7540. @item
  7541. Negate luminance:
  7542. @example
  7543. lutyuv=y=negval
  7544. @end example
  7545. @item
  7546. Remove chroma components, turning the video into a graytone image:
  7547. @example
  7548. lutyuv="u=128:v=128"
  7549. @end example
  7550. @item
  7551. Apply a luma burning effect:
  7552. @example
  7553. lutyuv="y=2*val"
  7554. @end example
  7555. @item
  7556. Remove green and blue components:
  7557. @example
  7558. lutrgb="g=0:b=0"
  7559. @end example
  7560. @item
  7561. Set a constant alpha channel value on input:
  7562. @example
  7563. format=rgba,lutrgb=a="maxval-minval/2"
  7564. @end example
  7565. @item
  7566. Correct luminance gamma by a factor of 0.5:
  7567. @example
  7568. lutyuv=y=gammaval(0.5)
  7569. @end example
  7570. @item
  7571. Discard least significant bits of luma:
  7572. @example
  7573. lutyuv=y='bitand(val, 128+64+32)'
  7574. @end example
  7575. @item
  7576. Technicolor like effect:
  7577. @example
  7578. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7579. @end example
  7580. @end itemize
  7581. @section lut2
  7582. Compute and apply a lookup table from two video inputs.
  7583. This filter accepts the following parameters:
  7584. @table @option
  7585. @item c0
  7586. set first pixel component expression
  7587. @item c1
  7588. set second pixel component expression
  7589. @item c2
  7590. set third pixel component expression
  7591. @item c3
  7592. set fourth pixel component expression, corresponds to the alpha component
  7593. @end table
  7594. Each of them specifies the expression to use for computing the lookup table for
  7595. the corresponding pixel component values.
  7596. The exact component associated to each of the @var{c*} options depends on the
  7597. format in inputs.
  7598. The expressions can contain the following constants:
  7599. @table @option
  7600. @item w
  7601. @item h
  7602. The input width and height.
  7603. @item x
  7604. The first input value for the pixel component.
  7605. @item y
  7606. The second input value for the pixel component.
  7607. @item bdx
  7608. The first input video bit depth.
  7609. @item bdy
  7610. The second input video bit depth.
  7611. @end table
  7612. All expressions default to "x".
  7613. @subsection Examples
  7614. @itemize
  7615. @item
  7616. Highlight differences between two RGB video streams:
  7617. @example
  7618. 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)'
  7619. @end example
  7620. @item
  7621. Highlight differences between two YUV video streams:
  7622. @example
  7623. 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)'
  7624. @end example
  7625. @end itemize
  7626. @section maskedclamp
  7627. Clamp the first input stream with the second input and third input stream.
  7628. Returns the value of first stream to be between second input
  7629. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7630. This filter accepts the following options:
  7631. @table @option
  7632. @item undershoot
  7633. Default value is @code{0}.
  7634. @item overshoot
  7635. Default value is @code{0}.
  7636. @item planes
  7637. Set which planes will be processed as bitmap, unprocessed planes will be
  7638. copied from first stream.
  7639. By default value 0xf, all planes will be processed.
  7640. @end table
  7641. @section maskedmerge
  7642. Merge the first input stream with the second input stream using per pixel
  7643. weights in the third input stream.
  7644. A value of 0 in the third stream pixel component means that pixel component
  7645. from first stream is returned unchanged, while maximum value (eg. 255 for
  7646. 8-bit videos) means that pixel component from second stream is returned
  7647. unchanged. Intermediate values define the amount of merging between both
  7648. input stream's pixel components.
  7649. This filter accepts the following options:
  7650. @table @option
  7651. @item planes
  7652. Set which planes will be processed as bitmap, unprocessed planes will be
  7653. copied from first stream.
  7654. By default value 0xf, all planes will be processed.
  7655. @end table
  7656. @section mcdeint
  7657. Apply motion-compensation deinterlacing.
  7658. It needs one field per frame as input and must thus be used together
  7659. with yadif=1/3 or equivalent.
  7660. This filter accepts the following options:
  7661. @table @option
  7662. @item mode
  7663. Set the deinterlacing mode.
  7664. It accepts one of the following values:
  7665. @table @samp
  7666. @item fast
  7667. @item medium
  7668. @item slow
  7669. use iterative motion estimation
  7670. @item extra_slow
  7671. like @samp{slow}, but use multiple reference frames.
  7672. @end table
  7673. Default value is @samp{fast}.
  7674. @item parity
  7675. Set the picture field parity assumed for the input video. It must be
  7676. one of the following values:
  7677. @table @samp
  7678. @item 0, tff
  7679. assume top field first
  7680. @item 1, bff
  7681. assume bottom field first
  7682. @end table
  7683. Default value is @samp{bff}.
  7684. @item qp
  7685. Set per-block quantization parameter (QP) used by the internal
  7686. encoder.
  7687. Higher values should result in a smoother motion vector field but less
  7688. optimal individual vectors. Default value is 1.
  7689. @end table
  7690. @section mergeplanes
  7691. Merge color channel components from several video streams.
  7692. The filter accepts up to 4 input streams, and merge selected input
  7693. planes to the output video.
  7694. This filter accepts the following options:
  7695. @table @option
  7696. @item mapping
  7697. Set input to output plane mapping. Default is @code{0}.
  7698. The mappings is specified as a bitmap. It should be specified as a
  7699. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7700. mapping for the first plane of the output stream. 'A' sets the number of
  7701. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7702. corresponding input to use (from 0 to 3). The rest of the mappings is
  7703. similar, 'Bb' describes the mapping for the output stream second
  7704. plane, 'Cc' describes the mapping for the output stream third plane and
  7705. 'Dd' describes the mapping for the output stream fourth plane.
  7706. @item format
  7707. Set output pixel format. Default is @code{yuva444p}.
  7708. @end table
  7709. @subsection Examples
  7710. @itemize
  7711. @item
  7712. Merge three gray video streams of same width and height into single video stream:
  7713. @example
  7714. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7715. @end example
  7716. @item
  7717. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7718. @example
  7719. [a0][a1]mergeplanes=0x00010210:yuva444p
  7720. @end example
  7721. @item
  7722. Swap Y and A plane in yuva444p stream:
  7723. @example
  7724. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7725. @end example
  7726. @item
  7727. Swap U and V plane in yuv420p stream:
  7728. @example
  7729. format=yuv420p,mergeplanes=0x000201:yuv420p
  7730. @end example
  7731. @item
  7732. Cast a rgb24 clip to yuv444p:
  7733. @example
  7734. format=rgb24,mergeplanes=0x000102:yuv444p
  7735. @end example
  7736. @end itemize
  7737. @section mestimate
  7738. Estimate and export motion vectors using block matching algorithms.
  7739. Motion vectors are stored in frame side data to be used by other filters.
  7740. This filter accepts the following options:
  7741. @table @option
  7742. @item method
  7743. Specify the motion estimation method. Accepts one of the following values:
  7744. @table @samp
  7745. @item esa
  7746. Exhaustive search algorithm.
  7747. @item tss
  7748. Three step search algorithm.
  7749. @item tdls
  7750. Two dimensional logarithmic search algorithm.
  7751. @item ntss
  7752. New three step search algorithm.
  7753. @item fss
  7754. Four step search algorithm.
  7755. @item ds
  7756. Diamond search algorithm.
  7757. @item hexbs
  7758. Hexagon-based search algorithm.
  7759. @item epzs
  7760. Enhanced predictive zonal search algorithm.
  7761. @item umh
  7762. Uneven multi-hexagon search algorithm.
  7763. @end table
  7764. Default value is @samp{esa}.
  7765. @item mb_size
  7766. Macroblock size. Default @code{16}.
  7767. @item search_param
  7768. Search parameter. Default @code{7}.
  7769. @end table
  7770. @section midequalizer
  7771. Apply Midway Image Equalization effect using two video streams.
  7772. Midway Image Equalization adjusts a pair of images to have the same
  7773. histogram, while maintaining their dynamics as much as possible. It's
  7774. useful for e.g. matching exposures from a pair of stereo cameras.
  7775. This filter has two inputs and one output, which must be of same pixel format, but
  7776. may be of different sizes. The output of filter is first input adjusted with
  7777. midway histogram of both inputs.
  7778. This filter accepts the following option:
  7779. @table @option
  7780. @item planes
  7781. Set which planes to process. Default is @code{15}, which is all available planes.
  7782. @end table
  7783. @section minterpolate
  7784. Convert the video to specified frame rate using motion interpolation.
  7785. This filter accepts the following options:
  7786. @table @option
  7787. @item fps
  7788. 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}.
  7789. @item mi_mode
  7790. Motion interpolation mode. Following values are accepted:
  7791. @table @samp
  7792. @item dup
  7793. Duplicate previous or next frame for interpolating new ones.
  7794. @item blend
  7795. Blend source frames. Interpolated frame is mean of previous and next frames.
  7796. @item mci
  7797. Motion compensated interpolation. Following options are effective when this mode is selected:
  7798. @table @samp
  7799. @item mc_mode
  7800. Motion compensation mode. Following values are accepted:
  7801. @table @samp
  7802. @item obmc
  7803. Overlapped block motion compensation.
  7804. @item aobmc
  7805. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7806. @end table
  7807. Default mode is @samp{obmc}.
  7808. @item me_mode
  7809. Motion estimation mode. Following values are accepted:
  7810. @table @samp
  7811. @item bidir
  7812. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7813. @item bilat
  7814. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7815. @end table
  7816. Default mode is @samp{bilat}.
  7817. @item me
  7818. The algorithm to be used for motion estimation. Following values are accepted:
  7819. @table @samp
  7820. @item esa
  7821. Exhaustive search algorithm.
  7822. @item tss
  7823. Three step search algorithm.
  7824. @item tdls
  7825. Two dimensional logarithmic search algorithm.
  7826. @item ntss
  7827. New three step search algorithm.
  7828. @item fss
  7829. Four step search algorithm.
  7830. @item ds
  7831. Diamond search algorithm.
  7832. @item hexbs
  7833. Hexagon-based search algorithm.
  7834. @item epzs
  7835. Enhanced predictive zonal search algorithm.
  7836. @item umh
  7837. Uneven multi-hexagon search algorithm.
  7838. @end table
  7839. Default algorithm is @samp{epzs}.
  7840. @item mb_size
  7841. Macroblock size. Default @code{16}.
  7842. @item search_param
  7843. Motion estimation search parameter. Default @code{32}.
  7844. @item vsbmc
  7845. 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).
  7846. @end table
  7847. @end table
  7848. @item scd
  7849. 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:
  7850. @table @samp
  7851. @item none
  7852. Disable scene change detection.
  7853. @item fdiff
  7854. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7855. @end table
  7856. Default method is @samp{fdiff}.
  7857. @item scd_threshold
  7858. Scene change detection threshold. Default is @code{5.0}.
  7859. @end table
  7860. @section mpdecimate
  7861. Drop frames that do not differ greatly from the previous frame in
  7862. order to reduce frame rate.
  7863. The main use of this filter is for very-low-bitrate encoding
  7864. (e.g. streaming over dialup modem), but it could in theory be used for
  7865. fixing movies that were inverse-telecined incorrectly.
  7866. A description of the accepted options follows.
  7867. @table @option
  7868. @item max
  7869. Set the maximum number of consecutive frames which can be dropped (if
  7870. positive), or the minimum interval between dropped frames (if
  7871. negative). If the value is 0, the frame is dropped unregarding the
  7872. number of previous sequentially dropped frames.
  7873. Default value is 0.
  7874. @item hi
  7875. @item lo
  7876. @item frac
  7877. Set the dropping threshold values.
  7878. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7879. represent actual pixel value differences, so a threshold of 64
  7880. corresponds to 1 unit of difference for each pixel, or the same spread
  7881. out differently over the block.
  7882. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7883. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7884. meaning the whole image) differ by more than a threshold of @option{lo}.
  7885. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7886. 64*5, and default value for @option{frac} is 0.33.
  7887. @end table
  7888. @section negate
  7889. Negate input video.
  7890. It accepts an integer in input; if non-zero it negates the
  7891. alpha component (if available). The default value in input is 0.
  7892. @section nlmeans
  7893. Denoise frames using Non-Local Means algorithm.
  7894. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7895. context similarity is defined by comparing their surrounding patches of size
  7896. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7897. around the pixel.
  7898. Note that the research area defines centers for patches, which means some
  7899. patches will be made of pixels outside that research area.
  7900. The filter accepts the following options.
  7901. @table @option
  7902. @item s
  7903. Set denoising strength.
  7904. @item p
  7905. Set patch size.
  7906. @item pc
  7907. Same as @option{p} but for chroma planes.
  7908. The default value is @var{0} and means automatic.
  7909. @item r
  7910. Set research size.
  7911. @item rc
  7912. Same as @option{r} but for chroma planes.
  7913. The default value is @var{0} and means automatic.
  7914. @end table
  7915. @section nnedi
  7916. Deinterlace video using neural network edge directed interpolation.
  7917. This filter accepts the following options:
  7918. @table @option
  7919. @item weights
  7920. Mandatory option, without binary file filter can not work.
  7921. Currently file can be found here:
  7922. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7923. @item deint
  7924. Set which frames to deinterlace, by default it is @code{all}.
  7925. Can be @code{all} or @code{interlaced}.
  7926. @item field
  7927. Set mode of operation.
  7928. Can be one of the following:
  7929. @table @samp
  7930. @item af
  7931. Use frame flags, both fields.
  7932. @item a
  7933. Use frame flags, single field.
  7934. @item t
  7935. Use top field only.
  7936. @item b
  7937. Use bottom field only.
  7938. @item tf
  7939. Use both fields, top first.
  7940. @item bf
  7941. Use both fields, bottom first.
  7942. @end table
  7943. @item planes
  7944. Set which planes to process, by default filter process all frames.
  7945. @item nsize
  7946. Set size of local neighborhood around each pixel, used by the predictor neural
  7947. network.
  7948. Can be one of the following:
  7949. @table @samp
  7950. @item s8x6
  7951. @item s16x6
  7952. @item s32x6
  7953. @item s48x6
  7954. @item s8x4
  7955. @item s16x4
  7956. @item s32x4
  7957. @end table
  7958. @item nns
  7959. Set the number of neurons in predicctor neural network.
  7960. Can be one of the following:
  7961. @table @samp
  7962. @item n16
  7963. @item n32
  7964. @item n64
  7965. @item n128
  7966. @item n256
  7967. @end table
  7968. @item qual
  7969. Controls the number of different neural network predictions that are blended
  7970. together to compute the final output value. Can be @code{fast}, default or
  7971. @code{slow}.
  7972. @item etype
  7973. Set which set of weights to use in the predictor.
  7974. Can be one of the following:
  7975. @table @samp
  7976. @item a
  7977. weights trained to minimize absolute error
  7978. @item s
  7979. weights trained to minimize squared error
  7980. @end table
  7981. @item pscrn
  7982. Controls whether or not the prescreener neural network is used to decide
  7983. which pixels should be processed by the predictor neural network and which
  7984. can be handled by simple cubic interpolation.
  7985. The prescreener is trained to know whether cubic interpolation will be
  7986. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7987. The computational complexity of the prescreener nn is much less than that of
  7988. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7989. using the prescreener generally results in much faster processing.
  7990. The prescreener is pretty accurate, so the difference between using it and not
  7991. using it is almost always unnoticeable.
  7992. Can be one of the following:
  7993. @table @samp
  7994. @item none
  7995. @item original
  7996. @item new
  7997. @end table
  7998. Default is @code{new}.
  7999. @item fapprox
  8000. Set various debugging flags.
  8001. @end table
  8002. @section noformat
  8003. Force libavfilter not to use any of the specified pixel formats for the
  8004. input to the next filter.
  8005. It accepts the following parameters:
  8006. @table @option
  8007. @item pix_fmts
  8008. A '|'-separated list of pixel format names, such as
  8009. apix_fmts=yuv420p|monow|rgb24".
  8010. @end table
  8011. @subsection Examples
  8012. @itemize
  8013. @item
  8014. Force libavfilter to use a format different from @var{yuv420p} for the
  8015. input to the vflip filter:
  8016. @example
  8017. noformat=pix_fmts=yuv420p,vflip
  8018. @end example
  8019. @item
  8020. Convert the input video to any of the formats not contained in the list:
  8021. @example
  8022. noformat=yuv420p|yuv444p|yuv410p
  8023. @end example
  8024. @end itemize
  8025. @section noise
  8026. Add noise on video input frame.
  8027. The filter accepts the following options:
  8028. @table @option
  8029. @item all_seed
  8030. @item c0_seed
  8031. @item c1_seed
  8032. @item c2_seed
  8033. @item c3_seed
  8034. Set noise seed for specific pixel component or all pixel components in case
  8035. of @var{all_seed}. Default value is @code{123457}.
  8036. @item all_strength, alls
  8037. @item c0_strength, c0s
  8038. @item c1_strength, c1s
  8039. @item c2_strength, c2s
  8040. @item c3_strength, c3s
  8041. Set noise strength for specific pixel component or all pixel components in case
  8042. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8043. @item all_flags, allf
  8044. @item c0_flags, c0f
  8045. @item c1_flags, c1f
  8046. @item c2_flags, c2f
  8047. @item c3_flags, c3f
  8048. Set pixel component flags or set flags for all components if @var{all_flags}.
  8049. Available values for component flags are:
  8050. @table @samp
  8051. @item a
  8052. averaged temporal noise (smoother)
  8053. @item p
  8054. mix random noise with a (semi)regular pattern
  8055. @item t
  8056. temporal noise (noise pattern changes between frames)
  8057. @item u
  8058. uniform noise (gaussian otherwise)
  8059. @end table
  8060. @end table
  8061. @subsection Examples
  8062. Add temporal and uniform noise to input video:
  8063. @example
  8064. noise=alls=20:allf=t+u
  8065. @end example
  8066. @section null
  8067. Pass the video source unchanged to the output.
  8068. @section ocr
  8069. Optical Character Recognition
  8070. This filter uses Tesseract for optical character recognition.
  8071. It accepts the following options:
  8072. @table @option
  8073. @item datapath
  8074. Set datapath to tesseract data. Default is to use whatever was
  8075. set at installation.
  8076. @item language
  8077. Set language, default is "eng".
  8078. @item whitelist
  8079. Set character whitelist.
  8080. @item blacklist
  8081. Set character blacklist.
  8082. @end table
  8083. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8084. @section ocv
  8085. Apply a video transform using libopencv.
  8086. To enable this filter, install the libopencv library and headers and
  8087. configure FFmpeg with @code{--enable-libopencv}.
  8088. It accepts the following parameters:
  8089. @table @option
  8090. @item filter_name
  8091. The name of the libopencv filter to apply.
  8092. @item filter_params
  8093. The parameters to pass to the libopencv filter. If not specified, the default
  8094. values are assumed.
  8095. @end table
  8096. Refer to the official libopencv documentation for more precise
  8097. information:
  8098. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8099. Several libopencv filters are supported; see the following subsections.
  8100. @anchor{dilate}
  8101. @subsection dilate
  8102. Dilate an image by using a specific structuring element.
  8103. It corresponds to the libopencv function @code{cvDilate}.
  8104. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8105. @var{struct_el} represents a structuring element, and has the syntax:
  8106. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8107. @var{cols} and @var{rows} represent the number of columns and rows of
  8108. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8109. point, and @var{shape} the shape for the structuring element. @var{shape}
  8110. must be "rect", "cross", "ellipse", or "custom".
  8111. If the value for @var{shape} is "custom", it must be followed by a
  8112. string of the form "=@var{filename}". The file with name
  8113. @var{filename} is assumed to represent a binary image, with each
  8114. printable character corresponding to a bright pixel. When a custom
  8115. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8116. or columns and rows of the read file are assumed instead.
  8117. The default value for @var{struct_el} is "3x3+0x0/rect".
  8118. @var{nb_iterations} specifies the number of times the transform is
  8119. applied to the image, and defaults to 1.
  8120. Some examples:
  8121. @example
  8122. # Use the default values
  8123. ocv=dilate
  8124. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8125. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8126. # Read the shape from the file diamond.shape, iterating two times.
  8127. # The file diamond.shape may contain a pattern of characters like this
  8128. # *
  8129. # ***
  8130. # *****
  8131. # ***
  8132. # *
  8133. # The specified columns and rows are ignored
  8134. # but the anchor point coordinates are not
  8135. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8136. @end example
  8137. @subsection erode
  8138. Erode an image by using a specific structuring element.
  8139. It corresponds to the libopencv function @code{cvErode}.
  8140. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8141. with the same syntax and semantics as the @ref{dilate} filter.
  8142. @subsection smooth
  8143. Smooth the input video.
  8144. The filter takes the following parameters:
  8145. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8146. @var{type} is the type of smooth filter to apply, and must be one of
  8147. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8148. or "bilateral". The default value is "gaussian".
  8149. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8150. depend on the smooth type. @var{param1} and
  8151. @var{param2} accept integer positive values or 0. @var{param3} and
  8152. @var{param4} accept floating point values.
  8153. The default value for @var{param1} is 3. The default value for the
  8154. other parameters is 0.
  8155. These parameters correspond to the parameters assigned to the
  8156. libopencv function @code{cvSmooth}.
  8157. @section oscilloscope
  8158. 2D Video Oscilloscope.
  8159. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8160. It accepts the following parameters:
  8161. @table @option
  8162. @item x
  8163. Set scope center x position.
  8164. @item y
  8165. Set scope center y position.
  8166. @item s
  8167. Set scope size, relative to frame diagonal.
  8168. @item t
  8169. Set scope tilt/rotation.
  8170. @item o
  8171. Set trace opacity.
  8172. @item tx
  8173. Set trace center x position.
  8174. @item ty
  8175. Set trace center y position.
  8176. @item tw
  8177. Set trace width, relative to width of frame.
  8178. @item th
  8179. Set trace height, relative to height of frame.
  8180. @item c
  8181. Set which components to trace. By default it traces first three components.
  8182. @item g
  8183. Draw trace grid. By default is enabled.
  8184. @item st
  8185. Draw some statistics. By default is enabled.
  8186. @item sc
  8187. Draw scope. By default is enabled.
  8188. @end table
  8189. @subsection Examples
  8190. @itemize
  8191. @item
  8192. Inspect full first row of video frame.
  8193. @example
  8194. oscilloscope=x=0.5:y=0:s=1
  8195. @end example
  8196. @item
  8197. Inspect full last row of video frame.
  8198. @example
  8199. oscilloscope=x=0.5:y=1:s=1
  8200. @end example
  8201. @item
  8202. Inspect full 5th line of video frame of height 1080.
  8203. @example
  8204. oscilloscope=x=0.5:y=5/1080:s=1
  8205. @end example
  8206. @item
  8207. Inspect full last column of video frame.
  8208. @example
  8209. oscilloscope=x=1:y=0.5:s=1:t=1
  8210. @end example
  8211. @end itemize
  8212. @anchor{overlay}
  8213. @section overlay
  8214. Overlay one video on top of another.
  8215. It takes two inputs and has one output. The first input is the "main"
  8216. video on which the second input is overlaid.
  8217. It accepts the following parameters:
  8218. A description of the accepted options follows.
  8219. @table @option
  8220. @item x
  8221. @item y
  8222. Set the expression for the x and y coordinates of the overlaid video
  8223. on the main video. Default value is "0" for both expressions. In case
  8224. the expression is invalid, it is set to a huge value (meaning that the
  8225. overlay will not be displayed within the output visible area).
  8226. @item eof_action
  8227. The action to take when EOF is encountered on the secondary input; it accepts
  8228. one of the following values:
  8229. @table @option
  8230. @item repeat
  8231. Repeat the last frame (the default).
  8232. @item endall
  8233. End both streams.
  8234. @item pass
  8235. Pass the main input through.
  8236. @end table
  8237. @item eval
  8238. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8239. It accepts the following values:
  8240. @table @samp
  8241. @item init
  8242. only evaluate expressions once during the filter initialization or
  8243. when a command is processed
  8244. @item frame
  8245. evaluate expressions for each incoming frame
  8246. @end table
  8247. Default value is @samp{frame}.
  8248. @item shortest
  8249. If set to 1, force the output to terminate when the shortest input
  8250. terminates. Default value is 0.
  8251. @item format
  8252. Set the format for the output video.
  8253. It accepts the following values:
  8254. @table @samp
  8255. @item yuv420
  8256. force YUV420 output
  8257. @item yuv422
  8258. force YUV422 output
  8259. @item yuv444
  8260. force YUV444 output
  8261. @item rgb
  8262. force packed RGB output
  8263. @item gbrp
  8264. force planar RGB output
  8265. @end table
  8266. Default value is @samp{yuv420}.
  8267. @item rgb @emph{(deprecated)}
  8268. If set to 1, force the filter to accept inputs in the RGB
  8269. color space. Default value is 0. This option is deprecated, use
  8270. @option{format} instead.
  8271. @item repeatlast
  8272. If set to 1, force the filter to draw the last overlay frame over the
  8273. main input until the end of the stream. A value of 0 disables this
  8274. behavior. Default value is 1.
  8275. @end table
  8276. The @option{x}, and @option{y} expressions can contain the following
  8277. parameters.
  8278. @table @option
  8279. @item main_w, W
  8280. @item main_h, H
  8281. The main input width and height.
  8282. @item overlay_w, w
  8283. @item overlay_h, h
  8284. The overlay input width and height.
  8285. @item x
  8286. @item y
  8287. The computed values for @var{x} and @var{y}. They are evaluated for
  8288. each new frame.
  8289. @item hsub
  8290. @item vsub
  8291. horizontal and vertical chroma subsample values of the output
  8292. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8293. @var{vsub} is 1.
  8294. @item n
  8295. the number of input frame, starting from 0
  8296. @item pos
  8297. the position in the file of the input frame, NAN if unknown
  8298. @item t
  8299. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8300. @end table
  8301. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8302. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8303. when @option{eval} is set to @samp{init}.
  8304. Be aware that frames are taken from each input video in timestamp
  8305. order, hence, if their initial timestamps differ, it is a good idea
  8306. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8307. have them begin in the same zero timestamp, as the example for
  8308. the @var{movie} filter does.
  8309. You can chain together more overlays but you should test the
  8310. efficiency of such approach.
  8311. @subsection Commands
  8312. This filter supports the following commands:
  8313. @table @option
  8314. @item x
  8315. @item y
  8316. Modify the x and y of the overlay input.
  8317. The command accepts the same syntax of the corresponding option.
  8318. If the specified expression is not valid, it is kept at its current
  8319. value.
  8320. @end table
  8321. @subsection Examples
  8322. @itemize
  8323. @item
  8324. Draw the overlay at 10 pixels from the bottom right corner of the main
  8325. video:
  8326. @example
  8327. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8328. @end example
  8329. Using named options the example above becomes:
  8330. @example
  8331. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8332. @end example
  8333. @item
  8334. Insert a transparent PNG logo in the bottom left corner of the input,
  8335. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8336. @example
  8337. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8338. @end example
  8339. @item
  8340. Insert 2 different transparent PNG logos (second logo on bottom
  8341. right corner) using the @command{ffmpeg} tool:
  8342. @example
  8343. 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
  8344. @end example
  8345. @item
  8346. Add a transparent color layer on top of the main video; @code{WxH}
  8347. must specify the size of the main input to the overlay filter:
  8348. @example
  8349. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8350. @end example
  8351. @item
  8352. Play an original video and a filtered version (here with the deshake
  8353. filter) side by side using the @command{ffplay} tool:
  8354. @example
  8355. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8356. @end example
  8357. The above command is the same as:
  8358. @example
  8359. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8360. @end example
  8361. @item
  8362. Make a sliding overlay appearing from the left to the right top part of the
  8363. screen starting since time 2:
  8364. @example
  8365. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8366. @end example
  8367. @item
  8368. Compose output by putting two input videos side to side:
  8369. @example
  8370. ffmpeg -i left.avi -i right.avi -filter_complex "
  8371. nullsrc=size=200x100 [background];
  8372. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8373. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8374. [background][left] overlay=shortest=1 [background+left];
  8375. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8376. "
  8377. @end example
  8378. @item
  8379. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8380. @example
  8381. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8382. -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]'
  8383. masked.avi
  8384. @end example
  8385. @item
  8386. Chain several overlays in cascade:
  8387. @example
  8388. nullsrc=s=200x200 [bg];
  8389. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8390. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8391. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8392. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8393. [in3] null, [mid2] overlay=100:100 [out0]
  8394. @end example
  8395. @end itemize
  8396. @section owdenoise
  8397. Apply Overcomplete Wavelet denoiser.
  8398. The filter accepts the following options:
  8399. @table @option
  8400. @item depth
  8401. Set depth.
  8402. Larger depth values will denoise lower frequency components more, but
  8403. slow down filtering.
  8404. Must be an int in the range 8-16, default is @code{8}.
  8405. @item luma_strength, ls
  8406. Set luma strength.
  8407. Must be a double value in the range 0-1000, default is @code{1.0}.
  8408. @item chroma_strength, cs
  8409. Set chroma strength.
  8410. Must be a double value in the range 0-1000, default is @code{1.0}.
  8411. @end table
  8412. @anchor{pad}
  8413. @section pad
  8414. Add paddings to the input image, and place the original input at the
  8415. provided @var{x}, @var{y} coordinates.
  8416. It accepts the following parameters:
  8417. @table @option
  8418. @item width, w
  8419. @item height, h
  8420. Specify an expression for the size of the output image with the
  8421. paddings added. If the value for @var{width} or @var{height} is 0, the
  8422. corresponding input size is used for the output.
  8423. The @var{width} expression can reference the value set by the
  8424. @var{height} expression, and vice versa.
  8425. The default value of @var{width} and @var{height} is 0.
  8426. @item x
  8427. @item y
  8428. Specify the offsets to place the input image at within the padded area,
  8429. with respect to the top/left border of the output image.
  8430. The @var{x} expression can reference the value set by the @var{y}
  8431. expression, and vice versa.
  8432. The default value of @var{x} and @var{y} is 0.
  8433. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8434. so the input image is centered on the padded area.
  8435. @item color
  8436. Specify the color of the padded area. For the syntax of this option,
  8437. check the "Color" section in the ffmpeg-utils manual.
  8438. The default value of @var{color} is "black".
  8439. @item eval
  8440. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8441. It accepts the following values:
  8442. @table @samp
  8443. @item init
  8444. Only evaluate expressions once during the filter initialization or when
  8445. a command is processed.
  8446. @item frame
  8447. Evaluate expressions for each incoming frame.
  8448. @end table
  8449. Default value is @samp{init}.
  8450. @item aspect
  8451. Pad to aspect instead to a resolution.
  8452. @end table
  8453. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8454. options are expressions containing the following constants:
  8455. @table @option
  8456. @item in_w
  8457. @item in_h
  8458. The input video width and height.
  8459. @item iw
  8460. @item ih
  8461. These are the same as @var{in_w} and @var{in_h}.
  8462. @item out_w
  8463. @item out_h
  8464. The output width and height (the size of the padded area), as
  8465. specified by the @var{width} and @var{height} expressions.
  8466. @item ow
  8467. @item oh
  8468. These are the same as @var{out_w} and @var{out_h}.
  8469. @item x
  8470. @item y
  8471. The x and y offsets as specified by the @var{x} and @var{y}
  8472. expressions, or NAN if not yet specified.
  8473. @item a
  8474. same as @var{iw} / @var{ih}
  8475. @item sar
  8476. input sample aspect ratio
  8477. @item dar
  8478. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8479. @item hsub
  8480. @item vsub
  8481. The horizontal and vertical chroma subsample values. For example for the
  8482. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8483. @end table
  8484. @subsection Examples
  8485. @itemize
  8486. @item
  8487. Add paddings with the color "violet" to the input video. The output video
  8488. size is 640x480, and the top-left corner of the input video is placed at
  8489. column 0, row 40
  8490. @example
  8491. pad=640:480:0:40:violet
  8492. @end example
  8493. The example above is equivalent to the following command:
  8494. @example
  8495. pad=width=640:height=480:x=0:y=40:color=violet
  8496. @end example
  8497. @item
  8498. Pad the input to get an output with dimensions increased by 3/2,
  8499. and put the input video at the center of the padded area:
  8500. @example
  8501. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8502. @end example
  8503. @item
  8504. Pad the input to get a squared output with size equal to the maximum
  8505. value between the input width and height, and put the input video at
  8506. the center of the padded area:
  8507. @example
  8508. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8509. @end example
  8510. @item
  8511. Pad the input to get a final w/h ratio of 16:9:
  8512. @example
  8513. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8514. @end example
  8515. @item
  8516. In case of anamorphic video, in order to set the output display aspect
  8517. correctly, it is necessary to use @var{sar} in the expression,
  8518. according to the relation:
  8519. @example
  8520. (ih * X / ih) * sar = output_dar
  8521. X = output_dar / sar
  8522. @end example
  8523. Thus the previous example needs to be modified to:
  8524. @example
  8525. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8526. @end example
  8527. @item
  8528. Double the output size and put the input video in the bottom-right
  8529. corner of the output padded area:
  8530. @example
  8531. pad="2*iw:2*ih:ow-iw:oh-ih"
  8532. @end example
  8533. @end itemize
  8534. @anchor{palettegen}
  8535. @section palettegen
  8536. Generate one palette for a whole video stream.
  8537. It accepts the following options:
  8538. @table @option
  8539. @item max_colors
  8540. Set the maximum number of colors to quantize in the palette.
  8541. Note: the palette will still contain 256 colors; the unused palette entries
  8542. will be black.
  8543. @item reserve_transparent
  8544. Create a palette of 255 colors maximum and reserve the last one for
  8545. transparency. Reserving the transparency color is useful for GIF optimization.
  8546. If not set, the maximum of colors in the palette will be 256. You probably want
  8547. to disable this option for a standalone image.
  8548. Set by default.
  8549. @item stats_mode
  8550. Set statistics mode.
  8551. It accepts the following values:
  8552. @table @samp
  8553. @item full
  8554. Compute full frame histograms.
  8555. @item diff
  8556. Compute histograms only for the part that differs from previous frame. This
  8557. might be relevant to give more importance to the moving part of your input if
  8558. the background is static.
  8559. @item single
  8560. Compute new histogram for each frame.
  8561. @end table
  8562. Default value is @var{full}.
  8563. @end table
  8564. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8565. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8566. color quantization of the palette. This information is also visible at
  8567. @var{info} logging level.
  8568. @subsection Examples
  8569. @itemize
  8570. @item
  8571. Generate a representative palette of a given video using @command{ffmpeg}:
  8572. @example
  8573. ffmpeg -i input.mkv -vf palettegen palette.png
  8574. @end example
  8575. @end itemize
  8576. @section paletteuse
  8577. Use a palette to downsample an input video stream.
  8578. The filter takes two inputs: one video stream and a palette. The palette must
  8579. be a 256 pixels image.
  8580. It accepts the following options:
  8581. @table @option
  8582. @item dither
  8583. Select dithering mode. Available algorithms are:
  8584. @table @samp
  8585. @item bayer
  8586. Ordered 8x8 bayer dithering (deterministic)
  8587. @item heckbert
  8588. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8589. Note: this dithering is sometimes considered "wrong" and is included as a
  8590. reference.
  8591. @item floyd_steinberg
  8592. Floyd and Steingberg dithering (error diffusion)
  8593. @item sierra2
  8594. Frankie Sierra dithering v2 (error diffusion)
  8595. @item sierra2_4a
  8596. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8597. @end table
  8598. Default is @var{sierra2_4a}.
  8599. @item bayer_scale
  8600. When @var{bayer} dithering is selected, this option defines the scale of the
  8601. pattern (how much the crosshatch pattern is visible). A low value means more
  8602. visible pattern for less banding, and higher value means less visible pattern
  8603. at the cost of more banding.
  8604. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8605. @item diff_mode
  8606. If set, define the zone to process
  8607. @table @samp
  8608. @item rectangle
  8609. Only the changing rectangle will be reprocessed. This is similar to GIF
  8610. cropping/offsetting compression mechanism. This option can be useful for speed
  8611. if only a part of the image is changing, and has use cases such as limiting the
  8612. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8613. moving scene (it leads to more deterministic output if the scene doesn't change
  8614. much, and as a result less moving noise and better GIF compression).
  8615. @end table
  8616. Default is @var{none}.
  8617. @item new
  8618. Take new palette for each output frame.
  8619. @end table
  8620. @subsection Examples
  8621. @itemize
  8622. @item
  8623. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8624. using @command{ffmpeg}:
  8625. @example
  8626. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8627. @end example
  8628. @end itemize
  8629. @section perspective
  8630. Correct perspective of video not recorded perpendicular to the screen.
  8631. A description of the accepted parameters follows.
  8632. @table @option
  8633. @item x0
  8634. @item y0
  8635. @item x1
  8636. @item y1
  8637. @item x2
  8638. @item y2
  8639. @item x3
  8640. @item y3
  8641. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8642. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8643. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8644. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8645. then the corners of the source will be sent to the specified coordinates.
  8646. The expressions can use the following variables:
  8647. @table @option
  8648. @item W
  8649. @item H
  8650. the width and height of video frame.
  8651. @item in
  8652. Input frame count.
  8653. @item on
  8654. Output frame count.
  8655. @end table
  8656. @item interpolation
  8657. Set interpolation for perspective correction.
  8658. It accepts the following values:
  8659. @table @samp
  8660. @item linear
  8661. @item cubic
  8662. @end table
  8663. Default value is @samp{linear}.
  8664. @item sense
  8665. Set interpretation of coordinate options.
  8666. It accepts the following values:
  8667. @table @samp
  8668. @item 0, source
  8669. Send point in the source specified by the given coordinates to
  8670. the corners of the destination.
  8671. @item 1, destination
  8672. Send the corners of the source to the point in the destination specified
  8673. by the given coordinates.
  8674. Default value is @samp{source}.
  8675. @end table
  8676. @item eval
  8677. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8678. It accepts the following values:
  8679. @table @samp
  8680. @item init
  8681. only evaluate expressions once during the filter initialization or
  8682. when a command is processed
  8683. @item frame
  8684. evaluate expressions for each incoming frame
  8685. @end table
  8686. Default value is @samp{init}.
  8687. @end table
  8688. @section phase
  8689. Delay interlaced video by one field time so that the field order changes.
  8690. The intended use is to fix PAL movies that have been captured with the
  8691. opposite field order to the film-to-video transfer.
  8692. A description of the accepted parameters follows.
  8693. @table @option
  8694. @item mode
  8695. Set phase mode.
  8696. It accepts the following values:
  8697. @table @samp
  8698. @item t
  8699. Capture field order top-first, transfer bottom-first.
  8700. Filter will delay the bottom field.
  8701. @item b
  8702. Capture field order bottom-first, transfer top-first.
  8703. Filter will delay the top field.
  8704. @item p
  8705. Capture and transfer with the same field order. This mode only exists
  8706. for the documentation of the other options to refer to, but if you
  8707. actually select it, the filter will faithfully do nothing.
  8708. @item a
  8709. Capture field order determined automatically by field flags, transfer
  8710. opposite.
  8711. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8712. basis using field flags. If no field information is available,
  8713. then this works just like @samp{u}.
  8714. @item u
  8715. Capture unknown or varying, transfer opposite.
  8716. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8717. analyzing the images and selecting the alternative that produces best
  8718. match between the fields.
  8719. @item T
  8720. Capture top-first, transfer unknown or varying.
  8721. Filter selects among @samp{t} and @samp{p} using image analysis.
  8722. @item B
  8723. Capture bottom-first, transfer unknown or varying.
  8724. Filter selects among @samp{b} and @samp{p} using image analysis.
  8725. @item A
  8726. Capture determined by field flags, transfer unknown or varying.
  8727. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8728. image analysis. If no field information is available, then this works just
  8729. like @samp{U}. This is the default mode.
  8730. @item U
  8731. Both capture and transfer unknown or varying.
  8732. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8733. @end table
  8734. @end table
  8735. @section pixdesctest
  8736. Pixel format descriptor test filter, mainly useful for internal
  8737. testing. The output video should be equal to the input video.
  8738. For example:
  8739. @example
  8740. format=monow, pixdesctest
  8741. @end example
  8742. can be used to test the monowhite pixel format descriptor definition.
  8743. @section pixscope
  8744. Display sample values of color channels. Mainly useful for checking color and levels.
  8745. The filters accept the following options:
  8746. @table @option
  8747. @item x
  8748. Set scope X position, offset on X axis.
  8749. @item y
  8750. Set scope Y position, offset on Y axis.
  8751. @item w
  8752. Set scope width.
  8753. @item h
  8754. Set scope height.
  8755. @item o
  8756. Set window opacity. This window also holds statistics about pixel area.
  8757. @end table
  8758. @section pp
  8759. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8760. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8761. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8762. Each subfilter and some options have a short and a long name that can be used
  8763. interchangeably, i.e. dr/dering are the same.
  8764. The filters accept the following options:
  8765. @table @option
  8766. @item subfilters
  8767. Set postprocessing subfilters string.
  8768. @end table
  8769. All subfilters share common options to determine their scope:
  8770. @table @option
  8771. @item a/autoq
  8772. Honor the quality commands for this subfilter.
  8773. @item c/chrom
  8774. Do chrominance filtering, too (default).
  8775. @item y/nochrom
  8776. Do luminance filtering only (no chrominance).
  8777. @item n/noluma
  8778. Do chrominance filtering only (no luminance).
  8779. @end table
  8780. These options can be appended after the subfilter name, separated by a '|'.
  8781. Available subfilters are:
  8782. @table @option
  8783. @item hb/hdeblock[|difference[|flatness]]
  8784. Horizontal deblocking filter
  8785. @table @option
  8786. @item difference
  8787. Difference factor where higher values mean more deblocking (default: @code{32}).
  8788. @item flatness
  8789. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8790. @end table
  8791. @item vb/vdeblock[|difference[|flatness]]
  8792. Vertical deblocking filter
  8793. @table @option
  8794. @item difference
  8795. Difference factor where higher values mean more deblocking (default: @code{32}).
  8796. @item flatness
  8797. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8798. @end table
  8799. @item ha/hadeblock[|difference[|flatness]]
  8800. Accurate horizontal deblocking filter
  8801. @table @option
  8802. @item difference
  8803. Difference factor where higher values mean more deblocking (default: @code{32}).
  8804. @item flatness
  8805. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8806. @end table
  8807. @item va/vadeblock[|difference[|flatness]]
  8808. Accurate vertical deblocking filter
  8809. @table @option
  8810. @item difference
  8811. Difference factor where higher values mean more deblocking (default: @code{32}).
  8812. @item flatness
  8813. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8814. @end table
  8815. @end table
  8816. The horizontal and vertical deblocking filters share the difference and
  8817. flatness values so you cannot set different horizontal and vertical
  8818. thresholds.
  8819. @table @option
  8820. @item h1/x1hdeblock
  8821. Experimental horizontal deblocking filter
  8822. @item v1/x1vdeblock
  8823. Experimental vertical deblocking filter
  8824. @item dr/dering
  8825. Deringing filter
  8826. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8827. @table @option
  8828. @item threshold1
  8829. larger -> stronger filtering
  8830. @item threshold2
  8831. larger -> stronger filtering
  8832. @item threshold3
  8833. larger -> stronger filtering
  8834. @end table
  8835. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8836. @table @option
  8837. @item f/fullyrange
  8838. Stretch luminance to @code{0-255}.
  8839. @end table
  8840. @item lb/linblenddeint
  8841. Linear blend deinterlacing filter that deinterlaces the given block by
  8842. filtering all lines with a @code{(1 2 1)} filter.
  8843. @item li/linipoldeint
  8844. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8845. linearly interpolating every second line.
  8846. @item ci/cubicipoldeint
  8847. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8848. cubically interpolating every second line.
  8849. @item md/mediandeint
  8850. Median deinterlacing filter that deinterlaces the given block by applying a
  8851. median filter to every second line.
  8852. @item fd/ffmpegdeint
  8853. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8854. second line with a @code{(-1 4 2 4 -1)} filter.
  8855. @item l5/lowpass5
  8856. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8857. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8858. @item fq/forceQuant[|quantizer]
  8859. Overrides the quantizer table from the input with the constant quantizer you
  8860. specify.
  8861. @table @option
  8862. @item quantizer
  8863. Quantizer to use
  8864. @end table
  8865. @item de/default
  8866. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8867. @item fa/fast
  8868. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8869. @item ac
  8870. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8871. @end table
  8872. @subsection Examples
  8873. @itemize
  8874. @item
  8875. Apply horizontal and vertical deblocking, deringing and automatic
  8876. brightness/contrast:
  8877. @example
  8878. pp=hb/vb/dr/al
  8879. @end example
  8880. @item
  8881. Apply default filters without brightness/contrast correction:
  8882. @example
  8883. pp=de/-al
  8884. @end example
  8885. @item
  8886. Apply default filters and temporal denoiser:
  8887. @example
  8888. pp=default/tmpnoise|1|2|3
  8889. @end example
  8890. @item
  8891. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8892. automatically depending on available CPU time:
  8893. @example
  8894. pp=hb|y/vb|a
  8895. @end example
  8896. @end itemize
  8897. @section pp7
  8898. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8899. similar to spp = 6 with 7 point DCT, where only the center sample is
  8900. used after IDCT.
  8901. The filter accepts the following options:
  8902. @table @option
  8903. @item qp
  8904. Force a constant quantization parameter. It accepts an integer in range
  8905. 0 to 63. If not set, the filter will use the QP from the video stream
  8906. (if available).
  8907. @item mode
  8908. Set thresholding mode. Available modes are:
  8909. @table @samp
  8910. @item hard
  8911. Set hard thresholding.
  8912. @item soft
  8913. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8914. @item medium
  8915. Set medium thresholding (good results, default).
  8916. @end table
  8917. @end table
  8918. @section premultiply
  8919. Apply alpha premultiply effect to input video stream using first plane
  8920. of second stream as alpha.
  8921. Both streams must have same dimensions and same pixel format.
  8922. The filter accepts the following option:
  8923. @table @option
  8924. @item planes
  8925. Set which planes will be processed, unprocessed planes will be copied.
  8926. By default value 0xf, all planes will be processed.
  8927. @end table
  8928. @section prewitt
  8929. Apply prewitt operator to input video stream.
  8930. The filter accepts the following option:
  8931. @table @option
  8932. @item planes
  8933. Set which planes will be processed, unprocessed planes will be copied.
  8934. By default value 0xf, all planes will be processed.
  8935. @item scale
  8936. Set value which will be multiplied with filtered result.
  8937. @item delta
  8938. Set value which will be added to filtered result.
  8939. @end table
  8940. @section psnr
  8941. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8942. Ratio) between two input videos.
  8943. This filter takes in input two input videos, the first input is
  8944. considered the "main" source and is passed unchanged to the
  8945. output. The second input is used as a "reference" video for computing
  8946. the PSNR.
  8947. Both video inputs must have the same resolution and pixel format for
  8948. this filter to work correctly. Also it assumes that both inputs
  8949. have the same number of frames, which are compared one by one.
  8950. The obtained average PSNR is printed through the logging system.
  8951. The filter stores the accumulated MSE (mean squared error) of each
  8952. frame, and at the end of the processing it is averaged across all frames
  8953. equally, and the following formula is applied to obtain the PSNR:
  8954. @example
  8955. PSNR = 10*log10(MAX^2/MSE)
  8956. @end example
  8957. Where MAX is the average of the maximum values of each component of the
  8958. image.
  8959. The description of the accepted parameters follows.
  8960. @table @option
  8961. @item stats_file, f
  8962. If specified the filter will use the named file to save the PSNR of
  8963. each individual frame. When filename equals "-" the data is sent to
  8964. standard output.
  8965. @item stats_version
  8966. Specifies which version of the stats file format to use. Details of
  8967. each format are written below.
  8968. Default value is 1.
  8969. @item stats_add_max
  8970. Determines whether the max value is output to the stats log.
  8971. Default value is 0.
  8972. Requires stats_version >= 2. If this is set and stats_version < 2,
  8973. the filter will return an error.
  8974. @end table
  8975. The file printed if @var{stats_file} is selected, contains a sequence of
  8976. key/value pairs of the form @var{key}:@var{value} for each compared
  8977. couple of frames.
  8978. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8979. the list of per-frame-pair stats, with key value pairs following the frame
  8980. format with the following parameters:
  8981. @table @option
  8982. @item psnr_log_version
  8983. The version of the log file format. Will match @var{stats_version}.
  8984. @item fields
  8985. A comma separated list of the per-frame-pair parameters included in
  8986. the log.
  8987. @end table
  8988. A description of each shown per-frame-pair parameter follows:
  8989. @table @option
  8990. @item n
  8991. sequential number of the input frame, starting from 1
  8992. @item mse_avg
  8993. Mean Square Error pixel-by-pixel average difference of the compared
  8994. frames, averaged over all the image components.
  8995. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8996. Mean Square Error pixel-by-pixel average difference of the compared
  8997. frames for the component specified by the suffix.
  8998. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8999. Peak Signal to Noise ratio of the compared frames for the component
  9000. specified by the suffix.
  9001. @item max_avg, max_y, max_u, max_v
  9002. Maximum allowed value for each channel, and average over all
  9003. channels.
  9004. @end table
  9005. For example:
  9006. @example
  9007. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9008. [main][ref] psnr="stats_file=stats.log" [out]
  9009. @end example
  9010. On this example the input file being processed is compared with the
  9011. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9012. is stored in @file{stats.log}.
  9013. @anchor{pullup}
  9014. @section pullup
  9015. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9016. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9017. content.
  9018. The pullup filter is designed to take advantage of future context in making
  9019. its decisions. This filter is stateless in the sense that it does not lock
  9020. onto a pattern to follow, but it instead looks forward to the following
  9021. fields in order to identify matches and rebuild progressive frames.
  9022. To produce content with an even framerate, insert the fps filter after
  9023. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9024. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9025. The filter accepts the following options:
  9026. @table @option
  9027. @item jl
  9028. @item jr
  9029. @item jt
  9030. @item jb
  9031. These options set the amount of "junk" to ignore at the left, right, top, and
  9032. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9033. while top and bottom are in units of 2 lines.
  9034. The default is 8 pixels on each side.
  9035. @item sb
  9036. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9037. filter generating an occasional mismatched frame, but it may also cause an
  9038. excessive number of frames to be dropped during high motion sequences.
  9039. Conversely, setting it to -1 will make filter match fields more easily.
  9040. This may help processing of video where there is slight blurring between
  9041. the fields, but may also cause there to be interlaced frames in the output.
  9042. Default value is @code{0}.
  9043. @item mp
  9044. Set the metric plane to use. It accepts the following values:
  9045. @table @samp
  9046. @item l
  9047. Use luma plane.
  9048. @item u
  9049. Use chroma blue plane.
  9050. @item v
  9051. Use chroma red plane.
  9052. @end table
  9053. This option may be set to use chroma plane instead of the default luma plane
  9054. for doing filter's computations. This may improve accuracy on very clean
  9055. source material, but more likely will decrease accuracy, especially if there
  9056. is chroma noise (rainbow effect) or any grayscale video.
  9057. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9058. load and make pullup usable in realtime on slow machines.
  9059. @end table
  9060. For best results (without duplicated frames in the output file) it is
  9061. necessary to change the output frame rate. For example, to inverse
  9062. telecine NTSC input:
  9063. @example
  9064. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9065. @end example
  9066. @section qp
  9067. Change video quantization parameters (QP).
  9068. The filter accepts the following option:
  9069. @table @option
  9070. @item qp
  9071. Set expression for quantization parameter.
  9072. @end table
  9073. The expression is evaluated through the eval API and can contain, among others,
  9074. the following constants:
  9075. @table @var
  9076. @item known
  9077. 1 if index is not 129, 0 otherwise.
  9078. @item qp
  9079. Sequentional index starting from -129 to 128.
  9080. @end table
  9081. @subsection Examples
  9082. @itemize
  9083. @item
  9084. Some equation like:
  9085. @example
  9086. qp=2+2*sin(PI*qp)
  9087. @end example
  9088. @end itemize
  9089. @section random
  9090. Flush video frames from internal cache of frames into a random order.
  9091. No frame is discarded.
  9092. Inspired by @ref{frei0r} nervous filter.
  9093. @table @option
  9094. @item frames
  9095. Set size in number of frames of internal cache, in range from @code{2} to
  9096. @code{512}. Default is @code{30}.
  9097. @item seed
  9098. Set seed for random number generator, must be an integer included between
  9099. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9100. less than @code{0}, the filter will try to use a good random seed on a
  9101. best effort basis.
  9102. @end table
  9103. @section readeia608
  9104. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9105. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9106. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9107. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9108. @table @option
  9109. @item lavfi.readeia608.X.cc
  9110. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9111. @item lavfi.readeia608.X.line
  9112. The number of the line on which the EIA-608 data was identified and read.
  9113. @end table
  9114. This filter accepts the following options:
  9115. @table @option
  9116. @item scan_min
  9117. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9118. @item scan_max
  9119. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9120. @item mac
  9121. Set minimal acceptable amplitude change for sync codes detection.
  9122. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9123. @item spw
  9124. Set the ratio of width reserved for sync code detection.
  9125. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9126. @item mhd
  9127. Set the max peaks height difference for sync code detection.
  9128. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9129. @item mpd
  9130. Set max peaks period difference for sync code detection.
  9131. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9132. @item msd
  9133. Set the first two max start code bits differences.
  9134. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9135. @item bhd
  9136. Set the minimum ratio of bits height compared to 3rd start code bit.
  9137. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9138. @item th_w
  9139. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9140. @item th_b
  9141. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9142. @item chp
  9143. Enable checking the parity bit. In the event of a parity error, the filter will output
  9144. @code{0x00} for that character. Default is false.
  9145. @end table
  9146. @subsection Examples
  9147. @itemize
  9148. @item
  9149. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9150. @example
  9151. 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
  9152. @end example
  9153. @end itemize
  9154. @section readvitc
  9155. Read vertical interval timecode (VITC) information from the top lines of a
  9156. video frame.
  9157. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9158. timecode value, if a valid timecode has been detected. Further metadata key
  9159. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9160. timecode data has been found or not.
  9161. This filter accepts the following options:
  9162. @table @option
  9163. @item scan_max
  9164. Set the maximum number of lines to scan for VITC data. If the value is set to
  9165. @code{-1} the full video frame is scanned. Default is @code{45}.
  9166. @item thr_b
  9167. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9168. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9169. @item thr_w
  9170. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9171. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9172. @end table
  9173. @subsection Examples
  9174. @itemize
  9175. @item
  9176. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9177. draw @code{--:--:--:--} as a placeholder:
  9178. @example
  9179. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9180. @end example
  9181. @end itemize
  9182. @section remap
  9183. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9184. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9185. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9186. value for pixel will be used for destination pixel.
  9187. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9188. will have Xmap/Ymap video stream dimensions.
  9189. Xmap and Ymap input video streams are 16bit depth, single channel.
  9190. @section removegrain
  9191. The removegrain filter is a spatial denoiser for progressive video.
  9192. @table @option
  9193. @item m0
  9194. Set mode for the first plane.
  9195. @item m1
  9196. Set mode for the second plane.
  9197. @item m2
  9198. Set mode for the third plane.
  9199. @item m3
  9200. Set mode for the fourth plane.
  9201. @end table
  9202. Range of mode is from 0 to 24. Description of each mode follows:
  9203. @table @var
  9204. @item 0
  9205. Leave input plane unchanged. Default.
  9206. @item 1
  9207. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9208. @item 2
  9209. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9210. @item 3
  9211. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9212. @item 4
  9213. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9214. This is equivalent to a median filter.
  9215. @item 5
  9216. Line-sensitive clipping giving the minimal change.
  9217. @item 6
  9218. Line-sensitive clipping, intermediate.
  9219. @item 7
  9220. Line-sensitive clipping, intermediate.
  9221. @item 8
  9222. Line-sensitive clipping, intermediate.
  9223. @item 9
  9224. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9225. @item 10
  9226. Replaces the target pixel with the closest neighbour.
  9227. @item 11
  9228. [1 2 1] horizontal and vertical kernel blur.
  9229. @item 12
  9230. Same as mode 11.
  9231. @item 13
  9232. Bob mode, interpolates top field from the line where the neighbours
  9233. pixels are the closest.
  9234. @item 14
  9235. Bob mode, interpolates bottom field from the line where the neighbours
  9236. pixels are the closest.
  9237. @item 15
  9238. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9239. interpolation formula.
  9240. @item 16
  9241. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9242. interpolation formula.
  9243. @item 17
  9244. Clips the pixel with the minimum and maximum of respectively the maximum and
  9245. minimum of each pair of opposite neighbour pixels.
  9246. @item 18
  9247. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9248. the current pixel is minimal.
  9249. @item 19
  9250. Replaces the pixel with the average of its 8 neighbours.
  9251. @item 20
  9252. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9253. @item 21
  9254. Clips pixels using the averages of opposite neighbour.
  9255. @item 22
  9256. Same as mode 21 but simpler and faster.
  9257. @item 23
  9258. Small edge and halo removal, but reputed useless.
  9259. @item 24
  9260. Similar as 23.
  9261. @end table
  9262. @section removelogo
  9263. Suppress a TV station logo, using an image file to determine which
  9264. pixels comprise the logo. It works by filling in the pixels that
  9265. comprise the logo with neighboring pixels.
  9266. The filter accepts the following options:
  9267. @table @option
  9268. @item filename, f
  9269. Set the filter bitmap file, which can be any image format supported by
  9270. libavformat. The width and height of the image file must match those of the
  9271. video stream being processed.
  9272. @end table
  9273. Pixels in the provided bitmap image with a value of zero are not
  9274. considered part of the logo, non-zero pixels are considered part of
  9275. the logo. If you use white (255) for the logo and black (0) for the
  9276. rest, you will be safe. For making the filter bitmap, it is
  9277. recommended to take a screen capture of a black frame with the logo
  9278. visible, and then using a threshold filter followed by the erode
  9279. filter once or twice.
  9280. If needed, little splotches can be fixed manually. Remember that if
  9281. logo pixels are not covered, the filter quality will be much
  9282. reduced. Marking too many pixels as part of the logo does not hurt as
  9283. much, but it will increase the amount of blurring needed to cover over
  9284. the image and will destroy more information than necessary, and extra
  9285. pixels will slow things down on a large logo.
  9286. @section repeatfields
  9287. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9288. fields based on its value.
  9289. @section reverse
  9290. Reverse a video clip.
  9291. Warning: This filter requires memory to buffer the entire clip, so trimming
  9292. is suggested.
  9293. @subsection Examples
  9294. @itemize
  9295. @item
  9296. Take the first 5 seconds of a clip, and reverse it.
  9297. @example
  9298. trim=end=5,reverse
  9299. @end example
  9300. @end itemize
  9301. @section roberts
  9302. Apply roberts cross operator to input video stream.
  9303. The filter accepts the following option:
  9304. @table @option
  9305. @item planes
  9306. Set which planes will be processed, unprocessed planes will be copied.
  9307. By default value 0xf, all planes will be processed.
  9308. @item scale
  9309. Set value which will be multiplied with filtered result.
  9310. @item delta
  9311. Set value which will be added to filtered result.
  9312. @end table
  9313. @section rotate
  9314. Rotate video by an arbitrary angle expressed in radians.
  9315. The filter accepts the following options:
  9316. A description of the optional parameters follows.
  9317. @table @option
  9318. @item angle, a
  9319. Set an expression for the angle by which to rotate the input video
  9320. clockwise, expressed as a number of radians. A negative value will
  9321. result in a counter-clockwise rotation. By default it is set to "0".
  9322. This expression is evaluated for each frame.
  9323. @item out_w, ow
  9324. Set the output width expression, default value is "iw".
  9325. This expression is evaluated just once during configuration.
  9326. @item out_h, oh
  9327. Set the output height expression, default value is "ih".
  9328. This expression is evaluated just once during configuration.
  9329. @item bilinear
  9330. Enable bilinear interpolation if set to 1, a value of 0 disables
  9331. it. Default value is 1.
  9332. @item fillcolor, c
  9333. Set the color used to fill the output area not covered by the rotated
  9334. image. For the general syntax of this option, check the "Color" section in the
  9335. ffmpeg-utils manual. If the special value "none" is selected then no
  9336. background is printed (useful for example if the background is never shown).
  9337. Default value is "black".
  9338. @end table
  9339. The expressions for the angle and the output size can contain the
  9340. following constants and functions:
  9341. @table @option
  9342. @item n
  9343. sequential number of the input frame, starting from 0. It is always NAN
  9344. before the first frame is filtered.
  9345. @item t
  9346. time in seconds of the input frame, it is set to 0 when the filter is
  9347. configured. It is always NAN before the first frame is filtered.
  9348. @item hsub
  9349. @item vsub
  9350. horizontal and vertical chroma subsample values. For example for the
  9351. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9352. @item in_w, iw
  9353. @item in_h, ih
  9354. the input video width and height
  9355. @item out_w, ow
  9356. @item out_h, oh
  9357. the output width and height, that is the size of the padded area as
  9358. specified by the @var{width} and @var{height} expressions
  9359. @item rotw(a)
  9360. @item roth(a)
  9361. the minimal width/height required for completely containing the input
  9362. video rotated by @var{a} radians.
  9363. These are only available when computing the @option{out_w} and
  9364. @option{out_h} expressions.
  9365. @end table
  9366. @subsection Examples
  9367. @itemize
  9368. @item
  9369. Rotate the input by PI/6 radians clockwise:
  9370. @example
  9371. rotate=PI/6
  9372. @end example
  9373. @item
  9374. Rotate the input by PI/6 radians counter-clockwise:
  9375. @example
  9376. rotate=-PI/6
  9377. @end example
  9378. @item
  9379. Rotate the input by 45 degrees clockwise:
  9380. @example
  9381. rotate=45*PI/180
  9382. @end example
  9383. @item
  9384. Apply a constant rotation with period T, starting from an angle of PI/3:
  9385. @example
  9386. rotate=PI/3+2*PI*t/T
  9387. @end example
  9388. @item
  9389. Make the input video rotation oscillating with a period of T
  9390. seconds and an amplitude of A radians:
  9391. @example
  9392. rotate=A*sin(2*PI/T*t)
  9393. @end example
  9394. @item
  9395. Rotate the video, output size is chosen so that the whole rotating
  9396. input video is always completely contained in the output:
  9397. @example
  9398. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9399. @end example
  9400. @item
  9401. Rotate the video, reduce the output size so that no background is ever
  9402. shown:
  9403. @example
  9404. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9405. @end example
  9406. @end itemize
  9407. @subsection Commands
  9408. The filter supports the following commands:
  9409. @table @option
  9410. @item a, angle
  9411. Set the angle expression.
  9412. The command accepts the same syntax of the corresponding option.
  9413. If the specified expression is not valid, it is kept at its current
  9414. value.
  9415. @end table
  9416. @section sab
  9417. Apply Shape Adaptive Blur.
  9418. The filter accepts the following options:
  9419. @table @option
  9420. @item luma_radius, lr
  9421. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9422. value is 1.0. A greater value will result in a more blurred image, and
  9423. in slower processing.
  9424. @item luma_pre_filter_radius, lpfr
  9425. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9426. value is 1.0.
  9427. @item luma_strength, ls
  9428. Set luma maximum difference between pixels to still be considered, must
  9429. be a value in the 0.1-100.0 range, default value is 1.0.
  9430. @item chroma_radius, cr
  9431. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9432. greater value will result in a more blurred image, and in slower
  9433. processing.
  9434. @item chroma_pre_filter_radius, cpfr
  9435. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9436. @item chroma_strength, cs
  9437. Set chroma maximum difference between pixels to still be considered,
  9438. must be a value in the -0.9-100.0 range.
  9439. @end table
  9440. Each chroma option value, if not explicitly specified, is set to the
  9441. corresponding luma option value.
  9442. @anchor{scale}
  9443. @section scale
  9444. Scale (resize) the input video, using the libswscale library.
  9445. The scale filter forces the output display aspect ratio to be the same
  9446. of the input, by changing the output sample aspect ratio.
  9447. If the input image format is different from the format requested by
  9448. the next filter, the scale filter will convert the input to the
  9449. requested format.
  9450. @subsection Options
  9451. The filter accepts the following options, or any of the options
  9452. supported by the libswscale scaler.
  9453. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9454. the complete list of scaler options.
  9455. @table @option
  9456. @item width, w
  9457. @item height, h
  9458. Set the output video dimension expression. Default value is the input
  9459. dimension.
  9460. If the @var{width} or @var{w} value is 0, the input width is used for
  9461. the output. If the @var{height} or @var{h} value is 0, the input height
  9462. is used for the output.
  9463. If one and only one of the values is -n with n >= 1, the scale filter
  9464. will use a value that maintains the aspect ratio of the input image,
  9465. calculated from the other specified dimension. After that it will,
  9466. however, make sure that the calculated dimension is divisible by n and
  9467. adjust the value if necessary.
  9468. If both values are -n with n >= 1, the behavior will be identical to
  9469. both values being set to 0 as previously detailed.
  9470. See below for the list of accepted constants for use in the dimension
  9471. expression.
  9472. @item eval
  9473. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9474. @table @samp
  9475. @item init
  9476. Only evaluate expressions once during the filter initialization or when a command is processed.
  9477. @item frame
  9478. Evaluate expressions for each incoming frame.
  9479. @end table
  9480. Default value is @samp{init}.
  9481. @item interl
  9482. Set the interlacing mode. It accepts the following values:
  9483. @table @samp
  9484. @item 1
  9485. Force interlaced aware scaling.
  9486. @item 0
  9487. Do not apply interlaced scaling.
  9488. @item -1
  9489. Select interlaced aware scaling depending on whether the source frames
  9490. are flagged as interlaced or not.
  9491. @end table
  9492. Default value is @samp{0}.
  9493. @item flags
  9494. Set libswscale scaling flags. See
  9495. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9496. complete list of values. If not explicitly specified the filter applies
  9497. the default flags.
  9498. @item param0, param1
  9499. Set libswscale input parameters for scaling algorithms that need them. See
  9500. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9501. complete documentation. If not explicitly specified the filter applies
  9502. empty parameters.
  9503. @item size, s
  9504. Set the video size. For the syntax of this option, check the
  9505. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9506. @item in_color_matrix
  9507. @item out_color_matrix
  9508. Set in/output YCbCr color space type.
  9509. This allows the autodetected value to be overridden as well as allows forcing
  9510. a specific value used for the output and encoder.
  9511. If not specified, the color space type depends on the pixel format.
  9512. Possible values:
  9513. @table @samp
  9514. @item auto
  9515. Choose automatically.
  9516. @item bt709
  9517. Format conforming to International Telecommunication Union (ITU)
  9518. Recommendation BT.709.
  9519. @item fcc
  9520. Set color space conforming to the United States Federal Communications
  9521. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9522. @item bt601
  9523. Set color space conforming to:
  9524. @itemize
  9525. @item
  9526. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9527. @item
  9528. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9529. @item
  9530. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9531. @end itemize
  9532. @item smpte240m
  9533. Set color space conforming to SMPTE ST 240:1999.
  9534. @end table
  9535. @item in_range
  9536. @item out_range
  9537. Set in/output YCbCr sample range.
  9538. This allows the autodetected value to be overridden as well as allows forcing
  9539. a specific value used for the output and encoder. If not specified, the
  9540. range depends on the pixel format. Possible values:
  9541. @table @samp
  9542. @item auto
  9543. Choose automatically.
  9544. @item jpeg/full/pc
  9545. Set full range (0-255 in case of 8-bit luma).
  9546. @item mpeg/tv
  9547. Set "MPEG" range (16-235 in case of 8-bit luma).
  9548. @end table
  9549. @item force_original_aspect_ratio
  9550. Enable decreasing or increasing output video width or height if necessary to
  9551. keep the original aspect ratio. Possible values:
  9552. @table @samp
  9553. @item disable
  9554. Scale the video as specified and disable this feature.
  9555. @item decrease
  9556. The output video dimensions will automatically be decreased if needed.
  9557. @item increase
  9558. The output video dimensions will automatically be increased if needed.
  9559. @end table
  9560. One useful instance of this option is that when you know a specific device's
  9561. maximum allowed resolution, you can use this to limit the output video to
  9562. that, while retaining the aspect ratio. For example, device A allows
  9563. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9564. decrease) and specifying 1280x720 to the command line makes the output
  9565. 1280x533.
  9566. Please note that this is a different thing than specifying -1 for @option{w}
  9567. or @option{h}, you still need to specify the output resolution for this option
  9568. to work.
  9569. @end table
  9570. The values of the @option{w} and @option{h} options are expressions
  9571. containing the following constants:
  9572. @table @var
  9573. @item in_w
  9574. @item in_h
  9575. The input width and height
  9576. @item iw
  9577. @item ih
  9578. These are the same as @var{in_w} and @var{in_h}.
  9579. @item out_w
  9580. @item out_h
  9581. The output (scaled) width and height
  9582. @item ow
  9583. @item oh
  9584. These are the same as @var{out_w} and @var{out_h}
  9585. @item a
  9586. The same as @var{iw} / @var{ih}
  9587. @item sar
  9588. input sample aspect ratio
  9589. @item dar
  9590. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9591. @item hsub
  9592. @item vsub
  9593. horizontal and vertical input chroma subsample values. For example for the
  9594. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9595. @item ohsub
  9596. @item ovsub
  9597. horizontal and vertical output chroma subsample values. For example for the
  9598. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9599. @end table
  9600. @subsection Examples
  9601. @itemize
  9602. @item
  9603. Scale the input video to a size of 200x100
  9604. @example
  9605. scale=w=200:h=100
  9606. @end example
  9607. This is equivalent to:
  9608. @example
  9609. scale=200:100
  9610. @end example
  9611. or:
  9612. @example
  9613. scale=200x100
  9614. @end example
  9615. @item
  9616. Specify a size abbreviation for the output size:
  9617. @example
  9618. scale=qcif
  9619. @end example
  9620. which can also be written as:
  9621. @example
  9622. scale=size=qcif
  9623. @end example
  9624. @item
  9625. Scale the input to 2x:
  9626. @example
  9627. scale=w=2*iw:h=2*ih
  9628. @end example
  9629. @item
  9630. The above is the same as:
  9631. @example
  9632. scale=2*in_w:2*in_h
  9633. @end example
  9634. @item
  9635. Scale the input to 2x with forced interlaced scaling:
  9636. @example
  9637. scale=2*iw:2*ih:interl=1
  9638. @end example
  9639. @item
  9640. Scale the input to half size:
  9641. @example
  9642. scale=w=iw/2:h=ih/2
  9643. @end example
  9644. @item
  9645. Increase the width, and set the height to the same size:
  9646. @example
  9647. scale=3/2*iw:ow
  9648. @end example
  9649. @item
  9650. Seek Greek harmony:
  9651. @example
  9652. scale=iw:1/PHI*iw
  9653. scale=ih*PHI:ih
  9654. @end example
  9655. @item
  9656. Increase the height, and set the width to 3/2 of the height:
  9657. @example
  9658. scale=w=3/2*oh:h=3/5*ih
  9659. @end example
  9660. @item
  9661. Increase the size, making the size a multiple of the chroma
  9662. subsample values:
  9663. @example
  9664. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9665. @end example
  9666. @item
  9667. Increase the width to a maximum of 500 pixels,
  9668. keeping the same aspect ratio as the input:
  9669. @example
  9670. scale=w='min(500\, iw*3/2):h=-1'
  9671. @end example
  9672. @end itemize
  9673. @subsection Commands
  9674. This filter supports the following commands:
  9675. @table @option
  9676. @item width, w
  9677. @item height, h
  9678. Set the output video dimension expression.
  9679. The command accepts the same syntax of the corresponding option.
  9680. If the specified expression is not valid, it is kept at its current
  9681. value.
  9682. @end table
  9683. @section scale_npp
  9684. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9685. format conversion on CUDA video frames. Setting the output width and height
  9686. works in the same way as for the @var{scale} filter.
  9687. The following additional options are accepted:
  9688. @table @option
  9689. @item format
  9690. The pixel format of the output CUDA frames. If set to the string "same" (the
  9691. default), the input format will be kept. Note that automatic format negotiation
  9692. and conversion is not yet supported for hardware frames
  9693. @item interp_algo
  9694. The interpolation algorithm used for resizing. One of the following:
  9695. @table @option
  9696. @item nn
  9697. Nearest neighbour.
  9698. @item linear
  9699. @item cubic
  9700. @item cubic2p_bspline
  9701. 2-parameter cubic (B=1, C=0)
  9702. @item cubic2p_catmullrom
  9703. 2-parameter cubic (B=0, C=1/2)
  9704. @item cubic2p_b05c03
  9705. 2-parameter cubic (B=1/2, C=3/10)
  9706. @item super
  9707. Supersampling
  9708. @item lanczos
  9709. @end table
  9710. @end table
  9711. @section scale2ref
  9712. Scale (resize) the input video, based on a reference video.
  9713. See the scale filter for available options, scale2ref supports the same but
  9714. uses the reference video instead of the main input as basis. scale2ref also
  9715. supports the following additional constants for the @option{w} and
  9716. @option{h} options:
  9717. @table @var
  9718. @item main_w
  9719. @item main_h
  9720. The main input video's width and height
  9721. @item main_a
  9722. The same as @var{main_w} / @var{main_h}
  9723. @item main_sar
  9724. The main input video's sample aspect ratio
  9725. @item main_dar, mdar
  9726. The main input video's display aspect ratio. Calculated from
  9727. @code{(main_w / main_h) * main_sar}.
  9728. @item main_hsub
  9729. @item main_vsub
  9730. The main input video's horizontal and vertical chroma subsample values.
  9731. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9732. is 1.
  9733. @end table
  9734. @subsection Examples
  9735. @itemize
  9736. @item
  9737. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9738. @example
  9739. 'scale2ref[b][a];[a][b]overlay'
  9740. @end example
  9741. @end itemize
  9742. @anchor{selectivecolor}
  9743. @section selectivecolor
  9744. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9745. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9746. by the "purity" of the color (that is, how saturated it already is).
  9747. This filter is similar to the Adobe Photoshop Selective Color tool.
  9748. The filter accepts the following options:
  9749. @table @option
  9750. @item correction_method
  9751. Select color correction method.
  9752. Available values are:
  9753. @table @samp
  9754. @item absolute
  9755. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9756. component value).
  9757. @item relative
  9758. Specified adjustments are relative to the original component value.
  9759. @end table
  9760. Default is @code{absolute}.
  9761. @item reds
  9762. Adjustments for red pixels (pixels where the red component is the maximum)
  9763. @item yellows
  9764. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9765. @item greens
  9766. Adjustments for green pixels (pixels where the green component is the maximum)
  9767. @item cyans
  9768. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9769. @item blues
  9770. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9771. @item magentas
  9772. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9773. @item whites
  9774. Adjustments for white pixels (pixels where all components are greater than 128)
  9775. @item neutrals
  9776. Adjustments for all pixels except pure black and pure white
  9777. @item blacks
  9778. Adjustments for black pixels (pixels where all components are lesser than 128)
  9779. @item psfile
  9780. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9781. @end table
  9782. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9783. 4 space separated floating point adjustment values in the [-1,1] range,
  9784. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9785. pixels of its range.
  9786. @subsection Examples
  9787. @itemize
  9788. @item
  9789. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9790. increase magenta by 27% in blue areas:
  9791. @example
  9792. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9793. @end example
  9794. @item
  9795. Use a Photoshop selective color preset:
  9796. @example
  9797. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9798. @end example
  9799. @end itemize
  9800. @anchor{separatefields}
  9801. @section separatefields
  9802. The @code{separatefields} takes a frame-based video input and splits
  9803. each frame into its components fields, producing a new half height clip
  9804. with twice the frame rate and twice the frame count.
  9805. This filter use field-dominance information in frame to decide which
  9806. of each pair of fields to place first in the output.
  9807. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9808. @section setdar, setsar
  9809. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9810. output video.
  9811. This is done by changing the specified Sample (aka Pixel) Aspect
  9812. Ratio, according to the following equation:
  9813. @example
  9814. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9815. @end example
  9816. Keep in mind that the @code{setdar} filter does not modify the pixel
  9817. dimensions of the video frame. Also, the display aspect ratio set by
  9818. this filter may be changed by later filters in the filterchain,
  9819. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9820. applied.
  9821. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9822. the filter output video.
  9823. Note that as a consequence of the application of this filter, the
  9824. output display aspect ratio will change according to the equation
  9825. above.
  9826. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9827. filter may be changed by later filters in the filterchain, e.g. if
  9828. another "setsar" or a "setdar" filter is applied.
  9829. It accepts the following parameters:
  9830. @table @option
  9831. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9832. Set the aspect ratio used by the filter.
  9833. The parameter can be a floating point number string, an expression, or
  9834. a string of the form @var{num}:@var{den}, where @var{num} and
  9835. @var{den} are the numerator and denominator of the aspect ratio. If
  9836. the parameter is not specified, it is assumed the value "0".
  9837. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9838. should be escaped.
  9839. @item max
  9840. Set the maximum integer value to use for expressing numerator and
  9841. denominator when reducing the expressed aspect ratio to a rational.
  9842. Default value is @code{100}.
  9843. @end table
  9844. The parameter @var{sar} is an expression containing
  9845. the following constants:
  9846. @table @option
  9847. @item E, PI, PHI
  9848. These are approximated values for the mathematical constants e
  9849. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9850. @item w, h
  9851. The input width and height.
  9852. @item a
  9853. These are the same as @var{w} / @var{h}.
  9854. @item sar
  9855. The input sample aspect ratio.
  9856. @item dar
  9857. The input display aspect ratio. It is the same as
  9858. (@var{w} / @var{h}) * @var{sar}.
  9859. @item hsub, vsub
  9860. Horizontal and vertical chroma subsample values. For example, for the
  9861. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9862. @end table
  9863. @subsection Examples
  9864. @itemize
  9865. @item
  9866. To change the display aspect ratio to 16:9, specify one of the following:
  9867. @example
  9868. setdar=dar=1.77777
  9869. setdar=dar=16/9
  9870. @end example
  9871. @item
  9872. To change the sample aspect ratio to 10:11, specify:
  9873. @example
  9874. setsar=sar=10/11
  9875. @end example
  9876. @item
  9877. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9878. 1000 in the aspect ratio reduction, use the command:
  9879. @example
  9880. setdar=ratio=16/9:max=1000
  9881. @end example
  9882. @end itemize
  9883. @anchor{setfield}
  9884. @section setfield
  9885. Force field for the output video frame.
  9886. The @code{setfield} filter marks the interlace type field for the
  9887. output frames. It does not change the input frame, but only sets the
  9888. corresponding property, which affects how the frame is treated by
  9889. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9890. The filter accepts the following options:
  9891. @table @option
  9892. @item mode
  9893. Available values are:
  9894. @table @samp
  9895. @item auto
  9896. Keep the same field property.
  9897. @item bff
  9898. Mark the frame as bottom-field-first.
  9899. @item tff
  9900. Mark the frame as top-field-first.
  9901. @item prog
  9902. Mark the frame as progressive.
  9903. @end table
  9904. @end table
  9905. @section showinfo
  9906. Show a line containing various information for each input video frame.
  9907. The input video is not modified.
  9908. The shown line contains a sequence of key/value pairs of the form
  9909. @var{key}:@var{value}.
  9910. The following values are shown in the output:
  9911. @table @option
  9912. @item n
  9913. The (sequential) number of the input frame, starting from 0.
  9914. @item pts
  9915. The Presentation TimeStamp of the input frame, expressed as a number of
  9916. time base units. The time base unit depends on the filter input pad.
  9917. @item pts_time
  9918. The Presentation TimeStamp of the input frame, expressed as a number of
  9919. seconds.
  9920. @item pos
  9921. The position of the frame in the input stream, or -1 if this information is
  9922. unavailable and/or meaningless (for example in case of synthetic video).
  9923. @item fmt
  9924. The pixel format name.
  9925. @item sar
  9926. The sample aspect ratio of the input frame, expressed in the form
  9927. @var{num}/@var{den}.
  9928. @item s
  9929. The size of the input frame. For the syntax of this option, check the
  9930. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9931. @item i
  9932. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9933. for bottom field first).
  9934. @item iskey
  9935. This is 1 if the frame is a key frame, 0 otherwise.
  9936. @item type
  9937. The picture type of the input frame ("I" for an I-frame, "P" for a
  9938. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9939. Also refer to the documentation of the @code{AVPictureType} enum and of
  9940. the @code{av_get_picture_type_char} function defined in
  9941. @file{libavutil/avutil.h}.
  9942. @item checksum
  9943. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9944. @item plane_checksum
  9945. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9946. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9947. @end table
  9948. @section showpalette
  9949. Displays the 256 colors palette of each frame. This filter is only relevant for
  9950. @var{pal8} pixel format frames.
  9951. It accepts the following option:
  9952. @table @option
  9953. @item s
  9954. Set the size of the box used to represent one palette color entry. Default is
  9955. @code{30} (for a @code{30x30} pixel box).
  9956. @end table
  9957. @section shuffleframes
  9958. Reorder and/or duplicate and/or drop video frames.
  9959. It accepts the following parameters:
  9960. @table @option
  9961. @item mapping
  9962. Set the destination indexes of input frames.
  9963. This is space or '|' separated list of indexes that maps input frames to output
  9964. frames. Number of indexes also sets maximal value that each index may have.
  9965. '-1' index have special meaning and that is to drop frame.
  9966. @end table
  9967. The first frame has the index 0. The default is to keep the input unchanged.
  9968. @subsection Examples
  9969. @itemize
  9970. @item
  9971. Swap second and third frame of every three frames of the input:
  9972. @example
  9973. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9974. @end example
  9975. @item
  9976. Swap 10th and 1st frame of every ten frames of the input:
  9977. @example
  9978. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9979. @end example
  9980. @end itemize
  9981. @section shuffleplanes
  9982. Reorder and/or duplicate video planes.
  9983. It accepts the following parameters:
  9984. @table @option
  9985. @item map0
  9986. The index of the input plane to be used as the first output plane.
  9987. @item map1
  9988. The index of the input plane to be used as the second output plane.
  9989. @item map2
  9990. The index of the input plane to be used as the third output plane.
  9991. @item map3
  9992. The index of the input plane to be used as the fourth output plane.
  9993. @end table
  9994. The first plane has the index 0. The default is to keep the input unchanged.
  9995. @subsection Examples
  9996. @itemize
  9997. @item
  9998. Swap the second and third planes of the input:
  9999. @example
  10000. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10001. @end example
  10002. @end itemize
  10003. @anchor{signalstats}
  10004. @section signalstats
  10005. Evaluate various visual metrics that assist in determining issues associated
  10006. with the digitization of analog video media.
  10007. By default the filter will log these metadata values:
  10008. @table @option
  10009. @item YMIN
  10010. Display the minimal Y value contained within the input frame. Expressed in
  10011. range of [0-255].
  10012. @item YLOW
  10013. Display the Y value at the 10% percentile within the input frame. Expressed in
  10014. range of [0-255].
  10015. @item YAVG
  10016. Display the average Y value within the input frame. Expressed in range of
  10017. [0-255].
  10018. @item YHIGH
  10019. Display the Y value at the 90% percentile within the input frame. Expressed in
  10020. range of [0-255].
  10021. @item YMAX
  10022. Display the maximum Y value contained within the input frame. Expressed in
  10023. range of [0-255].
  10024. @item UMIN
  10025. Display the minimal U value contained within the input frame. Expressed in
  10026. range of [0-255].
  10027. @item ULOW
  10028. Display the U value at the 10% percentile within the input frame. Expressed in
  10029. range of [0-255].
  10030. @item UAVG
  10031. Display the average U value within the input frame. Expressed in range of
  10032. [0-255].
  10033. @item UHIGH
  10034. Display the U value at the 90% percentile within the input frame. Expressed in
  10035. range of [0-255].
  10036. @item UMAX
  10037. Display the maximum U value contained within the input frame. Expressed in
  10038. range of [0-255].
  10039. @item VMIN
  10040. Display the minimal V value contained within the input frame. Expressed in
  10041. range of [0-255].
  10042. @item VLOW
  10043. Display the V value at the 10% percentile within the input frame. Expressed in
  10044. range of [0-255].
  10045. @item VAVG
  10046. Display the average V value within the input frame. Expressed in range of
  10047. [0-255].
  10048. @item VHIGH
  10049. Display the V value at the 90% percentile within the input frame. Expressed in
  10050. range of [0-255].
  10051. @item VMAX
  10052. Display the maximum V value contained within the input frame. Expressed in
  10053. range of [0-255].
  10054. @item SATMIN
  10055. Display the minimal saturation value contained within the input frame.
  10056. Expressed in range of [0-~181.02].
  10057. @item SATLOW
  10058. Display the saturation value at the 10% percentile within the input frame.
  10059. Expressed in range of [0-~181.02].
  10060. @item SATAVG
  10061. Display the average saturation value within the input frame. Expressed in range
  10062. of [0-~181.02].
  10063. @item SATHIGH
  10064. Display the saturation value at the 90% percentile within the input frame.
  10065. Expressed in range of [0-~181.02].
  10066. @item SATMAX
  10067. Display the maximum saturation value contained within the input frame.
  10068. Expressed in range of [0-~181.02].
  10069. @item HUEMED
  10070. Display the median value for hue within the input frame. Expressed in range of
  10071. [0-360].
  10072. @item HUEAVG
  10073. Display the average value for hue within the input frame. Expressed in range of
  10074. [0-360].
  10075. @item YDIF
  10076. Display the average of sample value difference between all values of the Y
  10077. plane in the current frame and corresponding values of the previous input frame.
  10078. Expressed in range of [0-255].
  10079. @item UDIF
  10080. Display the average of sample value difference between all values of the U
  10081. plane in the current frame and corresponding values of the previous input frame.
  10082. Expressed in range of [0-255].
  10083. @item VDIF
  10084. Display the average of sample value difference between all values of the V
  10085. plane in the current frame and corresponding values of the previous input frame.
  10086. Expressed in range of [0-255].
  10087. @item YBITDEPTH
  10088. Display bit depth of Y plane in current frame.
  10089. Expressed in range of [0-16].
  10090. @item UBITDEPTH
  10091. Display bit depth of U plane in current frame.
  10092. Expressed in range of [0-16].
  10093. @item VBITDEPTH
  10094. Display bit depth of V plane in current frame.
  10095. Expressed in range of [0-16].
  10096. @end table
  10097. The filter accepts the following options:
  10098. @table @option
  10099. @item stat
  10100. @item out
  10101. @option{stat} specify an additional form of image analysis.
  10102. @option{out} output video with the specified type of pixel highlighted.
  10103. Both options accept the following values:
  10104. @table @samp
  10105. @item tout
  10106. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10107. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10108. include the results of video dropouts, head clogs, or tape tracking issues.
  10109. @item vrep
  10110. Identify @var{vertical line repetition}. Vertical line repetition includes
  10111. similar rows of pixels within a frame. In born-digital video vertical line
  10112. repetition is common, but this pattern is uncommon in video digitized from an
  10113. analog source. When it occurs in video that results from the digitization of an
  10114. analog source it can indicate concealment from a dropout compensator.
  10115. @item brng
  10116. Identify pixels that fall outside of legal broadcast range.
  10117. @end table
  10118. @item color, c
  10119. Set the highlight color for the @option{out} option. The default color is
  10120. yellow.
  10121. @end table
  10122. @subsection Examples
  10123. @itemize
  10124. @item
  10125. Output data of various video metrics:
  10126. @example
  10127. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10128. @end example
  10129. @item
  10130. Output specific data about the minimum and maximum values of the Y plane per frame:
  10131. @example
  10132. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10133. @end example
  10134. @item
  10135. Playback video while highlighting pixels that are outside of broadcast range in red.
  10136. @example
  10137. ffplay example.mov -vf signalstats="out=brng:color=red"
  10138. @end example
  10139. @item
  10140. Playback video with signalstats metadata drawn over the frame.
  10141. @example
  10142. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10143. @end example
  10144. The contents of signalstat_drawtext.txt used in the command are:
  10145. @example
  10146. time %@{pts:hms@}
  10147. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10148. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10149. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10150. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10151. @end example
  10152. @end itemize
  10153. @anchor{signature}
  10154. @section signature
  10155. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10156. input. In this case the matching between the inputs can be calculated additionally.
  10157. The filter always passes through the first input. The signature of each stream can
  10158. be written into a file.
  10159. It accepts the following options:
  10160. @table @option
  10161. @item detectmode
  10162. Enable or disable the matching process.
  10163. Available values are:
  10164. @table @samp
  10165. @item off
  10166. Disable the calculation of a matching (default).
  10167. @item full
  10168. Calculate the matching for the whole video and output whether the whole video
  10169. matches or only parts.
  10170. @item fast
  10171. Calculate only until a matching is found or the video ends. Should be faster in
  10172. some cases.
  10173. @end table
  10174. @item nb_inputs
  10175. Set the number of inputs. The option value must be a non negative integer.
  10176. Default value is 1.
  10177. @item filename
  10178. Set the path to which the output is written. If there is more than one input,
  10179. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10180. integer), that will be replaced with the input number. If no filename is
  10181. specified, no output will be written. This is the default.
  10182. @item format
  10183. Choose the output format.
  10184. Available values are:
  10185. @table @samp
  10186. @item binary
  10187. Use the specified binary representation (default).
  10188. @item xml
  10189. Use the specified xml representation.
  10190. @end table
  10191. @item th_d
  10192. Set threshold to detect one word as similar. The option value must be an integer
  10193. greater than zero. The default value is 9000.
  10194. @item th_dc
  10195. Set threshold to detect all words as similar. The option value must be an integer
  10196. greater than zero. The default value is 60000.
  10197. @item th_xh
  10198. Set threshold to detect frames as similar. The option value must be an integer
  10199. greater than zero. The default value is 116.
  10200. @item th_di
  10201. Set the minimum length of a sequence in frames to recognize it as matching
  10202. sequence. The option value must be a non negative integer value.
  10203. The default value is 0.
  10204. @item th_it
  10205. Set the minimum relation, that matching frames to all frames must have.
  10206. The option value must be a double value between 0 and 1. The default value is 0.5.
  10207. @end table
  10208. @subsection Examples
  10209. @itemize
  10210. @item
  10211. To calculate the signature of an input video and store it in signature.bin:
  10212. @example
  10213. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10214. @end example
  10215. @item
  10216. To detect whether two videos match and store the signatures in XML format in
  10217. signature0.xml and signature1.xml:
  10218. @example
  10219. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  10220. @end example
  10221. @end itemize
  10222. @anchor{smartblur}
  10223. @section smartblur
  10224. Blur the input video without impacting the outlines.
  10225. It accepts the following options:
  10226. @table @option
  10227. @item luma_radius, lr
  10228. Set the luma radius. The option value must be a float number in
  10229. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10230. used to blur the image (slower if larger). Default value is 1.0.
  10231. @item luma_strength, ls
  10232. Set the luma strength. The option value must be a float number
  10233. in the range [-1.0,1.0] that configures the blurring. A value included
  10234. in [0.0,1.0] will blur the image whereas a value included in
  10235. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10236. @item luma_threshold, lt
  10237. Set the luma threshold used as a coefficient to determine
  10238. whether a pixel should be blurred or not. The option value must be an
  10239. integer in the range [-30,30]. A value of 0 will filter all the image,
  10240. a value included in [0,30] will filter flat areas and a value included
  10241. in [-30,0] will filter edges. Default value is 0.
  10242. @item chroma_radius, cr
  10243. Set the chroma radius. The option value must be a float number in
  10244. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10245. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10246. @item chroma_strength, cs
  10247. Set the chroma strength. The option value must be a float number
  10248. in the range [-1.0,1.0] that configures the blurring. A value included
  10249. in [0.0,1.0] will blur the image whereas a value included in
  10250. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10251. @item chroma_threshold, ct
  10252. Set the chroma threshold used as a coefficient to determine
  10253. whether a pixel should be blurred or not. The option value must be an
  10254. integer in the range [-30,30]. A value of 0 will filter all the image,
  10255. a value included in [0,30] will filter flat areas and a value included
  10256. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10257. @end table
  10258. If a chroma option is not explicitly set, the corresponding luma value
  10259. is set.
  10260. @section ssim
  10261. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10262. This filter takes in input two input videos, the first input is
  10263. considered the "main" source and is passed unchanged to the
  10264. output. The second input is used as a "reference" video for computing
  10265. the SSIM.
  10266. Both video inputs must have the same resolution and pixel format for
  10267. this filter to work correctly. Also it assumes that both inputs
  10268. have the same number of frames, which are compared one by one.
  10269. The filter stores the calculated SSIM of each frame.
  10270. The description of the accepted parameters follows.
  10271. @table @option
  10272. @item stats_file, f
  10273. If specified the filter will use the named file to save the SSIM of
  10274. each individual frame. When filename equals "-" the data is sent to
  10275. standard output.
  10276. @end table
  10277. The file printed if @var{stats_file} is selected, contains a sequence of
  10278. key/value pairs of the form @var{key}:@var{value} for each compared
  10279. couple of frames.
  10280. A description of each shown parameter follows:
  10281. @table @option
  10282. @item n
  10283. sequential number of the input frame, starting from 1
  10284. @item Y, U, V, R, G, B
  10285. SSIM of the compared frames for the component specified by the suffix.
  10286. @item All
  10287. SSIM of the compared frames for the whole frame.
  10288. @item dB
  10289. Same as above but in dB representation.
  10290. @end table
  10291. For example:
  10292. @example
  10293. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10294. [main][ref] ssim="stats_file=stats.log" [out]
  10295. @end example
  10296. On this example the input file being processed is compared with the
  10297. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10298. is stored in @file{stats.log}.
  10299. Another example with both psnr and ssim at same time:
  10300. @example
  10301. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10302. @end example
  10303. @section stereo3d
  10304. Convert between different stereoscopic image formats.
  10305. The filters accept the following options:
  10306. @table @option
  10307. @item in
  10308. Set stereoscopic image format of input.
  10309. Available values for input image formats are:
  10310. @table @samp
  10311. @item sbsl
  10312. side by side parallel (left eye left, right eye right)
  10313. @item sbsr
  10314. side by side crosseye (right eye left, left eye right)
  10315. @item sbs2l
  10316. side by side parallel with half width resolution
  10317. (left eye left, right eye right)
  10318. @item sbs2r
  10319. side by side crosseye with half width resolution
  10320. (right eye left, left eye right)
  10321. @item abl
  10322. above-below (left eye above, right eye below)
  10323. @item abr
  10324. above-below (right eye above, left eye below)
  10325. @item ab2l
  10326. above-below with half height resolution
  10327. (left eye above, right eye below)
  10328. @item ab2r
  10329. above-below with half height resolution
  10330. (right eye above, left eye below)
  10331. @item al
  10332. alternating frames (left eye first, right eye second)
  10333. @item ar
  10334. alternating frames (right eye first, left eye second)
  10335. @item irl
  10336. interleaved rows (left eye has top row, right eye starts on next row)
  10337. @item irr
  10338. interleaved rows (right eye has top row, left eye starts on next row)
  10339. @item icl
  10340. interleaved columns, left eye first
  10341. @item icr
  10342. interleaved columns, right eye first
  10343. Default value is @samp{sbsl}.
  10344. @end table
  10345. @item out
  10346. Set stereoscopic image format of output.
  10347. @table @samp
  10348. @item sbsl
  10349. side by side parallel (left eye left, right eye right)
  10350. @item sbsr
  10351. side by side crosseye (right eye left, left eye right)
  10352. @item sbs2l
  10353. side by side parallel with half width resolution
  10354. (left eye left, right eye right)
  10355. @item sbs2r
  10356. side by side crosseye with half width resolution
  10357. (right eye left, left eye right)
  10358. @item abl
  10359. above-below (left eye above, right eye below)
  10360. @item abr
  10361. above-below (right eye above, left eye below)
  10362. @item ab2l
  10363. above-below with half height resolution
  10364. (left eye above, right eye below)
  10365. @item ab2r
  10366. above-below with half height resolution
  10367. (right eye above, left eye below)
  10368. @item al
  10369. alternating frames (left eye first, right eye second)
  10370. @item ar
  10371. alternating frames (right eye first, left eye second)
  10372. @item irl
  10373. interleaved rows (left eye has top row, right eye starts on next row)
  10374. @item irr
  10375. interleaved rows (right eye has top row, left eye starts on next row)
  10376. @item arbg
  10377. anaglyph red/blue gray
  10378. (red filter on left eye, blue filter on right eye)
  10379. @item argg
  10380. anaglyph red/green gray
  10381. (red filter on left eye, green filter on right eye)
  10382. @item arcg
  10383. anaglyph red/cyan gray
  10384. (red filter on left eye, cyan filter on right eye)
  10385. @item arch
  10386. anaglyph red/cyan half colored
  10387. (red filter on left eye, cyan filter on right eye)
  10388. @item arcc
  10389. anaglyph red/cyan color
  10390. (red filter on left eye, cyan filter on right eye)
  10391. @item arcd
  10392. anaglyph red/cyan color optimized with the least squares projection of dubois
  10393. (red filter on left eye, cyan filter on right eye)
  10394. @item agmg
  10395. anaglyph green/magenta gray
  10396. (green filter on left eye, magenta filter on right eye)
  10397. @item agmh
  10398. anaglyph green/magenta half colored
  10399. (green filter on left eye, magenta filter on right eye)
  10400. @item agmc
  10401. anaglyph green/magenta colored
  10402. (green filter on left eye, magenta filter on right eye)
  10403. @item agmd
  10404. anaglyph green/magenta color optimized with the least squares projection of dubois
  10405. (green filter on left eye, magenta filter on right eye)
  10406. @item aybg
  10407. anaglyph yellow/blue gray
  10408. (yellow filter on left eye, blue filter on right eye)
  10409. @item aybh
  10410. anaglyph yellow/blue half colored
  10411. (yellow filter on left eye, blue filter on right eye)
  10412. @item aybc
  10413. anaglyph yellow/blue colored
  10414. (yellow filter on left eye, blue filter on right eye)
  10415. @item aybd
  10416. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10417. (yellow filter on left eye, blue filter on right eye)
  10418. @item ml
  10419. mono output (left eye only)
  10420. @item mr
  10421. mono output (right eye only)
  10422. @item chl
  10423. checkerboard, left eye first
  10424. @item chr
  10425. checkerboard, right eye first
  10426. @item icl
  10427. interleaved columns, left eye first
  10428. @item icr
  10429. interleaved columns, right eye first
  10430. @item hdmi
  10431. HDMI frame pack
  10432. @end table
  10433. Default value is @samp{arcd}.
  10434. @end table
  10435. @subsection Examples
  10436. @itemize
  10437. @item
  10438. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10439. @example
  10440. stereo3d=sbsl:aybd
  10441. @end example
  10442. @item
  10443. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10444. @example
  10445. stereo3d=abl:sbsr
  10446. @end example
  10447. @end itemize
  10448. @section streamselect, astreamselect
  10449. Select video or audio streams.
  10450. The filter accepts the following options:
  10451. @table @option
  10452. @item inputs
  10453. Set number of inputs. Default is 2.
  10454. @item map
  10455. Set input indexes to remap to outputs.
  10456. @end table
  10457. @subsection Commands
  10458. The @code{streamselect} and @code{astreamselect} filter supports the following
  10459. commands:
  10460. @table @option
  10461. @item map
  10462. Set input indexes to remap to outputs.
  10463. @end table
  10464. @subsection Examples
  10465. @itemize
  10466. @item
  10467. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10468. @example
  10469. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10470. @end example
  10471. @item
  10472. Same as above, but for audio:
  10473. @example
  10474. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10475. @end example
  10476. @end itemize
  10477. @section sobel
  10478. Apply sobel operator to input video stream.
  10479. The filter accepts the following option:
  10480. @table @option
  10481. @item planes
  10482. Set which planes will be processed, unprocessed planes will be copied.
  10483. By default value 0xf, all planes will be processed.
  10484. @item scale
  10485. Set value which will be multiplied with filtered result.
  10486. @item delta
  10487. Set value which will be added to filtered result.
  10488. @end table
  10489. @anchor{spp}
  10490. @section spp
  10491. Apply a simple postprocessing filter that compresses and decompresses the image
  10492. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10493. and average the results.
  10494. The filter accepts the following options:
  10495. @table @option
  10496. @item quality
  10497. Set quality. This option defines the number of levels for averaging. It accepts
  10498. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10499. effect. A value of @code{6} means the higher quality. For each increment of
  10500. that value the speed drops by a factor of approximately 2. Default value is
  10501. @code{3}.
  10502. @item qp
  10503. Force a constant quantization parameter. If not set, the filter will use the QP
  10504. from the video stream (if available).
  10505. @item mode
  10506. Set thresholding mode. Available modes are:
  10507. @table @samp
  10508. @item hard
  10509. Set hard thresholding (default).
  10510. @item soft
  10511. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10512. @end table
  10513. @item use_bframe_qp
  10514. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10515. option may cause flicker since the B-Frames have often larger QP. Default is
  10516. @code{0} (not enabled).
  10517. @end table
  10518. @anchor{subtitles}
  10519. @section subtitles
  10520. Draw subtitles on top of input video using the libass library.
  10521. To enable compilation of this filter you need to configure FFmpeg with
  10522. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10523. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10524. Alpha) subtitles format.
  10525. The filter accepts the following options:
  10526. @table @option
  10527. @item filename, f
  10528. Set the filename of the subtitle file to read. It must be specified.
  10529. @item original_size
  10530. Specify the size of the original video, the video for which the ASS file
  10531. was composed. For the syntax of this option, check the
  10532. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10533. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10534. correctly scale the fonts if the aspect ratio has been changed.
  10535. @item fontsdir
  10536. Set a directory path containing fonts that can be used by the filter.
  10537. These fonts will be used in addition to whatever the font provider uses.
  10538. @item charenc
  10539. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10540. useful if not UTF-8.
  10541. @item stream_index, si
  10542. Set subtitles stream index. @code{subtitles} filter only.
  10543. @item force_style
  10544. Override default style or script info parameters of the subtitles. It accepts a
  10545. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10546. @end table
  10547. If the first key is not specified, it is assumed that the first value
  10548. specifies the @option{filename}.
  10549. For example, to render the file @file{sub.srt} on top of the input
  10550. video, use the command:
  10551. @example
  10552. subtitles=sub.srt
  10553. @end example
  10554. which is equivalent to:
  10555. @example
  10556. subtitles=filename=sub.srt
  10557. @end example
  10558. To render the default subtitles stream from file @file{video.mkv}, use:
  10559. @example
  10560. subtitles=video.mkv
  10561. @end example
  10562. To render the second subtitles stream from that file, use:
  10563. @example
  10564. subtitles=video.mkv:si=1
  10565. @end example
  10566. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10567. @code{DejaVu Serif}, use:
  10568. @example
  10569. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10570. @end example
  10571. @section super2xsai
  10572. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10573. Interpolate) pixel art scaling algorithm.
  10574. Useful for enlarging pixel art images without reducing sharpness.
  10575. @section swaprect
  10576. Swap two rectangular objects in video.
  10577. This filter accepts the following options:
  10578. @table @option
  10579. @item w
  10580. Set object width.
  10581. @item h
  10582. Set object height.
  10583. @item x1
  10584. Set 1st rect x coordinate.
  10585. @item y1
  10586. Set 1st rect y coordinate.
  10587. @item x2
  10588. Set 2nd rect x coordinate.
  10589. @item y2
  10590. Set 2nd rect y coordinate.
  10591. All expressions are evaluated once for each frame.
  10592. @end table
  10593. The all options are expressions containing the following constants:
  10594. @table @option
  10595. @item w
  10596. @item h
  10597. The input width and height.
  10598. @item a
  10599. same as @var{w} / @var{h}
  10600. @item sar
  10601. input sample aspect ratio
  10602. @item dar
  10603. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10604. @item n
  10605. The number of the input frame, starting from 0.
  10606. @item t
  10607. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10608. @item pos
  10609. the position in the file of the input frame, NAN if unknown
  10610. @end table
  10611. @section swapuv
  10612. Swap U & V plane.
  10613. @section telecine
  10614. Apply telecine process to the video.
  10615. This filter accepts the following options:
  10616. @table @option
  10617. @item first_field
  10618. @table @samp
  10619. @item top, t
  10620. top field first
  10621. @item bottom, b
  10622. bottom field first
  10623. The default value is @code{top}.
  10624. @end table
  10625. @item pattern
  10626. A string of numbers representing the pulldown pattern you wish to apply.
  10627. The default value is @code{23}.
  10628. @end table
  10629. @example
  10630. Some typical patterns:
  10631. NTSC output (30i):
  10632. 27.5p: 32222
  10633. 24p: 23 (classic)
  10634. 24p: 2332 (preferred)
  10635. 20p: 33
  10636. 18p: 334
  10637. 16p: 3444
  10638. PAL output (25i):
  10639. 27.5p: 12222
  10640. 24p: 222222222223 ("Euro pulldown")
  10641. 16.67p: 33
  10642. 16p: 33333334
  10643. @end example
  10644. @section threshold
  10645. Apply threshold effect to video stream.
  10646. This filter needs four video streams to perform thresholding.
  10647. First stream is stream we are filtering.
  10648. Second stream is holding threshold values, third stream is holding min values,
  10649. and last, fourth stream is holding max values.
  10650. The filter accepts the following option:
  10651. @table @option
  10652. @item planes
  10653. Set which planes will be processed, unprocessed planes will be copied.
  10654. By default value 0xf, all planes will be processed.
  10655. @end table
  10656. For example if first stream pixel's component value is less then threshold value
  10657. of pixel component from 2nd threshold stream, third stream value will picked,
  10658. otherwise fourth stream pixel component value will be picked.
  10659. Using color source filter one can perform various types of thresholding:
  10660. @subsection Examples
  10661. @itemize
  10662. @item
  10663. Binary threshold, using gray color as threshold:
  10664. @example
  10665. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10666. @end example
  10667. @item
  10668. Inverted binary threshold, using gray color as threshold:
  10669. @example
  10670. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10671. @end example
  10672. @item
  10673. Truncate binary threshold, using gray color as threshold:
  10674. @example
  10675. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10676. @end example
  10677. @item
  10678. Threshold to zero, using gray color as threshold:
  10679. @example
  10680. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10681. @end example
  10682. @item
  10683. Inverted threshold to zero, using gray color as threshold:
  10684. @example
  10685. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10686. @end example
  10687. @end itemize
  10688. @section thumbnail
  10689. Select the most representative frame in a given sequence of consecutive frames.
  10690. The filter accepts the following options:
  10691. @table @option
  10692. @item n
  10693. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10694. will pick one of them, and then handle the next batch of @var{n} frames until
  10695. the end. Default is @code{100}.
  10696. @end table
  10697. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10698. value will result in a higher memory usage, so a high value is not recommended.
  10699. @subsection Examples
  10700. @itemize
  10701. @item
  10702. Extract one picture each 50 frames:
  10703. @example
  10704. thumbnail=50
  10705. @end example
  10706. @item
  10707. Complete example of a thumbnail creation with @command{ffmpeg}:
  10708. @example
  10709. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10710. @end example
  10711. @end itemize
  10712. @section tile
  10713. Tile several successive frames together.
  10714. The filter accepts the following options:
  10715. @table @option
  10716. @item layout
  10717. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10718. this option, check the
  10719. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10720. @item nb_frames
  10721. Set the maximum number of frames to render in the given area. It must be less
  10722. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10723. the area will be used.
  10724. @item margin
  10725. Set the outer border margin in pixels.
  10726. @item padding
  10727. Set the inner border thickness (i.e. the number of pixels between frames). For
  10728. more advanced padding options (such as having different values for the edges),
  10729. refer to the pad video filter.
  10730. @item color
  10731. Specify the color of the unused area. For the syntax of this option, check the
  10732. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10733. is "black".
  10734. @end table
  10735. @subsection Examples
  10736. @itemize
  10737. @item
  10738. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10739. @example
  10740. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10741. @end example
  10742. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10743. duplicating each output frame to accommodate the originally detected frame
  10744. rate.
  10745. @item
  10746. Display @code{5} pictures in an area of @code{3x2} frames,
  10747. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10748. mixed flat and named options:
  10749. @example
  10750. tile=3x2:nb_frames=5:padding=7:margin=2
  10751. @end example
  10752. @end itemize
  10753. @section tinterlace
  10754. Perform various types of temporal field interlacing.
  10755. Frames are counted starting from 1, so the first input frame is
  10756. considered odd.
  10757. The filter accepts the following options:
  10758. @table @option
  10759. @item mode
  10760. Specify the mode of the interlacing. This option can also be specified
  10761. as a value alone. See below for a list of values for this option.
  10762. Available values are:
  10763. @table @samp
  10764. @item merge, 0
  10765. Move odd frames into the upper field, even into the lower field,
  10766. generating a double height frame at half frame rate.
  10767. @example
  10768. ------> time
  10769. Input:
  10770. Frame 1 Frame 2 Frame 3 Frame 4
  10771. 11111 22222 33333 44444
  10772. 11111 22222 33333 44444
  10773. 11111 22222 33333 44444
  10774. 11111 22222 33333 44444
  10775. Output:
  10776. 11111 33333
  10777. 22222 44444
  10778. 11111 33333
  10779. 22222 44444
  10780. 11111 33333
  10781. 22222 44444
  10782. 11111 33333
  10783. 22222 44444
  10784. @end example
  10785. @item drop_even, 1
  10786. Only output odd frames, even frames are dropped, generating a frame with
  10787. unchanged height at half frame rate.
  10788. @example
  10789. ------> time
  10790. Input:
  10791. Frame 1 Frame 2 Frame 3 Frame 4
  10792. 11111 22222 33333 44444
  10793. 11111 22222 33333 44444
  10794. 11111 22222 33333 44444
  10795. 11111 22222 33333 44444
  10796. Output:
  10797. 11111 33333
  10798. 11111 33333
  10799. 11111 33333
  10800. 11111 33333
  10801. @end example
  10802. @item drop_odd, 2
  10803. Only output even frames, odd frames are dropped, generating a frame with
  10804. unchanged height at half frame rate.
  10805. @example
  10806. ------> time
  10807. Input:
  10808. Frame 1 Frame 2 Frame 3 Frame 4
  10809. 11111 22222 33333 44444
  10810. 11111 22222 33333 44444
  10811. 11111 22222 33333 44444
  10812. 11111 22222 33333 44444
  10813. Output:
  10814. 22222 44444
  10815. 22222 44444
  10816. 22222 44444
  10817. 22222 44444
  10818. @end example
  10819. @item pad, 3
  10820. Expand each frame to full height, but pad alternate lines with black,
  10821. generating a frame with double height at the same input frame rate.
  10822. @example
  10823. ------> time
  10824. Input:
  10825. Frame 1 Frame 2 Frame 3 Frame 4
  10826. 11111 22222 33333 44444
  10827. 11111 22222 33333 44444
  10828. 11111 22222 33333 44444
  10829. 11111 22222 33333 44444
  10830. Output:
  10831. 11111 ..... 33333 .....
  10832. ..... 22222 ..... 44444
  10833. 11111 ..... 33333 .....
  10834. ..... 22222 ..... 44444
  10835. 11111 ..... 33333 .....
  10836. ..... 22222 ..... 44444
  10837. 11111 ..... 33333 .....
  10838. ..... 22222 ..... 44444
  10839. @end example
  10840. @item interleave_top, 4
  10841. Interleave the upper field from odd frames with the lower field from
  10842. even frames, generating a frame with unchanged height at half frame rate.
  10843. @example
  10844. ------> time
  10845. Input:
  10846. Frame 1 Frame 2 Frame 3 Frame 4
  10847. 11111<- 22222 33333<- 44444
  10848. 11111 22222<- 33333 44444<-
  10849. 11111<- 22222 33333<- 44444
  10850. 11111 22222<- 33333 44444<-
  10851. Output:
  10852. 11111 33333
  10853. 22222 44444
  10854. 11111 33333
  10855. 22222 44444
  10856. @end example
  10857. @item interleave_bottom, 5
  10858. Interleave the lower field from odd frames with the upper field from
  10859. even frames, generating a frame with unchanged height at half frame rate.
  10860. @example
  10861. ------> time
  10862. Input:
  10863. Frame 1 Frame 2 Frame 3 Frame 4
  10864. 11111 22222<- 33333 44444<-
  10865. 11111<- 22222 33333<- 44444
  10866. 11111 22222<- 33333 44444<-
  10867. 11111<- 22222 33333<- 44444
  10868. Output:
  10869. 22222 44444
  10870. 11111 33333
  10871. 22222 44444
  10872. 11111 33333
  10873. @end example
  10874. @item interlacex2, 6
  10875. Double frame rate with unchanged height. Frames are inserted each
  10876. containing the second temporal field from the previous input frame and
  10877. the first temporal field from the next input frame. This mode relies on
  10878. the top_field_first flag. Useful for interlaced video displays with no
  10879. field synchronisation.
  10880. @example
  10881. ------> time
  10882. Input:
  10883. Frame 1 Frame 2 Frame 3 Frame 4
  10884. 11111 22222 33333 44444
  10885. 11111 22222 33333 44444
  10886. 11111 22222 33333 44444
  10887. 11111 22222 33333 44444
  10888. Output:
  10889. 11111 22222 22222 33333 33333 44444 44444
  10890. 11111 11111 22222 22222 33333 33333 44444
  10891. 11111 22222 22222 33333 33333 44444 44444
  10892. 11111 11111 22222 22222 33333 33333 44444
  10893. @end example
  10894. @item mergex2, 7
  10895. Move odd frames into the upper field, even into the lower field,
  10896. generating a double height frame at same frame rate.
  10897. @example
  10898. ------> time
  10899. Input:
  10900. Frame 1 Frame 2 Frame 3 Frame 4
  10901. 11111 22222 33333 44444
  10902. 11111 22222 33333 44444
  10903. 11111 22222 33333 44444
  10904. 11111 22222 33333 44444
  10905. Output:
  10906. 11111 33333 33333 55555
  10907. 22222 22222 44444 44444
  10908. 11111 33333 33333 55555
  10909. 22222 22222 44444 44444
  10910. 11111 33333 33333 55555
  10911. 22222 22222 44444 44444
  10912. 11111 33333 33333 55555
  10913. 22222 22222 44444 44444
  10914. @end example
  10915. @end table
  10916. Numeric values are deprecated but are accepted for backward
  10917. compatibility reasons.
  10918. Default mode is @code{merge}.
  10919. @item flags
  10920. Specify flags influencing the filter process.
  10921. Available value for @var{flags} is:
  10922. @table @option
  10923. @item low_pass_filter, vlfp
  10924. Enable linear vertical low-pass filtering in the filter.
  10925. Vertical low-pass filtering is required when creating an interlaced
  10926. destination from a progressive source which contains high-frequency
  10927. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10928. patterning.
  10929. @item complex_filter, cvlfp
  10930. Enable complex vertical low-pass filtering.
  10931. This will slightly less reduce interlace 'twitter' and Moire
  10932. patterning but better retain detail and subjective sharpness impression.
  10933. @end table
  10934. Vertical low-pass filtering can only be enabled for @option{mode}
  10935. @var{interleave_top} and @var{interleave_bottom}.
  10936. @end table
  10937. @section transpose
  10938. Transpose rows with columns in the input video and optionally flip it.
  10939. It accepts the following parameters:
  10940. @table @option
  10941. @item dir
  10942. Specify the transposition direction.
  10943. Can assume the following values:
  10944. @table @samp
  10945. @item 0, 4, cclock_flip
  10946. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10947. @example
  10948. L.R L.l
  10949. . . -> . .
  10950. l.r R.r
  10951. @end example
  10952. @item 1, 5, clock
  10953. Rotate by 90 degrees clockwise, that is:
  10954. @example
  10955. L.R l.L
  10956. . . -> . .
  10957. l.r r.R
  10958. @end example
  10959. @item 2, 6, cclock
  10960. Rotate by 90 degrees counterclockwise, that is:
  10961. @example
  10962. L.R R.r
  10963. . . -> . .
  10964. l.r L.l
  10965. @end example
  10966. @item 3, 7, clock_flip
  10967. Rotate by 90 degrees clockwise and vertically flip, that is:
  10968. @example
  10969. L.R r.R
  10970. . . -> . .
  10971. l.r l.L
  10972. @end example
  10973. @end table
  10974. For values between 4-7, the transposition is only done if the input
  10975. video geometry is portrait and not landscape. These values are
  10976. deprecated, the @code{passthrough} option should be used instead.
  10977. Numerical values are deprecated, and should be dropped in favor of
  10978. symbolic constants.
  10979. @item passthrough
  10980. Do not apply the transposition if the input geometry matches the one
  10981. specified by the specified value. It accepts the following values:
  10982. @table @samp
  10983. @item none
  10984. Always apply transposition.
  10985. @item portrait
  10986. Preserve portrait geometry (when @var{height} >= @var{width}).
  10987. @item landscape
  10988. Preserve landscape geometry (when @var{width} >= @var{height}).
  10989. @end table
  10990. Default value is @code{none}.
  10991. @end table
  10992. For example to rotate by 90 degrees clockwise and preserve portrait
  10993. layout:
  10994. @example
  10995. transpose=dir=1:passthrough=portrait
  10996. @end example
  10997. The command above can also be specified as:
  10998. @example
  10999. transpose=1:portrait
  11000. @end example
  11001. @section trim
  11002. Trim the input so that the output contains one continuous subpart of the input.
  11003. It accepts the following parameters:
  11004. @table @option
  11005. @item start
  11006. Specify the time of the start of the kept section, i.e. the frame with the
  11007. timestamp @var{start} will be the first frame in the output.
  11008. @item end
  11009. Specify the time of the first frame that will be dropped, i.e. the frame
  11010. immediately preceding the one with the timestamp @var{end} will be the last
  11011. frame in the output.
  11012. @item start_pts
  11013. This is the same as @var{start}, except this option sets the start timestamp
  11014. in timebase units instead of seconds.
  11015. @item end_pts
  11016. This is the same as @var{end}, except this option sets the end timestamp
  11017. in timebase units instead of seconds.
  11018. @item duration
  11019. The maximum duration of the output in seconds.
  11020. @item start_frame
  11021. The number of the first frame that should be passed to the output.
  11022. @item end_frame
  11023. The number of the first frame that should be dropped.
  11024. @end table
  11025. @option{start}, @option{end}, and @option{duration} are expressed as time
  11026. duration specifications; see
  11027. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11028. for the accepted syntax.
  11029. Note that the first two sets of the start/end options and the @option{duration}
  11030. option look at the frame timestamp, while the _frame variants simply count the
  11031. frames that pass through the filter. Also note that this filter does not modify
  11032. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11033. setpts filter after the trim filter.
  11034. If multiple start or end options are set, this filter tries to be greedy and
  11035. keep all the frames that match at least one of the specified constraints. To keep
  11036. only the part that matches all the constraints at once, chain multiple trim
  11037. filters.
  11038. The defaults are such that all the input is kept. So it is possible to set e.g.
  11039. just the end values to keep everything before the specified time.
  11040. Examples:
  11041. @itemize
  11042. @item
  11043. Drop everything except the second minute of input:
  11044. @example
  11045. ffmpeg -i INPUT -vf trim=60:120
  11046. @end example
  11047. @item
  11048. Keep only the first second:
  11049. @example
  11050. ffmpeg -i INPUT -vf trim=duration=1
  11051. @end example
  11052. @end itemize
  11053. @anchor{unsharp}
  11054. @section unsharp
  11055. Sharpen or blur the input video.
  11056. It accepts the following parameters:
  11057. @table @option
  11058. @item luma_msize_x, lx
  11059. Set the luma matrix horizontal size. It must be an odd integer between
  11060. 3 and 23. The default value is 5.
  11061. @item luma_msize_y, ly
  11062. Set the luma matrix vertical size. It must be an odd integer between 3
  11063. and 23. The default value is 5.
  11064. @item luma_amount, la
  11065. Set the luma effect strength. It must be a floating point number, reasonable
  11066. values lay between -1.5 and 1.5.
  11067. Negative values will blur the input video, while positive values will
  11068. sharpen it, a value of zero will disable the effect.
  11069. Default value is 1.0.
  11070. @item chroma_msize_x, cx
  11071. Set the chroma matrix horizontal size. It must be an odd integer
  11072. between 3 and 23. The default value is 5.
  11073. @item chroma_msize_y, cy
  11074. Set the chroma matrix vertical size. It must be an odd integer
  11075. between 3 and 23. The default value is 5.
  11076. @item chroma_amount, ca
  11077. Set the chroma effect strength. It must be a floating point number, reasonable
  11078. values lay between -1.5 and 1.5.
  11079. Negative values will blur the input video, while positive values will
  11080. sharpen it, a value of zero will disable the effect.
  11081. Default value is 0.0.
  11082. @item opencl
  11083. If set to 1, specify using OpenCL capabilities, only available if
  11084. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11085. @end table
  11086. All parameters are optional and default to the equivalent of the
  11087. string '5:5:1.0:5:5:0.0'.
  11088. @subsection Examples
  11089. @itemize
  11090. @item
  11091. Apply strong luma sharpen effect:
  11092. @example
  11093. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11094. @end example
  11095. @item
  11096. Apply a strong blur of both luma and chroma parameters:
  11097. @example
  11098. unsharp=7:7:-2:7:7:-2
  11099. @end example
  11100. @end itemize
  11101. @section uspp
  11102. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11103. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11104. shifts and average the results.
  11105. The way this differs from the behavior of spp is that uspp actually encodes &
  11106. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11107. DCT similar to MJPEG.
  11108. The filter accepts the following options:
  11109. @table @option
  11110. @item quality
  11111. Set quality. This option defines the number of levels for averaging. It accepts
  11112. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11113. effect. A value of @code{8} means the higher quality. For each increment of
  11114. that value the speed drops by a factor of approximately 2. Default value is
  11115. @code{3}.
  11116. @item qp
  11117. Force a constant quantization parameter. If not set, the filter will use the QP
  11118. from the video stream (if available).
  11119. @end table
  11120. @section vaguedenoiser
  11121. Apply a wavelet based denoiser.
  11122. It transforms each frame from the video input into the wavelet domain,
  11123. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11124. the obtained coefficients. It does an inverse wavelet transform after.
  11125. Due to wavelet properties, it should give a nice smoothed result, and
  11126. reduced noise, without blurring picture features.
  11127. This filter accepts the following options:
  11128. @table @option
  11129. @item threshold
  11130. The filtering strength. The higher, the more filtered the video will be.
  11131. Hard thresholding can use a higher threshold than soft thresholding
  11132. before the video looks overfiltered.
  11133. @item method
  11134. The filtering method the filter will use.
  11135. It accepts the following values:
  11136. @table @samp
  11137. @item hard
  11138. All values under the threshold will be zeroed.
  11139. @item soft
  11140. All values under the threshold will be zeroed. All values above will be
  11141. reduced by the threshold.
  11142. @item garrote
  11143. Scales or nullifies coefficients - intermediary between (more) soft and
  11144. (less) hard thresholding.
  11145. @end table
  11146. @item nsteps
  11147. Number of times, the wavelet will decompose the picture. Picture can't
  11148. be decomposed beyond a particular point (typically, 8 for a 640x480
  11149. frame - as 2^9 = 512 > 480)
  11150. @item percent
  11151. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  11152. @item planes
  11153. A list of the planes to process. By default all planes are processed.
  11154. @end table
  11155. @section vectorscope
  11156. Display 2 color component values in the two dimensional graph (which is called
  11157. a vectorscope).
  11158. This filter accepts the following options:
  11159. @table @option
  11160. @item mode, m
  11161. Set vectorscope mode.
  11162. It accepts the following values:
  11163. @table @samp
  11164. @item gray
  11165. Gray values are displayed on graph, higher brightness means more pixels have
  11166. same component color value on location in graph. This is the default mode.
  11167. @item color
  11168. Gray values are displayed on graph. Surrounding pixels values which are not
  11169. present in video frame are drawn in gradient of 2 color components which are
  11170. set by option @code{x} and @code{y}. The 3rd color component is static.
  11171. @item color2
  11172. Actual color components values present in video frame are displayed on graph.
  11173. @item color3
  11174. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11175. on graph increases value of another color component, which is luminance by
  11176. default values of @code{x} and @code{y}.
  11177. @item color4
  11178. Actual colors present in video frame are displayed on graph. If two different
  11179. colors map to same position on graph then color with higher value of component
  11180. not present in graph is picked.
  11181. @item color5
  11182. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11183. component picked from radial gradient.
  11184. @end table
  11185. @item x
  11186. Set which color component will be represented on X-axis. Default is @code{1}.
  11187. @item y
  11188. Set which color component will be represented on Y-axis. Default is @code{2}.
  11189. @item intensity, i
  11190. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11191. of color component which represents frequency of (X, Y) location in graph.
  11192. @item envelope, e
  11193. @table @samp
  11194. @item none
  11195. No envelope, this is default.
  11196. @item instant
  11197. Instant envelope, even darkest single pixel will be clearly highlighted.
  11198. @item peak
  11199. Hold maximum and minimum values presented in graph over time. This way you
  11200. can still spot out of range values without constantly looking at vectorscope.
  11201. @item peak+instant
  11202. Peak and instant envelope combined together.
  11203. @end table
  11204. @item graticule, g
  11205. Set what kind of graticule to draw.
  11206. @table @samp
  11207. @item none
  11208. @item green
  11209. @item color
  11210. @end table
  11211. @item opacity, o
  11212. Set graticule opacity.
  11213. @item flags, f
  11214. Set graticule flags.
  11215. @table @samp
  11216. @item white
  11217. Draw graticule for white point.
  11218. @item black
  11219. Draw graticule for black point.
  11220. @item name
  11221. Draw color points short names.
  11222. @end table
  11223. @item bgopacity, b
  11224. Set background opacity.
  11225. @item lthreshold, l
  11226. Set low threshold for color component not represented on X or Y axis.
  11227. Values lower than this value will be ignored. Default is 0.
  11228. Note this value is multiplied with actual max possible value one pixel component
  11229. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11230. is 0.1 * 255 = 25.
  11231. @item hthreshold, h
  11232. Set high threshold for color component not represented on X or Y axis.
  11233. Values higher than this value will be ignored. Default is 1.
  11234. Note this value is multiplied with actual max possible value one pixel component
  11235. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11236. is 0.9 * 255 = 230.
  11237. @item colorspace, c
  11238. Set what kind of colorspace to use when drawing graticule.
  11239. @table @samp
  11240. @item auto
  11241. @item 601
  11242. @item 709
  11243. @end table
  11244. Default is auto.
  11245. @end table
  11246. @anchor{vidstabdetect}
  11247. @section vidstabdetect
  11248. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11249. @ref{vidstabtransform} for pass 2.
  11250. This filter generates a file with relative translation and rotation
  11251. transform information about subsequent frames, which is then used by
  11252. the @ref{vidstabtransform} filter.
  11253. To enable compilation of this filter you need to configure FFmpeg with
  11254. @code{--enable-libvidstab}.
  11255. This filter accepts the following options:
  11256. @table @option
  11257. @item result
  11258. Set the path to the file used to write the transforms information.
  11259. Default value is @file{transforms.trf}.
  11260. @item shakiness
  11261. Set how shaky the video is and how quick the camera is. It accepts an
  11262. integer in the range 1-10, a value of 1 means little shakiness, a
  11263. value of 10 means strong shakiness. Default value is 5.
  11264. @item accuracy
  11265. Set the accuracy of the detection process. It must be a value in the
  11266. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11267. accuracy. Default value is 15.
  11268. @item stepsize
  11269. Set stepsize of the search process. The region around minimum is
  11270. scanned with 1 pixel resolution. Default value is 6.
  11271. @item mincontrast
  11272. Set minimum contrast. Below this value a local measurement field is
  11273. discarded. Must be a floating point value in the range 0-1. Default
  11274. value is 0.3.
  11275. @item tripod
  11276. Set reference frame number for tripod mode.
  11277. If enabled, the motion of the frames is compared to a reference frame
  11278. in the filtered stream, identified by the specified number. The idea
  11279. is to compensate all movements in a more-or-less static scene and keep
  11280. the camera view absolutely still.
  11281. If set to 0, it is disabled. The frames are counted starting from 1.
  11282. @item show
  11283. Show fields and transforms in the resulting frames. It accepts an
  11284. integer in the range 0-2. Default value is 0, which disables any
  11285. visualization.
  11286. @end table
  11287. @subsection Examples
  11288. @itemize
  11289. @item
  11290. Use default values:
  11291. @example
  11292. vidstabdetect
  11293. @end example
  11294. @item
  11295. Analyze strongly shaky movie and put the results in file
  11296. @file{mytransforms.trf}:
  11297. @example
  11298. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11299. @end example
  11300. @item
  11301. Visualize the result of internal transformations in the resulting
  11302. video:
  11303. @example
  11304. vidstabdetect=show=1
  11305. @end example
  11306. @item
  11307. Analyze a video with medium shakiness using @command{ffmpeg}:
  11308. @example
  11309. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11310. @end example
  11311. @end itemize
  11312. @anchor{vidstabtransform}
  11313. @section vidstabtransform
  11314. Video stabilization/deshaking: pass 2 of 2,
  11315. see @ref{vidstabdetect} for pass 1.
  11316. Read a file with transform information for each frame and
  11317. apply/compensate them. Together with the @ref{vidstabdetect}
  11318. filter this can be used to deshake videos. See also
  11319. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11320. the @ref{unsharp} filter, see below.
  11321. To enable compilation of this filter you need to configure FFmpeg with
  11322. @code{--enable-libvidstab}.
  11323. @subsection Options
  11324. @table @option
  11325. @item input
  11326. Set path to the file used to read the transforms. Default value is
  11327. @file{transforms.trf}.
  11328. @item smoothing
  11329. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11330. camera movements. Default value is 10.
  11331. For example a number of 10 means that 21 frames are used (10 in the
  11332. past and 10 in the future) to smoothen the motion in the video. A
  11333. larger value leads to a smoother video, but limits the acceleration of
  11334. the camera (pan/tilt movements). 0 is a special case where a static
  11335. camera is simulated.
  11336. @item optalgo
  11337. Set the camera path optimization algorithm.
  11338. Accepted values are:
  11339. @table @samp
  11340. @item gauss
  11341. gaussian kernel low-pass filter on camera motion (default)
  11342. @item avg
  11343. averaging on transformations
  11344. @end table
  11345. @item maxshift
  11346. Set maximal number of pixels to translate frames. Default value is -1,
  11347. meaning no limit.
  11348. @item maxangle
  11349. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11350. value is -1, meaning no limit.
  11351. @item crop
  11352. Specify how to deal with borders that may be visible due to movement
  11353. compensation.
  11354. Available values are:
  11355. @table @samp
  11356. @item keep
  11357. keep image information from previous frame (default)
  11358. @item black
  11359. fill the border black
  11360. @end table
  11361. @item invert
  11362. Invert transforms if set to 1. Default value is 0.
  11363. @item relative
  11364. Consider transforms as relative to previous frame if set to 1,
  11365. absolute if set to 0. Default value is 0.
  11366. @item zoom
  11367. Set percentage to zoom. A positive value will result in a zoom-in
  11368. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11369. zoom).
  11370. @item optzoom
  11371. Set optimal zooming to avoid borders.
  11372. Accepted values are:
  11373. @table @samp
  11374. @item 0
  11375. disabled
  11376. @item 1
  11377. optimal static zoom value is determined (only very strong movements
  11378. will lead to visible borders) (default)
  11379. @item 2
  11380. optimal adaptive zoom value is determined (no borders will be
  11381. visible), see @option{zoomspeed}
  11382. @end table
  11383. Note that the value given at zoom is added to the one calculated here.
  11384. @item zoomspeed
  11385. Set percent to zoom maximally each frame (enabled when
  11386. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11387. 0.25.
  11388. @item interpol
  11389. Specify type of interpolation.
  11390. Available values are:
  11391. @table @samp
  11392. @item no
  11393. no interpolation
  11394. @item linear
  11395. linear only horizontal
  11396. @item bilinear
  11397. linear in both directions (default)
  11398. @item bicubic
  11399. cubic in both directions (slow)
  11400. @end table
  11401. @item tripod
  11402. Enable virtual tripod mode if set to 1, which is equivalent to
  11403. @code{relative=0:smoothing=0}. Default value is 0.
  11404. Use also @code{tripod} option of @ref{vidstabdetect}.
  11405. @item debug
  11406. Increase log verbosity if set to 1. Also the detected global motions
  11407. are written to the temporary file @file{global_motions.trf}. Default
  11408. value is 0.
  11409. @end table
  11410. @subsection Examples
  11411. @itemize
  11412. @item
  11413. Use @command{ffmpeg} for a typical stabilization with default values:
  11414. @example
  11415. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11416. @end example
  11417. Note the use of the @ref{unsharp} filter which is always recommended.
  11418. @item
  11419. Zoom in a bit more and load transform data from a given file:
  11420. @example
  11421. vidstabtransform=zoom=5:input="mytransforms.trf"
  11422. @end example
  11423. @item
  11424. Smoothen the video even more:
  11425. @example
  11426. vidstabtransform=smoothing=30
  11427. @end example
  11428. @end itemize
  11429. @section vflip
  11430. Flip the input video vertically.
  11431. For example, to vertically flip a video with @command{ffmpeg}:
  11432. @example
  11433. ffmpeg -i in.avi -vf "vflip" out.avi
  11434. @end example
  11435. @anchor{vignette}
  11436. @section vignette
  11437. Make or reverse a natural vignetting effect.
  11438. The filter accepts the following options:
  11439. @table @option
  11440. @item angle, a
  11441. Set lens angle expression as a number of radians.
  11442. The value is clipped in the @code{[0,PI/2]} range.
  11443. Default value: @code{"PI/5"}
  11444. @item x0
  11445. @item y0
  11446. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11447. by default.
  11448. @item mode
  11449. Set forward/backward mode.
  11450. Available modes are:
  11451. @table @samp
  11452. @item forward
  11453. The larger the distance from the central point, the darker the image becomes.
  11454. @item backward
  11455. The larger the distance from the central point, the brighter the image becomes.
  11456. This can be used to reverse a vignette effect, though there is no automatic
  11457. detection to extract the lens @option{angle} and other settings (yet). It can
  11458. also be used to create a burning effect.
  11459. @end table
  11460. Default value is @samp{forward}.
  11461. @item eval
  11462. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11463. It accepts the following values:
  11464. @table @samp
  11465. @item init
  11466. Evaluate expressions only once during the filter initialization.
  11467. @item frame
  11468. Evaluate expressions for each incoming frame. This is way slower than the
  11469. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11470. allows advanced dynamic expressions.
  11471. @end table
  11472. Default value is @samp{init}.
  11473. @item dither
  11474. Set dithering to reduce the circular banding effects. Default is @code{1}
  11475. (enabled).
  11476. @item aspect
  11477. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11478. Setting this value to the SAR of the input will make a rectangular vignetting
  11479. following the dimensions of the video.
  11480. Default is @code{1/1}.
  11481. @end table
  11482. @subsection Expressions
  11483. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11484. following parameters.
  11485. @table @option
  11486. @item w
  11487. @item h
  11488. input width and height
  11489. @item n
  11490. the number of input frame, starting from 0
  11491. @item pts
  11492. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11493. @var{TB} units, NAN if undefined
  11494. @item r
  11495. frame rate of the input video, NAN if the input frame rate is unknown
  11496. @item t
  11497. the PTS (Presentation TimeStamp) of the filtered video frame,
  11498. expressed in seconds, NAN if undefined
  11499. @item tb
  11500. time base of the input video
  11501. @end table
  11502. @subsection Examples
  11503. @itemize
  11504. @item
  11505. Apply simple strong vignetting effect:
  11506. @example
  11507. vignette=PI/4
  11508. @end example
  11509. @item
  11510. Make a flickering vignetting:
  11511. @example
  11512. vignette='PI/4+random(1)*PI/50':eval=frame
  11513. @end example
  11514. @end itemize
  11515. @section vstack
  11516. Stack input videos vertically.
  11517. All streams must be of same pixel format and of same width.
  11518. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11519. to create same output.
  11520. The filter accept the following option:
  11521. @table @option
  11522. @item inputs
  11523. Set number of input streams. Default is 2.
  11524. @item shortest
  11525. If set to 1, force the output to terminate when the shortest input
  11526. terminates. Default value is 0.
  11527. @end table
  11528. @section w3fdif
  11529. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11530. Deinterlacing Filter").
  11531. Based on the process described by Martin Weston for BBC R&D, and
  11532. implemented based on the de-interlace algorithm written by Jim
  11533. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11534. uses filter coefficients calculated by BBC R&D.
  11535. There are two sets of filter coefficients, so called "simple":
  11536. and "complex". Which set of filter coefficients is used can
  11537. be set by passing an optional parameter:
  11538. @table @option
  11539. @item filter
  11540. Set the interlacing filter coefficients. Accepts one of the following values:
  11541. @table @samp
  11542. @item simple
  11543. Simple filter coefficient set.
  11544. @item complex
  11545. More-complex filter coefficient set.
  11546. @end table
  11547. Default value is @samp{complex}.
  11548. @item deint
  11549. Specify which frames to deinterlace. Accept one of the following values:
  11550. @table @samp
  11551. @item all
  11552. Deinterlace all frames,
  11553. @item interlaced
  11554. Only deinterlace frames marked as interlaced.
  11555. @end table
  11556. Default value is @samp{all}.
  11557. @end table
  11558. @section waveform
  11559. Video waveform monitor.
  11560. The waveform monitor plots color component intensity. By default luminance
  11561. only. Each column of the waveform corresponds to a column of pixels in the
  11562. source video.
  11563. It accepts the following options:
  11564. @table @option
  11565. @item mode, m
  11566. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11567. In row mode, the graph on the left side represents color component value 0 and
  11568. the right side represents value = 255. In column mode, the top side represents
  11569. color component value = 0 and bottom side represents value = 255.
  11570. @item intensity, i
  11571. Set intensity. Smaller values are useful to find out how many values of the same
  11572. luminance are distributed across input rows/columns.
  11573. Default value is @code{0.04}. Allowed range is [0, 1].
  11574. @item mirror, r
  11575. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11576. In mirrored mode, higher values will be represented on the left
  11577. side for @code{row} mode and at the top for @code{column} mode. Default is
  11578. @code{1} (mirrored).
  11579. @item display, d
  11580. Set display mode.
  11581. It accepts the following values:
  11582. @table @samp
  11583. @item overlay
  11584. Presents information identical to that in the @code{parade}, except
  11585. that the graphs representing color components are superimposed directly
  11586. over one another.
  11587. This display mode makes it easier to spot relative differences or similarities
  11588. in overlapping areas of the color components that are supposed to be identical,
  11589. such as neutral whites, grays, or blacks.
  11590. @item stack
  11591. Display separate graph for the color components side by side in
  11592. @code{row} mode or one below the other in @code{column} mode.
  11593. @item parade
  11594. Display separate graph for the color components side by side in
  11595. @code{column} mode or one below the other in @code{row} mode.
  11596. Using this display mode makes it easy to spot color casts in the highlights
  11597. and shadows of an image, by comparing the contours of the top and the bottom
  11598. graphs of each waveform. Since whites, grays, and blacks are characterized
  11599. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11600. should display three waveforms of roughly equal width/height. If not, the
  11601. correction is easy to perform by making level adjustments the three waveforms.
  11602. @end table
  11603. Default is @code{stack}.
  11604. @item components, c
  11605. Set which color components to display. Default is 1, which means only luminance
  11606. or red color component if input is in RGB colorspace. If is set for example to
  11607. 7 it will display all 3 (if) available color components.
  11608. @item envelope, e
  11609. @table @samp
  11610. @item none
  11611. No envelope, this is default.
  11612. @item instant
  11613. Instant envelope, minimum and maximum values presented in graph will be easily
  11614. visible even with small @code{step} value.
  11615. @item peak
  11616. Hold minimum and maximum values presented in graph across time. This way you
  11617. can still spot out of range values without constantly looking at waveforms.
  11618. @item peak+instant
  11619. Peak and instant envelope combined together.
  11620. @end table
  11621. @item filter, f
  11622. @table @samp
  11623. @item lowpass
  11624. No filtering, this is default.
  11625. @item flat
  11626. Luma and chroma combined together.
  11627. @item aflat
  11628. Similar as above, but shows difference between blue and red chroma.
  11629. @item chroma
  11630. Displays only chroma.
  11631. @item color
  11632. Displays actual color value on waveform.
  11633. @item acolor
  11634. Similar as above, but with luma showing frequency of chroma values.
  11635. @end table
  11636. @item graticule, g
  11637. Set which graticule to display.
  11638. @table @samp
  11639. @item none
  11640. Do not display graticule.
  11641. @item green
  11642. Display green graticule showing legal broadcast ranges.
  11643. @end table
  11644. @item opacity, o
  11645. Set graticule opacity.
  11646. @item flags, fl
  11647. Set graticule flags.
  11648. @table @samp
  11649. @item numbers
  11650. Draw numbers above lines. By default enabled.
  11651. @item dots
  11652. Draw dots instead of lines.
  11653. @end table
  11654. @item scale, s
  11655. Set scale used for displaying graticule.
  11656. @table @samp
  11657. @item digital
  11658. @item millivolts
  11659. @item ire
  11660. @end table
  11661. Default is digital.
  11662. @item bgopacity, b
  11663. Set background opacity.
  11664. @end table
  11665. @section weave, doubleweave
  11666. The @code{weave} takes a field-based video input and join
  11667. each two sequential fields into single frame, producing a new double
  11668. height clip with half the frame rate and half the frame count.
  11669. The @code{doubleweave} works same as @code{weave} but without
  11670. halving frame rate and frame count.
  11671. It accepts the following option:
  11672. @table @option
  11673. @item first_field
  11674. Set first field. Available values are:
  11675. @table @samp
  11676. @item top, t
  11677. Set the frame as top-field-first.
  11678. @item bottom, b
  11679. Set the frame as bottom-field-first.
  11680. @end table
  11681. @end table
  11682. @subsection Examples
  11683. @itemize
  11684. @item
  11685. Interlace video using @ref{select} and @ref{separatefields} filter:
  11686. @example
  11687. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11688. @end example
  11689. @end itemize
  11690. @section xbr
  11691. Apply the xBR high-quality magnification filter which is designed for pixel
  11692. art. It follows a set of edge-detection rules, see
  11693. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11694. It accepts the following option:
  11695. @table @option
  11696. @item n
  11697. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11698. @code{3xBR} and @code{4} for @code{4xBR}.
  11699. Default is @code{3}.
  11700. @end table
  11701. @anchor{yadif}
  11702. @section yadif
  11703. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11704. filter").
  11705. It accepts the following parameters:
  11706. @table @option
  11707. @item mode
  11708. The interlacing mode to adopt. It accepts one of the following values:
  11709. @table @option
  11710. @item 0, send_frame
  11711. Output one frame for each frame.
  11712. @item 1, send_field
  11713. Output one frame for each field.
  11714. @item 2, send_frame_nospatial
  11715. Like @code{send_frame}, but it skips the spatial interlacing check.
  11716. @item 3, send_field_nospatial
  11717. Like @code{send_field}, but it skips the spatial interlacing check.
  11718. @end table
  11719. The default value is @code{send_frame}.
  11720. @item parity
  11721. The picture field parity assumed for the input interlaced video. It accepts one
  11722. of the following values:
  11723. @table @option
  11724. @item 0, tff
  11725. Assume the top field is first.
  11726. @item 1, bff
  11727. Assume the bottom field is first.
  11728. @item -1, auto
  11729. Enable automatic detection of field parity.
  11730. @end table
  11731. The default value is @code{auto}.
  11732. If the interlacing is unknown or the decoder does not export this information,
  11733. top field first will be assumed.
  11734. @item deint
  11735. Specify which frames to deinterlace. Accept one of the following
  11736. values:
  11737. @table @option
  11738. @item 0, all
  11739. Deinterlace all frames.
  11740. @item 1, interlaced
  11741. Only deinterlace frames marked as interlaced.
  11742. @end table
  11743. The default value is @code{all}.
  11744. @end table
  11745. @section zoompan
  11746. Apply Zoom & Pan effect.
  11747. This filter accepts the following options:
  11748. @table @option
  11749. @item zoom, z
  11750. Set the zoom expression. Default is 1.
  11751. @item x
  11752. @item y
  11753. Set the x and y expression. Default is 0.
  11754. @item d
  11755. Set the duration expression in number of frames.
  11756. This sets for how many number of frames effect will last for
  11757. single input image.
  11758. @item s
  11759. Set the output image size, default is 'hd720'.
  11760. @item fps
  11761. Set the output frame rate, default is '25'.
  11762. @end table
  11763. Each expression can contain the following constants:
  11764. @table @option
  11765. @item in_w, iw
  11766. Input width.
  11767. @item in_h, ih
  11768. Input height.
  11769. @item out_w, ow
  11770. Output width.
  11771. @item out_h, oh
  11772. Output height.
  11773. @item in
  11774. Input frame count.
  11775. @item on
  11776. Output frame count.
  11777. @item x
  11778. @item y
  11779. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11780. for current input frame.
  11781. @item px
  11782. @item py
  11783. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11784. not yet such frame (first input frame).
  11785. @item zoom
  11786. Last calculated zoom from 'z' expression for current input frame.
  11787. @item pzoom
  11788. Last calculated zoom of last output frame of previous input frame.
  11789. @item duration
  11790. Number of output frames for current input frame. Calculated from 'd' expression
  11791. for each input frame.
  11792. @item pduration
  11793. number of output frames created for previous input frame
  11794. @item a
  11795. Rational number: input width / input height
  11796. @item sar
  11797. sample aspect ratio
  11798. @item dar
  11799. display aspect ratio
  11800. @end table
  11801. @subsection Examples
  11802. @itemize
  11803. @item
  11804. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11805. @example
  11806. 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
  11807. @end example
  11808. @item
  11809. Zoom-in up to 1.5 and pan always at center of picture:
  11810. @example
  11811. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11812. @end example
  11813. @item
  11814. Same as above but without pausing:
  11815. @example
  11816. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11817. @end example
  11818. @end itemize
  11819. @section zscale
  11820. Scale (resize) the input video, using the z.lib library:
  11821. https://github.com/sekrit-twc/zimg.
  11822. The zscale filter forces the output display aspect ratio to be the same
  11823. as the input, by changing the output sample aspect ratio.
  11824. If the input image format is different from the format requested by
  11825. the next filter, the zscale filter will convert the input to the
  11826. requested format.
  11827. @subsection Options
  11828. The filter accepts the following options.
  11829. @table @option
  11830. @item width, w
  11831. @item height, h
  11832. Set the output video dimension expression. Default value is the input
  11833. dimension.
  11834. If the @var{width} or @var{w} value is 0, the input width is used for
  11835. the output. If the @var{height} or @var{h} value is 0, the input height
  11836. is used for the output.
  11837. If one and only one of the values is -n with n >= 1, the zscale filter
  11838. will use a value that maintains the aspect ratio of the input image,
  11839. calculated from the other specified dimension. After that it will,
  11840. however, make sure that the calculated dimension is divisible by n and
  11841. adjust the value if necessary.
  11842. If both values are -n with n >= 1, the behavior will be identical to
  11843. both values being set to 0 as previously detailed.
  11844. See below for the list of accepted constants for use in the dimension
  11845. expression.
  11846. @item size, s
  11847. Set the video size. For the syntax of this option, check the
  11848. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11849. @item dither, d
  11850. Set the dither type.
  11851. Possible values are:
  11852. @table @var
  11853. @item none
  11854. @item ordered
  11855. @item random
  11856. @item error_diffusion
  11857. @end table
  11858. Default is none.
  11859. @item filter, f
  11860. Set the resize filter type.
  11861. Possible values are:
  11862. @table @var
  11863. @item point
  11864. @item bilinear
  11865. @item bicubic
  11866. @item spline16
  11867. @item spline36
  11868. @item lanczos
  11869. @end table
  11870. Default is bilinear.
  11871. @item range, r
  11872. Set the color range.
  11873. Possible values are:
  11874. @table @var
  11875. @item input
  11876. @item limited
  11877. @item full
  11878. @end table
  11879. Default is same as input.
  11880. @item primaries, p
  11881. Set the color primaries.
  11882. Possible values are:
  11883. @table @var
  11884. @item input
  11885. @item 709
  11886. @item unspecified
  11887. @item 170m
  11888. @item 240m
  11889. @item 2020
  11890. @end table
  11891. Default is same as input.
  11892. @item transfer, t
  11893. Set the transfer characteristics.
  11894. Possible values are:
  11895. @table @var
  11896. @item input
  11897. @item 709
  11898. @item unspecified
  11899. @item 601
  11900. @item linear
  11901. @item 2020_10
  11902. @item 2020_12
  11903. @item smpte2084
  11904. @item iec61966-2-1
  11905. @item arib-std-b67
  11906. @end table
  11907. Default is same as input.
  11908. @item matrix, m
  11909. Set the colorspace matrix.
  11910. Possible value are:
  11911. @table @var
  11912. @item input
  11913. @item 709
  11914. @item unspecified
  11915. @item 470bg
  11916. @item 170m
  11917. @item 2020_ncl
  11918. @item 2020_cl
  11919. @end table
  11920. Default is same as input.
  11921. @item rangein, rin
  11922. Set the input color range.
  11923. Possible values are:
  11924. @table @var
  11925. @item input
  11926. @item limited
  11927. @item full
  11928. @end table
  11929. Default is same as input.
  11930. @item primariesin, pin
  11931. Set the input color primaries.
  11932. Possible values are:
  11933. @table @var
  11934. @item input
  11935. @item 709
  11936. @item unspecified
  11937. @item 170m
  11938. @item 240m
  11939. @item 2020
  11940. @end table
  11941. Default is same as input.
  11942. @item transferin, tin
  11943. Set the input transfer characteristics.
  11944. Possible values are:
  11945. @table @var
  11946. @item input
  11947. @item 709
  11948. @item unspecified
  11949. @item 601
  11950. @item linear
  11951. @item 2020_10
  11952. @item 2020_12
  11953. @end table
  11954. Default is same as input.
  11955. @item matrixin, min
  11956. Set the input colorspace matrix.
  11957. Possible value are:
  11958. @table @var
  11959. @item input
  11960. @item 709
  11961. @item unspecified
  11962. @item 470bg
  11963. @item 170m
  11964. @item 2020_ncl
  11965. @item 2020_cl
  11966. @end table
  11967. @item chromal, c
  11968. Set the output chroma location.
  11969. Possible values are:
  11970. @table @var
  11971. @item input
  11972. @item left
  11973. @item center
  11974. @item topleft
  11975. @item top
  11976. @item bottomleft
  11977. @item bottom
  11978. @end table
  11979. @item chromalin, cin
  11980. Set the input chroma location.
  11981. Possible values are:
  11982. @table @var
  11983. @item input
  11984. @item left
  11985. @item center
  11986. @item topleft
  11987. @item top
  11988. @item bottomleft
  11989. @item bottom
  11990. @end table
  11991. @item npl
  11992. Set the nominal peak luminance.
  11993. @end table
  11994. The values of the @option{w} and @option{h} options are expressions
  11995. containing the following constants:
  11996. @table @var
  11997. @item in_w
  11998. @item in_h
  11999. The input width and height
  12000. @item iw
  12001. @item ih
  12002. These are the same as @var{in_w} and @var{in_h}.
  12003. @item out_w
  12004. @item out_h
  12005. The output (scaled) width and height
  12006. @item ow
  12007. @item oh
  12008. These are the same as @var{out_w} and @var{out_h}
  12009. @item a
  12010. The same as @var{iw} / @var{ih}
  12011. @item sar
  12012. input sample aspect ratio
  12013. @item dar
  12014. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12015. @item hsub
  12016. @item vsub
  12017. horizontal and vertical input chroma subsample values. For example for the
  12018. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12019. @item ohsub
  12020. @item ovsub
  12021. horizontal and vertical output chroma subsample values. For example for the
  12022. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12023. @end table
  12024. @table @option
  12025. @end table
  12026. @c man end VIDEO FILTERS
  12027. @chapter Video Sources
  12028. @c man begin VIDEO SOURCES
  12029. Below is a description of the currently available video sources.
  12030. @section buffer
  12031. Buffer video frames, and make them available to the filter chain.
  12032. This source is mainly intended for a programmatic use, in particular
  12033. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12034. It accepts the following parameters:
  12035. @table @option
  12036. @item video_size
  12037. Specify the size (width and height) of the buffered video frames. For the
  12038. syntax of this option, check the
  12039. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12040. @item width
  12041. The input video width.
  12042. @item height
  12043. The input video height.
  12044. @item pix_fmt
  12045. A string representing the pixel format of the buffered video frames.
  12046. It may be a number corresponding to a pixel format, or a pixel format
  12047. name.
  12048. @item time_base
  12049. Specify the timebase assumed by the timestamps of the buffered frames.
  12050. @item frame_rate
  12051. Specify the frame rate expected for the video stream.
  12052. @item pixel_aspect, sar
  12053. The sample (pixel) aspect ratio of the input video.
  12054. @item sws_param
  12055. Specify the optional parameters to be used for the scale filter which
  12056. is automatically inserted when an input change is detected in the
  12057. input size or format.
  12058. @item hw_frames_ctx
  12059. When using a hardware pixel format, this should be a reference to an
  12060. AVHWFramesContext describing input frames.
  12061. @end table
  12062. For example:
  12063. @example
  12064. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12065. @end example
  12066. will instruct the source to accept video frames with size 320x240 and
  12067. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12068. square pixels (1:1 sample aspect ratio).
  12069. Since the pixel format with name "yuv410p" corresponds to the number 6
  12070. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12071. this example corresponds to:
  12072. @example
  12073. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12074. @end example
  12075. Alternatively, the options can be specified as a flat string, but this
  12076. syntax is deprecated:
  12077. @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}]
  12078. @section cellauto
  12079. Create a pattern generated by an elementary cellular automaton.
  12080. The initial state of the cellular automaton can be defined through the
  12081. @option{filename} and @option{pattern} options. If such options are
  12082. not specified an initial state is created randomly.
  12083. At each new frame a new row in the video is filled with the result of
  12084. the cellular automaton next generation. The behavior when the whole
  12085. frame is filled is defined by the @option{scroll} option.
  12086. This source accepts the following options:
  12087. @table @option
  12088. @item filename, f
  12089. Read the initial cellular automaton state, i.e. the starting row, from
  12090. the specified file.
  12091. In the file, each non-whitespace character is considered an alive
  12092. cell, a newline will terminate the row, and further characters in the
  12093. file will be ignored.
  12094. @item pattern, p
  12095. Read the initial cellular automaton state, i.e. the starting row, from
  12096. the specified string.
  12097. Each non-whitespace character in the string is considered an alive
  12098. cell, a newline will terminate the row, and further characters in the
  12099. string will be ignored.
  12100. @item rate, r
  12101. Set the video rate, that is the number of frames generated per second.
  12102. Default is 25.
  12103. @item random_fill_ratio, ratio
  12104. Set the random fill ratio for the initial cellular automaton row. It
  12105. is a floating point number value ranging from 0 to 1, defaults to
  12106. 1/PHI.
  12107. This option is ignored when a file or a pattern is specified.
  12108. @item random_seed, seed
  12109. Set the seed for filling randomly the initial row, must be an integer
  12110. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12111. set to -1, the filter will try to use a good random seed on a best
  12112. effort basis.
  12113. @item rule
  12114. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12115. Default value is 110.
  12116. @item size, s
  12117. Set the size of the output video. For the syntax of this option, check the
  12118. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12119. If @option{filename} or @option{pattern} is specified, the size is set
  12120. by default to the width of the specified initial state row, and the
  12121. height is set to @var{width} * PHI.
  12122. If @option{size} is set, it must contain the width of the specified
  12123. pattern string, and the specified pattern will be centered in the
  12124. larger row.
  12125. If a filename or a pattern string is not specified, the size value
  12126. defaults to "320x518" (used for a randomly generated initial state).
  12127. @item scroll
  12128. If set to 1, scroll the output upward when all the rows in the output
  12129. have been already filled. If set to 0, the new generated row will be
  12130. written over the top row just after the bottom row is filled.
  12131. Defaults to 1.
  12132. @item start_full, full
  12133. If set to 1, completely fill the output with generated rows before
  12134. outputting the first frame.
  12135. This is the default behavior, for disabling set the value to 0.
  12136. @item stitch
  12137. If set to 1, stitch the left and right row edges together.
  12138. This is the default behavior, for disabling set the value to 0.
  12139. @end table
  12140. @subsection Examples
  12141. @itemize
  12142. @item
  12143. Read the initial state from @file{pattern}, and specify an output of
  12144. size 200x400.
  12145. @example
  12146. cellauto=f=pattern:s=200x400
  12147. @end example
  12148. @item
  12149. Generate a random initial row with a width of 200 cells, with a fill
  12150. ratio of 2/3:
  12151. @example
  12152. cellauto=ratio=2/3:s=200x200
  12153. @end example
  12154. @item
  12155. Create a pattern generated by rule 18 starting by a single alive cell
  12156. centered on an initial row with width 100:
  12157. @example
  12158. cellauto=p=@@:s=100x400:full=0:rule=18
  12159. @end example
  12160. @item
  12161. Specify a more elaborated initial pattern:
  12162. @example
  12163. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12164. @end example
  12165. @end itemize
  12166. @anchor{coreimagesrc}
  12167. @section coreimagesrc
  12168. Video source generated on GPU using Apple's CoreImage API on OSX.
  12169. This video source is a specialized version of the @ref{coreimage} video filter.
  12170. Use a core image generator at the beginning of the applied filterchain to
  12171. generate the content.
  12172. The coreimagesrc video source accepts the following options:
  12173. @table @option
  12174. @item list_generators
  12175. List all available generators along with all their respective options as well as
  12176. possible minimum and maximum values along with the default values.
  12177. @example
  12178. list_generators=true
  12179. @end example
  12180. @item size, s
  12181. Specify the size of the sourced video. For the syntax of this option, check the
  12182. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12183. The default value is @code{320x240}.
  12184. @item rate, r
  12185. Specify the frame rate of the sourced video, as the number of frames
  12186. generated per second. It has to be a string in the format
  12187. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12188. number or a valid video frame rate abbreviation. The default value is
  12189. "25".
  12190. @item sar
  12191. Set the sample aspect ratio of the sourced video.
  12192. @item duration, d
  12193. Set the duration of the sourced video. See
  12194. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12195. for the accepted syntax.
  12196. If not specified, or the expressed duration is negative, the video is
  12197. supposed to be generated forever.
  12198. @end table
  12199. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12200. A complete filterchain can be used for further processing of the
  12201. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12202. and examples for details.
  12203. @subsection Examples
  12204. @itemize
  12205. @item
  12206. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12207. given as complete and escaped command-line for Apple's standard bash shell:
  12208. @example
  12209. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12210. @end example
  12211. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12212. need for a nullsrc video source.
  12213. @end itemize
  12214. @section mandelbrot
  12215. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12216. point specified with @var{start_x} and @var{start_y}.
  12217. This source accepts the following options:
  12218. @table @option
  12219. @item end_pts
  12220. Set the terminal pts value. Default value is 400.
  12221. @item end_scale
  12222. Set the terminal scale value.
  12223. Must be a floating point value. Default value is 0.3.
  12224. @item inner
  12225. Set the inner coloring mode, that is the algorithm used to draw the
  12226. Mandelbrot fractal internal region.
  12227. It shall assume one of the following values:
  12228. @table @option
  12229. @item black
  12230. Set black mode.
  12231. @item convergence
  12232. Show time until convergence.
  12233. @item mincol
  12234. Set color based on point closest to the origin of the iterations.
  12235. @item period
  12236. Set period mode.
  12237. @end table
  12238. Default value is @var{mincol}.
  12239. @item bailout
  12240. Set the bailout value. Default value is 10.0.
  12241. @item maxiter
  12242. Set the maximum of iterations performed by the rendering
  12243. algorithm. Default value is 7189.
  12244. @item outer
  12245. Set outer coloring mode.
  12246. It shall assume one of following values:
  12247. @table @option
  12248. @item iteration_count
  12249. Set iteration cound mode.
  12250. @item normalized_iteration_count
  12251. set normalized iteration count mode.
  12252. @end table
  12253. Default value is @var{normalized_iteration_count}.
  12254. @item rate, r
  12255. Set frame rate, expressed as number of frames per second. Default
  12256. value is "25".
  12257. @item size, s
  12258. Set frame size. For the syntax of this option, check the "Video
  12259. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12260. @item start_scale
  12261. Set the initial scale value. Default value is 3.0.
  12262. @item start_x
  12263. Set the initial x position. Must be a floating point value between
  12264. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12265. @item start_y
  12266. Set the initial y position. Must be a floating point value between
  12267. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12268. @end table
  12269. @section mptestsrc
  12270. Generate various test patterns, as generated by the MPlayer test filter.
  12271. The size of the generated video is fixed, and is 256x256.
  12272. This source is useful in particular for testing encoding features.
  12273. This source accepts the following options:
  12274. @table @option
  12275. @item rate, r
  12276. Specify the frame rate of the sourced video, as the number of frames
  12277. generated per second. It has to be a string in the format
  12278. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12279. number or a valid video frame rate abbreviation. The default value is
  12280. "25".
  12281. @item duration, d
  12282. Set the duration of the sourced video. See
  12283. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12284. for the accepted syntax.
  12285. If not specified, or the expressed duration is negative, the video is
  12286. supposed to be generated forever.
  12287. @item test, t
  12288. Set the number or the name of the test to perform. Supported tests are:
  12289. @table @option
  12290. @item dc_luma
  12291. @item dc_chroma
  12292. @item freq_luma
  12293. @item freq_chroma
  12294. @item amp_luma
  12295. @item amp_chroma
  12296. @item cbp
  12297. @item mv
  12298. @item ring1
  12299. @item ring2
  12300. @item all
  12301. @end table
  12302. Default value is "all", which will cycle through the list of all tests.
  12303. @end table
  12304. Some examples:
  12305. @example
  12306. mptestsrc=t=dc_luma
  12307. @end example
  12308. will generate a "dc_luma" test pattern.
  12309. @section frei0r_src
  12310. Provide a frei0r source.
  12311. To enable compilation of this filter you need to install the frei0r
  12312. header and configure FFmpeg with @code{--enable-frei0r}.
  12313. This source accepts the following parameters:
  12314. @table @option
  12315. @item size
  12316. The size of the video to generate. For the syntax of this option, check the
  12317. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12318. @item framerate
  12319. The framerate of the generated video. It may be a string of the form
  12320. @var{num}/@var{den} or a frame rate abbreviation.
  12321. @item filter_name
  12322. The name to the frei0r source to load. For more information regarding frei0r and
  12323. how to set the parameters, read the @ref{frei0r} section in the video filters
  12324. documentation.
  12325. @item filter_params
  12326. A '|'-separated list of parameters to pass to the frei0r source.
  12327. @end table
  12328. For example, to generate a frei0r partik0l source with size 200x200
  12329. and frame rate 10 which is overlaid on the overlay filter main input:
  12330. @example
  12331. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12332. @end example
  12333. @section life
  12334. Generate a life pattern.
  12335. This source is based on a generalization of John Conway's life game.
  12336. The sourced input represents a life grid, each pixel represents a cell
  12337. which can be in one of two possible states, alive or dead. Every cell
  12338. interacts with its eight neighbours, which are the cells that are
  12339. horizontally, vertically, or diagonally adjacent.
  12340. At each interaction the grid evolves according to the adopted rule,
  12341. which specifies the number of neighbor alive cells which will make a
  12342. cell stay alive or born. The @option{rule} option allows one to specify
  12343. the rule to adopt.
  12344. This source accepts the following options:
  12345. @table @option
  12346. @item filename, f
  12347. Set the file from which to read the initial grid state. In the file,
  12348. each non-whitespace character is considered an alive cell, and newline
  12349. is used to delimit the end of each row.
  12350. If this option is not specified, the initial grid is generated
  12351. randomly.
  12352. @item rate, r
  12353. Set the video rate, that is the number of frames generated per second.
  12354. Default is 25.
  12355. @item random_fill_ratio, ratio
  12356. Set the random fill ratio for the initial random grid. It is a
  12357. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12358. It is ignored when a file is specified.
  12359. @item random_seed, seed
  12360. Set the seed for filling the initial random grid, must be an integer
  12361. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12362. set to -1, the filter will try to use a good random seed on a best
  12363. effort basis.
  12364. @item rule
  12365. Set the life rule.
  12366. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12367. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12368. @var{NS} specifies the number of alive neighbor cells which make a
  12369. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12370. which make a dead cell to become alive (i.e. to "born").
  12371. "s" and "b" can be used in place of "S" and "B", respectively.
  12372. Alternatively a rule can be specified by an 18-bits integer. The 9
  12373. high order bits are used to encode the next cell state if it is alive
  12374. for each number of neighbor alive cells, the low order bits specify
  12375. the rule for "borning" new cells. Higher order bits encode for an
  12376. higher number of neighbor cells.
  12377. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12378. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12379. Default value is "S23/B3", which is the original Conway's game of life
  12380. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12381. cells, and will born a new cell if there are three alive cells around
  12382. a dead cell.
  12383. @item size, s
  12384. Set the size of the output video. For the syntax of this option, check the
  12385. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12386. If @option{filename} is specified, the size is set by default to the
  12387. same size of the input file. If @option{size} is set, it must contain
  12388. the size specified in the input file, and the initial grid defined in
  12389. that file is centered in the larger resulting area.
  12390. If a filename is not specified, the size value defaults to "320x240"
  12391. (used for a randomly generated initial grid).
  12392. @item stitch
  12393. If set to 1, stitch the left and right grid edges together, and the
  12394. top and bottom edges also. Defaults to 1.
  12395. @item mold
  12396. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12397. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12398. value from 0 to 255.
  12399. @item life_color
  12400. Set the color of living (or new born) cells.
  12401. @item death_color
  12402. Set the color of dead cells. If @option{mold} is set, this is the first color
  12403. used to represent a dead cell.
  12404. @item mold_color
  12405. Set mold color, for definitely dead and moldy cells.
  12406. For the syntax of these 3 color options, check the "Color" section in the
  12407. ffmpeg-utils manual.
  12408. @end table
  12409. @subsection Examples
  12410. @itemize
  12411. @item
  12412. Read a grid from @file{pattern}, and center it on a grid of size
  12413. 300x300 pixels:
  12414. @example
  12415. life=f=pattern:s=300x300
  12416. @end example
  12417. @item
  12418. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12419. @example
  12420. life=ratio=2/3:s=200x200
  12421. @end example
  12422. @item
  12423. Specify a custom rule for evolving a randomly generated grid:
  12424. @example
  12425. life=rule=S14/B34
  12426. @end example
  12427. @item
  12428. Full example with slow death effect (mold) using @command{ffplay}:
  12429. @example
  12430. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12431. @end example
  12432. @end itemize
  12433. @anchor{allrgb}
  12434. @anchor{allyuv}
  12435. @anchor{color}
  12436. @anchor{haldclutsrc}
  12437. @anchor{nullsrc}
  12438. @anchor{rgbtestsrc}
  12439. @anchor{smptebars}
  12440. @anchor{smptehdbars}
  12441. @anchor{testsrc}
  12442. @anchor{testsrc2}
  12443. @anchor{yuvtestsrc}
  12444. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12445. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12446. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12447. The @code{color} source provides an uniformly colored input.
  12448. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12449. @ref{haldclut} filter.
  12450. The @code{nullsrc} source returns unprocessed video frames. It is
  12451. mainly useful to be employed in analysis / debugging tools, or as the
  12452. source for filters which ignore the input data.
  12453. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12454. detecting RGB vs BGR issues. You should see a red, green and blue
  12455. stripe from top to bottom.
  12456. The @code{smptebars} source generates a color bars pattern, based on
  12457. the SMPTE Engineering Guideline EG 1-1990.
  12458. The @code{smptehdbars} source generates a color bars pattern, based on
  12459. the SMPTE RP 219-2002.
  12460. The @code{testsrc} source generates a test video pattern, showing a
  12461. color pattern, a scrolling gradient and a timestamp. This is mainly
  12462. intended for testing purposes.
  12463. The @code{testsrc2} source is similar to testsrc, but supports more
  12464. pixel formats instead of just @code{rgb24}. This allows using it as an
  12465. input for other tests without requiring a format conversion.
  12466. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12467. see a y, cb and cr stripe from top to bottom.
  12468. The sources accept the following parameters:
  12469. @table @option
  12470. @item color, c
  12471. Specify the color of the source, only available in the @code{color}
  12472. source. For the syntax of this option, check the "Color" section in the
  12473. ffmpeg-utils manual.
  12474. @item level
  12475. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12476. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12477. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12478. coded on a @code{1/(N*N)} scale.
  12479. @item size, s
  12480. Specify the size of the sourced video. For the syntax of this option, check the
  12481. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12482. The default value is @code{320x240}.
  12483. This option is not available with the @code{haldclutsrc} filter.
  12484. @item rate, r
  12485. Specify the frame rate of the sourced video, as the number of frames
  12486. generated per second. It has to be a string in the format
  12487. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12488. number or a valid video frame rate abbreviation. The default value is
  12489. "25".
  12490. @item sar
  12491. Set the sample aspect ratio of the sourced video.
  12492. @item duration, d
  12493. Set the duration of the sourced video. See
  12494. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12495. for the accepted syntax.
  12496. If not specified, or the expressed duration is negative, the video is
  12497. supposed to be generated forever.
  12498. @item decimals, n
  12499. Set the number of decimals to show in the timestamp, only available in the
  12500. @code{testsrc} source.
  12501. The displayed timestamp value will correspond to the original
  12502. timestamp value multiplied by the power of 10 of the specified
  12503. value. Default value is 0.
  12504. @end table
  12505. For example the following:
  12506. @example
  12507. testsrc=duration=5.3:size=qcif:rate=10
  12508. @end example
  12509. will generate a video with a duration of 5.3 seconds, with size
  12510. 176x144 and a frame rate of 10 frames per second.
  12511. The following graph description will generate a red source
  12512. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12513. frames per second.
  12514. @example
  12515. color=c=red@@0.2:s=qcif:r=10
  12516. @end example
  12517. If the input content is to be ignored, @code{nullsrc} can be used. The
  12518. following command generates noise in the luminance plane by employing
  12519. the @code{geq} filter:
  12520. @example
  12521. nullsrc=s=256x256, geq=random(1)*255:128:128
  12522. @end example
  12523. @subsection Commands
  12524. The @code{color} source supports the following commands:
  12525. @table @option
  12526. @item c, color
  12527. Set the color of the created image. Accepts the same syntax of the
  12528. corresponding @option{color} option.
  12529. @end table
  12530. @c man end VIDEO SOURCES
  12531. @chapter Video Sinks
  12532. @c man begin VIDEO SINKS
  12533. Below is a description of the currently available video sinks.
  12534. @section buffersink
  12535. Buffer video frames, and make them available to the end of the filter
  12536. graph.
  12537. This sink is mainly intended for programmatic use, in particular
  12538. through the interface defined in @file{libavfilter/buffersink.h}
  12539. or the options system.
  12540. It accepts a pointer to an AVBufferSinkContext structure, which
  12541. defines the incoming buffers' formats, to be passed as the opaque
  12542. parameter to @code{avfilter_init_filter} for initialization.
  12543. @section nullsink
  12544. Null video sink: do absolutely nothing with the input video. It is
  12545. mainly useful as a template and for use in analysis / debugging
  12546. tools.
  12547. @c man end VIDEO SINKS
  12548. @chapter Multimedia Filters
  12549. @c man begin MULTIMEDIA FILTERS
  12550. Below is a description of the currently available multimedia filters.
  12551. @section abitscope
  12552. Convert input audio to a video output, displaying the audio bit scope.
  12553. The filter accepts the following options:
  12554. @table @option
  12555. @item rate, r
  12556. Set frame rate, expressed as number of frames per second. Default
  12557. value is "25".
  12558. @item size, s
  12559. Specify the video size for the output. For the syntax of this option, check the
  12560. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12561. Default value is @code{1024x256}.
  12562. @item colors
  12563. Specify list of colors separated by space or by '|' which will be used to
  12564. draw channels. Unrecognized or missing colors will be replaced
  12565. by white color.
  12566. @end table
  12567. @section ahistogram
  12568. Convert input audio to a video output, displaying the volume histogram.
  12569. The filter accepts the following options:
  12570. @table @option
  12571. @item dmode
  12572. Specify how histogram is calculated.
  12573. It accepts the following values:
  12574. @table @samp
  12575. @item single
  12576. Use single histogram for all channels.
  12577. @item separate
  12578. Use separate histogram for each channel.
  12579. @end table
  12580. Default is @code{single}.
  12581. @item rate, r
  12582. Set frame rate, expressed as number of frames per second. Default
  12583. value is "25".
  12584. @item size, s
  12585. Specify the video size for the output. For the syntax of this option, check the
  12586. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12587. Default value is @code{hd720}.
  12588. @item scale
  12589. Set display scale.
  12590. It accepts the following values:
  12591. @table @samp
  12592. @item log
  12593. logarithmic
  12594. @item sqrt
  12595. square root
  12596. @item cbrt
  12597. cubic root
  12598. @item lin
  12599. linear
  12600. @item rlog
  12601. reverse logarithmic
  12602. @end table
  12603. Default is @code{log}.
  12604. @item ascale
  12605. Set amplitude scale.
  12606. It accepts the following values:
  12607. @table @samp
  12608. @item log
  12609. logarithmic
  12610. @item lin
  12611. linear
  12612. @end table
  12613. Default is @code{log}.
  12614. @item acount
  12615. Set how much frames to accumulate in histogram.
  12616. Defauls is 1. Setting this to -1 accumulates all frames.
  12617. @item rheight
  12618. Set histogram ratio of window height.
  12619. @item slide
  12620. Set sonogram sliding.
  12621. It accepts the following values:
  12622. @table @samp
  12623. @item replace
  12624. replace old rows with new ones.
  12625. @item scroll
  12626. scroll from top to bottom.
  12627. @end table
  12628. Default is @code{replace}.
  12629. @end table
  12630. @section aphasemeter
  12631. Convert input audio to a video output, displaying the audio phase.
  12632. The filter accepts the following options:
  12633. @table @option
  12634. @item rate, r
  12635. Set the output frame rate. Default value is @code{25}.
  12636. @item size, s
  12637. Set the video size for the output. For the syntax of this option, check the
  12638. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12639. Default value is @code{800x400}.
  12640. @item rc
  12641. @item gc
  12642. @item bc
  12643. Specify the red, green, blue contrast. Default values are @code{2},
  12644. @code{7} and @code{1}.
  12645. Allowed range is @code{[0, 255]}.
  12646. @item mpc
  12647. Set color which will be used for drawing median phase. If color is
  12648. @code{none} which is default, no median phase value will be drawn.
  12649. @item video
  12650. Enable video output. Default is enabled.
  12651. @end table
  12652. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12653. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12654. The @code{-1} means left and right channels are completely out of phase and
  12655. @code{1} means channels are in phase.
  12656. @section avectorscope
  12657. Convert input audio to a video output, representing the audio vector
  12658. scope.
  12659. The filter is used to measure the difference between channels of stereo
  12660. audio stream. A monoaural signal, consisting of identical left and right
  12661. signal, results in straight vertical line. Any stereo separation is visible
  12662. as a deviation from this line, creating a Lissajous figure.
  12663. If the straight (or deviation from it) but horizontal line appears this
  12664. indicates that the left and right channels are out of phase.
  12665. The filter accepts the following options:
  12666. @table @option
  12667. @item mode, m
  12668. Set the vectorscope mode.
  12669. Available values are:
  12670. @table @samp
  12671. @item lissajous
  12672. Lissajous rotated by 45 degrees.
  12673. @item lissajous_xy
  12674. Same as above but not rotated.
  12675. @item polar
  12676. Shape resembling half of circle.
  12677. @end table
  12678. Default value is @samp{lissajous}.
  12679. @item size, s
  12680. Set the video size for the output. For the syntax of this option, check the
  12681. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12682. Default value is @code{400x400}.
  12683. @item rate, r
  12684. Set the output frame rate. Default value is @code{25}.
  12685. @item rc
  12686. @item gc
  12687. @item bc
  12688. @item ac
  12689. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12690. @code{160}, @code{80} and @code{255}.
  12691. Allowed range is @code{[0, 255]}.
  12692. @item rf
  12693. @item gf
  12694. @item bf
  12695. @item af
  12696. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12697. @code{10}, @code{5} and @code{5}.
  12698. Allowed range is @code{[0, 255]}.
  12699. @item zoom
  12700. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12701. @item draw
  12702. Set the vectorscope drawing mode.
  12703. Available values are:
  12704. @table @samp
  12705. @item dot
  12706. Draw dot for each sample.
  12707. @item line
  12708. Draw line between previous and current sample.
  12709. @end table
  12710. Default value is @samp{dot}.
  12711. @item scale
  12712. Specify amplitude scale of audio samples.
  12713. Available values are:
  12714. @table @samp
  12715. @item lin
  12716. Linear.
  12717. @item sqrt
  12718. Square root.
  12719. @item cbrt
  12720. Cubic root.
  12721. @item log
  12722. Logarithmic.
  12723. @end table
  12724. @end table
  12725. @subsection Examples
  12726. @itemize
  12727. @item
  12728. Complete example using @command{ffplay}:
  12729. @example
  12730. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12731. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12732. @end example
  12733. @end itemize
  12734. @section bench, abench
  12735. Benchmark part of a filtergraph.
  12736. The filter accepts the following options:
  12737. @table @option
  12738. @item action
  12739. Start or stop a timer.
  12740. Available values are:
  12741. @table @samp
  12742. @item start
  12743. Get the current time, set it as frame metadata (using the key
  12744. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12745. @item stop
  12746. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12747. the input frame metadata to get the time difference. Time difference, average,
  12748. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12749. @code{min}) are then printed. The timestamps are expressed in seconds.
  12750. @end table
  12751. @end table
  12752. @subsection Examples
  12753. @itemize
  12754. @item
  12755. Benchmark @ref{selectivecolor} filter:
  12756. @example
  12757. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12758. @end example
  12759. @end itemize
  12760. @section concat
  12761. Concatenate audio and video streams, joining them together one after the
  12762. other.
  12763. The filter works on segments of synchronized video and audio streams. All
  12764. segments must have the same number of streams of each type, and that will
  12765. also be the number of streams at output.
  12766. The filter accepts the following options:
  12767. @table @option
  12768. @item n
  12769. Set the number of segments. Default is 2.
  12770. @item v
  12771. Set the number of output video streams, that is also the number of video
  12772. streams in each segment. Default is 1.
  12773. @item a
  12774. Set the number of output audio streams, that is also the number of audio
  12775. streams in each segment. Default is 0.
  12776. @item unsafe
  12777. Activate unsafe mode: do not fail if segments have a different format.
  12778. @end table
  12779. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12780. @var{a} audio outputs.
  12781. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12782. segment, in the same order as the outputs, then the inputs for the second
  12783. segment, etc.
  12784. Related streams do not always have exactly the same duration, for various
  12785. reasons including codec frame size or sloppy authoring. For that reason,
  12786. related synchronized streams (e.g. a video and its audio track) should be
  12787. concatenated at once. The concat filter will use the duration of the longest
  12788. stream in each segment (except the last one), and if necessary pad shorter
  12789. audio streams with silence.
  12790. For this filter to work correctly, all segments must start at timestamp 0.
  12791. All corresponding streams must have the same parameters in all segments; the
  12792. filtering system will automatically select a common pixel format for video
  12793. streams, and a common sample format, sample rate and channel layout for
  12794. audio streams, but other settings, such as resolution, must be converted
  12795. explicitly by the user.
  12796. Different frame rates are acceptable but will result in variable frame rate
  12797. at output; be sure to configure the output file to handle it.
  12798. @subsection Examples
  12799. @itemize
  12800. @item
  12801. Concatenate an opening, an episode and an ending, all in bilingual version
  12802. (video in stream 0, audio in streams 1 and 2):
  12803. @example
  12804. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12805. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12806. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12807. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12808. @end example
  12809. @item
  12810. Concatenate two parts, handling audio and video separately, using the
  12811. (a)movie sources, and adjusting the resolution:
  12812. @example
  12813. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12814. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12815. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12816. @end example
  12817. Note that a desync will happen at the stitch if the audio and video streams
  12818. do not have exactly the same duration in the first file.
  12819. @end itemize
  12820. @section drawgraph, adrawgraph
  12821. Draw a graph using input video or audio metadata.
  12822. It accepts the following parameters:
  12823. @table @option
  12824. @item m1
  12825. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12826. @item fg1
  12827. Set 1st foreground color expression.
  12828. @item m2
  12829. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12830. @item fg2
  12831. Set 2nd foreground color expression.
  12832. @item m3
  12833. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12834. @item fg3
  12835. Set 3rd foreground color expression.
  12836. @item m4
  12837. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12838. @item fg4
  12839. Set 4th foreground color expression.
  12840. @item min
  12841. Set minimal value of metadata value.
  12842. @item max
  12843. Set maximal value of metadata value.
  12844. @item bg
  12845. Set graph background color. Default is white.
  12846. @item mode
  12847. Set graph mode.
  12848. Available values for mode is:
  12849. @table @samp
  12850. @item bar
  12851. @item dot
  12852. @item line
  12853. @end table
  12854. Default is @code{line}.
  12855. @item slide
  12856. Set slide mode.
  12857. Available values for slide is:
  12858. @table @samp
  12859. @item frame
  12860. Draw new frame when right border is reached.
  12861. @item replace
  12862. Replace old columns with new ones.
  12863. @item scroll
  12864. Scroll from right to left.
  12865. @item rscroll
  12866. Scroll from left to right.
  12867. @item picture
  12868. Draw single picture.
  12869. @end table
  12870. Default is @code{frame}.
  12871. @item size
  12872. Set size of graph video. For the syntax of this option, check the
  12873. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12874. The default value is @code{900x256}.
  12875. The foreground color expressions can use the following variables:
  12876. @table @option
  12877. @item MIN
  12878. Minimal value of metadata value.
  12879. @item MAX
  12880. Maximal value of metadata value.
  12881. @item VAL
  12882. Current metadata key value.
  12883. @end table
  12884. The color is defined as 0xAABBGGRR.
  12885. @end table
  12886. Example using metadata from @ref{signalstats} filter:
  12887. @example
  12888. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12889. @end example
  12890. Example using metadata from @ref{ebur128} filter:
  12891. @example
  12892. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12893. @end example
  12894. @anchor{ebur128}
  12895. @section ebur128
  12896. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12897. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12898. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12899. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12900. The filter also has a video output (see the @var{video} option) with a real
  12901. time graph to observe the loudness evolution. The graphic contains the logged
  12902. message mentioned above, so it is not printed anymore when this option is set,
  12903. unless the verbose logging is set. The main graphing area contains the
  12904. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12905. the momentary loudness (400 milliseconds).
  12906. More information about the Loudness Recommendation EBU R128 on
  12907. @url{http://tech.ebu.ch/loudness}.
  12908. The filter accepts the following options:
  12909. @table @option
  12910. @item video
  12911. Activate the video output. The audio stream is passed unchanged whether this
  12912. option is set or no. The video stream will be the first output stream if
  12913. activated. Default is @code{0}.
  12914. @item size
  12915. Set the video size. This option is for video only. For the syntax of this
  12916. option, check the
  12917. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12918. Default and minimum resolution is @code{640x480}.
  12919. @item meter
  12920. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12921. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12922. other integer value between this range is allowed.
  12923. @item metadata
  12924. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12925. into 100ms output frames, each of them containing various loudness information
  12926. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12927. Default is @code{0}.
  12928. @item framelog
  12929. Force the frame logging level.
  12930. Available values are:
  12931. @table @samp
  12932. @item info
  12933. information logging level
  12934. @item verbose
  12935. verbose logging level
  12936. @end table
  12937. By default, the logging level is set to @var{info}. If the @option{video} or
  12938. the @option{metadata} options are set, it switches to @var{verbose}.
  12939. @item peak
  12940. Set peak mode(s).
  12941. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12942. values are:
  12943. @table @samp
  12944. @item none
  12945. Disable any peak mode (default).
  12946. @item sample
  12947. Enable sample-peak mode.
  12948. Simple peak mode looking for the higher sample value. It logs a message
  12949. for sample-peak (identified by @code{SPK}).
  12950. @item true
  12951. Enable true-peak mode.
  12952. If enabled, the peak lookup is done on an over-sampled version of the input
  12953. stream for better peak accuracy. It logs a message for true-peak.
  12954. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12955. This mode requires a build with @code{libswresample}.
  12956. @end table
  12957. @item dualmono
  12958. Treat mono input files as "dual mono". If a mono file is intended for playback
  12959. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12960. If set to @code{true}, this option will compensate for this effect.
  12961. Multi-channel input files are not affected by this option.
  12962. @item panlaw
  12963. Set a specific pan law to be used for the measurement of dual mono files.
  12964. This parameter is optional, and has a default value of -3.01dB.
  12965. @end table
  12966. @subsection Examples
  12967. @itemize
  12968. @item
  12969. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12970. @example
  12971. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12972. @end example
  12973. @item
  12974. Run an analysis with @command{ffmpeg}:
  12975. @example
  12976. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12977. @end example
  12978. @end itemize
  12979. @section interleave, ainterleave
  12980. Temporally interleave frames from several inputs.
  12981. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12982. These filters read frames from several inputs and send the oldest
  12983. queued frame to the output.
  12984. Input streams must have well defined, monotonically increasing frame
  12985. timestamp values.
  12986. In order to submit one frame to output, these filters need to enqueue
  12987. at least one frame for each input, so they cannot work in case one
  12988. input is not yet terminated and will not receive incoming frames.
  12989. For example consider the case when one input is a @code{select} filter
  12990. which always drops input frames. The @code{interleave} filter will keep
  12991. reading from that input, but it will never be able to send new frames
  12992. to output until the input sends an end-of-stream signal.
  12993. Also, depending on inputs synchronization, the filters will drop
  12994. frames in case one input receives more frames than the other ones, and
  12995. the queue is already filled.
  12996. These filters accept the following options:
  12997. @table @option
  12998. @item nb_inputs, n
  12999. Set the number of different inputs, it is 2 by default.
  13000. @end table
  13001. @subsection Examples
  13002. @itemize
  13003. @item
  13004. Interleave frames belonging to different streams using @command{ffmpeg}:
  13005. @example
  13006. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13007. @end example
  13008. @item
  13009. Add flickering blur effect:
  13010. @example
  13011. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13012. @end example
  13013. @end itemize
  13014. @section metadata, ametadata
  13015. Manipulate frame metadata.
  13016. This filter accepts the following options:
  13017. @table @option
  13018. @item mode
  13019. Set mode of operation of the filter.
  13020. Can be one of the following:
  13021. @table @samp
  13022. @item select
  13023. If both @code{value} and @code{key} is set, select frames
  13024. which have such metadata. If only @code{key} is set, select
  13025. every frame that has such key in metadata.
  13026. @item add
  13027. Add new metadata @code{key} and @code{value}. If key is already available
  13028. do nothing.
  13029. @item modify
  13030. Modify value of already present key.
  13031. @item delete
  13032. If @code{value} is set, delete only keys that have such value.
  13033. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13034. the frame.
  13035. @item print
  13036. Print key and its value if metadata was found. If @code{key} is not set print all
  13037. metadata values available in frame.
  13038. @end table
  13039. @item key
  13040. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13041. @item value
  13042. Set metadata value which will be used. This option is mandatory for
  13043. @code{modify} and @code{add} mode.
  13044. @item function
  13045. Which function to use when comparing metadata value and @code{value}.
  13046. Can be one of following:
  13047. @table @samp
  13048. @item same_str
  13049. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13050. @item starts_with
  13051. Values are interpreted as strings, returns true if metadata value starts with
  13052. the @code{value} option string.
  13053. @item less
  13054. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13055. @item equal
  13056. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13057. @item greater
  13058. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13059. @item expr
  13060. Values are interpreted as floats, returns true if expression from option @code{expr}
  13061. evaluates to true.
  13062. @end table
  13063. @item expr
  13064. Set expression which is used when @code{function} is set to @code{expr}.
  13065. The expression is evaluated through the eval API and can contain the following
  13066. constants:
  13067. @table @option
  13068. @item VALUE1
  13069. Float representation of @code{value} from metadata key.
  13070. @item VALUE2
  13071. Float representation of @code{value} as supplied by user in @code{value} option.
  13072. @end table
  13073. @item file
  13074. If specified in @code{print} mode, output is written to the named file. Instead of
  13075. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13076. for standard output. If @code{file} option is not set, output is written to the log
  13077. with AV_LOG_INFO loglevel.
  13078. @end table
  13079. @subsection Examples
  13080. @itemize
  13081. @item
  13082. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13083. between 0 and 1.
  13084. @example
  13085. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13086. @end example
  13087. @item
  13088. Print silencedetect output to file @file{metadata.txt}.
  13089. @example
  13090. silencedetect,ametadata=mode=print:file=metadata.txt
  13091. @end example
  13092. @item
  13093. Direct all metadata to a pipe with file descriptor 4.
  13094. @example
  13095. metadata=mode=print:file='pipe\:4'
  13096. @end example
  13097. @end itemize
  13098. @section perms, aperms
  13099. Set read/write permissions for the output frames.
  13100. These filters are mainly aimed at developers to test direct path in the
  13101. following filter in the filtergraph.
  13102. The filters accept the following options:
  13103. @table @option
  13104. @item mode
  13105. Select the permissions mode.
  13106. It accepts the following values:
  13107. @table @samp
  13108. @item none
  13109. Do nothing. This is the default.
  13110. @item ro
  13111. Set all the output frames read-only.
  13112. @item rw
  13113. Set all the output frames directly writable.
  13114. @item toggle
  13115. Make the frame read-only if writable, and writable if read-only.
  13116. @item random
  13117. Set each output frame read-only or writable randomly.
  13118. @end table
  13119. @item seed
  13120. Set the seed for the @var{random} mode, must be an integer included between
  13121. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13122. @code{-1}, the filter will try to use a good random seed on a best effort
  13123. basis.
  13124. @end table
  13125. Note: in case of auto-inserted filter between the permission filter and the
  13126. following one, the permission might not be received as expected in that
  13127. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13128. perms/aperms filter can avoid this problem.
  13129. @section realtime, arealtime
  13130. Slow down filtering to match real time approximatively.
  13131. These filters will pause the filtering for a variable amount of time to
  13132. match the output rate with the input timestamps.
  13133. They are similar to the @option{re} option to @code{ffmpeg}.
  13134. They accept the following options:
  13135. @table @option
  13136. @item limit
  13137. Time limit for the pauses. Any pause longer than that will be considered
  13138. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13139. @end table
  13140. @anchor{select}
  13141. @section select, aselect
  13142. Select frames to pass in output.
  13143. This filter accepts the following options:
  13144. @table @option
  13145. @item expr, e
  13146. Set expression, which is evaluated for each input frame.
  13147. If the expression is evaluated to zero, the frame is discarded.
  13148. If the evaluation result is negative or NaN, the frame is sent to the
  13149. first output; otherwise it is sent to the output with index
  13150. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13151. For example a value of @code{1.2} corresponds to the output with index
  13152. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13153. @item outputs, n
  13154. Set the number of outputs. The output to which to send the selected
  13155. frame is based on the result of the evaluation. Default value is 1.
  13156. @end table
  13157. The expression can contain the following constants:
  13158. @table @option
  13159. @item n
  13160. The (sequential) number of the filtered frame, starting from 0.
  13161. @item selected_n
  13162. The (sequential) number of the selected frame, starting from 0.
  13163. @item prev_selected_n
  13164. The sequential number of the last selected frame. It's NAN if undefined.
  13165. @item TB
  13166. The timebase of the input timestamps.
  13167. @item pts
  13168. The PTS (Presentation TimeStamp) of the filtered video frame,
  13169. expressed in @var{TB} units. It's NAN if undefined.
  13170. @item t
  13171. The PTS of the filtered video frame,
  13172. expressed in seconds. It's NAN if undefined.
  13173. @item prev_pts
  13174. The PTS of the previously filtered video frame. It's NAN if undefined.
  13175. @item prev_selected_pts
  13176. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13177. @item prev_selected_t
  13178. The PTS of the last previously selected video frame. It's NAN if undefined.
  13179. @item start_pts
  13180. The PTS of the first video frame in the video. It's NAN if undefined.
  13181. @item start_t
  13182. The time of the first video frame in the video. It's NAN if undefined.
  13183. @item pict_type @emph{(video only)}
  13184. The type of the filtered frame. It can assume one of the following
  13185. values:
  13186. @table @option
  13187. @item I
  13188. @item P
  13189. @item B
  13190. @item S
  13191. @item SI
  13192. @item SP
  13193. @item BI
  13194. @end table
  13195. @item interlace_type @emph{(video only)}
  13196. The frame interlace type. It can assume one of the following values:
  13197. @table @option
  13198. @item PROGRESSIVE
  13199. The frame is progressive (not interlaced).
  13200. @item TOPFIRST
  13201. The frame is top-field-first.
  13202. @item BOTTOMFIRST
  13203. The frame is bottom-field-first.
  13204. @end table
  13205. @item consumed_sample_n @emph{(audio only)}
  13206. the number of selected samples before the current frame
  13207. @item samples_n @emph{(audio only)}
  13208. the number of samples in the current frame
  13209. @item sample_rate @emph{(audio only)}
  13210. the input sample rate
  13211. @item key
  13212. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13213. @item pos
  13214. the position in the file of the filtered frame, -1 if the information
  13215. is not available (e.g. for synthetic video)
  13216. @item scene @emph{(video only)}
  13217. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13218. probability for the current frame to introduce a new scene, while a higher
  13219. value means the current frame is more likely to be one (see the example below)
  13220. @item concatdec_select
  13221. The concat demuxer can select only part of a concat input file by setting an
  13222. inpoint and an outpoint, but the output packets may not be entirely contained
  13223. in the selected interval. By using this variable, it is possible to skip frames
  13224. generated by the concat demuxer which are not exactly contained in the selected
  13225. interval.
  13226. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13227. and the @var{lavf.concat.duration} packet metadata values which are also
  13228. present in the decoded frames.
  13229. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13230. start_time and either the duration metadata is missing or the frame pts is less
  13231. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13232. missing.
  13233. That basically means that an input frame is selected if its pts is within the
  13234. interval set by the concat demuxer.
  13235. @end table
  13236. The default value of the select expression is "1".
  13237. @subsection Examples
  13238. @itemize
  13239. @item
  13240. Select all frames in input:
  13241. @example
  13242. select
  13243. @end example
  13244. The example above is the same as:
  13245. @example
  13246. select=1
  13247. @end example
  13248. @item
  13249. Skip all frames:
  13250. @example
  13251. select=0
  13252. @end example
  13253. @item
  13254. Select only I-frames:
  13255. @example
  13256. select='eq(pict_type\,I)'
  13257. @end example
  13258. @item
  13259. Select one frame every 100:
  13260. @example
  13261. select='not(mod(n\,100))'
  13262. @end example
  13263. @item
  13264. Select only frames contained in the 10-20 time interval:
  13265. @example
  13266. select=between(t\,10\,20)
  13267. @end example
  13268. @item
  13269. Select only I-frames contained in the 10-20 time interval:
  13270. @example
  13271. select=between(t\,10\,20)*eq(pict_type\,I)
  13272. @end example
  13273. @item
  13274. Select frames with a minimum distance of 10 seconds:
  13275. @example
  13276. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13277. @end example
  13278. @item
  13279. Use aselect to select only audio frames with samples number > 100:
  13280. @example
  13281. aselect='gt(samples_n\,100)'
  13282. @end example
  13283. @item
  13284. Create a mosaic of the first scenes:
  13285. @example
  13286. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13287. @end example
  13288. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13289. choice.
  13290. @item
  13291. Send even and odd frames to separate outputs, and compose them:
  13292. @example
  13293. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13294. @end example
  13295. @item
  13296. Select useful frames from an ffconcat file which is using inpoints and
  13297. outpoints but where the source files are not intra frame only.
  13298. @example
  13299. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13300. @end example
  13301. @end itemize
  13302. @section sendcmd, asendcmd
  13303. Send commands to filters in the filtergraph.
  13304. These filters read commands to be sent to other filters in the
  13305. filtergraph.
  13306. @code{sendcmd} must be inserted between two video filters,
  13307. @code{asendcmd} must be inserted between two audio filters, but apart
  13308. from that they act the same way.
  13309. The specification of commands can be provided in the filter arguments
  13310. with the @var{commands} option, or in a file specified by the
  13311. @var{filename} option.
  13312. These filters accept the following options:
  13313. @table @option
  13314. @item commands, c
  13315. Set the commands to be read and sent to the other filters.
  13316. @item filename, f
  13317. Set the filename of the commands to be read and sent to the other
  13318. filters.
  13319. @end table
  13320. @subsection Commands syntax
  13321. A commands description consists of a sequence of interval
  13322. specifications, comprising a list of commands to be executed when a
  13323. particular event related to that interval occurs. The occurring event
  13324. is typically the current frame time entering or leaving a given time
  13325. interval.
  13326. An interval is specified by the following syntax:
  13327. @example
  13328. @var{START}[-@var{END}] @var{COMMANDS};
  13329. @end example
  13330. The time interval is specified by the @var{START} and @var{END} times.
  13331. @var{END} is optional and defaults to the maximum time.
  13332. The current frame time is considered within the specified interval if
  13333. it is included in the interval [@var{START}, @var{END}), that is when
  13334. the time is greater or equal to @var{START} and is lesser than
  13335. @var{END}.
  13336. @var{COMMANDS} consists of a sequence of one or more command
  13337. specifications, separated by ",", relating to that interval. The
  13338. syntax of a command specification is given by:
  13339. @example
  13340. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13341. @end example
  13342. @var{FLAGS} is optional and specifies the type of events relating to
  13343. the time interval which enable sending the specified command, and must
  13344. be a non-null sequence of identifier flags separated by "+" or "|" and
  13345. enclosed between "[" and "]".
  13346. The following flags are recognized:
  13347. @table @option
  13348. @item enter
  13349. The command is sent when the current frame timestamp enters the
  13350. specified interval. In other words, the command is sent when the
  13351. previous frame timestamp was not in the given interval, and the
  13352. current is.
  13353. @item leave
  13354. The command is sent when the current frame timestamp leaves the
  13355. specified interval. In other words, the command is sent when the
  13356. previous frame timestamp was in the given interval, and the
  13357. current is not.
  13358. @end table
  13359. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13360. assumed.
  13361. @var{TARGET} specifies the target of the command, usually the name of
  13362. the filter class or a specific filter instance name.
  13363. @var{COMMAND} specifies the name of the command for the target filter.
  13364. @var{ARG} is optional and specifies the optional list of argument for
  13365. the given @var{COMMAND}.
  13366. Between one interval specification and another, whitespaces, or
  13367. sequences of characters starting with @code{#} until the end of line,
  13368. are ignored and can be used to annotate comments.
  13369. A simplified BNF description of the commands specification syntax
  13370. follows:
  13371. @example
  13372. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13373. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13374. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13375. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13376. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13377. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13378. @end example
  13379. @subsection Examples
  13380. @itemize
  13381. @item
  13382. Specify audio tempo change at second 4:
  13383. @example
  13384. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13385. @end example
  13386. @item
  13387. Target a specific filter instance:
  13388. @example
  13389. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13390. @end example
  13391. @item
  13392. Specify a list of drawtext and hue commands in a file.
  13393. @example
  13394. # show text in the interval 5-10
  13395. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13396. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13397. # desaturate the image in the interval 15-20
  13398. 15.0-20.0 [enter] hue s 0,
  13399. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13400. [leave] hue s 1,
  13401. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13402. # apply an exponential saturation fade-out effect, starting from time 25
  13403. 25 [enter] hue s exp(25-t)
  13404. @end example
  13405. A filtergraph allowing to read and process the above command list
  13406. stored in a file @file{test.cmd}, can be specified with:
  13407. @example
  13408. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13409. @end example
  13410. @end itemize
  13411. @anchor{setpts}
  13412. @section setpts, asetpts
  13413. Change the PTS (presentation timestamp) of the input frames.
  13414. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13415. This filter accepts the following options:
  13416. @table @option
  13417. @item expr
  13418. The expression which is evaluated for each frame to construct its timestamp.
  13419. @end table
  13420. The expression is evaluated through the eval API and can contain the following
  13421. constants:
  13422. @table @option
  13423. @item FRAME_RATE
  13424. frame rate, only defined for constant frame-rate video
  13425. @item PTS
  13426. The presentation timestamp in input
  13427. @item N
  13428. The count of the input frame for video or the number of consumed samples,
  13429. not including the current frame for audio, starting from 0.
  13430. @item NB_CONSUMED_SAMPLES
  13431. The number of consumed samples, not including the current frame (only
  13432. audio)
  13433. @item NB_SAMPLES, S
  13434. The number of samples in the current frame (only audio)
  13435. @item SAMPLE_RATE, SR
  13436. The audio sample rate.
  13437. @item STARTPTS
  13438. The PTS of the first frame.
  13439. @item STARTT
  13440. the time in seconds of the first frame
  13441. @item INTERLACED
  13442. State whether the current frame is interlaced.
  13443. @item T
  13444. the time in seconds of the current frame
  13445. @item POS
  13446. original position in the file of the frame, or undefined if undefined
  13447. for the current frame
  13448. @item PREV_INPTS
  13449. The previous input PTS.
  13450. @item PREV_INT
  13451. previous input time in seconds
  13452. @item PREV_OUTPTS
  13453. The previous output PTS.
  13454. @item PREV_OUTT
  13455. previous output time in seconds
  13456. @item RTCTIME
  13457. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13458. instead.
  13459. @item RTCSTART
  13460. The wallclock (RTC) time at the start of the movie in microseconds.
  13461. @item TB
  13462. The timebase of the input timestamps.
  13463. @end table
  13464. @subsection Examples
  13465. @itemize
  13466. @item
  13467. Start counting PTS from zero
  13468. @example
  13469. setpts=PTS-STARTPTS
  13470. @end example
  13471. @item
  13472. Apply fast motion effect:
  13473. @example
  13474. setpts=0.5*PTS
  13475. @end example
  13476. @item
  13477. Apply slow motion effect:
  13478. @example
  13479. setpts=2.0*PTS
  13480. @end example
  13481. @item
  13482. Set fixed rate of 25 frames per second:
  13483. @example
  13484. setpts=N/(25*TB)
  13485. @end example
  13486. @item
  13487. Set fixed rate 25 fps with some jitter:
  13488. @example
  13489. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13490. @end example
  13491. @item
  13492. Apply an offset of 10 seconds to the input PTS:
  13493. @example
  13494. setpts=PTS+10/TB
  13495. @end example
  13496. @item
  13497. Generate timestamps from a "live source" and rebase onto the current timebase:
  13498. @example
  13499. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13500. @end example
  13501. @item
  13502. Generate timestamps by counting samples:
  13503. @example
  13504. asetpts=N/SR/TB
  13505. @end example
  13506. @end itemize
  13507. @section settb, asettb
  13508. Set the timebase to use for the output frames timestamps.
  13509. It is mainly useful for testing timebase configuration.
  13510. It accepts the following parameters:
  13511. @table @option
  13512. @item expr, tb
  13513. The expression which is evaluated into the output timebase.
  13514. @end table
  13515. The value for @option{tb} is an arithmetic expression representing a
  13516. rational. The expression can contain the constants "AVTB" (the default
  13517. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13518. audio only). Default value is "intb".
  13519. @subsection Examples
  13520. @itemize
  13521. @item
  13522. Set the timebase to 1/25:
  13523. @example
  13524. settb=expr=1/25
  13525. @end example
  13526. @item
  13527. Set the timebase to 1/10:
  13528. @example
  13529. settb=expr=0.1
  13530. @end example
  13531. @item
  13532. Set the timebase to 1001/1000:
  13533. @example
  13534. settb=1+0.001
  13535. @end example
  13536. @item
  13537. Set the timebase to 2*intb:
  13538. @example
  13539. settb=2*intb
  13540. @end example
  13541. @item
  13542. Set the default timebase value:
  13543. @example
  13544. settb=AVTB
  13545. @end example
  13546. @end itemize
  13547. @section showcqt
  13548. Convert input audio to a video output representing frequency spectrum
  13549. logarithmically using Brown-Puckette constant Q transform algorithm with
  13550. direct frequency domain coefficient calculation (but the transform itself
  13551. is not really constant Q, instead the Q factor is actually variable/clamped),
  13552. with musical tone scale, from E0 to D#10.
  13553. The filter accepts the following options:
  13554. @table @option
  13555. @item size, s
  13556. Specify the video size for the output. It must be even. For the syntax of this option,
  13557. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13558. Default value is @code{1920x1080}.
  13559. @item fps, rate, r
  13560. Set the output frame rate. Default value is @code{25}.
  13561. @item bar_h
  13562. Set the bargraph height. It must be even. Default value is @code{-1} which
  13563. computes the bargraph height automatically.
  13564. @item axis_h
  13565. Set the axis height. It must be even. Default value is @code{-1} which computes
  13566. the axis height automatically.
  13567. @item sono_h
  13568. Set the sonogram height. It must be even. Default value is @code{-1} which
  13569. computes the sonogram height automatically.
  13570. @item fullhd
  13571. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13572. instead. Default value is @code{1}.
  13573. @item sono_v, volume
  13574. Specify the sonogram volume expression. It can contain variables:
  13575. @table @option
  13576. @item bar_v
  13577. the @var{bar_v} evaluated expression
  13578. @item frequency, freq, f
  13579. the frequency where it is evaluated
  13580. @item timeclamp, tc
  13581. the value of @var{timeclamp} option
  13582. @end table
  13583. and functions:
  13584. @table @option
  13585. @item a_weighting(f)
  13586. A-weighting of equal loudness
  13587. @item b_weighting(f)
  13588. B-weighting of equal loudness
  13589. @item c_weighting(f)
  13590. C-weighting of equal loudness.
  13591. @end table
  13592. Default value is @code{16}.
  13593. @item bar_v, volume2
  13594. Specify the bargraph volume expression. It can contain variables:
  13595. @table @option
  13596. @item sono_v
  13597. the @var{sono_v} evaluated expression
  13598. @item frequency, freq, f
  13599. the frequency where it is evaluated
  13600. @item timeclamp, tc
  13601. the value of @var{timeclamp} option
  13602. @end table
  13603. and functions:
  13604. @table @option
  13605. @item a_weighting(f)
  13606. A-weighting of equal loudness
  13607. @item b_weighting(f)
  13608. B-weighting of equal loudness
  13609. @item c_weighting(f)
  13610. C-weighting of equal loudness.
  13611. @end table
  13612. Default value is @code{sono_v}.
  13613. @item sono_g, gamma
  13614. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13615. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13616. Acceptable range is @code{[1, 7]}.
  13617. @item bar_g, gamma2
  13618. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13619. @code{[1, 7]}.
  13620. @item bar_t
  13621. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13622. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13623. @item timeclamp, tc
  13624. Specify the transform timeclamp. At low frequency, there is trade-off between
  13625. accuracy in time domain and frequency domain. If timeclamp is lower,
  13626. event in time domain is represented more accurately (such as fast bass drum),
  13627. otherwise event in frequency domain is represented more accurately
  13628. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13629. @item attack
  13630. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13631. limits future samples by applying asymmetric windowing in time domain, useful
  13632. when low latency is required. Accepted range is @code{[0, 1]}.
  13633. @item basefreq
  13634. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13635. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13636. @item endfreq
  13637. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13638. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13639. @item coeffclamp
  13640. This option is deprecated and ignored.
  13641. @item tlength
  13642. Specify the transform length in time domain. Use this option to control accuracy
  13643. trade-off between time domain and frequency domain at every frequency sample.
  13644. It can contain variables:
  13645. @table @option
  13646. @item frequency, freq, f
  13647. the frequency where it is evaluated
  13648. @item timeclamp, tc
  13649. the value of @var{timeclamp} option.
  13650. @end table
  13651. Default value is @code{384*tc/(384+tc*f)}.
  13652. @item count
  13653. Specify the transform count for every video frame. Default value is @code{6}.
  13654. Acceptable range is @code{[1, 30]}.
  13655. @item fcount
  13656. Specify the transform count for every single pixel. Default value is @code{0},
  13657. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13658. @item fontfile
  13659. Specify font file for use with freetype to draw the axis. If not specified,
  13660. use embedded font. Note that drawing with font file or embedded font is not
  13661. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13662. option instead.
  13663. @item font
  13664. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13665. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13666. @item fontcolor
  13667. Specify font color expression. This is arithmetic expression that should return
  13668. integer value 0xRRGGBB. It can contain variables:
  13669. @table @option
  13670. @item frequency, freq, f
  13671. the frequency where it is evaluated
  13672. @item timeclamp, tc
  13673. the value of @var{timeclamp} option
  13674. @end table
  13675. and functions:
  13676. @table @option
  13677. @item midi(f)
  13678. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13679. @item r(x), g(x), b(x)
  13680. red, green, and blue value of intensity x.
  13681. @end table
  13682. Default value is @code{st(0, (midi(f)-59.5)/12);
  13683. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13684. r(1-ld(1)) + b(ld(1))}.
  13685. @item axisfile
  13686. Specify image file to draw the axis. This option override @var{fontfile} and
  13687. @var{fontcolor} option.
  13688. @item axis, text
  13689. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13690. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13691. Default value is @code{1}.
  13692. @item csp
  13693. Set colorspace. The accepted values are:
  13694. @table @samp
  13695. @item unspecified
  13696. Unspecified (default)
  13697. @item bt709
  13698. BT.709
  13699. @item fcc
  13700. FCC
  13701. @item bt470bg
  13702. BT.470BG or BT.601-6 625
  13703. @item smpte170m
  13704. SMPTE-170M or BT.601-6 525
  13705. @item smpte240m
  13706. SMPTE-240M
  13707. @item bt2020ncl
  13708. BT.2020 with non-constant luminance
  13709. @end table
  13710. @item cscheme
  13711. Set spectrogram color scheme. This is list of floating point values with format
  13712. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13713. The default is @code{1|0.5|0|0|0.5|1}.
  13714. @end table
  13715. @subsection Examples
  13716. @itemize
  13717. @item
  13718. Playing audio while showing the spectrum:
  13719. @example
  13720. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13721. @end example
  13722. @item
  13723. Same as above, but with frame rate 30 fps:
  13724. @example
  13725. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13726. @end example
  13727. @item
  13728. Playing at 1280x720:
  13729. @example
  13730. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13731. @end example
  13732. @item
  13733. Disable sonogram display:
  13734. @example
  13735. sono_h=0
  13736. @end example
  13737. @item
  13738. A1 and its harmonics: A1, A2, (near)E3, A3:
  13739. @example
  13740. 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),
  13741. asplit[a][out1]; [a] showcqt [out0]'
  13742. @end example
  13743. @item
  13744. Same as above, but with more accuracy in frequency domain:
  13745. @example
  13746. 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),
  13747. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13748. @end example
  13749. @item
  13750. Custom volume:
  13751. @example
  13752. bar_v=10:sono_v=bar_v*a_weighting(f)
  13753. @end example
  13754. @item
  13755. Custom gamma, now spectrum is linear to the amplitude.
  13756. @example
  13757. bar_g=2:sono_g=2
  13758. @end example
  13759. @item
  13760. Custom tlength equation:
  13761. @example
  13762. 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)))'
  13763. @end example
  13764. @item
  13765. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13766. @example
  13767. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13768. @end example
  13769. @item
  13770. Custom font using fontconfig:
  13771. @example
  13772. font='Courier New,Monospace,mono|bold'
  13773. @end example
  13774. @item
  13775. Custom frequency range with custom axis using image file:
  13776. @example
  13777. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13778. @end example
  13779. @end itemize
  13780. @section showfreqs
  13781. Convert input audio to video output representing the audio power spectrum.
  13782. Audio amplitude is on Y-axis while frequency is on X-axis.
  13783. The filter accepts the following options:
  13784. @table @option
  13785. @item size, s
  13786. Specify size of video. For the syntax of this option, check the
  13787. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13788. Default is @code{1024x512}.
  13789. @item mode
  13790. Set display mode.
  13791. This set how each frequency bin will be represented.
  13792. It accepts the following values:
  13793. @table @samp
  13794. @item line
  13795. @item bar
  13796. @item dot
  13797. @end table
  13798. Default is @code{bar}.
  13799. @item ascale
  13800. Set amplitude scale.
  13801. It accepts the following values:
  13802. @table @samp
  13803. @item lin
  13804. Linear scale.
  13805. @item sqrt
  13806. Square root scale.
  13807. @item cbrt
  13808. Cubic root scale.
  13809. @item log
  13810. Logarithmic scale.
  13811. @end table
  13812. Default is @code{log}.
  13813. @item fscale
  13814. Set frequency scale.
  13815. It accepts the following values:
  13816. @table @samp
  13817. @item lin
  13818. Linear scale.
  13819. @item log
  13820. Logarithmic scale.
  13821. @item rlog
  13822. Reverse logarithmic scale.
  13823. @end table
  13824. Default is @code{lin}.
  13825. @item win_size
  13826. Set window size.
  13827. It accepts the following values:
  13828. @table @samp
  13829. @item w16
  13830. @item w32
  13831. @item w64
  13832. @item w128
  13833. @item w256
  13834. @item w512
  13835. @item w1024
  13836. @item w2048
  13837. @item w4096
  13838. @item w8192
  13839. @item w16384
  13840. @item w32768
  13841. @item w65536
  13842. @end table
  13843. Default is @code{w2048}
  13844. @item win_func
  13845. Set windowing function.
  13846. It accepts the following values:
  13847. @table @samp
  13848. @item rect
  13849. @item bartlett
  13850. @item hanning
  13851. @item hamming
  13852. @item blackman
  13853. @item welch
  13854. @item flattop
  13855. @item bharris
  13856. @item bnuttall
  13857. @item bhann
  13858. @item sine
  13859. @item nuttall
  13860. @item lanczos
  13861. @item gauss
  13862. @item tukey
  13863. @item dolph
  13864. @item cauchy
  13865. @item parzen
  13866. @item poisson
  13867. @end table
  13868. Default is @code{hanning}.
  13869. @item overlap
  13870. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13871. which means optimal overlap for selected window function will be picked.
  13872. @item averaging
  13873. Set time averaging. Setting this to 0 will display current maximal peaks.
  13874. Default is @code{1}, which means time averaging is disabled.
  13875. @item colors
  13876. Specify list of colors separated by space or by '|' which will be used to
  13877. draw channel frequencies. Unrecognized or missing colors will be replaced
  13878. by white color.
  13879. @item cmode
  13880. Set channel display mode.
  13881. It accepts the following values:
  13882. @table @samp
  13883. @item combined
  13884. @item separate
  13885. @end table
  13886. Default is @code{combined}.
  13887. @item minamp
  13888. Set minimum amplitude used in @code{log} amplitude scaler.
  13889. @end table
  13890. @anchor{showspectrum}
  13891. @section showspectrum
  13892. Convert input audio to a video output, representing the audio frequency
  13893. spectrum.
  13894. The filter accepts the following options:
  13895. @table @option
  13896. @item size, s
  13897. Specify the video size for the output. For the syntax of this option, check the
  13898. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13899. Default value is @code{640x512}.
  13900. @item slide
  13901. Specify how the spectrum should slide along the window.
  13902. It accepts the following values:
  13903. @table @samp
  13904. @item replace
  13905. the samples start again on the left when they reach the right
  13906. @item scroll
  13907. the samples scroll from right to left
  13908. @item fullframe
  13909. frames are only produced when the samples reach the right
  13910. @item rscroll
  13911. the samples scroll from left to right
  13912. @end table
  13913. Default value is @code{replace}.
  13914. @item mode
  13915. Specify display mode.
  13916. It accepts the following values:
  13917. @table @samp
  13918. @item combined
  13919. all channels are displayed in the same row
  13920. @item separate
  13921. all channels are displayed in separate rows
  13922. @end table
  13923. Default value is @samp{combined}.
  13924. @item color
  13925. Specify display color mode.
  13926. It accepts the following values:
  13927. @table @samp
  13928. @item channel
  13929. each channel is displayed in a separate color
  13930. @item intensity
  13931. each channel is displayed using the same color scheme
  13932. @item rainbow
  13933. each channel is displayed using the rainbow color scheme
  13934. @item moreland
  13935. each channel is displayed using the moreland color scheme
  13936. @item nebulae
  13937. each channel is displayed using the nebulae color scheme
  13938. @item fire
  13939. each channel is displayed using the fire color scheme
  13940. @item fiery
  13941. each channel is displayed using the fiery color scheme
  13942. @item fruit
  13943. each channel is displayed using the fruit color scheme
  13944. @item cool
  13945. each channel is displayed using the cool color scheme
  13946. @end table
  13947. Default value is @samp{channel}.
  13948. @item scale
  13949. Specify scale used for calculating intensity color values.
  13950. It accepts the following values:
  13951. @table @samp
  13952. @item lin
  13953. linear
  13954. @item sqrt
  13955. square root, default
  13956. @item cbrt
  13957. cubic root
  13958. @item log
  13959. logarithmic
  13960. @item 4thrt
  13961. 4th root
  13962. @item 5thrt
  13963. 5th root
  13964. @end table
  13965. Default value is @samp{sqrt}.
  13966. @item saturation
  13967. Set saturation modifier for displayed colors. Negative values provide
  13968. alternative color scheme. @code{0} is no saturation at all.
  13969. Saturation must be in [-10.0, 10.0] range.
  13970. Default value is @code{1}.
  13971. @item win_func
  13972. Set window function.
  13973. It accepts the following values:
  13974. @table @samp
  13975. @item rect
  13976. @item bartlett
  13977. @item hann
  13978. @item hanning
  13979. @item hamming
  13980. @item blackman
  13981. @item welch
  13982. @item flattop
  13983. @item bharris
  13984. @item bnuttall
  13985. @item bhann
  13986. @item sine
  13987. @item nuttall
  13988. @item lanczos
  13989. @item gauss
  13990. @item tukey
  13991. @item dolph
  13992. @item cauchy
  13993. @item parzen
  13994. @item poisson
  13995. @end table
  13996. Default value is @code{hann}.
  13997. @item orientation
  13998. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13999. @code{horizontal}. Default is @code{vertical}.
  14000. @item overlap
  14001. Set ratio of overlap window. Default value is @code{0}.
  14002. When value is @code{1} overlap is set to recommended size for specific
  14003. window function currently used.
  14004. @item gain
  14005. Set scale gain for calculating intensity color values.
  14006. Default value is @code{1}.
  14007. @item data
  14008. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14009. @item rotation
  14010. Set color rotation, must be in [-1.0, 1.0] range.
  14011. Default value is @code{0}.
  14012. @end table
  14013. The usage is very similar to the showwaves filter; see the examples in that
  14014. section.
  14015. @subsection Examples
  14016. @itemize
  14017. @item
  14018. Large window with logarithmic color scaling:
  14019. @example
  14020. showspectrum=s=1280x480:scale=log
  14021. @end example
  14022. @item
  14023. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14024. @example
  14025. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14026. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14027. @end example
  14028. @end itemize
  14029. @section showspectrumpic
  14030. Convert input audio to a single video frame, representing the audio frequency
  14031. spectrum.
  14032. The filter accepts the following options:
  14033. @table @option
  14034. @item size, s
  14035. Specify the video size for the output. For the syntax of this option, check the
  14036. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14037. Default value is @code{4096x2048}.
  14038. @item mode
  14039. Specify display mode.
  14040. It accepts the following values:
  14041. @table @samp
  14042. @item combined
  14043. all channels are displayed in the same row
  14044. @item separate
  14045. all channels are displayed in separate rows
  14046. @end table
  14047. Default value is @samp{combined}.
  14048. @item color
  14049. Specify display color mode.
  14050. It accepts the following values:
  14051. @table @samp
  14052. @item channel
  14053. each channel is displayed in a separate color
  14054. @item intensity
  14055. each channel is displayed using the same color scheme
  14056. @item rainbow
  14057. each channel is displayed using the rainbow color scheme
  14058. @item moreland
  14059. each channel is displayed using the moreland color scheme
  14060. @item nebulae
  14061. each channel is displayed using the nebulae color scheme
  14062. @item fire
  14063. each channel is displayed using the fire color scheme
  14064. @item fiery
  14065. each channel is displayed using the fiery color scheme
  14066. @item fruit
  14067. each channel is displayed using the fruit color scheme
  14068. @item cool
  14069. each channel is displayed using the cool color scheme
  14070. @end table
  14071. Default value is @samp{intensity}.
  14072. @item scale
  14073. Specify scale used for calculating intensity color values.
  14074. It accepts the following values:
  14075. @table @samp
  14076. @item lin
  14077. linear
  14078. @item sqrt
  14079. square root, default
  14080. @item cbrt
  14081. cubic root
  14082. @item log
  14083. logarithmic
  14084. @item 4thrt
  14085. 4th root
  14086. @item 5thrt
  14087. 5th root
  14088. @end table
  14089. Default value is @samp{log}.
  14090. @item saturation
  14091. Set saturation modifier for displayed colors. Negative values provide
  14092. alternative color scheme. @code{0} is no saturation at all.
  14093. Saturation must be in [-10.0, 10.0] range.
  14094. Default value is @code{1}.
  14095. @item win_func
  14096. Set window function.
  14097. It accepts the following values:
  14098. @table @samp
  14099. @item rect
  14100. @item bartlett
  14101. @item hann
  14102. @item hanning
  14103. @item hamming
  14104. @item blackman
  14105. @item welch
  14106. @item flattop
  14107. @item bharris
  14108. @item bnuttall
  14109. @item bhann
  14110. @item sine
  14111. @item nuttall
  14112. @item lanczos
  14113. @item gauss
  14114. @item tukey
  14115. @item dolph
  14116. @item cauchy
  14117. @item parzen
  14118. @item poisson
  14119. @end table
  14120. Default value is @code{hann}.
  14121. @item orientation
  14122. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14123. @code{horizontal}. Default is @code{vertical}.
  14124. @item gain
  14125. Set scale gain for calculating intensity color values.
  14126. Default value is @code{1}.
  14127. @item legend
  14128. Draw time and frequency axes and legends. Default is enabled.
  14129. @item rotation
  14130. Set color rotation, must be in [-1.0, 1.0] range.
  14131. Default value is @code{0}.
  14132. @end table
  14133. @subsection Examples
  14134. @itemize
  14135. @item
  14136. Extract an audio spectrogram of a whole audio track
  14137. in a 1024x1024 picture using @command{ffmpeg}:
  14138. @example
  14139. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14140. @end example
  14141. @end itemize
  14142. @section showvolume
  14143. Convert input audio volume to a video output.
  14144. The filter accepts the following options:
  14145. @table @option
  14146. @item rate, r
  14147. Set video rate.
  14148. @item b
  14149. Set border width, allowed range is [0, 5]. Default is 1.
  14150. @item w
  14151. Set channel width, allowed range is [80, 8192]. Default is 400.
  14152. @item h
  14153. Set channel height, allowed range is [1, 900]. Default is 20.
  14154. @item f
  14155. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14156. @item c
  14157. Set volume color expression.
  14158. The expression can use the following variables:
  14159. @table @option
  14160. @item VOLUME
  14161. Current max volume of channel in dB.
  14162. @item PEAK
  14163. Current peak.
  14164. @item CHANNEL
  14165. Current channel number, starting from 0.
  14166. @end table
  14167. @item t
  14168. If set, displays channel names. Default is enabled.
  14169. @item v
  14170. If set, displays volume values. Default is enabled.
  14171. @item o
  14172. Set orientation, can be @code{horizontal} or @code{vertical},
  14173. default is @code{horizontal}.
  14174. @item s
  14175. Set step size, allowed range s [0, 5]. Default is 0, which means
  14176. step is disabled.
  14177. @end table
  14178. @section showwaves
  14179. Convert input audio to a video output, representing the samples waves.
  14180. The filter accepts the following options:
  14181. @table @option
  14182. @item size, s
  14183. Specify the video size for the output. For the syntax of this option, check the
  14184. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14185. Default value is @code{600x240}.
  14186. @item mode
  14187. Set display mode.
  14188. Available values are:
  14189. @table @samp
  14190. @item point
  14191. Draw a point for each sample.
  14192. @item line
  14193. Draw a vertical line for each sample.
  14194. @item p2p
  14195. Draw a point for each sample and a line between them.
  14196. @item cline
  14197. Draw a centered vertical line for each sample.
  14198. @end table
  14199. Default value is @code{point}.
  14200. @item n
  14201. Set the number of samples which are printed on the same column. A
  14202. larger value will decrease the frame rate. Must be a positive
  14203. integer. This option can be set only if the value for @var{rate}
  14204. is not explicitly specified.
  14205. @item rate, r
  14206. Set the (approximate) output frame rate. This is done by setting the
  14207. option @var{n}. Default value is "25".
  14208. @item split_channels
  14209. Set if channels should be drawn separately or overlap. Default value is 0.
  14210. @item colors
  14211. Set colors separated by '|' which are going to be used for drawing of each channel.
  14212. @item scale
  14213. Set amplitude scale.
  14214. Available values are:
  14215. @table @samp
  14216. @item lin
  14217. Linear.
  14218. @item log
  14219. Logarithmic.
  14220. @item sqrt
  14221. Square root.
  14222. @item cbrt
  14223. Cubic root.
  14224. @end table
  14225. Default is linear.
  14226. @end table
  14227. @subsection Examples
  14228. @itemize
  14229. @item
  14230. Output the input file audio and the corresponding video representation
  14231. at the same time:
  14232. @example
  14233. amovie=a.mp3,asplit[out0],showwaves[out1]
  14234. @end example
  14235. @item
  14236. Create a synthetic signal and show it with showwaves, forcing a
  14237. frame rate of 30 frames per second:
  14238. @example
  14239. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14240. @end example
  14241. @end itemize
  14242. @section showwavespic
  14243. Convert input audio to a single video frame, representing the samples waves.
  14244. The filter accepts the following options:
  14245. @table @option
  14246. @item size, s
  14247. Specify the video size for the output. For the syntax of this option, check the
  14248. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14249. Default value is @code{600x240}.
  14250. @item split_channels
  14251. Set if channels should be drawn separately or overlap. Default value is 0.
  14252. @item colors
  14253. Set colors separated by '|' which are going to be used for drawing of each channel.
  14254. @item scale
  14255. Set amplitude scale.
  14256. Available values are:
  14257. @table @samp
  14258. @item lin
  14259. Linear.
  14260. @item log
  14261. Logarithmic.
  14262. @item sqrt
  14263. Square root.
  14264. @item cbrt
  14265. Cubic root.
  14266. @end table
  14267. Default is linear.
  14268. @end table
  14269. @subsection Examples
  14270. @itemize
  14271. @item
  14272. Extract a channel split representation of the wave form of a whole audio track
  14273. in a 1024x800 picture using @command{ffmpeg}:
  14274. @example
  14275. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14276. @end example
  14277. @end itemize
  14278. @section sidedata, asidedata
  14279. Delete frame side data, or select frames based on it.
  14280. This filter accepts the following options:
  14281. @table @option
  14282. @item mode
  14283. Set mode of operation of the filter.
  14284. Can be one of the following:
  14285. @table @samp
  14286. @item select
  14287. Select every frame with side data of @code{type}.
  14288. @item delete
  14289. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14290. data in the frame.
  14291. @end table
  14292. @item type
  14293. Set side data type used with all modes. Must be set for @code{select} mode. For
  14294. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14295. in @file{libavutil/frame.h}. For example, to choose
  14296. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14297. @end table
  14298. @section spectrumsynth
  14299. Sythesize audio from 2 input video spectrums, first input stream represents
  14300. magnitude across time and second represents phase across time.
  14301. The filter will transform from frequency domain as displayed in videos back
  14302. to time domain as presented in audio output.
  14303. This filter is primarily created for reversing processed @ref{showspectrum}
  14304. filter outputs, but can synthesize sound from other spectrograms too.
  14305. But in such case results are going to be poor if the phase data is not
  14306. available, because in such cases phase data need to be recreated, usually
  14307. its just recreated from random noise.
  14308. For best results use gray only output (@code{channel} color mode in
  14309. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14310. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14311. @code{data} option. Inputs videos should generally use @code{fullframe}
  14312. slide mode as that saves resources needed for decoding video.
  14313. The filter accepts the following options:
  14314. @table @option
  14315. @item sample_rate
  14316. Specify sample rate of output audio, the sample rate of audio from which
  14317. spectrum was generated may differ.
  14318. @item channels
  14319. Set number of channels represented in input video spectrums.
  14320. @item scale
  14321. Set scale which was used when generating magnitude input spectrum.
  14322. Can be @code{lin} or @code{log}. Default is @code{log}.
  14323. @item slide
  14324. Set slide which was used when generating inputs spectrums.
  14325. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14326. Default is @code{fullframe}.
  14327. @item win_func
  14328. Set window function used for resynthesis.
  14329. @item overlap
  14330. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14331. which means optimal overlap for selected window function will be picked.
  14332. @item orientation
  14333. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14334. Default is @code{vertical}.
  14335. @end table
  14336. @subsection Examples
  14337. @itemize
  14338. @item
  14339. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14340. then resynthesize videos back to audio with spectrumsynth:
  14341. @example
  14342. 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
  14343. 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
  14344. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14345. @end example
  14346. @end itemize
  14347. @section split, asplit
  14348. Split input into several identical outputs.
  14349. @code{asplit} works with audio input, @code{split} with video.
  14350. The filter accepts a single parameter which specifies the number of outputs. If
  14351. unspecified, it defaults to 2.
  14352. @subsection Examples
  14353. @itemize
  14354. @item
  14355. Create two separate outputs from the same input:
  14356. @example
  14357. [in] split [out0][out1]
  14358. @end example
  14359. @item
  14360. To create 3 or more outputs, you need to specify the number of
  14361. outputs, like in:
  14362. @example
  14363. [in] asplit=3 [out0][out1][out2]
  14364. @end example
  14365. @item
  14366. Create two separate outputs from the same input, one cropped and
  14367. one padded:
  14368. @example
  14369. [in] split [splitout1][splitout2];
  14370. [splitout1] crop=100:100:0:0 [cropout];
  14371. [splitout2] pad=200:200:100:100 [padout];
  14372. @end example
  14373. @item
  14374. Create 5 copies of the input audio with @command{ffmpeg}:
  14375. @example
  14376. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14377. @end example
  14378. @end itemize
  14379. @section zmq, azmq
  14380. Receive commands sent through a libzmq client, and forward them to
  14381. filters in the filtergraph.
  14382. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14383. must be inserted between two video filters, @code{azmq} between two
  14384. audio filters.
  14385. To enable these filters you need to install the libzmq library and
  14386. headers and configure FFmpeg with @code{--enable-libzmq}.
  14387. For more information about libzmq see:
  14388. @url{http://www.zeromq.org/}
  14389. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14390. receives messages sent through a network interface defined by the
  14391. @option{bind_address} option.
  14392. The received message must be in the form:
  14393. @example
  14394. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14395. @end example
  14396. @var{TARGET} specifies the target of the command, usually the name of
  14397. the filter class or a specific filter instance name.
  14398. @var{COMMAND} specifies the name of the command for the target filter.
  14399. @var{ARG} is optional and specifies the optional argument list for the
  14400. given @var{COMMAND}.
  14401. Upon reception, the message is processed and the corresponding command
  14402. is injected into the filtergraph. Depending on the result, the filter
  14403. will send a reply to the client, adopting the format:
  14404. @example
  14405. @var{ERROR_CODE} @var{ERROR_REASON}
  14406. @var{MESSAGE}
  14407. @end example
  14408. @var{MESSAGE} is optional.
  14409. @subsection Examples
  14410. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14411. be used to send commands processed by these filters.
  14412. Consider the following filtergraph generated by @command{ffplay}
  14413. @example
  14414. ffplay -dumpgraph 1 -f lavfi "
  14415. color=s=100x100:c=red [l];
  14416. color=s=100x100:c=blue [r];
  14417. nullsrc=s=200x100, zmq [bg];
  14418. [bg][l] overlay [bg+l];
  14419. [bg+l][r] overlay=x=100 "
  14420. @end example
  14421. To change the color of the left side of the video, the following
  14422. command can be used:
  14423. @example
  14424. echo Parsed_color_0 c yellow | tools/zmqsend
  14425. @end example
  14426. To change the right side:
  14427. @example
  14428. echo Parsed_color_1 c pink | tools/zmqsend
  14429. @end example
  14430. @c man end MULTIMEDIA FILTERS
  14431. @chapter Multimedia Sources
  14432. @c man begin MULTIMEDIA SOURCES
  14433. Below is a description of the currently available multimedia sources.
  14434. @section amovie
  14435. This is the same as @ref{movie} source, except it selects an audio
  14436. stream by default.
  14437. @anchor{movie}
  14438. @section movie
  14439. Read audio and/or video stream(s) from a movie container.
  14440. It accepts the following parameters:
  14441. @table @option
  14442. @item filename
  14443. The name of the resource to read (not necessarily a file; it can also be a
  14444. device or a stream accessed through some protocol).
  14445. @item format_name, f
  14446. Specifies the format assumed for the movie to read, and can be either
  14447. the name of a container or an input device. If not specified, the
  14448. format is guessed from @var{movie_name} or by probing.
  14449. @item seek_point, sp
  14450. Specifies the seek point in seconds. The frames will be output
  14451. starting from this seek point. The parameter is evaluated with
  14452. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14453. postfix. The default value is "0".
  14454. @item streams, s
  14455. Specifies the streams to read. Several streams can be specified,
  14456. separated by "+". The source will then have as many outputs, in the
  14457. same order. The syntax is explained in the ``Stream specifiers''
  14458. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14459. respectively the default (best suited) video and audio stream. Default
  14460. is "dv", or "da" if the filter is called as "amovie".
  14461. @item stream_index, si
  14462. Specifies the index of the video stream to read. If the value is -1,
  14463. the most suitable video stream will be automatically selected. The default
  14464. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14465. audio instead of video.
  14466. @item loop
  14467. Specifies how many times to read the stream in sequence.
  14468. If the value is 0, the stream will be looped infinitely.
  14469. Default value is "1".
  14470. Note that when the movie is looped the source timestamps are not
  14471. changed, so it will generate non monotonically increasing timestamps.
  14472. @item discontinuity
  14473. Specifies the time difference between frames above which the point is
  14474. considered a timestamp discontinuity which is removed by adjusting the later
  14475. timestamps.
  14476. @end table
  14477. It allows overlaying a second video on top of the main input of
  14478. a filtergraph, as shown in this graph:
  14479. @example
  14480. input -----------> deltapts0 --> overlay --> output
  14481. ^
  14482. |
  14483. movie --> scale--> deltapts1 -------+
  14484. @end example
  14485. @subsection Examples
  14486. @itemize
  14487. @item
  14488. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14489. on top of the input labelled "in":
  14490. @example
  14491. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14492. [in] setpts=PTS-STARTPTS [main];
  14493. [main][over] overlay=16:16 [out]
  14494. @end example
  14495. @item
  14496. Read from a video4linux2 device, and overlay it on top of the input
  14497. labelled "in":
  14498. @example
  14499. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14500. [in] setpts=PTS-STARTPTS [main];
  14501. [main][over] overlay=16:16 [out]
  14502. @end example
  14503. @item
  14504. Read the first video stream and the audio stream with id 0x81 from
  14505. dvd.vob; the video is connected to the pad named "video" and the audio is
  14506. connected to the pad named "audio":
  14507. @example
  14508. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14509. @end example
  14510. @end itemize
  14511. @subsection Commands
  14512. Both movie and amovie support the following commands:
  14513. @table @option
  14514. @item seek
  14515. Perform seek using "av_seek_frame".
  14516. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14517. @itemize
  14518. @item
  14519. @var{stream_index}: If stream_index is -1, a default
  14520. stream is selected, and @var{timestamp} is automatically converted
  14521. from AV_TIME_BASE units to the stream specific time_base.
  14522. @item
  14523. @var{timestamp}: Timestamp in AVStream.time_base units
  14524. or, if no stream is specified, in AV_TIME_BASE units.
  14525. @item
  14526. @var{flags}: Flags which select direction and seeking mode.
  14527. @end itemize
  14528. @item get_duration
  14529. Get movie duration in AV_TIME_BASE units.
  14530. @end table
  14531. @c man end MULTIMEDIA SOURCES